/* Weerwolfr: het spelscherm (nacht en dag), de vensters en de plaatsing van de geluidsstrook.
 *
 * Dit is nog de oude, sobere indeling van het spelscherm. Kleuren, letter en de gedeelde
 * onderdelen (knoppen, keuzes, vensters, meldingen) komen uit toneel.css, dat hierna laadt
 * en de variabelen hieronder (--bg, --accent, ...) op de Toneel-tokens zet.
 * De schermen rond het spel (start, voorbereiding, slot) staan helemaal in toneel.css.
 */

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

:root {
  --bg: #0b0b14;
  --bg-elev: #15151f;
  --bg-elev-2: #1f1f2c;
  --text: #e8e8f0;
  --text-dim: #9999aa;
  --accent: #b97cff;
  --accent-glow: rgba(185, 124, 255, 0.4);
  --wolf: #d75c5c;
  --village: #6cc36c;
  --loner: #d4a64a;
  --warn: #d75c5c;
  --border: #2a2a3a;
  --radius: 12px;
  --shadow: 0 4px 16px rgba(0,0,0,0.5);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-top: env(safe-area-inset-top, 0px);
}

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Helvetica Neue", sans-serif;
  font-size: 16px;
  line-height: 1.5;
  min-height: 100vh;
}

/* Alleen op html: overflow op body breekt position: sticky (stap-navigatie). */
html { overflow-x: hidden; }

body {
  padding-top: var(--safe-top);
  padding-bottom: var(--safe-bottom);
}

#app {
  max-width: 600px;
  margin: 0 auto;
  min-height: 100vh;
  position: relative;
}

.view {
  padding: 16px;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ---------- Top bar ---------- */

.topbar {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
  padding-top: 4px;
}

.topbar h2 {
  font-size: 18px;
  margin: 0;
  flex: 1;
}

.topbar-info {
  flex: 1;
  text-align: center;
}

.topbar-spacer {
  width: 40px;
}

.night-label {
  font-size: 18px;
  font-weight: 600;
}

.step-progress {
  font-size: 12px;
  color: var(--text-dim);
}

/* ---------- Buttons ---------- */

.btn {
  background: var(--bg-elev);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 20px;
  font-size: 16px;
  font-weight: 500;
  cursor: pointer;
  font-family: inherit;
  min-height: 44px;
  transition: transform 0.08s ease, background 0.15s ease;
  touch-action: manipulation;
}

.btn:active {
  transform: scale(0.97);
}

.btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.btn-primary {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
  box-shadow: 0 4px 16px var(--accent-glow);
}

.btn-ghost {
  background: transparent;
  border-color: var(--border);
}

.btn-warn {
  background: var(--bg-elev);
  color: var(--warn);
  border-color: var(--warn);
}

.btn-big {
  width: 100%;
  font-size: 18px;
  padding: 16px;
  font-weight: 600;
}

.btn-block {
  width: 100%;
  margin-bottom: 8px;
}

.btn-small {
  padding: 6px 12px;
  font-size: 13px;
  min-height: 32px;
}

.btn-icon {
  background: transparent;
  border: none;
  color: var(--text);
  font-size: 24px;
  width: 40px;
  height: 40px;
  border-radius: 8px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.btn-icon:active {
  background: var(--bg-elev);
}

.row {
  display: flex;
  gap: 8px;
}

.row .btn {
  flex: 1;
}

/* ---------- Cards ---------- */

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

/* ---------- Night view ---------- */

.progress-bar {
  height: 4px;
  background: var(--bg-elev);
  border-radius: 2px;
  margin-bottom: 12px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: var(--accent);
  width: 0%;
  transition: width 0.3s ease;
}

.kamp-totals {
  display: flex;
  gap: 8px;
  justify-content: center;
  margin-bottom: 20px;
}

.step-content {
  flex: 1;
  text-align: center;
  padding: 20px 0;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.step-icon {
  font-size: 72px;
  margin-bottom: 12px;
  filter: drop-shadow(0 0 20px var(--accent-glow));
}

.step-name {
  font-size: 28px;
  margin: 0 0 16px;
  font-weight: 700;
}

.step-instruction {
  font-size: 16px;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  margin: 0 0 16px;
  text-align: left;
  line-height: 1.5;
}

.narration-block {
  width: 100%;
  margin-bottom: 16px;
}

.narration-block summary {
  cursor: pointer;
  padding: 10px 14px;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  user-select: none;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-dim);
  list-style: none;
}

.narration-block summary::-webkit-details-marker { display: none; }

.narration-block[open] summary {
  border-radius: var(--radius) var(--radius) 0 0;
  border-bottom: none;
}

.narration {
  background: var(--bg-elev-2);
  border: 1px solid var(--border);
  border-top: none;
  border-radius: 0 0 var(--radius) var(--radius);
  margin: 0;
  padding: 14px 16px;
  font-style: italic;
  text-align: left;
  font-size: 15px;
  line-height: 1.6;
  color: #f5f5ff;
}

.narration-block .btn-small {
  margin-top: 8px;
}

.step-nav {
  display: flex;
  gap: 8px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}

.step-nav .btn {
  flex: 1;
}

/* ---------- Modal ---------- */

.modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 16px;
  animation: fade-in 0.15s ease;
}

@keyframes fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

.modal-content {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  max-width: 400px;
  width: 100%;
  max-height: 80vh;
  overflow-y: auto;
  box-shadow: var(--shadow);
}

.modal-content h3 {
  margin: 0 0 16px;
  font-size: 20px;
}

.death-list {
  list-style: none;
  padding: 0;
  margin: 0 0 16px;
}

.death-list li {
  padding: 14px 12px;
  border-radius: 8px;
  border: 1px solid var(--border);
  margin-bottom: 8px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 10px;
  transition: background 0.15s;
  min-height: 48px;
}

.death-list li:active {
  background: var(--bg-elev-2);
}

.death-icon {
  font-size: 18px;
}

.death-name {
  flex: 1;
}

.death-count {
  color: var(--text-dim);
  font-size: 14px;
}

/* ---------- Loading ---------- */

.loading {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg);
  color: var(--text-dim);
  font-size: 14px;
  z-index: 1000;
}

.loading.hidden { display: none; }

/* ---------- Utilities ---------- */

[hidden] { display: none !important; }

@media (min-width: 480px) {
  .view { padding: 24px; }
  .step-icon { font-size: 96px; }
  .step-name { font-size: 32px; }
}

/* =====================================================================
   Spelers, stap-paneel, keuzelijsten, meldingen (v2)
   Bewust sober: de vormgeving wordt later opnieuw gedaan.
   ===================================================================== */

.btn:focus-visible, .btn-icon:focus-visible, .chip:focus-visible,
.option:focus-visible, .player-row:focus-visible, .text-input:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.notice {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 16px;
  margin: 0 0 16px;
  font-size: 15px;
}

.notice-warn {
  border-color: var(--loner);
  color: var(--loner);
}

.text-input {
  width: 100%;
  min-height: 48px;
  padding: 10px 14px;
  font-size: 17px;
  font-family: inherit;
  color: var(--text);
  background: var(--bg-elev-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

/* ---------- Nacht ---------- */

.kamp-totals {
  background: transparent;
  border: none;
  font-family: inherit;
  cursor: pointer;
  width: 100%;
  flex-wrap: wrap;
  padding: 4px 0;
}

.badge-uncertain { color: var(--loner); border: 1px solid var(--loner); }

.step-panel {
  width: 100%;
  text-align: left;
  margin-bottom: 16px;
}

.panel-block {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  margin-bottom: 12px;
}

.panel-title {
  margin: 0 0 6px;
  font-size: 17px;
}

.panel-block .panel-title + .choice-row { margin-top: 8px; }
.panel-block .choice-row + .panel-title { margin-top: 16px; }

.panel-hint, .panel-note {
  margin: 0 0 10px;
  font-size: 14px;
  color: var(--text-dim);
}

.panel-note-warn { color: var(--loner); }

.chip-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: 8px;
  margin-bottom: 10px;
}

.chip {
  min-height: 48px;
  padding: 8px 12px;
  font-size: 16px;
  font-family: inherit;
  color: var(--text);
  background: var(--bg-elev-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  overflow-wrap: anywhere;
  touch-action: manipulation;
}

.chip-on {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
  font-weight: 600;
}

.chip-locked { opacity: 0.7; }

.choice-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 8px;
}

.choice-row .choice { flex: 1 1 140px; }

.choice-on {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.step-actions {
  width: 100%;
}

.step-nav {
  position: sticky;
  bottom: 0;
  background: var(--bg);
  padding-bottom: 12px;
  z-index: 5;
}

.step-nav .btn { min-height: 56px; font-size: 18px; }

/* ---------- Modals ---------- */

.modal-level-2 { z-index: 110; }
.modal-level-3 { z-index: 120; }
.modal-level-4 { z-index: 130; }

.modal-content { max-height: 88vh; }
.modal-wide { max-width: 640px; }

.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.modal-head h3 { margin: 0; }

.field-label {
  margin: 16px 0 8px;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.sheet-actions { margin-top: 20px; }

.picker-text { margin: 0 0 12px; color: var(--text-dim); }

.option-list, .players-list {
  list-style: none;
  padding: 0;
  margin: 0 0 12px;
}

.option, .player-row {
  width: 100%;
  min-height: 52px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  margin-bottom: 8px;
  font-size: 16px;
  font-family: inherit;
  text-align: left;
  color: var(--text);
  background: var(--bg-elev-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  cursor: pointer;
  touch-action: manipulation;
}

.option:active, .player-row:active { background: var(--border); }

.option-icon, .player-status { width: 28px; text-align: center; flex-shrink: 0; }
.option-label, .player-name { flex: 1; font-weight: 600; overflow-wrap: anywhere; }
.option-sub, .player-role { color: var(--text-dim); font-size: 14px; text-align: right; }
.option-dim { opacity: 0.75; }
.option-warn { border-color: var(--warn); color: var(--warn); }

.player-dead .player-name { text-decoration: line-through; }
.player-dead { opacity: 0.6; }

.panel-details { margin-bottom: 12px; }
.panel-details summary { cursor: pointer; padding: 10px 0; min-height: 44px; }

/* ---------- Melding ---------- */

.toast {
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  bottom: calc(88px + var(--safe-bottom));
  width: calc(100% - 32px);
  max-width: 560px;
  z-index: 200;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  background: var(--bg-elev-2);
  border: 1px solid var(--accent);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.toast-text { flex: 1; cursor: pointer; }
.toast-text p { margin: 0; }
.toast-main { font-weight: 600; }
.toast-note { font-size: 14px; color: var(--text-dim); margin-top: 4px !important; }

/* ---------- iPad en MacBook ---------- */

@media (min-width: 700px) {
  #app { max-width: 860px; }
  .step-instruction { font-size: 18px; }
  .narration { font-size: 19px; }
  .chip-grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
}

/* Compactere stapkop, zodat het stap-paneel zonder scrollen in beeld komt. */
.step-content { padding: 4px 0 16px; }
.step-icon, .view .step-icon { font-size: 56px; margin-bottom: 4px; }
.step-name, .view .step-name { font-size: 28px; margin-bottom: 12px; }
.kamp-totals { margin-bottom: 8px; }

/* ===== Nachtlog en dagfase (functioneel, wordt later opnieuw vormgegeven) ===== */
.check-row { display: flex; gap: 10px; align-items: flex-start; margin: 12px 0; min-height: 44px; cursor: pointer; }
.check-row input { width: 22px; height: 22px; flex-shrink: 0; margin-top: 2px; }

.note-list { margin: 8px 0; padding-left: 20px; text-align: left; }
.note-list li { margin: 4px 0; }

.proposal-list { list-style: none; margin: 8px 0; padding: 0; }
.proposal-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 8px 0; border-bottom: 1px solid var(--border); text-align: left; }
.proposal-name { font-weight: 600; flex: 1 1 140px; overflow-wrap: anywhere; }
.proposal-role, .proposal-cause { color: var(--text-dim); font-size: 14px; flex: 1 1 140px; }
.proposal-saved .proposal-name { font-weight: 400; }

.timer-display { font-size: 64px; font-weight: 700; font-variant-numeric: tabular-nums; text-align: center; margin: 8px 0 12px; }
.timer-display[data-state="ended"] { color: var(--warn); }
.timer-display[data-state="paused"] { opacity: 0.6; }

.chip-none { border-style: dashed; }

/* ===== Geluid: strook, zijpaneel, test (functioneel, wordt later opnieuw vormgegeven) ===== */
#app { display: flex; flex-direction: column; }
#app > .view { flex: 1 0 auto; min-height: 0; }

.sound-strip {
  z-index: 20;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
}
.sound-strip .btn { flex: none; padding: 8px 12px; font-size: 14px; }
.sound-strip .btn[aria-pressed="true"] { border-color: var(--accent); }
.sound-vol { display: flex; align-items: center; gap: 8px; flex: 1 1 140px; min-width: 120px; font-size: 14px; color: var(--text-dim); }
.sound-vol input { flex: 1; min-width: 0; height: 44px; margin: 0; }
.sound-now { flex: 1 1 120px; min-width: 0; font-size: 13px; color: var(--text-dim); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.sound-panel {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: 360px;
  max-width: 100%;
  z-index: 150;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: calc(12px + var(--safe-top)) 12px calc(12px + var(--safe-bottom));
  background: var(--bg);
  border-left: 1px solid var(--border);
}

/* iPad en MacBook: de strook blijft in beeld. Op een telefoon scrolt hij mee (te hoog om vast te zetten). */
@media (min-width: 700px) {
  .sound-strip { position: sticky; top: 0; }
}

/* iPad liggend en MacBook: het paneel staat naast het spel in plaats van eroverheen. */
@media (min-width: 1000px) {
  body.sound-open { padding-right: 360px; }
  body.sound-open .modal { right: 360px; }
  body.sound-open .toast { left: calc((100% - 360px) / 2); }
}
