:root {
  --bg: #f6f3ee;
  --fg: #1f1d1a;
  --muted: #6d665c;
  --card: #fffdf9;
  --line: #e2dbcf;
  --accent: #b4432f;
  --accent-fg: #fff;
  --ok: #2f7a4b;
  --secret: #2b2d42;
  --secret-fg: #f1f1f6;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #15161c;
    --fg: #ecebe8;
    --muted: #a19d95;
    --card: #1f2029;
    --line: #34353f;
    --accent: #e0705a;
    --accent-fg: #15161c;
    --ok: #6fc28f;
    --secret: #0c0d12;
    --secret-fg: #f1f1f6;
    color-scheme: dark;
  }
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--fg);
  font-family: -apple-system, BlinkMacSystemFont, "Hiragino Sans", "Noto Sans JP", sans-serif;
  line-height: 1.6;
  -webkit-text-size-adjust: 100%;
}
main { max-width: 560px; margin: 0 auto; padding: 16px 16px 48px; }
h1 { font-size: 1.5rem; margin: 8px 0 16px; }
h2 { font-size: 1.1rem; margin: 20px 0 8px; }
a { color: var(--accent); }
.muted { color: var(--muted); font-size: 0.9rem; }
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 16px;
  margin: 12px 0;
}
button, .btn {
  font: inherit;
  font-size: 1rem;
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--fg);
  border-radius: 12px;
  padding: 12px 16px;
  min-height: 48px;
  cursor: pointer;
  touch-action: manipulation;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}
button.primary, .btn.primary { background: var(--accent); color: var(--accent-fg); border-color: var(--accent); font-weight: 700; }
button:disabled { opacity: 0.45; cursor: default; }
button.small { min-height: 36px; padding: 6px 12px; font-size: 0.9rem; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.stack > * + * { margin-top: 8px; }
.full { width: 100%; }
input[type="text"] {
  font: inherit;
  font-size: 1.1rem;
  width: 100%;
  padding: 12px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--fg);
}
.code {
  font-size: 2.4rem;
  font-weight: 800;
  letter-spacing: 0.3em;
  text-align: center;
}
.players { list-style: none; padding: 0; margin: 0; }
.players li {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 0; border-bottom: 1px solid var(--line);
}
.players li:last-child { border-bottom: 0; }
.dot { width: 9px; height: 9px; border-radius: 50%; background: var(--ok); flex: none; }
.dot.off { background: var(--muted); opacity: 0.5; }
.tag { font-size: 0.75rem; border: 1px solid var(--line); border-radius: 999px; padding: 0 8px; color: var(--muted); }
.grow { flex: 1; }
.toast {
  position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%);
  background: var(--fg); color: var(--bg); padding: 10px 16px; border-radius: 12px;
  max-width: calc(100% - 32px); z-index: 10; font-size: 0.95rem;
}
.banner { background: #e9b949; color: #1f1d1a; text-align: center; padding: 6px; font-size: 0.9rem; }
.topbar { display: flex; align-items: center; gap: 8px; padding: 8px 16px; border-bottom: 1px solid var(--line); max-width: 560px; margin: 0 auto; }
.topbar a { text-decoration: none; color: var(--muted); font-size: 0.9rem; }

/* 覗き見防止：押している間だけ見える */
.secret {
  position: relative;
  background: var(--secret);
  color: var(--secret-fg);
  border-radius: 16px;
  min-height: 132px;
  padding: 16px;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
  touch-action: none;
  display: flex; align-items: center; justify-content: center; text-align: center;
}
.secret .inner { display: none; }
.secret .cover { color: #9a9cb3; font-size: 0.95rem; }
.secret.open .inner { display: block; }
.secret.open .cover { display: none; }
.secret .big { font-size: 2rem; font-weight: 800; }

.grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
.grid button { min-height: 56px; }
.grid button.sel { outline: 3px solid var(--accent); }
.timer { font-size: 4.5rem; font-weight: 800; text-align: center; font-variant-numeric: tabular-nums; line-height: 1.1; }
.timer.small { font-size: 2rem; }
table { width: 100%; border-collapse: collapse; font-size: 0.92rem; }
th, td { text-align: left; padding: 6px 4px; border-bottom: 1px solid var(--line); vertical-align: top; }
.win { color: var(--ok); font-weight: 700; }
.stepper { display: flex; align-items: center; gap: 8px; padding: 6px 0; border-bottom: 1px solid var(--line); }
.stepper .name { flex: 1; }
.stepper .n { width: 2em; text-align: center; font-weight: 700; font-size: 1.1rem; }
.stepper button { min-height: 40px; min-width: 44px; padding: 4px; }
select { font: inherit; font-size: 1rem; padding: 8px; border-radius: 10px; border: 1px solid var(--line); background: var(--card); color: var(--fg); }
