/* Volontärsdag · Team 2 Säkerhetsquiz — mobil- + projektorvänlig */
:root {
  --navy: #0f2340;
  --navy2: #16304f;
  --teal: #0ea5a4;
  --teal2: #14b8b6;
  --gold: #f4b400;
  --red: #e53935;
  --red2: #f44336;
  --green: #2e9e5b;
  --ink: #1c2732;
  --muted: #5c6b7a;
  --bg: #eef2f7;
  --card: #ffffff;
  --line: #dde5ee;
  --opt-colors: #e53935 #2563eb #eab308 #22a55e;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background: linear-gradient(180deg, var(--navy) 0%, var(--navy2) 240px, var(--bg) 240px);
  color: var(--ink);
  min-height: 100vh;
  font-size: 16px;
}
#app { max-width: 720px; margin: 0 auto; padding: 14px 14px 40px; min-height: 100vh; }

/* ---------- toppbar ---------- */
.topbar { display: flex; align-items: center; gap: 8px; color: #fff; padding: 4px 0 12px; flex-wrap: wrap; }
.pill { border-radius: 999px; padding: 3px 11px; font-size: 13px; background: rgba(255,255,255,.14); }
.pill.name { background: rgba(244,180,0,.22); color: #ffe9a8; }
.pill.live { background: rgba(46,158,91,.25); color: #b7f0cd; }
.pill.ack { background: rgba(37,99,235,.18); color: #cfe2ff; }
.pill.open { background: rgba(229,57,53,.25); color: #ffc9c7; animation: pulse 1.2s infinite; }
.mode-pill { margin-left: auto; font-size: 13px; color: #ffe9a8; }

/* ---------- knappar ---------- */
.btn { border: 0; border-radius: 12px; padding: 12px 18px; font-size: 16px; font-weight: 600;
  cursor: pointer; text-decoration: none; text-align: center; transition: transform .05s, opacity .15s; }
.btn:active { transform: scale(.98); }
.btn.primary, .btn.btn-primary { background: var(--teal2); color: #fff; }
.btn.primary.big, .btn.btn-primary.big { width: 100%; padding: 16px; font-size: 18px; }
.btn.warn { background: var(--red); color: #fff; }
.btn.ghost { background: transparent; color: inherit; border: 1.5px solid var(--line); }
.btn.sm { padding: 6px 12px; font-size: 14px; }
.btn[disabled] { opacity: .55; cursor: default; }

/* ---------- join ---------- */
.join-card { background: var(--card); border-radius: 18px; margin-top: 40px; padding: 26px 22px;
  box-shadow: 0 12px 34px rgba(15,35,64,.18); display: flex; flex-direction: column; gap: 12px; }
.join-logo { font-size: 46px; text-align: center; }
.join-card h1 { margin: 0; text-align: center; font-size: 24px; color: var(--navy); }
.join-sub { margin: 0; text-align: center; color: var(--muted); }
.join-card input { padding: 14px; font-size: 17px; border: 1.5px solid var(--line); border-radius: 12px; }
.join-actions { display: flex; gap: 10px; margin-top: 6px; }
.join-actions .btn { flex: 1; font-size: 14px; }
.form-err { min-height: 0; color: var(--red); font-size: 14px; font-weight: 600; text-align: center;
  opacity: 0; max-height: 0; overflow: hidden; transition: opacity .2s, max-height .2s; }
.form-err.show { opacity: 1; max-height: 40px; }

/* ---------- löbsteg / stadium ---------- */
.stage-wrap { margin-top: 4px; }
.lobby-msg { text-align: center; color: #fff; padding: 60px 10px; }
.lobby-ind { font-size: 60px; }
.lobby-msg h2 { color: #fff; margin: 14px 0 6px; }
.lobby-msg p { color: #cfd9e6; }

/* ---------- stegkort ---------- */
.step-card { background: var(--card); border-radius: 18px; padding: 22px 20px; box-shadow: 0 8px 26px rgba(15,35,64,.14); }
.step-card h2 { margin: 0 0 8px; font-size: 20px; color: var(--navy); }
.step-card .step-q { margin: 0 0 14px; font-size: 18px; line-height: 1.45; font-weight: 600; color: var(--ink); }
.step-body { margin: 0 0 6px; line-height: 1.5; color: var(--muted); font-size: 16px; }
.step-img { width: 100%; border-radius: 12px; margin-bottom: 12px; max-height: 240px; object-fit: cover; }
.accepted { margin-top: 12px; padding: 10px; background: rgba(46,158,91,.12); border-radius: 10px;
  color: var(--green); font-weight: 600; text-align: center; }

/* ---------- timer ---------- */
.timer { text-align: right; margin: -6px 0 10px; }
.timer-num { font-variant-numeric: tabular-nums; font-weight: 800; font-size: 26px; color: var(--navy); opacity: .85; }
.timer-num.danger { color: var(--red); animation: pulse 1s infinite; }

/* ---------- svarsalternativ ---------- */
.opts { display: flex; flex-direction: column; gap: 10px; }
.opt { display: flex; align-items: center; gap: 12px; width: 100%; padding: 14px 12px; border-radius: 12px;
  border: 2px solid var(--line); background: #fff; font-size: 16px; text-align: left; cursor: pointer; line-height: 1.3; }
.opt-key { display: inline-flex; width: 34px; height: 34px; flex: 0 0 34px; border-radius: 9px; align-items: center;
  justify-content: center; font-weight: 800; color: #fff; }
.opts .opt:nth-child(1) .opt-key { background: #e53935; }
.opts .opt:nth-child(2) .opt-key { background: #2563eb; }
.opts .opt:nth-child(3) .opt-key { background: #eab308; }
.opts .opt:nth-child(4) .opt-key { background: #22a55e; }
.opt.chosen { border-color: var(--teal); background: rgba(14,165,164,.08); }
.opt.show-answer { cursor: default; }
.opt.show-answer.correct { border-color: var(--green); background: rgba(46,158,91,.1); }

/* ---------- självstyrt ---------- */
.pace-progress { color: #cfd9e6; font-size: 13px; margin-bottom: 10px; letter-spacing: .4px; }
.step-card.pace .opts .opt { margin-bottom: 0; }
.your-answer { background: var(--bg); border-radius: 12px; padding: 14px; display: flex; flex-direction: column; gap: 8px; }
.your-chose { font-weight: 600; }
.correct-ans { font-weight: 700; }
.correct-ans:has(.correct-ans) {}
.explain { color: var(--muted); font-size: 14px; line-height: 1.45; margin: 4px 0 0; }
.done-banner { margin-top: 16px; text-align: center; font-size: 20px; font-weight: 700; color: var(--green); }

/* ---------- ledare ---------- */
.leader-tabs { display: flex; gap: 8px; margin-bottom: 14px; flex-wrap: wrap; }
.ltab { background: rgba(255,255,255,.1); color: #cfe2ff; border: 0; border-radius: 999px; padding: 8px 16px;
  font-size: 15px; font-weight: 600; cursor: pointer; }
.ltab.on { background: var(--teal2); color: #fff; }
.leader-stage, .overview { background: var(--card); border-radius: 18px; padding: 18px 16px; box-shadow: 0 8px 26px rgba(15,35,64,.14); }
.step-picker { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.spick { width: 40px; height: 40px; border-radius: 10px; border: 2px solid var(--line); background: #fff;
  font-weight: 700; font-size: 15px; cursor: pointer; color: var(--navy); }
.spick.on { background: var(--teal2); border-color: var(--teal2); color: #fff; }
.spick.info { border-style: dashed; color: var(--muted); }
.spick.wc { border-color: var(--gold); color: #7a5a00; }
.mini-label { font-size: 13px; color: var(--muted); margin-bottom: 10px; }
.stage-preview h2 { margin: 0 0 6px; }
.leader-controls { margin-top: 16px; border-top: 1px solid var(--line); padding-top: 14px; display: flex; flex-direction: column; gap: 10px; }
.live-ack { display: flex; gap: 8px; align-items: center; }
.ctrl-row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.hint { font-size: 13px; color: var(--muted); }
.wc-preview { border: 2px dashed var(--line); border-radius: 12px; padding: 24px; text-align: center; color: var(--muted); }

/* ---------- översikt ---------- */
.overview h2 { margin: 0 0 10px; font-size: 20px; color: var(--navy); }
.statrow { display: flex; gap: 10px; margin-bottom: 16px; }
.stat { flex: 1; background: var(--bg); border-radius: 12px; padding: 12px; display: flex; flex-direction: column; }
.stat b { font-size: 24px; color: var(--navy); }
.stat span { font-size: 12px; color: var(--muted); }
.step-cards { display: flex; flex-direction: column; gap: 14px; }
.ovcard { border: 1px solid var(--line); border-radius: 14px; padding: 12px; }
.ovcard-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; gap: 8px; }
.ovcard-title { font-weight: 700; font-size: 15px; color: var(--navy); }
.ovinfo { color: var(--muted); font-size: 14px; }
.bars { display: flex; flex-direction: column; gap: 7px; }
.bar { display: flex; align-items: center; gap: 8px; }
.bar-key { width: 22px; font-weight: 800; color: var(--muted); font-size: 14px; }
.bar-track { position: relative; flex: 1; height: 26px; background: var(--bg); border-radius: 7px; overflow: hidden; }
.bar-fill { position: absolute; left: 0; top: 0; bottom: 0; background: var(--teal); border-radius: 7px; transition: width .4s ease; min-width: 2px; }
.bar.correct .bar-fill { background: var(--green); }
.bar-label { position: absolute; left: 8px; top: 5px; font-size: 13px; color: #fff; text-shadow: 0 1px 2px rgba(0,0,0,.4); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 92%; }
.bar-num { min-width: 62px; font-size: 13px; font-weight: 700; color: var(--muted); text-align: right; }

/* ---------- ordmoln ---------- */
.wordcloud { display: flex; flex-wrap: wrap; gap: 8px 16px; align-items: baseline; padding: 6px 2px; }
.cloud-word { color: var(--navy); font-weight: 700; line-height: 1.2; }

/* ---------- toast ---------- */
#toast { position: fixed; left: 50%; bottom: 26px; transform: translateX(-50%) translateY(20px);
  background: var(--navy); color: #fff; padding: 12px 20px; border-radius: 999px; font-size: 15px;
  opacity: 0; pointer-events: none; transition: opacity .25s, transform .25s; z-index: 50; box-shadow: 0 8px 24px rgba(0,0,0,.3); }
#toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ---------- landing (välj quiz) ---------- */
.landing-list { display: flex; flex-direction: column; gap: 8px; margin: 6px 0; }
.landing-card { display: flex; justify-content: space-between; align-items: center; padding: 14px 16px;
  border: 2px solid var(--line); border-radius: 14px; text-decoration: none; color: var(--ink); background: #fff; }
.landing-card:active, .landing-card:hover { border-color: var(--teal2); }
.landing-code { font-weight: 800; font-size: 17px; color: var(--navy); }
.landing-arrow { font-size: 18px; color: var(--teal2); font-weight: 700; }

/* ---------- admin ---------- */
.admin h2 { margin: 0; color: var(--navy); }
.admin-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; gap: 10px; }
.quiz-list { display: flex; flex-direction: column; gap: 8px; }
.quiz-row { display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap;
  background: var(--card); border-radius: 14px; padding: 12px 14px; box-shadow: 0 4px 14px rgba(15,35,64,.08); }
.quiz-row-info { display: flex; flex-direction: column; gap: 2px; }
.quiz-row-code { font-weight: 800; font-size: 16px; color: var(--navy); }
.quiz-row-title { font-size: 14px; color: var(--muted); }
.quiz-row-meta { font-size: 12px; color: var(--teal2); font-family: monospace; }
.quiz-row-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.edit-row { display: flex; align-items: center; gap: 10px; }
.edit-label { font-weight: 600; font-size: 14px; color: var(--navy); }
.edit-row select { padding: 10px 12px; border: 1.5px solid var(--line); border-radius: 10px; font-size: 14px; flex: 1; background: #fff; }
.mode-pill.self { background: rgba(14,165,164,.18); color: var(--teal2); }

/* ---------- modal ---------- */
.modal { position: fixed; inset: 0; background: rgba(12,25,45,.55); display: flex; align-items: center;
  justify-content: center; padding: 16px; z-index: 60; }
.modal-card { background: #fff; border-radius: 16px; padding: 18px; width: 100%; max-width: 640px;
  box-shadow: 0 18px 50px rgba(0,0,0,.35); display: flex; flex-direction: column; gap: 10px; }
.modal-card h3 { margin: 0; color: var(--navy); }

/* ---------- QR ---------- */
.qr-card { align-items: center; text-align: center; }
.qr-img { width: 260px; height: 260px; max-width: 100%; border: 1px solid var(--line); border-radius: 12px; }
.qr-url { font-family: monospace; font-size: 13px; word-break: break-all; color: var(--teal2);
  background: var(--bg); padding: 8px 10px; border-radius: 8px; cursor: pointer; }
/* Skriv ut bara QR:n (inte resten av admin-sidan) */
@media print {
  body > #app { display: none !important; }
  body > .modal { position: fixed; inset: 0; background: #fff; display: flex; align-items: center; justify-content: center; }
  .modal-card { box-shadow: none; border: 0; }
  .modal .join-actions, .modal .btn { display: none; }
}

@keyframes pulse { 50% { opacity: .55; } }
@media (min-width: 900px) { #app { max-width: 900px; } }
