.puzzle-status {
    padding: 12px 14px;
    border: 1px solid var(--line);
    border-radius: 14px;
    color: var(--muted);
    background: rgba(255,255,255,.04);
}

.puzzle-status.is-success { border-color: rgba(63,198,202,.4); color: #9df1f2; }
.puzzle-status.is-warning { border-color: rgba(241,201,74,.35); color: #f1d777; }
.puzzle-status.is-error   { border-color: rgba(227,79,95,.45); color: #ff9ba6; }

.tournament-status-badge {
    display: inline-block;
    padding: 1px 8px;
    border-radius: 999px;
    font-weight: 600;
    text-transform: capitalize;
}

.tournament-status-badge.is-draft { background: rgba(148, 163, 184, 0.2); color: var(--muted); }
.tournament-status-badge.is-registration { background: rgba(45, 212, 191, 0.18); color: var(--accent-2); }
.tournament-status-badge.is-upcoming { background: rgba(96, 165, 250, 0.2); color: #60a5fa; }
.tournament-status-badge.is-live { background: rgba(124, 92, 255, 0.2); color: var(--accent); }
.tournament-status-badge.is-review { background: rgba(234, 179, 8, 0.2); color: #eab308; }
.tournament-status-badge.is-closed { background: rgba(148, 163, 184, 0.15); color: var(--muted); }
.tournament-status-badge.is-canceled { background: rgba(239, 68, 68, 0.18); color: #ef4444; }
.tournament-status-badge.is-ended { background: rgba(234, 179, 8, 0.2); color: #eab308; }

#tournament-view:not([hidden]) {
    display: grid;
    gap: 22px;
}

.tournament-banner {
    display: block;
    width: 100%;
    aspect-ratio: 4 / 1;
    object-fit: cover;
    border-radius: var(--radius-lg, 28px);
    border: 1px solid var(--line);
}

.tournament-hero {
    display: grid;
    grid-template-columns: minmax(0, 1.4fr) minmax(260px, 1fr);
    gap: 28px;
    align-items: center;
    padding: 28px;
}

.tournament-hero h1 {
    margin: 0 0 12px;
    font-size: clamp(1.8rem, 4vw, 2.6rem);
    line-height: 1.1;
}

.tournament-hero p {
    margin: 0 0 12px;
    color: var(--muted);
    line-height: 1.7;
}

.tournament-clock {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: 20px;
    text-align: center;
    border-radius: var(--radius-md, 18px);
    background: var(--surface-strong);
    border: 1px solid var(--line);
}

.tournament-clock-label {
    color: var(--muted);
    font-weight: 600;
}

.tournament-clock-value {
    font-size: clamp(1.8rem, 5vw, 2.6rem);
    font-weight: 800;
    line-height: 1.1;
    font-variant-numeric: tabular-nums;
}

.tournament-clock-at,
.tournament-clock-then {
    color: var(--muted);
    font-size: 0.92rem;
}

.tournament-clock-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 10px;
    margin-top: 10px;
}

.tournament-clock-actions .primary-button {
    padding: 14px 34px;
    font-size: 1.05rem;
}

.tournament-schedule {
    list-style: none;
    display: grid;
    gap: 10px;
    margin: 0 0 14px;
    padding: 0;
}

.legal-section .tournament-schedule li {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 4px 12px;
    padding: 12px 14px;
    border-radius: var(--radius-sm, 12px);
    border: 1px solid var(--line);
    background: var(--surface-strong);
    line-height: 1.4;
}

.tournament-schedule li.is-past { opacity: 0.6; }
.tournament-schedule li.is-next { border-color: var(--accent-2); }
.tournament-schedule strong { color: var(--text); font-variant-numeric: tabular-nums; }

.time-zone-picker {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px 10px;
    color: var(--muted);
}

.time-zone-select {
    width: 100%;
    max-width: 26rem;
    min-width: 0;
    padding: 8px 10px;
    border-radius: 10px;
    border: 1px solid var(--line);
    background: var(--surface-strong);
    color: var(--text);
    font: inherit;
}

.tournament-progress-bar {
    height: 12px;
    border-radius: 999px;
    overflow: hidden;
    background: rgba(255, 255, 255, 0.08);
}

.tournament-progress-bar span {
    display: block;
    width: 0;
    height: 100%;
    background: linear-gradient(90deg, var(--accent), var(--accent-2));
    transition: width 0.4s ease;
}

#progress-text {
    margin: 10px 0 0;
}

.tournament-clock .tournament-time-zone {
    margin-top: 10px;
}

/* The prize is the most important thing on the page, so it stands out from every other block. */
.tournament-prize {
    padding: 24px 28px;
    text-align: center;
    border-radius: var(--radius-lg, 28px);
    border: 2px solid #f1c94a;
    background: linear-gradient(135deg, rgba(241, 201, 74, 0.24), rgba(255, 140, 66, 0.12));
    box-shadow: 0 0 36px rgba(241, 201, 74, 0.2);
}

.tournament-prize-label {
    color: #f1c94a;
    font-size: 0.85rem;
    font-weight: 800;
    letter-spacing: 0.22em;
    text-transform: uppercase;
}

.tournament-prize-type {
    margin: 6px 0;
    font-size: clamp(1.8rem, 5vw, 2.6rem);
    font-weight: 800;
    line-height: 1.15;
}

.tournament-prize-lines {
    list-style: none;
    margin: 0;
    padding: 0;
}

.tournament-prize-lines li {
    font-size: 1.25rem;
    font-weight: 700;
    line-height: 1.6;
}

.tournament-prize-note {
    display: block;
    margin-top: 8px;
    font-size: 0.7rem;
    opacity: 0.75;
}

.section-head {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 8px 12px;
    margin-bottom: 14px;
}

.section-head h2 {
    margin: 0;
}

.leaderboard-list {
    list-style: none;
    display: grid;
    gap: 8px;
    margin: 0;
    padding: 0;
}

.legal-section .leaderboard-row {
    display: grid;
    grid-template-columns: 2.6rem minmax(0, 1fr) auto;
    gap: 2px 12px;
    align-items: center;
    padding: 10px 14px;
    border-radius: var(--radius-sm, 12px);
    border: 1px solid var(--line);
    background: var(--surface-strong);
    color: var(--text);
    line-height: 1.4;
}

.leaderboard-row.is-me {
    border-color: var(--accent);
    background: rgba(124, 92, 255, 0.16);
}

.leaderboard-rank {
    text-align: center;
    font-size: 1.1rem;
    font-weight: 800;
}

.leaderboard-name {
    font-weight: 700;
    overflow-wrap: anywhere;
}

.leaderboard-points {
    font-size: 1.05rem;
    font-weight: 800;
}

.leaderboard-detail {
    grid-column: 2 / -1;
    color: var(--muted);
    font-size: 0.88rem;
}

@media (max-width: 760px) {
    .tournament-hero {
        grid-template-columns: 1fr;
        padding: 20px;
    }
}

.leaderboard-note {
    margin: 10px 0 0;
    color: var(--muted);
    font-size: 0.9em;
}

.terms-box {
    white-space: pre-wrap;
    padding: 14px 16px;
    border-radius: var(--radius-md, 18px);
    background: var(--surface-strong);
    border: 1px solid var(--line);
    max-height: 320px;
    overflow-y: auto;
    margin-bottom: 20px;
}

.tournament-rules-link {
    margin: 0 0 12px;
    color: var(--muted);
    font-size: 0.92em;
}

.tournament-rules-link a {
    color: var(--accent-2);
}

#reg-disqualified a {
    color: inherit;
    text-decoration: underline;
}

.appeal-textarea {
    width: 100%;
    box-sizing: border-box;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: rgba(4, 10, 20, .45);
    color: inherit;
    padding: 11px 12px;
    font: inherit;
    resize: vertical;
}

#a-notice {
    max-height: none;
}

#a-notice.appeal-notice {
    white-space: normal;
}

/* The appeal page: the outcome card and the notice rows (reason, deadline, decision). */
.appeal-outcome {
    padding: 18px 20px;
    border-radius: var(--radius-md, 18px);
    border-width: 2px;
}

.appeal-outcome-title {
    margin: 0 0 10px;
    font-size: 1.2em;
    font-weight: 700;
    line-height: 1.35;
}

.appeal-outcome-line {
    display: flex;
    flex-direction: column;
    gap: 2px;
    margin: 0 0 10px;
}

.appeal-outcome-line:last-child {
    margin-bottom: 0;
}

.appeal-outcome-line strong {
    font-size: 0.85em;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    opacity: 0.85;
}

.appeal-outcome-line span {
    font-size: 1.05em;
    white-space: pre-wrap;
}

/* ── Appeal discussion ─────────────────────────────────────────────────── */
.appeal-thread {
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-height: 520px;
    overflow-y: auto;
    margin: 12px 0 18px;
    padding-right: 4px;
}

.appeal-msg {
    max-width: 88%;
    padding: 10px 14px;
    border-radius: 14px;
    border: 1px solid var(--line);
    background: var(--surface-strong);
}

.appeal-msg.is-mine {
    align-self: flex-end;
    background: rgba(124, 92, 255, 0.16);
}

.appeal-msg.is-decision {
    border-color: rgba(234, 179, 8, 0.5);
}

.appeal-msg-head {
    display: flex;
    gap: 10px;
    align-items: baseline;
    font-size: 0.85em;
    color: var(--muted);
    margin-bottom: 4px;
}

.appeal-msg-text {
    white-space: pre-wrap;
    word-break: break-word;
}

.appeal-msg-files {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 8px;
}

.appeal-image {
    max-width: 220px;
    max-height: 180px;
    border-radius: 10px;
    border: 1px solid var(--line);
    cursor: zoom-in;
}

.appeal-image.is-zoomed {
    max-width: 100%;
    max-height: none;
    cursor: zoom-out;
}

.appeal-file-name {
    font-size: 0.8em;
    color: var(--muted);
}

.appeal-text-file {
    white-space: pre-wrap;
    max-height: 240px;
    overflow: auto;
    font-size: 0.85em;
}

.appeal-empty {
    color: var(--muted);
}

.appeal-attach {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 12px;
    margin-bottom: 8px;
}

.appeal-attach-button {
    cursor: pointer;
}

.appeal-attach-hint {
    color: var(--muted);
    font-size: 0.85em;
}

.appeal-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 10px;
}

.appeal-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 2px 10px;
    border-radius: 999px;
    border: 1px solid var(--line);
    font-size: 0.85em;
}

.appeal-chip button {
    background: none;
    border: 0;
    color: inherit;
    cursor: pointer;
    font-size: 1.1em;
}

.appeal-stage-line {
    font-weight: 600;
}

.appeal-stage-line.is-unread {
    color: #ffd166;
}

.tournament-players-note {
    margin: 0 0 12px;
    font-weight: 600;
}

.games-scoring {
    margin: 14px 0 0;
    padding-left: 20px;
    color: var(--muted);
    font-size: 0.92em;
}

.games-scoring li {
    margin: 4px 0;
}

.games-total {
    margin: 0 0 8px;
    font-size: 1.05em;
}

/* Appeal messages look like a chat: what you wrote is blue, what you received is light grey. */
.appeal-msg {
    max-width: 78%;
    border: none;
    border-radius: 18px;
    background: #e9e9eb;
    color: #16181d;
    align-self: flex-start;
}

.appeal-msg .appeal-msg-head {
    color: #55575d;
}

.appeal-msg.is-mine {
    align-self: flex-end;
    background: #0b84fe;
    color: #ffffff;
}

.appeal-msg.is-mine .appeal-msg-head {
    color: rgba(255, 255, 255, 0.82);
}

.appeal-msg.is-decision {
    box-shadow: 0 0 0 2px rgba(234, 179, 8, 0.85);
}

.reg-state { margin: 0 0 12px; padding: 10px 14px; font-weight: 700; border-radius: 12px; border: 1px solid transparent; }
.reg-state.is-in { color: #3fc6a6; background: rgba(63, 198, 166, 0.12); border-color: rgba(63, 198, 166, 0.4); }
.reg-state.is-out { color: var(--muted); background: rgba(128, 128, 128, 0.1); border-color: rgba(128, 128, 128, 0.35); }

/* ── The winners' podium, in place of the prize card once the results are out ── */
.tournament-podium {
    padding: 24px 20px 18px;
    text-align: center;
    border-radius: var(--radius-lg, 28px);
    border: 2px solid #f1c94a;
    background: radial-gradient(ellipse at 50% 0%, rgba(241, 201, 74, 0.28), rgba(255, 140, 66, 0.08) 60%, transparent 100%);
    box-shadow: 0 0 36px rgba(241, 201, 74, 0.2);
}

.tournament-podium-label {
    color: #f1c94a;
    font-size: 0.85rem;
    font-weight: 800;
    letter-spacing: 0.22em;
    text-transform: uppercase;
}

.podium {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    align-items: end;
    gap: 10px;
    max-width: 760px;
    margin: 18px auto 10px;
}

.podium-place {
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    min-width: 0;
}

.podium-winners {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 8px;
}

.podium-winner {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    min-width: 0;
}

.podium-crown {
    font-size: 1.9rem;
    line-height: 1;
    filter: drop-shadow(0 2px 6px rgba(241, 201, 74, 0.6));
}

.podium-name {
    max-width: 100%;
    font-size: clamp(1rem, 2.6vw, 1.35rem);
    font-weight: 800;
    overflow-wrap: anywhere;
}

.place-1 .podium-name {
    font-size: clamp(1.15rem, 3.2vw, 1.6rem);
}

.podium-prize {
    max-width: 100%;
    padding: 3px 10px;
    border-radius: 999px;
    background: rgba(241, 201, 74, 0.18);
    border: 1px solid rgba(241, 201, 74, 0.55);
    color: #ffd666;
    font-size: clamp(0.85rem, 2.2vw, 1.05rem);
    font-weight: 700;
    overflow-wrap: anywhere;
}

.podium-prize.is-none {
    background: none;
    border-color: transparent;
    color: inherit;
    opacity: 0.65;
    font-weight: 500;
}

.podium-step {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    padding-top: 10px;
    border-radius: 12px 12px 0 0;
    color: #1a1400;
    box-shadow: inset 0 2px 0 rgba(255, 255, 255, 0.45);
}

.podium-number {
    font-size: clamp(1.8rem, 6vw, 2.8rem);
    font-weight: 900;
    line-height: 1;
}

.podium-word {
    margin-top: 4px;
    font-size: 0.72rem;
    font-weight: 800;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    opacity: 0.8;
}

.place-1 .podium-step { height: 150px; background: linear-gradient(180deg, #ffe27a, #e6b422); }
.place-2 .podium-step { height: 112px; background: linear-gradient(180deg, #eef1f6, #aab3c2); }
.place-3 .podium-step { height: 82px; background: linear-gradient(180deg, #e8b184, #b8733d); }

.podium-place.is-empty .podium-step { opacity: 0.25; }

@media (max-width: 520px) {
    .podium { gap: 6px; }
    .place-1 .podium-step { height: 120px; }
    .place-2 .podium-step { height: 90px; }
    .place-3 .podium-step { height: 66px; }
    .podium-word { display: none; }
}

:root[data-theme="light"] .podium-prize {
    background: rgba(201, 151, 0, 0.14);
    border-color: #c99700;
    color: #6b4e00;
}

/* What is played and the registration, folded below the final results */
.t-more {
    padding: 0;
}

.t-more > summary {
    cursor: pointer;
    padding: 16px 20px;
    font-size: 1.15rem;
    font-weight: 700;
}

.t-more > div {
    padding: 0 20px 18px;
}

.t-more .legal-section.is-folded {
    margin: 0;
    padding: 0;
    background: none;
    border: 0;
    box-shadow: none;
    backdrop-filter: none;
}

.t-more .legal-section.is-folded > h2 {
    display: none;
}
