:root {
  --bg: #0f1419;
  --bg-card: #1a222c;
  --bg-soft: #243040;
  --text: #e7eef7;
  --muted: #9aabbd;
  --accent: #3d9cf0;
  --accent-2: #2f7fc4;
  --ok: #2f9e6b;
  --err: #d45454;
  --border: #2d3a4a;
  --radius: 12px;
  --shadow: 0 8px 24px rgba(0, 0, 0, 0.25);
  font-size: 16px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, Ubuntu, sans-serif;
  background: radial-gradient(1200px 600px at 20% -10%, #1b2a3d 0%, var(--bg) 55%);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.5;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* Hide SVG icon sprite completely (would otherwise create a huge blank header) */
.icon-sprite {
  position: absolute !important;
  width: 0 !important;
  height: 0 !important;
  padding: 0 !important;
  margin: 0 !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  border: 0 !important;
  white-space: nowrap !important;
}

.wrap {
  width: min(860px, calc(100% - 2rem));
  margin: 0 auto;
}

/* Player play area: full-width, centered, prominent */
body.player .wrap {
  width: min(920px, calc(100% - 1.25rem));
}
body.player main.wrap {
  min-height: calc(100vh - 6.5rem);
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: stretch;
  padding: 1rem 0 1.5rem;
}
.play-stage {
  width: 100%;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
}
.play-meta {
  color: var(--muted);
  font-size: 0.9rem;
  margin: 0 0 0.5rem;
  text-align: center;
}
.play-status {
  color: var(--ok);
  font-weight: 600;
  margin: 0.75rem 0 1rem;
  font-size: 1.05rem;
  text-align: center;
}
.play-flash { text-align: center; width: 100%; max-width: 36rem; }
.play-form {
  margin-top: 0.5rem;
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
}
.play-form .play-submit {
  margin-top: 0.85rem;
  min-width: 10rem;
  padding: 0.75rem 1.5rem;
  font-size: 1.05rem;
  display: inline-flex;
  justify-content: center;
  align-items: center;
}
.play-form .option-grid {
  max-width: 34rem;
  width: 100%;
  margin-left: auto;
  margin-right: auto;
}
.play-form .option { text-align: center; }
.play-form .option span { display: block; width: 100%; }
.play-open {
  width: 100%;
  max-width: 34rem;
  display: grid;
  place-items: center;
}
.play-open textarea {
  width: 100%;
  max-width: 34rem;
  margin: 0 auto;
  text-align: center;
}
.play-list {
  max-width: 36rem;
  width: 100%;
  margin-left: auto;
  margin-right: auto;
  text-align: left;
}
.question-text {
  font-size: clamp(1.35rem, 4.5vw, 1.85rem);
  font-weight: 700;
  margin: 0.5rem auto 1.25rem;
  max-width: 36rem;
  width: 100%;
  line-height: 1.35;
  text-align: center;
}

.site-header {
  border-bottom: 1px solid var(--border);
  background: rgba(15, 20, 25, 0.85);
  backdrop-filter: blur(8px);
  position: sticky;
  top: 0;
  z-index: 10;
}

.header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.55rem 0;
  flex-wrap: nowrap;
}

.footer-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  padding: 0.45rem 0 0.55rem;
  flex-wrap: nowrap;
  font-size: 0.78rem;
  white-space: nowrap;
}

.brand {
  font-weight: 700;
  letter-spacing: 0.04em;
  color: var(--text);
  font-size: 1.05rem;
  flex-shrink: 0;
}

.nav, .footer-nav {
  display: flex;
  gap: 0.55rem;
  flex-wrap: nowrap;
  align-items: center;
  min-width: 0;
}

.nav a, .footer-nav a { color: var(--muted); font-size: 0.85rem; }
.nav a:hover, .footer-nav a:hover { color: var(--text); }

.nav-btn {
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--muted);
  font: inherit;
  padding: 0.3rem 0.5rem;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  max-width: 38vw;
}
.nav-btn:hover { border-color: var(--accent); color: var(--text); }
.nav-btn .nick-value,
.nav-btn #nickname-display {
  color: var(--text);
  font-weight: 600;
  max-width: 8rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 0.88rem;
}
.nav-btn.has-nick #nickname-display { color: var(--text); }
.nav-btn:not(.has-nick) #nickname-display { color: var(--muted); font-weight: 500; }

.answer-form .btn { margin-top: 0.25rem; }

.hidden { display: none !important; }

.pool-badge-ok { border-color: var(--ok); color: var(--ok); }
.pool-badge-watch { border-color: #c9a227; color: #e0c35a; }
.pool-badge-low { border-color: #e08a2e; color: #f0b56a; }
.pool-badge-empty { border-color: var(--err); color: var(--err); }

/* Aggregate answers: count first, names below */
.agg-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 0.65rem;
}
.agg-item {
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.65rem 0.8rem;
  text-align: left;
}
.agg-head {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  align-items: baseline;
}
.agg-label { font-weight: 600; }
.agg-count { color: var(--muted); white-space: nowrap; font-size: 0.95rem; }
.agg-names {
  margin-top: 0.3rem;
  color: var(--muted);
  font-size: 0.92rem;
}

.modal-nick { max-width: 360px; }
.modal-actions {
  display: flex;
  gap: 0.5rem;
  margin-top: 0.75rem;
  flex-wrap: wrap;
}

.steps { padding-left: 1.2rem; }
.steps li { margin-bottom: 0.35rem; }

main.wrap { padding: 1.25rem 0 1.5rem; }

.page-head h1, .hero h1 { margin: 0 0 0.25rem; font-size: 1.8rem; }
.lead { color: var(--muted); font-size: 1.05rem; }
.muted { color: var(--muted); }
.small { font-size: 0.9rem; }
.badge {
  display: inline-block;
  background: var(--bg-soft);
  border: 1px solid var(--border);
  color: var(--muted);
  border-radius: 999px;
  padding: 0.15rem 0.65rem;
  font-size: 0.85rem;
}

.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  margin: 1rem 0;
  box-shadow: var(--shadow);
}

.card h2 { margin-top: 0; font-size: 1.2rem; }
.card h3 { font-size: 1rem; }

.hero .card { margin-top: 1.5rem; }
.plain { padding-left: 1.1rem; }

.flash {
  border-radius: var(--radius);
  padding: 0.65rem 0.9rem;
  margin: 0.75rem 0;
  border: 1px solid var(--border);
  font-size: 0.95rem;
}
.flash.ok { background: rgba(47, 158, 107, 0.15); border-color: var(--ok); }
.flash.err { background: rgba(212, 84, 84, 0.15); border-color: var(--err); }

/* Question/list action cells: keep toggle + edit + delete on one row */
.row-actions.actions-inline {
  flex-wrap: nowrap;
  align-items: center;
}
.row-actions.actions-inline form { display: flex; margin: 0; }
.row-actions.actions-inline .btn,
.row-actions.actions-inline form .btn,
.row-actions.actions-inline a.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 2rem;
  min-height: 2rem;
  padding: 0 0.4rem;
  white-space: nowrap;
}
.row-actions.actions-inline .state-btn {
  min-width: 0;
  font-size: 0.85rem;
}
.row-actions.actions-inline .state-btn .icon { margin-right: 0.2rem; }

.inline-form {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

input[type="text"],
input[type="password"],
textarea,
select {
  width: 100%;
  background: var(--bg-soft);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.65rem 0.75rem;
  font: inherit;
}

.inline-form input[type="text"] { width: auto; min-width: 220px; flex: 1; }

textarea { resize: vertical; min-height: 4.5rem; }

.field { display: grid; gap: 0.35rem; margin-bottom: 0.75rem; }
.field > span { color: var(--muted); font-size: 0.9rem; }

.btn {
  display: inline-block;
  background: var(--bg-soft);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.55rem 0.95rem;
  font: inherit;
  cursor: pointer;
  text-decoration: none;
}
.btn:hover { border-color: var(--accent); text-decoration: none; }
.btn.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #061018;
  font-weight: 600;
}
.btn.primary:hover { background: var(--accent-2); }
.btn.danger {
  background: rgba(212, 84, 84, 0.2);
  border-color: var(--err);
  color: var(--text);
}
.btn.small { padding: 0.3rem 0.6rem; font-size: 0.9rem; }

.option-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 0.65rem;
  margin-bottom: 1rem;
}
.option-grid.binary { grid-template-columns: 1fr 1fr; }

.option {
  display: block;
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.85rem 0.95rem;
  cursor: pointer;
  font-size: 1.05rem;
}
.option:hover { border-color: var(--accent); }
.option input { position: absolute; opacity: 0; pointer-events: none; }
.option span { font-weight: 500; }
.option:has(input:checked) {
  border-color: var(--accent);
  background: rgba(61, 156, 240, 0.15);
}

.answer-list {
  list-style: none;
  padding: 0;
  margin: 0.5rem 0 0;
  display: grid;
  gap: 0.4rem;
}
.answer-list li {
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.55rem 0.75rem;
  text-align: left;
}

.day-head {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  flex-wrap: wrap;
}
.day-head h2 { margin: 0; }

.site-footer {
  border-top: 1px solid var(--border);
  color: var(--muted);
  font-size: 0.78rem;
  margin-top: 0;
}

/* Admin */
.icon-sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
.icon {
  width: 1em;
  height: 1em;
  display: inline-block;
  vertical-align: -0.12em;
  flex-shrink: 0;
}
h1 .icon, h2 .icon { width: 1.15em; height: 1.15em; vertical-align: -0.15em; margin-right: 0.2rem; color: var(--accent); }

.nav-icon {
  display: inline-flex !important;
  align-items: center;
  gap: 0.3rem;
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.3rem 0.55rem !important;
  color: var(--text) !important;
  font-size: 0.85rem;
  text-decoration: none !important;
}
.nav-icon:hover { border-color: var(--accent); }
.nav-icon .icon { color: var(--accent); }
.nav-inline-form { display: inline; margin: 0; }
button.nav-icon { font: inherit; cursor: pointer; }

.btn .icon { margin-right: 0.25rem; }
.btn.icon-only, .btn.small.icon-only { margin: 0; }
.row-actions {
  display: flex;
  gap: 0.4rem;
  flex-wrap: wrap;
  align-items: stretch;
}
.row-actions form { display: flex; margin: 0; }
.row-actions .btn,
.row-actions button.btn,
.row-actions form .btn,
.row-actions a.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 2.25rem;
  height: 2.25rem;
  padding-top: 0;
  padding-bottom: 0;
  white-space: nowrap;
}
.row-actions .btn.small,
.row-actions form .btn.small {
  min-height: 2rem;
  height: 2rem;
  font-size: 0.88rem;
}

.state-btn { min-width: 6.2rem; justify-content: center; }
.state-btn.is-on {
  border-color: var(--ok);
  color: var(--ok);
  background: rgba(47, 158, 107, 0.12);
}
.state-btn.is-off {
  border-color: var(--err);
  color: var(--err);
  background: rgba(212, 84, 84, 0.1);
}
.state-btn .icon { margin-right: 0.25rem; }

.btn.copied {
  border-color: var(--ok);
  color: var(--ok);
}

/* Floating status toast — fixed, does not shift layout */
.toast {
  position: fixed;
  right: 1rem;
  bottom: 1rem;
  z-index: 80;
  max-width: min(22rem, calc(100vw - 2rem));
  padding: 0.75rem 1rem;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text);
  box-shadow: var(--shadow);
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 0.2s ease, transform 0.2s ease;
  pointer-events: none;
  font-size: 0.95rem;
  line-height: 1.35;
}
.toast.show { opacity: 1; transform: translateY(0); }
.toast-ok { border-color: var(--ok); }
.toast-err { border-color: var(--err); }

.admin-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  align-items: start;
}
@media (max-width: 800px) {
  .admin-grid { grid-template-columns: 1fr; }
}

.today-card h2 {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
}

.list-box {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.75rem;
  margin: 0 0 0.75rem;
}
.list-box legend { color: var(--muted); font-size: 0.9rem; padding: 0 0.35rem; }

.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 0.85rem; }

.admin-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-bottom: 1rem;
}
.admin-bar h1 { margin: 0; font-size: 1.45rem; display: flex; align-items: center; gap: 0.45rem; flex-wrap: wrap; }

table.data {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.95rem;
}
table.data th, table.data td {
  text-align: left;
  padding: 0.5rem 0.45rem;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
table.data th { color: var(--muted); font-weight: 600; }

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 0.75rem;
  margin-bottom: 1rem;
}
.stat {
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.85rem;
}
.stat .num { font-size: 1.5rem; font-weight: 700; }
.stat .label { color: var(--muted); font-size: 0.9rem; }

.qr-box {
  display: grid;
  gap: 0.75rem;
  justify-items: start;
}
.qr-box img {
  background: #fff;
  border-radius: 8px;
  padding: 0.5rem;
  width: min(240px, 100%);
  height: auto;
}

.stack { display: grid; gap: 0.75rem; }

.check-list { display: grid; gap: 0.35rem; }
.check-list label {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.45rem 0.65rem;
  cursor: pointer;
}
.check-list .list-edit-link {
  display: inline-flex;
  align-items: center;
  color: var(--accent);
  text-decoration: none;
  flex-shrink: 0;
}
.check-list .list-edit-link:hover { text-decoration: underline; }
.check-list .list-edit-link .icon { width: 1rem; height: 1rem; margin: 0; }

/* Tutorial modal */
.modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  display: grid;
  place-items: center;
  padding: 1rem;
  z-index: 50;
}
.modal.hidden { display: none; }
.modal-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  width: min(520px, 100%);
  box-shadow: var(--shadow);
  max-height: min(90vh, 700px);
  overflow: auto;
}
.tutorial-steps { padding-left: 1.2rem; display: grid; gap: 0.55rem; }
.modal-card .btn { margin-top: 0.75rem; }

.legal h2 { margin-top: 1.25rem; }
.legal code {
  background: var(--bg-soft);
  padding: 0.1rem 0.35rem;
  border-radius: 4px;
  font-size: 0.9em;
}

.login-card { max-width: 420px; }

@media (max-width: 600px) {
  .option-grid.binary { grid-template-columns: 1fr; }
  .option-grid { grid-template-columns: 1fr; }
  .nav { gap: 0.35rem; }
  .nav-icon span { display: none; }
  .nav-icon { padding: 0.32rem 0.45rem !important; }
  .nav-btn { padding: 0.28rem 0.45rem; font-size: 0.85rem; }
  .nav-btn #nickname-display { max-width: 4.2rem; }
  .nav a { font-size: 0.82rem; }
  .footer-row { font-size: 0.72rem; gap: 0.55rem; }
  .footer-nav { gap: 0.5rem; }
  body.player main.wrap { min-height: calc(100vh - 5.5rem); }
  .play-form .play-submit { width: 100%; max-width: 20rem; }
  .admin-bar h1 { font-size: 1.2rem; }
  .row-actions .btn, .row-actions .btn span { font-size: 0.85rem; }
  .toast { right: 0.75rem; bottom: 0.75rem; }
}


