/* Eloria — Despierta la isla. Palette and shapes taken from the card art: painted
   sky and sea, cream parchment framed in soft honey gold, vines, warm brown text.
   The art has no outlines, so nothing here does either: edges come from soft warm
   shadows and painted gold frames. */
/* Fonts are served from this site (SIL Open Font License, see fonts/): no request
   leaves for Google or anyone else. */
@font-face { font-family: "Atkinson Hyperlegible"; font-weight: 400; font-style: normal; font-display: swap;
  src: url("fonts/atkinson-hyperlegible-latin-400-normal.woff2") format("woff2"); }
@font-face { font-family: "Atkinson Hyperlegible"; font-weight: 700; font-style: normal; font-display: swap;
  src: url("fonts/atkinson-hyperlegible-latin-700-normal.woff2") format("woff2"); }
@font-face { font-family: "Baloo 2"; font-weight: 600; font-style: normal; font-display: swap;
  src: url("fonts/baloo-2-latin-600-normal.woff2") format("woff2"); }
@font-face { font-family: "Baloo 2"; font-weight: 700; font-style: normal; font-display: swap;
  src: url("fonts/baloo-2-latin-700-normal.woff2") format("woff2"); }
@font-face { font-family: "Baloo 2"; font-weight: 800; font-style: normal; font-display: swap;
  src: url("fonts/baloo-2-latin-800-normal.woff2") format("woff2"); }

:root {
  --sky-top: #3f9fe0;
  --sky-mid: #6cc9f1;
  --sky-low: #c9f0fd;
  --parchment: #fff6de;
  --parchment-deep: #fbe7b8;
  --teal: #1f9e9a;
  --teal-deep: #0c6468;
  --gold: #f3b53f;
  --gold-deep: #c98316;
  --leaf: #69ad3c;
  --ink: #3b2c1e;         /* warm brown, like the card text: 12.6:1 on parchment */
  --ink-soft: #6a5440;
  --highlight: rgba(243, 181, 63, 0.55);
  /* Honey gold, painted rather than polished: the card frames' colour. */
  --gold-frame: linear-gradient(160deg, #fde9ac, #e9b955 45%, #c88f38);
  --soft-shadow: 0 6px 14px rgba(110, 70, 20, 0.22), 0 2px 4px rgba(110, 70, 20, 0.16);
  --soft-shadow-pressed: 0 2px 5px rgba(110, 70, 20, 0.22);
  /* Four-point sparkles, like the stars on the IA card: light, never grime. */
  --sparkle: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'%3E%3Ccircle cx='10' cy='10' r='5' fill='white' opacity='0.35'/%3E%3Cpath d='M10 0C10.7 6.3 13.7 9.3 20 10C13.7 10.7 10.7 13.7 10 20C9.3 13.7 6.3 10.7 0 10C6.3 9.3 9.3 6.3 10 0Z' fill='white'/%3E%3C/svg%3E");
  --sparkle-small: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'%3E%3Cpath d='M10 0C10.7 6.3 13.7 9.3 20 10C13.7 10.7 10.7 13.7 10 20C9.3 13.7 6.3 10.7 0 10C6.3 9.3 9.3 6.3 10 0Z' fill='white' opacity='0.8'/%3E%3C/svg%3E");
  --shadow: 0 10px 28px rgba(14, 76, 110, 0.28), 0 3px 8px rgba(14, 76, 110, 0.18);
  --radius: 30px;
  --font-display: "Baloo 2", "Atkinson Hyperlegible", system-ui, sans-serif;
  --font-text: "Atkinson Hyperlegible", system-ui, -apple-system, sans-serif;
  color-scheme: light;
}

* { box-sizing: border-box; }
html { -webkit-tap-highlight-color: transparent; }
body {
  margin: 0;
  min-height: 100dvh;
  font-family: var(--font-text);
  color: var(--ink);
  /* Shown until (or instead of, without WebGL) the procedural sky. */
  background:
    radial-gradient(ellipse 90% 45% at 50% -8%, rgba(255, 238, 180, 0.55), rgba(255, 238, 180, 0) 70%) fixed,
    linear-gradient(180deg, var(--sky-top) 0%, var(--sky-mid) 50%, var(--sky-low) 100%) fixed;
  overflow-x: hidden;
}
button { font: inherit; color: inherit; cursor: pointer; }
.sr-only {
  position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
:focus-visible { outline: 4px solid var(--ink); outline-offset: 3px; border-radius: 14px; }
/* Headings get focus when a screen changes (for screen readers); no ring needed there. */
[tabindex="-1"]:focus { outline: none; }

/* ------------------------------------------------------------ sky + motes */
.clouds { position: fixed; inset: 0; z-index: -2; pointer-events: none; overflow: hidden; }
.cloud {
  position: absolute; left: 0; background: no-repeat center / contain;
  will-change: transform; animation: drift linear infinite;
}
@keyframes drift { from { transform: translateX(-100%); } to { transform: translateX(100vw); } }
.motes { position: fixed; inset: 0; z-index: -1; pointer-events: none; overflow: hidden; }
.mote {
  position: absolute; bottom: -12px; width: 7px; height: 7px; border-radius: 50%;
  background: radial-gradient(circle, #fff9d6 0%, #ffd56b 45%, rgba(255, 213, 107, 0) 72%);
  filter: blur(0.3px);
  animation: rise linear infinite;
  opacity: 0;
}
@keyframes rise {
  0% { transform: translate(0, 0) scale(0.6); opacity: 0; }
  12% { opacity: 0.95; }
  50% { transform: translate(var(--dx), -55vh) scale(1); }
  88% { opacity: 0.85; }
  100% { transform: translate(calc(var(--dx) * -0.6), -108vh) scale(0.7); opacity: 0; }
}

/* ----------------------------------------------------------------- layout */
#app { max-width: 560px; margin: 0 auto; padding: 0 16px calc(28px + env(safe-area-inset-bottom)); }
.view[hidden] { display: none !important; }
.view { animation: viewIn 0.45s cubic-bezier(.2, .8, .3, 1); }
@keyframes viewIn { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }

/* Painted banner: the top of the box cover, with its title lettering, melting
   into the sky. (No separate transparent logo exists yet.) */
.banner {
  position: relative;
  margin: 0 -16px;
  height: clamp(180px, 36vh, 300px);
  overflow: hidden;
  -webkit-mask-image: linear-gradient(180deg, #000 62%, transparent 100%);
          mask-image: linear-gradient(180deg, #000 62%, transparent 100%);
}
.banner-art { width: 100%; height: 100%; object-fit: cover; object-position: 50% 4%; display: block; }

/* ------------------------------------------------------------------ panel */
.panel {
  position: relative;
  background:
    radial-gradient(120% 80% at 50% 0%, rgba(255, 255, 255, 0.65), rgba(255, 255, 255, 0) 60%) padding-box,
    linear-gradient(var(--parchment), var(--parchment)) padding-box,
    var(--gold-frame) border-box;
  border: 5px solid transparent;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 26px 20px 22px;
}
/* Leafy vines on two corners, like the card frames. */
.panel::before, .panel::after {
  content: ""; position: absolute; width: 74px; height: 74px; pointer-events: none;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 80 80'%3E%3Cpath d='M6 74C14 50 30 30 60 12' fill='none' stroke='%23458f2c' stroke-width='3' stroke-linecap='round'/%3E%3Cpath d='M18 52c-10-2-14-9-14-16 8 0 14 5 14 16z' fill='%2369ad3c'/%3E%3Cpath d='M30 36c-2-10 3-17 10-20 3 7 1 15-10 20z' fill='%2380c24a'/%3E%3Cpath d='M44 24c4-9 12-12 20-11-2 8-8 13-20 11z' fill='%2369ad3c'/%3E%3Cpath d='M24 46c8-5 16-4 21 1-6 6-15 6-21-1z' fill='%2394d15a'/%3E%3C/svg%3E") no-repeat center / contain;
}
.panel::before { left: -18px; bottom: -18px; }
.panel::after { right: -18px; top: -18px; transform: rotate(180deg); }

.panel-title {
  margin: 0 0 18px;
  text-align: center;
  font: 800 clamp(1.7rem, 7vw, 2.2rem) / 1 var(--font-display);
  letter-spacing: 0.04em;
  color: var(--teal-deep);
  text-shadow: 0 2px 0 rgba(255, 255, 255, 0.8);
}
.menu-panel { margin-top: -28px; }

/* ------------------------------------------------------------- language */
.lang-row {
  display: grid; grid-template-columns: 52px 1fr; grid-template-areas: "icon label" "toggle toggle";
  align-items: center; gap: 8px 12px; margin-bottom: 18px;
}
.lang-row .lang-icon { grid-area: icon; }
.lang-row .lang-label { grid-area: label; }
.lang-row .lang-toggle { grid-area: toggle; }
.lang-icon { color: var(--teal-deep); width: 52px; height: 52px; }
.lang-icon svg { width: 100%; height: 100%; }
.lang-label { font: 700 1.15rem var(--font-display); color: var(--ink-soft); }
.lang-toggle {
  display: grid; grid-template-columns: 1fr 1fr; padding: 5px; gap: 4px;
  background: #f7e8c2; border-radius: 18px;
  box-shadow: inset 0 2px 5px rgba(160, 120, 50, 0.22);
}
.lang-btn {
  min-height: 52px; padding: 0 14px; border: 0; border-radius: 12px;
  background: transparent; font: 700 1.05rem var(--font-display); color: var(--ink-soft);
  transition: background 0.2s, color 0.2s, transform 0.15s;
}
.lang-btn[aria-pressed="true"] {
  --chip: polygon(10px 0, 56% 2px, calc(100% - 12px) 0, 100% 12px, calc(100% - 2px) calc(100% - 10px),
                  calc(100% - 13px) 100%, 40% calc(100% - 2px), 11px 100%, 0 calc(100% - 12px), 2px 11px);
}
.lang-btn:active { transform: translateY(2px); }

/* ------------------------------------------------------------ chipped stone */
/* Every button is a chipped stone, in the soft pastels of the art: an irregular
   chiselled outline, a pale bevelled rim, a smooth face with light coming through
   from below (sea glass, moonstone), a few faint chip planes and a sparkle. Smooth,
   no dark edges; shadows are soft and sea-tinted, and the stones that matter most
   glow gold like Sonqo's heart.
   The shape is cut out of two layers behind the content (::before = rim, ::after =
   face), so the button itself keeps a plain box for focus rings and taps, and its
   drop-shadow follows the chipped outline. :where() keeps these defaults at zero
   specificity, so each button's own shape and colour rules below always win.
   Text and icons use each stone's own deep tone: 4.7:1 or more on every face. */
:where(.listen-item, .scan-cta, .icon-btn, .round-btn, .pill-btn, .lang-btn[aria-pressed="true"], .gem) {
  /* butter honey, the default */
  --rim-hi: #fbe9b9; --rim-lo: #c9963a; --face-hi: #fdf0cc; --face: #f8dd9a; --face-lo: #ecc56c;
  --plane-lo: rgba(170, 115, 30, 0.16); --stone-ink: #553608; --glow: rgba(255, 164, 40, 0.9);
  --bevel: 4px;
  --chip: polygon(30% 2%, 58% 0, 81% 8%, 96% 27%, 100% 52%, 94% 76%, 77% 94%, 51% 100%, 25% 96%, 7% 79%, 0 52%, 6% 24%);
  --spark-1: 24% 20%; --spark-2: 72% 74%; --spark-size: 13px;
  --shadow-stone: drop-shadow(0 5px 9px rgba(30, 100, 120, 0.28)) drop-shadow(0 1px 1px rgba(30, 100, 120, 0.2));
  position: relative; isolation: isolate; border: 0; background: none;
  filter: var(--shadow-stone);
}
:is(.listen-item, .scan-cta, .icon-btn, .round-btn, .pill-btn, .lang-btn[aria-pressed="true"], .gem) { color: var(--stone-ink); }
:where(.listen-item, .scan-cta, .icon-btn, .round-btn, .pill-btn, .lang-btn[aria-pressed="true"], .gem)::before,
:where(.listen-item, .scan-cta, .icon-btn, .round-btn, .pill-btn, .lang-btn[aria-pressed="true"], .gem)::after {
  content: ""; position: absolute; z-index: -1; clip-path: var(--chip); pointer-events: none;
}
:where(.listen-item, .scan-cta, .icon-btn, .round-btn, .pill-btn, .lang-btn[aria-pressed="true"], .gem)::before {
  inset: 0; background: linear-gradient(150deg, var(--rim-hi) 8%, var(--face) 52%, var(--rim-lo) 96%);
}
:where(.listen-item, .scan-cta, .icon-btn, .round-btn, .pill-btn, .lang-btn[aria-pressed="true"], .gem)::after {
  inset: var(--bevel);
  background:
    var(--sparkle) var(--spark-1) / var(--spark-size) var(--spark-size) no-repeat,
    var(--sparkle-small) var(--spark-2) / 7px 7px no-repeat,
    radial-gradient(70% 55% at 50% 100%, rgba(255, 255, 255, 0.2), rgba(255, 255, 255, 0) 70%),
    linear-gradient(128deg, rgba(255, 255, 255, 0.22) 0 15%, transparent 15.5%),
    linear-gradient(205deg, rgba(255, 255, 255, 0.1) 0 11%, transparent 11.5%),
    linear-gradient(-50deg, var(--plane-lo) 0 13%, transparent 13.5%),
    radial-gradient(120% 120% at 30% 22%, var(--face-hi), var(--face) 50%, var(--face-lo));
}
:where(.listen-item, .scan-cta, .icon-btn, .round-btn, .pill-btn):active {
  transform: translateY(2px) scale(0.98);
  filter: drop-shadow(0 0 12px var(--glow)) drop-shadow(0 1px 2px rgba(30, 100, 120, 0.3));
}
:where(.listen-item, .scan-cta, .icon-btn, .round-btn, .pill-btn) { transition: transform 0.12s, filter 0.12s; }
/* Icons are engraved: the deep tone with a thin line of light under it. */
:is(.gem, .round-btn, .icon-btn, .scan-cta-icon) svg, .seek-num { filter: drop-shadow(0 1px 0 rgba(255, 255, 255, 0.7)); }

/* Wide slabs: square-ish with knocked-off corners and a nick or two along the edges. */
:is(.listen-item, .scan-cta) {
  --chip: polygon(14px 0, 37% 2px, calc(37% + 12px) 0, calc(100% - 20px) 1px, 100% 13px, calc(100% - 3px) 48%,
                  100% calc(100% - 17px), calc(100% - 11px) 100%, 63% calc(100% - 1px), calc(63% - 10px) calc(100% - 4px),
                  21px 100%, 0 calc(100% - 12px), 3px 42%, 0 18px);
  --bevel: 5px;
  --spark-1: calc(100% - 34px) 9px; --spark-2: 46% calc(100% - 13px); --spark-size: 12px;
}
/* Sea glass: the pale turquoise of the cards' skies. */
.listen-item {
  --rim-hi: #dff7f2; --rim-lo: #4fb3ac; --face-hi: #e3f8f4; --face: #bdebe3; --face-lo: #8fd6cc;
  --plane-lo: rgba(20, 110, 120, 0.14); --stone-ink: #123f47; --glow: rgba(110, 232, 215, 0.85);
}
/* Aqua crystal: play, the chosen language. */
.play-btn, .lang-btn[aria-pressed="true"] {
  --rim-hi: #c8f3ec; --rim-lo: #2b9497; --face-hi: #b9efe8; --face: #7fd8d1; --face-lo: #48b5b3;
  --plane-lo: rgba(10, 90, 100, 0.16); --stone-ink: #0c3f47; --glow: rgba(80, 226, 210, 0.9);
}
.lang-btn { --glow: rgba(80, 226, 210, 0.9); }
/* The speaker stones: the heart's honey, the sparkles' lavender, the flowers' peach. */
.listen-item[data-item="descubre"] .gem { --rim-hi: #fbe3a0; --rim-lo: #b9801f; --face-hi: #fde9a8; --face: #f4c95e; --face-lo: #e2a63a; --plane-lo: rgba(160, 100, 10, 0.16); --stone-ink: #4f3005; --glow: rgba(255, 186, 60, 0.85); }
.listen-item[data-item="instrucciones"] .gem { --rim-hi: #e3d8fa; --rim-lo: #7259bd; --face-hi: #e6dcfb; --face: #c7b5f0; --face-lo: #a68fe0; --plane-lo: rgba(80, 50, 160, 0.14); --stone-ink: #35216b; --glow: rgba(170, 130, 255, 0.85); }
.listen-item[data-item="guia-rapida"] .gem { --rim-hi: #fbdccb; --rim-lo: #c96a4c; --face-hi: #fde3d4; --face: #f8c0a3; --face-lo: #ee9a78; --plane-lo: rgba(170, 70, 30, 0.14); --stone-ink: #6a2a10; --glow: rgba(255, 140, 115, 0.8); }
/* Each speaker stone gives off a little light of its own colour. */
.gem { filter: drop-shadow(0 0 6px var(--glow)) drop-shadow(0 2px 2px rgba(30, 100, 120, 0.25)); }
/* The two that matter most glow, each in its own light: the scanner gold like
   Sonqo's heart, play a turquoise aura with a warm core like the lagoon at dusk. */
.scan-cta { filter: drop-shadow(0 0 12px rgba(255, 196, 80, 0.75)) var(--shadow-stone); }
.play-btn { filter: drop-shadow(0 0 5px rgba(255, 232, 150, 0.9)) drop-shadow(0 0 16px rgba(60, 215, 200, 0.75)) drop-shadow(0 4px 6px rgba(30, 100, 120, 0.25)); }
:is(.scan-cta, .play-btn):active { filter: drop-shadow(0 0 18px var(--glow)) drop-shadow(0 1px 2px rgba(30, 100, 120, 0.3)); }

/* --------------------------------------------------------- listen items */
.listen-list { list-style: none; margin: 0 0 22px; padding: 0; display: grid; gap: 14px; }
.listen-item {
  width: 100%; display: grid; grid-template-columns: 60px 1fr auto; align-items: center; gap: 14px;
  min-height: 86px; padding: 12px 18px 12px 13px; text-align: left;
}
.listen-item:hover { filter: drop-shadow(0 0 9px var(--glow)) var(--shadow-stone); }
/* The speaker is a smaller coloured stone set into the slab. */
.gem {
  --chip: polygon(25% 4%, 55% 0, 80% 10%, 97% 32%, 98% 62%, 85% 86%, 60% 99%, 33% 97%, 10% 84%, 0 58%, 4% 28%);
  display: grid; place-items: center;
  --spark-1: 22% 18%; --spark-2: 76% 72%; --spark-size: 10px;
}
.listen-icon { width: 60px; height: 60px; }
.listen-icon svg { width: 30px; height: 30px; }
.listen-title { font: 700 clamp(1.15rem, 4.6vw, 1.35rem) / 1.15 var(--font-display); }
.listen-meta {
  font: 700 0.95rem var(--font-text); color: #164a52;
  background: rgba(255, 255, 255, 0.6); padding: 6px 10px; border-radius: 10px 12px 9px 13px; white-space: nowrap;
  box-shadow: inset 0 1px 2px rgba(40, 130, 140, 0.2);
}

/* --------------------------------------------------------------- scan CTA */
.scan-cta {
  width: 100%; display: grid; grid-template-columns: 112px 1fr; align-items: center; gap: 16px;
  min-height: 132px; padding: 14px 18px 14px 14px; text-align: left;
}
.scan-cta-icon {
  width: 106px; height: 100px; display: grid; place-items: center; color: #0c3f47;
  /* set into the slab: an aqua-crystal tile sitting a little below the surface */
  clip-path: polygon(10px 0, calc(100% - 14px) 2px, 100% 12px, calc(100% - 2px) calc(100% - 10px),
                     calc(100% - 12px) 100%, 12px calc(100% - 2px), 0 calc(100% - 13px), 2px 11px);
  background: var(--sparkle) calc(100% - 22px) 12px / 12px 12px no-repeat,
              radial-gradient(70% 55% at 50% 100%, rgba(255, 255, 255, 0.2), rgba(255, 255, 255, 0) 70%),
              radial-gradient(120% 120% at 30% 22%, #b9efe8, #7fd8d1 50%, #48b5b3);
  box-shadow: inset 0 3px 7px rgba(20, 100, 110, 0.3);
}
.scan-cta-icon svg { width: 72px; height: 72px; }
.scan-cta-text { font: 800 clamp(1.45rem, 6vw, 1.85rem) / 1.1 var(--font-display); text-align: center; }

/* -------------------------------------------------------------- top bar */
.topbar {
  display: grid; grid-template-columns: 64px 1fr; align-items: center; gap: 10px;
  padding: calc(14px + env(safe-area-inset-top)) 0 14px;
}
.topbar-title {
  margin: 0; font: 700 clamp(1.4rem, 6vw, 1.9rem) / 1.15 var(--font-display);
  color: #fff; text-shadow: 0 2px 6px rgba(10, 60, 100, 0.45); text-align: center; padding-right: 64px;
}
.topbar-small { font-size: clamp(1.15rem, 4.8vw, 1.4rem); }
.icon-btn {
  width: 64px; height: 64px; display: grid; place-items: center;
  --chip: polygon(36% 0, 66% 4%, 88% 18%, 100% 44%, 95% 72%, 78% 93%, 50% 100%, 22% 94%, 4% 74%, 0 46%, 10% 18%);
}
.icon-btn svg { width: 32px; height: 32px; }

/* --------------------------------------------------------------- scanner */
.viewfinder-panel { padding: 18px; text-align: center; }
.viewfinder {
  position: relative; aspect-ratio: 1; border-radius: 22px; overflow: hidden;
  background: radial-gradient(circle at 50% 40%, #2b5f7f, #0d2f45);
}
.viewfinder video {
  width: 100%; height: 100%; object-fit: cover;
  transform: scale(var(--zoom, 1.6)); /* the scanner analyses this same central crop */
}
.vf-heart {
  position: absolute; inset: 22% 30%; width: 40%; opacity: 0.0; border-radius: 12px;
  transition: opacity 0.4s;
}
.viewfinder.no-camera .vf-heart { opacity: 0.9; }
.corner { position: absolute; width: 22%; height: 22%; border: 7px solid #fff; filter: drop-shadow(0 0 6px rgba(255, 220, 120, 0.8)); transition: border-color 0.3s, transform 0.3s; }
.corner.tl { top: 8%; left: 8%; border-right: 0; border-bottom: 0; border-radius: 18px 0 0 0; }
.corner.tr { top: 8%; right: 8%; border-left: 0; border-bottom: 0; border-radius: 0 18px 0 0; }
.corner.bl { bottom: 8%; left: 8%; border-right: 0; border-top: 0; border-radius: 0 0 0 18px; }
.corner.br { bottom: 8%; right: 8%; border-left: 0; border-top: 0; border-radius: 0 0 18px 0; }
.sweep {
  position: absolute; left: 10%; right: 10%; height: 3px; top: 12%;
  background: linear-gradient(90deg, transparent, #ffe8a3, transparent);
  box-shadow: 0 0 14px 4px rgba(255, 220, 120, 0.55);
  animation: sweep 2.6s ease-in-out infinite;
}
@keyframes sweep { 0%, 100% { top: 12%; } 50% { top: 86%; } }
.viewfinder.found .corner { border-color: var(--gold); transform: scale(0.92); }
.viewfinder.found .sweep { display: none; }
.viewfinder.found::after {
  content: ""; position: absolute; inset: 0;
  background: radial-gradient(circle, rgba(255, 233, 160, 0.75), rgba(255, 233, 160, 0) 70%);
  animation: burst 0.7s ease-out forwards;
}
@keyframes burst { from { opacity: 1; transform: scale(0.6); } to { opacity: 0; transform: scale(1.3); } }
.scan-hint { margin: 16px 6px 4px; font: 700 clamp(1.15rem, 5vw, 1.4rem) / 1.3 var(--font-display); color: var(--ink); min-height: 2.6em; }
.pill-btn {
  margin-top: 6px; min-height: 56px; padding: 0 26px; font: 700 1.05rem var(--font-display);
  --chip: polygon(12px 0, calc(100% - 16px) 2px, 100% 14px, calc(100% - 3px) calc(100% - 12px),
                  calc(100% - 14px) 100%, 15px calc(100% - 2px), 0 calc(100% - 15px), 3px 12px);
}
.pill-btn[aria-pressed="true"] { --face: #f8d479; --face-lo: #eab44a; }

/* ---------------------------------------------------------------- player */
.player-head { display: grid; grid-template-columns: auto 1fr; gap: 14px; align-items: center; margin-bottom: 12px; }
.card-art {
  width: 92px; border-radius: 10px; transform: rotate(-4deg);
  box-shadow: 0 0 0 3px #fff, var(--shadow);
  animation: float 5s ease-in-out infinite;
}
.card-art[hidden] { display: none; }
@keyframes float { 0%, 100% { transform: rotate(-4deg) translateY(0); } 50% { transform: rotate(-2deg) translateY(-6px); } }
.player-head:not(:has(.card-art:not([hidden]))) { grid-template-columns: 1fr; text-align: center; }
.play-title {
  margin: 0; font: 800 clamp(1.4rem, 6vw, 1.9rem) / 1.15 var(--font-display);
  color: #fff; text-shadow: 0 2px 8px rgba(10, 60, 100, 0.55);
}
.play-note[hidden] { display: none; }
.play-note {
  margin: 6px 0 0; display: inline-block; padding: 4px 12px; border-radius: 999px;
  background: rgba(255, 246, 222, 0.92); color: var(--teal-deep); font: 700 0.95rem var(--font-text);
}

/* The player is one screen tall: the lyrics take whatever the title and the
   controls leave, so it fits a phone without scrolling, card picture or not. */
#view-play:not([hidden]) {
  display: flex; flex-direction: column;
  min-height: calc(100vh - 28px);
  min-height: calc(100dvh - 28px - env(safe-area-inset-bottom));
}
.lyrics-panel { padding: 8px 6px 8px 14px; flex: 1 1 0; min-height: 220px; display: flex; flex-direction: column; }
.lyrics {
  flex: 1 1 0; min-height: 0;
  overflow-y: auto; scroll-behavior: auto;
  padding: 34% 10px 34% 4px; /* lets the first and last lines reach the middle */
  -webkit-mask-image: linear-gradient(180deg, transparent 0, #000 16%, #000 84%, transparent 100%);
          mask-image: linear-gradient(180deg, transparent 0, #000 16%, #000 84%, transparent 100%);
  scrollbar-width: thin; scrollbar-color: var(--teal) transparent;
}
.lyrics:focus-visible { outline-offset: -4px; }
.line {
  margin: 0 0 0.55em; font: 700 clamp(1.3rem, 5.4vw, 1.75rem) / 1.38 var(--font-text);
  color: var(--ink); opacity: 0.38; cursor: pointer;
  transition: opacity 0.35s, transform 0.35s;
  transform-origin: left center;
}
.line.past { opacity: 0.55; }
.line.active { opacity: 1; transform: scale(1.035); }
.w { border-radius: 6px; padding: 0 1px; }
.line.active .w { opacity: 0.62; transition: opacity 0.15s; }
.line.active .w.sung { opacity: 1; }
.line.active .w.now {
  opacity: 1;
  background: linear-gradient(90deg, var(--highlight) calc(var(--p, 0) * 100%), transparent 0);
  box-shadow: 0 3px 0 -1px var(--gold);
}
.lyrics-empty { font: 700 1.3rem / 1.4 var(--font-text); color: var(--ink-soft); text-align: center; padding: 30% 10px; }

.transport { margin-top: 12px; }
.timeline {
  display: grid; grid-template-columns: auto 1fr auto; align-items: center; column-gap: 12px; row-gap: 2px;
}
.side-label {
  justify-self: center; font: 700 0.85rem / 1 var(--font-display); color: #fff;
  text-shadow: 0 1px 4px rgba(10, 60, 100, 0.65);
}
#seek {
  -webkit-appearance: none; appearance: none; width: 100%; height: 34px; background: transparent; margin: 0;
}
#seek::-webkit-slider-runnable-track {
  height: 8px; border-radius: 99px;
  background: linear-gradient(90deg, var(--gold) var(--fill, 0%), rgba(255, 250, 235, 0.85) var(--fill, 0%));
  box-shadow: inset 0 1px 3px rgba(110, 70, 20, 0.35), 0 1px 4px rgba(10, 60, 100, 0.25);
}
#seek::-moz-range-track { height: 8px; border-radius: 99px; background: rgba(255, 250, 235, 0.85); box-shadow: inset 0 1px 3px rgba(110, 70, 20, 0.35), 0 1px 4px rgba(10, 60, 100, 0.25); }
#seek::-moz-range-progress { height: 8px; border-radius: 99px; background: var(--gold); }
#seek::-webkit-slider-thumb {
  -webkit-appearance: none; width: 28px; height: 28px; margin-top: -10px; border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #fffdf2, #ffe9a8 55%, #f2c75c);
  border: 0; box-shadow: 0 0 9px rgba(255, 220, 130, 0.9), 0 1px 3px rgba(40, 110, 130, 0.35);
}
#seek::-moz-range-thumb {
  width: 24px; height: 24px; border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #fffdf2, #ffe9a8 55%, #f2c75c);
  border: 0; box-shadow: 0 0 9px rgba(255, 220, 130, 0.9), 0 1px 3px rgba(40, 110, 130, 0.35);
}
.times { display: flex; justify-content: space-between; padding: 0 4px; font: 700 1rem var(--font-text); color: #fff; text-shadow: 0 1px 4px rgba(10, 60, 100, 0.6); }

/* Back, play and forward: big stones with room between them. */
.controls { display: flex; justify-content: center; align-items: center; gap: clamp(20px, 8vw, 36px); margin-top: 14px; }

.round-btn { width: 70px; height: 70px; display: grid; place-items: center; }
#btn-fwd { --chip: polygon(42% 0, 70% 3%, 92% 20%, 100% 46%, 96% 72%, 80% 92%, 55% 100%, 28% 97%, 8% 82%, 0 56%, 4% 28%, 20% 8%); }
.side-btn { width: 56px; height: 56px; --bevel: 3px; }
.side-btn svg { width: 26px; height: 26px; }
#btn-speed { --chip: polygon(40% 2%, 68% 0, 90% 16%, 100% 42%, 97% 70%, 82% 91%, 56% 100%, 30% 97%, 9% 82%, 0 55%, 6% 26%, 20% 9%); }
.seek-num { font: 800 1.2rem var(--font-display); }
.side-btn .seek-num { font-size: 1.05rem; }
/* Play is the big aqua crystal, glowing. */
.play-btn {
  width: 100px; height: 100px; --bevel: 6px; --spark-1: 22% 18%; --spark-size: 16px;
  --chip: polygon(34% 1%, 62% 0, 83% 10%, 97% 28%, 100% 50%, 96% 70%, 84% 88%, 64% 98%, 40% 100%, 19% 92%, 5% 76%, 0 54%, 3% 32%, 15% 12%);
}
.play-btn svg { width: 46px; height: 46px; }
.play-btn .i-pause { display: none; }
.play-btn.playing .i-play { display: none; }
.play-btn.playing .i-pause { display: block; }

/* ------------------------------------------------------------ legal */
/* Quiet on purpose: small, soft brown, a faint underline. Still readable (4.8:1). */
.legal-footer {
  display: flex; flex-wrap: wrap; justify-content: center; gap: 0 16px; margin-top: 18px;
  font: 400 0.85rem var(--font-text);
}
.legal-footer a {
  color: #7d6a55; padding: 8px 2px; text-decoration: underline;
  text-decoration-color: rgba(125, 106, 85, 0.35); text-underline-offset: 3px;
}
.legal-footer a:hover { color: var(--ink-soft); text-decoration-color: currentColor; }
.legal-page .topbar { grid-template-columns: 64px 1fr; }
.legal-lang { justify-self: end; width: min(260px, 100%); }
.legal { margin-bottom: 24px; }
.legal[hidden] { display: none; }
.legal h1 { margin: 0 0 4px; font: 800 clamp(1.6rem, 6.5vw, 2.1rem) / 1.15 var(--font-display); color: var(--teal-deep); }
.legal h2 { margin: 26px 0 6px; font: 800 1.3rem / 1.2 var(--font-display); color: var(--teal-deep); }
.legal p, .legal li { font: 400 1.1rem / 1.6 var(--font-text); color: var(--ink); }
.legal ul { padding-left: 1.2em; }
.legal li { margin: 6px 0; }
.legal a { color: var(--teal-deep); font-weight: 700; }
.legal code { font-size: 0.95em; background: rgba(233, 185, 85, 0.22); padding: 1px 5px; border-radius: 5px; }
.legal-date { margin: 0 0 14px; color: var(--ink-soft) !important; font-size: 1rem !important; }
.legal-lead { padding: 12px 14px; border-radius: 14px; background: rgba(191, 235, 227, 0.55); }
.legal-credits { margin-top: 26px; font-size: 0.95rem !important; color: var(--ink-soft) !important; }

@media (min-width: 700px) {
  .banner { border-radius: 0 0 40px 40px; }
}
/* ------------------------------------------------------------ tap magic */
/* Made by js/magic.js where a stone is touched, in that stone's --glow colour. */
.tap-fx { position: fixed; z-index: 50; width: 0; height: 0; pointer-events: none; }
.tap-bloom, .tap-ring, .tap-spark { position: absolute; }
.tap-bloom {
  left: -22px; top: -22px; width: 44px; height: 44px; border-radius: 50%;
  background: radial-gradient(circle, #fff 0 12%, var(--c) 34%, transparent 70%);
  animation: tap-bloom 0.55s ease-out forwards;
}
@keyframes tap-bloom { from { transform: scale(0.4); opacity: 1; } 35% { opacity: 0.95; } to { transform: scale(2.8); opacity: 0; } }
.tap-ring {
  left: -12px; top: -12px; width: 24px; height: 24px; border-radius: 50%;
  border: 3px solid var(--c); box-shadow: 0 0 10px var(--c), inset 0 0 6px var(--c);
  animation: tap-ring 0.65s cubic-bezier(0.2, 0.7, 0.3, 1) forwards;
}
@keyframes tap-ring { from { transform: scale(0.4); opacity: 0.95; } to { transform: scale(5); opacity: 0; } }
.tap-spark {
  left: calc(var(--s) / -2); top: calc(var(--s) / -2); width: var(--s); height: var(--s);
  background: radial-gradient(circle, #fff 28%, var(--c) 58%);
  filter: drop-shadow(0 0 3px var(--c));
  -webkit-mask: var(--sparkle-small) center / contain no-repeat;
          mask: var(--sparkle-small) center / contain no-repeat;
  animation: tap-spark 0.75s cubic-bezier(0.15, 0.75, 0.3, 1) both;
}
@keyframes tap-spark {
  0% { transform: rotate(var(--a)) translateX(4px) scale(0.3); opacity: 0; }
  18% { opacity: 1; }
  100% { transform: rotate(var(--a)) translateX(var(--d)) scale(1) rotate(120deg); opacity: 0; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .motes { display: none; }
}
