/* ============================================================
   Klokketrening – BliGod-palett
   Varm hvit #FAF7F2 · Amber #D4820A · Kull #111
   ============================================================ */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
  background: #FAF7F2;
  min-height: 100dvh;
  display: flex;
  justify-content: center;
  padding: calc(48px + 1rem) 1rem 2rem;
}

/* ── Topplinje ── */
.top-nav {
  position: fixed;
  inset: 0 0 auto 0;
  height: 48px;
  background: #111111;
  border-bottom: 1px solid rgba(255,255,255,0.08);
  display: flex;
  align-items: center;
  padding: 0 1.25rem;
  z-index: 100;
}
.nav-back {
  font-size: 0.82rem; font-weight: 600;
  color: #D4820A; text-decoration: none;
  letter-spacing: 0.03em;
  transition: color .15s;
}
.nav-back:hover { color: #F5A623; }
.nav-title {
  font-size: 0.82rem; font-weight: 700;
  color: rgba(250,247,242,0.4);
  margin-left: auto;
}

/* ── Screens ── */
.screen { display: none; width: 100%; max-width: 560px; }
.screen.active { display: block; }

h1 { text-align: center; font-size: 2rem; color: #111111; margin-bottom: 1.25rem; }
h2 { font-size: 1rem; font-weight: 700; color: #D4820A; margin-bottom: 0.75rem; }

/* ── Card ── */
.card {
  background: white;
  border-radius: 14px;
  padding: 1.25rem;
  margin-bottom: 0.875rem;
  box-shadow: 0 2px 10px rgba(212,130,10,.08);
  border: 1px solid #EDE3D4;
}

/* ── Mode cards ── */
.mode-cards { display: flex; flex-direction: column; gap: 0.625rem; }

.mode-card {
  display: flex; flex-direction: column; align-items: flex-start;
  gap: 0.15rem;
  padding: 0.875rem 1rem;
  border: 2px solid #EDE3D4; border-radius: 10px;
  background: white; cursor: pointer; text-align: left;
  font-family: inherit; font-size: 1rem;
  transition: border-color .15s, background .15s;
}
.mode-card .mode-icon { font-size: 1.25rem; margin-bottom: 0.1rem; }
.mode-card strong { color: #111111; }
.mode-card small { color: #888888; font-size: 0.85rem; }
.mode-card.active { border-color: #D4820A; background: #FDF4E8; }
.mode-card:hover:not(.active) { border-color: #E8AD5C; }

/* ── Settings rows ── */
.setting-row {
  display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap;
  gap: 0.5rem;
  padding: 0.6rem 0;
  border-bottom: 1px solid #F0EAE0;
}
.setting-row:last-child { border-bottom: none; }
.setting-row > label:first-child { font-weight: 600; color: #333333; }

.radio-group { display: flex; gap: 0.875rem; flex-wrap: wrap; }
.radio-group label {
  display: flex; align-items: center; gap: 0.3rem;
  font-size: 0.9rem; cursor: pointer; color: #333333;
}

input[type="color"] {
  width: 40px; height: 28px; border: none; border-radius: 6px;
  cursor: pointer; background: none; padding: 0;
}

/* ── Toggle ── */
.toggle { position: relative; display: inline-block; width: 46px; height: 26px; }
.toggle input { opacity: 0; width: 0; height: 0; }
.slider {
  position: absolute; inset: 0; background: #d1d5db;
  border-radius: 26px; cursor: pointer; transition: background .2s;
}
.slider::before {
  content: ''; position: absolute;
  width: 20px; height: 20px; left: 3px; top: 3px;
  background: white; border-radius: 50%; transition: transform .2s;
}
.toggle input:checked + .slider { background: #D4820A; }
.toggle input:checked + .slider::before { transform: translateX(20px); }

/* ── Buttons ── */
.btn-primary {
  display: block; width: 100%; padding: 0.9rem;
  background: #D4820A; color: white; border: none; border-radius: 10px;
  font-size: 1.05rem; font-weight: 700; cursor: pointer; margin-top: 0.875rem;
  font-family: inherit; transition: background .15s;
}
.btn-primary:hover { background: #B86D08; }
.btn-primary.hidden { display: none; }

.btn-secondary {
  display: block; width: 100%; padding: 0.8rem;
  background: white; color: #D4820A;
  border: 2px solid #D4820A; border-radius: 10px;
  font-size: 1rem; font-weight: 700; cursor: pointer; margin-top: 0.625rem;
  font-family: inherit; transition: background .15s;
}
.btn-secondary:hover { background: #FDF4E8; }

.btn-icon {
  background: white; border: 2px solid #EDE3D4; border-radius: 8px;
  width: 38px; height: 38px; font-size: 1.1rem; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
}

/* ── Game header ── */
.game-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 0.625rem 0 1rem;
}
.score-info { font-weight: 700; color: #333333; }
#streak-display { color: #D4820A; margin-left: 0.4rem; }
.header-right { display: flex; align-items: center; gap: 0.5rem; }
#task-counter { color: #AAAAAA; font-size: 0.9rem; }

/* ── Clock ── */
.clock-wrap {
  display: flex; justify-content: center;
  margin: 0.5rem 0 1rem;
}
#clock-svg { filter: drop-shadow(0 4px 16px rgba(0,0,0,.10)); }
#clock-svg.interactive { cursor: crosshair; touch-action: none; }

/* ── Choices ── */
.choices {
  display: grid; grid-template-columns: 1fr 1fr; gap: 0.625rem;
}

.choice-row { display: flex; align-items: stretch; gap: 0.375rem; }
.choice-row .choice-btn { flex: 1; }

.speak-btn {
  background: #FDE9C0; border: 2px solid #F5C57A; border-radius: 8px;
  font-size: 1rem; padding: 0 0.5rem; cursor: pointer; flex-shrink: 0;
  transition: background .12s, border-color .12s;
  line-height: 1;
}
.speak-btn:hover:not(:disabled) { background: #F5C57A; border-color: #E8AD5C; }
.speak-btn:disabled { opacity: 0.4; cursor: default; }

.choice-btn {
  padding: 0.8rem 0.5rem;
  background: white; border: 2px solid #EDE3D4; border-radius: 10px;
  font-size: 0.95rem; font-weight: 600; font-family: inherit;
  cursor: pointer; transition: border-color .12s, background .12s;
  color: #111111;
}
.choice-btn:hover:not(:disabled) { border-color: #D4820A; background: #FDF4E8; }
.choice-btn.correct { border-color: #16a34a; background: #f0fdf4; color: #15803d; }
.choice-btn.wrong   { border-color: #dc2626; background: #fef2f2; color: #b91c1c; }
.choice-btn:disabled { cursor: default; }

/* ── Expression task ── */
.expr-card {
  text-align: center;
  background: white; border-radius: 14px; padding: 1.25rem 1rem;
  margin-bottom: 0.75rem;
  box-shadow: 0 2px 10px rgba(212,130,10,.08);
  border: 1px solid #EDE3D4;
}
.expr-card.speakable {
  cursor: pointer;
  border: 2px solid #EDE3D4;
  transition: background .15s, border-color .15s;
  user-select: none;
}
.expr-card.speakable:hover { background: #FDF4E8; border-color: #F5C57A; }
.expr-card .expr-text {
  font-size: 1.9rem; font-weight: 800; color: #111111;
  line-height: 1.2;
}
.expr-card small { color: #888888; font-size: 0.85rem; display: block; margin-top: 0.4rem; }

.current-hint {
  text-align: center; font-size: 0.9rem; color: #888888;
  margin-bottom: 0.5rem; min-height: 1.4em;
}
.current-hint strong { color: #D4820A; }

.btn-confirm {
  display: block; width: 100%; padding: 0.8rem;
  background: #16a34a; color: white; border: none; border-radius: 10px;
  font-size: 1rem; font-weight: 700; cursor: pointer; margin-top: 0.5rem;
  font-family: inherit; transition: background .15s;
}
.btn-confirm:hover:not(:disabled) { background: #15803d; }
.btn-confirm:disabled { background: #9ca3af; cursor: default; }

/* ── Feedback ── */
.feedback {
  padding: 0.875rem 1.1rem; border-radius: 10px; margin-top: 0.75rem;
  font-size: 0.95rem; font-weight: 600;
}
.feedback.correct { background: #f0fdf4; color: #15803d; border: 2px solid #86efac; }
.feedback.wrong   { background: #fef2f2; color: #b91c1c; border: 2px solid #fca5a5; }
.feedback.hidden  { display: none; }

/* ── Result ── */
#result-screen { text-align: center; padding-top: 2rem; }
#result-screen h2 { font-size: 2.25rem; color: #111111; margin-bottom: 1.5rem; }

.result-stats {
  display: flex; justify-content: center; gap: 2rem; margin-bottom: 1.25rem;
}
.stat { display: flex; flex-direction: column; align-items: center; }
.stat span { font-size: 2.75rem; font-weight: 800; color: #D4820A; }
.stat label { color: #888888; font-size: 0.85rem; margin-top: 0.1rem; }

#result-message { font-size: 1.1rem; color: #333333; margin-bottom: 1.5rem; }

/* ── Digital klokkeslett ── */
.digital-display {
  font-family: 'Courier New', 'Lucida Console', monospace;
  font-size: 3.5rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  color: #111111;
  background: #F0E6D3;
  border-radius: 10px;
  padding: 0.3rem 1rem;
  display: inline-block;
  margin-bottom: 0.4rem;
}

.choice-btn.digital {
  font-family: 'Courier New', 'Lucida Console', monospace;
  font-size: 1.2rem;
  letter-spacing: 0.05em;
}

/* ── Sammenleggbar Klokkevisning ── */
.card.collapsible { padding: 0; }

.card-toggle {
  width: 100%; display: flex; align-items: center; justify-content: space-between;
  padding: 1.1rem 1.25rem;
  background: none; border: none; cursor: pointer; font-family: inherit;
  border-radius: 14px;
}
.card-toggle h2 { margin: 0; font-size: 1rem; font-weight: 700; color: #D4820A; }
.toggle-arrow {
  font-size: 0.75rem; color: #AAAAAA;
  transition: transform .25s;
  display: inline-block;
}
.card.collapsible.collapsed .toggle-arrow { transform: rotate(180deg); }

.card-body {
  padding: 0 1.25rem 1.1rem;
  overflow: hidden;
  transition: max-height .3s ease, opacity .25s;
  max-height: 600px;
  opacity: 1;
}
.card.collapsible.collapsed .card-body {
  max-height: 0;
  opacity: 0;
  padding-bottom: 0;
}

/* ── Stoppeklokke i spillhode ── */
.task-timer {
  font-family: 'Courier New', monospace;
  font-size: 0.9rem; font-weight: 700;
  color: #D4820A;
  min-width: 3.5rem; text-align: right;
}

/* ── Resultat-progresjon ── */
#result-progress {
  font-size: 0.95rem; color: #333333;
  margin-bottom: 1.25rem;
  min-height: 1.4em;
}
.result-stats { flex-wrap: wrap; gap: 1.25rem 2rem; }
.stat span { font-size: 2.2rem; }

/* ── Øktlogg ── */
#log-section { margin-top: 1.5rem; padding-bottom: 1rem; }

.log-heading {
  font-size: 1rem; font-weight: 700; color: #D4820A;
  margin-bottom: 0.75rem;
}

.log-empty {
  text-align: center; color: #AAAAAA;
  font-size: 0.9rem; padding: 1.5rem 0;
}

.log-entry {
  display: flex; align-items: center; gap: 0.75rem;
  background: white; border-radius: 12px;
  padding: 0.875rem 1rem;
  margin-bottom: 0.625rem;
  box-shadow: 0 2px 8px rgba(212,130,10,.07);
  border: 2px solid transparent;
  transition: border-color .12s;
}
.log-entry:hover { border-color: #EDE3D4; }

.log-badge {
  width: 44px; min-width: 44px; height: 44px;
  border-radius: 10px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.4rem;
}

.log-info { flex: 1; min-width: 0; }

.log-meta {
  font-size: 0.78rem; color: #AAAAAA;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  margin-bottom: 0.2rem;
}
.log-settings-label { color: #D4820A; font-weight: 600; }

.log-score {
  font-size: 1rem; font-weight: 700; color: #111111;
  margin-bottom: 0.2rem;
}

.log-progress { display: flex; gap: 0.75rem; flex-wrap: wrap; }

.prog {
  font-size: 0.78rem; font-weight: 600; padding: 0.1rem 0.4rem;
  border-radius: 4px;
}
.prog.up   { background: #f0fdf4; color: #15803d; }
.prog.down { background: #fef2f2; color: #b91c1c; }
.prog.same { background: #f3f4f6; color: #888888; }

.prog-best { font-size: 0.78rem; color: #AAAAAA; align-self: center; }
.prog-best.is-best { color: #D4820A; font-weight: 700; }

.log-more-btn {
  display: block; width: 100%;
  padding: 0.6rem; margin-top: 0.25rem;
  background: none; border: 2px dashed #F0D5AA; border-radius: 10px;
  color: #D4820A; font-size: 0.88rem; font-weight: 600;
  cursor: pointer; font-family: inherit;
  transition: background .12s, border-color .12s;
}
.log-more-btn:hover { background: #FDF4E8; border-color: #E8AD5C; }

.log-repeat-btn {
  background: #FDF4E8; border: 2px solid #F0D5AA; border-radius: 8px;
  color: #D4820A; font-size: 0.82rem; font-weight: 700;
  padding: 0.4rem 0.7rem; cursor: pointer; white-space: nowrap;
  font-family: inherit; flex-shrink: 0;
  transition: background .12s;
}
.log-repeat-btn:hover { background: #F0D5AA; }

/* ── Visuell klokkeansikt-velger ── */
.setting-row.face-picker-row {
  flex-direction: column; align-items: flex-start; gap: 0.4rem;
}
.face-picker { display: flex; gap: 0.625rem; flex-wrap: wrap; }

.face-option {
  display: flex; flex-direction: column; align-items: center;
  gap: 0.3rem; cursor: pointer; user-select: none;
}
.face-option svg {
  border: 2.5px solid #EDE3D4; border-radius: 10px;
  display: block;
  transition: border-color .14s, background .14s;
}
.face-option:hover svg { border-color: #E8AD5C; }
.face-option.selected svg { border-color: #D4820A; background: #FDF4E8; }

.face-label { font-size: 0.72rem; color: #AAAAAA; font-weight: 500; }
.face-option.selected .face-label { color: #D4820A; font-weight: 700; }
