/* Header */
.header {
  display: flex;
  align-items: center;
  justify-content: center;
  height: var(--header-height);
  padding: 0 16px;
  flex-shrink: 0;
  z-index: 10;
  border-bottom: 1px solid var(--border-light);
  position: relative;
}

.header__logo {
  height: calc(var(--header-height) - 20px);
  width: auto;
  object-fit: contain;
}

.header__reset {
  position: absolute;
  right: 16px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 14px;
  line-height: 1;
  color: var(--text-muted);
  opacity: 0.35;
  background: none;
  border: none;
  padding: 6px;
  cursor: pointer;
  transition: opacity 0.2s;
}

.header__reset:hover {
  opacity: 0.8;
}

/* Screens */
.screen {
  position: absolute;
  inset: 0;
  top: var(--header-height);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px var(--canvas-margin);
  padding-bottom: calc(24px + var(--safe-bottom));
  opacity: 0;
  visibility: hidden;
  transform: translateY(12px);
  transition: opacity 0.35s ease, transform 0.35s ease, visibility 0.35s;
  will-change: opacity, transform;
  overflow-y: auto;
}

body[data-screen="ALREADY_PLAYED"] .screen--already-played,
body[data-screen="INTRO"] .screen--intro,
body[data-screen="READY"] .screen--game,
body[data-screen="DRAWING"] .screen--game,
body[data-screen="EVALUATING"] .screen--game,
body[data-screen="RESULT"] .screen--game,
body[data-screen="INVALID"] .screen--game,
body[data-screen="EDUCATIONAL"] .screen--educational,
body[data-screen="PRIZE"] .screen--prize {
  opacity: 1;
  visibility: visible;
  transform: none;
}

/* Game screen */
.game__top-bar {
  display: flex;
  flex-direction: column;
  align-items: center;
  position: relative;
  width: 100%;
  z-index: 2;
  flex-shrink: 0;
}

.wordmark {
  margin: 0 auto;
  line-height: 0;
}

.wordmark img {
  display: block;
  width: 100%;
  height: auto;
}

.wordmark--intro {
  width: min(86vw, 380px);
  margin-bottom: 16px;
}

.wordmark--game {
  width: min(72vw, 300px);
  margin-bottom: 16px;
}

.game__canvas-area {
  position: relative;
  flex: 1;
  width: 100%;
  max-width: 400px;
  display: flex;
  align-items: center;
  justify-content: center;
  touch-action: none;
}

.game__canvas-glow,
.game__canvas-main {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.game__canvas-glow {
  filter: blur(12px);
  opacity: 0.4;
  pointer-events: none;
}

.game__rings {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.game__guide {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.game__guide-ring {
  opacity: 0;
  transition: opacity 0.3s ease;
}

.game__guide-ring.is-active {
  opacity: 0.55;
}

.intro__guide-area {
  width: min(70vw, 320px);
  aspect-ratio: 1;
  margin: 8px auto 32px;
}

.intro__guide {
  width: 100%;
  height: 100%;
}

.game__score {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: var(--score-font-size);
  font-weight: 900;
  z-index: 4;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.3s ease;
  color: var(--text-primary);
  text-shadow: var(--glow-score);
}

body[data-screen="RESULT"] .game__score,
body[data-screen="EVALUATING"] .game__score {
  opacity: 1;
}

.game__hint {
  font-size: 15px;
  font-weight: var(--font-medium);
  color: #ffffff;
  text-align: center;
  margin-bottom: 12px;
  z-index: 2;
  transition: opacity 0.3s;
  flex-shrink: 0;
}

body[data-screen="DRAWING"] .game__hint,
body[data-screen="EVALUATING"] .game__hint,
body[data-screen="RESULT"] .game__hint {
  opacity: 0;
}

.game__bottom-buttons {
  position: absolute;
  bottom: calc(24px + max(var(--safe-bottom), 16px));
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  z-index: 10;
}

.game__attempts {
  font-size: 13px;
  color: var(--text-muted);
  text-align: center;
}

.game__invalid-msg {
  position: absolute;
  bottom: 100px;
  left: 50%;
  transform: translateX(-50%);
  background: #ffffff;
  border-radius: var(--btn-radius);
  padding: 12px 20px;
  font-size: 15px;
  font-weight: var(--font-bold);
  text-align: center;
  color: var(--hera-magenta);
  opacity: 0;
  transition: opacity 0.3s;
  z-index: 5;
  pointer-events: none;
  white-space: nowrap;
}

body[data-screen="INVALID"] .game__invalid-msg {
  opacity: 1;
}

/* Educational screen */
.educational__best-score-label {
  font-size: 15px;
  font-weight: var(--font-medium);
  color: var(--text-primary);
  text-align: center;
  margin-bottom: 8px;
}

.educational__best-score-value {
  font-family: var(--font-primary);
  font-size: clamp(72px, 22vw, 140px);
  font-weight: var(--font-bold);
  text-align: center;
  line-height: 1;
  margin-bottom: 24px;
  color: #ffffff;
}

.educational__eyebrow {
  font-size: 14px;
  color: #ffffff;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-bottom: 12px;
}

.educational__body {
  font-size: clamp(20px, 5.5vw, 26px);
  font-weight: var(--font-bold);
  text-align: center;
  line-height: 1.4;
  color: var(--text-primary);
  max-width: 380px;
  margin-bottom: 32px;
}

.educational__cta-text {
  font-size: 15px;
  font-weight: var(--font-medium);
  color: var(--hera-magenta);
  text-align: center;
  margin-bottom: 32px;
}

/* Prize screen */
.prize__title {
  font-size: clamp(24px, 7vw, 36px);
  font-weight: var(--font-bold);
  text-align: center;
  margin-bottom: 8px;
  color: var(--text-primary);
}

.prize__text {
  font-size: clamp(22px, 6.5vw, 30px);
  font-weight: var(--font-bold);
  line-height: 1.25;
  text-align: center;
  max-width: 340px;
  margin-bottom: 20px;
  color: var(--text-primary);
}

.prize__image-wrap {
  position: relative;
  width: clamp(220px, 66vw, 320px);
  height: clamp(220px, 66vw, 320px);
  margin-bottom: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #ffffff;
  border-radius: 50%;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.3);
}

.prize__image-glow {
  position: absolute;
  inset: -20px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(230, 0, 126, 0.1) 0%, transparent 70%);
  animation: prize-glow-pulse 2s ease-in-out infinite;
}

.prize__image {
  position: relative;
  width: 78%;
  height: 78%;
  object-fit: contain;
  z-index: 1;
}

.prize__best-score {
  font-size: 15px;
  color: var(--text-secondary);
  margin-bottom: 16px;
}

.prize__code {
  font-family: var(--font-primary);
  font-size: clamp(40px, 12vw, 56px);
  font-weight: var(--font-bold);
  letter-spacing: 0.12em;
  line-height: 1;
  color: var(--hera-magenta);
  background: #ffffff;
  border-radius: var(--btn-radius);
  padding: 18px 28px 18px calc(28px + 0.12em);
  margin-bottom: 12px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25);
}

.prize__code-hint {
  font-size: 15px;
  font-weight: var(--font-bold);
  color: var(--text-primary);
  margin-bottom: 32px;
}

.prize__save-hint {
  font-size: 12px;
  color: var(--text-muted);
  text-align: center;
  margin-top: 8px;
}

.prize__thanks {
  font-size: 18px;
  font-weight: var(--font-bold);
  color: var(--text-primary);
  text-align: center;
  margin-top: 24px;
}

.prize__waiting {
  font-size: 15px;
  color: var(--text-secondary);
  text-align: center;
  margin-top: 8px;
}

/* Intro screen */
.intro__title {
  font-size: clamp(28px, 8vw, 42px);
  font-weight: 900;
  text-align: center;
  margin-bottom: 16px;
  line-height: 1.1;
  color: var(--text-primary);
}

.intro__subtitle {
  font-size: 16px;
  color: var(--text-secondary);
  text-align: center;
  margin-bottom: 48px;
}

/* Already played */
.already-played__prize {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-top: 12px;
}

.already-played__prize-image-wrap {
  width: clamp(110px, 32vw, 150px);
  height: clamp(110px, 32vw, 150px);
  display: flex;
  align-items: center;
  justify-content: center;
  background: #ffffff;
  border-radius: 50%;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25);
  margin-bottom: 10px;
}

.already-played__prize-image {
  width: 78%;
  height: 78%;
  object-fit: contain;
}

.already-played__prize-label {
  font-size: 18px;
  font-weight: var(--font-bold);
  color: var(--text-primary);
  text-align: center;
}

.already-played__score {
  font-size: clamp(28px, 8vw, 40px);
  font-weight: var(--font-bold);
  color: var(--text-primary);
  margin: 12px 0 14px;
}

.already-played__code {
  font-family: var(--font-primary);
  font-size: clamp(32px, 9vw, 44px);
  font-weight: var(--font-bold);
  letter-spacing: 0.12em;
  line-height: 1;
  color: var(--hera-magenta);
  background: #ffffff;
  border-radius: var(--btn-radius);
  padding: 14px 22px 14px calc(22px + 0.12em);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25);
  margin-bottom: 12px;
}

.already-played__hint {
  font-size: 15px;
  font-weight: var(--font-bold);
  color: var(--text-primary);
  text-align: center;
  max-width: 300px;
  line-height: 1.5;
}

.already-played__warning {
  font-size: 15px;
  font-weight: var(--font-bold);
  color: var(--hera-magenta);
  text-align: center;
  max-width: 300px;
  line-height: 1.5;
  margin-top: 20px;
  padding: 14px 18px;
  background: #ffffff;
  border-radius: var(--btn-radius);
}

.btn-save-image {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  height: var(--btn-height);
  min-width: 240px;
  padding: 0 28px;
  margin-top: 16px;
  border: none;
  border-radius: var(--btn-radius);
  background: var(--hera-magenta);
  color: #ffffff;
  font-family: inherit;
  font-size: 15px;
  font-weight: var(--font-bold);
  cursor: pointer;
  transition: transform 0.15s ease, opacity 0.2s ease;
}

.btn-save-image:active { transform: scale(0.97); }
.btn-save-image:disabled { opacity: 0.6; cursor: default; }

.btn-save-image__icon {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
}
