@font-face {
  font-family: "Echo Nunito";
  src: url("../assets/art/fonts/Nunito-VF.ttf") format("truetype");
  font-style: normal;
  font-weight: 300 900;
  font-display: swap;
}

.game-screen {
  position: absolute;
  inset: 0;
  overflow: hidden;
  isolation: isolate;
  color: var(--eg-text, #3a2b22);
  font-family: "Echo Nunito", Nunito, system-ui, sans-serif;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}
.game-screen[data-world="1"] { --game-text: #3a2b22; --game-text-2: #6e5646; --game-surface: #fff; --game-accent: #c4452b; --game-on-accent: #fff; --game-shadow: 0 6px 16px rgba(138,75,31,.22); --game-scrim: rgba(42,30,23,.5); }
.game-screen[data-world="2"] { --game-text: #1f3a28; --game-text-2: #46634f; --game-surface: #fff; --game-accent: #2f7d45; --game-on-accent: #fff; --game-shadow: 0 6px 16px rgba(47,90,42,.22); --game-scrim: rgba(21,41,28,.5); }
.game-screen[data-world="3"] { --game-text: #f1f2ff; --game-text-2: #bfc4ee; --game-surface: #2d3566; --game-accent: #8fb4ff; --game-on-accent: #0f1330; --game-shadow: 0 6px 16px rgba(0,0,0,.45); --game-scrim: rgba(7,9,24,.5); }
.game-screen[data-world="4"] { --game-text: #3a2547; --game-text-2: #6b5478; --game-surface: #fff; --game-accent: #a8447a; --game-on-accent: #fff; --game-shadow: 0 6px 16px rgba(90,50,110,.22); --game-scrim: rgba(40,22,52,.5); }
.game-screen[data-world="5"] { --game-text: #173a44; --game-text-2: #3d616c; --game-surface: #fff; --game-accent: #1f7385; --game-on-accent: #fff; --game-shadow: 0 6px 16px rgba(25,80,100,.22); --game-scrim: rgba(14,37,44,.5); }
.game-screen[data-world="6"] { --game-text: #3d2716; --game-text-2: #6e4f35; --game-surface: #fff; --game-accent: #9c4a1e; --game-on-accent: #fff; --game-shadow: 0 6px 16px rgba(120,70,20,.22); --game-scrim: rgba(40,25,13,.5); }
.game-screen[data-world="7"] { --game-text: #1e2b3e; --game-text-2: #4a5a71; --game-surface: #fff; --game-accent: #3a659a; --game-on-accent: #fff; --game-shadow: 0 6px 16px rgba(40,60,100,.2); --game-scrim: rgba(17,26,40,.5); }
.game-screen[data-world="8"] { --game-text: #eafbf6; --game-text-2: #b2d6d0; --game-surface: #21495a; --game-accent: #6fddbe; --game-on-accent: #0a1a22; --game-shadow: 0 6px 16px rgba(0,0,0,.45); --game-scrim: rgba(4,16,15,.5); }
.game-canvas {
  position: absolute;
  inset: 0 auto auto 0;
  display: block;
  max-width: none;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}
.game-safe-area-probe {
  position: absolute;
  z-index: -1;
  width: 0;
  height: 0;
  /* Logical-px safe insets published by app.js on .eg-stage (0 when absent, e.g. desktop). */
  padding: var(--eg-inset-top, 0px) var(--eg-inset-right, 0px) var(--eg-inset-bottom, 0px) var(--eg-inset-left, 0px);
  visibility: hidden;
  pointer-events: none;
}
.game-hud { position: absolute; inset: 0; pointer-events: none; color: var(--game-text); }
.game-topbar { position: absolute; inset: 0 0 auto; height: 0; pointer-events: none; }
.game-level-title {
  position: absolute;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  color: var(--game-text);
  text-align: center;
  pointer-events: none;
}
.game-level-id { font-size: 48px; font-weight: 700; line-height: 1.3; color: var(--game-text-2); }
.game-level-name { width: 100%; overflow: hidden; font-size: 60px; font-weight: 700; line-height: 1.3; text-overflow: ellipsis; white-space: nowrap; }
.game-tip {
  position: absolute;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  color: var(--game-text-2);
  font-size: 60px;
  font-weight: 700;
  line-height: 1.15;
  text-align: center;
  white-space: nowrap;
  text-overflow: ellipsis;
  pointer-events: none;
}
.game-tip[hidden] { display: none; }
.game-dots {
  position: absolute;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--dot-gap, 28px);
  transform: translate(-50%, -50%);
  pointer-events: none;
}
.game-dot {
  position: relative;
  display: block;
  flex: 0 0 var(--dot-size, 64px);
  width: var(--dot-size, 64px);
  height: var(--dot-size, 64px);
  border: 6px solid color-mix(in srgb, var(--game-text-2), transparent 40%);
  border-radius: 50%;
  box-sizing: border-box;
  transform: scale(var(--dot-scale, 1));
  transition: border-color .12s ease, border-width .12s ease;
}
.game-dot::before {
  position: absolute;
  inset: 0;
  content: "";
  border-radius: 50%;
  background: var(--dot-color, transparent);
  opacity: var(--dot-fill, 0);
}
.game-dot::after {
  position: absolute;
  inset: calc(var(--dot-size, 64px) * .125);
  content: "";
  border-radius: 50%;
  background-color: var(--dot-shape-color, transparent);
  -webkit-mask: var(--dot-icon, none) center / calc(var(--dot-size, 64px) * .5625) calc(var(--dot-size, 64px) * .5625) no-repeat;
  mask: var(--dot-icon, none) center / calc(var(--dot-size, 64px) * .5625) calc(var(--dot-size, 64px) * .5625) no-repeat;
  opacity: var(--dot-icon-opacity, 0);
}
.game-dot.is-next { border: 8px solid var(--game-text); }
.game-dot.is-hidden { display: none; }
/* Song levels: "+N" for the notes still to find. */
.game-dot-more {
  flex: 0 0 auto;
  margin-left: 4px;
  color: var(--game-text-2);
  font-size: 44px;
  font-weight: 800;
  line-height: 1;
  white-space: nowrap;
}
.game-icon-button,
.game-listen {
  position: absolute;
  display: grid;
  place-items: center;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--game-text);
  cursor: pointer;
  pointer-events: auto;
  -webkit-appearance: none;
  appearance: none;
  touch-action: manipulation;
}
.game-icon-button { width: 160px; height: 160px; }
.game-icon-button::before {
  position: absolute;
  width: 128px;
  height: 128px;
  border-radius: 50%;
  background: var(--game-surface);
  box-shadow: var(--game-shadow);
  content: "";
  transition: transform .08s ease;
}
.game-icon-button img { position: relative; width: 64px; height: 64px; filter: brightness(0) saturate(100%) opacity(.9); }
.game-screen[data-world="3"] .game-icon-button:not(.game-action) img,
.game-screen[data-world="8"] .game-icon-button:not(.game-action) img { filter: brightness(0) invert(1); }
.game-icon-button:active::before { transform: scale(.94); }
.game-icon-button:disabled, .game-listen:disabled { cursor: default; opacity: .45; }
.game-icon-button:focus-visible, .game-listen:focus-visible, .game-pill:focus-visible { outline: 6px solid color-mix(in srgb, var(--game-accent), transparent 25%); outline-offset: 5px; }
.game-listen {
  width: 248px;
  height: 248px;
  background: transparent;
}
.game-listen::before {
  position: absolute;
  width: 216px;
  height: 216px;
  border-radius: 50%;
  background: var(--game-accent);
  box-shadow: var(--game-shadow);
  content: "";
  transition: transform .08s ease;
}
.game-listen img { position: relative; width: 104px; height: 104px; filter: brightness(0) invert(1); }
.game-screen[data-world="8"] .game-listen img { filter: brightness(0) opacity(.88); }
.game-screen[data-world="3"] .game-listen img { filter: brightness(0) saturate(100%) invert(7%) sepia(24%) saturate(3276%) hue-rotate(208deg) brightness(87%) contrast(96%); }
.game-listen:active::before { transform: scale(.94); }
.game-listen.is-pulsing::after {
  position: absolute;
  width: 216px;
  height: 216px;
  border: 10px solid var(--game-accent);
  border-radius: 50%;
  content: "";
  animation: game-listen-ring .35s ease-out both;
}
@keyframes game-listen-ring { from { transform: scale(1); opacity: .6; } to { transform: scale(1.25); opacity: 0; } }
.game-modal-layer { position: absolute; inset: 0; display: grid; place-items: center; pointer-events: auto; }
.game-modal-layer[hidden] { display: none; }
.game-scrim { position: absolute; inset: 0; background: var(--game-scrim); }
.game-dialog {
  position: relative;
  z-index: 1;
  display: flex;
  width: min(936px, calc(100% - 112px));
  max-height: calc(100% - 160px);
  flex-direction: column;
  align-items: center;
  gap: 40px;
  overflow-y: auto;
  padding: 64px;
  border-radius: 56px;
  box-sizing: border-box;
  background: var(--game-surface);
  box-shadow: var(--game-shadow);
  color: var(--game-text);
  text-align: center;
  animation: game-dialog-in .3s cubic-bezier(.16,1,.3,1) both;
}
.game-dialog[aria-label="Paused"] { gap: 40px; animation-duration: .2s; }
.game-dialog h2 { margin: 0; color: var(--game-text); font-size: 96px; font-weight: 900; line-height: 1.1; }
.game-dialog-caption { max-width: 100%; max-height: 2.6em; margin: 0; overflow: hidden; color: var(--game-text-2); font-size: 48px; font-weight: 700; line-height: 1.3; }
.game-pill {
  display: flex;
  width: min(600px, 100%);
  min-height: 144px;
  flex: 0 0 auto;
  align-items: center;
  justify-content: center;
  padding: 20px 48px;
  border: 0;
  border-radius: 72px;
  box-sizing: border-box;
  box-shadow: var(--game-shadow);
  color: var(--game-text);
  font: 700 60px/1.15 "Echo Nunito", Nunito, system-ui, sans-serif;
  cursor: pointer;
  touch-action: manipulation;
  transition: transform .1s ease, filter .1s ease;
}
.game-pill:active { transform: scale(.96); filter: brightness(.94); }
.game-pill-primary { background: var(--game-accent); color: var(--game-on-accent); font-weight: 800; }
.game-pill-secondary { background: var(--game-surface); color: var(--game-text); font-weight: 700; }
.game-action-row { display: flex; align-items: flex-start; justify-content: center; gap: 64px; }
.game-action-column { display: flex; flex-direction: column; align-items: center; gap: 16px; color: var(--game-text-2); font-size: 48px; font-weight: 700; }
.game-action { position: relative; inset: auto; }
.game-action img { filter: brightness(0) saturate(100%) opacity(.85); }
.game-screen[data-world="3"] .game-action img,
.game-screen[data-world="8"] .game-action img { filter: brightness(0) invert(1); }
.game-no-slide { animation-name: game-dialog-fade !important; }
.game-reduce-motion *, .game-reduce-motion *::before, .game-reduce-motion *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
@keyframes game-dialog-in { from { opacity: 0; transform: translateY(80px); } to { opacity: 1; transform: translateY(0); } }
@keyframes game-dialog-fade { from { opacity: 0; } to { opacity: 1; } }

/* Verses (world 4): pips. Solved pips are buttons: tap one to redraw that verse (docs/verses-spec.md 4.2). */
.game-pips {
  position: absolute;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0;
  transform: translate(-50%, -50%);
  pointer-events: none;
}
/* The button is a 144x132 touch target (about 48x44 CSS px on a phone); the capsule inside is what is drawn. */
.game-pip {
  position: relative;
  display: block;
  width: 144px;
  height: 132px;
  margin: 0;
  padding: 0;
  border: 0;
  background: none;
  pointer-events: none;
  -webkit-tap-highlight-color: transparent;
}
.game-pip:not(:disabled) { pointer-events: auto; cursor: pointer; }
.game-pip::before {
  position: absolute;
  top: 58px;
  left: 44px;
  width: 56px;
  height: 16px;
  border: 3px solid transparent;
  border-radius: 8px;
  box-sizing: border-box;
  background: color-mix(in srgb, var(--game-text-2), transparent 55%);
  content: "";
  transition: background-color .25s ease, border-color .25s ease, transform .2s ease;
}
.game-pip:focus-visible { outline: 6px solid color-mix(in srgb, var(--game-accent), transparent 25%); outline-offset: -10px; border-radius: 24px; }
/* solved */
.game-pip.is-done::before { border-color: var(--game-accent); background: var(--game-accent); }
.game-pip.is-done:not(:disabled):active::before { transform: scale(.92); }
/* the furthest verse, being traced */
.game-pip.is-current::before { border-color: var(--game-accent); background: transparent; animation: game-pip-breathe 1.6s ease-in-out infinite; }
/* a solved verse being redrawn: tinted fill, taller, steady */
.game-pip.is-editing::before { border-color: var(--game-accent); background: color-mix(in srgb, var(--game-accent), transparent 62%); transform: scaleY(1.45); }
/* the furthest verse while another is edited: dashed "tap to go back" outline */
.game-pip.is-return::before { border: 3px dashed var(--game-accent); background: transparent; }
/* a solved verse standing in the way of a later one: pulsing ring */
.game-pip.is-blocker::before { border-color: var(--game-accent); background: var(--game-accent); animation: game-pip-alert 1.2s ease-out infinite; }
.game-pip.is-pulsing::before { animation: game-pip-alert .6s ease-out; }
@keyframes game-pip-breathe { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.08); } }
@keyframes game-pip-alert {
  0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--game-accent), transparent 35%); }
  100% { box-shadow: 0 0 0 16px color-mix(in srgb, var(--game-accent), transparent 100%); }
}
.game-reduce-motion .game-pip.is-current::before { animation: none; }
.game-reduce-motion .game-pip.is-blocker::before,
.game-reduce-motion .game-pip.is-pulsing::before { animation: none; box-shadow: 0 0 0 7px color-mix(in srgb, var(--game-accent), transparent 55%); }

/* First-run guidance: the Listen button breathes until the tune has been heard */
.game-listen.is-coach::after {
  position: absolute;
  width: 216px;
  height: 216px;
  border: 10px solid var(--game-accent);
  border-radius: 50%;
  content: "";
  animation: game-listen-ring 1.3s ease-out infinite;
}
.game-reduce-motion .game-listen.is-coach::after { animation: none; opacity: .7; transform: scale(1.12); }

/* C3 duet: "Undo voice 1" sits in the top bar's title slot while voice 2 is traced. */
.game-undo-voice { position: absolute; z-index: 3; width: auto; min-height: 112px; padding: 12px 36px; font-size: 48px; pointer-events: auto; }
.game-undo-voice[hidden] { display: none; }
/* Verse levels: a quiet round icon button beside the speaker - curved arrow only, never competing with Listen. */
.game-undo-voice.is-verse {
  display: inline-flex;
  min-width: 104px;
  min-height: 104px;
  padding: 0;
  border-radius: 50%;
  border: 4px solid color-mix(in srgb, var(--game-text-2), transparent 70%);
  transition: transform .08s ease;
}
.game-undo-voice.is-verse::before {
  width: 52px;
  height: 52px;
  flex: none;
  background: currentColor;
  content: "";
  -webkit-mask: var(--undo-icon) center / contain no-repeat;
  mask: var(--undo-icon) center / contain no-repeat;
  --undo-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M9 14 4 9l5-5'/%3E%3Cpath d='M4 9h10.5a5.5 5.5 0 0 1 0 11H11'/%3E%3C/svg%3E");
}
.game-undo-voice.is-verse.is-back::before { transform: scaleX(-1); }
.game-undo-voice.is-verse:active { transform: scale(.95); }
.game-undo-voice.is-verse.is-alert { border-color: var(--game-accent); }
/* Verse levels: on a dead end the "Undo verse N" button breathes to point the way out. */
.game-undo-voice.is-alert { animation: game-undo-alert 1.2s ease-in-out infinite; }
@keyframes game-undo-alert { 50% { transform: scale(1.06); } }
@media (prefers-reduced-motion: reduce) { .game-undo-voice.is-alert { animation: none; } }
