:root {
  --bg: #f6f5f2;
  --panel: #ffffff;
  --ink: #1c1b19;
  --muted: #6b6862;
  --line: #e3e0d8;
  --accent: #a8402f;
  --accent-ink: #ffffff;
  --accent-soft: #f3e2dd;
  --ok: #3f6b4a;
  --ok-soft: #e3ecdf;
  --warn: #b3821b;
  --warn-soft: #f6ecd2;
  --radius: 14px;
  --maxw: 640px;
  font-size: 17px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  line-height: 1.45;
  -webkit-tap-highlight-color: transparent;
}

.wrap {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 20px 16px 100px;
}

.wide .wrap { max-width: 1100px; }

h1, h2, h3 { margin: 0 0 0.4em; line-height: 1.2; }
h1 { font-size: 1.5rem; }
h2 { font-size: 1.15rem; }
p { margin: 0 0 1em; }

.muted { color: var(--muted); }
.small { font-size: 0.85rem; }
.center { text-align: center; }

.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 14px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border: none;
  border-radius: 999px;
  padding: 12px 22px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  background: var(--accent);
  color: var(--accent-ink);
  width: 100%;
}

.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.btn.secondary { background: var(--panel); color: var(--ink); border: 1px solid var(--line); }
.btn.small { width: auto; padding: 8px 16px; font-size: 0.85rem; }

input[type=text], input[type=number], textarea, select {
  width: 100%;
  font-size: 1rem;
  padding: 11px 12px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--ink);
  font-family: inherit;
}

textarea { resize: vertical; min-height: 70px; }

label { display: block; font-weight: 600; font-size: 0.9rem; margin-bottom: 6px; }
.field { margin-bottom: 16px; }

.pill {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 600;
  background: var(--accent-soft);
  color: var(--accent);
}
.pill.ok { background: var(--ok-soft); color: var(--ok); }
.pill.warn { background: var(--warn-soft); color: var(--warn); }

.group-list { display: flex; flex-direction: column; gap: 10px; }
.group-row {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 16px; border: 1px solid var(--line); border-radius: 12px;
  background: var(--panel); cursor: pointer;
}
.group-row:active { background: var(--accent-soft); }
.group-row.over .cap { color: var(--warn); }
.group-row .cap { font-variant-numeric: tabular-nums; color: var(--muted); }
.group-row.started { opacity: 0.5; cursor: not-allowed; }
.group-row.started .cap { color: var(--muted); }

#tiles {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
}
@media (min-width: 700px) {
  #tiles { grid-template-columns: repeat(2, 1fr); }
}
@media (min-width: 1000px) {
  #tiles { grid-template-columns: repeat(3, 1fr); }
}

.strategy {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px 14px;
  cursor: pointer;
  transition: background 0.1s, border-color 0.1s;
}
.strategy .num {
  display: inline-block; width: 22px; height: 22px; line-height: 22px;
  text-align: center; border-radius: 50%; background: var(--line);
  font-size: 0.75rem; font-weight: 700; margin-right: 8px; flex: none;
}
.strategy .title { font-weight: 700; }
.strategy .text { color: var(--muted); font-size: 0.92rem; margin-top: 4px; }
.strategy.selected { border-color: var(--accent); background: var(--accent-soft); }
.strategy.selected .num { background: var(--accent); color: #fff; }
.strategy .head { display: flex; align-items: center; }

.top-row { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }

.waiting-banner {
  position: sticky; bottom: 0; left: 0; right: 0;
  background: var(--panel); border-top: 1px solid var(--line);
  padding: 14px 16px; margin: 0 -16px -100px;
  box-shadow: 0 -4px 16px rgba(0,0,0,0.06);
}

.reveal-grid { display: flex; flex-direction: column; gap: 12px; }
.reveal-player { border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; }
.reveal-player .name { font-weight: 700; margin-bottom: 6px; }
.chip-row { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  background: var(--accent-soft); color: var(--accent);
  border-radius: 999px; padding: 3px 10px; font-size: 0.8rem; font-weight: 600;
}
.reveal-player .reflection { margin-top: 8px; font-size: 0.88rem; color: var(--muted); font-style: italic; }

table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
th, td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line); }
th { color: var(--muted); font-weight: 600; font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.02em; }

.status-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 12px; }
.status-card { border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; background: var(--panel); }
.status-card.stuck { border-color: var(--warn); background: var(--warn-soft); }
.status-card .bar { height: 6px; border-radius: 999px; background: var(--line); overflow: hidden; margin-top: 8px; }
.status-card .bar > div { height: 100%; background: var(--ok); }

.qr-box { text-align: center; }
.qr-box img { border-radius: 12px; border: 1px solid var(--line); }
.room-code { font-size: 2rem; font-weight: 800; letter-spacing: 0.08em; }

.heatcell { text-align: center; font-variant-numeric: tabular-nums; }
