* { margin: 0; padding: 0; box-sizing: border-box; }

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

:root {
    --bg: #090b10;
    --bg-elevated: #10141d;
    --surface: #151a24;
    --surface-2: #1d2430;
    --surface-3: #263040;
    --line: rgba(255,255,255,0.09);
    --line-strong: rgba(255,255,255,0.15);
    --text: #f6f8fb;
    --text-muted: #a9b4c3;
    --text-soft: #748196;
    --primary: #38d39f;
    --primary-strong: #14b884;
    --accent: #4db8ff;
    --warning: #f4c95d;
    --danger: #ff5c7a;
    --exact: #ff6b6b;
    --radius: 8px;
    --shadow: 0 14px 36px rgba(0,0,0,0.24);
    --shadow-soft: 0 8px 22px rgba(0,0,0,0.16);
}

body {
    font-family: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
    font-size: 14px;
    background:
        radial-gradient(circle at 18% -10%, rgba(56,211,159,0.16), transparent 34rem),
        radial-gradient(circle at 88% 0%, rgba(77,184,255,0.13), transparent 30rem),
        var(--bg);
    color: var(--text);
    min-height: 100vh;
    line-height: 1.5;
    overflow-x: hidden;
}

button, input, select, textarea { font: inherit; }
button { -webkit-tap-highlight-color: transparent; }
input[type="number"] { -moz-appearance: textfield; appearance: textfield; }
input[type="number"]::-webkit-outer-spin-button,
input[type="number"]::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.hidden { display: none !important; }

.top-bar {
    height: 64px;
    padding: 0 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 100;
    background: rgba(9,11,16,0.82);
    border-bottom: 1px solid var(--line);
    backdrop-filter: blur(18px);
}

.top-bar-title {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    font-size: 17px;
    font-weight: 750;
    letter-spacing: 0;
    flex-shrink: 0;
}

.top-bar-title::before {
    content: "sports_soccer";
    font-family: 'Material Icons';
    display: grid;
    place-items: center;
    width: 34px;
    height: 34px;
    border-radius: 8px;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    color: #061014;
    font-size: 21px;
}

.top-bar-user {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
    color: var(--text-muted);
    font-weight: 650;
    flex: 1;
    min-width: 0;
}

.room-switcher {
    max-width: 190px;
    min-height: 34px;
    padding: 6px 28px 6px 10px;
    font-size: 13px;
    flex: 0 0 auto;
}

#nav-username {
    flex: 0 1 auto;
    min-width: 82px;
    max-width: clamp(160px, 22vw, 320px);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.app-shell {
    display: flex;
    min-height: calc(100vh - 64px);
}

.side-rail {
    width: 92px;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 18px 10px;
    gap: 8px;
    position: sticky;
    top: 64px;
    height: calc(100vh - 64px);
    background: rgba(12,15,22,0.72);
    border-right: 1px solid var(--line);
    backdrop-filter: blur(16px);
}

.rail-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 5px;
    width: 72px;
    min-height: 66px;
    border-radius: var(--radius);
    color: var(--text-soft);
    text-decoration: none;
    font-size: 11px;
    font-weight: 650;
    transition: background 0.18s, color 0.18s, transform 0.18s;
}

.rail-item .material-icons { font-size: 23px; }
.rail-item:hover { background: rgba(255,255,255,0.06); color: var(--text); }
.rail-item.active {
    background: rgba(56,211,159,0.13);
    color: var(--primary);
    box-shadow: inset 0 0 0 1px rgba(56,211,159,0.24);
}

.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    min-height: 70px;
    padding: 8px 8px calc(8px + env(safe-area-inset-bottom));
    display: flex;
    align-items: center;
    justify-content: space-around;
    background: rgba(9,11,16,0.92);
    border-top: 1px solid var(--line);
    backdrop-filter: blur(18px);
    z-index: 100;
}

.bottom-nav-item {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
    padding: 8px 4px;
    border-radius: var(--radius);
    color: var(--text-soft);
    text-decoration: none;
    font-size: 10px;
    font-weight: 700;
}

.bottom-nav-item .material-icons { font-size: 22px; }
.bottom-nav-item.active { color: var(--primary); background: rgba(56,211,159,0.12); }

main {
    flex: 1;
    min-width: 0;
    width: 100%;
    max-width: 1180px;
    margin: 0 auto;
    padding: 28px;
}

.page-head {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 18px;
    margin-bottom: 20px;
}

.page-title {
    font-size: 30px;
    line-height: 1.12;
    font-weight: 820;
    letter-spacing: 0;
}

.page-subtitle {
    color: var(--text-muted);
    margin-top: 6px;
    max-width: 660px;
}

.page-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.card {
    background: linear-gradient(180deg, rgba(255,255,255,0.045), rgba(255,255,255,0.02)), var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow-soft);
}

h2, .section-title {
    font-size: 17px;
    font-weight: 750;
    margin-bottom: 12px;
}

.btn, .btn-small, .btn-outlined, .btn-danger, .btn-text {
    border: 0;
    cursor: pointer;
    border-radius: var(--radius);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    transition: transform 0.12s, background 0.18s, border-color 0.18s, color 0.18s, box-shadow 0.18s;
}

.btn {
    min-height: 42px;
    padding: 10px 18px;
    background: var(--primary);
    color: #061014;
    font-weight: 800;
    box-shadow: 0 10px 24px rgba(56,211,159,0.18);
}

.btn:hover { background: #54e4b4; }
.btn:active, .btn-small:active, .btn-danger:active { transform: translateY(1px); }
.btn:disabled { background: var(--surface-3); color: var(--text-soft); cursor: not-allowed; box-shadow: none; }

.btn-small {
    min-height: 34px;
    padding: 7px 12px;
    background: var(--primary);
    color: #061014;
    font-size: 12px;
    font-weight: 800;
}

.btn-small .material-icons {
    font-size: 16px;
}

.btn-small.btn-secondary {
    background: rgba(255,255,255,0.08);
    color: var(--text);
    border: 1px solid var(--line);
}

.btn-small.btn-secondary:hover { background: rgba(255,255,255,0.13); }

.btn-outlined {
    min-height: 40px;
    padding: 9px 14px;
    background: transparent;
    color: var(--primary);
    border: 1px solid rgba(56,211,159,0.38);
    font-weight: 750;
}

.btn-outlined:hover { background: rgba(56,211,159,0.1); }

.btn-danger {
    min-height: 32px;
    padding: 7px 10px;
    background: rgba(255,92,122,0.12);
    color: #ff9bad;
    font-size: 12px;
    font-weight: 750;
}

.btn-danger:hover { background: rgba(255,92,122,0.2); color: #ffd3db; }

.btn-text {
    width: 38px;
    height: 38px;
    background: rgba(255,255,255,0.04);
    color: var(--text-muted);
}

.btn-text:hover { background: rgba(255,255,255,0.08); color: var(--text); }

.form-group { margin-bottom: 14px; }
.form-group label {
    display: block;
    margin-bottom: 6px;
    color: var(--text-muted);
    font-size: 12px;
    font-weight: 750;
}

input, select, textarea {
    width: 100%;
    min-height: 40px;
    padding: 9px 38px 9px 11px;
    background: #0f141d;
    border: 1px solid var(--line-strong);
    border-radius: var(--radius);
    color: var(--text);
    outline: none;
}

textarea {
    display: block;
}

select {
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg width='18' height='18' viewBox='0 0 24 24' fill='none' stroke='%23a9b4c3' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 18px 18px;
}

input:focus, select:focus, textarea:focus {
    border-color: rgba(56,211,159,0.68);
    box-shadow: 0 0 0 3px rgba(56,211,159,0.13);
}

input::placeholder, textarea::placeholder {
    color: var(--text-soft);
    opacity: 1;
}

.login-container {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 24px;
}

.login-panel {
    width: min(440px, 100%);
    padding: 28px;
}

.login-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 24px;
}

.login-mark {
    width: 48px;
    height: 48px;
    border-radius: var(--radius);
    display: grid;
    place-items: center;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    color: #061014;
    font-size: 27px;
}

.login-container h1 {
    font-size: 28px;
    line-height: 1.08;
    font-weight: 840;
}

.login-container p {
    color: var(--text-muted);
    margin-top: 4px;
}

.login-container .btn { width: 100%; margin-top: 4px; }

.group-header {
    position: sticky;
    top: 64px;
    z-index: 20;
    margin: 18px 0 10px;
    padding: 9px 12px;
    color: var(--text);
    background: rgba(9,11,16,0.86);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    backdrop-filter: blur(12px);
    font-size: 13px;
    font-weight: 800;
}

.match-card {
    display: grid;
    grid-template-columns: 1fr;
    gap: 8px;
    padding: 14px 16px;
    margin-bottom: 10px;
    overflow: hidden;
}

.match-fixture {
    display: grid;
    grid-template-columns: minmax(0, 1fr) max-content minmax(0, 1fr);
    align-items: center;
    gap: 10px;
    min-width: 0;
}

.match-save-row {
    min-height: 12px;
    display: flex;
    justify-content: flex-end;
    margin-top: -3px;
    color: var(--text-soft);
}

.match-team {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
    font-size: 15px;
    font-weight: 780;
    line-height: 1.25;
}

.match-team.away { justify-content: flex-end; text-align: right; }
.team-name {
    min-width: 0;
    overflow-wrap: anywhere;
}
.team-flag { font-size: 21px; line-height: 1; flex-shrink: 0; }

.match-vs {
    min-width: 44px;
    padding: 5px 8px;
    border-radius: var(--radius);
    background: #0d121a;
    border: 1px solid var(--line);
    color: var(--text-muted);
    text-align: center;
    font-size: 12px;
    font-weight: 800;
}

.match-score {
    color: var(--primary);
    font-size: 17px;
    font-weight: 850;
}

.placeholder-team {
    color: var(--text-muted);
    font-style: italic;
}

.match-vs-placeholder {
    min-width: 92px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    color: var(--warning);
}

.match-vs-placeholder .material-icons {
    font-size: 15px;
}

.match-group-badge, .status-pill {
    justify-self: end;
    padding: 5px 9px;
    border-radius: 999px;
    white-space: nowrap;
    font-size: 11px;
    font-weight: 800;
}

.match-group-badge {
    background: rgba(77,184,255,0.12);
    color: #98d8ff;
    border: 1px solid rgba(77,184,255,0.22);
}

.status-pill {
    background: rgba(255,255,255,0.06);
    color: var(--text-muted);
}

.status-pill.open { background: rgba(56,211,159,0.12); color: #92f1cf; }
.status-pill.locked { background: rgba(244,201,93,0.12); color: #f7d987; }
.status-pill.live { background: rgba(255,92,122,0.12); color: #ff9bad; }
.status-pill.final { background: rgba(77,184,255,0.12); color: #98d8ff; }
.status-pill.placeholder { background: rgba(244,201,93,0.12); color: #f7d987; }

.match-meta {
    grid-column: 1 / -1;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding-top: 12px;
    border-top: 1px solid var(--line);
    color: var(--text-muted);
    font-size: 12px;
}

.match-info {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    flex-wrap: wrap;
    min-width: 0;
    color: var(--text-muted);
}

.countdown { color: var(--warning); font-weight: 800; }

.bet-form {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 12px;
    min-width: 0;
    padding-top: 8px;
    border-top: 1px solid var(--line);
}

.bet-form input {
    width: 54px;
    min-height: 38px;
    padding: 8px 6px;
    text-align: center;
    font-weight: 850;
    color: var(--text);
    caret-color: var(--primary);
}

.bet-locked, .bet-placed {
    grid-column: 1 / -1;
    font-weight: 750;
}

.bet-locked { color: var(--warning); }
.bet-placed { color: var(--primary); }

.bets-list {
    grid-column: 1 / -1;
    padding-top: 12px;
    border-top: 1px solid var(--line);
}

.bets-list h4 { color: var(--text); margin-bottom: 8px; }
.bet-item {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    padding: 7px 0;
    border-bottom: 1px solid var(--line);
    color: var(--text-muted);
}

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

.ranking-item {
    display: grid;
    grid-template-columns: 36px 40px minmax(0, 1fr) auto auto;
    align-items: center;
    gap: 12px;
    padding: 12px;
    border-radius: var(--radius);
    background: rgba(255,255,255,0.035);
    border: 1px solid transparent;
}

.ranking-item.rank-1, .ranking-item.rank-2, .ranking-item.rank-3 {
    background: rgba(255,255,255,0.055);
    border-color: var(--line);
}

.rank-number {
    color: var(--text-soft);
    font-weight: 850;
    text-align: center;
}

.rank-1 .rank-number { color: #f4d35e; }
.rank-2 .rank-number { color: #d4dae4; }
.rank-3 .rank-number { color: #d79662; }

.rank-avatar {
    width: 40px;
    height: 40px;
    border-radius: 8px;
    display: grid;
    place-items: center;
    background: #0f141d;
    color: var(--primary);
    font-size: 13px;
    font-weight: 850;
    border: 1px solid var(--line-strong);
}

.rank-name {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-weight: 750;
}

.rank-stats {
    color: var(--text-muted);
    font-size: 12px;
    white-space: nowrap;
}

.rank-points {
    min-width: 50px;
    padding: 5px 10px;
    border-radius: 999px;
    background: var(--primary);
    color: #061014;
    text-align: center;
    font-size: 12px;
    font-weight: 850;
}

.room-selector {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    margin-bottom: 16px;
}

.room-selector .material-icons {
    color: var(--primary);
}

.room-selector select {
    flex: 1;
}

.sync-card {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 14px;
    padding: 16px;
    margin-bottom: 14px;
    align-items: center;
}

.sync-card-main {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    min-width: 0;
}

.sync-card h2 {
    margin-bottom: 4px;
}

.sync-card p {
    color: var(--text-muted);
    margin-bottom: 4px;
}

.sync-card small,
.sync-actions span {
    color: var(--text-soft);
    font-size: 12px;
}

.sync-card small {
    display: block;
    margin-top: 2px;
}

.sync-card-warning {
    border-color: rgba(244,201,93,0.28);
    background: linear-gradient(180deg, rgba(244,201,93,0.08), rgba(255,255,255,0.02)), var(--surface);
}

.sync-icon {
    width: 38px;
    height: 38px;
    border-radius: var(--radius);
    display: grid;
    place-items: center;
    background: rgba(56,211,159,0.12);
    color: var(--primary);
    flex: 0 0 auto;
}

.sync-card-warning .sync-icon {
    background: rgba(244,201,93,0.12);
    color: var(--warning);
}

.sync-stats {
    display: flex;
    align-items: stretch;
    gap: 8px;
}

.sync-stats span {
    min-width: 86px;
    padding: 9px 10px;
    border-radius: var(--radius);
    background: rgba(255,255,255,0.045);
    border: 1px solid var(--line);
}

.sync-stats strong {
    display: block;
    font-size: 18px;
    line-height: 1.1;
}

.sync-stats small {
    display: block;
    margin-top: 3px;
}

.sync-actions {
    grid-column: 1 / -1;
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    padding-top: 12px;
    border-top: 1px solid var(--line);
}

.score-sync-chip {
    display: inline-flex;
    align-items: center;
    margin-left: 6px;
    padding: 2px 6px;
    border-radius: 999px;
    background: rgba(77,184,255,0.12);
    color: #98d8ff;
    font-size: 10px;
    font-weight: 800;
}

.empty-state {
    padding: 22px;
    color: var(--text-muted);
    text-align: center;
}

.points {
    font-weight: 850;
    white-space: nowrap;
}

.points.exact { color: var(--primary); }
.points.correct { color: var(--warning); }
.points.wrong { color: var(--danger); }

.admin-tabs {
    display: flex;
    gap: 6px;
    padding: 5px;
    margin-bottom: 18px;
    background: rgba(255,255,255,0.045);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    overflow-x: auto;
}

.admin-tab {
    min-height: 38px;
    padding: 8px 14px;
    border: 0;
    border-radius: 7px;
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
    white-space: nowrap;
    font-weight: 750;
}

.admin-tab:hover { color: var(--text); }
.admin-tab.active { color: #061014; background: var(--primary); }

.admin-section { margin-bottom: 22px; }
.section-head {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 12px;
}

.section-head p {
    color: var(--text-muted);
    font-size: 13px;
}

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

.summary-tile {
    padding: 14px;
    background: rgba(255,255,255,0.045);
    border: 1px solid var(--line);
    border-radius: var(--radius);
}

.summary-tile strong {
    display: block;
    font-size: 26px;
    line-height: 1;
}

.summary-tile span {
    display: block;
    margin-top: 6px;
    color: var(--text-muted);
    font-size: 12px;
    font-weight: 750;
}

.admin-form {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
    gap: 10px;
    margin-bottom: 12px;
}

.admin-section > .card { padding: 16px; }

.account-card {
    max-width: 460px;
    padding: 18px;
}

.invite-panel .btn-text {
    margin-top: 8px;
    width: 100%;
}

.invite-admin-card {
    padding: 16px;
    margin-bottom: 14px;
}

.invite-link-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto auto;
    gap: 8px;
    align-items: center;
    margin-top: 12px;
}

.invite-link-row input {
    min-width: 0;
    font-size: 13px;
    color: var(--text-muted);
}

.membership-editor {
    margin: 10px 0 16px 48px;
    padding: 16px;
    border: 1px solid rgba(56,211,159,0.2);
    border-radius: var(--radius);
    background: rgba(15,20,29,0.92);
}

.membership-editor-head {
    margin-bottom: 12px;
}

.membership-editor-head h3 {
    font-size: 15px;
    line-height: 1.2;
    margin-bottom: 3px;
}

.membership-editor-head p {
    color: var(--text-muted);
    font-size: 12px;
}

.membership-list {
    display: grid;
    gap: 8px;
}

.membership-row {
    display: grid;
    grid-template-columns: minmax(220px, 1fr) 150px 108px;
    gap: 12px;
    align-items: center;
    padding: 10px 12px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: rgba(255,255,255,0.025);
}

.membership-row.has-nickname {
    grid-template-columns: minmax(160px, 1fr) minmax(160px, 220px) 150px 108px;
}

.membership-row.is-selected {
    border-color: rgba(56,211,159,0.34);
    background: rgba(56,211,159,0.08);
}

.membership-check,
.membership-primary,
.membership-role,
.membership-nickname {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
    color: var(--text);
    font-size: 13px;
    font-weight: 700;
}

.membership-check input[type="checkbox"],
.membership-primary input[type="radio"] {
    width: 16px;
    min-width: 16px;
    height: 16px;
    min-height: 16px;
    padding: 0;
    margin: 0;
    accent-color: var(--primary);
    cursor: pointer;
    box-shadow: none;
}

.membership-room-name {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.membership-role,
.membership-nickname {
    flex-direction: column;
    align-items: stretch;
    gap: 4px;
}

.membership-role span,
.membership-nickname span {
    color: var(--text-soft);
    font-size: 10px;
    line-height: 1;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.membership-role select {
    min-height: 34px;
    padding: 7px 40px 7px 10px;
    font-size: 13px;
}

.membership-nickname input {
    min-height: 34px;
    padding: 7px 10px;
    font-size: 13px;
}

.membership-primary {
    justify-content: flex-start;
    color: var(--text-muted);
    white-space: nowrap;
}

.membership-primary:has(input:checked) {
    color: var(--primary);
}

.membership-editor > .row-actions {
    margin-top: 16px;
}

.editable-user-row {
    display: grid;
    grid-template-columns: 38px minmax(0, 1fr) minmax(120px, auto) auto;
    gap: 10px;
    align-items: center;
    padding: 11px 12px;
    background: rgba(255,255,255,0.04);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    margin-top: 8px;
}

.editable-user-avatar {
    width: 34px;
    height: 34px;
    flex-shrink: 0;
    font-size: 11px;
}

.editable-user-fields {
    display: grid;
    grid-template-columns: minmax(130px, 1.1fr) minmax(120px, 0.9fr) minmax(130px, 0.9fr) minmax(120px, 0.8fr) minmax(110px, 0.7fr);
    gap: 8px;
    min-width: 0;
}

.editable-user-fields input,
.editable-user-fields select {
    min-width: 0;
}

.editable-user-meta {
    display: grid;
    justify-items: end;
    gap: 4px;
    min-width: 0;
}

.editable-user-meta small {
    color: var(--text-muted);
    font-size: 11px;
    font-weight: 700;
    text-align: right;
    max-width: 180px;
    overflow-wrap: anywhere;
}

.form-action {
    margin-bottom: 10px;
}

.create-room-card {
    padding: 16px;
    margin-bottom: 12px;
}

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

.user-row, .score-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 11px 12px;
    background: rgba(255,255,255,0.04);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    margin-top: 8px;
}

.user-row span, .score-row > span { min-width: 0; overflow-wrap: anywhere; }
.score-row input { width: 52px; text-align: center; font-weight: 800; }

.score-controls {
    display: flex;
    align-items: center;
    gap: 6px;
}
.score-controls input { color: #fff; text-align: center; padding: 9px 6px; width: 52px; }

.room-card {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto auto;
    gap: 12px;
    align-items: center;
    padding: 14px;
}

.room-card.expanded {
    border-color: rgba(56,211,159,0.32);
    box-shadow: 0 12px 30px rgba(56,211,159,0.08);
}

.room-card-toggle {
    min-width: 0;
    border: 0;
    background: transparent;
    color: var(--text);
    display: flex;
    align-items: center;
    gap: 10px;
    text-align: left;
    cursor: pointer;
}

.room-card-toggle .material-icons {
    width: 34px;
    height: 34px;
    display: grid;
    place-items: center;
    flex: 0 0 auto;
    border-radius: var(--radius);
    background: rgba(56,211,159,0.12);
    color: var(--primary);
}

.room-card-toggle strong,
.room-card-toggle small {
    display: block;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.room-card-toggle strong {
    font-size: 16px;
    font-weight: 820;
}

.room-card-toggle small {
    margin-top: 2px;
    color: var(--text-muted);
    font-size: 12px;
    font-weight: 700;
}

.room-card-meta {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
}

.room-edit-panel {
    grid-column: 1 / -1;
    display: grid;
    grid-template-columns: minmax(180px, 1fr) minmax(120px, 160px) auto;
    gap: 8px;
    align-items: center;
    padding-top: 12px;
    border-top: 1px solid var(--line);
}

.room-count {
    color: var(--text-muted);
    font-size: 12px;
    font-weight: 750;
    white-space: nowrap;
}

.row-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 8px;
}

.room-members {
    grid-column: 1 / -1;
    display: grid;
    gap: 12px;
    padding-top: 12px;
    border-top: 1px solid var(--line);
}

.room-add-member {
    display: grid;
    grid-template-columns: minmax(140px, 1.1fr) minmax(120px, 1fr) minmax(120px, 1fr) minmax(110px, 140px) auto;
    gap: 8px;
    align-items: center;
    padding: 12px;
    background: rgba(56,211,159,0.05);
    border: 1px solid rgba(56,211,159,0.14);
    border-radius: var(--radius);
}

.member-group {
    display: grid;
    gap: 8px;
}

.member-group h3 {
    color: var(--text-muted);
    font-size: 12px;
    font-weight: 850;
    text-transform: uppercase;
    letter-spacing: 0;
}

.member-row {
    display: grid;
    grid-template-columns: 38px minmax(0, 1fr) auto auto auto auto;
    gap: 10px;
    align-items: center;
    padding: 10px;
    background: rgba(0,0,0,0.13);
    border: 1px solid rgba(255,255,255,0.06);
    border-radius: 8px;
}

.member-row strong,
.member-row span {
    display: block;
    min-width: 0;
    overflow-wrap: anywhere;
}

.member-row > div:nth-child(2) span {
    color: var(--text-muted);
    font-size: 12px;
    margin-top: 2px;
}

.member-rank,
.member-points,
.member-stats {
    white-space: nowrap;
    font-size: 12px;
    font-weight: 800;
}

.member-rank { color: var(--text-soft); }
.member-points {
    padding: 4px 8px;
    border-radius: 999px;
    background: var(--primary);
    color: #061014;
}
.member-stats {
    color: var(--text-muted);
    font-weight: 700;
}

.role-badge {
    display: inline-flex;
    margin-left: 6px;
    padding: 3px 7px;
    border-radius: 999px;
    background: rgba(77,184,255,0.12);
    color: #98d8ff;
    font-size: 10px;
    font-weight: 850;
}

.table-wrap {
    overflow: auto;
    padding: 0;
    max-width: 100%;
    -webkit-overflow-scrolling: touch;
}

.allbets-wrap::before {
    content: "Scroll sideways to see all participants";
    display: block;
    padding: 8px 10px;
    color: var(--text-soft);
    font-size: 10px;
    font-weight: 750;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    border-bottom: 1px solid var(--line);
}

.allbets-table {
    width: max-content;
    min-width: 100%;
    table-layout: fixed;
    border-collapse: separate;
    border-spacing: 0;
    font-size: 12px;
}

.allbets-table th {
    position: sticky;
    top: 0;
    padding: 8px 5px;
    background: #111722;
    color: var(--text-muted);
    text-align: center;
    white-space: nowrap;
    border-bottom: 1px solid var(--line);
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0;
}

.allbets-table td {
    padding: 6px 5px;
    text-align: center;
    border-bottom: 1px solid var(--line);
}

.allbets-table .match-cell {
    position: sticky;
    left: 0;
    z-index: 2;
    background: #151a24;
    text-align: left;
    white-space: normal;
    font-weight: 700;
    width: 190px;
    min-width: 190px;
    max-width: 190px;
}

.allbets-table .result-cell {
    width: 44px;
    min-width: 44px;
    max-width: 44px;
    color: var(--primary);
    font-weight: 850;
}

.allbets-table .user-col {
    width: 68px;
    min-width: 68px;
    max-width: 68px;
    overflow: hidden;
    white-space: normal;
    vertical-align: bottom;
}

.user-col-name {
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    overflow-wrap: anywhere;
    line-height: 1.08;
    font-size: 9px;
    font-weight: 800;
    text-transform: none;
}

.allbets-date {
    display: block;
    color: var(--text-soft);
    font-size: 10px;
    font-weight: 700;
    line-height: 1.25;
    margin-bottom: 2px;
}
.allbets-teams {
    display: block;
    line-height: 1.25;
    overflow: hidden;
    text-overflow: ellipsis;
}

.bet-cell {
    width: 68px;
    min-width: 68px;
    max-width: 68px;
    font-size: 11px;
    font-weight: 850;
    border-radius: 0;
    white-space: nowrap;
}
.bet-exact { color: var(--exact); background: rgba(255,107,107,0.1); }
.bet-goaldiff { color: #ffd54f; background: rgba(255,213,79,0.1); }
.bet-correct { color: #8bd7ff; background: rgba(77,184,255,0.09); }
.bet-wrong { color: var(--text-soft); }
.bet-hidden { color: #647084; background: rgba(255,255,255,0.035); }
.bet-empty { color: #4f5b6d; }
.bet-editable {
    cursor: pointer;
    position: relative;
    color: var(--primary);
    background: rgba(56,211,159,0.075);
    box-shadow: inset 0 0 0 1px rgba(56,211,159,0.16);
}

.bet-editable:hover {
    background: rgba(56,211,159,0.15);
    color: #b8f8df;
}

.bet-edit-overlay {
    position: fixed;
    inset: 0;
    z-index: 1800;
    display: grid;
    place-items: center;
    padding: 18px;
    background: rgba(5,7,11,0.66);
    backdrop-filter: blur(10px);
}

.bet-edit-modal {
    position: relative;
    width: min(520px, 100%);
    padding: 22px;
    border-radius: var(--radius);
    border: 1px solid var(--line-strong);
    background: linear-gradient(180deg, rgba(255,255,255,0.06), rgba(255,255,255,0.025)), var(--surface);
    box-shadow: 0 24px 70px rgba(0,0,0,0.42);
}

.bet-edit-close {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 34px;
    height: 34px;
    border: 0;
    border-radius: var(--radius);
    display: grid;
    place-items: center;
    background: rgba(255,255,255,0.05);
    color: var(--text-muted);
    cursor: pointer;
}

.bet-edit-close:hover {
    color: var(--text);
    background: rgba(255,255,255,0.1);
}

.bet-edit-close .material-icons {
    font-size: 19px;
}

.bet-edit-head {
    margin-bottom: 20px;
}

.bet-edit-date {
    color: var(--text-soft);
    font-size: 12px;
    font-weight: 750;
}

.bet-edit-head h2 {
    margin: 13px 0 0;
    font-size: 20px;
    line-height: 1.25;
    width: 100%;
}

.bet-edit-matchup {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 28px minmax(0, 1fr);
    align-items: center;
    gap: 12px;
    width: 100%;
    min-width: 0;
    padding: 0 14px;
}

.bet-edit-team {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    max-width: 100%;
    min-width: 0;
    vertical-align: middle;
}

.bet-edit-team .team-flag {
    flex: 0 0 auto;
    font-size: 1.1em;
}

.bet-edit-team span:last-child {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.bet-edit-matchup .bet-edit-team:first-child {
    justify-self: start;
}

.bet-edit-matchup .bet-edit-team:last-child {
    justify-self: end;
    text-align: right;
}

.bet-edit-vs {
    color: var(--text-muted);
    font-size: 0.74em;
    font-weight: 750;
    justify-self: center;
    text-align: center;
}

.bet-edit-score {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 28px minmax(0, 1fr);
    align-items: center;
    gap: 12px;
    padding: 14px;
    margin-bottom: 20px;
    border-radius: var(--radius);
    background: rgba(5,7,11,0.24);
    border: 1px solid rgba(255,255,255,0.06);
}

.bet-edit-score input {
    width: 100%;
    min-height: 76px;
    padding: 10px;
    text-align: center;
    font-size: 32px;
    font-weight: 850;
    color: var(--text);
    caret-color: var(--primary);
    border-radius: var(--radius);
}

.bet-edit-dash {
    color: var(--text-soft);
    font-size: 26px;
    font-weight: 850;
    text-align: center;
}

.bet-edit-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    flex-wrap: wrap;
}

/* ── Room chat ─────────────────────────────────────────────────────────── */
.chat-card {
    overflow: hidden;
    display: grid;
    grid-template-rows: auto minmax(360px, 56vh) auto;
}

.chat-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 16px 18px;
    border-bottom: 1px solid var(--line);
    background: rgba(9,11,16,0.22);
}

.chat-toolbar h2 { margin-bottom: 2px; }

.chat-toolbar p {
    color: var(--text-muted);
    font-size: 13px;
}

.chat-toolbar-compact {
    min-height: 52px;
    padding: 8px 14px;
    justify-content: flex-end;
}

.chat-messages {
    min-height: 0;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 18px;
    background:
        linear-gradient(180deg, rgba(56,211,159,0.05), transparent 120px),
        rgba(9,11,16,0.2);
    scroll-behavior: smooth;
}

.chat-empty {
    min-height: 260px;
    display: grid;
    place-items: center;
    align-content: center;
    gap: 8px;
    color: var(--text-muted);
    text-align: center;
}

.chat-empty .material-icons {
    width: 48px;
    height: 48px;
    display: grid;
    place-items: center;
    border-radius: var(--radius);
    background: rgba(56,211,159,0.12);
    color: var(--primary);
    font-size: 25px;
}

.chat-empty strong {
    color: var(--text);
    font-size: 16px;
}

.chat-empty small { color: var(--text-soft); }

.chat-message {
    display: grid;
    grid-template-columns: 36px minmax(0, 1fr);
    gap: 10px;
    max-width: min(760px, 86%);
    align-self: flex-start;
}

.chat-message.mine {
    grid-template-columns: minmax(0, 1fr) 36px;
    align-self: flex-end;
}

.chat-message.mine .chat-avatar {
    grid-column: 2;
    grid-row: 1;
    background: rgba(56,211,159,0.18);
    color: var(--primary);
}

.chat-message.mine .chat-bubble {
    grid-column: 1;
    grid-row: 1;
    background: linear-gradient(180deg, rgba(56,211,159,0.20), rgba(56,211,159,0.10)), var(--surface-2);
    border-color: rgba(56,211,159,0.26);
}

.chat-avatar {
    width: 36px;
    height: 36px;
    border-radius: var(--radius);
    display: grid;
    place-items: center;
    background: rgba(77,184,255,0.13);
    color: var(--accent);
    font-size: 12px;
    font-weight: 850;
}

.chat-bubble {
    position: relative;
    min-width: 0;
    padding: 10px 42px 11px 12px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--surface-2);
    box-shadow: var(--shadow-soft);
}

.chat-meta {
    display: flex;
    align-items: baseline;
    gap: 8px;
    min-width: 0;
    margin-bottom: 4px;
}

.chat-meta strong {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: var(--text);
    font-size: 13px;
}

.chat-meta span {
    flex-shrink: 0;
    color: var(--text-soft);
    font-size: 11px;
    font-weight: 700;
}

.chat-text {
    color: var(--text);
    overflow-wrap: anywhere;
    line-height: 1.45;
}

.chat-delete {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 26px;
    height: 26px;
    border: 0;
    border-radius: var(--radius);
    display: grid;
    place-items: center;
    background: transparent;
    color: var(--text-soft);
    cursor: pointer;
    opacity: 0;
    transition: opacity 0.15s, color 0.15s, background 0.15s;
}

.chat-bubble:hover .chat-delete,
.chat-delete:focus-visible {
    opacity: 1;
}

.chat-delete:hover {
    color: var(--danger);
    background: rgba(255,92,122,0.12);
}

.chat-delete .material-icons { font-size: 17px; }

.chat-compose {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 10px;
    padding: 14px;
    border-top: 1px solid var(--line);
    background: linear-gradient(180deg, rgba(255,255,255,0.035), rgba(9,11,16,0.38));
}

.chat-compose textarea {
    min-height: 54px;
    max-height: 140px;
    padding: 14px 16px;
    resize: none;
    line-height: 1.45;
    border-radius: 8px;
    background: rgba(9,11,16,0.62);
    border-color: rgba(255,255,255,0.13);
    color: var(--text);
    font-size: 14px;
    font-weight: 500;
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.04);
}

.chat-compose textarea:focus {
    background: #1e1e1e;
    border-color: transparent;
    box-shadow: none;
}

.chat-compose textarea::placeholder {
    color: #7f8b9d;
    font-weight: 600;
}

.chat-compose .btn {
    align-self: center;
    min-width: 86px;
    min-height: 46px;
    padding-left: 14px;
    padding-right: 14px;
}

.chat-compose .btn .material-icons {
    font-size: 18px;
}

#toast-container {
    position: fixed;
    left: 50%;
    bottom: 28px;
    transform: translateX(-50%);
    z-index: 1000;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    pointer-events: none;
}

.toast {
    max-width: min(380px, calc(100vw - 32px));
    padding: 12px 16px;
    background: #f6f8fb;
    color: #10141d;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    animation: snackIn 0.24s ease;
    font-weight: 750;
}

.toast.error { background: #ffe0e7; color: #8c1830; }

@keyframes snackIn {
    from { transform: translateY(12px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

.loading-overlay {
    position: fixed;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(9,11,16,0.52);
    z-index: 2000;
    backdrop-filter: blur(3px);
}

.spinner {
    width: 38px;
    height: 38px;
    border: 3px solid rgba(255,255,255,0.14);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
}

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

@media (max-width: 768px) {
    .top-bar { height: 58px; padding: 0 14px; }
    .top-bar-title { font-size: 15px; }
    #nav-username { display: none; }
    .side-rail { display: none; }
    .bottom-nav { display: flex; }
    .app-shell { min-height: calc(100vh - 58px); }
    main {
        width: 100%;
        max-width: 100vw;
        min-width: 0;
        overflow-x: hidden;
        padding: 18px 10px 92px;
    }
    .card,
    .match-card,
    .group-overview {
        max-width: 100%;
        min-width: 0;
    }
    .page-head { display: block; margin-bottom: 16px; }
    .page-title { font-size: 25px; }
    .page-subtitle { font-size: 13px; }
    .editable-user-row { grid-template-columns: 34px minmax(0, 1fr); }
    .editable-user-fields { grid-column: 1 / -1; grid-template-columns: 1fr; }
    .editable-user-meta { justify-items: start; }
    .editable-user-meta small { text-align: left; max-width: none; }
    .editable-user-row .row-actions { grid-column: 1 / -1; justify-content: flex-start; }
    .invite-link-row { grid-template-columns: 1fr; }
    .invite-link-row .btn-small { width: 100%; }
    .membership-editor { margin-left: 0; }
    .membership-row { grid-template-columns: 1fr; }
    .sync-card { grid-template-columns: 1fr; }
    .sync-stats { flex-wrap: wrap; }
    .sync-stats span { flex: 1 1 90px; min-width: 0; }
    .group-header { top: 58px; }
    .match-summary {
        grid-template-columns: 1fr;
    }
    .match-summary > div,
    .match-summary-next {
        padding: 10px;
    }
    .match-stage-section > summary {
        top: 58px;
    }
    .match-card {
        grid-template-columns: 1fr;
        gap: 10px;
        padding: 13px;
    }
    .match-fixture { grid-template-columns: minmax(0, 1fr) minmax(74px, 96px) minmax(0, 1fr); gap: 6px; }
    .match-team { font-size: 13px; align-items: flex-start; overflow: hidden; }
    .team-name { overflow: hidden; text-overflow: ellipsis; }
    .team-flag { font-size: 18px; }
    .match-vs { min-width: 36px; padding-left: 6px; padding-right: 6px; }
    .match-info { align-items: flex-start; gap: 6px; }
    .meta-badges { justify-content: flex-start; }
    .bet-form {
        gap: 8px;
    }
    .bet-inputs { gap: 4px; min-width: 0; }
    .bet-inputs input { width: 34px; min-height: 34px; font-size: 15px; }
    .bet-locked, .bet-placed { width: 100%; margin-right: 0; }
    .ranking-item { grid-template-columns: 30px 36px minmax(0, 1fr) auto; }
    .rank-stats { display: none; }
    .admin-summary { grid-template-columns: 1fr; }
    .section-head { display: block; }
    .user-row, .score-row { align-items: stretch; flex-direction: column; }
    .room-card { grid-template-columns: 1fr; align-items: stretch; }
    .room-card-meta { justify-content: flex-start; }
    .room-edit-panel, .room-add-member { grid-template-columns: 1fr; }
    .row-actions { justify-content: flex-start; }
    .member-row { grid-template-columns: 34px minmax(0, 1fr); }
    .member-rank, .member-points, .member-stats, .member-row .role-badge {
        grid-column: 2;
        justify-self: start;
        margin-left: 0;
    }
    .score-row > div { justify-content: flex-start; flex-wrap: wrap; }
    #toast-container { bottom: 86px; }
}

@media (min-width: 769px) {
    .side-rail { display: flex; }
    .bottom-nav { display: none !important; }
}

/* ── Group filter ──────────────────────────────────────────────────────── */
.group-filter {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding: 4px 2px 14px;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
}
.group-filter::-webkit-scrollbar { display: none; }

.group-pill {
    flex-shrink: 0;
    min-height: 34px;
    padding: 7px 14px;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 12px;
    font-weight: 700;
    transition: all 0.15s;
    white-space: nowrap;
}
.group-pill:hover { color: var(--text); border-color: var(--line-strong); }
.group-pill.active { background: var(--primary); color: #061014; border-color: transparent; }

.group-pill.compact {
    min-width: 38px;
    padding-left: 11px;
    padding-right: 11px;
    text-align: center;
}

.match-view-filter {
    padding-top: 0;
}

.match-summary {
    display: grid;
    grid-template-columns: minmax(120px, 150px) minmax(0, 1fr);
    gap: 10px;
    align-items: stretch;
    margin-bottom: 12px;
}

.match-summary > div,
.match-summary-next {
    min-width: 0;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: rgba(255,255,255,0.035);
    padding: 11px 12px;
}

.match-summary-label {
    display: block;
    margin-bottom: 2px;
    color: var(--text-muted);
    font-size: 11px;
    font-weight: 800;
    text-transform: uppercase;
}

.match-summary strong {
    color: var(--primary);
    font-size: 28px;
    line-height: 1;
}

.match-summary-next {
    display: grid;
    grid-template-columns: 24px minmax(0, 1fr);
    gap: 10px;
    align-items: center;
    color: var(--text);
    font: inherit;
    text-align: left;
    cursor: pointer;
}

.match-summary-next:hover {
    border-color: var(--line-strong);
    background: rgba(255,255,255,0.055);
}

.match-summary-next .material-icons {
    color: var(--primary);
    font-size: 22px;
}

.match-summary-next b,
.match-summary-next small {
    display: block;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.match-summary-next b {
    margin-bottom: 2px;
    font-size: 13px;
}

.match-summary-next small {
    color: var(--text-muted);
    font-size: 12px;
}

.browse-panel {
    margin-bottom: 14px;
    padding: 10px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: rgba(255,255,255,0.03);
}

.browse-tier {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding: 0;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
}

.browse-tier::-webkit-scrollbar {
    display: none;
}

.browse-stage-filter {
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid var(--line);
}

.match-stage-section {
    margin-bottom: 12px;
}

.match-stage-section > summary {
    position: sticky;
    top: 68px;
    z-index: 7;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    list-style: none;
    cursor: pointer;
    padding: 10px 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: rgba(18,18,18,0.94);
    color: var(--text);
    font-size: 13px;
    font-weight: 850;
}

.match-stage-section > summary::-webkit-details-marker {
    display: none;
}

.match-stage-section > summary::before {
    content: 'expand_more';
    font-family: 'Material Icons';
    color: var(--text-muted);
    font-size: 20px;
    line-height: 1;
}

.match-stage-section:not([open]) > summary::before {
    content: 'chevron_right';
}

.match-stage-section > summary span {
    flex: 1;
    min-width: 0;
}

.match-stage-section > summary small {
    flex-shrink: 0;
    color: var(--text-muted);
    font-size: 11px;
    font-weight: 750;
}

/* ── Bet progress bar ──────────────────────────────────────────────────── */
.bet-progress {
    height: 3px;
    background: rgba(255,255,255,0.08);
    border-radius: 999px;
    margin-bottom: 18px;
    overflow: hidden;
}
.bet-progress-bar {
    height: 100%;
    background: linear-gradient(90deg, var(--primary), var(--accent));
    border-radius: 999px;
    transition: width 0.5s ease;
    min-width: 2px;
}

.group-overview {
    margin: 0 0 16px;
    padding: 14px;
}

.group-overview-head {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 10px;
}

.group-overview h2 {
    margin-bottom: 2px;
}

.group-overview p {
    color: var(--text-muted);
    font-size: 12px;
}

.group-standings-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.group-standings {
    width: 100%;
    min-width: 480px;
    border-collapse: collapse;
    font-size: 12px;
}

.group-standings th,
.group-standings td {
    padding: 8px 7px;
    border-bottom: 1px solid var(--line);
    text-align: center;
    white-space: nowrap;
}

.group-standings th {
    color: var(--text-soft);
    font-size: 10px;
    font-weight: 850;
    text-transform: uppercase;
}

.group-standings th:first-child,
.group-standings td:first-child {
    text-align: left;
    width: 100%;
}

.group-standings tbody tr:last-child td {
    border-bottom: 0;
}

.group-team {
    display: grid;
    grid-template-columns: 20px 26px minmax(0, 1fr);
    align-items: center;
    column-gap: 8px;
    min-width: 0;
}

.group-rank {
    display: grid;
    place-items: center;
    width: 20px;
    height: 20px;
    border-radius: 999px;
    background: rgba(255,255,255,0.06);
    color: var(--text-muted);
    font-size: 10px;
    font-weight: 850;
}

.group-team-flag {
    display: block;
    width: 26px;
    font-size: 20px;
    line-height: 1;
    text-align: center;
}

.group-team-name {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ── Match card enhancements ───────────────────────────────────────────── */
.closing-soon {
    border-color: rgba(244,201,93,0.4) !important;
    box-shadow: 0 0 0 1px rgba(244,201,93,0.14), var(--shadow-soft) !important;
}

.match-final {
    opacity: 0.85;
}

.vs-text {
    color: var(--text-soft);
    font-size: 12px;
    font-weight: 800;
}

.match-date-str {
    color: var(--text-muted);
    font-size: 12px;
    overflow-wrap: anywhere;
}

.meta-badges {
    display: flex;
    align-items: center;
    gap: 7px;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.countdown.urgent {
    color: var(--danger);
    animation: pulse 1.2s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.6; }
}

/* ── Bet form improvements ─────────────────────────────────────────────── */
.bet-label {
    color: var(--text-muted);
    font-size: 12px;
    font-weight: 700;
    white-space: nowrap;
}

.bet-inputs {
    display: flex;
    align-items: center;
    gap: 6px;
    justify-content: center;
    min-width: 0;
}

.bet-score-group {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}

.bet-team-label {
    font-size: 10px;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    white-space: nowrap;
    max-width: 54px;
    overflow: hidden;
    text-overflow: ellipsis;
}

.bet-score-group input {
    width: 54px;
    min-height: 38px;
    padding: 8px 6px;
    text-align: center;
    font-weight: 850;
    font-size: 16px;
    color: var(--text);
    caret-color: var(--primary);
}

.bet-inputs input {
    width: 50px;
    min-height: 38px;
    padding: 8px 6px;
    text-align: center;
    font-weight: 850;
    font-size: 16px;
    color: var(--text);
    caret-color: var(--primary);
}

.bet-dash {
    color: var(--text-soft);
    font-weight: 800;
}

.bet-save-status {
    min-width: 0;
    color: var(--text-soft);
    font-size: 10px;
    font-weight: 650;
    letter-spacing: 0;
    line-height: 1.2;
    opacity: 0.78;
    text-align: right;
    white-space: nowrap;
}

.bet-save-status::before {
    content: "";
}

.bet-save-status.pending { color: var(--warning); opacity: 0.9; }
.bet-save-status.saved { color: var(--primary); opacity: 0.95; }
.bet-save-status.error { color: var(--danger); opacity: 0.95; }

.btn-update {
    background: rgba(56,211,159,0.15) !important;
    color: var(--primary) !important;
    border: 1px solid rgba(56,211,159,0.3) !important;
}
.btn-update:hover { background: rgba(56,211,159,0.25) !important; }

.bet-form-locked {
    background: rgba(0,0,0,0.12);
    border-top: 1px solid var(--line);
}

.bet-check {
    font-size: 18px;
    color: var(--primary);
}

.bet-locked-icon {
    font-size: 16px;
    color: var(--warning);
}

.bet-pts {
    font-size: 12px;
    font-weight: 800;
    padding: 3px 8px;
    border-radius: 999px;
    white-space: nowrap;
    margin-left: auto;
}
.bet-pts-exact { background: rgba(56,211,159,0.18); color: var(--primary); }
.bet-pts-goaldiff { background: rgba(255,213,79,0.15); color: #ffd54f; }
.bet-pts-correct { background: rgba(77,184,255,0.15); color: #98d8ff; }
.bet-pts-wrong { background: rgba(255,92,122,0.12); color: #ff9bad; }
.bet-pts-pending { background: rgba(255,255,255,0.07); color: var(--text-soft); }

/* ── Inline bets list ──────────────────────────────────────────────────── */
.inline-bets { display: grid; gap: 6px; }

.bet-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 7px 0;
    border-bottom: 1px solid var(--line);
}

.bet-item-name {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: var(--text-muted);
}

.bet-item-score {
    font-weight: 850;
    color: var(--primary);
}

.btn-show-bets {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 7px 12px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: rgba(255,255,255,0.04);
    color: var(--text-muted);
    cursor: pointer;
    font-size: 12px;
    font-weight: 700;
    transition: all 0.15s;
    font-family: inherit;
}
.btn-show-bets:hover { background: rgba(255,255,255,0.08); color: var(--text); }
.btn-show-bets .material-icons { font-size: 16px; }

/* ── Ranking improvements ──────────────────────────────────────────────── */
.ranking-list { display: grid; gap: 8px; }

.ranking-item {
    display: grid;
    grid-template-columns: 44px 40px minmax(0, 1fr) auto;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    border-radius: var(--radius);
    background: rgba(255,255,255,0.035);
    border: 1px solid transparent;
}

.rank-info {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.rank-name {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-weight: 750;
}

.rank-stats {
    font-size: 11px;
    color: var(--text-soft);
}

.rank-points small {
    font-size: 10px;
    font-weight: 700;
    opacity: 0.7;
}

/* ── All Bets legend ───────────────────────────────────────────────────── */
.bets-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 12px 20px;
    margin-bottom: 14px;
    padding: 10px 14px;
    background: rgba(255,255,255,0.03);
    border: 1px solid var(--line);
    border-radius: var(--radius);
}

.legend-item {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    font-size: 12px;
    font-weight: 700;
    color: var(--text-muted);
}

.legend-dot {
    width: 10px;
    height: 10px;
    border-radius: 3px;
    flex-shrink: 0;
}
.legend-dot.exact { background: rgba(255,107,107,0.7); }
.legend-dot.goaldiff { background: #ff9800; }
.legend-dot.correct { background: rgba(77,184,255,0.6); }
.legend-dot.wrong { background: rgba(255,255,255,0.12); }
.legend-dot.hidden-dot { background: rgba(255,255,255,0.07); border: 1px solid var(--line); }

/* ── Admin improvements ────────────────────────────────────────────────── */
.admin-group-header {
    padding: 8px 12px;
    margin: 14px 0 6px;
    font-size: 12px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-muted);
    background: rgba(255,255,255,0.04);
    border: 1px solid var(--line);
    border-radius: var(--radius);
}

.score-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 11px 12px;
    background: rgba(255,255,255,0.04);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    margin-top: 6px;
    flex-wrap: wrap;
}

.score-row.has-score {
    border-color: rgba(56,211,159,0.2);
}

.score-row-placeholder {
    align-items: stretch;
}

.score-row-teams {
    flex: 1;
    min-width: 0;
    overflow-wrap: anywhere;
    font-size: 13px;
}

.score-row-date {
    color: var(--text-soft);
    font-size: 11px;
    white-space: nowrap;
}

.match-no {
    color: var(--text-soft);
    font-weight: 850;
    margin-right: 4px;
}

.placeholder-edit {
    width: 100%;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: end;
    gap: 12px;
    padding: 12px;
    border-radius: var(--radius);
    background: rgba(8,12,19,0.46);
    border: 1px solid rgba(255,255,255,0.06);
}

.placeholder-fields {
    display: grid;
    grid-template-columns: minmax(140px, 1fr) minmax(140px, 1fr) minmax(200px, 1.2fr) minmax(130px, 0.7fr);
    gap: 10px;
    min-width: 0;
}

.placeholder-fields label {
    display: grid;
    gap: 5px;
    min-width: 0;
}

.placeholder-fields label span {
    color: var(--text-soft);
    font-size: 10px;
    font-weight: 850;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.placeholder-edit input,
.placeholder-edit select {
    width: 100%;
    min-height: 38px;
    font-size: 12px;
    min-width: 0;
}

.placeholder-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    justify-content: flex-end;
    white-space: nowrap;
}

.placeholder-ready {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    color: var(--text-muted);
    font-size: 12px;
    font-weight: 750;
    white-space: nowrap;
}

.placeholder-ready input {
    width: 16px;
    min-height: 16px;
    padding: 0;
}

.score-dash {
    color: var(--text-soft);
    font-weight: 800;
}

.score-controls input {
    width: 52px;
    text-align: center;
    font-weight: 800;
    font-size: 15px;
}

.room-admin-row {
    margin-bottom: 10px;
    overflow: hidden;
}

.room-admin-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
}

.room-chevron {
    color: var(--text-muted);
    flex-shrink: 0;
}

.room-admin-info {
    flex: 1;
    min-width: 0;
}

.room-admin-info strong {
    display: block;
    font-size: 15px;
    font-weight: 750;
}

.room-admin-info small {
    color: var(--text-muted);
    font-size: 12px;
}

.room-edit-panel {
    padding: 0 16px 4px;
    border-top: 1px solid var(--line);
    padding-top: 14px;
}

.room-members {
    padding: 14px 16px;
    border-top: 1px solid var(--line);
    background: rgba(56,211,159,0.03);
}

/* ── match-meta layout fix ─────────────────────────────────────────────── */
.match-meta {
    grid-column: 1 / -1;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding-top: 12px;
    border-top: 1px solid var(--line);
    flex-wrap: wrap;
}

@media (min-width: 769px) and (max-width: 980px) {
    .match-card {
        grid-template-columns: 1fr;
        align-items: stretch;
        gap: 12px;
    }
}

@media (min-width: 769px) and (max-width: 1180px) {
    .placeholder-edit {
        grid-template-columns: 1fr;
    }
    .placeholder-fields {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
    .placeholder-actions {
        justify-content: flex-start;
    }
}

/* ── Responsive additions ──────────────────────────────────────────────── */
@media (max-width: 768px) {
    .bet-form { flex-wrap: wrap; gap: 10px; }
    .bet-label { width: 100%; }
    .score-row { flex-direction: column; align-items: flex-start; }
    .score-row-date { font-size: 11px; }
    .bets-legend { gap: 8px 14px; }
    .room-admin-header { flex-wrap: wrap; }
    .ranking-item { grid-template-columns: 36px 36px minmax(0,1fr) auto; gap: 8px; padding: 10px 12px; }
    .placeholder-edit {
        grid-template-columns: 1fr;
        padding: 10px;
    }
    .placeholder-fields {
        grid-template-columns: 1fr;
    }
    .placeholder-actions {
        justify-content: space-between;
        width: 100%;
        flex-wrap: wrap;
    }
    .bet-edit-overlay { align-items: end; padding: 0; }
    .bet-edit-modal {
        width: 100%;
        border-radius: 8px 8px 0 0;
        padding: 18px 14px calc(18px + env(safe-area-inset-bottom));
    }
    .bet-edit-head h2 {
        font-size: clamp(13px, 4vw, 16px);
    }
    .bet-edit-matchup {
        grid-template-columns: minmax(0, 1fr) 24px minmax(0, 1fr);
        gap: 8px;
        padding: 0 10px;
        align-items: start;
    }
    .bet-edit-team {
        gap: 5px;
        line-height: 1.18;
    }
    .bet-edit-team .team-flag {
        font-size: 1em;
        margin-top: 1px;
    }
    .bet-edit-team span:last-child {
        white-space: normal;
        overflow: visible;
        text-overflow: clip;
        overflow-wrap: anywhere;
    }
    .bet-edit-vs {
        padding-top: 1px;
    }
    .bet-edit-score {
        grid-template-columns: minmax(0, 1fr) 24px minmax(0, 1fr);
        gap: 8px;
        padding: 10px;
    }
    .bet-edit-score input {
        min-height: 62px;
        font-size: 26px;
    }
    .bet-edit-actions .btn,
    .bet-edit-actions .btn-outlined,
    .bet-edit-actions .btn-danger {
        flex: 1;
    }
    .chat-card { grid-template-rows: auto minmax(320px, 54vh) auto; }
    .chat-toolbar { padding: 14px; }
    .chat-messages { padding: 12px; }
    .chat-message { max-width: 94%; grid-template-columns: 32px minmax(0, 1fr); gap: 8px; }
    .chat-message.mine { grid-template-columns: minmax(0, 1fr) 32px; }
    .chat-avatar { width: 32px; height: 32px; font-size: 11px; }
    .chat-compose { grid-template-columns: 1fr; }
    .chat-compose .btn { width: 100%; }
}

/* Emoji picker */
.chat-compose { display: flex; gap: 8px; align-items: flex-end; }
.chat-input-box { flex: 1; min-width: 0; border: 1px solid rgba(255,255,255,0.15); border-radius: 12px; background: #1e1e1e; overflow: hidden; }
.chat-input-box textarea { width: 100%; box-sizing: border-box; border: none; background: #1e1e1e; resize: none; padding: 10px 12px 4px; color: inherit; font: inherit; outline: none; min-height: 44px; max-height: 150px; overflow-y: auto; }
.emoji-row { position: relative; padding: 2px 8px 6px; }
.emoji-btn { background: none; border: none; font-size: 14px; cursor: pointer; opacity: 0.5; padding: 0; line-height: 1; }
.emoji-btn:hover { opacity: 1; }
.emoji-picker { position: absolute; bottom: 100%; left: 0; margin-bottom: 4px; display: flex; flex-wrap: wrap; gap: 2px; padding: 8px; background: #2a2a2a; border-radius: 10px; font-size: 20px; box-shadow: 0 4px 20px rgba(0,0,0,0.5); max-width: 260px; z-index: 100; }
.emoji-item { padding: 4px; border-radius: 6px; cursor: pointer; user-select: none; }
.emoji-item:hover { background: rgba(255,255,255,0.1); }
.emoji-item:active { transform: scale(1.2); }

/* Chat unread badge */
[data-route="chat"].has-badge { position: relative; }
[data-route="chat"].has-badge::after { content: ''; position: absolute; top: 4px; right: 4px; width: 8px; height: 8px; background: #e94560; border-radius: 50%; }
