body {
    margin: 0;
    min-height: 100vh;
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    background: radial-gradient(circle at top, #1a2450 0%, #0b1126 32%, #050812 72%);
    color: #f4ead2;
}
* { box-sizing: border-box; }
main { max-width: 1180px; margin: 0 auto; padding: 24px; }
.hero, .panel {
    background: rgba(10, 17, 36, .92);
    border: 1px solid #8b7446;
    border-radius: 20px;
    padding: 24px;
    margin-bottom: 20px;
    box-shadow: 0 18px 50px rgba(0,0,0,.2);
}
.hero h1, .panel h2 { margin-top: 0; }
.eyebrow {
    letter-spacing: .18em;
    color: #d7b974;
    font-size: .78rem;
    font-weight: 800;
}
.note, .section-head p { color: #c7c0af; }
.section-head {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    align-items: flex-start;
    margin-bottom: 18px;
}
.section-head p { margin: 4px 0 0; }
.badge {
    border: 1px solid #8b7446;
    border-radius: 999px;
    padding: 8px 12px;
    white-space: nowrap;
    background: #171b32;
}
.cards {
    display: grid;
    grid-template-columns: repeat(8, minmax(80px, 1fr));
    gap: 12px;
}
.card { aspect-ratio: 2 / 3; perspective: 1000px; }
.card button {
    width: 100%;
    height: 100%;
    padding: 0;
    border: 0;
    background: none;
    cursor: pointer;
}
.card button:disabled { cursor: default; }
.inner {
    position: relative;
    width: 100%;
    height: 100%;
    transition: transform .85s cubic-bezier(.2,.75,.25,1);
    transform-style: preserve-3d;
}
.flipped .inner { transform: rotateY(180deg); }
.face {
    position: absolute;
    inset: 0;
    border: 2px solid #c7a45b;
    border-radius: 13px;
    overflow: hidden;
    backface-visibility: hidden;
    box-shadow: 0 12px 30px rgba(0,0,0,.28);
}
.back {
    display: grid;
    place-items: center;
    background: radial-gradient(circle at center, #2e437f 0%, #182958 35%, #091025 76%);
}
.back::before {
    content: "";
    width: 56%;
    aspect-ratio: 1;
    border: 1px solid #d7b974;
    transform: rotate(45deg);
    box-shadow: 0 0 0 9px rgba(215,185,116,.06), 0 0 24px rgba(215,185,116,.18);
}
.back::after {
    content: "✦";
    position: absolute;
    font-size: 2rem;
    color: #ead49d;
}
.front { transform: rotateY(180deg); background: #070b18; }
.front img { width: 100%; height: 100%; object-fit: cover; }
.claimed {
    opacity: .2;
    filter: grayscale(.7);
    pointer-events: none;
}
.hidden { display: none; }
.result-layout {
    display: grid;
    grid-template-columns: minmax(220px, 290px) 1fr;
    gap: 32px;
    align-items: center;
}
.result-card { max-width: 290px; width: 100%; margin: auto; }
.result-copy h3 { color: #e4c989; }
.assignment {
    margin: 26px 0;
    padding: 18px 20px;
    border: 1px solid #8b7446;
    border-radius: 14px;
    background: linear-gradient(135deg, rgba(57,47,91,.7), rgba(19,26,52,.72));
}
.assignment .label {
    color: #d7b974;
    letter-spacing: .18em;
    font-size: .74rem;
    font-weight: 800;
}
.heat-result {
    margin-top: 6px;
    font-size: clamp(1.5rem, 4vw, 2.5rem);
    font-weight: 850;
}
button {
    font: inherit;
    border: 1px solid #b69555;
    border-radius: 11px;
    padding: 11px 16px;
    background: #d7b974;
    color: #12141b;
    font-weight: 800;
    cursor: pointer;
}
.heat-block { margin-bottom: 24px; }
.heat-block h3 { margin: 0 0 8px; color: #e7d39f; }
table {
    width: 100%;
    border-collapse: collapse;
    overflow: hidden;
    border-radius: 12px;
}
th, td {
    padding: 11px 12px;
    border-bottom: 1px solid #30364c;
    text-align: left;
}
th { color: #cdb77f; font-size: .84rem; }
tr.assigned { background: rgba(67, 57, 105, .28); }

@media (max-width: 900px) {
    .cards { grid-template-columns: repeat(4, 1fr); }
}
@media (max-width: 650px) {
    main { padding: 12px; }
    .hero, .panel { padding: 18px; border-radius: 16px; }
    .result-layout { grid-template-columns: 1fr; }
    .cards { gap: 8px; }
    .section-head { display: block; }
    .badge { display: inline-block; margin-top: 10px; }
}


/* Configurable  setup */
.setup-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(180px, 1fr));
    gap: 14px;
    margin-bottom: 18px;
}
.setup-grid label, .summary-box {
    display: grid;
    gap: 8px;
    padding: 14px;
    border: 1px solid #343b55;
    border-radius: 12px;
    background: #11172b;
}
.setup-grid label span, .summary-box span {
    color: #cdb77f;
    font-size: .82rem;
}
.setup-grid select, .setup-grid input {
    width: 100%;
    padding: 11px 12px;
    border: 1px solid #6f6247;
    border-radius: 9px;
    background: #f6f3ea;
    color: #171717;
    font: inherit;
}
.summary-box strong { font-size: 1.08rem; }
@media (max-width: 900px) {
    .setup-grid { grid-template-columns: 1fr; }
}


.action-row {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.danger-button {
    background: #3a1620;
    color: #f5d5dc;
    border-color: #8f4052;
}

.danger-button:hover {
    background: #51202c;
}

.save-status {
    margin: 8px 0 0;
    color: #9fd4ac;
    font-size: .88rem;
}

.save-status.restored {
    color: #e6ca82;
}


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


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


.pilot-name-editor {
    display: grid;
    gap: 7px;
    max-width: 420px;
}

.pilot-name-editor label {
    color: #cdb77f;
    font-size: .82rem;
    font-weight: 700;
}

.pilot-name-editor input {
    font-size: 1.15rem;
    font-weight: 750;
}

.board-reset-row {
    display: flex;
    justify-content: flex-end;
    margin-bottom: 14px;
}
