/* ═══════════════════════════════════════════════════════════════
   Auvae — minimalistisch, edel, ruhig.
   Mobile first · Systemschriften · keine externen Abhängigkeiten
   ═══════════════════════════════════════════════════════════════ */

:root {
  --serif: "Didot", "Bodoni MT", "Cochin", "Georgia", "Noto Serif", serif;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;

  --ink: #14110e;
  --ink-soft: #2a251f;
  --paper: #f4efe7;
  --paper-soft: #eae3d7;
  --gold: #c2a05e;
  --gold-dim: #9c8250;

  /* dunkles Grundthema */
  --bg: var(--ink);
  --bg-soft: var(--ink-soft);
  --fg: var(--paper);
  --fg-dim: rgba(244, 239, 231, .55);
  --line: rgba(244, 239, 231, .16);

  --qscale: 1;
  --ease: cubic-bezier(.33, .1, .18, 1);
}

html[data-theme="light"] {
  --bg: var(--paper);
  --bg-soft: var(--paper-soft);
  --fg: var(--ink);
  --fg-dim: rgba(20, 17, 14, .55);
  --line: rgba(20, 17, 14, .16);
}

@media (prefers-color-scheme: light) {
  html:not([data-theme]) {
    --bg: var(--paper);
    --bg-soft: var(--paper-soft);
    --fg: var(--ink);
    --fg-dim: rgba(20, 17, 14, .55);
    --line: rgba(20, 17, 14, .16);
  }
}

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

[hidden] { display: none !important; }

html, body { height: 100%; }

body {
  font-family: var(--sans);
  background: var(--bg);
  color: var(--fg);
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
  transition: background-color .9s var(--ease), color .5s var(--ease);
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

/* ── Screens ─────────────────────────────────────────────────── */

.screen {
  position: fixed;
  inset: 0;
  display: none;
  flex-direction: column;
  padding: calc(env(safe-area-inset-top, 0px) + 16px)
           calc(env(safe-area-inset-right, 0px) + 24px)
           calc(env(safe-area-inset-bottom, 0px) + 24px)
           calc(env(safe-area-inset-left, 0px) + 24px);
  opacity: 0;
}

.screen.active {
  display: flex;
  animation: screen-in .7s var(--ease) forwards;
}

@keyframes screen-in {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: none; }
}

/* ── Begrüßung ───────────────────────────────────────────────── */

#screen-welcome {
  align-items: center;
  justify-content: center;
  text-align: center;
}

.glow {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(ellipse 70% 45% at 50% 38%,
      rgba(194, 160, 94, .14), transparent 70%);
  animation: breathe 9s ease-in-out infinite;
}

@keyframes breathe {
  0%, 100% { opacity: .6; }
  50%      { opacity: 1; }
}

.welcome-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 22px;
  z-index: 1;
}

.hairline {
  width: 56px;
  height: 1px;
  background: var(--gold);
  opacity: .8;
}

.wordmark {
  font-family: var(--serif);
  font-weight: 400;
  font-size: clamp(3.4rem, 16vw, 5.5rem);
  letter-spacing: .14em;
  text-transform: uppercase;
  margin-left: .14em; /* optischer Ausgleich des letter-spacing */
  line-height: 1;
}

.tagline {
  font-size: .82rem;
  letter-spacing: .28em;
  text-transform: uppercase;
  color: var(--fg-dim);
  margin: 4px 0 26px;
}

.welcome-bottom {
  position: absolute;
  bottom: calc(env(safe-area-inset-bottom, 0px) + 26px);
  left: 0;
  right: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 18px;
  z-index: 1;
}

.welcome-foot {
  font-family: var(--serif);
  font-style: italic;
  font-size: .95rem;
  color: var(--fg-dim);
  padding: 0 24px;
  text-align: center;
}

/* ── Sprachwahl ──────────────────────────────────────────────── */

.lang-picker {
  display: flex;
  align-items: center;
  gap: 4px;
}

.lang-option {
  border: none;
  background: transparent;
  color: var(--fg-dim);
  font-family: var(--sans);
  font-size: .72rem;
  letter-spacing: .18em;
  text-transform: uppercase;
  padding: 8px 10px;
  cursor: pointer;
  transition: color .3s var(--ease);
  position: relative;
}

.lang-option:hover { color: var(--fg); }

.lang-option.on { color: var(--gold); }

.lang-option.on::after {
  content: "";
  position: absolute;
  left: 10px;
  right: 10px;
  bottom: 2px;
  height: 1px;
  background: var(--gold);
  opacity: .7;
}

.lang-sep {
  color: var(--fg-dim);
  opacity: .4;
  font-size: .7rem;
}

/* Zahnrad ohne Kopfzeile (Begrüßungsbildschirm) */
.gear-float {
  position: absolute;
  top: calc(env(safe-area-inset-top, 0px) + 14px);
  right: calc(env(safe-area-inset-right, 0px) + 18px);
  z-index: 2;
  opacity: .45;
}

/* ── Buttons ─────────────────────────────────────────────────── */

.btn {
  font-family: var(--sans);
  font-size: .8rem;
  letter-spacing: .22em;
  text-transform: uppercase;
  padding: 15px 42px;
  border-radius: 999px;
  cursor: pointer;
  transition: all .35s var(--ease);
}

.btn-solid {
  border: 1px solid var(--gold);
  background: transparent;
  color: var(--gold);
}

.btn-solid:hover,
.btn-solid:focus-visible {
  background: var(--gold);
  color: var(--ink);
}

.btn-ghost {
  border: 1px solid currentColor;
  background: transparent;
  color: inherit;
  opacity: .85;
}

.btn-ghost:hover { opacity: 1; }

.btn-small {
  border: 1px solid var(--line);
  background: transparent;
  color: inherit;
  font-size: .68rem;
  letter-spacing: .14em;
  padding: 9px 16px;
  white-space: nowrap;
}

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

.icon-btn {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border: none;
  border-radius: 50%;
  background: transparent;
  color: inherit;
  font-size: 1.1rem;
  cursor: pointer;
  opacity: .7;
  transition: opacity .3s, background .3s;
}

.icon-btn:hover { opacity: 1; background: rgba(127, 127, 127, .12); }

/* ── Kopfzeile ───────────────────────────────────────────────── */

.screen-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 48px;
}

.head-label {
  font-size: .72rem;
  letter-spacing: .28em;
  text-transform: uppercase;
  color: var(--fg-dim);
}

.head-spacer { width: 42px; }

/* ── Personenwahl ────────────────────────────────────────────── */

.count-inner {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 34px;
  text-align: center;
}

.count-question {
  font-family: var(--serif);
  font-size: clamp(1.6rem, 6vw, 2.2rem);
  font-weight: 400;
}

.stepper {
  display: flex;
  align-items: center;
  gap: 30px;
}

.stepper-btn {
  width: 58px;
  height: 58px;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: transparent;
  color: inherit;
  font-size: 1.6rem;
  font-weight: 300;
  cursor: pointer;
  transition: border-color .3s, transform .15s;
}

.stepper-btn:hover { border-color: var(--gold); }
.stepper-btn:active { transform: scale(.92); }

.count-value {
  font-family: var(--serif);
  font-size: clamp(4.5rem, 22vw, 7rem);
  line-height: 1;
  min-width: 2ch;
  font-variant-numeric: tabular-nums;
}

.count-dots {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
  max-width: 240px;
  min-height: 34px;
}

.count-dots span {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  animation: dot-in .4s var(--ease) backwards;
}

@keyframes dot-in {
  from { transform: scale(0); }
  to   { transform: scale(1); }
}

/* ── Spiel ───────────────────────────────────────────────────── */

#screen-game { color: var(--game-fg, var(--paper)); }

.turn-label {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
}

.turn-name {
  font-size: .78rem;
  letter-spacing: .3em;
  text-transform: uppercase;
}

.turn-sub {
  font-size: .62rem;
  letter-spacing: .18em;
  opacity: .5;
}

.question-wrap {
  position: relative;
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 12px 4px;
}

/* ── Rückblick ───────────────────────────────────────────────
   Zwei feine Winkel an den Rändern. Sie sind bewusst zurück-
   genommen und werden erst beim Berühren deutlicher. */

.foot-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.chevron {
  flex-shrink: 0;
  width: 46px;
  height: 46px;
  display: grid;
  place-items: center;
  border: none;
  background: transparent;
  color: inherit;
  font-family: var(--serif);
  font-size: 1.75rem;
  font-weight: 300;
  line-height: 1;
  cursor: pointer;
  opacity: .28;
  transition: opacity .35s var(--ease), transform .25s var(--ease);
}

.chevron:hover,
.chevron:focus-visible { opacity: .75; }

/* Auch unsichtbar behalten die Winkel ihren Platz, damit der Knopf
   beim Ein- und Ausblenden nicht seitlich springt. */
.chevron[hidden] {
  display: grid !important;
  visibility: hidden;
  pointer-events: none;
}

#btn-prev:active { transform: translateX(-3px); }
#btn-fwd:active { transform: translateX(3px); }

/* Im Rückblick tritt die Frage leicht zurück und bekommt eine Marke. */
.in-past .question { opacity: .88; }

/* „Zurück zum Spiel“ ist länger als „Weiter“ und steht zwischen beiden
   Winkeln. Damit es einzeilig bleibt, rückt die Beschriftung enger. */
.in-past .foot-row .btn {
  white-space: nowrap;
  padding-left: 20px;
  padding-right: 20px;
  letter-spacing: .14em;
}

.back-marker {
  font-size: .62rem;
  letter-spacing: .3em;
  text-transform: uppercase;
  opacity: .5;
  margin-bottom: 2px;
}

.question {
  font-family: var(--serif);
  font-weight: 400;
  font-size: calc(clamp(1.7rem, 7vw, 2.6rem) * var(--qscale));
  line-height: 1.45;
  text-align: center;
  max-width: 21em;
  text-wrap: balance;
  transition: opacity .45s var(--ease), transform .45s var(--ease);
}

.question.fading {
  opacity: 0;
  transform: translateY(14px);
}

.game-foot {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.hint {
  font-size: .68rem;
  letter-spacing: .12em;
  opacity: .4;
}

.timerbar {
  position: absolute;
  top: 0;
  left: 0;
  height: 3px;
  width: 100%;
  background: currentColor;
  opacity: .55;
  transform-origin: left;
  transform: scaleX(0);
}

.timerbar.running {
  transition: transform linear;
  transform: scaleX(1);
}

.timerbar.ended {
  animation: timer-pulse 1.2s ease-in-out 3;
}

@keyframes timer-pulse {
  0%, 100% { opacity: .55; }
  50%      { opacity: 1; height: 5px; }
}

/* ── Einstellungen ───────────────────────────────────────────── */

.backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, .45);
  backdrop-filter: blur(3px);
  z-index: 40;
  animation: fade-in .35s var(--ease);
}

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

.sheet {
  position: fixed;
  z-index: 50;
  inset: auto 0 0 0;
  max-height: 86dvh;
  background: var(--bg);
  color: var(--fg);
  border-radius: 22px 22px 0 0;
  border-top: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  animation: sheet-up .45s var(--ease);
  box-shadow: 0 -18px 60px rgba(0, 0, 0, .35);
}

@keyframes sheet-up {
  from { transform: translateY(40px); opacity: 0; }
  to   { transform: none; opacity: 1; }
}

.sheet-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 20px 10px 28px;
}

.sheet-body {
  overflow-y: auto;
  padding: 0 28px calc(env(safe-area-inset-bottom, 0px) + 32px);
  overscroll-behavior: contain;
}

.set-section {
  font-size: .66rem;
  letter-spacing: .3em;
  text-transform: uppercase;
  color: var(--gold-dim);
  margin: 30px 0 6px;
  font-weight: 500;
}

.set-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 0;
  border-bottom: 1px solid var(--line);
}

.set-row.set-col {
  flex-direction: column;
  align-items: flex-start;
  gap: 12px;
}

.set-text {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}

.set-label { font-size: .92rem; }

.set-desc {
  font-size: .74rem;
  color: var(--fg-dim);
  line-height: 1.45;
}

/* Segment-Schalter */

.segmented {
  display: flex;
  border: 1px solid var(--line);
  border-radius: 999px;
  overflow: hidden;
  flex-shrink: 0;
}

.segmented button {
  border: none;
  background: transparent;
  color: var(--fg-dim);
  font-size: .72rem;
  letter-spacing: .06em;
  padding: 8px 13px;
  cursor: pointer;
  transition: all .3s var(--ease);
}

.segmented button.on {
  background: var(--fg);
  color: var(--bg);
}

/* Sprachumschalter braucht mehr Platz und darf die ganze Zeile nutzen. */
.segmented-wide {
  width: 100%;
  flex-shrink: 1;
}

.segmented-wide button {
  flex: 1;
  padding: 10px 6px;
  font-size: .74rem;
  letter-spacing: .04em;
}

/* Kippschalter */

.switch {
  flex-shrink: 0;
  width: 48px;
  height: 28px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: transparent;
  position: relative;
  cursor: pointer;
  transition: background .3s var(--ease), border-color .3s;
}

.switch::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--fg-dim);
  transition: transform .3s var(--ease), background .3s;
}

.switch[aria-checked="true"] {
  background: var(--gold);
  border-color: var(--gold);
}

.switch[aria-checked="true"]::after {
  transform: translateX(20px);
  background: var(--ink);
}

/* Farbwelten */

.palette-picker {
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: 100%;
}

.palette-option {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: transparent;
  color: inherit;
  cursor: pointer;
  transition: border-color .3s;
  width: 100%;
}

.palette-option.on { border-color: var(--gold); }

.palette-name {
  font-size: .8rem;
  letter-spacing: .1em;
  flex: 1;
  text-align: left;
}

.palette-swatches { display: flex; gap: 5px; }

.palette-swatches i {
  width: 16px;
  height: 16px;
  border-radius: 50%;
}

/* Namen */

.names-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 14px 0;
}

.name-row {
  display: flex;
  align-items: center;
  gap: 12px;
}

.name-row i {
  flex-shrink: 0;
  width: 14px;
  height: 14px;
  border-radius: 50%;
}

.name-row input {
  flex: 1;
  min-width: 0;
  border: none;
  border-bottom: 1px solid var(--line);
  background: transparent;
  color: inherit;
  font-family: var(--serif);
  font-size: 1.05rem;
  padding: 7px 2px;
  outline: none;
  transition: border-color .3s;
}

.name-row input:focus { border-color: var(--gold); }

.sheet-foot {
  margin-top: 34px;
  text-align: center;
  font-size: .68rem;
  letter-spacing: .2em;
  text-transform: uppercase;
  color: var(--fg-dim);
}

/* ── Größere Bildschirme ─────────────────────────────────────── */

@media (min-width: 700px) {
  .screen { padding-left: 48px; padding-right: 48px; }

  .question { font-size: calc(clamp(2.2rem, 4vw, 3.2rem) * var(--qscale)); }

  .sheet {
    inset: 0 0 0 auto;
    width: min(440px, 90vw);
    max-height: none;
    border-radius: 0;
    border-top: none;
    border-left: 1px solid var(--line);
    animation: sheet-side .45s var(--ease);
  }

  @keyframes sheet-side {
    from { transform: translateX(60px); opacity: 0; }
    to   { transform: none; opacity: 1; }
  }

  /* dezente Vignette für Tiefe auf großen Flächen */
  #screen-game::before {
    content: "";
    position: absolute;
    inset: 0;
    pointer-events: none;
    background: radial-gradient(ellipse 120% 100% at 50% 45%,
      transparent 55%, rgba(0, 0, 0, .18));
  }
}

/* ── Reduzierte Bewegung ─────────────────────────────────────── */

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    transition-duration: .01ms !important;
  }
}
