:root {
    --bg-top: #0d2d36;
    --bg-bottom: #e9dbc7;
    --phone-edge: rgba(255, 255, 255, 0.08);
    --phone-inner: #f5eee4;
    --card: rgba(255, 251, 245, 0.94);
    --card-strong: #fffdf9;
    --ink: #1c2529;
    --muted: #66757b;
    --line: rgba(28, 37, 41, 0.10);
    --brand: #0f7269;
    --brand-strong: #0a4e49;
    --brand-soft: rgba(15, 114, 105, 0.10);
    --warm: #d88939;
    --warm-soft: #ffe2c1;
    --cool-soft: #daf2ff;
    --success-soft: #dff5ec;
    --danger-soft: #f8dddd;
    --shadow-lg: 0 26px 80px rgba(12, 33, 40, 0.18);
    --shadow-md: 0 16px 34px rgba(12, 33, 40, 0.08);
    --radius-xl: 30px;
    --radius-lg: 22px;
    --radius-md: 18px;
    --radius-sm: 14px;
}

* {
    box-sizing: border-box;
}

[hidden] {
    display: none !important;
}

html,
body {
    width: 100%;
    height: 100%;
    min-height: 100%;
}

body {
    margin: 0;
    font-family: "Trebuchet MS", "Segoe UI", sans-serif;
    color: var(--ink);
    background:
        radial-gradient(circle at top left, rgba(216, 137, 57, 0.22), transparent 28%),
        radial-gradient(circle at 100% 0, rgba(15, 114, 105, 0.28), transparent 30%),
        linear-gradient(180deg, var(--bg-top) 0%, #194450 22%, var(--bg-bottom) 100%);
    overflow: hidden;
    background-color: #12343c;
}

button,
input,
select {
    font: inherit;
}

button {
    border: 0;
    cursor: pointer;
}

button:disabled,
input:disabled,
select:disabled {
    cursor: not-allowed;
    opacity: 0.7;
}

.app-shell {
    position: fixed;
    inset: 0;
    width: 100%;
    height: 100%;
    min-height: 100vh;
    min-height: 100svh;
    min-height: 100dvh;
    padding: 0;
    overflow: hidden;
    background: #12343c;
}

.app-phone {
    width: 100%;
    height: 100%;
    min-height: 100vh;
    min-height: 100svh;
    min-height: 100dvh;
    background:
        radial-gradient(circle at top right, rgba(216, 137, 57, 0.14), transparent 24%),
        linear-gradient(180deg, rgba(255, 255, 255, 0.04), rgba(255, 255, 255, 0.01)),
        linear-gradient(180deg, #fcf7f0 0%, var(--phone-inner) 100%);
    border-radius: 0;
    padding: 0;
    box-shadow: none;
    display: grid;
    grid-template-rows: auto minmax(0, 1fr) auto;
    overflow: hidden;
    background-color: #f5eee4;
}

.app-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: calc(12px + env(safe-area-inset-top, 0px)) 18px 14px;
    background: linear-gradient(180deg, #12343c, #16424b);
}

.brand-lockup {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    color: #f6f2eb;
}

.brand-lockup strong,
.brand-lockup span {
    display: block;
}

.brand-lockup span {
    color: rgba(246, 242, 235, 0.72);
    font-size: 0.82rem;
}

.brand-lockup__badge {
    width: 46px;
    height: 46px;
    border-radius: 14px;
    display: inline-grid;
    place-items: center;
    background: linear-gradient(135deg, var(--warm), #efb26e);
    color: #fff;
    font-weight: 800;
}

.icon-button {
    min-height: 42px;
    padding: 0 14px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.12);
    color: #fff;
}

.app-main {
    background: transparent;
    overflow: hidden;
    display: block;
    min-height: 0;
}

.screen {
    height: 100%;
    overflow-y: auto;
    padding: 18px 16px calc(112px + env(safe-area-inset-bottom, 0px));
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
}

.screen--guest {
    display: grid;
    align-content: center;
    padding-top: 24px;
    padding-bottom: 24px;
}

.screen--app {
    display: block;
}

.app-view {
    display: grid;
    gap: 16px;
}

.hero-card,
.card,
.summary-card {
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
}

.hero-card {
    padding: 22px;
    background:
        radial-gradient(circle at top right, rgba(216, 137, 57, 0.20), transparent 24%),
        linear-gradient(145deg, #14383f, #0e6058);
    color: #fffaf4;
}

.hero-card h1,
.hero-card h2 {
    margin: 10px 0 8px;
    font-family: Georgia, "Times New Roman", serif;
    letter-spacing: -0.04em;
    line-height: 0.98;
}

.hero-card h1 {
    font-size: clamp(2.25rem, 9vw, 3.4rem);
}

.hero-card h2 {
    font-size: clamp(1.8rem, 8vw, 2.8rem);
}

.hero-card p {
    margin: 0;
    color: rgba(255, 250, 244, 0.78);
    line-height: 1.6;
}

.hero-card--logged {
    padding-bottom: 18px;
}

.hero-card--login {
    min-height: 200px;
}

.login-shell {
    width: min(100%, 380px);
    margin: 0 auto;
    display: grid;
    gap: 16px;
}

.hero-card__chips,
.card-chip-row {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-top: 16px;
}

.eyebrow {
    display: inline-flex;
    align-items: center;
    min-height: 30px;
    padding: 0 12px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.14);
    color: #fff;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.card {
    background: var(--card);
    border: 1px solid rgba(28, 37, 41, 0.07);
    padding: 18px;
}

.card--match {
    background: var(--card-strong);
}

.card__header span,
.summary-card small,
.field span {
    display: block;
    color: var(--muted);
    font-size: 0.84rem;
}

.card__header strong,
.summary-card strong,
.stack-row strong {
    display: block;
    margin-top: 6px;
}

.summary-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
}

.match-summary-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
}

.summary-card {
    background: rgba(255, 255, 255, 0.66);
    border: 1px solid rgba(28, 37, 41, 0.06);
    padding: 16px 14px;
}

.summary-card strong {
    font-size: 1.4rem;
    margin-top: 8px;
}

.summary-card span {
    display: block;
    margin-top: 4px;
    color: var(--muted);
    font-size: 0.82rem;
    line-height: 1.45;
}

.summary-tile {
    background: rgba(255, 255, 255, 0.72);
    border: 1px solid rgba(28, 37, 41, 0.06);
    border-radius: 16px;
    padding: 14px 12px;
}

.summary-tile small {
    display: block;
    color: var(--muted);
    font-size: 0.8rem;
}

.summary-tile strong {
    display: block;
    margin-top: 8px;
    font-size: 1.15rem;
}

.summary-tile span {
    display: block;
    margin-top: 6px;
    color: var(--muted);
    font-size: 0.78rem;
    line-height: 1.35;
}

.summary-tile--accent {
    background: rgba(15, 114, 105, 0.10);
    border-color: rgba(15, 114, 105, 0.14);
}

.summary-tile--muted {
    background: rgba(28, 37, 41, 0.05);
    border-color: rgba(28, 37, 41, 0.08);
}

.form-stack {
    display: grid;
    gap: 10px;
    margin-top: 14px;
}

.form-stack--compact {
    gap: 8px;
}

.field {
    display: grid;
    gap: 7px;
}

.field input,
.field select {
    width: 100%;
    min-height: 50px;
    border-radius: 14px;
    border: 1px solid var(--line);
    background: #fbf6ee;
    padding: 12px 14px;
    color: var(--ink);
    outline: none;
}

.field input:focus,
.field select:focus {
    border-color: rgba(15, 114, 105, 0.42);
    box-shadow: 0 0 0 4px rgba(15, 114, 105, 0.10);
}

.field--score input {
    text-align: center;
    font-weight: 800;
    font-size: 1.15rem;
}

.checkbox-field {
    display: flex;
    gap: 10px;
    align-items: flex-start;
    color: var(--muted);
    font-size: 0.92rem;
}

.button {
    min-height: 50px;
    padding: 0 16px;
    border-radius: 16px;
    font-weight: 700;
}

.button--primary {
    background: linear-gradient(135deg, var(--brand), var(--brand-strong));
    color: #fff;
}

.button--soft {
    background: #edf0eb;
    color: var(--ink);
}

.feedback {
    min-height: 44px;
    padding: 12px 14px;
    border-radius: 14px;
    background: #f3ece2;
    color: var(--muted);
    line-height: 1.5;
}

.feedback.is-success {
    background: var(--success-soft);
    color: var(--brand-strong);
}

.feedback.is-error {
    background: var(--danger-soft);
    color: #8a3232;
}

.chip {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 34px;
    padding: 0 12px;
    border-radius: 999px;
    font-size: 0.82rem;
    font-weight: 700;
}

.chip--soft {
    background: #eef3ed;
    color: var(--brand-strong);
}

.chip--warm {
    background: var(--warm-soft);
    color: #8a4d00;
}

.chip--cool {
    background: var(--cool-soft);
    color: #15556f;
}

.chip--success {
    background: var(--success-soft);
    color: var(--brand-strong);
}

.match-list,
.league-bets-list,
.stack-list {
    display: grid;
    gap: 12px;
}

.special-bet-grid {
    display: grid;
    gap: 12px;
}

.match-meta {
    margin-top: 10px;
    color: var(--muted);
    font-size: 0.9rem;
}

.match-bet-panel {
    margin-top: 14px;
}

.team-inline {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
    vertical-align: middle;
    justify-content: center;
}

.team-flag {
    width: 24px;
    height: 24px;
    object-fit: contain;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.92);
    border: 1px solid rgba(28, 37, 41, 0.08);
    flex: 0 0 auto;
    box-shadow: 0 4px 10px rgba(12, 33, 40, 0.08);
}

.score-inline {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
}

.stack-row,
.ranking-item {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 12px;
    align-items: center;
    padding: 12px 14px;
    border-radius: 14px;
    border: 1px solid var(--line);
    background: rgba(255, 255, 255, 0.55);
}

.stack-row--own {
    background: rgba(15, 114, 105, 0.08);
    border-color: rgba(15, 114, 105, 0.16);
}

.stack-row--meta {
    background: rgba(18, 52, 60, 0.06);
}

.stack-row__meta {
    display: grid;
    gap: 8px;
    justify-items: end;
}

.stack-row__points {
    font-size: 0.88rem;
    color: var(--brand-strong);
}

.stack-row span,
.ranking-item span {
    display: block;
    margin-top: 4px;
    color: var(--muted);
    font-size: 0.84rem;
}

.ranking-list {
    display: grid;
    gap: 10px;
}

.ranking-item {
    grid-template-columns: 54px minmax(0, 1fr) auto;
}

.ranking-item--current {
    background: rgba(15, 114, 105, 0.08);
    border-color: rgba(15, 114, 105, 0.18);
}

.hero-card--special {
    background:
        radial-gradient(circle at top right, rgba(255, 255, 255, 0.18), transparent 24%),
        radial-gradient(circle at bottom left, rgba(216, 137, 57, 0.24), transparent 30%),
        linear-gradient(145deg, #214d6a, #0f7269);
}

.special-card {
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.92), rgba(255, 249, 241, 0.98));
    border: 1px solid rgba(28, 37, 41, 0.08);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    overflow: hidden;
}

.special-card__media {
    min-height: 180px;
    display: grid;
    place-items: center;
    padding: 20px;
    background:
        radial-gradient(circle at top, rgba(216, 137, 57, 0.20), transparent 36%),
        linear-gradient(180deg, rgba(18, 52, 60, 0.06), rgba(18, 52, 60, 0.02));
}

.special-card__media img {
    width: 112px;
    height: 112px;
    object-fit: cover;
    border-radius: 26px;
    background: rgba(255, 255, 255, 0.84);
    border: 1px solid rgba(28, 37, 41, 0.08);
    box-shadow: 0 16px 28px rgba(12, 33, 40, 0.12);
}

.special-card__media img.special-card__media--team {
    object-fit: contain;
    padding: 10px;
    border-radius: 28px;
}

.special-card__body {
    padding: 18px;
}

.special-card__body small {
    display: block;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-size: 0.72rem;
}

.special-card__body strong {
    display: block;
    margin-top: 8px;
    font-size: 1.2rem;
}

.special-card__body span {
    display: block;
    margin-top: 6px;
    color: var(--muted);
    line-height: 1.45;
}

.special-card__meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-top: 14px;
}

.trend-up,
.trend-down {
    font-style: normal;
    margin-left: 6px;
    font-weight: 700;
}

.trend-up {
    color: var(--brand);
}

.trend-down {
    color: #9b3b3b;
}

.app-tabbar {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 10px;
    padding: 12px 14px calc(14px + env(safe-area-inset-bottom, 0px));
    background: linear-gradient(180deg, rgba(11, 31, 38, 0.72), rgba(11, 31, 38, 0.94));
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    position: relative;
    z-index: 5;
    min-height: calc(84px + env(safe-area-inset-bottom, 0px));
}

.app-tabbar::after {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    bottom: calc(env(safe-area-inset-bottom, 0px) * -1);
    height: env(safe-area-inset-bottom, 0px);
    background: rgba(11, 31, 38, 0.94);
}

.tabbar-button {
    min-height: 58px;
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.08);
    color: rgba(255, 255, 255, 0.72);
    font-weight: 700;
    display: grid;
    place-items: center;
    gap: 2px;
    padding: 6px 8px;
}

.tabbar-button__icon {
    display: block;
    font-size: 1.2rem;
    line-height: 1;
}

.tabbar-button__label {
    display: block;
    font-size: 0.7rem;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.tabbar-button.is-active {
    background: linear-gradient(135deg, rgba(216, 137, 57, 0.96), rgba(239, 178, 110, 0.94));
    color: #fff;
}

@media (display-mode: standalone) {
    body {
        background: linear-gradient(180deg, #12343c 0%, #f5eee4 30%, #f5eee4 100%);
    }

    .app-shell {
        background: #12343c;
    }
}

@media (min-width: 768px) {
    .app-shell {
        padding: 0;
    }

    .app-phone {
        width: 100%;
        height: 100%;
        min-height: 100vh;
        min-height: 100svh;
        min-height: 100dvh;
    }

    .screen {
        padding: 24px 24px calc(112px + env(safe-area-inset-bottom, 0px));
    }

    .summary-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .match-summary-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .screen--app {
        display: block;
    }

    .app-view {
        max-width: 920px;
        width: 100%;
        margin: 0 auto;
    }
}
