/* Registered so the hue can animate smoothly between topics. */
@property --h {
  syntax: "<number>";
  inherits: true;
  initial-value: 345;
}

:root {
  --bg: hsl(28 60% 96%);
  --text: hsl(340 22% 17%);
  --muted: hsl(340 9% 42%);
  --surface: hsl(0 0% 100% / 0.62);
  --surface-strong: hsl(0 0% 100% / 0.82);
  --border: hsl(340 35% 78% / 0.5);
  --shadow: 0 1px 2px hsl(340 30% 30% / 0.06), 0 18px 44px -18px hsl(340 45% 35% / 0.35);
  --danger: hsl(2 72% 46%);
  --danger-text: #fff;
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", Georgia, "Noto Serif", serif;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color-scheme: light dark;
}

/* Hue-dependent tokens must be declared where --h changes, otherwise they stay fixed. */
body,
.topic-card {
  --accent: hsl(var(--h) 66% 50%);
  --accent-soft: hsl(var(--h) 85% 92%);
  --accent-text: #fff;
  --blob-a: hsl(var(--h) 85% 82% / 0.8);
  --blob-b: hsl(calc(var(--h) + 35) 90% 84% / 0.65);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: hsl(285 30% 7%);
    --text: hsl(30 35% 94%);
    --muted: hsl(300 10% 70%);
    --surface: hsl(290 22% 14% / 0.6);
    --surface-strong: hsl(290 22% 16% / 0.82);
    --border: hsl(300 25% 50% / 0.25);
    --shadow: 0 1px 2px #0005, 0 20px 50px -20px #000c;
    --danger: hsl(2 85% 68%);
    --danger-text: hsl(285 30% 10%);
  }
  body,
  .topic-card {
    --accent: hsl(var(--h) 80% 70%);
    --accent-soft: hsl(var(--h) 35% 22%);
    --accent-text: hsl(285 30% 10%);
    --blob-a: hsl(var(--h) 70% 32% / 0.6);
    --blob-b: hsl(calc(var(--h) + 35) 65% 28% / 0.5);
  }
}

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

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100dvh;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  line-height: 1.5;
  transition: --h 0.9s ease;
  -webkit-tap-highlight-color: transparent;
}

button {
  font: inherit;
  color: inherit;
  cursor: pointer;
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

/*
  Soft color blobs behind everything. Kept still on purpose: if they moved, every blurred
  "glass" element above them would have to be recomputed in every frame, which makes
  phones stutter.
*/
.backdrop {
  position: fixed;
  inset: -20%;
  z-index: -1;
  pointer-events: none;
  background:
    radial-gradient(38% 32% at 18% 18%, var(--blob-a), transparent 70%),
    radial-gradient(42% 36% at 86% 30%, var(--blob-b), transparent 70%),
    radial-gradient(50% 40% at 45% 92%, var(--blob-a), transparent 72%);
  filter: blur(24px);
}

/*
  The blobs fade into the plain background at the top and bottom of the screen, so the
  phone's status and navigation bars join without a seam: they get exactly --bg (theme-color
  in the HTML pages, theme_color in the manifest; keep those in sync with --bg).
*/
body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background: linear-gradient(
    to bottom,
    var(--bg),
    transparent 96px,
    transparent calc(100% - 120px),
    var(--bg)
  );
}

.app {
  max-width: 720px;
  min-height: 100dvh;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  /* Cards sliding or being dragged sideways must not widen the page (that flashes a
     scrollbar). clip, unlike hidden, creates no scroll container. */
  overflow-x: clip;
  padding:
    max(16px, env(safe-area-inset-top))
    max(16px, env(safe-area-inset-right))
    max(16px, env(safe-area-inset-bottom))
    max(16px, env(safe-area-inset-left));
}

main {
  flex: 1;
  display: flex;
  flex-direction: column;
}

.view {
  flex: 1;
  display: flex;
  flex-direction: column;
}

.view[hidden] {
  display: none;
}

/* Top bar */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

/* ---------- Sticky header (main app) ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
}

.topbar-shell {
  position: relative;
  z-index: 2;
}

/*
  The only glass surface of the header. It fades in once the page is scrolled and grows
  down to also cover the progress strip, so bar and strip read as one piece of glass.
*/
.header-glass {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  z-index: 0;
  height: 100%;
  border-bottom: 1px solid transparent;
  pointer-events: none;
  transition:
    height 0.35s cubic-bezier(0.2, 0.8, 0.2, 1),
    background 0.35s ease,
    border-color 0.35s ease,
    box-shadow 0.35s ease;
}

.site-header.is-scrolled .header-glass {
  border-bottom-color: var(--border);
  background: color-mix(in srgb, var(--bg) 72%, transparent);
  backdrop-filter: blur(18px) saturate(1.4);
  -webkit-backdrop-filter: blur(18px) saturate(1.4);
  box-shadow: 0 10px 30px -22px hsl(var(--h) 40% 25% / 0.55);
}

.site-header.show-progress .header-glass {
  height: calc(100% + var(--strip-h, 40px));
}

.site-header .topbar {
  max-width: 720px;
  margin: 0 auto;
  padding:
    max(14px, env(safe-area-inset-top))
    max(16px, env(safe-area-inset-right))
    12px
    max(16px, env(safe-area-inset-left));
  transition: padding 0.35s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.site-header .brand {
  transition: font-size 0.35s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.site-header .brand-mark {
  display: inline-block;
  transition: transform 0.45s cubic-bezier(0.3, 1.6, 0.5, 1);
}

/* Condense a little while scrolled */
.site-header.is-scrolled .topbar {
  padding-top: max(8px, env(safe-area-inset-top));
  padding-bottom: 8px;
}

.site-header.is-scrolled .brand {
  font-size: 1.05rem;
}

.site-header.is-scrolled .brand-mark {
  transform: scale(0.88) rotate(-8deg);
}

/* Compact phase progress; has no background of its own, it sits on the header glass */
.sticky-progress {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  z-index: 1;
  overflow: hidden;
  pointer-events: none;
}

.sticky-progress-clip {
  opacity: 0;
  transform: translateY(-12px);
  transition:
    transform 0.35s cubic-bezier(0.2, 0.8, 0.2, 1),
    opacity 0.2s ease;
}

.site-header.show-progress .sticky-progress-clip {
  opacity: 1;
  transform: none;
}

.sticky-progress-inner {
  max-width: 720px;
  margin: 0 auto;
  padding: 2px max(16px, env(safe-area-inset-right)) 10px max(16px, env(safe-area-inset-left));
}

.sticky-progress-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 6px;
  font-size: 0.8rem;
  opacity: 0;
  transform: translateY(-6px);
  transition: opacity 0.3s ease, transform 0.4s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.site-header.show-progress .sticky-progress-row {
  opacity: 1;
  transform: none;
  transition-delay: 0.05s;
}

.sticky-progress-label {
  overflow: hidden;
  font-weight: 700;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.sticky-progress-count {
  flex: none;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.sticky-progress .progress-bar {
  transform-origin: left center;
}

/* Replays every time the strip attaches: the bar fills up to its value */
.site-header.show-progress .sticky-progress .progress-bar {
  animation: fill-in 0.6s 0.05s cubic-bezier(0.2, 0.8, 0.2, 1) both;
}

@keyframes fill-in {
  from {
    transform: scaleX(0);
  }
}

/* The header already reserves the top safe area */
.site-header + .app {
  min-height: calc(100dvh - var(--header-h, 64px));
  padding-top: 0;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 4px;
  border: 0;
  background: none;
  font-family: var(--serif);
  font-size: 1.2rem;
  font-weight: 600;
  letter-spacing: 0.01em;
}

.brand-mark {
  font-size: 1.1rem;
}

.lang {
  display: inline-flex;
  padding: 3px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.lang button {
  min-width: 44px;
  padding: 6px 12px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  transition: background 0.25s, color 0.25s;
}

.lang button[aria-pressed="true"] {
  background: var(--accent);
  color: var(--accent-text);
}

/* Topics view */
.intro {
  margin: 28px 0 24px;
}

.intro h1 {
  margin: 0 0 8px;
  font-family: var(--serif);
  font-size: clamp(2rem, 8vw, 2.9rem);
  font-weight: 600;
  line-height: 1.08;
  letter-spacing: -0.01em;
  text-wrap: balance;
}

.intro p {
  margin: 0;
  color: var(--muted);
  max-width: 34em;
}

.mix-card {
  display: flex;
  align-items: center;
  gap: 14px;
  width: 100%;
  margin-bottom: 14px;
  padding: 18px 18px;
  border: 0;
  border-radius: 22px;
  background: linear-gradient(130deg, hsl(345 75% 58%), hsl(18 88% 62%) 60%, hsl(38 95% 62%));
  color: #fff;
  text-align: left;
  box-shadow: 0 18px 40px -18px hsl(350 70% 45% / 0.7);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  animation: rise 0.5s both cubic-bezier(0.2, 0.8, 0.2, 1);
}

.mix-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 22px 44px -18px hsl(350 70% 45% / 0.8);
}

.mix-emoji {
  display: grid;
  place-items: center;
  flex: none;
  width: 48px;
  height: 48px;
  border-radius: 15px;
  background: hsl(0 0% 100% / 0.22);
  font-size: 1.5rem;
}

.mix-text {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.mix-title {
  font-family: var(--serif);
  font-size: 1.25rem;
  font-weight: 600;
}

.mix-sub {
  font-size: 0.88rem;
  opacity: 0.9;
}

.chev {
  margin-left: auto;
  flex: none;
  font-size: 1.1rem;
}

.topic-list {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
  margin: 0 0 8px;
  padding: 0;
  list-style: none;
}

@media (min-width: 600px) {
  .topic-list {
    grid-template-columns: 1fr 1fr;
  }
}

.topic-list li {
  animation: rise 0.5s both cubic-bezier(0.2, 0.8, 0.2, 1);
  animation-delay: calc(var(--i) * 35ms + 60ms);
}

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
}

.topic-card {
  display: flex;
  align-items: center;
  gap: 14px;
  width: 100%;
  height: 100%;
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: 18px;
  background: var(--surface);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  text-align: left;
  transition: transform 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}

.topic-card:hover {
  transform: translateY(-2px);
  border-color: var(--accent);
  box-shadow: var(--shadow);
}

.topic-emoji {
  display: grid;
  place-items: center;
  flex: none;
  width: 44px;
  height: 44px;
  border-radius: 14px;
  background: var(--accent-soft);
  font-size: 1.3rem;
}

.topic-text {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.topic-title {
  font-weight: 600;
  line-height: 1.3;
}

.topic-count {
  color: var(--muted);
  font-size: 0.85rem;
}

.topic-card .chev {
  color: var(--accent);
}

/* Shown, but nothing to start yet (e.g. "questions come back from ..."). */
.topic-card:disabled {
  cursor: default;
}

.topic-card:disabled:hover {
  transform: none;
  border-color: var(--border);
  box-shadow: none;
}

.topic-list:empty {
  display: none;
}

.topic-list.highlight-list {
  grid-template-columns: 1fr;
  margin-bottom: 18px;
}

.extras[hidden] {
  display: none;
}

.topic-list.browse-list {
  margin-bottom: 18px;
}

/* List page (topics or occasions) */
.intro.list-intro {
  margin: 8px 0 22px;
}

.section-title {
  margin: 22px 4px 10px;
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

/* Phase journey */
.journey {
  --fill: 0;
  position: relative;
  display: flex;
  justify-content: space-between;
  margin: 0 0 18px;
  padding: 0 2px;
  list-style: none;
}

/* Track behind the dots, filled up to the highest unlocked phase */
.journey::before,
.journey::after {
  content: "";
  position: absolute;
  top: 23px;
  left: 28px;
  right: 28px;
  height: 3px;
  border-radius: 999px;
  background: var(--border);
}

.journey::after {
  right: auto;
  width: calc((100% - 56px) * var(--fill));
  background: var(--accent);
  transition: width 0.6s ease;
}

.step {
  position: relative;
  z-index: 1;
}

.step-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 0;
  border: 0;
  background: none;
}

.step-btn:disabled {
  cursor: default;
}

.step-dot {
  position: relative;
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  border: 2px solid var(--border);
  border-radius: 50%;
  background: var(--surface-strong);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  font-size: 1.3rem;
  transition: transform 0.25s ease, border-color 0.25s ease, background 0.25s ease;
}

.step-dot::after {
  position: absolute;
  right: -4px;
  bottom: -4px;
  display: grid;
  place-items: center;
  width: 20px;
  height: 20px;
  border: 2px solid var(--bg);
  border-radius: 50%;
  font-size: 0.62rem;
  font-weight: 800;
}

.step.is-done .step-dot {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.step.is-done .step-dot::after {
  content: "✓";
  background: var(--accent);
  color: var(--accent-text);
}

.step.is-locked .step-dot {
  opacity: 0.55;
  filter: grayscale(1);
}

.step.is-locked .step-dot::after {
  content: "🔒";
  background: var(--surface-strong);
}

.step.is-current .step-dot {
  border-color: var(--accent);
  animation: pulse 2.4s ease-out infinite;
}

@keyframes pulse {
  0% {
    box-shadow: 0 0 0 0 color-mix(in srgb, var(--accent) 45%, transparent);
  }
  70%,
  100% {
    box-shadow: 0 0 0 12px color-mix(in srgb, var(--accent) 0%, transparent);
  }
}

.step.is-selected .step-dot {
  transform: scale(1.12);
  outline: 3px solid var(--accent);
  outline-offset: 3px;
}

.step-num {
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 700;
}

.step.is-selected .step-num {
  color: var(--text);
}

.phase-card {
  margin-bottom: 14px;
  padding: 18px 20px;
  border: 1px solid var(--border);
  border-radius: 22px;
  background: var(--surface);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  box-shadow: var(--shadow);
  animation: rise 0.5s both cubic-bezier(0.2, 0.8, 0.2, 1);
}

.phase-kicker {
  margin: 0 0 4px;
  color: var(--accent);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.phase-title {
  margin: 0 0 4px;
  font-family: var(--serif);
  font-size: 1.45rem;
  font-weight: 600;
  line-height: 1.2;
}

.phase-desc {
  margin: 0 0 14px;
  color: var(--muted);
  font-size: 0.92rem;
}

.phase-count {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 0.82rem;
  font-variant-numeric: tabular-nums;
}

.topic-card.is-complete {
  border-color: color-mix(in srgb, var(--accent) 45%, transparent);
}

.topic-check {
  display: grid;
  place-items: center;
  flex: none;
  width: 26px;
  height: 26px;
  margin-left: auto;
  border-radius: 50%;
  background: var(--accent);
  color: var(--accent-text);
  font-size: 0.8rem;
  font-weight: 800;
}

.link-btn {
  padding: 8px;
  border: 0;
  background: none;
  color: var(--muted);
  font-size: 0.85rem;
  text-decoration: underline;
  text-underline-offset: 3px;
}

/* Question view */
.q-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 18px 0 14px;
}

.pill-btn {
  flex: none;
  padding: 8px 14px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  font-size: 0.9rem;
  font-weight: 600;
}

.q-chip {
  min-width: 0;
  overflow: hidden;
  padding: 6px 12px;
  border-radius: 999px;
  background: var(--accent-soft);
  font-size: 0.85rem;
  font-weight: 600;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.progress {
  height: 4px;
  overflow: hidden;
  border-radius: 999px;
  background: var(--border);
}

.progress-bar {
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: var(--accent);
  transition: width 0.45s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.stage {
  flex: 1;
  display: grid;
  place-items: center;
  padding: 22px 0;
}

.card {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: center;
  width: 100%;
  min-height: min(48vh, 420px);
  padding: clamp(32px, 8vw, 60px) clamp(24px, 7vw, 56px);
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 30px;
  /* No backdrop blur: behind the card is only the already blurred background, so it would
     look the same but cost a lot while the card moves. Its own layer keeps dragging smooth. */
  background: var(--surface-strong);
  box-shadow: var(--shadow);
  will-change: transform;
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
  touch-action: pan-y;
  transition: transform 0.25s ease;
}

.card.dragging {
  transition: none;
}

.card.is-done {
  cursor: default;
}

/* Big decorative quote mark */
.card::before {
  content: "\201C";
  position: absolute;
  top: -0.12em;
  left: 0.12em;
  color: var(--accent);
  font-family: var(--serif);
  font-size: 9rem;
  line-height: 1;
  opacity: 0.16;
  pointer-events: none;
}

.card.is-done::before {
  content: none;
}

.card-topic {
  margin: 0 0 14px;
  color: var(--accent);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.card-meta {
  margin: 16px 0 0;
  color: var(--muted);
  font-size: 0.9rem;
  font-style: italic;
}

.card-meta:empty {
  display: none;
}

.card-topic:empty {
  display: none;
}

.card-question {
  margin: 0;
  font-family: var(--serif);
  font-size: clamp(1.65rem, 6.4vw, 2.5rem);
  font-weight: 500;
  line-height: 1.22;
  letter-spacing: -0.005em;
  text-wrap: balance;
}

.card-done {
  text-align: center;
}

.card-done[hidden],
.card-body[hidden] {
  display: none;
}

.done-mark {
  font-size: 2.4rem;
}

.card-done h2 {
  margin: 8px 0 6px;
  font-family: var(--serif);
  font-size: clamp(1.6rem, 6vw, 2.2rem);
  font-weight: 600;
}

.card-done p {
  margin: 0 auto 22px;
  max-width: 26em;
  color: var(--muted);
}

.done-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
}

.card.enter-next {
  animation: enter-next 0.5s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.card.enter-prev {
  animation: enter-prev 0.5s cubic-bezier(0.2, 0.8, 0.2, 1);
}

@keyframes enter-next {
  from {
    opacity: 0;
    transform: translateX(42px) rotate(2deg) scale(0.97);
  }
}

@keyframes enter-prev {
  from {
    opacity: 0;
    transform: translateX(-42px) rotate(-2deg) scale(0.97);
  }
}

.hint {
  margin: 0 0 12px;
  color: var(--muted);
  font-size: 0.82rem;
  text-align: center;
}

.controls {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 12px;
}

.controls #prev {
  justify-self: start;
}

.controls #next {
  justify-self: end;
}

.counter {
  color: var(--muted);
  font-size: 0.9rem;
  font-variant-numeric: tabular-nums;
}

.btn {
  padding: 13px 22px;
  border: 1px solid transparent;
  border-radius: 999px;
  font-weight: 600;
  white-space: nowrap;
  transition: transform 0.15s ease, opacity 0.2s ease, background 0.25s;
}

.btn:active:not(:disabled) {
  transform: scale(0.96);
}

.btn:disabled {
  opacity: 0.35;
  cursor: default;
}

.btn.primary {
  background: var(--accent);
  color: var(--accent-text);
  box-shadow: 0 12px 26px -14px var(--accent);
}

.btn.ghost {
  border-color: var(--border);
  background: var(--surface);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

/* Who starts? */
.starter {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  margin: -6px 0 10px;
}

.skip-btn {
  color: var(--muted);
}

.starter-btn {
  min-width: 11em;
  transition: transform 0.2s ease, background 0.25s ease, color 0.25s ease;
}

.starter-btn.is-rolling {
  transform: scale(1.04);
}

.starter-btn.is-picked {
  border-color: transparent;
  background: var(--accent);
  color: var(--accent-text);
  animation: pop 0.35s cubic-bezier(0.2, 0.8, 0.2, 1.4);
}

@keyframes pop {
  from {
    transform: scale(0.85);
  }
}

/* Top bar extras */
.topbar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.account-btn {
  height: 36px;
  min-width: 36px;
  padding: 0 10px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  font-size: 0.8rem;
  font-weight: 700;
}

.account-btn[hidden] {
  display: none;
}

.loading {
  margin: 40vh 0 0;
  color: var(--muted);
  text-align: center;
}

.intro-names {
  margin: 0 0 6px;
  color: var(--accent);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.intro-names:empty {
  display: none;
}

/* Login and registration */
.auth-card {
  padding: 20px;
  border: 1px solid var(--border);
  border-radius: 24px;
  background: var(--surface-strong);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  box-shadow: var(--shadow);
  animation: rise 0.5s both cubic-bezier(0.2, 0.8, 0.2, 1);
}

.tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
  margin-bottom: 18px;
  padding: 4px;
  border-radius: 999px;
  background: var(--border);
}

.tab {
  padding: 9px 10px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 600;
  transition: background 0.2s, color 0.2s;
}

.tab[aria-selected="true"] {
  background: var(--surface-strong);
  color: var(--text);
  box-shadow: 0 1px 4px hsl(0 0% 0% / 0.08);
}

.auth-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.auth-form[hidden],
.passkey-login[hidden] {
  display: none;
}

.passkey-login {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.passkey-hint {
  margin-top: -6px;
  color: var(--muted);
  font-size: 0.8rem;
  text-align: center;
}

.divider {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--muted);
  font-size: 0.82rem;
}

.divider::before,
.divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--border);
}

.field-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
  font-size: 0.85rem;
  font-weight: 600;
}

.field input,
.field textarea {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--bg);
  color: var(--text);
  font: inherit;
  font-size: 1rem; /* 16px keeps iOS from zooming in on focus */
  font-weight: 400;
}

.field textarea {
  resize: vertical;
}

.field input:focus,
.field textarea:focus {
  border-color: var(--accent);
  outline: 2px solid color-mix(in srgb, var(--accent) 30%, transparent);
  outline-offset: 0;
}

.field small {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 400;
}

.btn.wide {
  width: 100%;
  white-space: normal;
}

.btn.small {
  padding: 8px 14px;
  font-size: 0.85rem;
}

.form-msg {
  margin: 12px 0 0;
  color: var(--accent);
  font-size: 0.9rem;
  font-weight: 600;
  text-align: center;
}

.form-msg:empty {
  display: none;
}

/* Passkey hint on the home screen */
.banner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 12px;
  margin-bottom: 18px;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 18px;
  background: var(--surface);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  font-size: 0.9rem;
}

.banner[hidden] {
  display: none;
}

.banner-text {
  flex: 1 1 12em;
}

.banner-actions {
  display: flex;
  align-items: center;
  gap: 4px;
}

/* Account sheet */
.sheet {
  width: min(440px, calc(100vw - 32px));
  max-height: calc(100dvh - 32px);
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 26px;
  background: var(--bg);
  color: var(--text);
  box-shadow: var(--shadow);
}

.sheet::backdrop {
  background: hsl(285 30% 8% / 0.45);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}

.sheet[open] {
  animation: rise 0.3s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.sheet-inner {
  padding: 24px 22px 20px;
}

.sheet-title {
  margin: 0;
  font-family: var(--serif);
  font-size: 1.6rem;
  font-weight: 600;
}

.sheet-sub {
  margin: 2px 0 18px;
  color: var(--muted);
  font-size: 0.88rem;
}

.sheet-section {
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: 18px;
  background: var(--surface);
}

.sheet-section h3 {
  margin: 0 0 4px;
  font-size: 1rem;
}

.sheet-section p {
  margin: 0 0 10px;
  color: var(--muted);
  font-size: 0.88rem;
}

.sheet-status {
  font-weight: 600;
}

.sheet-status:empty {
  display: none;
}

/* Long labels (e.g. in German) wrap instead of sticking out on narrow phones. */
.sheet-section .btn {
  max-width: 100%;
  white-space: normal;
}

.sheet-section + .sheet-section {
  margin-top: 12px;
}

.passkey-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin: 0 0 12px;
  padding: 0;
  list-style: none;
}

.passkey-list:empty {
  display: none;
}

.passkey-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 4px 8px 12px;
  border: 1px solid var(--border);
  border-radius: 12px;
}

.passkey-text {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.passkey-name {
  font-size: 0.92rem;
  font-weight: 600;
}

.passkey-meta {
  color: var(--muted);
  font-size: 0.8rem;
}

.security-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 12px;
}

.security-actions .link-btn[hidden],
.password-form[hidden] {
  display: none;
}

.password-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 10px;
}

.password-form .form-msg {
  margin: 0;
  color: var(--danger);
}

.password-form .sheet-actions {
  margin-top: 0;
}

/* Flagging a question */
.flag-btn {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 1;
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border: 1px solid transparent;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  font-size: 1.05rem;
  opacity: 0.55;
  cursor: pointer;
  transition: opacity 0.2s ease, background 0.2s ease, border-color 0.2s ease;
}

.flag-btn:hover,
.flag-btn:focus-visible {
  opacity: 1;
  border-color: var(--border);
  background: var(--surface);
}

.flag-btn.is-flagged {
  opacity: 1;
  background: var(--accent-soft);
  color: var(--accent);
}

.flag-btn[hidden] {
  display: none;
}

.flag-question {
  font-style: italic;
}

.flag-options {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.flag-option {
  padding: 12px 16px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-weight: 600;
  text-align: left;
  cursor: pointer;
}

.flag-option:hover {
  border-color: var(--accent);
}

.flag-option.is-selected {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.flag-option.is-selected::after {
  content: " ✓";
}

.flag-note {
  margin: 12px 0 0;
  color: var(--muted);
  font-size: 0.8rem;
}

/* Question box */
.box-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 18px;
}

.box-form .sheet-actions {
  margin-top: 0;
}

.author-choice {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0;
  padding: 0;
  border: 0;
}

.author-choice legend {
  margin-bottom: 6px;
  padding: 0;
  font-size: 0.85rem;
  font-weight: 600;
}

.author-choice label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  font-weight: 600;
  cursor: pointer;
}

.author-choice label:has(input:checked) {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.author-choice input {
  margin: 0;
  accent-color: var(--accent);
}

.sheet-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 18px;
}

.sheet .btn[hidden] {
  display: none;
}

.sheet-danger {
  margin-top: 18px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
}

.danger-link {
  padding: 4px 0;
  color: var(--danger);
}

.danger-link[hidden],
.delete-form[hidden] {
  display: none;
}

.delete-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 16px;
  border: 1px solid color-mix(in srgb, var(--danger) 45%, transparent);
  border-radius: 18px;
  background: color-mix(in srgb, var(--danger) 7%, transparent);
}

.delete-form h3 {
  margin: 0;
  color: var(--danger);
  font-size: 1rem;
}

.delete-form p {
  margin: 0;
  font-size: 0.88rem;
}

.delete-form .form-msg {
  margin: 0;
  color: var(--danger);
}

.delete-form .sheet-actions {
  margin-top: 0;
}

.btn.danger {
  background: var(--danger);
  color: var(--danger-text);
}

/* Shown when saving progress failed */
.toast {
  position: fixed;
  left: 50%;
  bottom: max(16px, env(safe-area-inset-bottom));
  z-index: 10;
  max-width: calc(100vw - 32px);
  padding: 10px 16px;
  border-radius: 999px;
  background: var(--text);
  color: var(--bg);
  font-size: 0.85rem;
  transform: translateX(-50%);
  box-shadow: var(--shadow);
}

.toast[hidden] {
  display: none;
}

/* Footer with the imprint link */
.app-footer {
  margin-top: 24px;
  padding: 8px 0 4px;
  text-align: center;
}

.app-footer a,
.legal a {
  color: var(--muted);
  font-size: 0.82rem;
}

/* Imprint page */
.legal {
  padding-top: 20px;
}

a.brand {
  color: inherit;
  text-decoration: none;
}

.legal-back {
  align-self: flex-start;
  margin-bottom: 16px;
  color: var(--text);
  text-decoration: none;
}

.legal .legal-back {
  color: var(--text);
  font-size: 0.9rem;
}

.legal-card {
  padding: 24px 22px;
  border: 1px solid var(--border);
  border-radius: 24px;
  background: var(--surface-strong);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  box-shadow: var(--shadow);
}

.legal-card h1 {
  margin: 0 0 4px;
  font-family: var(--serif);
  font-size: clamp(1.6rem, 7vw, 2rem);
  overflow-wrap: break-word;
  hyphens: auto;
}

.legal-card h2 {
  margin: 20px 0 6px;
  font-size: 1rem;
}

.legal-card p {
  margin: 0;
  line-height: 1.6;
}

.legal-basis {
  margin-bottom: 18px !important;
  color: var(--muted);
  font-size: 0.88rem;
}

.legal-card a {
  color: var(--accent);
  font-size: inherit;
}

.legal-note {
  color: var(--muted);
}

.legal-card p + p {
  margin-top: 8px;
}

.legal-updated {
  margin-top: 24px !important;
}

.form-note {
  margin: 0;
  color: var(--muted);
  font-size: 0.8rem;
  text-align: center;
}

.form-note a {
  color: inherit;
}

.app-footer span {
  margin: 0 6px;
  color: var(--muted);
  font-size: 0.82rem;
}

/* Bot trap: invisible for people, filled in by simple bots */
.hp {
  position: absolute;
  left: -10000px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

.field[hidden] {
  display: none;
}

/* Shown only if questions.js is broken */
.fatal {
  margin: 24px 0;
  padding: 16px;
  border-radius: 12px;
  background: hsl(0 80% 95%);
  color: hsl(0 70% 30%);
  font: 0.9rem/1.4 ui-monospace, monospace;
  white-space: pre-wrap;
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
