:root {
  --bg: #07182b;
  --bg2: #0c2440;
  --card: #10304f;
  --line: #1d4569;
  --text: #e8f2fb;
  --muted: #8fb0cc;
  --accent: #ff8a5c;
  --accent2: #4fd1c5;
  --danger: #ff6b6b;
  --radius: 14px;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font: 16px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color: var(--text);
  background: var(--bg) linear-gradient(180deg, var(--bg2), var(--bg) 600px) no-repeat;
  min-height: 100vh;
  padding-bottom: env(safe-area-inset-bottom);
}
main { max-width: 760px; margin: 0 auto; padding: 0 16px 48px; }
h1, h2, h3 { margin: 0 0 8px; line-height: 1.2; }
h2 { font-size: 1.1rem; margin-top: 28px; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
h3 { font-size: 1.05rem; }
a { color: var(--accent2); }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.center { text-align: center; }
.err { color: var(--danger); margin: 8px 0 0; }
.hint { color: var(--accent2); font-size: .9rem; margin: 0; }
.grow { flex: 1; }

.top {
  position: sticky; top: 0; z-index: 5;
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 16px; padding-top: calc(12px + env(safe-area-inset-top));
  background: rgba(7, 24, 43, .9); backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}
.brand { font-weight: 800; font-size: 1.2rem; letter-spacing: .02em; }
.logo { margin-right: 4px; }

.card, .game, .board-game, dialog {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
}
.card { padding: 20px; margin-top: 24px; }

.btn, .chip, .icon-btn, .tab, .mine, .sc {
  font: inherit; color: var(--text); cursor: pointer;
  background: var(--bg2); border: 1px solid var(--line); border-radius: 10px;
}
.btn { padding: 10px 14px; font-weight: 600; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #2a0f02; }
.btn.danger { color: var(--danger); }
.btn.wide { width: 100%; margin-top: 12px; padding: 14px; font-size: 1.05rem; }
.btn:disabled { opacity: .6; cursor: default; }
.chip { padding: 6px 12px; border-radius: 999px; }
.icon-btn { width: 40px; height: 40px; font-size: 1.4rem; line-height: 1; }
.icon-btn:disabled { opacity: .3; cursor: default; }

.row { display: flex; gap: 8px; align-items: center; margin-top: 12px; }
.row.end { justify-content: flex-end; }
input, select, textarea {
  font: inherit; color: var(--text); width: 100%;
  background: var(--bg); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px;
}
textarea { resize: vertical; font-family: ui-monospace, Menlo, Consolas, monospace; font-size: .9rem; }
label { display: grid; gap: 6px; margin-top: 12px; font-weight: 600; }
label .muted { font-weight: 400; }

.name-list { display: flex; flex-wrap: wrap; gap: 8px; margin: 12px 0; }

.day-bar { display: flex; align-items: center; justify-content: space-between; margin-top: 16px; }
.day-label { font-size: 1.3rem; font-weight: 800; }

.games { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
.game { padding: 14px; display: flex; flex-direction: column; gap: 6px; }
.game p { margin: 0; flex: 1; }
.game-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.play {
  font-weight: 700; text-decoration: none; color: var(--bg);
  background: var(--accent2); padding: 6px 10px; border-radius: 8px; white-space: nowrap;
}
.game-foot { display: flex; justify-content: space-between; align-items: center; margin-top: 6px; }
.mine { padding: 8px 12px; font-weight: 700; border-color: var(--accent2); }

.tabs { display: flex; gap: 6px; margin-bottom: 12px; overflow-x: auto; }
.tab { padding: 8px 14px; white-space: nowrap; }
.tab.active { background: var(--accent2); border-color: var(--accent2); color: var(--bg); font-weight: 700; }

.board-game { padding: 14px; margin-bottom: 10px; }
.ranks { list-style: none; margin: 0; padding: 0; }
.ranks li { display: flex; align-items: center; gap: 10px; padding: 6px 0; border-top: 1px solid var(--line); }
.ranks li:first-child { border-top: 0; }
.ranks li.me .nm { color: var(--accent); font-weight: 700; }
.rk { width: 2em; text-align: center; }
.nm { flex: 1; }
.sc { padding: 4px 10px; font-weight: 700; }

.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); }
table { border-collapse: collapse; width: 100%; min-width: 560px; }
th, td { padding: 10px; text-align: center; border-bottom: 1px solid var(--line); white-space: nowrap; }
th:first-child, td:first-child { text-align: left; position: sticky; left: 0; background: var(--card); }
th { font-size: .8rem; color: var(--muted); background: var(--card); }
tr.me td:first-child { color: var(--accent); font-weight: 700; }
tbody tr:last-child td { border-bottom: 0; }

dialog { color: var(--text); width: min(520px, calc(100vw - 24px)); padding: 20px; max-height: 90vh; overflow: auto; }
dialog::backdrop { background: rgba(0, 0, 0, .6); }
.preview img, .proof { max-width: 100%; border-radius: 10px; margin-top: 10px; display: block; }
.preview p { margin: 10px 0 0; }
.share { white-space: pre-wrap; background: var(--bg); padding: 12px; border-radius: 10px; font-size: .9rem; }
.big { font-size: 2rem; font-weight: 800; margin: 4px 0 12px; }
