:root {
    --bg: #fff7db;
    --panel: #ffffff;
    --ink: #1f2452;
    --muted: #69728d;
    --line: #f0d9ae;
    --brand: #10b981;
    --brand-dark: #0f8f7a;
    --company-red: #b21f0b;
    --company-red-dark: #8f1908;
    --blue: #3b82f6;
    --red: #f43f5e;
    --pink: #ec4899;
    --orange: #fb923c;
    --sky: #38bdf8;
    --gold: #f7b801;
    --silver: #94a3b8;
    --bronze: #d97706;
    --danger: #ef4444;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    min-height: 100vh;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    color: var(--ink);
    background:
        radial-gradient(circle at 12% 8%, rgba(56, 189, 248, .22), transparent 28%),
        radial-gradient(circle at 86% 12%, rgba(236, 72, 153, .18), transparent 26%),
        linear-gradient(180deg, #fff7db 0%, #eafff7 48%, #eef7ff 100%);
}

a {
    color: var(--brand-dark);
    text-decoration: none;
}

.app-shell {
    width: min(1120px, calc(100% - 32px));
    margin: 0 auto;
    padding: 24px 0 40px;
}

.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 22px;
    padding: 16px 18px;
    border: 1px solid rgba(255, 255, 255, .8);
    border-radius: 8px;
    background: rgba(255, 255, 255, .74);
    box-shadow: 0 14px 34px rgba(31, 36, 82, .08);
    backdrop-filter: blur(10px);
}

.brand {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.brand strong {
    color: var(--company-red);
    font-size: 24px;
}

.company-logo {
    display: block;
    width: clamp(78px, 11vw, 128px);
    height: auto;
    max-height: 86px;
    object-fit: contain;
}

.topbar-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 14px;
}

.brand span,
.muted {
    color: var(--muted);
}

.grid {
    display: grid;
    grid-template-columns: minmax(0, 1.4fr) minmax(280px, .8fr);
    gap: 18px;
    align-items: start;
}

.panel,
.card {
    background: var(--panel);
    border: 1px solid rgba(240, 217, 174, .95);
    border-radius: 8px;
    box-shadow: 0 12px 26px rgba(31, 36, 82, .08);
}

.panel {
    padding: 22px;
}

.admin-section {
    overflow: hidden;
}

.admin-section-summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    cursor: pointer;
    list-style: none;
}

.admin-section-summary::-webkit-details-marker {
    display: none;
}

.admin-section-summary h1,
.admin-section-summary h2 {
    margin: 0;
}

.admin-section-summary::after {
    content: "+";
    display: grid;
    place-items: center;
    flex: 0 0 auto;
    width: 30px;
    height: 30px;
    border-radius: 999px;
    color: #fff;
    background: var(--company-red);
    font-size: 20px;
    font-weight: 900;
    line-height: 1;
}

.admin-section[open] > .admin-section-summary {
    margin-bottom: 14px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--line);
}

.admin-section[open] > .admin-section-summary::after {
    content: "-";
}

.admin-rank-panel {
    display: grid;
    gap: 14px;
}

.admin-rank-panel .admin-section {
    display: grid;
    gap: 12px;
}

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

.mt-18 {
    margin-top: 18px;
}

.cover-section {
    width: 100%;
    aspect-ratio: 16 / 6;
    min-height: 180px;
    max-height: 320px;
    border: 1px solid var(--line);
    border-radius: 8px;
    overflow: hidden;
    margin-bottom: 18px;
    background: #fff1c7;
    box-shadow: 0 14px 30px rgba(31, 36, 82, .1);
}

.cover-section img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.cover-thumb {
    width: 180px;
    height: 90px;
    border: 1px solid var(--line);
    border-radius: 8px;
    overflow: hidden;
    background: #fff1c7;
}

.cover-thumb img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Poster/manual style inspired by printed guide layouts. */
body {
    background:
        linear-gradient(rgba(31, 36, 82, .035) 1px, transparent 1px),
        linear-gradient(90deg, rgba(31, 36, 82, .025) 1px, transparent 1px),
        #fbfbf7;
    background-size: 100% 26px, 26px 100%, auto;
}

.topbar,
.panel,
.card,
.cover-section,
.answer-accordion,
.player-announcement,
.mission-prompt,
.active-mission-row,
.team-score,
.rank {
    border: 2px solid #111827;
    border-radius: 2px;
    box-shadow: 5px 5px 0 #111827;
}

.topbar,
.panel,
.card {
    background: rgba(255, 255, 255, .94);
}

.topbar {
    padding: 14px 16px;
    backdrop-filter: none;
}

.brand strong,
h1,
h2,
h3 {
    color: #111827;
    font-weight: 900;
}

.brand strong {
    display: inline-flex;
    width: fit-content;
    padding: 4px 12px;
    border: 2px solid #111827;
    background: var(--gold);
    box-shadow: 4px 4px 0 #111827;
    transform: rotate(-1deg);
}

.mission-board-title h2,
.admin-section-summary h2,
.score-history h2,
.recent-answers h3,
aside h2 {
    display: inline-flex;
    width: fit-content;
    padding: 5px 10px;
    border: 2px solid #111827;
    background: #7dd3fc;
    box-shadow: 3px 3px 0 #111827;
}

.admin-section-summary h2,
aside h2:nth-child(1) {
    background: #fde047;
}

.mission-item.active h2 {
    display: inline-flex;
    width: fit-content;
    padding: 5px 10px;
    border: 2px solid #111827;
    background: #86efac;
    box-shadow: 3px 3px 0 #111827;
}

.player-announcement {
    border-left-width: 2px;
    background: #fff;
}

.player-announcement p {
    display: inline;
    width: fit-content;
    padding: 8px 12px;
    border: 2px solid #111827;
    background: #fde047;
    box-shadow: 4px 4px 0 #111827;
    transform: rotate(-.5deg);
}

.mission-prompt {
    border-left-width: 2px;
    background: #fff7ed;
}

.btn,
.badge,
.status-badge,
.progress-wrap,
.photo-upload-button {
    border: 2px solid #111827;
    border-radius: 2px;
    box-shadow: 3px 3px 0 #111827;
}

.btn {
    background: #f97316;
}

.btn:hover {
    background: #ea580c;
}

.btn.secondary {
    background: #fde047;
}

.btn.danger {
    background: #ef4444;
}

.badge,
.status-badge {
    background: #fde68a;
    color: #111827;
}

.photo-upload-box,
input,
textarea,
select {
    border: 2px solid #111827;
    border-radius: 2px;
}

.photo-upload-box {
    background: #f8fafc;
    box-shadow: 4px 4px 0 #111827;
}

.progress-track {
    border: 2px solid #111827;
    background: #fff;
}

.progress-fill {
    background: #22c55e;
}

.avatar {
    border: 2px solid #111827;
    box-shadow: 3px 3px 0 #111827;
}

@media (max-width: 760px) {
    .topbar,
    .panel,
    .card,
    .cover-section,
    .answer-accordion,
    .player-announcement,
    .mission-prompt,
    .active-mission-row,
    .team-score,
    .rank {
        box-shadow: 4px 4px 0 #111827;
    }

    .brand strong {
        padding: 3px 8px;
        box-shadow: 3px 3px 0 #111827;
    }
}

.cover-library {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 12px;
}

.cover-option {
    display: grid;
    gap: 8px;
    margin: 0;
}

.cover-option label {
    display: grid;
    gap: 8px;
    margin: 0;
    cursor: pointer;
}

.cover-option input,
.cover-option button {
    justify-self: start;
}

.cover-option img {
    width: 100%;
    aspect-ratio: 16 / 9;
    object-fit: cover;
    border: 2px solid var(--line);
    border-radius: 8px;
}

.cover-option:has(input:checked) img {
    border-color: var(--brand);
    box-shadow: 0 0 0 3px rgba(16, 185, 129, .2);
}

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

.person {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
}

.person.compact {
    gap: 10px;
}

.player-summary {
    padding: 4px;
}

.player-copy {
    min-width: 0;
}

.player-copy h1 {
    margin-bottom: 6px;
}

.player-copy p {
    margin: 0;
}

.player-phone {
    white-space: nowrap;
}

.avatar {
    flex: 0 0 auto;
    width: 42px;
    height: 42px;
    border-radius: 50%;
    border: 2px solid #fff;
    object-fit: cover;
    box-shadow: 0 0 0 2px #fff, 0 6px 16px rgba(31, 36, 82, .16);
    background: #dff7ff;
}

.avatar.lg {
    width: 64px;
    height: 64px;
}

.avatar-fallback {
    display: grid;
    place-items: center;
    color: #fff;
    background: linear-gradient(135deg, var(--brand), var(--sky));
    font-weight: 800;
}

.avatar.team-blue {
    box-shadow: 0 0 0 3px var(--blue);
}

.avatar.team-red {
    box-shadow: 0 0 0 3px var(--red);
}

.avatar.has-team {
    box-shadow: 0 0 0 3px var(--team-color);
}

.team-board {
    display: grid;
    gap: 10px;
}

.active-mission-list {
    display: grid;
    gap: 10px;
    margin: 10px 0;
}

.active-mission-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: linear-gradient(135deg, #ffffff 0%, #fff8e6 100%);
}

.team-score {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 14px;
    border: 1px solid var(--line);
    border-left: 6px solid var(--team-color, var(--brand));
    border-radius: 8px;
    background: linear-gradient(135deg, #ffffff 0%, #f8fffb 100%);
    box-shadow: 0 8px 18px rgba(31, 36, 82, .06);
}

.team-card-blue {
    border-color: #93b4ff;
    background: #eaf5ff;
}

.team-card-red {
    border-color: #f3a1a1;
    background: #fff0f5;
}

.member-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 12px;
}

.settings-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(180px, 1fr)) auto;
    gap: 12px;
    align-items: end;
}

.release-pair-form {
    display: grid;
    grid-template-columns: repeat(2, minmax(180px, 1fr)) auto;
    gap: 12px;
    align-items: end;
    margin: 12px 0 16px;
}

.manual-score-grid {
    display: grid;
    grid-template-columns: repeat(5, minmax(140px, 1fr)) auto;
    gap: 12px;
    align-items: end;
}

.score-history {
    display: grid;
    gap: 12px;
    margin-top: 18px;
}

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

.history-item {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    align-items: center;
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: linear-gradient(135deg, #ffffff 0%, #fffaf0 100%);
}

.score.negative {
    color: #dc2626;
}

.settings-full {
    grid-column: 1 / -1;
}

.speed-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
    gap: 10px;
}

.member-card {
    display: grid;
    gap: 10px;
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: linear-gradient(135deg, #ffffff 0%, #f7fffb 100%);
}

.check-row {
    display: flex;
    align-items: center;
    gap: 8px;
}

.check-row input {
    width: auto;
}

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

.answer-accordion {
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
    overflow: hidden;
    box-shadow: 0 8px 18px rgba(31, 36, 82, .05);
}

.answer-accordion summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px;
    cursor: pointer;
    list-style: none;
}

.answer-accordion summary::-webkit-details-marker {
    display: none;
}

.answer-accordion[open] summary {
    border-bottom: 1px solid var(--line);
    background: #fff8e6;
}

.accordion-caret {
    flex: 0 0 auto;
    color: var(--brand-dark);
    font-size: 13px;
    font-weight: 700;
}

.answer-accordion[open] .accordion-caret {
    color: var(--muted);
}

.answer-accordion[open] .accordion-caret::before {
    content: "Dang ";
}

.answer-body {
    padding: 12px;
}

.answer-form {
    margin-top: 0;
}

.other-answers {
    display: grid;
    gap: 10px;
    margin-top: -4px;
    margin-bottom: 12px;
}

.other-answers h3 {
    margin-bottom: 0;
}

.other-answer-table-wrap {
    width: 100%;
    overflow-x: auto;
}

.other-answer-table {
    min-width: 520px;
}

.other-answer-table th,
.other-answer-table td {
    padding: 10px;
    vertical-align: middle;
}

.other-answer-table .avatar {
    width: 34px;
    height: 34px;
}

.other-answer-table .photo-preview {
    max-width: 110px;
    max-height: 82px;
}

.other-name-cell,
.other-time-cell,
.other-status-cell,
.other-answer-cell {
    overflow-wrap: anywhere;
}

.status-badge {
    display: inline-flex;
    align-items: center;
    min-height: 24px;
    padding: 3px 8px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 800;
    background: #fff0c2;
    color: #8a4f00;
}

.status-approved {
    background: #d1fae5;
    color: #047857;
}

.status-rejected {
    background: #ffe4e6;
    color: #be123c;
}

.status-pending {
    background: #e0f2fe;
    color: #0369a1;
}

.answer-form .answer-body {
    display: grid;
    gap: 14px;
}

.answer-form .btn[type="submit"] {
    min-height: 120px;
    font-size: 20px;
}

.photo-upload-box {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    gap: 14px;
    align-items: center;
    min-height: 112px;
    padding: 18px;
    border: 2px dashed rgba(16, 185, 129, .55);
    border-radius: 8px;
    background: linear-gradient(135deg, #edfff8 0%, #ffffff 62%, #fff8e6 100%);
}

.photo-upload-icon {
    display: grid;
    place-items: center;
    width: 52px;
    height: 52px;
    border-radius: 999px;
    color: #fff;
    background: var(--brand);
    font-size: 32px;
    font-weight: 800;
    line-height: 1;
}

.photo-upload-copy {
    display: grid;
    gap: 4px;
    min-width: 0;
}

.photo-upload-copy strong {
    font-size: 18px;
}

.photo-upload-copy span,
.photo-upload-filename {
    color: var(--muted);
    font-weight: 600;
}

.photo-upload-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 42px;
    padding: 10px 14px;
    border-radius: 8px;
    color: #fff;
    background: var(--company-red);
    font-weight: 800;
}

.photo-upload-input {
    position: absolute;
    width: 1px;
    height: 1px;
    opacity: 0;
    pointer-events: none;
}

.answer-form label:has(.photo-upload-input) {
    position: relative;
}

.answer-form label:has(.photo-upload-input):focus-within .photo-upload-box,
.answer-form label:has(.photo-upload-input):hover .photo-upload-box {
    border-color: var(--brand);
    box-shadow: 0 0 0 3px rgba(16, 185, 129, .16);
}

.admin-answer summary {
    gap: 12px;
}

.history-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.history-meta span {
    display: inline-flex;
    align-items: center;
    min-height: 26px;
    padding: 3px 9px;
    border-radius: 999px;
    background: #e0f7ff;
    color: #24607a;
    font-size: 13px;
}

.answer-body p {
    margin: 0;
}

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

h1,
h2,
h3 {
    margin: 0 0 12px;
    line-height: 1.2;
}

p {
    line-height: 1.5;
}

label {
    display: grid;
    gap: 6px;
    font-weight: 700;
}

.team-choice-group {
    display: grid;
    gap: 10px;
    margin: 0;
    padding: 0;
    border: 0;
}

.team-choice-group legend {
    margin-bottom: 2px;
    font-weight: 800;
}

.team-choice {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px;
    border: 2px solid #111827;
    border-left: 8px solid var(--team-color, var(--brand));
    border-radius: 2px;
    background:
        linear-gradient(90deg, color-mix(in srgb, var(--team-color, var(--brand)) 18%, white) 0%, #fff 64%),
        #fff;
    box-shadow: 3px 3px 0 #111827;
    cursor: pointer;
}

.team-choice input {
    width: auto;
    box-shadow: none;
    accent-color: var(--brand);
}

.team-choice:has(input:checked) {
    background:
        linear-gradient(90deg, color-mix(in srgb, var(--team-color, var(--brand)) 36%, white) 0%, #fde047 78%),
        #fde047;
}

.auth-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 18px;
    align-items: start;
}

.auth-panel {
    display: grid;
    gap: 14px;
}

.auth-panel h1 {
    margin-bottom: 2px;
}

.recover-panel {
    background:
        linear-gradient(135deg, #edfff8 0%, #ffffff 62%, #fff8e6 100%);
}

.recover-panel summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    cursor: pointer;
    list-style: none;
}

.recover-panel summary::-webkit-details-marker {
    display: none;
}

.recover-panel summary span {
    display: grid;
    gap: 8px;
}

.recover-panel summary strong {
    font-size: 22px;
    font-weight: 900;
}

.recover-panel summary::after {
    content: "+";
    display: grid;
    place-items: center;
    flex: 0 0 auto;
    width: 34px;
    height: 34px;
    border: 2px solid #111827;
    border-radius: 2px;
    color: #111827;
    background: #fde047;
    box-shadow: 3px 3px 0 #111827;
    font-size: 24px;
    font-weight: 900;
    line-height: 1;
}

.recover-panel[open] summary {
    margin-bottom: 14px;
    padding-bottom: 12px;
    border-bottom: 2px solid #111827;
}

.recover-panel[open] summary::after {
    content: "-";
}

.recover-panel .btn {
    min-height: 58px;
    font-size: 18px;
}

.compact-team-choice {
    grid-template-columns: 1fr;
}

.compact-team-choice .team-choice {
    padding: 10px 12px;
}

input,
textarea,
select {
    width: 100%;
    border: 1px solid #ecd4a4;
    border-radius: 6px;
    padding: 11px 12px;
    font: inherit;
    color: var(--ink);
    background: #fffdf8;
}

input:focus,
textarea:focus,
select:focus {
    outline: 3px solid rgba(56, 189, 248, .22);
    border-color: var(--sky);
}

textarea {
    min-height: 120px;
    resize: vertical;
}

.eyebrow {
    display: inline-flex;
    width: fit-content;
    border-radius: 999px;
    padding: 5px 10px;
    font-size: 12px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: .04em;
    color: var(--company-red);
    background: #fff0c2;
}

.admin-message-panel {
    display: grid;
    grid-template-columns: minmax(220px, .75fr) minmax(0, 1.25fr);
    gap: 18px;
    align-items: start;
    margin-bottom: 18px;
    border-color: rgba(16, 185, 129, .35);
    background: linear-gradient(135deg, #ffffff 0%, #edfff8 58%, #fff8e6 100%);
}

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

.admin-message-copy h1 {
    margin-bottom: 0;
}

.admin-message-form {
    display: grid;
    gap: 12px;
}

.admin-message-form textarea {
    min-height: 112px;
    font-size: 16px;
}

.player-announcement {
    display: grid;
    gap: 12px;
    padding: 18px;
    border: 1px solid rgba(16, 185, 129, .38);
    border-left: 6px solid var(--brand);
    border-radius: 8px;
    background: linear-gradient(135deg, #edfff8 0%, #ffffff 58%, #fff8e6 100%);
    box-shadow: 0 14px 28px rgba(31, 36, 82, .08);
}

.player-announcement p {
    margin: 0;
    font-size: clamp(18px, 2.4vw, 26px);
    line-height: 1.35;
    font-weight: 800;
    color: var(--ink);
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    border: 0;
    border-radius: 8px;
    padding: 10px 14px;
    min-height: 40px;
    font-weight: 700;
    color: #fff;
    background: linear-gradient(135deg, var(--brand), #14b8a6);
    cursor: pointer;
    box-shadow: 0 8px 18px rgba(16, 185, 129, .24);
}

.btn:hover {
    background: linear-gradient(135deg, var(--brand-dark), #0ea5a3);
}

.btn.secondary {
    color: var(--ink);
    background: #fff0c2;
    box-shadow: none;
}

.btn.danger {
    background: linear-gradient(135deg, var(--danger), var(--pink));
}

.flash {
    margin-bottom: 16px;
    padding: 12px 14px;
    border: 1px solid #8ee6cf;
    border-radius: 8px;
    background: #eafff7;
}

.badge {
    display: inline-flex;
    align-items: center;
    border-radius: 999px;
    padding: 5px 9px;
    font-size: 13px;
    font-weight: 700;
    background: #fff0c2;
    color: #8a4f00;
}

.countdown-number {
    color: var(--ink);
    font-weight: 900;
}

.progress-wrap {
    display: grid;
    grid-template-columns: minmax(120px, 180px) auto;
    align-items: center;
    gap: 10px;
}

.progress-track {
    height: 12px;
    overflow: hidden;
    border-radius: 999px;
    background: #ffe8a3;
}

.progress-fill {
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(90deg, var(--brand), var(--sky), var(--pink));
}

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

.rank {
    display: grid;
    grid-template-columns: 44px minmax(0, 1fr) auto;
    gap: 10px;
    align-items: center;
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
    box-shadow: 0 8px 18px rgba(31, 36, 82, .05);
}

.rank.top-1 {
    border-color: var(--gold);
    background: linear-gradient(135deg, #fff8d6 0%, #fff 62%);
}

.rank.top-2 {
    border-color: var(--silver);
    background: linear-gradient(135deg, #eef5ff 0%, #fff 62%);
}

.rank.top-3 {
    border-color: var(--bronze);
    background: linear-gradient(135deg, #ffe8d1 0%, #fff 62%);
}

.rank.is-current-player {
    position: relative;
    border: 3px solid var(--company-red);
    background: linear-gradient(135deg, #fff1d6 0%, #ffffff 58%);
    box-shadow: 0 0 0 2px rgba(178, 31, 11, .12), 0 12px 28px rgba(178, 31, 11, .12);
}

.rank.is-current-player .rank-number {
    background: linear-gradient(135deg, var(--company-red), var(--orange));
}

.rank-number {
    display: grid;
    place-items: center;
    width: 34px;
    height: 34px;
    border-radius: 999px;
    color: #fff;
    background: linear-gradient(135deg, var(--brand), var(--sky));
    font-weight: 800;
}

.top-1 .rank-number {
    background: var(--gold);
}

.top-2 .rank-number {
    background: var(--silver);
}

.top-3 .rank-number {
    background: var(--bronze);
}

.score {
    font-size: 20px;
    font-weight: 800;
}

table {
    width: 100%;
    border-collapse: collapse;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 8px;
    overflow: hidden;
}

th,
td {
    padding: 12px;
    border-bottom: 1px solid var(--line);
    text-align: left;
    vertical-align: top;
}

th {
    color: #8a4f00;
    font-size: 13px;
    text-transform: uppercase;
}

tr:last-child td {
    border-bottom: 0;
}

.mission-list {
    display: grid;
    gap: 12px;
}

.mission-item {
    padding: 14px;
}

.mission-item.active {
    border-color: #8ee6cf;
    background: linear-gradient(135deg, #edfff8 0%, #fff8e6 100%);
}

.mission-prompt {
    margin: 14px 0;
    padding: 18px;
    border: 1px solid #8ee6cf;
    border-left: 6px solid var(--orange);
    border-radius: 8px;
    color: var(--ink);
    background: linear-gradient(135deg, #ffffff 0%, #fff8e6 100%);
    font-size: 22px;
    font-weight: 800;
    line-height: 1.45;
    word-break: normal;
    overflow-wrap: break-word;
}

.photo-preview {
    display: block;
    max-width: 220px;
    max-height: 180px;
    border-radius: 8px;
    border: 1px solid var(--line);
    box-shadow: 0 8px 18px rgba(31, 36, 82, .1);
}

.image-lightbox[hidden] {
    display: none;
}

.image-lightbox {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: grid;
    place-items: center;
    padding: 58px 18px 18px;
    background: rgba(15, 23, 42, .78);
}

.image-lightbox img {
    display: block;
    max-width: min(100%, 980px);
    max-height: calc(100vh - 96px);
    border-radius: 8px;
    background: #fff;
    box-shadow: 0 24px 70px rgba(0, 0, 0, .35);
    object-fit: contain;
}

.image-lightbox-close {
    position: fixed;
    top: 14px;
    right: 14px;
    border: 0;
    border-radius: 999px;
    padding: 10px 16px;
    color: #fff;
    background: var(--company-red);
    font: inherit;
    font-weight: 800;
    cursor: pointer;
    box-shadow: 0 10px 24px rgba(0, 0, 0, .28);
}

@media (max-width: 760px) {
    .app-shell {
        width: min(100% - 20px, 1120px);
        padding-top: 16px;
    }

    .grid,
    .auth-grid,
    .admin-message-panel,
    .manual-score-grid,
    .release-pair-form,
    .settings-grid,
    .split {
        grid-template-columns: 1fr;
        display: grid;
    }

    .auth-grid {
        gap: 14px;
    }

    .auth-panel {
        padding: 18px;
    }

    .topbar {
        align-items: center;
        flex-direction: row;
        padding: 12px;
        gap: 10px;
    }

    .brand {
        min-width: 0;
    }

    .brand strong {
        font-size: 20px;
    }

    .brand span {
        font-size: 12px;
    }

    .player-summary {
        display: grid;
        grid-template-columns: auto minmax(0, 1fr);
        gap: 12px;
        align-items: center;
        padding: 14px;
        border: 1px solid rgba(16, 185, 129, .3);
        border-radius: 8px;
        background: linear-gradient(135deg, #ffffff 0%, #edfff8 62%, #fff8e6 100%);
        box-shadow: 0 10px 22px rgba(31, 36, 82, .07);
    }

    .player-identity {
        display: contents;
    }

    .player-summary .avatar.lg {
        width: 72px;
        height: 72px;
        grid-row: 1 / span 2;
        align-self: center;
    }

    .player-copy {
        align-self: end;
        min-width: 0;
    }

    .player-copy h1 {
        margin: 0 0 5px;
        font-size: 30px;
        line-height: 1.08;
        overflow-wrap: anywhere;
    }

    .player-copy .muted {
        font-size: 15px;
        line-height: 1.25;
    }

    .player-phone {
        grid-column: 2;
        justify-self: start;
        width: auto;
        max-width: 100%;
        min-height: 30px;
        padding: 7px 12px;
        border: 1px solid rgba(138, 79, 0, .18);
        background: #fff0c2;
        font-size: 13px;
        color: #8a4f00;
    }

    .company-logo {
        width: 58px;
        max-height: 58px;
        margin-left: auto;
    }

    .topbar-actions {
        margin-left: auto;
        align-items: flex-end;
        flex-direction: column;
        gap: 8px;
    }

    .topbar-actions .company-logo {
        margin-left: 0;
    }

    .topbar-actions .row {
        justify-content: flex-end;
        gap: 6px;
    }

    .topbar-actions .btn {
        min-height: 34px;
        padding: 8px 10px;
        font-size: 12px;
    }

    .photo-upload-box {
        grid-template-columns: auto minmax(0, 1fr);
    }

    .photo-upload-button {
        grid-column: 1 / -1;
        width: 100%;
    }

    .cover-section {
        aspect-ratio: 4 / 3;
        min-height: 160px;
    }

    table,
    thead,
    tbody,
    th,
    td,
    tr {
        display: block;
    }

    thead {
        display: none;
    }

    tr {
        border-bottom: 1px solid var(--line);
    }

    .other-answer-table-wrap {
        overflow-x: visible;
    }

    .other-answer-table {
        min-width: 0;
        border: 0;
        background: transparent;
    }

    .other-answer-table tr {
        display: grid;
        grid-template-columns: 74px minmax(0, 1fr);
        gap: 8px 12px;
        padding: 10px;
        border: 1px solid var(--line);
        border-radius: 8px;
        background: #fff;
    }

    .other-answer-table td {
        display: block;
        padding: 0;
        border-bottom: 0;
    }

    .other-avatar-cell {
        grid-column: 1;
        grid-row: 1;
        justify-self: center;
    }

    .other-name-cell {
        grid-column: 1;
        grid-row: 2;
        justify-self: center;
        text-align: center;
        font-size: 12px;
        line-height: 1.2;
    }

    .other-answer-cell {
        grid-column: 2;
        grid-row: 1;
        font-size: 13px;
        line-height: 1.35;
    }

    .other-time-cell {
        grid-column: 2;
        grid-row: 2;
        color: var(--muted);
        font-size: 12px;
        line-height: 1.2;
    }

    .other-status-cell {
        grid-column: 2;
        grid-row: 3;
    }

    .other-status-cell .status-badge {
        min-height: 20px;
        padding: 2px 7px;
        font-size: 11px;
    }

    .other-answer-table .avatar {
        width: 44px;
        height: 44px;
    }

    .other-answer-table .photo-preview {
        max-width: 130px;
        max-height: 90px;
    }
}

/* Final poster/manual skin overrides. Keep this block last. */
body {
    background:
        linear-gradient(rgba(31, 36, 82, .035) 1px, transparent 1px),
        linear-gradient(90deg, rgba(31, 36, 82, .025) 1px, transparent 1px),
        #fbfbf7;
    background-size: 100% 26px, 26px 100%, auto;
}

.topbar,
.panel,
.card,
.cover-section,
.answer-accordion,
.player-announcement,
.mission-prompt,
.active-mission-row,
.team-score,
.rank {
    border: 2px solid #111827;
    border-radius: 2px;
    box-shadow: 5px 5px 0 #111827;
    background-color: rgba(255, 255, 255, .96);
}

.brand strong,
.mission-board-title h2,
.admin-section-summary h2,
.score-history h2,
.recent-answers h3,
aside h2,
.mission-item.active h2 {
    display: inline-flex;
    width: fit-content;
    border: 2px solid #111827;
    border-radius: 2px;
    box-shadow: 3px 3px 0 #111827;
    color: #111827;
    font-weight: 900;
}

.brand strong {
    padding: 4px 12px;
    background: var(--gold);
    transform: rotate(-1deg);
}

.mission-board-title h2,
.recent-answers h3,
aside h2 {
    padding: 5px 10px;
    background: #7dd3fc;
}

.admin-section-summary h2,
.score-history h2 {
    padding: 5px 10px;
    background: #fde047;
}

.mission-item.active h2 {
    padding: 5px 10px;
    background: #86efac;
}

.player-announcement p {
    display: inline;
    width: fit-content;
    padding: 8px 12px;
    border: 2px solid #111827;
    border-radius: 2px;
    background: #fde047;
    box-shadow: 4px 4px 0 #111827;
    transform: rotate(-.5deg);
}

.btn {
    border: 2px solid #111827;
    border-radius: 2px;
    background: #f97316;
    box-shadow: 3px 3px 0 #111827;
}

.btn:hover {
    background: #ea580c;
}

.btn.secondary {
    background: #fde047;
}

.btn.danger {
    background: #ef4444;
}

.badge,
.status-badge,
.progress-wrap,
.photo-upload-button,
.progress-track,
.photo-upload-box,
input,
textarea,
select,
.avatar {
    border: 2px solid #111827;
    border-radius: 2px;
    box-shadow: 3px 3px 0 #111827;
}

.badge,
.status-badge {
    background: #fde68a;
    color: #111827;
}

.photo-upload-box {
    background: #f8fafc;
    box-shadow: 4px 4px 0 #111827;
}

.mission-prompt {
    border-left-width: 2px;
    background: #fff7ed;
}

@media (max-width: 760px) {
    .topbar,
    .panel,
    .card,
    .cover-section,
    .answer-accordion,
    .player-announcement,
    .mission-prompt,
    .active-mission-row,
    .team-score,
    .rank {
        box-shadow: 4px 4px 0 #111827;
    }
}

.team-score {
    border-left-color: var(--team-color, var(--brand));
    background:
        linear-gradient(90deg, color-mix(in srgb, var(--team-color, var(--brand)) 22%, white) 0%, rgba(255, 255, 255, .96) 58%),
        #fff;
}

.team-score strong {
    color: color-mix(in srgb, var(--team-color, var(--brand)) 72%, #111827);
}

.team-score .score {
    border: 2px solid #111827;
    border-radius: 2px;
    padding: 6px 10px;
    color: #111827;
    background: color-mix(in srgb, var(--team-color, var(--brand)) 35%, white);
    box-shadow: 3px 3px 0 #111827;
}

@media (max-width: 760px) {
    .mission-board-title {
        grid-template-columns: auto minmax(0, 1fr);
        align-items: center;
        width: 100%;
        max-width: 100%;
        box-sizing: border-box;
        margin-left: 0;
        padding: 10px;
        border: 2px solid #111827;
        border-radius: 2px;
        background: #fff;
        box-shadow: 4px 4px 0 #111827;
    }

    .mission-board-title h2 {
        justify-self: start;
        margin: 0;
        white-space: nowrap;
    }

    .mission-board-title .progress-wrap {
        width: 100%;
        min-width: 0;
        grid-template-columns: minmax(0, 1fr) auto;
        gap: 6px;
        padding: 6px;
    }

    .mission-board-title .progress-track {
        width: 100%;
        height: 16px;
    }
}
