:root {
    --black: #080808;
    --panel: #151515;
    --panel-soft: #1f1f1f;
    --gold: #d5a93b;
    --gold-soft: #f4d77b;
    --white: #ffffff;
    --muted: #b8b8b8;
    --danger: #ff6b6b;
    --success: #75d99c;
    --radius: 8px;
}

:root[data-theme="green"] {
    --gold: #42c57a;
    --gold-soft: #9df0bd;
}

:root[data-theme="blue"] {
    --gold: #5da8ff;
    --gold-soft: #a8d1ff;
}

:root[data-theme="light"] {
    --black: #f4f2ec;
    --panel: #ffffff;
    --panel-soft: #f0ede5;
    --white: #111111;
    --muted: #5d5d5d;
    --gold: #c79a24;
    --gold-soft: #8a650c;
}

* { box-sizing: border-box; }

[hidden] {
    display: none !important;
}

body {
    margin: 0;
    min-height: 100vh;
    background: var(--black);
    color: var(--white);
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

a { color: inherit; text-decoration: none; }

.topbar {
    position: sticky;
    top: 0;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 14px 18px;
    background: rgba(8, 8, 8, .92);
    border-bottom: 1px solid rgba(213, 169, 59, .22);
    backdrop-filter: blur(12px);
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    font-weight: 800;
}

.topbar-logout {
    margin: 0;
}

.brand-logo {
    width: 58px;
    height: 58px;
    object-fit: contain;
    border-radius: 50%;
    background: var(--gold);
}

.auth-intro {
    display: grid;
    justify-items: center;
    text-align: center;
}

.auth-logo {
    width: min(260px, 68vw);
    height: auto;
    margin: 0 auto 18px;
    object-fit: contain;
}

.user-name-with-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    vertical-align: middle;
}

.supporter-badge {
    width: 24px;
    height: 24px;
    flex: 0 0 auto;
    object-fit: contain;
}

.tabs {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1px;
    background: rgba(255,255,255,.08);
    border-bottom: 1px solid rgba(255,255,255,.08);
}

.tabs a {
    padding: 12px 8px;
    text-align: center;
    color: var(--muted);
    background: var(--black);
    font-size: 13px;
}

.tabs a:hover { color: var(--gold-soft); }

.bottom-tabs {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 20;
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 1px;
    border-top: 1px solid rgba(213, 169, 59, .22);
    background: rgba(255,255,255,.08);
}

.bottom-tabs a,
.bottom-tabs button {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 58px;
    border: 0;
    border-radius: 0;
    padding: 8px 4px;
    color: var(--muted);
    background: var(--black);
    font-size: 12px;
    font-weight: 800;
}

.bottom-tabs a:hover,
.bottom-tabs button:hover {
    color: var(--gold-soft);
}

.bottom-tabs a.active {
    color: var(--gold-soft);
    box-shadow: inset 0 3px 0 var(--gold);
}

.subtabs {
    display: flex;
    gap: 8px;
    margin: 0 0 18px;
    overflow-x: auto;
}

.subtabs a {
    flex: 0 0 auto;
    border: 1px solid rgba(255,255,255,.14);
    border-radius: var(--radius);
    padding: 10px 12px;
    color: var(--muted);
    font-size: 14px;
    font-weight: 800;
}

.subtabs a.active {
    color: var(--black);
    border-color: var(--gold);
    background: var(--gold);
}

.shell {
    width: min(1120px, 100%);
    margin: 0 auto;
    padding: 22px 16px 96px;
}

.hero, .auth-panel {
    position: relative;
    display: grid;
    gap: 22px;
    align-items: center;
    min-height: 50vh;
    padding: 28px 0;
}

.hero {
    min-height: 42vh;
}

.hero-subtitle {
    margin-top: -4px;
    color: var(--gold-soft);
    font-size: 18px;
    font-weight: 900;
}

.hero .hero-edition {
    font-size: clamp(38px, 12vw, 84px);
    line-height: .92;
}

.dashboard-edition-title {
    display: inline-flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 14px;
}

.dashboard-supporter-badge {
    display: inline-flex;
    align-items: center;
}

.dashboard-supporter-badge .supporter-badge {
    width: clamp(52px, 12vw, 88px);
    height: clamp(52px, 12vw, 88px);
}

.hero .welcome-title {
    font-size: clamp(24px, 5vw, 38px);
}

.hero h1, .auth-panel h1, .page-title h1, h1 {
    margin: 0 0 10px;
    font-size: clamp(30px, 7vw, 58px);
    line-height: 1;
}

h2 { margin: 0 0 12px; font-size: 20px; }
h3 { margin: 0 0 12px; font-size: 16px; }
p { color: var(--muted); line-height: 1.55; }

.eyebrow {
    margin: 0 0 10px;
    color: var(--gold-soft);
    font-size: 12px;
    font-weight: 800;
    letter-spacing: 0;
    text-transform: uppercase;
}

.grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 14px;
}

.card {
    border: 1px solid rgba(213, 169, 59, .24);
    border-radius: var(--radius);
    padding: 18px;
    background: var(--panel);
    box-shadow: 0 18px 60px rgba(0,0,0,.24);
}

.form {
    display: grid;
    gap: 14px;
}

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

.choice-option {
    display: flex;
    align-items: center;
    gap: 10px;
    border: 1px solid rgba(213,169,59,.24);
    border-radius: var(--radius);
    padding: 12px;
    background: rgba(255,255,255,.04);
    cursor: pointer;
}

.choice-option input {
    width: auto;
}

.choice-option span {
    font-weight: 800;
}

.form-hint {
    margin: -4px 0 0;
    color: var(--muted);
    font-size: 13px;
}

.group-rename-form {
    display: grid;
    gap: 10px;
    margin: 14px 0;
    padding-top: 14px;
    border-top: 1px solid rgba(255,255,255,.08);
}

.form-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 14px;
}

.phone-field-row {
    display: grid;
    grid-template-columns: 1fr;
    gap: 14px;
}

label {
    display: grid;
    gap: 7px;
    color: var(--muted);
    font-size: 14px;
}

input, select {
    width: 100%;
    min-height: 44px;
    border: 1px solid rgba(255,255,255,.12);
    border-radius: var(--radius);
    padding: 10px 12px;
    color: var(--white);
    background: var(--panel-soft);
}

.button, button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 42px;
    border: 1px solid rgba(213,169,59,.45);
    border-radius: var(--radius);
    padding: 10px 14px;
    color: var(--white);
    background: transparent;
    font-weight: 800;
    cursor: pointer;
}

.button.primary {
    color: var(--black);
    background: linear-gradient(135deg, var(--gold), var(--gold-soft));
}

.button.success {
    border-color: var(--success);
    color: var(--black);
    background: linear-gradient(135deg, #16c767, #75d99c);
}

.button.danger {
    border-color: rgba(255, 107, 107, .75);
    color: #ffffff;
    background: rgba(255, 107, 107, .18);
}

.button.ghost { border-color: rgba(255,255,255,.16); }
.button:disabled { opacity: .45; cursor: not-allowed; }

.actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.hero-primary-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
    width: min(520px, 100%);
}

.hero-primary-actions .button,
.hero-secondary-actions .button {
    width: 100%;
}

.hero-secondary-actions {
    width: min(520px, 100%);
}

.page-title {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 18px;
}

.compact-title {
    margin-bottom: 0;
}

.narrow { max-width: 620px; margin: 0 auto; }
.code { color: var(--gold-soft); font-size: 24px; font-weight: 900; }

.edition-picker {
    max-width: 360px;
}

.section-block {
    display: grid;
    gap: 12px;
    margin-bottom: 22px;
}

.groups-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 12px;
}

.group-card {
    padding: 14px;
}

.active-filter {
    border-color: var(--gold-soft);
}

.group-title {
    display: block;
}

.mini-table {
    min-width: 0;
}

.mini-table th,
.mini-table td {
    padding: 9px 0;
}

.mini-table th:not(:first-child),
.mini-table td:not(:first-child) {
    padding-left: 10px;
}

.standings-grid {
    align-items: start;
}

.standings-table th,
.standings-table td {
    font-size: 13px;
}

.qualified-row {
    background: rgba(117, 217, 156, .12);
}

.team-link,
.match-link {
    display: inline-flex;
    align-items: center;
    gap: 7px;
}

.link-button {
    min-height: auto;
    border: 0;
    padding: 0;
    color: inherit;
    background: transparent;
    font: inherit;
    text-align: left;
}

.link-button:disabled {
    cursor: default;
    opacity: 1;
}

.flag {
    display: inline-flex;
    min-width: 22px;
    justify-content: center;
}

.compact-button {
    min-height: 34px;
    padding: 6px 10px;
}

.selected-game-row {
    background: rgba(213, 169, 59, .09);
}

.prediction-row td {
    background: rgba(255,255,255,.035);
}

.modal-row {
    display: none;
}

.modal {
    display: none;
}

.modal.is-open {
    position: fixed;
    inset: 0;
    z-index: 100;
    display: grid;
    place-items: center;
    padding: 18px;
}

.modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,.72);
}

.modal-panel {
    position: relative;
    z-index: 1;
    width: min(620px, 100%);
    max-height: min(760px, calc(100vh - 36px));
    overflow: auto;
    border: 1px solid rgba(213, 169, 59, .38);
    border-radius: var(--radius);
    padding: 18px;
    background: var(--panel);
    box-shadow: 0 24px 90px rgba(0,0,0,.55);
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 16px;
}

.modal-header h2 {
    margin: 0;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    border-top: 1px solid rgba(255,255,255,.1);
    margin-top: 18px;
    padding-top: 14px;
}

.modal-open {
    overflow: hidden;
}

.onboarding-step {
    min-height: 188px;
}

.onboarding-step h3 {
    color: var(--white);
    font-size: 26px;
}

.onboarding-step p {
    font-size: 16px;
}

.onboarding-target {
    position: relative;
    z-index: 25;
    scroll-margin-top: 120px;
    box-shadow: 0 0 0 3px rgba(213, 169, 59, .85), 0 0 0 12px rgba(213, 169, 59, .16);
    border-radius: calc(var(--radius) + 2px);
    transition: box-shadow .2s ease;
}

.onboarding-footer {
    justify-content: space-between;
}

.onboarding-footer [data-onboarding-next],
.onboarding-footer [data-onboarding-finish] {
    margin-left: auto;
}

.score-rules {
    display: grid;
    gap: 10px;
}

.prediction-insights {
    display: grid;
    gap: 8px;
    border-top: 1px solid rgba(255,255,255,.1);
    margin-top: 18px;
    padding-top: 14px;
}

.prediction-insights-summary {
    margin-bottom: 12px;
    color: var(--gold-soft);
    font-size: 15px;
    font-weight: 800;
}

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

.prediction-insights-list article {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    border: 1px solid rgba(213,169,59,.22);
    border-radius: var(--radius);
    padding: 12px;
    background: rgba(255,255,255,.04);
}

.prediction-insights-list strong {
    color: var(--white);
    font-size: 18px;
}

.prediction-insights-list span {
    color: var(--muted);
    font-weight: 800;
}

.score-rules article {
    display: grid;
    grid-template-columns: minmax(92px, auto) 1fr;
    gap: 12px;
    align-items: center;
    border: 1px solid rgba(213,169,59,.22);
    border-radius: var(--radius);
    padding: 12px;
    background: rgba(255,255,255,.04);
}

.score-rules strong {
    color: var(--gold-soft);
    font-size: 18px;
}

.score-rules span {
    color: var(--muted);
    line-height: 1.45;
}

.config-section {
    border-top: 1px solid rgba(255,255,255,.1);
    padding-top: 14px;
    margin-top: 14px;
}

.config-profile-section {
    display: grid;
    gap: 10px;
}

.config-profile-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
}

.config-profile-row p {
    margin-bottom: 0;
}

.config-profile-row .button {
    flex: 0 0 auto;
}

.config-language-form {
    display: flex;
    align-items: flex-end;
    gap: 10px;
}

.config-language-form label {
    flex: 1 1 auto;
    margin-bottom: 0;
}

.config-language-form .button {
    flex: 0 0 auto;
}

.theme-options {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 8px;
}

.theme-options button {
    min-height: 38px;
    padding: 7px 8px;
}

.theme-options [data-theme="classic"] {
    border-color: rgba(213, 169, 59, .8);
    color: #16120a;
    background: linear-gradient(135deg, #d5a93b, #f5d77b);
}

.theme-options [data-theme="green"] {
    border-color: rgba(38, 166, 91, .75);
    color: #07140d;
    background: linear-gradient(135deg, #26a65b, #75d99c);
}

.theme-options [data-theme="blue"] {
    border-color: rgba(72, 148, 255, .75);
    color: #07111f;
    background: linear-gradient(135deg, #4894ff, #9fc4ff);
}

.theme-options [data-theme="light"] {
    border-color: rgba(255, 255, 255, .85);
    color: #121212;
    background: linear-gradient(135deg, #ffffff, #d9dee8);
}

.auth-help {
    justify-self: center;
    color: var(--gold-soft);
}

.install-app-button[hidden] {
    display: none;
}

.install-top-button {
    position: absolute;
    top: 0;
    right: 0;
    min-height: 38px;
    padding: 8px 12px;
    color: var(--black);
    background: linear-gradient(135deg, var(--gold), var(--gold-soft));
}

.install-steps {
    display: grid;
    gap: 10px;
    margin: 0;
    padding-left: 22px;
    color: var(--muted);
    line-height: 1.5;
}

.support-shell {
    display: grid;
    gap: 22px;
    max-width: 760px;
    margin: 0 auto;
    border-color: rgba(213, 169, 59, .34);
    background:
        linear-gradient(180deg, rgba(213, 169, 59, .08), rgba(213, 169, 59, 0) 220px),
        var(--panel);
}

.pix-box {
    display: grid;
    gap: 10px;
    border: 1px solid rgba(213, 169, 59, .24);
    border-radius: var(--radius);
    padding: 18px;
    background: rgba(0,0,0,.26);
}

.pix-box span {
    color: var(--muted);
    font-size: 13px;
    font-weight: 900;
    text-transform: uppercase;
}

.pix-box strong {
    overflow-wrap: anywhere;
    font-size: 18px;
}

.receipt-form {
    border: 1px solid rgba(213, 169, 59, .2);
    border-radius: var(--radius);
    padding: 18px;
    background: rgba(213, 169, 59, .04);
}

.inline-prediction-form {
    grid-template-columns: repeat(2, minmax(130px, 1fr));
    align-items: end;
}

.modal-prediction-form {
    grid-template-columns: 1fr auto 1fr;
}

.modal-prediction-form label {
    min-width: 0;
}

.penalty-fields {
    display: contents;
}

.inline-prediction-form > span {
    display: none;
}

.inline-prediction-form label {
    min-width: 0;
}

.match-list {
    display: grid;
    gap: 14px;
}

.match {
    display: grid;
    gap: 14px;
}

.badge {
    display: inline-flex;
    border-radius: 999px;
    padding: 5px 9px;
    color: var(--black) !important;
    background: var(--gold);
    font-size: 12px;
    font-weight: 900;
}

.prediction-form {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    gap: 8px;
    align-items: center;
}

.prediction-form select, .prediction-form button {
    grid-column: 1 / -1;
}

.games-table {
    min-width: 1120px;
}

.games-table td {
    vertical-align: middle;
}

.games-table td span {
    display: block;
    margin-top: 4px;
    color: var(--muted);
    font-size: 13px;
}

.table-prediction-form {
    grid-template-columns: 58px auto 58px 78px 78px minmax(130px, 1fr) auto;
    min-width: 580px;
}

.table-prediction-form select,
.table-prediction-form button {
    grid-column: auto;
}

.table-card { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; min-width: 620px; }
th, td { padding: 12px; border-bottom: 1px solid rgba(255,255,255,.09); text-align: left; }
th { color: var(--gold-soft); }

.current-ranking-row td {
    background: rgba(213, 169, 59, .12);
    color: var(--white);
    font-weight: 800;
}

.ranking-separator-row td {
    color: var(--gold-soft);
    text-align: center;
    letter-spacing: 0;
}

.members-modal-panel {
    width: min(860px, 100%);
}

.members-table {
    min-width: 0;
}

.members-toggle {
    width: 100%;
    justify-content: flex-start;
}

.alert {
    margin-bottom: 16px;
    border-radius: var(--radius);
    padding: 12px 14px;
    background: var(--panel);
    border: 1px solid rgba(255,255,255,.12);
}

.alert.success { border-color: var(--success); }
.alert.error { border-color: var(--danger); }
.admin-link { display: block; }

@media (min-width: 760px) {
    .shell { padding: 34px 24px 110px; }
    .auth-panel { grid-template-columns: 1.1fr .9fr; }
    .grid { grid-template-columns: repeat(3, 1fr); }
    .groups-grid { grid-template-columns: repeat(2, 1fr); }
    .form-grid { grid-template-columns: repeat(2, 1fr); }
    .phone-field-row { grid-template-columns: minmax(230px, .9fr) 1.1fr; }
    .match { grid-template-columns: 1.2fr .8fr; }
    .prediction-form { grid-template-columns: 70px auto 70px; }
    .table-prediction-form { grid-template-columns: 58px auto 58px 78px 78px minmax(130px, 1fr) auto; }
    .inline-prediction-form {
        grid-template-columns: 100px auto 100px 130px 130px minmax(150px, 1fr) auto;
    }
    .inline-prediction-form > span {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        min-height: 44px;
    }
}

@media (min-width: 1040px) {
    .groups-grid { grid-template-columns: repeat(4, 1fr); }
}
