:root {
  --bg: #0f1b3d;
  --panel: #182752;
  --panel-2: #1f3167;
  --text: #f3f5fb;
  --muted: #9fb0d8;
  --accent: #ffc83d;
  --accent-text: #1a1a1a;
  --good: #3ddc97;
  --bad: #ff6b6b;
  --border: #2d4180;
}
* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  line-height: 1.45;
}
h1, h2, h3 { margin: 0 0 .5rem; line-height: 1.2; }
button, input, textarea { font: inherit; }
.hidden { display: none !important; }

.wrap { max-width: 640px; margin: 0 auto; padding: 24px 16px; }
.wrap.wide { max-width: 1100px; }
.brand { color: var(--accent); font-weight: 800; letter-spacing: .04em; text-transform: uppercase; font-size: .85rem; }
.card { background: var(--panel); border: 1px solid var(--border); border-radius: 14px; padding: 20px; margin-bottom: 16px; }
.muted { color: var(--muted); }
.error { color: var(--bad); min-height: 1.4em; margin: .5rem 0 0; }

label { display: block; font-weight: 600; margin: 12px 0 4px; }
input[type=text], input[type=password], input[type=number], textarea {
  width: 100%; padding: 12px 14px; border-radius: 10px; border: 1px solid var(--border);
  background: var(--bg); color: var(--text);
}
textarea { min-height: 80px; resize: vertical; }
input:focus, textarea:focus { outline: 2px solid var(--accent); border-color: transparent; }

.btn {
  display: inline-block; border: 0; border-radius: 10px; padding: 12px 20px; cursor: pointer;
  background: var(--accent); color: var(--accent-text); font-weight: 700;
}
.btn:disabled { opacity: .4; cursor: not-allowed; }
.btn.secondary { background: var(--panel-2); color: var(--text); border: 1px solid var(--border); }
.btn.danger { background: var(--bad); color: #fff; }
.btn.small { padding: 6px 12px; font-size: .85rem; }
.btn.block { display: block; width: 100%; }

/* spelvy */
.game { display: flex; flex-direction: column; height: 100dvh; }
.game-head { padding: 12px 16px; background: var(--panel); border-bottom: 1px solid var(--border); }
.game-head .row { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.dots { display: flex; gap: 6px; margin-top: 8px; }
.dots span { flex: 1; height: 6px; border-radius: 3px; background: var(--panel-2); }
.dots span.done { background: var(--good); }
.dots span.now { background: var(--accent); }
.clue { margin: 10px 0 0; font-size: 1.1rem; font-weight: 600; }
.map-box { position: relative; flex: 1; min-height: 240px; }
#map { position: absolute; inset: 0; }
.game-foot { padding: 12px 16px; background: var(--panel); border-top: 1px solid var(--border); display: flex; gap: 12px; align-items: center; }
.game-foot .hint { flex: 1; font-size: .9rem; color: var(--muted); }

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

/* admin */
.tabs { display: flex; gap: 8px; margin: 16px 0; flex-wrap: wrap; }
.tab { padding: 8px 16px; border-radius: 999px; border: 1px solid var(--border); background: transparent; color: var(--text); cursor: pointer; }
.tab.active { background: var(--accent); color: var(--accent-text); border-color: var(--accent); font-weight: 700; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--border); vertical-align: top; }
th { color: var(--muted); font-weight: 600; font-size: .85rem; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
.medal { font-weight: 800; color: var(--accent); }
.row-flex { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.q-head { display: flex; justify-content: space-between; gap: 12px; align-items: flex-start; }
.badge { display: inline-block; padding: 2px 8px; border-radius: 999px; background: var(--panel-2); font-size: .75rem; color: var(--muted); }
.badge.on { background: var(--good); color: #05261a; }
.result-map { height: 340px; border-radius: 10px; margin-top: 12px; }
.edit-map { height: 360px; border-radius: 10px; margin: 8px 0; }
.dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 6px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 560px) { .grid2 { grid-template-columns: 1fr; } }
