:root {
    --color-primary: #ff8f73;
    --color-primary-deep: #ff704f;
    --color-background: #fff8f0;
    --color-surface: #ffffff;
    --color-surface-soft: #fff3e7;
    --color-text: #4a3f35;
    --color-muted: #d1c7bd;
    --color-muted-strong: #a79787;
    --color-accent: #7bcdba;
    --color-warning: #ffb84d;
    --color-warning-soft: #ffe3b6;
    --color-line: rgba(74, 63, 53, 0.08);
    --font-heading: 'Fredoka', sans-serif;
    --font-body: 'Quicksand', sans-serif;
    --radius-card: 28px;
    --radius-button: 999px;
    --radius-pill: 20px;
    --shadow-soft: 0 18px 45px rgba(255, 143, 115, 0.16);
    --shadow-card: 0 14px 30px rgba(255, 143, 115, 0.1);
}

* {
    box-sizing: border-box;
}

html,
body {
    margin: 0;
    min-height: 100%;
    background:
        radial-gradient(circle at top left, rgba(255, 184, 77, 0.18), transparent 22%),
        radial-gradient(circle at top right, rgba(123, 205, 186, 0.2), transparent 28%),
        linear-gradient(180deg, #fffaf4 0%, var(--color-background) 100%);
    color: var(--color-text);
    font-family: var(--font-body);
}

body {
    min-height: 100vh;
}

button,
input,
textarea {
    font: inherit;
}

button {
    border: 0;
    cursor: pointer;
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    border: 0;
}

.app-shell {
    position: relative;
    min-height: 100dvh;
    padding: 0;
    box-sizing: border-box;
    display: flex;
    justify-content: stretch;
}

.app-bg {
    position: fixed;
    inset: auto auto 10% 0;
    width: 220px;
    height: 220px;
    background: radial-gradient(circle, rgba(255, 184, 77, 0.15), transparent 65%);
    filter: blur(2px);
    pointer-events: none;
}

.app-bg-right {
    left: auto;
    right: 0;
    top: 5%;
    bottom: auto;
    background: radial-gradient(circle, rgba(123, 205, 186, 0.18), transparent 68%);
}

.phone-frame {
    position: relative;
    width: 100%;
    min-height: 100dvh;
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.5), rgba(255, 248, 240, 0.88)),
        var(--color-background);
    overflow-x: hidden;
}

.screen {
    height: 100%;
    min-height: 100dvh;
    padding: 28px 18px 28px;
    display: flex;
    flex-direction: column;
    position: relative;
    overflow: auto;
    -webkit-overflow-scrolling: touch;
}

.screen-home {
    justify-content: space-between;
    overflow: hidden;
    gap: 18px;
}

.screen-topbar {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 20px;
}

.back-button {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.75);
    color: var(--color-text);
    box-shadow: var(--shadow-card);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    flex: 0 0 auto;
}

.back-icon {
    width: 22px;
    height: 22px;
    display: block;
}

.topbar-meta {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
    flex: 1;
}

.title-block h1,
.hero-copy h1,
.checkout-title,
.section-title {
    margin: 0;
    font-family: var(--font-heading);
    font-weight: 600;
    line-height: 1.05;
}

.title-block h1,
.section-title {
    font-size: 28px;
}

.title-block p,
.hero-copy p,
.muted-text,
.helper-text,
.participant-subtitle {
    margin: 0;
    color: var(--color-muted-strong);
}

.hero-stars {
    position: absolute;
    inset: 22px 24px auto;
    display: flex;
    justify-content: space-between;
    font-size: 30px;
    opacity: 0.42;
}

.hero-copy {
    padding-top: 52px;
    text-align: center;
}

.hero-copy h1 {
    font-size: clamp(42px, 11vw, 64px);
    letter-spacing: -0.04em;
}

.hero-copy p {
    margin-top: 18px;
    font-size: 18px;
    line-height: 1.55;
}

.hero-illustration {
    margin: 12px 0;
    height: clamp(220px, 34vh, 340px);
    min-height: 220px;
    flex: 0 0 auto;
    border-radius: 38px;
    background:
        radial-gradient(circle at 72% 35%, rgba(255, 184, 77, 0.28), transparent 20%),
        radial-gradient(circle at 18% 78%, rgba(255, 143, 115, 0.12), transparent 20%),
        linear-gradient(180deg, rgba(255, 255, 255, 0.78), rgba(255, 243, 231, 0.95));
    border: 4px solid rgba(255, 255, 255, 0.88);
    box-shadow: var(--shadow-soft);
    display: grid;
    place-items: center;
    position: relative;
    overflow: hidden;
}

.receipt-shape {
    width: 102px;
    height: 136px;
    background: linear-gradient(180deg, #ffffff, #fdf6ef);
    border-radius: 28px;
    transform: rotate(-10deg);
    box-shadow: 0 20px 30px rgba(111, 77, 43, 0.1);
    position: relative;
}

.receipt-shape::before,
.receipt-shape::after {
    content: '';
    position: absolute;
    left: 18px;
    right: 18px;
    border-radius: 999px;
    background: rgba(209, 199, 189, 0.38);
}

.receipt-shape::before {
    top: 34px;
    height: 10px;
    box-shadow:
        0 22px 0 rgba(209, 199, 189, 0.28),
        0 44px 0 rgba(209, 199, 189, 0.2);
}

.coin {
    position: absolute;
    display: grid;
    place-items: center;
    border-radius: 50%;
    font-family: var(--font-heading);
    color: #ae7a00;
    box-shadow: 0 14px 25px rgba(234, 188, 74, 0.28);
}

.coin-large {
    width: 82px;
    height: 82px;
    background: #ffca28;
    border: 4px solid #ffd95d;
    right: 78px;
    bottom: 66px;
    font-size: 36px;
}

.coin-small {
    width: 52px;
    height: 52px;
    background: #ff7857;
    border: 3px solid #ff956f;
    right: 36px;
    bottom: 112px;
    color: #fff;
    font-size: 20px;
}

.screen-actions {
    display: flex;
    flex-direction: column;
    gap: 16px;
    margin-top: 0;
}

.primary-button,
.secondary-button,
.ghost-button {
    min-height: 62px;
    padding: 16px 22px;
    border-radius: var(--radius-button);
    font-family: var(--font-heading);
    font-size: 22px;
    font-weight: 500;
    transition: transform 0.18s ease, box-shadow 0.18s ease, opacity 0.18s ease;
}

.primary-button {
    background: linear-gradient(135deg, var(--color-primary), var(--color-primary-deep));
    color: #fff;
    box-shadow: var(--shadow-soft);
}

.secondary-button {
    background: rgba(255, 255, 255, 0.78);
    color: var(--color-text);
}

.ghost-button {
    background: rgba(255, 143, 115, 0.13);
    color: var(--color-primary-deep);
    min-height: 52px;
    font-size: 18px;
}

.primary-button:disabled,
.secondary-button:disabled,
.ghost-button:disabled {
    opacity: 0.55;
    cursor: default;
}

.helper-link {
    text-align: center;
    color: var(--color-muted-strong);
    text-decoration: none;
    font-size: 17px;
}

.card {
    background: rgba(255, 255, 255, 0.88);
    border-radius: var(--radius-card);
    box-shadow: var(--shadow-card);
    border: 1px solid rgba(255, 255, 255, 0.85);
}

.qr-card {
    width: min(100%, 254px);
    aspect-ratio: 1;
    margin: 24px auto;
    padding: 26px;
    background: linear-gradient(180deg, #ff825f, #ff8f73);
    display: grid;
    place-items: center;
    box-shadow: var(--shadow-soft);
}

.qr-inner {
    width: 100%;
    height: 100%;
    background: #fff5eb;
    border-radius: 26px;
    display: grid;
    place-items: center;
}

.qr-inner canvas,
.qr-inner img {
    width: 100% !important;
    height: auto !important;
    max-width: 180px;
}

.identity-stack {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
}

.avatar-button,
.avatar-badge {
    width: 76px;
    height: 76px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    font-size: 34px;
    box-shadow: var(--shadow-soft);
}

.avatar-button {
    background: var(--avatar-color, var(--color-accent));
    color: #1a1a1a;
}

.name-input {
    width: 100%;
    max-width: 270px;
    background: transparent;
    border: 0;
    border-bottom: 2px solid rgba(209, 199, 189, 0.55);
    text-align: center;
    font-size: 24px;
    font-weight: 700;
    color: var(--color-text);
    padding: 0 8px 12px;
}

.name-input:focus {
    outline: none;
    border-bottom-color: var(--color-primary);
}

.status-pill,
.empty-card,
.loading-card {
    padding: 18px 22px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.88);
    box-shadow: var(--shadow-card);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
}

.status-dots {
    display: inline-flex;
    gap: 6px;
}

.status-dots span {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--color-primary-deep);
    animation: bounce 1s infinite ease-in-out;
}

.status-dots span:nth-child(2) {
    animation-delay: 0.12s;
}

.status-dots span:nth-child(3) {
    animation-delay: 0.24s;
}

@keyframes bounce {
    0%, 80%, 100% {
        transform: translateY(0);
        opacity: 0.4;
    }
    40% {
        transform: translateY(-5px);
        opacity: 1;
    }
}

.workspace {
    padding: 0 0 20px;
}

.sticky-top {
    position: sticky;
    top: 0;
    z-index: 4;
    padding: 22px 16px 0;
    background: linear-gradient(180deg, rgba(255, 248, 240, 0.98), rgba(255, 248, 240, 0.92), rgba(255, 248, 240, 0));
}

.warning-banner {
    margin-top: 18px;
    padding: 14px 18px;
    border-radius: 18px;
    background: linear-gradient(180deg, #ffc96b, var(--color-warning));
    color: #5e4721;
    font-family: var(--font-heading);
    font-size: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    box-shadow: 0 10px 24px rgba(255, 184, 77, 0.32);
}

.claim-hint {
    margin-top: 12px;
    text-align: center;
    color: var(--color-muted-strong);
    font-size: 14px;
}

.workspace-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
    padding: 20px 10px 152px;
}

.item-card {
    padding: 20px 18px;
    display: flex;
    flex-direction: column;
    gap: 14px;
    transition: transform 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease;
}

.item-card.claimed {
    border: 2px solid var(--color-primary);
    box-shadow: var(--shadow-soft);
}

.item-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
}

.item-side {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 0 0 auto;
}

.item-main h3,
.participant-name {
    margin: 0;
    font-size: 18px;
    font-weight: 700;
}

.item-main p {
    margin: 6px 0 0;
    color: var(--color-muted-strong);
}

.item-split-label {
    margin-top: 8px;
    color: var(--color-accent);
    font-weight: 700;
}

.item-price {
    font-family: var(--font-heading);
    font-size: 20px;
    white-space: nowrap;
}

.item-meta-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.item-status {
    padding: 8px 12px;
    border-radius: 999px;
    background: rgba(123, 205, 186, 0.18);
    color: #4d8f80;
    font-size: 14px;
    font-weight: 700;
}

.item-status.is-empty {
    background: rgba(255, 184, 77, 0.22);
    color: #8f6420;
}

.avatar-stack {
    display: inline-flex;
    align-items: center;
    margin-right: 4px;
}

.avatar-mini {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    border: 2px solid #fff;
    margin-left: -10px;
    font-size: 16px;
}

.avatar-stack .avatar-mini:first-child {
    margin-left: 0;
}

.claim-icon-button {
    width: 46px;
    height: 46px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    background: rgba(255, 255, 255, 0.92);
    color: var(--color-primary-deep);
    box-shadow: inset 0 0 0 2px rgba(209, 199, 189, 0.85);
    border: 2px dashed rgba(209, 199, 189, 0.95);
    flex: 0 0 auto;
    font-size: 19px;
    font-weight: 700;
}

.claim-icon-button.is-active {
    background: linear-gradient(135deg, var(--color-primary), var(--color-primary-deep));
    color: #fff;
    border-style: solid;
    border-color: rgba(255, 255, 255, 0.96);
    box-shadow: var(--shadow-soft);
}

.claim-icon {
    width: 20px;
    height: 20px;
    display: block;
}

.workspace-footer {
    position: sticky;
    bottom: 0;
    z-index: 5;
    margin-top: auto;
    padding: 0 10px 22px;
    background: linear-gradient(180deg, rgba(255, 248, 240, 0), rgba(255, 248, 240, 0.96) 28%, rgba(255, 248, 240, 1) 100%);
}

.footer-card {
    padding: 20px 18px 18px;
}

.footer-grid {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 20px;
    margin-bottom: 16px;
    align-items: end;
}

.footer-label {
    display: block;
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 0.03em;
    text-transform: uppercase;
    color: var(--color-muted-strong);
    margin-bottom: 6px;
}

.footer-total {
    font-family: var(--font-heading);
    font-size: 24px;
}

.section-block {
    display: flex;
    flex-direction: column;
    gap: 18px;
    margin-top: 14px;
}

.summary-card {
    padding: 30px 24px;
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.95), rgba(255, 244, 234, 0.94)),
        var(--color-surface);
}

.summary-card .amount-caption {
    text-align: center;
    color: var(--color-muted-strong);
    font-size: 18px;
}

.summary-card .amount-value {
    margin: 14px 0 20px;
    text-align: center;
    font-family: var(--font-heading);
    font-size: 54px;
    color: var(--color-primary);
    letter-spacing: -0.04em;
}

.summary-divider {
    border-top: 2px dashed rgba(209, 199, 189, 0.55);
    margin: 20px 0;
}

.inline-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.bizum-box {
    margin-top: 14px;
    display: flex;
    align-items: center;
    gap: 12px;
    background: rgba(255, 243, 231, 0.85);
    padding: 12px;
    border-radius: 22px;
}

.bizum-number {
    flex: 1;
    font-size: 18px;
    font-weight: 700;
    letter-spacing: 0.04em;
}

.tip-card,
.participants-card {
    padding: 22px 20px;
}

.tip-card h3,
.participants-card h3 {
    margin: 0 0 16px;
    font-family: var(--font-heading);
    font-size: 24px;
}

.range-wrap {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.tip-output {
    font-family: var(--font-heading);
    font-size: 28px;
    color: var(--color-primary);
}

input[type="range"] {
    width: 100%;
    accent-color: var(--color-primary);
}

.range-labels {
    display: flex;
    justify-content: space-between;
    color: var(--color-muted-strong);
    font-size: 14px;
    font-weight: 700;
}

.participant-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.participant-row {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 12px 0;
}

.participant-row + .participant-row {
    border-top: 1px solid var(--color-line);
}

.participant-meta {
    flex: 1;
    min-width: 0;
}

.participant-amount {
    color: var(--color-muted-strong);
    font-size: 14px;
    margin-top: 4px;
}

.status-badge {
    padding: 8px 12px;
    border-radius: 999px;
    font-size: 13px;
    font-weight: 700;
    text-transform: uppercase;
}

.status-badge.pending {
    color: var(--color-muted-strong);
    background: rgba(209, 199, 189, 0.18);
}

.status-badge.paid {
    color: #3b9f8a;
    background: rgba(123, 205, 186, 0.2);
}

.empty-card,
.loading-card {
    text-align: center;
    justify-content: center;
}

.empty-card {
    min-height: 180px;
    border-radius: var(--radius-card);
    flex-direction: column;
    gap: 12px;
}

.toast {
    position: fixed;
    left: 50%;
    bottom: 28px;
    transform: translateX(-50%) translateY(24px);
    background: rgba(74, 63, 53, 0.92);
    color: #fff;
    padding: 12px 18px;
    border-radius: 999px;
    font-weight: 700;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.22s ease, transform 0.22s ease;
    z-index: 30;
}

.toast.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

.loading-overlay {
    position: absolute;
    inset: 0;
    background: rgba(255, 248, 240, 0.68);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
}

.spinner {
    width: 54px;
    height: 54px;
    border-radius: 50%;
    border: 4px solid rgba(255, 143, 115, 0.2);
    border-top-color: var(--color-primary);
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

@media (max-width: 420px) {
    .screen {
        padding: 24px 14px 24px;
    }

    .sticky-top,
    .workspace-footer,
    .workspace-list {
        padding-left: 8px;
        padding-right: 8px;
    }

    .hero-copy h1 {
        font-size: 50px;
    }

    .hero-copy p {
        font-size: 17px;
    }

    .hero-illustration {
        border-radius: 32px;
    }

    .summary-card .amount-value {
        font-size: 46px;
    }

    .item-side {
        gap: 10px;
    }
}
