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

:root {
  --paper: #FAF7F2;
  --paper-deep: #F0EBE3;
  --ink: #1C1917;
  --ink-soft: #57534E;
  --ink-muted: #A8A29E;
  --line: #E7E2DA;
  --surface: #FFFFFF;
  --accent: #C2410C;
  --accent-hover: #9A3412;
  --accent-soft: #FFF7ED;
  --success: #166534;
  --success-soft: #ECFDF5;
  --radius-sm: 12px;
  --radius-md: 16px;
  --radius-lg: 24px;
  --radius-full: 999px;
  --font-body: 'DM Sans', system-ui, sans-serif;
  --font-display: 'Fraunces', Georgia, serif;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --shadow-sm: 0 1px 2px rgba(28, 25, 23, 0.06);
  --shadow-md: 0 8px 24px rgba(28, 25, 23, 0.08);
}

html {
  font-size: 16px;
  -webkit-tap-highlight-color: transparent;
}

body {
  font-family: var(--font-body);
  background: var(--paper);
  color: var(--ink);
  min-height: 100dvh;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

body::before {
  content: '';
  position: fixed;
  inset: 0;
  background:
    url('../assets/card-texture.png') center / 512px repeat,
    radial-gradient(ellipse 80% 50% at 50% -10%, rgba(194, 65, 12, 0.06), transparent 60%),
    linear-gradient(180deg, var(--paper) 0%, var(--paper-deep) 100%);
  opacity: 0.55;
  pointer-events: none;
  z-index: -1;
}

.app {
  max-width: 420px;
  margin: 0 auto;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  padding: 20px 24px calc(28px + var(--safe-bottom));
}

/* Header */
.header {
  padding: 8px 0 24px;
}

.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--ink);
}

.logo__mark {
  flex-shrink: 0;
  color: var(--accent);
}

.logo__text {
  font-family: var(--font-display);
  font-size: 1.125rem;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.logo__text em {
  font-style: normal;
  color: var(--ink-soft);
  font-weight: 600;
}

/* Screens */
.screen {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 28px;
  animation: enter 0.4s cubic-bezier(0.22, 1, 0.36, 1);
}

.screen[hidden] {
  display: none !important;
}

@keyframes enter {
  from {
    opacity: 0;
    transform: translateY(16px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.eyebrow {
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 12px;
}

.screen-title {
  font-family: var(--font-display);
  font-size: 2rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.15;
  text-align: center;
  color: var(--ink);
}

/* Start */
.hero__art {
  display: block;
  width: min(240px, 62vw);
  height: auto;
  margin: 0 auto 8px;
  opacity: 0.95;
}

.hero__title {
  font-family: var(--font-display);
  font-size: clamp(2.5rem, 10vw, 3.25rem);
  font-weight: 700;
  letter-spacing: -0.04em;
  line-height: 1.05;
  margin-bottom: 28px;
  color: var(--ink);
}

.steps {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--surface);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

.steps li {
  position: relative;
  padding: 16px 16px 16px 44px;
  font-size: 0.9375rem;
  color: var(--ink-soft);
  border-bottom: 1px solid var(--line);
  counter-increment: step;
}

.steps li:last-child {
  border-bottom: none;
}

.steps {
  counter-reset: step;
}

.steps li::before {
  content: counter(step);
  position: absolute;
  left: 16px;
  top: 50%;
  transform: translateY(-50%);
  width: 20px;
  height: 20px;
  display: grid;
  place-items: center;
  font-size: 0.6875rem;
  font-weight: 700;
  color: var(--accent);
  background: var(--accent-soft);
  border-radius: var(--radius-full);
}

/* Round */
.round-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  padding-bottom: 4px;
}

.round-label {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--ink-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.round-progress {
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--ink);
}

.round-sep {
  color: var(--ink-muted);
  margin: 0 2px;
}

.word-slot {
  width: 100%;
  padding: 16px 18px 18px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
}

.word-slot__label {
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--ink-muted);
  margin-bottom: 12px;
  text-align: center;
}

.word-letters {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px;
  min-height: 52px;
  align-items: center;
}

.word-char {
  position: relative;
  width: 2.1rem;
  height: 2.75rem;
  flex-shrink: 0;
}

.word-char--space {
  width: 0.75rem;
}

.word-char__letter {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--accent);
  letter-spacing: -0.02em;
}

.word-char__cover {
  position: absolute;
  inset: 0;
  border-radius: 8px;
  background: var(--paper-deep);
  border: 1.5px solid var(--line);
  transition: transform 0.22s cubic-bezier(0.22, 1, 0.36, 1), opacity 0.22s ease;
}

.word-slot--revealed .word-char__cover {
  transform: translateY(-110%);
  opacity: 0;
}

.word-slot--revealed {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px rgba(194, 65, 12, 0.15), var(--shadow-md);
}

.stage {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
  padding: 32px 0 16px;
}

.hint {
  text-align: center;
  font-size: 0.875rem;
  color: var(--ink-muted);
  line-height: 1.55;
  max-width: 28ch;
  margin: 0 auto;
}

/* Buttons */
.btn {
  border: none;
  cursor: pointer;
  font-family: inherit;
  font-weight: 600;
  font-size: 1rem;
  border-radius: var(--radius-full);
  transition: background 0.15s ease, transform 0.12s ease, box-shadow 0.15s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  -webkit-user-select: none;
  user-select: none;
}

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

.btn--block {
  width: 100%;
  padding: 18px 24px;
}

.btn--primary {
  background: var(--accent);
  color: #fff;
  box-shadow: 0 2px 8px rgba(194, 65, 12, 0.25);
}

.btn--primary:hover {
  background: var(--accent-hover);
}

.btn--secondary {
  background: var(--surface);
  color: var(--ink);
  border: 1.5px solid var(--line);
  box-shadow: var(--shadow-sm);
}

.btn--secondary:hover {
  border-color: var(--ink-muted);
  background: var(--paper);
}

.btn--ghost {
  background: transparent;
  color: var(--ink-soft);
  border: 1px solid var(--line);
  padding: 8px 14px;
  font-size: 0.8125rem;
  border-radius: var(--radius-full);
}

.btn--ghost:hover {
  background: var(--surface);
  color: var(--ink);
}

.btn--peek {
  position: absolute;
  top: 0;
  right: 0;
}

.btn--speaker {
  position: relative;
  width: 168px;
  height: 168px;
  border-radius: 50%;
  background: var(--ink);
  color: #fff;
  flex-direction: column;
  gap: 10px;
  box-shadow: var(--shadow-md);
}

.btn--speaker:hover:not(:disabled) {
  background: #292524;
}

.btn--speaker:disabled {
  opacity: 0.7;
  cursor: wait;
}

.speaker-ring {
  position: absolute;
  inset: -8px;
  border-radius: 50%;
  border: 2px solid var(--accent);
  opacity: 0;
  transform: scale(0.95);
  transition: opacity 0.2s ease;
}

.btn--speaker.playing .speaker-ring {
  opacity: 1;
  animation: ringPulse 0.8s ease-out;
}

@keyframes ringPulse {
  0% { transform: scale(0.95); opacity: 0.8; }
  100% { transform: scale(1.08); opacity: 0; }
}

.btn--speaker.loading .speaker-icon {
  animation: spin 0.9s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.speaker-icon {
  display: flex;
  align-items: center;
  justify-content: center;
}

.speaker-label {
  font-size: 0.875rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  pointer-events: none;
}

/* Guessed / End */
.result-badge {
  width: 64px;
  height: 64px;
  margin: 0 auto;
  display: grid;
  place-items: center;
  color: var(--success);
  background: var(--success-soft);
  border-radius: 50%;
}

.guessed-label {
  text-align: center;
  font-size: 0.875rem;
  color: var(--ink-muted);
}

.guessed-word {
  font-family: var(--font-display);
  font-size: clamp(2.25rem, 9vw, 3rem);
  font-weight: 700;
  letter-spacing: -0.03em;
  text-align: center;
  padding: 24px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  width: 100%;
}

.end-desc {
  text-align: center;
  font-size: 1rem;
  color: var(--ink-soft);
  line-height: 1.6;
}

.end-desc strong {
  font-family: var(--font-display);
  font-weight: 700;
  color: var(--ink);
}

@media (max-height: 640px) {
  .btn--speaker {
    width: 140px;
    height: 140px;
  }

  .hero__title {
    font-size: 2.25rem;
    margin-bottom: 20px;
  }

  .stage {
    padding: 24px 0 8px;
  }
}
