:root {
    color-scheme: dark;
    --bg: #0b1020;
    --panel: rgba(255, 255, 255, .075);
    --panel-strong: rgba(255, 255, 255, .12);
    --border: rgba(255, 255, 255, .14);
    --text: #eef4ff;
    --muted: #aebcdd;
    --accent: #78e0aa;
    --accent-2: #8dd7ff;
    --danger: #ff8fa3;
    --warning: #ffd36b;
    --shadow: 0 24px 90px rgba(0, 0, 0, .28);
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    min-height: 100vh;
    color: var(--text);
    background:
        radial-gradient(circle at 12% 10%, rgba(120, 224, 170, .20), transparent 32%),
        radial-gradient(circle at 86% 18%, rgba(141, 215, 255, .22), transparent 30%),
        linear-gradient(145deg, #070a13 0%, #101a33 52%, #080d18 100%);
}

button, input { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: .52; }

.shell {
    width: min(1180px, calc(100% - 28px));
    margin: 0 auto;
    padding: 28px 0 54px;
}

.hero {
    display: grid;
    grid-template-columns: 1fr minmax(260px, 360px);
    gap: 20px;
    align-items: stretch;
    margin-bottom: 20px;
}

.eyebrow {
    margin: 0 0 8px;
    color: var(--accent-2);
    font-size: 13px;
    font-weight: 700;
    letter-spacing: .08em;
    text-transform: uppercase;
}

h1, h2, h3, p { margin-top: 0; }
h1 { margin-bottom: 10px; font-size: clamp(34px, 6vw, 68px); line-height: .92; letter-spacing: -.05em; }
h2 { font-size: 22px; }
h3 { font-size: 16px; }
.lead { max-width: 760px; color: #dce7ff; font-size: clamp(17px, 2vw, 21px); line-height: 1.55; margin-bottom: 0; }

.hero-card, .panel {
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: 24px;
    box-shadow: var(--shadow);
    backdrop-filter: blur(12px);
}

.hero-card {
    padding: 20px;
    display: grid;
    align-content: center;
    gap: 8px;
}
.hero-card strong { font-size: 18px; }
.hero-card span { color: var(--accent); font-weight: 800; }
.hero-card small { color: var(--muted); overflow-wrap: anywhere; }

.layout {
    display: grid;
    grid-template-columns: 330px 1fr;
    gap: 20px;
    align-items: start;
}

.panel { padding: 20px; }
.setup-panel { position: sticky; top: 16px; }

.field { display: grid; gap: 8px; margin-bottom: 14px; }
.field span { color: var(--muted); font-size: 14px; }
input {
    width: 100%;
    padding: 13px 14px;
    color: var(--text);
    background: rgba(0,0,0,.25);
    border: 1px solid rgba(255,255,255,.16);
    border-radius: 14px;
    outline: none;
}
input:focus { border-color: var(--accent-2); box-shadow: 0 0 0 4px rgba(141, 215, 255, .13); }

.primary-button, .secondary-button {
    width: 100%;
    border: 0;
    border-radius: 15px;
    padding: 13px 15px;
    font-weight: 850;
    transition: transform .16s ease, filter .16s ease, background .16s ease;
}
.primary-button { background: var(--accent); color: #07130d; }
.secondary-button { background: rgba(255,255,255,.12); color: var(--text); border: 1px solid rgba(255,255,255,.10); }
.primary-button:hover, .secondary-button:hover { transform: translateY(-1px); filter: brightness(1.05); }
.setup-panel .secondary-button { margin-top: 10px; }

.status-card {
    display: grid;
    grid-template-columns: 14px 1fr;
    gap: 12px;
    align-items: start;
    margin: 16px 0;
    padding: 14px;
    background: rgba(0,0,0,.20);
    border-radius: 16px;
    border: 1px solid rgba(255,255,255,.08);
}
.status-card p { color: var(--muted); font-size: 13px; line-height: 1.45; margin: 4px 0 0; }
.status-dot { width: 12px; height: 12px; border-radius: 99px; margin-top: 4px; background: var(--warning); box-shadow: 0 0 0 5px rgba(255,211,107,.1); }
.status-dot.online { background: var(--accent); box-shadow: 0 0 0 5px rgba(120,224,170,.12); }
.status-dot.offline { background: var(--danger); box-shadow: 0 0 0 5px rgba(255,143,163,.12); }

.rules {
    color: var(--muted);
    font-size: 14px;
    line-height: 1.5;
}
.rules ol { padding-left: 20px; margin-bottom: 0; }

.hud {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
    margin-bottom: 16px;
}
.hud div {
    padding: 13px;
    background: rgba(0,0,0,.20);
    border: 1px solid rgba(255,255,255,.09);
    border-radius: 16px;
}
.hud span { display: block; color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .06em; margin-bottom: 4px; }
.hud strong { font-size: 24px; }

.message-card {
    position: relative;
    min-height: 210px;
    padding: 22px;
    margin-bottom: 16px;
    background:
        linear-gradient(135deg, rgba(141,215,255,.12), transparent 38%),
        rgba(0,0,0,.26);
    border: 1px solid rgba(255,255,255,.13);
    border-radius: 22px;
    overflow: hidden;
}
.message-card:before {
    content: "";
    position: absolute;
    inset: 0;
    background-image: linear-gradient(rgba(255,255,255,.035) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,.03) 1px, transparent 1px);
    background-size: 26px 26px;
    pointer-events: none;
}
.message-card > * { position: relative; }
.message-topline { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 16px; }
.badge { display: inline-flex; align-items: center; border-radius: 999px; padding: 6px 10px; background: rgba(120,224,170,.16); color: #baf6d2; font-size: 12px; font-weight: 800; letter-spacing: .05em; text-transform: uppercase; }
.badge.ghost { background: rgba(255,255,255,.10); color: #d8e2f9; }
.message-text { min-height: 84px; font-size: clamp(22px, 3.2vw, 36px); line-height: 1.22; font-weight: 850; letter-spacing: -.03em; margin-bottom: 12px; overflow-wrap: anywhere; }
.hint-text { color: #c8d5f1; line-height: 1.55; margin-bottom: 0; }

.targets {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 10px;
    margin-bottom: 14px;
}
.target {
    min-height: 115px;
    text-align: left;
    color: var(--text);
    background: rgba(255,255,255,.09);
    border: 1px solid rgba(255,255,255,.13);
    border-radius: 18px;
    padding: 13px;
    transition: transform .14s ease, border-color .14s ease, background .14s ease;
}
.target:hover { transform: translateY(-2px); border-color: rgba(141,215,255,.55); background: rgba(141,215,255,.13); }
.target .icon { display: block; font-size: 24px; margin-bottom: 5px; }
.target strong { display: block; margin-bottom: 5px; }
.target small { color: var(--muted); line-height: 1.35; }
.target.correct { border-color: rgba(120,224,170,.85); background: rgba(120,224,170,.20); }
.target.wrong { border-color: rgba(255,143,163,.85); background: rgba(255,143,163,.18); }

.game-actions { display: grid; grid-template-columns: 1fr 160px; gap: 10px; }
.round-feedback {
    margin-top: 14px;
    min-height: 44px;
    padding: 13px 14px;
    border-radius: 16px;
    color: #dce7ff;
    background: rgba(0,0,0,.20);
    border: 1px solid rgba(255,255,255,.09);
}
.round-feedback.good { border-color: rgba(120,224,170,.55); color: #c8f7da; }
.round-feedback.bad { border-color: rgba(255,143,163,.65); color: #ffd4db; }

.boards {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-top: 20px;
}
.board-title { display: flex; justify-content: space-between; gap: 12px; align-items: baseline; margin-bottom: 12px; }
.board-title h2 { margin-bottom: 0; }
.board-title span { color: var(--muted); font-size: 13px; }
.leaderboard table { width: 100%; border-collapse: collapse; }
.leaderboard th, .leaderboard td { padding: 10px 8px; border-bottom: 1px solid rgba(255,255,255,.10); text-align: left; }
.leaderboard th { color: var(--muted); font-size: 12px; letter-spacing: .05em; text-transform: uppercase; }
.leaderboard tr:last-child td { border-bottom: 0; }
.leaderboard .empty { color: var(--muted); }
.sync-badge { display: inline-block; border-radius: 99px; padding: 3px 8px; font-size: 12px; background: rgba(255,255,255,.10); color: #d8e2f9; }
.sync-badge.synced { background: rgba(120,224,170,.16); color: #baf6d2; }
.sync-badge.pending { background: rgba(255,211,107,.14); color: #ffe3a1; }
.sync-badge.moderation { background: rgba(141,215,255,.14); color: #c8edff; }

.visitor-text { margin-top: 20px; }
.visitor-text p { color: #dce7ff; line-height: 1.65; margin-bottom: 0; }

@media (max-width: 1040px) {
    .targets { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 820px) {
    .hero, .layout, .boards { grid-template-columns: 1fr; }
    .setup-panel { position: static; }
    .hud { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 520px) {
    .targets, .game-actions { grid-template-columns: 1fr; }
    .hud strong { font-size: 20px; }
    .message-card { min-height: 190px; padding: 18px; }
}
