:root {
    color-scheme: dark;
    --carbon: #0a0d12;
    --panel: #151d29;
    --panel-deep: #0e141c;
    --inset: #0d1219;
    --line: rgba(140, 165, 190, 0.24);
    --line-soft: rgba(140, 165, 190, 0.14);
    --text: #f2f5f8;
    --muted: #93a1b0;
    --red: #d7212e;
    --red-bright: #ef3541;
    --red-deep: #9e1220;
    --blue: #2a5d84;
    --blue-bright: #3f83b8;
    --blue-deep: #1b3a52;
    --silver: #d7dee6;
    --gold: #e9b83f;
    --gold-line: rgba(233, 184, 63, 0.42);
    --shadow: 0 16px 36px rgba(0, 0, 0, 0.55);
    --radius: 8px;
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
    box-sizing: border-box;
}

html {
    min-height: 100%;
    background: var(--carbon);
    /* Prevent iOS from inflating text or holding a stuck zoom in the PWA. */
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
    /* iOS ignores overflow clipping on body alone; html must carry it too,
       or any overflowing element makes the whole page pannable/zoomed. */
    overflow-x: clip;
}

/* Diamond-plate carbon floor */
body {
    min-height: 100%;
    margin: 0;
    color: var(--text);
    background:
        repeating-linear-gradient(45deg, rgba(255, 255, 255, 0.035) 0 2px, transparent 2px 18px),
        repeating-linear-gradient(-45deg, rgba(255, 255, 255, 0.028) 0 2px, transparent 2px 18px),
        radial-gradient(120% 90% at 50% 0%, #131a24 0%, var(--carbon) 62%),
        var(--carbon);
    overscroll-behavior-y: contain;
    overflow-x: clip;
}

button,
input,
select {
    font: inherit;
}

button {
    cursor: pointer;
}

.app-frame {
    min-height: 100vh;
    padding-bottom: env(safe-area-inset-bottom);
}

.topbar {
    position: sticky;
    top: 0;
    z-index: 20;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    min-height: 72px;
    padding: calc(12px + env(safe-area-inset-top)) 18px 12px;
    color: #fff;
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.05), rgba(0, 0, 0, 0.4)),
        repeating-linear-gradient(90deg, rgba(255, 255, 255, 0.018) 0 1px, transparent 1px 3px),
        #070a0e;
    border-bottom: 4px solid var(--red);
    box-shadow: 0 6px 22px rgba(0, 0, 0, 0.55);
}

.brand {
    display: inline-flex;
    align-items: center;
    min-width: 0;
    gap: 10px;
    color: inherit;
    text-decoration: none;
}

.brand strong,
.brand small {
    display: block;
    line-height: 1.02;
    font-style: italic;
    letter-spacing: 0.02em;
    text-transform: uppercase;
}

.brand strong {
    font-size: 0.98rem;
    font-weight: 900;
}

.brand small {
    color: var(--red-bright);
    font-size: 0.88rem;
    font-weight: 900;
}

.brand-logo {
    flex: 0 0 46px;
    width: 46px;
    height: 46px;
    object-fit: contain;
    filter: drop-shadow(0 3px 8px rgba(0, 0, 0, 0.6));
}

.app-shell {
    width: min(1040px, 100%);
    margin: 0 auto;
    padding: 18px 14px 42px;
}

.view-stack {
    display: grid;
    gap: 18px;
}

.dashboard-grid {
    display: grid;
    gap: 18px;
}

/* Grid items default to min-width:auto, so one unbreakable line deep inside
   a panel can force the whole column (and every sibling) wider than the
   screen. Let stack children shrink; inner content wraps or clips locally. */
.view-stack > *,
.dashboard-grid > *,
.sessions-grid > *,
.session-card > *,
.leaderboard > *,
.round-list > *,
.playoff-list > *,
.final-list > *,
.admin-list > * {
    min-width: 0;
}

/* Brushed steel panels */
.tool-panel,
.session-summary,
.scoreboard-band,
.playoff-band,
.history-band,
.final-band {
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.05), rgba(255, 255, 255, 0) 34%, rgba(0, 0, 0, 0.22)),
        repeating-linear-gradient(0deg, rgba(255, 255, 255, 0.014) 0 1px, transparent 1px 3px),
        var(--panel);
    border: 1px solid var(--line-soft);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

/* Full-bleed cosmos hero: no card, no border — the canvas melts into the
   diamond plate through a soft radial mask. */
.hero-cosmos {
    position: relative;
    display: grid;
    place-items: center;
    min-height: 330px;
    /* Full-bleed via a pinned 100vw width (not symmetric negative margins,
       which would amplify any accidental document overflow). */
    width: 100vw;
    margin: -18px 0 2px calc(50% - 50vw);
    padding: 46px 22px 40px;
    overflow: hidden;
    text-align: center;
    touch-action: pan-y;
}

.cosmos-canvas {
    position: absolute;
    top: 0;
    bottom: 0;
    /* Wider than the hero on purpose: the clipped edges live offscreen, so
       a nebula glow can never end in a visible vertical seam. (Explicit
       width — a canvas is replaced, so left+right+width:auto won't stretch.) */
    left: -64px;
    width: calc(100% + 128px);
    height: 100%;
    pointer-events: none;
    /* Guaranteed-zero alpha at top and bottom so the nebula dissolves into
       the diamond plate instead of ending on a hard edge. */
    -webkit-mask-image: linear-gradient(180deg, transparent 0, #000 38px, #000 calc(100% - 140px), transparent 100%);
    mask-image: linear-gradient(180deg, transparent 0, #000 38px, #000 calc(100% - 140px), transparent 100%);
}

.hero-cosmos-content {
    position: relative;
    z-index: 1;
    display: grid;
    gap: 16px;
    justify-items: center;
    max-width: 580px;
}

.hero-cosmos h1 {
    margin: 0;
    font-size: 1.95rem;
    line-height: 1.06;
    text-shadow:
        0 2px 20px rgba(215, 33, 46, 0.5),
        0 0 46px rgba(63, 131, 184, 0.4),
        0 1px 3px rgba(0, 0, 0, 0.8);
}

.eyebrow {
    margin: 0 0 8px;
    color: var(--red-bright);
    font-size: 0.78rem;
    font-weight: 900;
    font-style: italic;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

h1,
h2,
h3,
p {
    margin-top: 0;
}

h1 {
    max-width: 620px;
    margin-bottom: 8px;
    font-size: 2rem;
    font-style: italic;
    letter-spacing: 0.01em;
    line-height: 1.02;
    text-transform: uppercase;
}

h2 {
    margin-bottom: 12px;
    font-size: 1.25rem;
    line-height: 1.15;
}

h3 {
    margin-bottom: 8px;
    font-size: 1rem;
}

.tool-panel,
.session-summary,
.scoreboard-band,
.playoff-band,
.history-band,
.final-band {
    padding: 16px;
}

.panel-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 14px;
}

.panel-header p {
    margin-bottom: 0;
    color: var(--muted);
    font-size: 0.92rem;
}

.control-grid {
    display: grid;
    gap: 14px;
}

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

.field label,
.field-label {
    color: var(--muted);
    font-size: 0.78rem;
    font-weight: 800;
    text-transform: uppercase;
}

.segmented {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 6px;
    padding: 4px;
    background: var(--inset);
    border: 1px solid var(--line-soft);
    border-radius: var(--radius);
    box-shadow: inset 0 2px 6px rgba(0, 0, 0, 0.45);
}

.segmented button {
    min-height: 42px;
    border: 0;
    border-radius: 6px;
    color: var(--muted);
    background: transparent;
    font-weight: 800;
}

.segmented button.is-active {
    color: #fff;
    background: linear-gradient(180deg, var(--red-bright), var(--red-deep));
    box-shadow: 0 4px 12px rgba(215, 33, 46, 0.4);
}

.name-form {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 8px;
}

.input,
.score-input {
    width: 100%;
    min-height: 46px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    color: var(--text);
    background: var(--inset);
    padding: 0 12px;
    outline: none;
    box-shadow: inset 0 2px 6px rgba(0, 0, 0, 0.4);
}

.input::placeholder,
.score-input::placeholder {
    color: rgba(147, 161, 176, 0.65);
}

.input:focus,
.score-input:focus {
    border-color: var(--red-bright);
    box-shadow: inset 0 2px 6px rgba(0, 0, 0, 0.4), 0 0 0 3px rgba(215, 33, 46, 0.28);
}

.primary-button,
.secondary-button,
.ghost-button,
.danger-button,
.icon-button {
    min-height: 42px;
    border-radius: var(--radius);
    font-weight: 900;
    font-style: italic;
    letter-spacing: 0.02em;
    text-transform: uppercase;
}

a.secondary-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
}

.primary-button {
    border: 1px solid var(--red-deep);
    color: #fff;
    background: linear-gradient(180deg, var(--red-bright), var(--red-deep));
    padding: 0 16px;
    box-shadow: 0 6px 16px rgba(215, 33, 46, 0.38), inset 0 1px 0 rgba(255, 255, 255, 0.25);
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.35);
}

.primary-button:disabled {
    cursor: not-allowed;
    border-color: var(--line-soft);
    color: #5c6a78;
    background: #1a212c;
    box-shadow: none;
    text-shadow: none;
}

.secondary-button {
    border: 1px solid var(--blue-deep);
    color: #fff;
    background: linear-gradient(180deg, var(--blue-bright), var(--blue));
    padding: 0 14px;
    box-shadow: 0 5px 14px rgba(42, 93, 132, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.22);
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

.ghost-button {
    border: 1px solid rgba(255, 255, 255, 0.28);
    color: inherit;
    background: rgba(255, 255, 255, 0.08);
    padding: 0 12px;
}

.danger-button {
    border: 1px solid rgba(239, 53, 65, 0.5);
    color: #ff97a0;
    background: rgba(215, 33, 46, 0.14);
    padding: 0 12px;
}

.icon-button {
    display: inline-grid;
    place-items: center;
    width: 38px;
    min-height: 38px;
    border: 1px solid var(--line-soft);
    color: var(--muted);
    background: var(--inset);
}

.roster,
.pool {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.roster-chip,
.pool-chip,
.status-chip,
.seed-chip,
.delta-chip {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    min-height: 34px;
    max-width: 100%;
    border-radius: 999px;
    font-size: 0.88rem;
    font-weight: 800;
}

.roster-chip {
    color: #fff;
    background: linear-gradient(180deg, var(--blue-bright), var(--blue));
    border: 1px solid var(--blue-deep);
    padding: 0 6px 0 12px;
}

.pool-chip {
    position: relative;
    overflow: hidden;
    border: 1px solid var(--line);
    color: var(--text);
    background: var(--inset);
    padding: 0 5px 0 12px;
    touch-action: pan-y;
    transition: transform 140ms ease, opacity 140ms ease;
}

.pool-chip.is-swiping {
    transform: translateX(-28px);
    opacity: 0.75;
}

.chip-main {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.chip-rank {
    color: var(--muted);
    font-size: 0.76rem;
}

.roster-chip button,
.chip-remove {
    display: inline-grid;
    place-items: center;
    width: 28px;
    height: 28px;
    border: 0;
    border-radius: 50%;
    color: inherit;
    background: rgba(0, 0, 0, 0.25);
}

.chip-remove {
    color: var(--red-bright);
    background: rgba(215, 33, 46, 0.16);
}

.roster-meter {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    color: var(--muted);
    font-size: 0.9rem;
    font-weight: 800;
}

.meter-bar,
.progress-bar {
    position: relative;
    overflow: hidden;
    height: 10px;
    border-radius: 999px;
    background: rgba(0, 0, 0, 0.45);
    box-shadow: inset 0 1px 4px rgba(0, 0, 0, 0.6);
}

.meter-bar span,
.progress-bar span {
    position: absolute;
    inset: 0 auto 0 0;
    width: var(--progress, 0%);
    border-radius: inherit;
    background: linear-gradient(90deg, var(--red-deep), var(--red-bright) 55%, var(--silver));
}

.sessions-grid {
    display: grid;
    gap: 10px;
}

.session-card {
    display: grid;
    gap: 10px;
    padding: 14px;
    color: inherit;
    text-decoration: none;
    background: var(--panel-deep);
    border: 1px solid var(--line-soft);
    border-radius: var(--radius);
    box-shadow: 0 8px 18px rgba(0, 0, 0, 0.35);
}

.session-card-top,
.session-meta,
.game-meta,
.team-row,
.score-row,
.rank-row,
.final-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.session-card h3 {
    margin: 0;
}

.session-card p,
.empty-text {
    margin: 0;
    color: var(--muted);
    font-size: 0.9rem;
}

.status-chip {
    flex: 0 0 auto;
    min-height: 28px;
    padding: 0 10px;
    color: #fff;
    background: linear-gradient(180deg, var(--blue-bright), var(--blue));
    font-size: 0.75rem;
    font-style: italic;
    text-transform: uppercase;
}

.status-chip.is-complete {
    color: #10151d;
    background: linear-gradient(180deg, #ffffff, var(--silver));
}

.status-chip.is-playoffs {
    color: #fff;
    background: linear-gradient(180deg, var(--red-bright), var(--red-deep));
}

.session-meta {
    justify-content: flex-start;
    flex-wrap: wrap;
    color: var(--muted);
    font-size: 0.82rem;
}

.session-hero {
    position: relative;
    display: grid;
    /* minmax(0, …): children (e.g. the inline name editor) shrink instead of
       stretching the track past the viewport. */
    grid-template-columns: minmax(0, 1fr);
    gap: 14px;
    padding: 16px;
    color: #fff;
    background:
        linear-gradient(135deg, rgba(7, 10, 14, 0.95), rgba(27, 58, 82, 0.85) 60%, rgba(158, 18, 32, 0.62)),
        repeating-linear-gradient(90deg, transparent 0 78px, rgba(255, 255, 255, 0.08) 78px 81px),
        var(--blue-deep);
    border: 1px solid rgba(215, 33, 46, 0.35);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.session-hero h1 {
    margin-bottom: 0;
}

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

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

.stat-box {
    min-height: 72px;
    padding: 10px;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.16);
    border-radius: var(--radius);
}

.stat-box strong {
    display: block;
    font-size: 1.3rem;
    font-style: italic;
}

.stat-box span {
    color: rgba(255, 255, 255, 0.72);
    font-size: 0.78rem;
    font-weight: 800;
    text-transform: uppercase;
}

.leaderboard {
    display: grid;
    gap: 8px;
}

.rank-row {
    min-height: 58px;
    padding: 10px;
    background: var(--panel-deep);
    border: 1px solid var(--line-soft);
    border-radius: var(--radius);
}

.rank-left {
    display: flex;
    align-items: center;
    min-width: 0;
    gap: 10px;
}

.rank-number {
    display: inline-grid;
    flex: 0 0 34px;
    width: 34px;
    height: 34px;
    place-items: center;
    border-radius: 50%;
    color: #fff;
    background: linear-gradient(180deg, var(--red-bright), var(--red-deep));
    border: 1px solid rgba(255, 255, 255, 0.22);
    font-weight: 900;
    font-style: italic;
}

.rank-name {
    min-width: 0;
}

.rank-name strong,
.rank-meta {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.rank-meta {
    color: var(--muted);
    font-size: 0.78rem;
}

.rank-stats {
    display: grid;
    grid-auto-flow: column;
    gap: 10px;
    text-align: right;
}

.rank-stats strong {
    display: block;
    font-size: 0.94rem;
    white-space: nowrap;
}

.rank-stats span {
    color: var(--muted);
    font-size: 0.68rem;
    font-weight: 900;
    text-transform: uppercase;
    white-space: nowrap;
}

.seed-chip {
    display: inline-flex;
    width: fit-content;
    min-height: 24px;
    margin-top: 4px;
    padding: 0 10px;
    color: #fff;
    background: linear-gradient(180deg, var(--blue-bright), var(--blue));
    border: 1px solid rgba(255, 255, 255, 0.24);
    box-shadow: inset 0 -1px 0 rgba(0, 0, 0, 0.3);
    font-size: 0.72rem;
    line-height: 1;
    text-transform: uppercase;
}

.round-list,
.playoff-list,
.team-grid,
.final-list {
    display: grid;
    gap: 10px;
}

.round-card,
.game-card,
.team-card {
    padding: 12px;
    background: var(--panel-deep);
    border: 1px solid var(--line-soft);
    border-radius: var(--radius);
}

.round-card {
    display: grid;
    gap: 10px;
}

.round-card.is-locked {
    color: var(--muted);
    background: rgba(13, 18, 25, 0.5);
    border-style: dashed;
}

.round-title {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin: 0;
}

.game-card {
    display: grid;
    gap: 10px;
}

.game-meta {
    color: var(--muted);
    font-size: 0.78rem;
    font-weight: 900;
    font-style: italic;
    text-transform: uppercase;
}

.team-row {
    align-items: stretch;
    padding: 8px;
    background: var(--inset);
    border: 1px solid transparent;
    border-radius: 6px;
}

.team-row.is-winner {
    color: #fff;
    background: rgba(215, 33, 46, 0.16);
    border-color: rgba(239, 53, 65, 0.55);
    outline: 2px solid rgba(215, 33, 46, 0.45);
}

.team-names {
    min-width: 0;
    align-self: center;
    font-weight: 900;
}

.team-names span {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.score-inputs {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) auto;
    gap: 8px;
}

.score-input {
    min-width: 0;
    text-align: center;
    font-weight: 900;
}

.score-value {
    display: inline-grid;
    place-items: center;
    width: 44px;
    min-height: 42px;
    color: #fff;
    background: linear-gradient(180deg, #23364a, #16222f);
    border: 1px solid var(--line-soft);
    border-radius: 6px;
    font-weight: 900;
    font-style: italic;
}

.team-row.is-winner .score-value {
    background: linear-gradient(180deg, var(--red-bright), var(--red-deep));
    border-color: rgba(255, 255, 255, 0.25);
}

.confirm-strip {
    display: grid;
    gap: 10px;
    padding: 14px;
    color: #fff;
    background:
        linear-gradient(120deg, rgba(158, 18, 32, 0.92), rgba(90, 9, 18, 0.95)),
        repeating-linear-gradient(45deg, rgba(255, 255, 255, 0.05) 0 2px, transparent 2px 16px),
        var(--red-deep);
    border: 1px solid rgba(239, 53, 65, 0.5);
    border-radius: var(--radius);
}

.confirm-strip p {
    margin: 0;
    color: rgba(255, 255, 255, 0.85);
}

.team-card {
    display: grid;
    gap: 8px;
}

.team-card strong {
    font-size: 1.05rem;
    font-style: italic;
}

.team-card span {
    color: var(--muted);
}

.final-band {
    position: relative;
    overflow: hidden;
    color: #fff;
    background:
        linear-gradient(135deg, rgba(7, 10, 14, 0.96), rgba(158, 18, 32, 0.9)),
        repeating-linear-gradient(-45deg, rgba(255, 255, 255, 0.05) 0 2px, transparent 2px 18px),
        var(--red-deep);
    border: 1px solid rgba(239, 53, 65, 0.5);
}

.final-band::before {
    position: absolute;
    inset: 0;
    pointer-events: none;
    content: "";
    background:
        linear-gradient(90deg, transparent 0 18%, rgba(239, 53, 65, 0.7) 18% 20%, transparent 20% 46%, rgba(255, 255, 255, 0.5) 46% 48%, transparent 48%),
        linear-gradient(135deg, transparent 0 28%, rgba(63, 131, 184, 0.6) 28% 30%, transparent 30%);
    background-size: 120px 80px, 160px 110px;
    opacity: 0.35;
}

.final-band > * {
    position: relative;
}

.final-band p {
    color: rgba(255, 255, 255, 0.85);
}

.final-row {
    padding: 10px;
    color: var(--text);
    background: rgba(10, 13, 18, 0.72);
    border: 1px solid rgba(255, 255, 255, 0.14);
    border-radius: var(--radius);
}

.delta-chip {
    min-height: 28px;
    padding: 0 9px;
    color: #fff;
    background: linear-gradient(180deg, var(--blue-bright), var(--blue));
    font-size: 0.78rem;
}

.delta-chip.is-down {
    background: linear-gradient(180deg, var(--red-bright), var(--red-deep));
}

.loading-card {
    display: grid;
    place-items: center;
    min-height: 280px;
    gap: 14px;
    padding: 24px;
    color: var(--muted);
    background: var(--panel);
    border: 1px solid var(--line-soft);
    border-radius: var(--radius);
}

.loading-logo {
    width: 128px;
    height: 128px;
    object-fit: contain;
    filter: drop-shadow(0 10px 26px rgba(0, 0, 0, 0.6));
    animation: logo-pulse 1.6s ease-in-out infinite;
}

@keyframes logo-pulse {
    0%,
    100% {
        transform: scale(1);
        opacity: 0.85;
    }
    50% {
        transform: scale(1.06);
        opacity: 1;
    }
}

@media (prefers-reduced-motion: reduce) {
    .loading-logo {
        animation: none;
    }
}

/* ---------------------------------------------------------------------------
   The Pickle: full-screen (non-blocking) celebration for a shutout game.
   A dancing pickle crosses the court, confetti falls, PICKLE! pops.
--------------------------------------------------------------------------- */
.pickle-party {
    position: fixed;
    inset: 0;
    z-index: 90;
    overflow: hidden;
    pointer-events: none;
}

.pickle-party.is-leaving {
    animation: pickle-fade 0.7s ease forwards;
}

@keyframes pickle-fade {
    to { opacity: 0; }
}

.pickle-shout {
    position: absolute;
    top: 16vh;
    left: 0;
    right: 0;
    text-align: center;
    font-size: clamp(3.2rem, 17vw, 6.5rem);
    font-style: italic;
    font-weight: 900;
    letter-spacing: 0.03em;
    color: #ffd854;
    text-shadow:
        0 3px 0 rgba(60, 112, 40, 0.9),
        0 10px 28px rgba(0, 0, 0, 0.55),
        0 0 42px rgba(255, 216, 84, 0.5);
    animation:
        pickle-shout-pop 0.55s cubic-bezier(0.2, 1.6, 0.4, 1) both,
        pickle-shout-swing 0.9s ease-in-out 0.55s infinite alternate;
}

@keyframes pickle-shout-pop {
    from { opacity: 0; transform: scale(0.3) rotate(-8deg); }
    to { opacity: 1; transform: scale(1) rotate(-3deg); }
}

@keyframes pickle-shout-swing {
    from { transform: scale(1) rotate(-3deg); }
    to { transform: scale(1.06) rotate(3deg); }
}

/* The dancer tours: in from the left, boogie, backflip, double flip,
   stick the landing, cartwheel off stage right. ~7 seconds of show. */
.pickle-dancer {
    position: absolute;
    bottom: 9vh;
    left: 50%;
    width: clamp(190px, 27vw, 270px);
    margin-left: calc(clamp(190px, 27vw, 270px) / -2);
    animation: pickle-tour 7s ease-in-out forwards;
    filter: drop-shadow(0 16px 20px rgba(0, 0, 0, 0.5));
}

@keyframes pickle-tour {
    0% { transform: translateX(-75vw); }
    16% { transform: translateX(0); }
    76% { transform: translateX(0); }
    100% { transform: translateX(85vw); }
}

/* Acrobatics layer: jumps and rotations around the center of mass. */
.pickle-acro {
    transform-origin: 50% 52%;
    animation: pickle-acro 7s linear forwards;
}

@keyframes pickle-acro {
    0%, 20% {
        transform: translateY(0) rotate(0deg);
        animation-timing-function: ease-out;
    }
    /* Backflip */
    26% {
        transform: translateY(-24vh) rotate(-180deg);
        animation-timing-function: ease-in;
    }
    32% {
        transform: translateY(0) rotate(-360deg);
        animation-timing-function: ease-out;
    }
    /* Beat of boogie between tricks */
    44% {
        transform: translateY(0) rotate(-360deg);
        animation-timing-function: ease-out;
    }
    /* Double flip */
    51% {
        transform: translateY(-30vh) rotate(-720deg);
        animation-timing-function: ease-in;
    }
    58% {
        transform: translateY(0) rotate(-1080deg);
        animation-timing-function: ease-out;
    }
    /* Stick the landing, take the applause */
    76% {
        transform: translateY(0) rotate(-1080deg);
        animation-timing-function: linear;
    }
    /* Cartwheel off stage */
    100% {
        transform: translateY(0) rotate(-1440deg);
    }
}

.pickle-guy {
    display: block;
    width: 100%;
    height: auto;
    transform-origin: 50% 88%;
    animation: pickle-bop 0.42s ease-in-out infinite alternate;
}

@keyframes pickle-bop {
    from { transform: rotate(-8deg) translateY(0); }
    to { transform: rotate(8deg) translateY(-10px); }
}

.pickle-arm,
.pickle-leg {
    transform-box: fill-box;
}

.pickle-arm-l {
    transform-origin: 100% 100%;
    animation: pickle-wave-l 0.42s ease-in-out infinite alternate;
}

@keyframes pickle-wave-l {
    from { transform: rotate(-34deg); }
    to { transform: rotate(16deg); }
}

.pickle-arm-r {
    transform-origin: 0% 100%;
    animation: pickle-wave-r 0.42s ease-in-out infinite alternate-reverse;
}

@keyframes pickle-wave-r {
    from { transform: rotate(-16deg); }
    to { transform: rotate(34deg); }
}

.pickle-leg-l {
    transform-origin: 100% 0%;
    animation: pickle-kick-l 0.42s ease-in-out infinite alternate-reverse;
}

@keyframes pickle-kick-l {
    from { transform: rotate(-12deg); }
    to { transform: rotate(10deg); }
}

.pickle-leg-r {
    transform-origin: 0% 0%;
    animation: pickle-kick-r 0.42s ease-in-out infinite alternate;
}

@keyframes pickle-kick-r {
    from { transform: rotate(-10deg); }
    to { transform: rotate(12deg); }
}

.pickle-confetti {
    position: absolute;
    top: -20px;
    border-radius: 2px;
    opacity: 0;
    animation: pickle-confetti-fall 2.8s ease-in forwards;
}

@keyframes pickle-confetti-fall {
    0% { opacity: 0; transform: translateY(-4vh) rotate(0deg); }
    8% { opacity: 1; }
    100% { opacity: 0.9; transform: translateY(var(--dy)) rotate(var(--spin)); }
}

@media (prefers-reduced-motion: reduce) {
    .pickle-party {
        display: none;
    }
}

/* Bottom-sheet toast: slides up from below, bleeds off the bottom edge,
   slides back down on dismiss. Install-sheet card language with a gold
   glow (the comet color) so alerts stand out from the steel panels. */
.toast {
    position: fixed;
    left: 50%;
    bottom: 0;
    z-index: 50;
    width: min(430px, calc(100vw - 28px));
    padding: 15px 18px calc(22px + env(safe-area-inset-bottom));
    color: var(--text);
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.05), rgba(255, 255, 255, 0) 34%, rgba(0, 0, 0, 0.22)),
        var(--panel);
    border: 1px solid var(--line);
    border-bottom: 0;
    border-radius: 14px 14px 0 0;
    /* Gold glows need spread (blur-only vanishes on the near-black page)
       and must precede the drop shadow, which would paint over them. */
    box-shadow:
        0 0 26px 5px rgba(255, 216, 84, 0.32),
        0 0 8px 1px rgba(255, 216, 84, 0.26),
        var(--shadow);
    /* Hidden = slid below the viewport (150% clears the glow too) plus
       visibility:hidden as a guarantee that nothing paints even if a
       browser mishandles the transform. During the slide-out animation,
       showToast/hideToast keep visibility on via an inline style. */
    transform: translate(-50%, 150%);
    visibility: hidden;
    pointer-events: none;
    transition: transform 320ms cubic-bezier(0.32, 0.9, 0.35, 1);
}

.toast.is-visible {
    transform: translate(-50%, 0);
    visibility: visible;
    pointer-events: auto;
}

.toast-title {
    display: block;
    padding: 0 30px;
    text-align: center;
    font-size: 1.02rem;
    font-weight: 800;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.toast-body {
    margin: 8px 0 0;
    text-align: center;
}

.toast-close {
    position: absolute;
    top: 11px;
    right: 12px;
    display: grid;
    place-items: center;
    width: 24px;
    height: 24px;
    padding: 0;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid var(--line-soft);
    border-radius: 50%;
    color: var(--muted);
    font-size: 0.95rem;
    line-height: 1;
    cursor: pointer;
}

.pull-refresh {
    position: fixed;
    top: calc(12px + env(safe-area-inset-top));
    left: 50%;
    z-index: 70;
    display: inline-flex;
    align-items: center;
    gap: 9px;
    min-height: 40px;
    padding: 0 14px;
    color: #fff;
    background: rgba(10, 13, 18, 0.96);
    border: 1px solid var(--line);
    border-radius: 999px;
    box-shadow: var(--shadow);
    font-size: 0.84rem;
    font-weight: 900;
    opacity: 0;
    pointer-events: none;
    transform: translate(-50%, calc(-58px + var(--pull-distance, 0px)));
    transition: opacity 140ms ease, transform 140ms ease;
}

.pull-refresh.is-visible {
    opacity: 1;
}

.pull-refresh.is-ready {
    background: var(--red-deep);
    border-color: var(--red-bright);
}

.pull-refresh-spinner {
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255, 255, 255, 0.35);
    border-top-color: var(--red-bright);
    border-radius: 50%;
}

.pull-refresh.is-refreshing .pull-refresh-spinner {
    animation: refresh-spin 720ms linear infinite;
}

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

.tab-bar {
    position: fixed;
    right: 0;
    bottom: 0;
    left: 0;
    z-index: 40;
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 4px;
    padding: 8px 10px calc(8px + env(safe-area-inset-bottom));
    background:
        repeating-linear-gradient(45deg, rgba(255, 255, 255, 0.03) 0 2px, transparent 2px 14px),
        repeating-linear-gradient(-45deg, rgba(255, 255, 255, 0.025) 0 2px, transparent 2px 14px),
        rgba(7, 10, 14, 0.98);
    border-top: 3px solid var(--red);
    box-shadow: 0 -10px 26px rgba(0, 0, 0, 0.6);
}

.tab-bar button {
    display: grid;
    place-items: center;
    gap: 2px;
    min-height: 52px;
    border: 0;
    border-radius: var(--radius);
    color: rgba(255, 255, 255, 0.6);
    background: transparent;
    font-size: 0.82rem;
    font-weight: 900;
    font-style: italic;
    text-transform: uppercase;
}

.tab-bar button.is-active {
    color: #fff;
    background: linear-gradient(180deg, var(--red-bright), var(--red-deep));
    box-shadow: 0 4px 14px rgba(215, 33, 46, 0.45);
}

.tab-icon {
    font-size: 0.72rem;
    line-height: 1;
}

body.has-tabs .app-shell {
    padding-bottom: calc(96px + env(safe-area-inset-bottom));
}

/* (No .toast override here: the bottom-sheet toast deliberately anchors to
   the true bottom edge and slides over the tab bar, then out of the way.) */

.stepper {
    display: grid;
    grid-template-columns: 48px minmax(0, 1fr) 48px;
    align-items: center;
    gap: 6px;
    padding: 4px;
    background: var(--inset);
    border: 1px solid var(--line-soft);
    border-radius: var(--radius);
    box-shadow: inset 0 2px 6px rgba(0, 0, 0, 0.45);
}

.stepper strong {
    text-align: center;
    font-size: 1.15rem;
    font-style: italic;
}

.stepper button {
    min-height: 42px;
    border: 1px solid var(--blue-deep);
    border-radius: 6px;
    color: #fff;
    background: linear-gradient(180deg, var(--blue-bright), var(--blue));
    font-size: 1.15rem;
    font-weight: 900;
}

.field-hint {
    color: var(--muted);
    font-style: normal;
    font-weight: 700;
    text-transform: none;
}

.session-hero.is-compact {
    gap: 10px;
    padding: 14px 16px;
}

.session-hero.is-compact h1 {
    font-size: 1.45rem;
}

.hero-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 6px 14px;
    color: rgba(255, 255, 255, 0.82);
    font-size: 0.84rem;
    font-weight: 800;
}

/* When the note sits directly in a panel (not inside a gapped grid), it
   needs its own breathing room. */
.history-band > .sitters-note,
.playoff-band > .sitters-note {
    margin-bottom: 12px;
}

.up-next .sitters-note {
    margin-top: 8px;
}

.sitters-note {
    margin: 0;
    padding: 9px 12px;
    color: #bcd9ef;
    background: rgba(63, 131, 184, 0.14);
    border: 1px solid rgba(63, 131, 184, 0.4);
    border-radius: var(--radius);
    font-size: 0.9rem;
}

.up-next {
    margin-top: 12px;
    padding: 12px;
    background: rgba(13, 18, 25, 0.6);
    border: 1px dashed var(--line);
    border-radius: var(--radius);
}

.up-next h3 {
    margin-bottom: 6px;
}

.up-next p {
    margin: 0 0 4px;
    color: var(--muted);
    font-size: 0.9rem;
    font-weight: 700;
}

.up-next em,
.locked-matchup em {
    color: var(--red-bright);
    font-style: italic;
    font-weight: 900;
}

.locked-matchup {
    margin: 0;
    font-size: 0.88rem;
    font-weight: 700;
}

.consolation-strip {
    display: grid;
    gap: 10px;
    margin-top: 12px;
    padding: 14px;
    color: #fff;
    background:
        linear-gradient(120deg, rgba(27, 58, 82, 0.95), rgba(15, 33, 47, 0.95)),
        repeating-linear-gradient(45deg, rgba(255, 255, 255, 0.04) 0 2px, transparent 2px 16px),
        var(--blue-deep);
    border: 1px solid rgba(63, 131, 184, 0.45);
    border-radius: var(--radius);
}

.consolation-strip h3 {
    margin-bottom: 4px;
}

.consolation-strip p {
    margin: 0;
    color: rgba(255, 255, 255, 0.82);
    font-size: 0.9rem;
}

.consolation-strip .secondary-button {
    border-color: rgba(255, 255, 255, 0.4);
    background: rgba(255, 255, 255, 0.14);
    box-shadow: none;
}

.segmented.is-on-dark {
    background: rgba(0, 0, 0, 0.35);
    border-color: rgba(255, 255, 255, 0.2);
}

.segmented.is-on-dark button {
    color: rgba(255, 255, 255, 0.72);
}

.segmented.is-on-dark button.is-active {
    color: var(--red-deep);
    background: #fff;
    box-shadow: none;
}

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

.roster-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    min-height: 56px;
    padding: 8px 12px;
    background: var(--panel-deep);
    border: 1px solid var(--line-soft);
    border-radius: var(--radius);
}

.roster-row strong {
    display: block;
}

.roster-row span {
    color: var(--muted);
    font-size: 0.8rem;
}

.roster-row.is-departed {
    background: rgba(13, 18, 25, 0.45);
    border-style: dashed;
}

.roster-row.is-departed strong {
    color: var(--muted);
    text-decoration: line-through;
}

.rank-row.is-departed {
    opacity: 0.62;
}

.departed-chip {
    display: inline-flex;
    align-items: center;
    width: fit-content;
    min-height: 24px;
    margin-top: 4px;
    padding: 0 10px;
    color: #fff;
    background: linear-gradient(180deg, var(--red-bright), var(--red-deep));
    border-radius: 999px;
    font-size: 0.72rem;
    font-weight: 800;
    line-height: 1;
    text-transform: uppercase;
}

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

.stepper.is-inline {
    grid-template-columns: 44px 52px 44px;
}

.hero-cta {
    position: relative;
    width: auto;
    padding: 0 26px;
    font-size: 1.05rem;
}

a.rank-row {
    color: inherit;
    text-decoration: none;
}

a.final-row {
    color: var(--text);
    text-decoration: none;
}

.player-stats .stat-box {
    color: var(--text);
    background: var(--inset);
    border: 1px solid var(--line-soft);
}

.player-stats .stat-box span {
    color: var(--muted);
}

.trend-wrap {
    margin-top: 16px;
}

.trend-chart-box {
    padding: 10px 12px 8px;
    background: var(--inset);
    border: 1px solid var(--line-soft);
    border-radius: var(--radius);
}

.trend-chart {
    display: block;
    width: 100%;
    height: 140px;
}

.trend-chart .trend-line {
    fill: none;
    stroke: var(--red-bright);
    stroke-width: 3.5;
    stroke-linejoin: round;
    stroke-linecap: round;
}

.trend-chart .trend-zero {
    stroke: rgba(140, 165, 190, 0.35);
    stroke-width: 1.5;
    stroke-dasharray: 6 6;
}

.trend-chart circle {
    fill: #fff;
    stroke: var(--red-deep);
    stroke-width: 2;
}

.trend-labels {
    display: flex;
    justify-content: space-between;
    margin-top: 6px;
    color: var(--muted);
    font-size: 0.8rem;
    font-weight: 800;
}

.player-night {
    align-items: center;
}

.player-night > div:first-child {
    min-width: 0;
}

.player-night > div:first-child strong,
.player-night > div:first-child span {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.player-night > div:first-child span {
    margin-top: 3px;
    color: var(--muted);
    font-size: 0.85rem;
}

.player-night > div:last-child {
    display: grid;
    flex: 0 0 auto;
    justify-items: end;
    gap: 4px;
}

.player-night > div:last-child strong {
    font-size: 1.12rem;
    font-style: italic;
    line-height: 1;
}

.player-night .delta-chip {
    min-height: 20px;
    padding: 0 8px;
    font-size: 0.68rem;
}

.roster-add-field {
    margin-top: 16px;
}

.roster-add-field .pool:not([hidden]) {
    margin-top: 2px;
}

.score-help {
    margin-top: 14px;
    padding: 12px 14px;
    background: rgba(13, 18, 25, 0.6);
    border: 1px dashed var(--line);
    border-radius: var(--radius);
}

.score-help h3 {
    margin-bottom: 6px;
    font-size: 0.9rem;
}

.score-help ul {
    margin: 0;
    padding-left: 18px;
    color: var(--muted);
    font-size: 0.88rem;
}

.score-help li {
    margin-bottom: 4px;
}

.score-help li:last-child {
    margin-bottom: 0;
}

[data-create-session] .primary-button {
    width: 100%;
    margin-top: 4px;
}

.game-card.is-skipped {
    border-style: dashed;
    opacity: 0.72;
}

.game-card.is-skipped .score-value {
    color: var(--muted);
    background: var(--inset);
}

.landing-tagline {
    max-width: 460px;
    margin: 0;
    color: rgba(255, 255, 255, 0.85);
    text-shadow: 0 1px 6px rgba(0, 0, 0, 0.8);
}

.auth-panel {
    max-width: 520px;
    width: 100%;
    margin: 0 auto;
}

.auth-modes {
    margin-bottom: 14px;
}

.auth-submit {
    width: 100%;
}

.auth-back {
    width: 100%;
    margin-top: 10px;
}

.auth-code-input {
    letter-spacing: 0.35em;
    text-align: center;
    font-size: 1.4rem;
    font-weight: 900;
}

.join-banner {
    margin-bottom: 14px;
    padding: 12px 14px;
    color: #bcd9ef;
    background: rgba(63, 131, 184, 0.14);
    border: 1px solid rgba(63, 131, 184, 0.4);
    border-radius: var(--radius);
}

/* Topbar right side: install button + hamburger. */
.topbar-actions {
    display: flex;
    align-items: center;
    flex: 0 0 auto;
    gap: 10px;
}

/* Two horizontal lines that pivot into an X when the menu opens. */
.menu-toggle {
    position: relative;
    width: 44px;
    height: 38px;
    padding: 0;
    background: transparent;
    border: 1px solid var(--line-soft);
    border-radius: 8px;
    cursor: pointer;
}

.menu-toggle span {
    position: absolute;
    left: 12px;
    right: 12px;
    height: 2px;
    background: var(--silver);
    border-radius: 2px;
    transition: transform 0.28s ease, top 0.28s ease;
}

.menu-toggle span:first-child {
    top: 14px;
}

.menu-toggle span:last-child {
    top: 22px;
}

.menu-toggle.is-open span:first-child {
    top: 18px;
    transform: rotate(45deg);
}

.menu-toggle.is-open span:last-child {
    top: 18px;
    transform: rotate(-45deg);
}

.app-menu {
    position: fixed;
    top: calc(64px + env(safe-area-inset-top));
    right: 12px;
    z-index: 30;
    min-width: 230px;
    max-width: calc(100vw - 24px);
    padding: 6px;
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.05), rgba(255, 255, 255, 0) 34%, rgba(0, 0, 0, 0.22)),
        var(--panel-deep);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.menu-head {
    padding: 10px 12px 12px;
    border-bottom: 1px solid var(--line-soft);
    margin-bottom: 6px;
}

.menu-head strong {
    display: block;
    font-style: italic;
    text-transform: uppercase;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.menu-head span {
    color: var(--muted);
    font-size: 0.8rem;
}

.menu-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    width: 100%;
    padding: 11px 12px;
    background: transparent;
    border: 0;
    border-radius: 6px;
    color: var(--text);
    font: inherit;
    font-weight: 600;
    text-align: left;
    text-decoration: none;
    cursor: pointer;
}

.menu-item:active {
    background: rgba(255, 255, 255, 0.06);
}

.menu-badge {
    min-width: 22px;
    padding: 2px 7px;
    background: linear-gradient(180deg, var(--red-bright), var(--red-deep));
    border-radius: 999px;
    font-size: 0.75rem;
    font-style: normal;
    font-weight: 800;
    text-align: center;
}

/* Organizer nudge on the dashboard when join requests are waiting. */
.pending-banner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    width: 100%;
    padding: 13px 16px;
    background:
        linear-gradient(180deg, rgba(215, 33, 46, 0.16), rgba(215, 33, 46, 0.04)),
        var(--panel-deep);
    border: 1px solid rgba(215, 33, 46, 0.4);
    border-radius: var(--radius);
    color: var(--text);
    font: inherit;
    cursor: pointer;
}

.pending-banner span {
    flex: 0 0 auto;
    padding: 6px 14px;
    background: linear-gradient(180deg, var(--red-bright), var(--red-deep));
    border-radius: 999px;
    font-size: 0.78rem;
    font-weight: 800;
    font-style: italic;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.pending-panel .pending-note {
    margin: 14px 0 0;
    color: var(--muted);
}

/* Members screen rows */
.member-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 10px;
    padding: 12px 14px;
    background: var(--inset);
    border: 1px solid var(--line-soft);
    border-radius: var(--radius);
}

.member-row.is-pending {
    border-color: rgba(215, 33, 46, 0.4);
}

.member-row-name strong {
    display: block;
    font-style: italic;
    text-transform: uppercase;
}

.member-row-name span {
    color: var(--muted);
    font-size: 0.8rem;
}

.member-state.is-joined {
    color: #6fc86f;
}

.member-state.is-invited {
    color: var(--blue-bright);
}

.member-row-actions {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 8px;
    align-items: center;
}

.member-row-actions .member-select {
    grid-column: 1 / -1;
}

.member-buttons {
    grid-column: 1 / -1;
    display: flex;
    gap: 8px;
}

.member-buttons .primary-button {
    flex: 1;
}

/* Own player card: compact Update pinned to the hero's top-right corner. */
.edit-name-button {
    position: absolute;
    top: 12px;
    right: 12px;
    min-height: 0;
    padding: 6px 12px;
    font-size: 0.72rem;
}

/* One row, always: the field flexes, the buttons never wrap. */
.name-edit {
    display: flex;
    gap: 8px;
    align-items: center;
    margin-top: 4px;
}

.name-edit .input {
    flex: 1 1 auto;
    width: auto;
    min-width: 0;
}

.name-edit .primary-button,
.name-edit .ghost-button {
    flex: 0 0 auto;
}

/* Current group atop the dashboard hero; dropdown switcher for multi-group
   folks. Tighter hero when it carries the pill. */
.hero-cosmos.is-dashboard {
    min-height: 280px;
    padding-top: 26px;
    padding-bottom: 34px;
}

.group-pill-wrap {
    position: relative;
    z-index: 2;
    display: flex;
    justify-content: center;
}

/* Pinned just under the topbar's red line, clear of the headline. */
.hero-cosmos.is-dashboard .group-pill-wrap {
    position: absolute;
    top: 12px;
    left: 0;
    right: 0;
}

.group-pill {
    display: inline-flex;
    align-items: center;
    gap: 9px;
    max-width: 100%;
    min-height: 0;
    padding: 8px 16px;
    background: var(--panel-deep);
    border: 1px solid var(--line-soft);
    border-radius: 999px;
    color: var(--text);
    font-size: 0.85rem;
    font-weight: 800;
    font-style: italic;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    cursor: pointer;
}

.group-pill span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.group-pill[disabled] {
    cursor: default;
}

.group-pill-chevron {
    flex: 0 0 auto;
    width: 8px;
    height: 8px;
    margin-top: -4px;
    border-right: 2px solid var(--muted);
    border-bottom: 2px solid var(--muted);
    transform: rotate(45deg);
}

.group-pill-menu {
    position: absolute;
    top: calc(100% + 8px);
    left: 50%;
    transform: translateX(-50%);
    z-index: 30;
    min-width: 230px;
    max-width: calc(100vw - 28px);
    padding: 6px;
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.05), rgba(255, 255, 255, 0) 34%, rgba(0, 0, 0, 0.22)),
        var(--panel-deep);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.group-pill-option {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    width: 100%;
    padding: 11px 12px;
    background: transparent;
    border: 0;
    border-radius: 6px;
    color: var(--text);
    font: inherit;
    text-align: left;
    cursor: pointer;
}

.group-pill-option strong {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-style: italic;
    text-transform: uppercase;
}

.group-pill-option span {
    flex: 0 0 auto;
    color: var(--muted);
    font-size: 0.75rem;
}

.group-pill-option.is-current span {
    color: var(--blue-bright);
}

.group-pill-option:active {
    background: rgba(255, 255, 255, 0.06);
}

/* Profile: tap-to-switch rows for shared groups. */
button.member-row {
    width: 100%;
    text-align: left;
    color: var(--text);
    font: inherit;
    cursor: pointer;
}

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

.group-jump-go {
    flex: 0 0 auto;
    padding: 6px 14px;
    background: linear-gradient(180deg, var(--blue-bright), var(--blue));
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 800;
    font-style: italic;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.group-sheet-note {
    margin: 0;
    color: var(--muted);
    font-size: 0.9rem;
}

.group-sheet .install-sheet-card .input {
    width: 100%;
}

.group-sheet-actions {
    display: flex;
    gap: 10px;
    width: 100%;
}

.group-sheet-actions .primary-button {
    flex: 1;
}

.pending-switch {
    display: grid;
    gap: 8px;
    margin-top: 14px;
}

.pending-switch p {
    margin: 0;
    color: var(--muted);
    font-size: 0.85rem;
}

/* Live Now: in-progress sessions anyone can tap into and follow. The
   wrapper div always exists so the poller can swap content in place;
   hide it when empty so it doesn't add a phantom grid gap. */
[data-live-now]:empty {
    display: none;
}

.live-now {
    display: grid;
    /* minmax(0, …): the track must never grow past the container just
       because a card holds a long nowrap player list. */
    grid-template-columns: minmax(0, 1fr);
    gap: 10px;
    padding: 14px 16px 16px;
    background:
        linear-gradient(180deg, rgba(215, 33, 46, 0.12), rgba(215, 33, 46, 0.02) 55%),
        var(--panel-deep);
    border: 1px solid rgba(215, 33, 46, 0.35);
    border-radius: var(--radius);
    box-shadow: 0 0 22px rgba(215, 33, 46, 0.14);
}

.live-now-header {
    display: flex;
    align-items: baseline;
    gap: 10px;
    min-width: 0;
}

.live-now-header h2 {
    margin: 0;
    font-size: 1.05rem;
    font-style: italic;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.live-now-sub {
    color: var(--muted);
    font-size: 0.8rem;
}

.live-dot {
    align-self: center;
    width: 10px;
    height: 10px;
    flex: 0 0 auto;
    border-radius: 50%;
    background: var(--red-bright);
    box-shadow: 0 0 0 0 rgba(239, 53, 65, 0.55);
    animation: live-pulse 1.6s ease-out infinite;
}

@keyframes live-pulse {
    0% { box-shadow: 0 0 0 0 rgba(239, 53, 65, 0.55); }
    70% { box-shadow: 0 0 0 9px rgba(239, 53, 65, 0); }
    100% { box-shadow: 0 0 0 0 rgba(239, 53, 65, 0); }
}

.live-now-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 10px 12px;
    background: var(--inset);
    border: 1px solid var(--line-soft);
    border-radius: var(--radius);
    text-decoration: none;
    color: var(--text);
}

.live-now-card:active {
    border-color: rgba(215, 33, 46, 0.5);
}

.live-now-info {
    min-width: 0;
}

.live-now-info strong {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-style: italic;
    text-transform: uppercase;
}

.live-now-info span {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: var(--muted);
    font-size: 0.8rem;
}

.live-now-watch {
    flex: 0 0 auto;
    padding: 7px 14px;
    background: linear-gradient(180deg, var(--red-bright), var(--red-deep));
    border-radius: 999px;
    font-size: 0.78rem;
    font-weight: 800;
    font-style: italic;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

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

.admin-row {
    display: grid;
    gap: 10px;
    padding: 12px;
    background: var(--panel-deep);
    border: 1px solid var(--line-soft);
    border-radius: var(--radius);
}

.admin-row-name strong {
    display: block;
    font-style: italic;
    text-transform: uppercase;
}

.admin-row-name span {
    color: var(--muted);
    font-size: 0.8rem;
}

.admin-row-stats {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 8px;
    text-align: center;
}

.admin-row-stats strong {
    display: block;
    font-size: 1.05rem;
    font-style: italic;
}

.admin-row-stats span {
    color: var(--muted);
    font-size: 0.68rem;
    font-weight: 900;
    text-transform: uppercase;
    white-space: nowrap;
}

.rank-help {
    margin-top: 14px;
    padding: 0 14px;
    background: rgba(13, 18, 25, 0.6);
    border: 1px dashed var(--line);
    border-radius: var(--radius);
}

.rank-help summary {
    padding: 12px 0;
    color: var(--muted);
    font-size: 0.92rem;
    font-weight: 800;
    cursor: pointer;
}

.rank-help summary::marker {
    color: var(--red-bright);
}

.rank-help[open] summary {
    color: var(--text);
}

.rank-help ul {
    display: grid;
    gap: 8px;
    margin: 0;
    padding: 0 0 14px 18px;
    color: var(--muted);
    font-size: 0.92rem;
}

.rank-help strong {
    color: var(--text);
}

.rank-math {
    margin: 0 0 14px;
    padding: 0 12px;
    background: rgba(0, 0, 0, 0.28);
    border: 1px solid var(--line-soft);
    border-radius: 6px;
}

.rank-math summary {
    padding: 10px 0;
    color: var(--blue-bright);
    font-size: 0.88rem;
    font-weight: 800;
    cursor: pointer;
}

.rank-math summary::marker {
    color: var(--blue-bright);
}

.rank-math-body {
    padding-bottom: 12px;
    color: var(--muted);
    font-size: 0.88rem;
}

.rank-math-body p {
    margin: 0 0 8px;
}

.rank-math-body pre {
    margin: 0 0 10px;
    padding: 10px 12px;
    overflow-x: auto;
    color: var(--silver);
    background: var(--inset);
    border: 1px solid var(--line-soft);
    border-radius: 6px;
    font-size: 0.82rem;
    line-height: 1.5;
}

.recap-band {
    padding: 16px;
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.05), rgba(255, 255, 255, 0) 34%, rgba(0, 0, 0, 0.22)),
        repeating-linear-gradient(0deg, rgba(255, 255, 255, 0.014) 0 1px, transparent 1px 3px),
        var(--panel);
    border: 1px solid var(--line-soft);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.recap-band .session-actions {
    margin-top: 18px;
}

.recap-body p {
    margin: 0 0 12px;
    color: #dbe3ea;
    font-size: 0.98rem;
    line-height: 1.55;
}

.recap-body p:last-child {
    margin-bottom: 4px;
}

.recap-writing {
    color: var(--muted);
}

.recap-dots span {
    animation: recap-dot 1.3s infinite;
    display: inline-block;
}

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

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

@keyframes recap-dot {
    0%,
    60%,
    100% {
        opacity: 0.25;
    }
    30% {
        opacity: 1;
    }
}

.recap-band .ghost-button {
    border-color: var(--line);
}

.install-sheet {
    position: fixed;
    inset: 0;
    z-index: 90;
    display: grid;
    align-items: end;
    justify-items: center;
    padding: 16px;
    background: rgba(4, 6, 9, 0.72);
}

.install-sheet-card {
    display: grid;
    justify-items: center;
    gap: 12px;
    width: min(430px, 100%);
    margin-bottom: env(safe-area-inset-bottom);
    padding: 20px 18px;
    text-align: center;
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.05), rgba(255, 255, 255, 0) 34%, rgba(0, 0, 0, 0.22)),
        var(--panel);
    border: 1px solid var(--line);
    border-radius: 14px;
    box-shadow: var(--shadow);
}

.install-sheet-card img {
    width: 84px;
    height: 84px;
    object-fit: contain;
}

.install-sheet-card h3 {
    margin: 0;
}

.install-sheet-card ol {
    display: grid;
    gap: 8px;
    margin: 0;
    padding-left: 22px;
    color: var(--muted);
    text-align: left;
    font-size: 0.94rem;
}

.install-sheet-card svg {
    vertical-align: -4px;
    color: var(--blue-bright);
}

.install-sheet-card .secondary-button {
    width: 100%;
    margin-top: 4px;
}

.error-box {
    padding: 14px;
    color: #ffb0b6;
    background: rgba(215, 33, 46, 0.12);
    border: 1px solid rgba(239, 53, 65, 0.45);
    border-radius: var(--radius);
}

.spacer {
    height: 12px;
}

.back-button {
    margin-top: 16px;
}

@media (min-width: 720px) {
    .app-shell {
        padding: 24px 22px 56px;
    }

    .dashboard-grid {
        display: grid;
        grid-template-columns: minmax(0, 1fr) 380px;
        align-items: start;
        gap: 18px;
    }

    .hero-cosmos {
        min-height: 410px;
        margin-top: -24px;
    }

    .hero-cosmos h1 {
        font-size: 2.7rem;
    }

    h1 {
        font-size: 2.4rem;
    }

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

    .field.is-wide {
        grid-column: 1 / -1;
    }

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

    .playoff-list {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .tab-bar {
        right: 50%;
        bottom: 18px;
        left: auto;
        width: min(520px, calc(100% - 44px));
        padding: 6px;
        border: 1px solid var(--line);
        border-radius: 999px;
        border-top: 1px solid var(--line);
        transform: translateX(50%);
    }

    .tab-bar button {
        grid-auto-flow: column;
        gap: 8px;
        min-height: 44px;
        border-radius: 999px;
    }

    body.has-tabs .app-shell {
        padding-bottom: 110px;
    }
}

/* ---------------------------------------------------------------------------
   Round timer band
--------------------------------------------------------------------------- */

.timer-band {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px 14px;
    padding: 12px 14px;
    background: var(--panel-deep);
    border: 1px solid var(--line-soft);
    border-radius: var(--radius);
}

.timer-info {
    display: flex;
    align-items: baseline;
    gap: 10px;
    flex: 1 1 auto;
    min-width: 0;
}

.timer-clock {
    font-size: 1.7rem;
    font-weight: 900;
    font-style: italic;
    font-variant-numeric: tabular-nums;
    letter-spacing: 0.02em;
}

.timer-clock.is-muted {
    color: var(--muted);
}

.timer-note {
    color: var(--muted);
    font-size: 0.82rem;
    font-weight: 700;
}

.timer-stepper strong {
    min-width: 44px;
    text-align: center;
}

.timer-title {
    color: var(--muted);
    font-size: 0.78rem;
    font-weight: 900;
    font-style: italic;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.timer-controls {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1 1 100%;
}

.timer-start {
    flex: 0 0 auto;
    width: auto;
    padding: 10px 20px;
}

.timer-band.is-running {
    border-color: rgba(63, 131, 184, 0.55);
    box-shadow: inset 0 0 0 1px rgba(63, 131, 184, 0.25);
}

.timer-band.is-expired {
    border-color: var(--red-bright);
    background: linear-gradient(180deg, rgba(158, 18, 32, 0.5), rgba(30, 10, 12, 0.6));
    animation: timer-alarm 1s ease-in-out 4;
}

.timer-band.is-expired .timer-clock {
    color: var(--red-bright);
}

@keyframes timer-alarm {
    0%, 100% { box-shadow: 0 0 0 0 rgba(239, 53, 65, 0); }
    50% { box-shadow: 0 0 0 4px rgba(239, 53, 65, 0.35); }
}

/* ---------------------------------------------------------------------------
   Court cards: birds-eye court, north end on top
--------------------------------------------------------------------------- */

.court {
    position: relative;
    display: grid;
    grid-template-rows: 1fr auto 1fr;
    min-height: 190px;
    background:
        linear-gradient(180deg, rgba(63, 131, 184, 0.16), rgba(42, 93, 132, 0.1));
    border: 2px solid rgba(215, 222, 230, 0.5);
    border-radius: 10px;
    overflow: hidden;
}

.court.is-swappable {
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}

.court.is-swappable:active .court-half {
    background: rgba(63, 131, 184, 0.14);
}

.court-half {
    display: grid;
    place-items: center;
    padding: 14px 12px 20px;
    transition: background 0.15s ease;
}

.court-half.is-north {
    padding-top: 20px;
    padding-bottom: 14px;
}

.court-team {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    column-gap: 18px;
    row-gap: 2px;
    text-align: center;
    font-weight: 900;
    font-style: italic;
    font-size: 1.02rem;
    line-height: 1.35;
}

.court-net {
    position: relative;
    display: grid;
    height: 0;
}

/* Kitchen lines flank the net; the net itself is the dashed band. */
.kitchen-band {
    position: absolute;
    left: 0;
    right: 0;
    height: 1px;
    background: rgba(215, 222, 230, 0.35);
}

.court-net .kitchen-band:first-child {
    top: -26px;
}

.court-net .kitchen-band:last-child {
    top: 26px;
}

.net-line {
    position: absolute;
    top: -2px;
    left: -2px;
    right: -2px;
    height: 4px;
    background: repeating-linear-gradient(
        90deg,
        var(--silver) 0 8px,
        rgba(215, 222, 230, 0.25) 8px 12px
    );
}

.court-compass {
    position: absolute;
    top: 8px;
    right: 10px;
    z-index: 1;
    display: inline-flex;
    align-items: center;
    gap: 3px;
    padding: 3px 8px;
    color: var(--silver);
    background: rgba(10, 13, 18, 0.65);
    border: 1px solid var(--line);
    border-radius: 999px;
    font-size: 0.72rem;
    font-weight: 900;
    letter-spacing: 0.08em;
}

.compass-arrow {
    font-size: 0.85rem;
    line-height: 1;
}

.swap-hint {
    position: absolute;
    bottom: 6px;
    left: 0;
    right: 0;
    text-align: center;
    color: var(--muted);
    font-size: 0.68rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    pointer-events: none;
}

.score-inputs.has-sides {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) auto;
}

.score-side {
    position: relative;
    display: block;
    min-width: 0;
}

.score-side .score-input {
    width: 100%;
    padding-left: 26px;
}

.score-side-tag {
    position: absolute;
    top: 50%;
    left: 9px;
    transform: translateY(-50%);
    color: var(--muted);
    font-size: 0.72rem;
    font-weight: 900;
}


/* ---------------------------------------------------------------------------
   King of the Hill: the crown, the reign, and the head start
--------------------------------------------------------------------------- */

.hill-band {
    display: grid;
    gap: 8px;
    margin-bottom: 12px;
    padding: 14px;
    color: #fff;
    background:
        linear-gradient(125deg, rgba(180, 132, 22, 0.28), rgba(90, 62, 6, 0.34)),
        repeating-linear-gradient(45deg, rgba(255, 255, 255, 0.05) 0 2px, transparent 2px 16px),
        var(--panel-deep);
    border: 1px solid var(--gold-line);
    border-radius: var(--radius);
}

.hill-band .eyebrow {
    color: var(--gold);
}

.hill-band h3 {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0;
    font-size: 1.2rem;
    font-style: italic;
}

.hill-band p {
    margin: 0;
    color: rgba(255, 255, 255, 0.84);
    font-size: 0.9rem;
    font-weight: 700;
}

.hill-band strong {
    color: var(--gold);
}

.hill-band.is-empty {
    background:
        repeating-linear-gradient(45deg, rgba(255, 255, 255, 0.04) 0 2px, transparent 2px 16px),
        var(--panel-deep);
    border-style: dashed;
}

.hill-band .crown {
    font-size: 1.05rem;
    line-height: 1;
    filter: drop-shadow(0 0 6px rgba(233, 184, 63, 0.55));
}

/* One pip per win toward retiring the crown. */
.hill-pips {
    display: flex;
    gap: 5px;
}

.hill-pips span {
    width: 26px;
    height: 5px;
    background: rgba(255, 255, 255, 0.16);
    border-radius: 999px;
}

.hill-pips span.is-won {
    background: linear-gradient(90deg, var(--gold), #f4d489);
    box-shadow: 0 0 8px rgba(233, 184, 63, 0.5);
}

.game-card.is-hill {
    padding: 10px;
    background: rgba(180, 132, 22, 0.07);
    border: 1px solid var(--gold-line);
    border-radius: var(--radius);
}

.game-card.is-hill .game-meta {
    color: var(--gold);
}

/* Crown on the reigning side, head start on the challengers. */
.hill-tag {
    display: inline-block;
    margin-left: 6px;
    padding: 1px 6px;
    border-radius: 999px;
    font-size: 0.7rem;
    font-weight: 900;
    line-height: 1.5;
    vertical-align: middle;
}

.hill-tag.is-king {
    background: rgba(233, 184, 63, 0.18);
    border: 1px solid var(--gold-line);
}

.hill-tag.is-spot {
    color: #bcd9ef;
    background: rgba(63, 131, 184, 0.18);
    border: 1px solid rgba(63, 131, 184, 0.45);
}

/* Score rows stack each name on its own line, so the tag has to opt out of
   that block display to stay beside the name it belongs to. */
.team-names span .hill-tag {
    display: inline-block;
    font-style: normal;
}

.hill-spot-note {
    margin: 0;
    padding: 8px 10px;
    color: #bcd9ef;
    background: rgba(63, 131, 184, 0.14);
    border: 1px solid rgba(63, 131, 184, 0.4);
    border-radius: 6px;
    font-size: 0.86rem;
    font-weight: 700;
}

.hill-spot-note strong {
    color: #fff;
}

.hill-spot-note span + span::before {
    content: ' + ';
    color: var(--muted);
}

.is-hill-chip {
    color: var(--gold);
    font-weight: 900;
}

/* Create screen: what the ladder will feel like before you commit to it. */
.field-note {
    margin: 8px 0 0;
    color: var(--muted);
    font-size: 0.86rem;
    font-weight: 600;
    line-height: 1.45;
}

.hill-preview {
    display: grid;
    gap: 6px;
    padding: 12px;
    background:
        linear-gradient(125deg, rgba(180, 132, 22, 0.16), rgba(90, 62, 6, 0.2)),
        var(--panel-deep);
    border: 1px solid var(--gold-line);
    border-radius: var(--radius);
}

.hill-preview .eyebrow {
    color: var(--gold);
}

.hill-preview p {
    margin: 0;
    font-size: 0.92rem;
    font-weight: 800;
}

.hill-preview .hill-preview-note {
    color: var(--muted);
    font-size: 0.84rem;
    font-weight: 600;
    line-height: 1.45;
}

.finalist-strip {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 8px;
    font-size: 1.02rem;
    font-style: italic;
    font-weight: 900;
}

.finalist-strip em {
    color: rgba(255, 255, 255, 0.7);
    font-size: 0.85rem;
    font-weight: 800;
}

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

.reign-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 10px 12px;
    background: var(--inset);
    border: 1px solid var(--line-soft);
    border-radius: 6px;
}

.reign-row.is-retired {
    border-color: var(--gold-line);
}

.reign-row > div {
    display: grid;
    gap: 2px;
    min-width: 0;
}

.reign-row > div:last-child {
    text-align: right;
    flex-shrink: 0;
}

.reign-row strong {
    font-size: 0.98rem;
    font-style: italic;
}

.reign-row.is-retired > div:last-child strong {
    color: var(--gold);
}

.reign-row span {
    color: var(--muted);
    font-size: 0.8rem;
    font-weight: 700;
}
