:root {
  --bg: #1a1a1a;
  --text: #e8e4df;
  --text-dim: #7a756e;
  --accent: #c4a882;
  --error: #b85c5c;
  --font: -apple-system, 'Segoe UI', system-ui, sans-serif;
}

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

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 2rem;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

main {
  max-width: 32rem;
  width: 100%;
  text-align: left;
}

#mark {
  max-width: 32rem;
  width: 100%;
  font-size: 2rem;
  color: var(--text-dim);
  margin-bottom: 3rem;
  opacity: 0.6;
}

/* Phase visibility */

body[data-phase="entry"] #session {
  display: none;
}

body[data-phase="session"] #entry {
  display: none;
}

body[data-phase="loading"] #entry {
  display: none;
}

body[data-phase="loading"] #session-frame,
body[data-phase="loading"] #session-actions {
  display: none;
}

body[data-phase="loading"] #session-loading {
  display: flex !important;
}

/* Choices */

.choice {
  cursor: pointer;
  padding: 1.25rem 0;
  font-size: 1.5rem;
  line-height: 1.5;
  color: var(--text);
  transition: color 0.2s ease;
  user-select: none;
  text-wrap: pretty;
}

@media (hover: hover) {
  .choice:hover {
    color: var(--accent);
  }
}

.choice:focus-visible {
  color: var(--accent);
}

.choice:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 4px;
  border-radius: 2px;
}

/* Choice history (Typeform-style accumulation) */

#session-history {
  margin-bottom: 2rem;
}

#session-history:empty {
  display: none;
}

#session-history p {
  color: var(--text-dim);
  font-size: 1rem;
  line-height: 1.8;
  margin-bottom: 0.75em;
  text-wrap: pretty;
}

/* Action buttons */

#entry .cycle {
  margin-top: 2.5rem;
}

#session-actions {
  display: flex;
  gap: 2rem;
  margin-top: 2.5rem;
}

.cycle {
  background: none;
  border: none;
  color: var(--text-dim);
  cursor: pointer;
  font-family: var(--font);
  font-size: 0.875rem;
  padding: 0.5rem 0;
  transition: color 0.2s ease;
}

.cycle:hover {
  color: var(--text);
}

.cycle:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 4px;
  border-radius: 2px;
}

/* Loading dots */

#session-loading {
  display: none;
  gap: 0.5rem;
  align-items: center;
  padding: 3rem 0;
}

.dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--text-dim);
  animation: pulse 1.4s ease-in-out infinite;
}

.dot:nth-child(2) { animation-delay: 0.2s; }
.dot:nth-child(3) { animation-delay: 0.4s; }

@keyframes pulse {
  0%, 80%, 100% { opacity: 0.2; transform: scale(0.8); }
  40% { opacity: 1; transform: scale(1); }
}

/* Error state */

#session-error {
  color: var(--text-dim);
  font-size: 0.875rem;
  padding: 2rem 0;
}

#session-error button {
  background: none;
  border: none;
  color: var(--accent);
  cursor: pointer;
  font-family: var(--font);
  font-size: 0.875rem;
  text-decoration: underline;
  text-underline-offset: 2px;
}

#session-error button:hover {
  color: var(--text);
}

/* Start over — dimmer than its sibling */

#start-over {
  opacity: 0.5;
  transition: opacity 0.2s;
}

#start-over:hover {
  opacity: 1;
}

/* Content transitions */

#entry-frame,
#session-frame {
  transition: opacity 0.15s ease;
}

.fading {
  opacity: 0;
}

/* Reduced motion */

@media (prefers-reduced-motion: reduce) {
  .dot {
    animation: none;
    opacity: 0.5;
  }
  #entry-frame,
  #session-frame {
    transition: none;
  }
}
