/* Baby Animal Piano. No inline styles anywhere: JS only sets custom properties through the CSSOM. */
:root {
  --bg: #fdf6ea;
  --bg-2: #f7ecdb;
  --card: #fffdf8;
  --ink: #2e2433;
  --ink-soft: #5b4f61;
  --line: #e7d9c4;
  --accent: #6b4fc1;
  --accent-soft: #ece6fb;
  --focus: #2c6fd6;
  --badge: rgba(255, 255, 255, .6);
  --scrim: rgba(28, 20, 36, .55);
  --k0: #ef8a80; --k1: #f4a96a; --k2: #f2cf63; --k3: #9ccf7a; --k4: #63c2b0; --k5: #74a9e8; --k6: #9d8fe0; --k7: #e98fbd;
  --bar-h: 58px;
  --peek-h: 40px;
  --gap: clamp(5px, 1.1vw, 12px);
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #191b26;
    --bg-2: #20233a;
    --card: #262a3c;
    --ink: #f3eef6;
    --ink-soft: #c9c0d1;
    --line: #3a3e56;
    --accent: #b8a4ff;
    --accent-soft: #3a3366;
    --focus: #8cb8ff;
    --badge: rgba(255, 255, 255, .8);
    --scrim: rgba(0, 0, 0, .62);
    --k0: #d9776e; --k1: #dd9459; --k2: #d4b252; --k3: #7fb262; --k4: #4ea697; --k5: #5f92cf; --k6: #8676c9; --k7: #cf7aa6;
  }
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; background: var(--bg); overscroll-behavior: none; /* no pull-to-refresh, no two-finger swipe back on a trackpad */
  touch-action: pan-x pan-y; } /* no pinch or double-tap zoom anywhere: a page zoomed by little fingers can't be un-zoomed by the page */
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.55 ui-rounded, "SF Pro Rounded", system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  overscroll-behavior: none;
  overflow-x: hidden;
}
button { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }

/* ---------- top bar ---------- */
.bar {
  position: relative;
  height: var(--bar-h);
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 0 max(12px, env(safe-area-inset-right)) 0 max(12px, env(safe-area-inset-left));
  touch-action: none;
  -webkit-user-select: none; user-select: none; -webkit-touch-callout: none;
}
.title { display: flex; align-items: center; gap: 9px; min-width: 0; }
.logo { width: 30px; height: 30px; flex: none; }
h1 { margin: 0; font-size: clamp(15px, 4.6vw, 22px); line-height: 1.15; letter-spacing: -.01em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pill { flex: none; font-size: 12.5px; font-weight: 600; color: var(--ink-soft); background: var(--bg-2); border: 1px solid var(--line); border-radius: 99px; padding: 2px 9px; white-space: nowrap; }

.gate-btn {
  flex: none;
  display: flex; align-items: center; gap: 6px;
  min-height: 48px; padding: 0 12px 0 2px;
  border: 2px solid var(--line); border-radius: 26px;
  background: var(--card); color: var(--ink);
  font-size: 14px; font-weight: 650;
  cursor: pointer;
  touch-action: none; -webkit-user-select: none; user-select: none; -webkit-touch-callout: none;
}
.ring-wrap { position: relative; width: 42px; height: 42px; display: grid; place-items: center; }
.ring { position: absolute; inset: 0; width: 100%; height: 100%; transform: rotate(-90deg); }
.ring-bg { fill: none; stroke: var(--bg-2); stroke-width: 4; }
.ring-fg { fill: none; stroke: var(--accent); stroke-width: 4.5; stroke-linecap: round; stroke-dasharray: 131.95; stroke-dashoffset: calc(131.95 * (1 - var(--p, 0))); }
.lock { width: 20px; height: 20px; fill: var(--ink-soft); color: var(--ink-soft); }
.gate-hint {
  position: absolute; z-index: 6; right: 10px; top: calc(var(--bar-h) - 2px);
  margin: 0; max-width: min(300px, calc(100vw - 20px));
  background: var(--ink); color: var(--bg);
  font-size: 14px; font-weight: 600; line-height: 1.35;
  padding: 9px 13px; border-radius: 12px;
  opacity: 0; transform: translateY(-4px); transition: opacity .2s, transform .2s;
  pointer-events: none;
}
.gate-hint.show { opacity: 1; transform: none; }
.gate-hint::before { content: ""; position: absolute; top: -6px; right: 40px; border: 6px solid transparent; border-top: 0; border-bottom-color: var(--ink); }

/* ---------- the piano ---------- */
.stage {
  position: relative;
  height: calc(100vh - var(--bar-h) - var(--peek-h));
  height: calc(100svh - var(--bar-h) - var(--peek-h));
  min-height: 250px;
  padding: 2px max(12px, env(safe-area-inset-right)) 8px max(12px, env(safe-area-inset-left));
  /* The layout below asks how big the piano really is (container queries), not how big the screen is: on phones the
     browser's own bars take a lot of the height. */
  container: stage / size;
  touch-action: none; /* taps never scroll or zoom the page */
  -webkit-user-select: none; user-select: none; -webkit-touch-callout: none;
  -webkit-tap-highlight-color: transparent;
}
.stage:focus { outline: none; } /* it only takes focus to park the keyboard while a child plays */
.stage-in { height: 100%; display: grid; grid-template-rows: auto minmax(0, 1fr); gap: 10px; }
.controls { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.modes { display: flex; gap: 10px; flex: none; }
.mode, .tune {
  height: 68px; padding: 0;
  display: grid; place-items: center;
  border: 3px solid var(--line); border-radius: 50%;
  background: var(--card);
  box-shadow: 0 3px 0 var(--line);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: transform .12s, border-color .2s, background-color .2s;
}
.mode { width: 68px; }
.mode svg { width: 40px; height: 40px; }
.mode.on { border-color: var(--accent); background: var(--accent-soft); }
.mode:active, .tune:active { transform: translateY(2px); }
.ic { fill: none; stroke: var(--ink); stroke-width: 3.4; stroke-linecap: round; stroke-linejoin: round; }
.icf { fill: var(--ink); }
.paw { fill: #c47a52; }
.silly-face { fill: #f6c945; stroke: var(--ink); stroke-width: 2.6; }
.mode .silly-face + .ic, .mode .silly-face ~ .ic { stroke: #3a2c3a; }
.tongue { fill: #f47b8f; stroke: #3a2c3a; stroke-width: 2; }
@media (prefers-color-scheme: dark) { .silly-face { stroke: #3a2c3a; } }

.tune { position: relative; flex: 0 1 104px; min-width: 76px; border-radius: 34px; grid-template-columns: 1fr 1fr; padding: 0 8px; }
.tune svg.i-play, .tune svg.i-stop { width: 30px; height: 30px; fill: var(--accent); justify-self: center; }
.tune .i-stop, .tune.playing .i-play { display: none; }
.tune.playing .i-stop { display: block; }
.tune.playing { border-color: var(--accent); background: var(--accent-soft); }
.tune-pic { width: 36px; height: 36px; display: grid; justify-self: center; }
.tune-pic .tp { width: 36px; height: 36px; grid-area: 1 / 1; visibility: hidden; }
.tune[data-tune="twinkle"] .tp-twinkle, .tune[data-tune="mary"] .tp-mary, .tune[data-tune="macdonald"] .tp-macdonald { visibility: visible; }
@container stage (max-width: 333px) { /* 320 px phones: 3 x 64 + the tune button still fit in one row */
  .controls, .modes { gap: 8px; }
  .mode { width: 64px; height: 64px; }
  .mode svg { width: 38px; height: 38px; }
  .tune { height: 64px; padding: 0 5px; }
  .tune svg.i-play, .tune svg.i-stop { width: 26px; height: 26px; }
  .tune-pic, .tune-pic .tp { width: 30px; height: 30px; }
}

.keys {
  position: relative;
  display: grid; grid-template-columns: repeat(8, minmax(0, 1fr)); grid-template-rows: minmax(0, 1fr); gap: var(--gap);
  min-height: 0;
}
/* Too narrow for 8 keys of 64 px side by side: two rows of four, low notes on the bottom row. */
@container stage (max-width: 560px) {
  .keys { grid-template-columns: repeat(4, minmax(0, 1fr)); grid-template-rows: repeat(2, minmax(0, 1fr)); }
  .k0 { grid-area: 2 / 1; } .k1 { grid-area: 2 / 2; } .k2 { grid-area: 2 / 3; } .k3 { grid-area: 2 / 4; }
  .k4 { grid-area: 1 / 1; } .k5 { grid-area: 1 / 2; } .k6 { grid-area: 1 / 3; } .k7 { grid-area: 1 / 4; }
}
.key {
  --kc: var(--k0);
  position: relative;
  min-width: 0; min-height: 0;
  margin: 0; padding: 10px 3px 12px;
  display: flex;
  container-type: size; /* each key lays out its animal by its own shape (see .kin) */
  border: 0; border-radius: 18px;
  background: var(--kc);
  background: linear-gradient(180deg, color-mix(in srgb, var(--kc) 78%, #fff) 0%, var(--kc) 55%);
  box-shadow: inset 0 -9px 0 rgba(40, 20, 40, .14), 0 3px 0 rgba(40, 20, 40, .1);
  cursor: pointer;
  touch-action: none;
  -webkit-tap-highlight-color: transparent;
  transition: filter .3s ease-out, transform .3s ease-out, box-shadow .3s ease-out;
}
.k1 { --kc: var(--k1); } .k2 { --kc: var(--k2); } .k3 { --kc: var(--k3); } .k4 { --kc: var(--k4); }
.k5 { --kc: var(--k5); } .k6 { --kc: var(--k6); } .k7 { --kc: var(--k7); }
.key.lit {
  filter: brightness(1.1) saturate(1.1);
  transform: translateY(3px);
  box-shadow: inset 0 -5px 0 rgba(40, 20, 40, .14), 0 0 0 4px rgba(255, 255, 255, .6), 0 0 22px 2px color-mix(in srgb, var(--kc) 70%, transparent);
  transition: filter .08s, transform .08s, box-shadow .08s;
}
.kin { flex: 1 1 auto; min-width: 0; min-height: 0; display: flex; flex-direction: column; align-items: center; justify-content: space-between; gap: 4px; pointer-events: none; }
.badge {
  width: min(100%, 124px); width: min(100%, 124px, calc(100cqh - 26px)); aspect-ratio: 1; flex: none;
  display: grid; place-items: center;
  border-radius: 50%;
  background: var(--badge);
  pointer-events: none;
}
/* A key wider than it is tall (phones held upright, short windows): the animal sits at the left, the note name at the right. */
@container (min-aspect-ratio: 5/4) {
  .kin { flex-direction: row; padding: 0 12px 0 2px; }
  .badge { width: auto; height: 100%; max-height: 112px; }
}
.animal { width: 90%; height: 90%; overflow: visible; transform-origin: 50% 90%; }
.badge.bounce .animal { animation: bounce .5s cubic-bezier(.3, .7, .4, 1); }
@keyframes bounce {
  0% { transform: translateY(0) scale(1, 1); }
  25% { transform: translateY(-16%) scale(.96, 1.05); }
  55% { transform: translateY(0) scale(1.08, .9); }
  75% { transform: translateY(-4%) scale(.98, 1.02); }
  100% { transform: translateY(0) scale(1, 1); }
}
.animal .o { stroke: #3a2c3a; stroke-width: 2.6; stroke-linejoin: round; stroke-linecap: round; }
.animal .o-light { stroke: #f3e9ee; stroke-width: 2.4; stroke-linecap: round; }
.animal .eye { fill: #2a2030; }
.animal .shine { fill: #fff; }
.animal .cheek { fill: #ff8fa3; opacity: .5; }
.animal .whisk { stroke: #3a2c3a; stroke-width: 1.8; stroke-linecap: round; }
.animal .m-open { opacity: 0; }
.key.lit .m-open { opacity: 1; }
.key.lit .m-shut { opacity: 0; }
.nn {
  font-size: clamp(14px, 2.2vw, 20px); font-weight: 800; line-height: 1;
  color: rgba(46, 36, 51, .74);
  pointer-events: none;
}
@media (prefers-color-scheme: dark) { .nn { color: rgba(16, 10, 20, .78); } }
/* a soft shine down each key, like a glossy toy */
.key::before {
  content: ""; position: absolute; left: 12%; top: 12px; bottom: 22px; width: 9%;
  border-radius: 99px; background: rgba(255, 255, 255, .2); pointer-events: none;
}

/* keys-only mode */
.stage.simple .stage-in { grid-template-rows: minmax(0, 1fr); }
.stage.simple .controls { display: none; }

/* floating notes, hearts and stars */
.fx { position: absolute; inset: 0; overflow: hidden; pointer-events: none; }
.p {
  position: absolute; left: 0; top: 0; width: 26px; height: 26px; margin: -13px 0 0 -13px;
  background: var(--c, #fff);
  -webkit-mask: var(--shape) center / contain no-repeat; mask: var(--shape) center / contain no-repeat;
  transform: translate(var(--x), var(--y));
  animation: rise 1.1s ease-out forwards;
  opacity: 0;
}
.p0 { --shape: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M9 18.5V5l10-2v12.5' fill='none' stroke='%23000' stroke-width='2.4'/%3E%3Ccircle cx='6.5' cy='18.5' r='3.5'/%3E%3Ccircle cx='16.5' cy='15.5' r='3.5'/%3E%3C/svg%3E"); }
.p1 { --shape: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M12 21s-8-5.2-8-11a4.5 4.5 0 0 1 8-2.8A4.5 4.5 0 0 1 20 10c0 5.8-8 11-8 11z'/%3E%3C/svg%3E"); }
.p2 { --shape: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M12 2l2.9 6.3 6.9.8-5.1 4.7 1.4 6.8L12 17.2l-6.1 3.4 1.4-6.8-5.1-4.7 6.9-.8z'/%3E%3C/svg%3E"); }
.c0 { --c: #e0574b; } .c1 { --c: #e98a3c; } .c2 { --c: #d9a91c; } .c3 { --c: #5fa83f; }
.c4 { --c: #2f9a87; } .c5 { --c: #3f7fd0; } .c6 { --c: #7461cf; } .c7 { --c: #d65c9b; }
@keyframes rise {
  0% { opacity: 0; transform: translate(var(--x), var(--y)) scale(.6); }
  15% { opacity: .95; }
  100% { opacity: 0; transform: translate(calc(var(--x) + var(--dx, 0px)), calc(var(--y) - 90px)) scale(1.05) rotate(var(--r, 0deg)); }
}

.peek {
  height: var(--peek-h);
  display: flex; align-items: center; justify-content: center; gap: 6px;
  padding: 0 12px;
  color: var(--ink-soft); font-size: 14px; font-weight: 600;
  text-align: center;
}
.peek svg { width: 18px; height: 18px; flex: none; }
.peek b { color: var(--ink); }
.peek-short { display: none; }
@media (max-width: 520px) { .pill { display: none; } .peek-long { display: none; } .peek-short { display: inline; } }
@media (max-width: 380px) { .logo { display: none; } .gate-btn { padding-right: 10px; } }

/* Phones held sideways and other short screens: buttons go in a column at the side. */
@media (orientation: landscape) and (max-height: 560px) {
  :root { --bar-h: 46px; --peek-h: 30px; }
  .pill { display: none; }
  .gate-btn { min-height: 44px; }
  .ring-wrap { width: 38px; height: 38px; }
  .stage { padding-top: 0; padding-bottom: 6px; }
  .key { padding: 8px 3px 10px; border-radius: 16px; }
  .peek { font-size: 13px; }
  /* Tall enough for a column of 64 px buttons (3 sounds + the tune): it goes at the side and the keys get the height.
     Shorter than that (a phone with the browser's bars showing), the buttons stay in a row on top. */
  @container stage (min-height: 284px) {
    .stage-in { grid-template-rows: minmax(0, 1fr); grid-template-columns: auto minmax(0, 1fr); gap: 12px; }
    .stage.simple .stage-in { grid-template-columns: minmax(0, 1fr); }
    .controls { flex-direction: column; justify-content: space-between; }
    .modes { flex-direction: column; gap: 8px; }
    .mode { width: 64px; height: 64px; }
    .mode svg { width: 38px; height: 38px; }
    .tune { flex: none; width: 64px; height: 64px; min-width: 0; grid-template-columns: 1fr; grid-template-rows: auto auto; align-content: center; gap: 1px; padding: 0; border-radius: 50%; }
    .tune svg.i-play, .tune svg.i-stop { width: 22px; height: 22px; }
    .tune-pic, .tune-pic .tp { width: 26px; height: 26px; }
  }
  @container stage (min-height: 284px) and (max-width: 638px) {
    .keys { grid-template-columns: repeat(4, minmax(0, 1fr)); grid-template-rows: repeat(2, minmax(0, 1fr)); }
    .k0 { grid-area: 2 / 1; } .k1 { grid-area: 2 / 2; } .k2 { grid-area: 2 / 3; } .k3 { grid-area: 2 / 4; }
    .k4 { grid-area: 1 / 1; } .k5 { grid-area: 1 / 2; } .k6 { grid-area: 1 / 3; } .k7 { grid-area: 1 / 4; }
  }
}

/* Tall, narrow screens (phones held upright): the keys become wide bars stacked low to high. */
@media (max-aspect-ratio: 4/5) {
  .keys { grid-template-columns: minmax(0, 1fr); grid-template-rows: repeat(8, minmax(0, 1fr)); }
  .key { padding: 4px 8px 4px 6px; border-radius: 16px; box-shadow: inset 0 -6px 0 rgba(40, 20, 40, .14), 0 2px 0 rgba(40, 20, 40, .1); }
  /* Same as the key-shape rule above, for browsers without container queries (old iPads stay on iOS 15). */
  .kin { flex-direction: row; padding: 0 12px 0 2px; }
  .badge { width: auto; height: 100%; max-height: 112px; }
  .key.lit { box-shadow: inset 0 -3px 0 rgba(40, 20, 40, .14), 0 0 0 4px rgba(255, 255, 255, .6), 0 0 18px 2px color-mix(in srgb, var(--kc) 70%, transparent); }
  .key::before { left: 27%; right: 9%; top: 8px; bottom: auto; width: auto; height: 11%; }
  .nn { font-size: 20px; }
  .k0 { grid-area: 8 / 1; } .k1 { grid-area: 7 / 1; } .k2 { grid-area: 6 / 1; } .k3 { grid-area: 5 / 1; }
  .k4 { grid-area: 4 / 1; } .k5 { grid-area: 3 / 1; } .k6 { grid-area: 2 / 1; } .k7 { grid-area: 1 / 1; }
  /* Most phones once the browser's bars are counted: two columns of four, still low (bottom left) to high (top right),
     so every key stays well over 64 px tall. */
  @container stage (max-height: 624px) {
    .keys { grid-template-columns: repeat(2, minmax(0, 1fr)); grid-template-rows: repeat(4, minmax(0, 1fr)); }
    .key { padding: 4px 4px 4px 5px; }
    .k0 { grid-area: 4 / 1; } .k1 { grid-area: 4 / 2; } .k2 { grid-area: 3 / 1; } .k3 { grid-area: 3 / 2; }
    .k4 { grid-area: 2 / 1; } .k5 { grid-area: 2 / 2; } .k6 { grid-area: 1 / 1; } .k7 { grid-area: 1 / 2; }
  }
}
@media (max-aspect-ratio: 4/5) and (min-width: 600px) {
  .key { padding-left: 14px; padding-right: 20px; }
  .nn { font-size: 24px; }
}
/* Big screens: keep the piano a comfortable size and centred. */
@media (min-width: 1100px) and (min-aspect-ratio: 4/5) {
  .stage { max-width: 1240px; margin: 0 auto; }
  .badge { width: min(100%, 140px); width: min(100%, 140px, calc(100cqh - 26px)); }
}

/* ---------- notes for parents ---------- */
.notes { max-width: 760px; margin: 0 auto; padding: 18px max(16px, env(safe-area-inset-left)) 28px; border-top: 1px solid var(--line); }
.notes:focus { outline: none; }
.notes h2 { font-size: 26px; line-height: 1.2; margin: 10px 0 8px; }
.notes h3 { font-size: 19px; line-height: 1.3; margin: 28px 0 6px; }
.notes h4 { font-size: 16px; margin: 16px 0 4px; }
.notes p, .notes li { color: var(--ink); }
.notes ul, .notes ol { padding-left: 1.3em; }
.notes li { margin: 5px 0; }
.lede { font-size: 17.5px; }
.notes a, .foot a { color: var(--accent); text-underline-offset: 2px; -webkit-touch-callout: none; }
.howto { display: grid; gap: 4px 22px; }
.howto h4 { margin-top: 12px; }
@media (min-width: 720px) { .howto { grid-template-columns: 1fr 1fr; } .howto > div:last-child { grid-column: 1 / -1; } }
.more ul { list-style: none; padding: 0; }
.more li { margin: 8px 0; }
.foot { max-width: 760px; margin: 0 auto; padding: 14px 16px 120px; color: var(--ink-soft); font-size: 14px; border-top: 1px solid var(--line); } /* room to scroll the last links above the back-to-the-piano button */
.foot p { margin: 0; }
/* No text selection on the notes: on a phone a long press would offer "Search web", "Look up" and "Share". */
.notes, .foot { -webkit-user-select: none; user-select: none; }

/* Back to the piano: shows whenever the piano has been scrolled out of view (a swipe on the strip under it). */
.back-top {
  position: fixed; z-index: 20;
  right: max(16px, env(safe-area-inset-right)); bottom: max(18px, env(safe-area-inset-bottom));
  width: 80px; height: 80px; padding: 0;
  display: grid; place-items: center;
  border: 3px solid var(--line); border-radius: 50%;
  background: var(--card);
  box-shadow: 0 8px 22px rgba(40, 20, 40, .22), 0 3px 0 var(--line);
  cursor: pointer;
  touch-action: manipulation; -webkit-tap-highlight-color: transparent;
  -webkit-user-select: none; user-select: none; -webkit-touch-callout: none;
  animation: bob 2.4s ease-in-out infinite;
}
.back-top svg { width: 50px; height: 50px; }
@keyframes bob { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-5px); } }
.sr-only { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; border: 0; }

/* ---------- dialogs ---------- */
.scrim { position: fixed; inset: 0; z-index: 30; background: var(--scrim); touch-action: none; }
.dialog {
  position: fixed; z-index: 31; left: 50%; top: 50%;
  transform: translate(-50%, -50%);
  width: min(calc(100vw - 24px), 440px);
  max-height: calc(100svh - 24px); overflow: auto; overscroll-behavior: contain;
  background: var(--card); color: var(--ink);
  border-radius: 22px; padding: 20px 20px 18px;
  box-shadow: 0 18px 50px rgba(0, 0, 0, .3);
}
.dialog h2 { margin: 0 0 6px; font-size: 21px; line-height: 1.25; }
.dialog p { margin: 6px 0; }
.gate-dialog { text-align: center; touch-action: none; -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
.hold-big {
  position: relative; width: 104px; height: 104px; margin: 14px auto 12px;
  display: grid; place-items: center;
  border: 0; border-radius: 50%; background: var(--accent-soft); color: var(--ink);
  cursor: pointer; touch-action: none; -webkit-user-select: none; user-select: none; -webkit-touch-callout: none;
}
.hold-big .ring { inset: 0; }
.hold-txt { font-size: 20px; font-weight: 750; }
.gd-share { margin: 16px 0 6px; min-height: 56px; font-size: 17px; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 48px; padding: 0 16px;
  border: 2px solid var(--line); border-radius: 14px;
  background: var(--card); color: var(--ink);
  font-size: 15.5px; font-weight: 650; text-decoration: none;
  cursor: pointer;
}
.btn svg { width: 20px; height: 20px; }
.btn-ghost { border-color: transparent; color: var(--ink-soft); text-decoration: underline; text-underline-offset: 3px; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; }
@media (prefers-color-scheme: dark) { .btn-primary { color: #1b1530; } }
.btn-wide { width: 100%; margin-top: 10px; }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 4px; }
.panel-head h2 { margin: 0; }
.btn-x { width: 46px; height: 46px; border: 0; border-radius: 50%; background: var(--bg-2); display: grid; place-items: center; cursor: pointer; }
.btn-x svg { width: 22px; height: 22px; }
.field { margin: 14px 0 0; padding: 0; border: 0; }
.field > label, legend { display: block; font-weight: 700; margin-bottom: 4px; padding: 0; }
.vol-row { display: flex; align-items: center; gap: 10px; }
.vol-row svg { width: 22px; height: 22px; fill: var(--ink-soft); flex: none; }
.vol-row input { flex: 1; min-width: 0; height: 40px; accent-color: var(--accent); }
.vol-row output { width: 2ch; text-align: right; font-weight: 700; font-variant-numeric: tabular-nums; }
.fine { font-size: 13.5px; color: var(--ink-soft); margin: 2px 0 0; }
.seg { display: flex; border: 2px solid var(--line); border-radius: 14px; overflow: hidden; }
.seg input { position: absolute; opacity: 0; width: 1px; height: 1px; pointer-events: none; }
.seg label { flex: 1; min-height: 46px; display: grid; place-items: center; font-weight: 650; cursor: pointer; }
.seg label + input + label { border-left: 2px solid var(--line); }
.seg input:checked + label { background: var(--accent-soft); color: var(--ink); box-shadow: inset 0 -3px 0 var(--accent); }
.seg input:focus-visible + label { outline: 3px solid var(--focus); outline-offset: -3px; }
.check { display: flex; align-items: center; gap: 10px; min-height: 44px; font-weight: 600; cursor: pointer; }
.check input { width: 22px; height: 22px; accent-color: var(--accent); flex: none; }
.btns { display: flex; flex-wrap: wrap; gap: 10px; }
.btns .btn { flex: 1 1 140px; }
.status { min-height: 1.4em; font-size: 14px; color: var(--ink-soft); word-break: break-all; }
.status:empty { min-height: 0; margin: 0; }
.dialog:focus { outline: none; }

/* Calm motion for anyone who asks for it: no bouncing, floating or sliding, just colour. */
@media (prefers-reduced-motion: reduce) {
  .badge.bounce .animal { animation: none; }
  .p { display: none; }
  .key, .key.lit { transform: none; }
  .gate-hint, .mode, .tune { transition: none; }
  .back-top { animation: none; }
}
