/* Sunset Rally UI — warm cream paper panels docked to the left, so the live garden stays in view.
   Display: Lilita One (logo, headings, score, main action). Text: Fredoka. */
:root {
  --glass: rgba(255, 247, 234, 0.95);
  --glass-strong: #fff7ea;
  --glass-soft: rgba(120, 66, 44, 0.07);
  --glass-line: rgba(120, 66, 44, 0.14);
  --edge-light: rgba(255, 255, 255, 0.95);
  --well: rgba(120, 66, 44, 0.09);
  /* text on the cream paper */
  --paper: #3b2a26;
  --paper-dim: #7a5d52;
  --paper-faint: #a88f80;
  /* light text drawn over the 3D view */
  --light: #fff7ea;
  --accent-text: #c8402c;
  --gold-text: #8f5a0e;
  --plum: #24142a;
  --plum-ink: #2a1630;
  --gold: #ffc35a;
  --gold-deep: #e5962a;
  --coral: #ff5a45;
  --coral-deep: #b9301f;
  --coral-ui: #e0442f;
  --blue-ui: #3a6fcb;
  --teal: #2fb3a3;
  --card-paper: #fffaf1;
  --card-paper-2: #efe3d0;
  --ink: #2a1630;
  --display: 'Lilita One', 'Fredoka', 'Trebuchet MS', system-ui, sans-serif;
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-spring: cubic-bezier(0.25, 1.5, 0.45, 1);
  --panel-shadow: 0 7px 0 rgba(120, 52, 34, 0.16), 0 28px 50px -18px rgba(70, 25, 30, 0.45);
  font-family: 'Fredoka', 'Nunito', 'Trebuchet MS', system-ui, sans-serif;
  color: var(--paper);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  overscroll-behavior: none;
  background: #f0b49c;
  -webkit-tap-highlight-color: transparent;
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  user-select: none;
  touch-action: manipulation;
}

button {
  touch-action: manipulation;
  font: inherit;
  color: inherit;
}

#app {
  position: fixed;
  inset: 0;
}

#game-canvas {
  width: 100%;
  height: 100%;
  display: block;
  touch-action: none;
  outline: none;
}

#game-canvas.playing {
  cursor: none;
}

[hidden] {
  display: none !important;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

button:focus-visible,
.vol-slider:focus-visible {
  outline: 3px solid var(--paper);
  outline-offset: 3px;
}

/* ---------------------------------------------------------------- HUD: the flip scorer */
#hud {
  position: absolute;
  top: max(12px, env(safe-area-inset-top));
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  pointer-events: none;
}

.scoreboard {
  display: flex;
  align-items: stretch;
  padding: 5px;
  gap: 5px;
  border-radius: 20px;
  background: var(--glass-strong);
  box-shadow:
    0 5px 0 rgba(120, 52, 34, 0.18),
    0 14px 26px -12px rgba(70, 25, 30, 0.5);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
}

.side {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px;
  border-radius: 15px;
  color: #fff;
}

.side.you {
  padding-left: 14px;
  background: linear-gradient(180deg, #ff6a52, var(--coral-ui));
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.3),
    inset 0 -3px 0 rgba(0, 0, 0, 0.18);
}

.side.rival {
  padding-right: 14px;
  background: var(--rival-ui, var(--blue-ui));
  background-image: linear-gradient(180deg, rgba(255, 255, 255, 0.16), rgba(0, 0, 0, 0.06));
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.25),
    inset 0 -3px 0 rgba(0, 0, 0, 0.18);
}

.name {
  font-family: var(--display);
  font-size: clamp(15px, 1.7vw, 19px);
  letter-spacing: 0.01em;
  text-shadow: 0 1px 0 rgba(0, 0, 0, 0.25);
}

/* A flip card: two paper halves split by the hinge. */
.pts,
.flip {
  position: relative;
  display: inline-grid;
  place-items: center;
  min-width: 1.35em;
  height: 1.3em;
  padding: 0 0.12em;
  border-radius: 0.2em;
  background: linear-gradient(180deg, var(--card-paper) 0 50%, var(--card-paper-2) 50% 100%);
  color: var(--ink);
  font-family: var(--display);
  font-size: clamp(28px, 3.4vw, 40px);
  line-height: 1;
  box-shadow:
    0 3px 0 rgba(0, 0, 0, 0.22),
    inset 0 1px 0 #fff;
  font-variant-numeric: tabular-nums;
}

.pts::after,
.flip::after {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  top: 50%;
  height: 2px;
  margin-top: -1px;
  background: rgba(42, 22, 48, 0.28);
}

.pts::before,
.flip::before {
  /* hinge pins */
  content: '';
  position: absolute;
  top: 50%;
  left: -3px;
  right: -3px;
  height: 6px;
  margin-top: -3px;
  border-radius: 3px;
  background: linear-gradient(
    90deg,
    #6d5560 0 6px,
    transparent 6px calc(100% - 6px),
    #6d5560 calc(100% - 6px)
  );
}

/* Serve marker: a little ball. */
.serve-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #fff, #ffe9c2 60%, #e8c48e);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.35);
  opacity: 0;
  transform: scale(0.3);
  transition:
    opacity 0.2s,
    transform 0.3s var(--ease-spring);
}

.serve-dot.on {
  opacity: 1;
  transform: scale(1);
}

.rally {
  min-height: 24px;
  padding: 3px 14px;
  border-radius: 999px;
  background: var(--glass-strong);
  color: var(--paper);
  font-weight: 600;
  font-size: 14px;
  box-shadow: 0 3px 0 rgba(120, 52, 34, 0.16);
  opacity: 0;
  transform: translateY(-4px);
  transition:
    opacity 0.2s,
    transform 0.25s var(--ease-out),
    background-color 0.2s;
}

.rally.on {
  opacity: 1;
  transform: none;
}

.rally.hot {
  background: var(--gold);
  color: var(--plum-ink);
}

#hud.training .scoreboard {
  display: none;
}

#hud.training .rally {
  opacity: 1;
  transform: none;
  font-family: var(--display);
  font-weight: 400;
  font-size: 22px;
  padding: 6px 20px;
  min-height: 0;
}

/* ---------------------------------------------------------------- Corner buttons */
#corner {
  z-index: 30;
  position: absolute;
  top: max(12px, env(safe-area-inset-top));
  right: max(12px, env(safe-area-inset-right));
  display: flex;
  gap: 8px;
}

.icon-btn {
  width: 46px;
  height: 46px;
  border: 0;
  border-radius: 50%;
  background: var(--glass);
  color: var(--paper);
  box-shadow:
    0 4px 0 rgba(120, 52, 34, 0.18),
    0 10px 20px -10px rgba(70, 25, 30, 0.5);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  cursor: pointer;
  display: grid;
  place-items: center;
  transition:
    transform 0.15s var(--ease-out),
    background-color 0.15s;
}

.icon-btn svg {
  width: 22px;
  height: 22px;
  fill: currentColor;
  stroke: currentColor;
}

.icon-btn rect,
.icon-btn path:not(.wave):not(.mute) {
  stroke: none;
}

.icon-btn:hover {
  background: #fff;
  transform: translateY(-1px);
}

.icon-btn:active {
  transform: scale(0.94);
}

#btn-sound .mute,
.vol-btn .mute {
  display: none;
}

#btn-full .fs-out,
#btn-full.is-full .fs-in {
  display: none;
}

#btn-full.is-full .fs-out {
  display: inline;
}

#btn-sound.muted .wave {
  display: none;
}

#btn-sound.muted .mute,
.vol-btn[aria-pressed='false'] .mute {
  display: inline;
}

/* ---------------------------------------------------------------- Callouts, hints, countdown */
#callout {
  position: absolute;
  left: 0;
  right: 0;
  top: 30%;
  text-align: center;
  pointer-events: none;
}

#callout.high {
  top: calc(max(12px, env(safe-area-inset-top)) + 84px);
}

.pop-text {
  display: inline-block;
  font-family: var(--display);
  font-size: clamp(32px, 5.6vw, 64px);
  line-height: 1;
  color: var(--light);
  -webkit-text-stroke: 7px var(--plum-ink);
  paint-order: stroke fill;
  text-shadow: 0 6px 0 rgba(42, 22, 48, 0.4);
  animation: pop-in 0.95s var(--ease-spring) forwards;
}

#callout.high .pop-text:not(.small-pop) {
  font-size: clamp(28px, 4.4vw, 48px);
}

#callout.high .pop-text {
  font-size: clamp(22px, 3.4vw, 36px);
}

.pop-text small {
  display: block;
  margin-top: 0.2em;
  font-family: 'Fredoka', sans-serif;
  font-weight: 700;
  font-size: 0.4em;
  -webkit-text-stroke: 4px var(--plum-ink);
}

.pop-text.gold {
  color: var(--gold);
}

.pop-text.coral {
  color: #ffb7aa;
}

.pop-text.blue {
  color: #c8dbff;
}

.pop-text.small-pop {
  font-size: clamp(22px, 3.6vw, 38px);
}

@keyframes pop-in {
  0% {
    transform: scale(0.3) rotate(-8deg);
    opacity: 0;
  }
  18% {
    transform: scale(1.14) rotate(2deg);
    opacity: 1;
  }
  30% {
    transform: scale(1) rotate(0);
  }
  75% {
    opacity: 1;
    transform: translateY(0);
  }
  100% {
    opacity: 0;
    transform: translateY(-20px);
  }
}

@keyframes fade-only {
  0%,
  70% {
    opacity: 1;
  }
  100% {
    opacity: 0;
  }
}

.reduced .pop-text {
  animation: fade-only 0.9s linear forwards;
}

#hint {
  position: absolute;
  left: 50%;
  top: calc(max(12px, env(safe-area-inset-top)) + 92px);
  transform: translateX(-50%);
  width: min(520px, calc(100% - 32px));
  padding: 12px 20px;
  border-radius: 20px;
  background: var(--glass);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
  box-shadow: var(--panel-shadow);
  text-align: center;
  pointer-events: none;
  animation: hint-in 0.4s var(--ease-out);
}

#hint p {
  margin: 0;
}

#hint-main {
  font-family: var(--display);
  font-size: clamp(19px, 2.3vw, 24px);
  letter-spacing: 0.01em;
  color: var(--accent-text);
  animation: breathe 1.6s ease-in-out infinite;
}

#hint-sub {
  margin-top: 4px !important;
  color: var(--paper-dim);
  font-size: clamp(13px, 1.6vw, 15px);
}

#hint-sub:empty {
  display: none;
}

@keyframes hint-in {
  from {
    transform: translate(-50%, 16px);
    opacity: 0;
  }
}

@keyframes breathe {
  50% {
    opacity: 0.72;
  }
}

#countdown {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  pointer-events: none;
  font-family: var(--display);
  font-size: clamp(80px, 15vw, 170px);
  color: var(--light);
  -webkit-text-stroke: 10px var(--plum-ink);
  paint-order: stroke fill;
  text-shadow: 0 10px 0 rgba(42, 22, 48, 0.35);
}

#flash,
#vignette {
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 0;
}

#flash {
  background: #fff8e6;
}

#vignette {
  background: radial-gradient(
    ellipse at center,
    transparent 55%,
    var(--vc, rgba(255, 195, 90, 0.55)) 100%
  );
}

/* Warm static vignette over the 3D view. */
#grade {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: radial-gradient(ellipse at 50% 55%, transparent 58%, rgba(60, 20, 45, 0.28) 100%);
}

/* ---------------------------------------------------------------- Toast (achievement) */
#toast {
  position: absolute;
  z-index: 31;
  left: 50%;
  top: calc(max(12px, env(safe-area-inset-top)) + 80px);
  transform: translate(-50%, -20px);
  padding: 10px 20px 10px 44px;
  border-radius: 999px;
  background: var(--glass-strong);
  color: var(--paper);
  font-weight: 600;
  font-size: 15px;
  box-shadow:
    var(--panel-shadow),
    inset 0 0 0 2px var(--gold);
  opacity: 0;
  pointer-events: none;
  white-space: nowrap;
  max-width: calc(100% - 24px);
  overflow: hidden;
  text-overflow: ellipsis;
}

#toast::before {
  content: '★';
  position: absolute;
  left: 8px;
  top: 50%;
  width: 28px;
  height: 28px;
  margin-top: -14px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--gold);
  color: var(--plum-ink);
  font-size: 16px;
}

#toast.show {
  animation: toast 3.4s ease both;
}

@keyframes toast {
  0% {
    opacity: 0;
    transform: translate(-50%, -20px);
  }
  10%,
  85% {
    opacity: 1;
    transform: translate(-50%, 0);
  }
  100% {
    opacity: 0;
    transform: translate(-50%, -12px);
  }
}

.reduced #toast.show {
  animation-name: fade-only;
}

/* ---------------------------------------------------------------- Screens: panels docked left */
.overlay {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  gap: 18px;
  padding: max(20px, env(safe-area-inset-top)) max(20px, env(safe-area-inset-right))
    max(20px, env(safe-area-inset-bottom)) max(clamp(20px, 5vw, 72px), env(safe-area-inset-left));
  /* Darken only the side the panel sits on, so the scene keeps its light. */
  background: linear-gradient(
    90deg,
    rgba(90, 40, 50, 0.32),
    rgba(90, 40, 50, 0.1) 45%,
    rgba(90, 40, 50, 0) 70%
  );
  animation: fade-in 0.3s ease-out;
}

@keyframes fade-in {
  from {
    opacity: 0;
  }
}

.card {
  position: relative;
  width: min(420px, 100%);
  max-height: 100%;
  overflow: auto;
  overscroll-behavior: contain;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 10px;
  padding: 26px 24px 22px;
  border-radius: 28px;
  background: var(--glass);
  -webkit-backdrop-filter: blur(18px) saturate(1.3);
  backdrop-filter: blur(18px) saturate(1.3);
  box-shadow:
    var(--panel-shadow),
    inset 0 2px 0 var(--edge-light);
  text-align: left;
  scrollbar-width: thin;
  scrollbar-color: rgba(120, 66, 44, 0.3) transparent;
  animation: panel-in 0.5s var(--ease-out);
}

/* Never squash buttons on short screens: the panel scrolls instead (keeps 44 px touch targets). */
.card > * {
  flex-shrink: 0;
}

@keyframes panel-in {
  from {
    transform: translateX(-28px);
    opacity: 0;
  }
}

.card h2 {
  margin: 0 0 6px;
  font-family: var(--display);
  font-weight: 400;
  font-size: 38px;
  line-height: 1;
  letter-spacing: 0.01em;
  color: var(--paper);
}

.small {
  margin: 0;
  font-size: 14px;
  color: var(--paper-dim);
}

.small:empty {
  display: none;
}

/* Main action: a big coral pill with a pressable lip. */
.btn {
  position: relative;
  width: 100%;
  min-height: 50px;
  padding: 0 22px;
  border: 0;
  border-radius: 18px;
  font-weight: 600;
  font-size: 19px;
  cursor: pointer;
  background: #f1e2cf;
  color: var(--paper);
  box-shadow: 0 4px 0 rgba(120, 52, 34, 0.2);
  transition:
    transform 0.15s var(--ease-out),
    filter 0.15s,
    box-shadow 0.15s;
}

.btn.primary {
  min-height: 60px;
  margin-bottom: 6px;
  font-family: var(--display);
  font-weight: 400;
  font-size: 30px;
  letter-spacing: 0.02em;
  color: #fff;
  text-shadow: 0 2px 0 rgba(120, 25, 15, 0.45);
  background: linear-gradient(180deg, #ff7a5f 0%, var(--coral) 45%, #e8432e 100%);
  box-shadow:
    0 6px 0 var(--coral-deep),
    0 18px 30px -10px rgba(255, 90, 69, 0.55),
    inset 0 2px 0 rgba(255, 255, 255, 0.35);
}

.btn.primary::after {
  /* a slow sheen across the main action */
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: linear-gradient(
      105deg,
      transparent 35%,
      rgba(255, 255, 255, 0.28) 50%,
      transparent 65%
    )
    no-repeat;
  background-size: 250% 100%;
  background-position: 120% 0;
  animation: sheen 4.5s ease-in-out 1.2s infinite;
  pointer-events: none;
}

@keyframes sheen {
  0%,
  70% {
    background-position: 120% 0;
  }
  100% {
    background-position: -120% 0;
  }
}

.btn:hover {
  filter: brightness(1.06);
  transform: translateY(-2px);
}

.btn.primary:hover {
  box-shadow:
    0 8px 0 var(--coral-deep),
    0 22px 34px -10px rgba(255, 90, 69, 0.6),
    inset 0 2px 0 rgba(255, 255, 255, 0.35);
}

.btn:active,
.btn.primary:active {
  transform: translateY(4px);
  box-shadow:
    0 2px 0 var(--coral-deep),
    inset 0 2px 0 rgba(255, 255, 255, 0.25);
}

.btn:not(.primary):active {
  box-shadow: 0 1px 0 rgba(120, 52, 34, 0.2);
}

/* Secondary actions: a list, like a console menu; the focused item gets a ball marker. */
.menu-item {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 46px;
  padding: 0 16px 0 40px;
  border: 0;
  border-radius: 16px;
  background: transparent;
  color: var(--paper);
  font-weight: 600;
  font-size: 21px;
  text-align: left;
  cursor: pointer;
  transition:
    background-color 0.15s,
    color 0.15s,
    padding 0.2s var(--ease-out);
}

.menu-item::before {
  content: '';
  position: absolute;
  left: 14px;
  top: 50%;
  width: 14px;
  height: 14px;
  margin-top: -7px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #ff9a84, var(--coral) 55%, #c8402c);
  box-shadow: 0 2px 3px rgba(120, 40, 20, 0.35);
  opacity: 0;
  transform: scale(0.3) translateX(-8px);
  transition:
    opacity 0.15s,
    transform 0.25s var(--ease-spring);
}

.menu-item:hover,
.menu-item:focus-visible {
  background: var(--glass-soft);
  color: var(--paper);
  padding-left: 44px;
}

.menu-item:hover::before,
.menu-item:focus-visible::before {
  opacity: 1;
  transform: none;
}

.menu-item:focus-visible {
  outline: 2px solid var(--paper);
  outline-offset: 0;
}

.menu-item .count {
  margin-left: auto;
  padding: 2px 10px;
  border-radius: 999px;
  background: rgba(255, 195, 90, 0.35);
  color: var(--gold-text);
  font-size: 15px;
  font-variant-numeric: tabular-nums;
}

/* Low-key toggles (language, reduce motion). */
.quiet {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.quiet .chip {
  min-height: 36px;
  font-size: 13px;
}

/* ---------------------------------------------------------------- Title screen */
.menu-screen {
  justify-content: center;
  gap: clamp(14px, 3vh, 26px);
}

.title-block {
  animation: title-in 0.9s var(--ease-out) both;
}

/* Logo: Shrikhand lockup, tilted as one piece. Two layers per word: a plum back layer (stroke + extrusion + soft
   shadow) and the gradient fill on top with no stroke, so the counters of e/a/R stay open. The ping-pong ball is
   the setting sun, tucked between the "t" and the "y". */
@font-face {
  font-family: 'Shrikhand';
  src: url('./shrikhand-logo-fqExYxud.woff') format('woff');
  font-display: block;
}

.logo {
  position: relative;
  display: inline-block;
  margin: 0;
  padding-right: 0.5em; /* room for the ball, so centring looks centred */
  font:
    400 clamp(54px, min(7vw, 10.5vh), 92px) / 0.86 'Shrikhand',
    var(--display);
  font-synthesis: none;
  letter-spacing: 0;
  transform: rotate(-5deg);
  transform-origin: 50% 60%;
}

.logo-word {
  position: relative;
  display: block;
  width: max-content;
  white-space: nowrap;
}

.logo-word::before {
  content: attr(data-t);
  position: absolute;
  inset: 0;
  color: var(--plum-ink);
  -webkit-text-stroke: 0.15em var(--plum-ink);
  text-shadow:
    0 0.075em 0 var(--plum-ink),
    0 0.14em 0.16em rgba(42, 22, 48, 0.35);
}

.logo-word > span {
  position: relative;
  color: transparent;
  -webkit-background-clip: text;
  background-clip: text;
}

.logo .w1 > span {
  background-image: linear-gradient(180deg, #ffe08a 8%, #ffc35a 34%, #ff8a4c 66%, #ff5a45 92%);
}

.logo .w2 {
  font-size: 1.1em;
  margin: -0.02em 0 0 0.62em;
}

.logo .w2 > span {
  background-image: linear-gradient(180deg, #fffaf0 40%, #ffe6c8 95%);
}

.logo-ball {
  position: absolute;
  left: 3.86em;
  top: 0.8em;
  width: 0.42em;
  height: 0.42em;
  border-radius: 50%;
  background: radial-gradient(
    circle at 36% 30%,
    #fff 0 16%,
    #fff4e0 46%,
    #ffd08a 78%,
    #ffb04a 100%
  );
  box-shadow:
    0 0 0 0.075em var(--plum-ink),
    0 0.075em 0 0.075em var(--plum-ink),
    0 0 0.5em 0.12em rgba(255, 195, 90, 0.55);
}

@keyframes title-in {
  from {
    transform: translateY(-18px);
    opacity: 0;
  }
}

.rule {
  margin: 4px 0 0 0.25em;
  font-size: 14px;
  color: var(--light);
  opacity: 0.9;
  text-shadow: 0 1px 8px rgba(40, 14, 30, 0.85);
}

.tagline {
  margin: 12px 0 0 0.2em;
  font-weight: 600;
  font-size: clamp(15px, 1.6vw, 19px);
  color: var(--light);
  text-shadow: 0 1px 8px rgba(40, 14, 30, 0.8);
}

.menu-card {
  width: min(400px, 100%);
  padding: 16px 14px 14px;
  gap: 4px;
  animation-delay: 0.12s;
  animation-fill-mode: both;
}

.menu-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.menu-list .menu-item {
  animation: item-in 0.5s var(--ease-out) both;
}

.menu-list .menu-item:nth-child(2) {
  animation-delay: 0.22s;
}
.menu-list .menu-item:nth-child(3) {
  animation-delay: 0.27s;
}
.menu-list .menu-item:nth-child(4) {
  animation-delay: 0.32s;
}
.menu-list .menu-item:nth-child(5) {
  animation-delay: 0.37s;
}

@keyframes item-in {
  from {
    transform: translateX(-14px);
    opacity: 0;
  }
}

/* The player's record: big figures over small labels. */
.stats {
  display: flex;
  gap: 6px;
  margin: 10px 0 2px;
}

.stats:empty {
  display: none;
}

.stats p {
  flex: 1;
  margin: 0;
  padding: 10px 12px 9px;
  border-radius: 14px;
  background: var(--well);
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.stats .coin {
  margin-right: 4px;
  font-size: 20px;
}

.stats b {
  font-family: var(--display);
  font-weight: 400;
  font-size: 24px;
  line-height: 1;
  color: var(--accent-text);
  font-variant-numeric: tabular-nums;
}

.stats span {
  font-size: 12px;
  line-height: 1.2;
  color: var(--paper-dim);
}

.menu-foot {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: 6px;
  padding-top: 10px;
  border-top: 1px solid var(--glass-line);
}

.reduced .title-block,
.reduced .card,
.reduced .menu-list .menu-item,
.reduced .btn.primary::after,
.reduced #hint-main {
  animation: none;
}

/* ---------------------------------------------------------------- Choices: segmented tracks */
.group-label {
  margin: 10px 0 0;
  font-weight: 600;
  font-size: 14px;
  color: var(--paper-dim);
}

.options {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  padding: 4px;
  border-radius: 16px;
  background: var(--well);
  box-shadow: inset 0 2px 3px rgba(120, 52, 34, 0.12);
}

.chip {
  flex: 1 1 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 40px;
  padding: 6px 14px;
  border: 0;
  border-radius: 12px;
  background: transparent;
  font-size: 15px;
  font-weight: 600;
  color: var(--paper-dim);
  cursor: pointer;
  transition:
    background-color 0.15s,
    color 0.15s,
    transform 0.15s var(--ease-out);
}

.chip:hover {
  color: var(--paper);
  background: rgba(255, 255, 255, 0.55);
}

.chip[aria-pressed='true'] {
  background: linear-gradient(180deg, #ffd27a, var(--gold));
  color: var(--plum-ink);
  box-shadow:
    0 2px 0 var(--gold-deep),
    inset 0 1px 0 rgba(255, 255, 255, 0.6);
}

.chip:active {
  transform: scale(0.97);
}

.chip svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  flex: none;
}

.quiet .chip {
  flex: 0 0 auto;
  background: transparent;
  box-shadow: inset 0 0 0 2px #ead6bf;
}

.quiet .chip[aria-pressed='true'] {
  background: rgba(255, 195, 90, 0.3);
  color: var(--gold-text);
  box-shadow: inset 0 0 0 2px var(--gold);
}

/* Ambient: four equal segments. */
.seg4 {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
}

.seg4 .chip {
  flex-direction: column;
  gap: 2px;
  min-height: 56px;
  padding: 6px 4px;
  font-size: 13px;
}

/* Places: postcards with a little painted view. */
.places {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  padding: 0;
  background: none;
  box-shadow: none;
}

.place-card {
  flex-direction: column;
  align-items: stretch;
  gap: 0;
  padding: 0;
  overflow: hidden;
  border-radius: 16px;
  background: var(--well);
  box-shadow: inset 0 0 0 2px transparent;
  text-align: left;
}

.place-card span {
  padding: 8px 12px 10px;
  font-size: 14px;
  line-height: 1.2;
}

.place-card[aria-pressed='true'] {
  background: #fff;
  color: var(--paper);
  box-shadow:
    0 0 0 3px var(--gold),
    0 4px 0 3px var(--gold-deep);
}

.place-card[aria-pressed='true'] span {
  color: var(--gold-text);
}

.thumb {
  display: block;
  height: 64px;
  position: relative;
}

/* Real renders of each place (made from the game itself, 480 x 229 for Retina). */
.thumb {
  background-size: cover;
  background-position: center;
}

.thumb.garden {
  background-image: url('./thumb-garden-DKZNeWbt.jpg');
}

.thumb.sakura {
  background-image: url('./thumb-sakura-mBCEshfS.jpg');
}

.thumb.cafe {
  background-image: url('./thumb-cafe-xCVKYp7O.jpg');
}

.setup-card {
  width: min(440px, 100%);
}

.setup-card .vol-row {
  margin-top: 6px;
}

.setup-card .vol-label {
  width: auto;
  flex: 0 0 44%;
  color: var(--paper-dim);
}

.setup-card .btn.primary,
.camp-card > .btn.primary,
.ws-card > .btn.primary {
  margin-top: 10px;
  /* Pinned to the bottom of the panel when it scrolls (short screens): OK is always reachable. */
  position: sticky;
  bottom: -12px;
  box-shadow:
    0 6px 0 var(--coral-deep),
    0 0 0 12px #fff7ea,
    0 -10px 18px 6px #fff7ea;
}

/* ---------------------------------------------------------------- Workshop */
.ws-card {
  width: min(820px, 100%);
}

.ws-body {
  width: 100%;
  display: flex;
  flex-wrap: wrap;
  gap: 18px;
  align-items: flex-start;
}

/* The preview and the buy bar stay in view while the options scroll. */
.ws-side {
  position: sticky;
  top: 0;
  z-index: 2;
  flex: 0 0 auto;
  width: min(250px, 100%);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

#ws-canvas {
  flex: 0 0 auto;
  width: 100%;
  aspect-ratio: 1;
  border-radius: 22px;
  background:
    radial-gradient(circle at 50% 40%, #fff6e6, transparent 65%),
    radial-gradient(circle at 50% 120%, rgba(255, 140, 100, 0.45), transparent 60%), #f2dcc0;
  box-shadow: inset 0 2px 6px rgba(120, 52, 34, 0.15);
}

#ws-groups {
  flex: 1 1 300px;
  min-width: 0;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  column-gap: 16px;
}

.ws-group:first-child {
  grid-column: 1 / -1;
}

.ws-group .group-label {
  margin: 10px 0 6px;
}

.ws-group .options {
  justify-content: flex-start;
}

.ws-group .options:has(.swatch) {
  background: none;
  box-shadow: none;
  padding: 0;
  gap: 6px;
}

.swatch {
  flex: none;
  width: 40px;
  height: 40px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  cursor: pointer;
  box-shadow:
    inset 0 -3px 0 rgba(0, 0, 0, 0.2),
    0 0 0 2px rgba(120, 66, 44, 0.1);
  transition:
    transform 0.15s var(--ease-spring),
    box-shadow 0.15s;
}

.swatch:hover {
  transform: translateY(-2px);
}

.swatch[aria-pressed='true'] {
  transform: scale(1.06);
  box-shadow:
    inset 0 -3px 0 rgba(0, 0, 0, 0.2),
    0 0 0 3px #fff7ea,
    0 0 0 6px var(--paper);
}

/* ---------------------------------------------------------------- Achievements */
.trophy-card {
  width: min(520px, 100%);
}

#trophy-list {
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 6px;
}

#trophy-list li {
  display: grid;
  grid-template-columns: 40px 1fr;
  column-gap: 12px;
  align-items: center;
  padding: 10px 12px;
  border-radius: 16px;
  background: var(--well);
  color: var(--paper-dim);
}

#trophy-list li.done {
  background: linear-gradient(90deg, rgba(255, 195, 90, 0.45), rgba(255, 195, 90, 0.15));
  color: var(--paper);
  box-shadow: inset 0 0 0 2px rgba(229, 150, 42, 0.45);
}

#trophy-list .mark {
  grid-row: span 2;
  width: 40px;
  height: 40px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  font-size: 20px;
  background: rgba(255, 255, 255, 0.6);
  color: var(--paper-faint);
}

#trophy-list li.done .mark {
  background: linear-gradient(180deg, #ffd27a, var(--gold));
  color: var(--plum-ink);
  box-shadow: 0 2px 0 var(--gold-deep);
}

#trophy-list b {
  font-size: 16px;
  font-weight: 600;
}

#trophy-list li.done b {
  color: var(--gold-text);
}

#trophy-list span:not(.mark) {
  font-size: 13px;
  line-height: 1.3;
}

/* ---------------------------------------------------------------- Result */
#result .card {
  align-items: stretch;
}

.final {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 6px 0 10px;
}

.final .flip {
  font-size: 76px;
  min-width: 1.1em;
  color: #fff;
  background: linear-gradient(180deg, #ff7a5f 0 50%, var(--coral-ui) 50% 100%);
  box-shadow:
    0 5px 0 var(--coral-deep),
    inset 0 1px 0 rgba(255, 255, 255, 0.4);
  text-shadow: 0 3px 0 rgba(0, 0, 0, 0.2);
  animation: flip-in 0.7s var(--ease-spring) both;
}

.final .flip.rival {
  background: var(--rival-ui, var(--blue-ui));
  background-image: linear-gradient(
    180deg,
    rgba(255, 255, 255, 0.18) 0 50%,
    rgba(0, 0, 0, 0.04) 50% 100%
  );
  box-shadow:
    0 5px 0 rgba(0, 0, 0, 0.35),
    inset 0 1px 0 rgba(255, 255, 255, 0.35);
  animation-delay: 0.12s;
}

.final .flip::after {
  background: rgba(0, 0, 0, 0.22);
}

@keyframes flip-in {
  from {
    transform: perspective(300px) rotateX(-90deg);
    opacity: 0;
  }
}

.reduced .final .flip {
  animation: none;
}

.dash {
  font-family: var(--display);
  font-size: 48px;
  color: #d8c3ad;
}

#result-stats {
  white-space: pre-line;
  line-height: 1.6;
  margin-bottom: 8px;
  padding: 10px 14px;
  border-radius: 14px;
  background: var(--well);
}

/* ---------------------------------------------------------------- Audio popover */
#audio-pop {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  width: min(280px, calc(100vw - 24px));
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 10px 14px 10px 10px;
  border-radius: 20px;
  background: var(--glass-strong);
  -webkit-backdrop-filter: blur(16px);
  backdrop-filter: blur(16px);
  box-shadow:
    var(--panel-shadow),
    inset 0 1px 0 var(--edge-light);
  animation: pop-down 0.25s var(--ease-out);
}

@keyframes pop-down {
  from {
    transform: translateY(-8px);
    opacity: 0;
  }
}

.vol-row {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 46px;
}

.vol-btn {
  flex: none;
  width: 40px;
  height: 40px;
  border: 0;
  border-radius: 12px;
  background: linear-gradient(180deg, #ffd27a, var(--gold));
  color: var(--plum-ink);
  display: grid;
  place-items: center;
  cursor: pointer;
}

.vol-btn[aria-pressed='false'] {
  background: #ecdcc7;
  color: var(--paper-dim);
}

.vol-btn svg {
  width: 22px;
  height: 22px;
  fill: currentColor;
  stroke: currentColor;
}

.vol-label {
  flex: none;
  width: 60px;
  font-size: 14px;
  font-weight: 600;
  color: var(--paper);
}

/* Sliders: gold fill on a dark groove. */
.vol-slider {
  flex: 1;
  min-width: 0;
  height: 32px;
  margin: 0;
  accent-color: var(--coral-ui);
  cursor: pointer;
  touch-action: pan-x;
}

/* ---------------------------------------------------------------- Replay */
#replay {
  position: absolute;
  inset: 0;
  z-index: 20;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  align-items: center;
  padding: max(14px, env(safe-area-inset-top)) max(16px, env(safe-area-inset-right))
    max(16px, env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left));
  pointer-events: none;
}

#replay[hidden] {
  display: none;
}

#replay::before,
#replay::after {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  height: min(7vh, 52px);
  background: rgba(20, 8, 24, 0.85);
}

#replay::before {
  top: 0;
}

#replay::after {
  bottom: 0;
}

.replay-tag {
  position: relative;
  z-index: 1;
  align-self: flex-start;
  margin: 0;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 16px;
  border-radius: 999px;
  background: var(--glass-strong);
  color: var(--paper);
  font-family: var(--display);
  font-size: 18px;
  letter-spacing: 0.01em;
  box-shadow: inset 0 0 0 1px var(--glass-line);
}

.replay-tag i {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--coral);
  box-shadow: 0 0 10px var(--coral);
  animation: rec-blink 1.1s steps(2, jump-none) infinite;
}

@keyframes rec-blink {
  50% {
    opacity: 0.25;
  }
}

.reduced .replay-tag i {
  animation: none;
}

.replay-foot {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  width: min(420px, 100%);
}

.replay-bar {
  width: 100%;
  height: 6px;
  border-radius: 3px;
  background: rgba(255, 243, 227, 0.25);
  overflow: hidden;
}

.replay-bar i {
  display: block;
  height: 100%;
  background: var(--gold);
  transform: scaleX(0);
  transform-origin: left;
}

.replay-foot .btn {
  width: auto;
  min-width: 140px;
  pointer-events: auto;
}

#fatal {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 24px;
  text-align: center;
  font-size: 18px;
  background: #fff7ea;
  color: var(--paper);
}

/* ---------------------------------------------------------------- Phones, portrait: bottom sheets */
@media (max-width: 640px) {
  .overlay {
    justify-content: flex-end;
    align-items: stretch;
    padding: max(12px, env(safe-area-inset-top)) 10px max(10px, env(safe-area-inset-bottom));
    background: linear-gradient(
      0deg,
      rgba(90, 40, 50, 0.35),
      rgba(90, 40, 50, 0.08) 55%,
      rgba(90, 40, 50, 0)
    );
  }
  .card {
    width: 100%;
    max-height: 86%;
    padding: 20px 16px 16px;
    border-radius: 28px;
    animation-name: sheet-in;
  }
  @keyframes sheet-in {
    from {
      transform: translateY(40px);
      opacity: 0;
    }
  }
  .card h2 {
    font-size: 32px;
  }
  .menu-screen {
    justify-content: space-between;
  }
  .title-block {
    margin-top: 64px;
    align-self: center;
    text-align: center;
  }
  .logo {
    font-size: clamp(44px, 17vw, 78px);
  }
  .tagline,
  .rule {
    margin-left: 0;
  }
  .menu-card {
    width: 100%;
  }
  .btn.primary {
    min-height: 58px;
    font-size: 27px;
  }
  .menu-item {
    min-height: 46px;
    font-size: 19px;
  }
  .ws-body {
    flex-direction: column;
    align-items: center;
  }
  .ws-side {
    width: 100%;
    flex-direction: row;
    align-items: center;
    padding-bottom: 6px;
    background: #fff7ea;
  }
  #ws-canvas {
    width: 120px;
  }
  .ws-side .ws-buy {
    flex: 1;
  }
  #ws-groups {
    width: 100%;
  }

  /* HUD: compact scorer on the left so it never meets the corner buttons. */
  #hud {
    left: max(10px, env(safe-area-inset-left));
    transform: none;
    align-items: flex-start;
  }
  .scoreboard {
    padding: 4px;
    gap: 4px;
    border-radius: 16px;
  }
  .side {
    gap: 6px;
    padding: 3px;
    border-radius: 12px;
  }
  .side.you {
    padding-left: 8px;
  }
  .side.rival {
    padding-right: 8px;
  }
  .name {
    font-size: 13px;
  }
  .pts {
    font-size: 26px;
  }
  .serve-dot {
    width: 10px;
    height: 10px;
  }
  #hint {
    top: auto;
    bottom: max(24px, env(safe-area-inset-bottom));
    width: calc(100% - 28px);
  }
  #callout.high {
    top: calc(max(12px, env(safe-area-inset-top)) + 70px);
  }
  .final .flip {
    font-size: 64px;
  }
}

@media (max-width: 380px) {
  .name {
    display: none;
  }
  .side.you {
    padding-left: 3px;
  }
  .side.rival {
    padding-right: 3px;
  }
  #corner {
    gap: 4px;
  }
  .icon-btn {
    width: 42px;
    height: 42px;
  }
}

/* ---------------------------------------------------------------- Short landscape phones */
@media (max-height: 460px) {
  .overlay {
    padding-top: max(10px, env(safe-area-inset-top));
    padding-bottom: max(10px, env(safe-area-inset-bottom));
  }
  .menu-screen {
    flex-direction: row;
    align-items: center;
    justify-content: flex-start;
    gap: 24px;
  }
  .logo {
    font-size: 46px;
  }
  .menu-card {
    width: min(340px, 50vw);
    max-height: 100%;
  }
  .card {
    gap: 6px;
    padding: 14px 16px;
  }
  .card h2 {
    font-size: 28px;
  }
  .btn.primary {
    min-height: 50px;
    font-size: 24px;
  }
  .menu-item,
  .btn {
    min-height: 44px;
    font-size: 18px;
  }
  .chip,
  .vol-btn {
    min-height: 44px;
  }
  .vol-slider {
    height: 44px;
  }
  .stats {
    display: none;
  }
  .setup-card .btn.primary {
    position: sticky;
    bottom: -14px;
    box-shadow:
      0 6px 0 var(--coral-deep),
      0 0 0 10px #fff7ea;
  }
  #hint {
    top: auto;
    left: max(12px, env(safe-area-inset-left));
    bottom: max(10px, env(safe-area-inset-bottom));
    transform: none;
    width: min(280px, 36vw);
    padding: 8px 14px;
    border-radius: 16px;
    text-align: left;
    animation-name: hint-in-left;
  }
  #hint-main {
    font-size: 17px;
  }
  #hint-sub {
    font-size: 12px;
    line-height: 1.25;
  }
  .rally {
    font-size: 12px;
    min-height: 18px;
  }
  #callout.high {
    top: calc(max(8px, env(safe-area-inset-top)) + 84px);
  }
}

@keyframes hint-in-left {
  from {
    transform: translateY(16px);
    opacity: 0;
  }
}

/* The paper panels are nearly opaque: no backdrop blur over the live 3D view (it would cost every frame). */
.card,
.scoreboard,
.icon-btn,
#hint,
#audio-pop {
  -webkit-backdrop-filter: none;
  backdrop-filter: none;
}

/* Phones: fully opaque paper. */
@media (pointer: coarse) {
  .card,
  .scoreboard,
  .icon-btn,
  #hint,
  #audio-pop {
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
  }
  .card,
  .icon-btn,
  #hint {
    background: #fff7ea;
  }
}

/* No blur support: a solid panel keeps the text readable. */
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  .card,
  .scoreboard,
  .icon-btn,
  #hint,
  #audio-pop {
    background: #fff7ea;
  }
}

/* ---------------------------------------------------------------- Title: "tap to start" */
.tap-start {
  display: none;
}

#menu.splash .menu-card {
  display: none;
}

#menu.splash {
  cursor: pointer;
}

#menu.splash .tap-start {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  margin-top: 26px;
  padding: 14px 28px 14px 22px;
  border: 0;
  border-radius: 999px;
  background: var(--glass-strong);
  color: var(--accent-text);
  font-family: var(--display);
  font-size: clamp(22px, 2.6vw, 30px);
  letter-spacing: 0.02em;
  box-shadow:
    0 6px 0 rgba(120, 52, 34, 0.2),
    0 18px 34px -12px rgba(70, 25, 30, 0.5);
  cursor: pointer;
  animation: tap-pulse 1.4s ease-in-out infinite;
}

.tap-start svg {
  width: 30px;
  height: 30px;
  stroke: currentColor;
  animation: tap-finger 1.4s ease-in-out infinite;
}

.tap-touch {
  display: none;
}

@media (pointer: coarse) {
  .tap-touch {
    display: inline;
  }
  .tap-mouse {
    display: none;
  }
}

@keyframes tap-pulse {
  50% {
    transform: scale(1.05);
  }
}

@keyframes tap-finger {
  40% {
    transform: translateY(4px) scale(0.92);
  }
}

.reduced #menu.splash .tap-start,
.reduced .tap-start svg {
  animation: none;
}

@media (max-width: 640px) {
  #menu.splash {
    justify-content: center;
  }
  #menu.splash .title-block {
    margin-top: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
  }
}

/* ---------------------------------------------------------------- Coins */
.coin {
  display: inline-block;
  flex: none;
  width: 1.05em;
  height: 1.05em;
  border-radius: 50%;
  vertical-align: -0.16em;
  background: radial-gradient(circle at 38% 32%, #fff3b8 0 12%, #ffd45a 34%, #f2a91e 78%);
  box-shadow:
    inset 0 0 0 0.11em #d98a12,
    inset 0 0 0 0.2em rgba(255, 236, 160, 0.65),
    0 1px 0 rgba(120, 60, 10, 0.35);
}

.coin-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px 5px 8px;
  border-radius: 999px;
  background: rgba(255, 195, 90, 0.28);
  color: var(--gold-text);
  font-family: var(--display);
  font-size: 20px;
  font-variant-numeric: tabular-nums;
}

.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.card-head h2 {
  margin: 0;
}

/* The main button carries the campaign progress under its label. */
.camp-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  line-height: 1;
}

.camp-btn small {
  font-family: 'Fredoka', sans-serif;
  font-weight: 600;
  font-size: 13px;
  letter-spacing: 0;
  text-shadow: none;
  opacity: 0.9;
}

.camp-btn small:empty {
  display: none;
}

/* ---------------------------------------------------------------- Campaign screen */
.camp-card {
  width: min(480px, 100%);
}

.camp-stars {
  margin: 2px 0 4px;
  font-family: var(--display);
  font-size: 18px;
  color: var(--gold-text);
}

#camp-stages {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.camp-stage-head {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 6px;
}

.camp-stage-head .thumb {
  flex: none;
  width: 92px;
  height: 44px;
  border-radius: 12px;
  box-shadow: 0 2px 0 rgba(120, 52, 34, 0.18);
}

.camp-stage-head h3 {
  margin: 0;
  font-family: var(--display);
  font-weight: 400;
  font-size: 21px;
  line-height: 1.05;
}

.camp-prize {
  margin: 2px 0 0;
  font-size: 13px;
  color: var(--paper-dim);
}

.camp-prize.done {
  color: var(--gold-text);
  font-weight: 600;
}

.camp-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.camp-match {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-height: 56px;
  padding: 8px 14px 8px 10px;
  border: 0;
  border-radius: 16px;
  background: var(--well);
  color: var(--paper);
  text-align: left;
  cursor: pointer;
  transition:
    background-color 0.15s,
    transform 0.15s var(--ease-out),
    box-shadow 0.15s;
}

.camp-match:hover:not(:disabled) {
  background: #fff;
  transform: translateY(-1px);
}

.camp-match:focus-visible {
  outline: 2px solid var(--paper);
  outline-offset: 2px;
}

.camp-match.next {
  background: #fff;
  box-shadow:
    0 0 0 3px var(--gold),
    0 4px 0 3px var(--gold-deep);
}

.camp-match.locked {
  cursor: default;
  opacity: 0.55;
}

.cm-n {
  flex: none;
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--glass-strong);
  font-family: var(--display);
  font-size: 18px;
  box-shadow: inset 0 0 0 2px var(--glass-line);
}

.camp-match.next .cm-n {
  background: var(--coral);
  color: #fff;
  box-shadow: none;
}

.cm-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.cm-main b {
  font-size: 17px;
  font-weight: 600;
}

.cm-main small {
  font-size: 13px;
  color: var(--paper-dim);
}

.cm-stars {
  flex: none;
  display: flex;
  gap: 3px;
}

/* A five-point star, empty or gold. */
.cm-stars i,
.star-row i,
.price.prize .star {
  display: inline-block;
  width: 20px;
  height: 20px;
  background: rgba(120, 66, 44, 0.18);
  clip-path: polygon(
    50% 2%,
    62% 36%,
    98% 37%,
    69% 59%,
    80% 95%,
    50% 74%,
    20% 95%,
    31% 59%,
    2% 37%,
    38% 36%
  );
}

.cm-stars i.on,
.star-row li.on i,
.price.prize .star {
  background: linear-gradient(180deg, #ffd96a, #f2a91e);
}

.cm-lock {
  flex: none;
  width: 22px;
  height: 22px;
  fill: var(--paper-faint);
  stroke: var(--paper-faint);
}

.cm-tag {
  position: absolute;
  top: -8px;
  right: 12px;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--coral);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
}

/* ---------------------------------------------------------------- Shop: locked items, buy bar */
.chip.locked,
.swatch.locked {
  position: relative;
}

.chip.locked {
  color: var(--paper);
}

.price {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  margin-left: 6px;
  font-size: 12px;
  font-weight: 700;
  color: var(--gold-text);
}

.swatch .price {
  position: absolute;
  right: 50%;
  transform: translateX(50%);
  bottom: -9px;
  margin: 0;
  padding: 1px 5px 1px 2px;
  border-radius: 999px;
  background: #fff7ea;
  box-shadow: 0 1px 2px rgba(80, 40, 30, 0.3);
  font-size: 10px;
}

.price.prize {
  padding: 1px 7px;
  border-radius: 999px;
  background: rgba(255, 195, 90, 0.35);
  font-size: 11px;
}

.ws-group .options:has(.swatch) {
  row-gap: 16px;
}

.chip.trying,
.swatch.trying {
  opacity: 1;
  color: var(--paper);
  box-shadow:
    0 0 0 3px #fff7ea,
    0 0 0 5px var(--coral);
}

.ws-buy {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 8px;
  padding: 10px 12px;
  border-radius: 16px;
  background: rgba(255, 195, 90, 0.22);
  box-shadow: inset 0 0 0 2px rgba(229, 150, 42, 0.45);
}

.ws-buy p:empty {
  display: none;
}

.ws-buy p {
  margin: 0;
  font-size: 14px;
  font-weight: 600;
  color: var(--paper-dim);
}

.btn.buy {
  width: 100%;
  min-height: 46px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0 18px;
  background: linear-gradient(180deg, #ffd27a, var(--gold));
  color: var(--plum-ink);
  font-family: var(--display);
  font-weight: 400;
  font-size: 20px;
  box-shadow: 0 4px 0 var(--gold-deep);
}

.btn.buy:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  transform: none;
}

/* ---------------------------------------------------------------- Result: campaign stars and coins */
.result-camp {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.result-sub {
  margin: 0;
  font-size: 14px;
  font-weight: 600;
  color: var(--paper-dim);
}

.star-row {
  display: flex;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.star-row li {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 10px 6px 8px;
  border-radius: 14px;
  background: var(--well);
  font-size: 12px;
  font-weight: 600;
  color: var(--paper-faint);
  text-align: center;
}

.star-row li i {
  width: 30px;
  height: 30px;
}

.star-row li.on {
  color: var(--gold-text);
  background: rgba(255, 195, 90, 0.25);
}

.star-row li.on i {
  animation: star-pop 0.5s var(--ease-spring) both;
}

.star-row li:nth-child(2).on i {
  animation-delay: 0.15s;
}

.star-row li:nth-child(3).on i {
  animation-delay: 0.3s;
}

@keyframes star-pop {
  from {
    transform: scale(0.2) rotate(-40deg);
  }
}

.result-prize {
  margin: 0;
  padding: 8px 12px;
  border-radius: 12px;
  background: linear-gradient(90deg, rgba(255, 195, 90, 0.4), rgba(255, 195, 90, 0.12));
  color: var(--gold-text);
  font-weight: 600;
  font-size: 14px;
}

.coins-earned {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 2px 0 6px;
  font-family: var(--display);
  font-size: 24px;
  color: var(--gold-text);
  animation: star-pop 0.5s var(--ease-spring) 0.45s both;
}

.reduced .star-row li.on i,
.reduced .coins-earned {
  animation: none;
}

/* ---------------------------------------------------------------- Campaign: second pass */
.goals {
  display: flex;
  gap: 6px;
}

.goals span {
  padding: 3px 10px;
  border-radius: 999px;
  background: var(--glass-strong);
  font-size: 12px;
  font-weight: 600;
  color: var(--paper-dim);
  box-shadow: 0 2px 0 rgba(120, 52, 34, 0.15);
  transition:
    background-color 0.3s,
    color 0.3s;
}

.goals span.done {
  background: #ffe2a0;
  color: var(--gold-text);
}

#hud.training .goals {
  display: none;
}

.camp-card .card-head h2 {
  font-size: clamp(26px, 7.4vw, 34px);
  white-space: nowrap;
}

.icon-btn.small {
  width: 40px;
  height: 40px;
  flex: none;
  box-shadow: inset 0 0 0 2px var(--glass-line);
}

.icon-btn.small svg {
  width: 18px;
  height: 18px;
}

.star-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 14px;
  margin: 0;
  padding: 0;
  list-style: none;
  font-size: 13px;
  font-weight: 600;
  color: var(--gold-text);
}

.star-legend li {
  display: flex;
  align-items: center;
  gap: 5px;
}

.star-legend i {
  width: 16px;
  height: 16px;
  background: linear-gradient(180deg, #ffd96a, #f2a91e);
  clip-path: polygon(
    50% 2%,
    62% 36%,
    98% 37%,
    69% 59%,
    80% 95%,
    50% 74%,
    20% 95%,
    31% 59%,
    2% 37%,
    38% 36%
  );
}

.camp-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.camp-meta .camp-stars {
  margin: 0;
}

.camp-complete {
  margin: 0;
  padding: 10px 14px;
  border-radius: 14px;
  background: linear-gradient(90deg, #ffd27a, #ffe6a8);
  color: var(--plum-ink);
  font-family: var(--display);
  font-size: 19px;
  text-align: center;
}

.star-row li.half {
  color: var(--gold-text);
}

.star-row li.half i {
  background: linear-gradient(180deg, #ffd96a, #f2a91e);
  opacity: 0.45;
}

.star-row li em {
  display: block;
  margin-top: 2px;
  font-style: normal;
  font-size: 11px;
  color: var(--paper-dim);
}

/* The prize: an icon of the item, its name, and "equip now". */
.prize-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 16px;
  background: linear-gradient(90deg, rgba(255, 195, 90, 0.5), rgba(255, 195, 90, 0.18));
  box-shadow: inset 0 0 0 2px rgba(229, 150, 42, 0.5);
}

.prize-card > div {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.prize-card b {
  font-family: var(--display);
  font-weight: 400;
  font-size: 19px;
  line-height: 1.1;
}

.prize-card small {
  font-size: 13px;
  color: var(--paper-dim);
}

.prize-card .btn.buy {
  min-height: 42px;
  padding: 0 14px;
  font-size: 16px;
  width: auto;
  flex: none;
}

.prize-icon {
  flex: none;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  animation: star-pop 0.6s var(--ease-spring) 0.3s both;
}

.prize-icon.ball-gold {
  background: radial-gradient(circle at 36% 30%, #fff8d0 0 14%, #ffd45a 45%, #e59a16 100%);
  box-shadow:
    0 0 0 3px #fff7ea,
    0 0 18px 4px rgba(255, 195, 90, 0.7);
}

.prize-icon.edge-gold {
  background: radial-gradient(circle, #ff6b55 0 58%, #d9a93a 60% 76%, transparent 78%);
  box-shadow: 0 0 16px 3px rgba(255, 195, 90, 0.6);
}

.prize-icon.sticker-blossom {
  background:
    radial-gradient(circle, #ffb04a 0 16%, transparent 17%),
    conic-gradient(
      from 0deg,
      #ffd9e4 0 14%,
      #fff7ea 14% 20%,
      #ffd9e4 20% 34%,
      #fff7ea 34% 40%,
      #ffd9e4 40% 54%,
      #fff7ea 54% 60%,
      #ffd9e4 60% 74%,
      #fff7ea 74% 80%,
      #ffd9e4 80% 94%,
      #fff7ea 94%
    );
  box-shadow:
    0 0 0 3px #3b2a26 inset,
    0 0 16px 3px rgba(255, 170, 200, 0.6);
}

.reduced .prize-icon {
  animation: none;
}

/* Coins: one line per source, then the total and the purse. */
.coin-break {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin: 2px 0 6px;
}

#coin-lines {
  margin: 0;
  padding: 0;
  list-style: none;
}

#coin-lines li {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  font-size: 14px;
  color: var(--paper-dim);
}

#coin-lines b {
  color: var(--gold-text);
  font-weight: 700;
}

.coin-total {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin: 2px 0 0;
  padding-top: 6px;
  border-top: 1px solid var(--glass-line);
}

.coin-total span {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--display);
  font-size: 24px;
  color: var(--gold-text);
  animation: star-pop 0.5s var(--ease-spring) 0.45s both;
}

.coin-total small {
  font-size: 13px;
  color: var(--paper-dim);
}

.coin-hint {
  margin: 0;
  font-size: 13px;
  font-weight: 600;
  color: var(--accent-text);
}

.reduced .coin-total span {
  animation: none;
}

/* Workshop: a "trying on" tag on the preview. */
.ws-preview {
  position: relative;
}

.ws-trying {
  position: absolute;
  top: 8px;
  left: 8px;
  padding: 2px 9px;
  border-radius: 999px;
  background: var(--coral);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
}

/* Menu: the coin purse on the workshop row; a dot when something can be bought. */
.menu-item .count.coins {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.menu-item.can-buy::after {
  content: '';
  position: absolute;
  left: 30px;
  top: 12px;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--coral);
  box-shadow: 0 0 0 2px #fff7ea;
}

@media (max-width: 600px) {
  #toast {
    white-space: normal;
    border-radius: 18px;
    max-width: min(360px, calc(100% - 24px));
    text-align: left;
  }
}

/* Result on wide screens: two columns (the score and stars on the left, coins and actions on the right), so the
   longer campaign result fits without scrolling. On narrow screens the two wrappers dissolve into the card. */
#result .res-main,
#result .res-side {
  display: contents;
}

@media (min-width: 900px) and (min-height: 461px) {
  #result .card {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    column-gap: 28px;
    align-items: start;
    width: min(720px, 100%);
  }
  #result .res-main,
  #result .res-side {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    min-width: 0;
  }
  #result .res-side {
    gap: 10px;
    align-self: center;
  }
  #result .res-side > .coin-break {
    margin-top: 0;
    margin-bottom: 8px;
  }
}

/* ---------------------------------------------------------------- Online */
.menu-item .count.live {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(47, 179, 163, 0.18);
  color: #1d6f66;
}

.menu-item .count.live::before {
  content: '';
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--teal);
  box-shadow: 0 0 0 3px rgba(47, 179, 163, 0.25);
}

.online-card {
  width: min(420px, 100%);
}

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 14px;
  font-weight: 600;
  color: var(--paper-dim);
}

.field input,
.join-row input {
  width: 100%;
  min-height: 48px;
  padding: 0 14px;
  border: 2px solid var(--glass-line);
  border-radius: 14px;
  background: var(--card-paper);
  color: var(--paper);
  font: inherit;
  font-size: 20px;
  font-weight: 600;
  -webkit-user-select: text;
  user-select: text;
}

.field input:focus,
.join-row input:focus {
  outline: none;
  border-color: var(--coral-ui);
  box-shadow: 0 0 0 4px rgba(224, 68, 47, 0.16);
}

.join-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  margin: 2px 0 0;
}

.join-row input {
  font-family: var(--display);
  font-weight: 400;
  font-size: 24px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.join-row input::placeholder {
  font-family: 'Fredoka', sans-serif;
  font-size: 17px;
  letter-spacing: 0;
  text-transform: none;
  color: var(--paper-faint);
}

.join-row .btn {
  width: auto;
  min-height: 48px;
}

.net-note {
  min-height: 1.3em;
  margin: 2px 0 0;
  font-size: 14px;
  font-weight: 600;
  color: var(--paper-dim);
}

.net-note.error {
  color: var(--accent-text);
}

.online-card .btn:disabled,
.online-card .menu-item:disabled {
  opacity: 0.55;
  pointer-events: none;
}

/* Lobby: the table code is the hero, on the same flip cards as the scoreboard. */
.lobby-card {
  width: min(440px, 100%);
  align-items: stretch;
}

.lobby-label {
  margin: 0;
  font-size: 15px;
  font-weight: 600;
  color: var(--paper-dim);
}

.room-code {
  display: flex;
  gap: 8px;
  margin: 2px 0 8px;
  font-size: 0;
}

.room-code .flip {
  font-size: clamp(36px, 9vw, 52px);
  min-width: 1.05em;
  animation: flip-in 0.6s var(--ease-spring) both;
}

.room-code .flip:nth-child(2) {
  animation-delay: 0.05s;
}
.room-code .flip:nth-child(3) {
  animation-delay: 0.1s;
}
.room-code .flip:nth-child(4) {
  animation-delay: 0.15s;
}
.room-code .flip:nth-child(5) {
  animation-delay: 0.2s;
}

.reduced .room-code .flip {
  animation: none;
}

.lobby-share {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: start;
  gap: 10px;
}

.lobby-share .chip {
  min-height: 60px;
  padding: 0 16px;
}

.versus {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 8px;
  padding: 12px;
  border-radius: 18px;
  background: var(--well);
}

.seat {
  display: grid;
  justify-items: center;
  gap: 4px;
  min-width: 0;
  text-align: center;
}

.seat b {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 18px;
}

.seat small {
  font-size: 13px;
  font-weight: 600;
  color: var(--paper-dim);
}

.seat.empty b {
  color: var(--paper-faint);
}

.paddle-dot {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--dot, var(--coral));
  box-shadow:
    inset 0 -3px 0 rgba(0, 0, 0, 0.18),
    0 2px 0 rgba(120, 52, 34, 0.25);
}

.seat.empty .paddle-dot {
  background: transparent;
  box-shadow: inset 0 0 0 2px var(--paper-faint);
  animation: seat-wait 1.4s ease-in-out infinite;
}

@keyframes seat-wait {
  50% {
    transform: scale(0.82);
    opacity: 0.5;
  }
}

.reduced .seat.empty .paddle-dot {
  animation: none;
}

.vs {
  font-family: var(--display);
  font-size: 26px;
  color: var(--paper-faint);
}

.lobby-status {
  min-height: 1.4em;
  margin: 2px 0;
  font-family: var(--display);
  font-size: 24px;
  color: var(--paper);
}

.toggle {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  font-size: 15px;
  font-weight: 600;
  color: var(--paper-dim);
  cursor: pointer;
}

.toggle input {
  width: 22px;
  height: 22px;
  margin: 0;
  accent-color: var(--coral-ui);
}

/* In a match: a quiet pill under the scoreboard when someone's connection drops. */
.net-banner {
  position: absolute;
  top: calc(env(safe-area-inset-top) + 96px);
  left: 50%;
  z-index: 6;
  max-width: calc(100% - 32px);
  padding: 8px 16px;
  border-radius: 999px;
  background: var(--glass);
  box-shadow: var(--panel-shadow);
  font-size: 15px;
  font-weight: 600;
  color: var(--paper);
  transform: translateX(-50%);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  pointer-events: none;
}

.net-banner::before {
  content: '';
  display: inline-block;
  width: 9px;
  height: 9px;
  margin-right: 8px;
  border-radius: 50%;
  background: var(--gold-deep);
  vertical-align: 0.05em;
  animation: seat-wait 1s ease-in-out infinite;
}

.btn:disabled {
  cursor: default;
  filter: saturate(0.55) brightness(1.04);
  transform: none;
}

.btn.primary:disabled::after {
  animation: none;
}

/* A longer label on the big button ("Wait for another player") stays on one line. */
.btn.primary.long {
  font-size: 23px;
}

/* ---------------------------------------------------------------- Campaign on wide screens
   The three places side by side in one wide panel (a column each, their three matches stacked under the
   place's picture), the title, legend and progress across the top, and the play button under it all: the whole
   circuit at a glance, no scrolling on a computer screen. */
@media (min-width: 760px) {
  #campaign.overlay {
    align-items: center;
    background: radial-gradient(
      ellipse at center,
      rgba(90, 40, 50, 0.32),
      rgba(90, 40, 50, 0.12) 70%
    );
  }

  .camp-card {
    width: min(1060px, 100%);
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-areas:
      'head head'
      'intro meta'
      'legend meta'
      'complete complete'
      'stages stages'
      'go go';
    column-gap: 24px;
    row-gap: 8px;
    padding: 26px 30px 26px;
    animation-name: fade-in;
  }

  .camp-card > .card-head {
    grid-area: head;
  }
  .camp-card > .small {
    grid-area: intro;
  }
  .camp-card > .star-legend {
    grid-area: legend;
  }
  .camp-card > .camp-meta {
    grid-area: meta;
    align-self: center;
    gap: 14px;
  }
  .camp-card > .camp-complete {
    grid-area: complete;
  }
  .camp-card > #camp-stages {
    grid-area: stages;
  }
  .camp-card > .btn.primary {
    grid-area: go;
    justify-self: center;
    width: min(440px, 100%);
    margin: 10px 0 4px;
    position: relative;
    bottom: auto;
    box-shadow:
      0 6px 0 var(--coral-deep),
      0 18px 30px -10px rgba(255, 90, 69, 0.55),
      inset 0 2px 0 rgba(255, 255, 255, 0.35);
  }

  .camp-card .card-head h2 {
    font-size: 38px;
  }

  .camp-meta .camp-stars {
    font-size: 22px;
  }

  #camp-stages {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 16px;
    margin-top: 10px;
  }

  .camp-stage {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 10px;
    border-radius: 22px;
    background: var(--glass-soft);
  }

  .camp-stage-head {
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
    margin: 0;
  }

  .camp-stage-head .thumb {
    width: 100%;
    height: clamp(64px, 12vh, 112px);
    border-radius: 15px;
  }

  .camp-stage-head > div {
    padding: 0 4px;
  }

  .camp-list {
    gap: 8px;
  }

  .camp-match {
    background: var(--glass-strong);
  }
}

/* Wide but short (a small laptop window): tighter rows so the circuit still fits. */
@media (min-width: 760px) and (max-height: 620px) {
  .camp-card {
    row-gap: 4px;
    padding: 18px 24px 18px;
  }

  .camp-card .card-head h2 {
    font-size: 30px;
  }

  .camp-card > .small {
    display: none;
  }

  #camp-stages {
    margin-top: 4px;
  }

  .camp-stage {
    gap: 6px;
    padding: 8px;
  }

  .camp-stage-head {
    flex-direction: row;
    align-items: center;
  }

  .camp-stage-head .thumb {
    width: 64px;
    height: 40px;
    border-radius: 10px;
  }

  .camp-stage-head h3 {
    font-size: 18px;
  }

  .camp-list {
    gap: 6px;
  }

  .camp-match {
    min-height: 46px;
    padding: 6px 10px 6px 8px;
    gap: 10px;
  }

  .cm-n {
    width: 28px;
    height: 28px;
    font-size: 15px;
  }

  .cm-main b {
    font-size: 15px;
  }

  .cm-stars i {
    width: 16px;
    height: 16px;
  }

  .camp-card > .btn.primary {
    min-height: 52px;
    font-size: 26px;
    margin-top: 6px;
  }
}

/* Wide but short: clear the corner buttons, drop the pictures, keep every line on one line. */
@media (min-width: 760px) and (max-height: 620px) {
  #campaign.overlay {
    padding-top: 66px;
    padding-bottom: 12px;
  }

  .camp-stage-head .thumb {
    display: none;
  }

  .camp-prize,
  .cm-main b,
  .cm-main small {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .cm-main small {
    font-size: 12px;
  }

  .cm-stars {
    gap: 2px;
  }

  .cm-stars i {
    width: 14px;
    height: 14px;
  }
}

/* Mid-width screens (small laptops, tablets in landscape): the same one-line rule for the narrow columns. */
@media (min-width: 760px) and (max-width: 1000px) {
  .cm-main small,
  .camp-prize {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
}

/* ---------------------------------------------------------------- Other panels on wide screens
   Same idea as the campaign: on a computer the panels open wide and centred, their content in columns, instead
   of a narrow strip that scrolls. On phones the column wrappers dissolve and nothing changes. */
.setup-col {
  display: contents;
}

@media (min-width: 760px) {
  #setup.overlay,
  #trophies.overlay,
  #workshop.overlay {
    align-items: center;
    background: radial-gradient(
      ellipse at center,
      rgba(90, 40, 50, 0.32),
      rgba(90, 40, 50, 0.12) 70%
    );
  }

  #setup .card,
  #trophies .card,
  #workshop .card {
    animation-name: fade-in;
  }

  /* Ajustes: match options on the left, the place and its light on the right. */
  .setup-card {
    width: min(900px, 100%);
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    column-gap: 28px;
    row-gap: 0;
    padding: 26px 30px 24px;
  }

  .setup-card > h2 {
    grid-column: 1 / -1;
  }

  .setup-col {
    display: flex;
    flex-direction: column;
    gap: 10px;
    min-width: 0;
  }

  .setup-card > .btn.primary,
  .trophy-card > .btn.primary {
    grid-column: 1 / -1;
    justify-self: center;
    width: min(360px, 100%);
    margin: 18px auto 4px;
    position: relative;
    bottom: auto;
    box-shadow:
      0 6px 0 var(--coral-deep),
      0 18px 30px -10px rgba(255, 90, 69, 0.55),
      inset 0 2px 0 rgba(255, 255, 255, 0.35);
  }

  /* Conquistas: the trophies in a grid, all in view. */
  .trophy-card {
    width: min(1000px, 100%);
    padding: 26px 30px 24px;
  }

  #trophy-list {
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 8px;
  }

  #trophy-list li {
    min-height: 62px;
  }
}

/* Oficina: wider, so the options fall into three columns beside the preview. */
@media (min-width: 1000px) {
  .ws-card {
    width: min(1120px, 100%);
    padding: 26px 30px 24px;
  }

  #ws-groups {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .ws-card > .btn.primary {
    justify-self: center;
    align-self: center;
    width: min(360px, 100%);
    box-shadow:
      0 6px 0 var(--coral-deep),
      0 0 0 12px #fff7ea;
  }
}

/* Short wide screens: a little tighter. */
@media (min-width: 760px) and (max-height: 620px) {
  #setup.overlay,
  #trophies.overlay,
  #workshop.overlay {
    padding-top: 66px;
    padding-bottom: 12px;
  }

  .setup-card,
  .trophy-card,
  .ws-card {
    padding: 18px 24px 18px;
  }

  .setup-card h2,
  .trophy-card h2,
  .ws-card h2 {
    font-size: 30px;
  }

  #trophy-list li {
    min-height: 52px;
    padding: 6px 10px;
  }

  #trophy-list .mark {
    width: 32px;
    height: 32px;
  }

  .setup-card > .btn.primary,
  .trophy-card > .btn.primary {
    min-height: 52px;
    font-size: 26px;
    margin-top: 10px;
  }
}

/* Oficina, wide: one grid — the preview on the left with the ball and the table colours under it, the colour
   swatches across the top, and the six paddle parts in three columns. */
@media (min-width: 1000px) {
  #workshop.overlay {
    padding-top: 70px;
    padding-bottom: 16px;
  }

  .ws-body {
    display: grid;
    grid-template-columns: 250px repeat(3, minmax(0, 1fr));
    column-gap: 18px;
    row-gap: 0;
    align-items: start;
  }

  .ws-side {
    position: static;
    grid-column: 1;
    grid-row: 1 / span 2;
  }

  #ws-groups {
    display: contents;
  }

  #ws-groups > .ws-group:nth-child(1) {
    grid-column: 2 / -1;
    grid-row: 1;
  }

  #ws-groups > .ws-group:nth-child(n + 2):nth-child(-n + 4) {
    grid-row: 2;
  }

  #ws-groups > .ws-group:nth-child(n + 5):nth-child(-n + 7) {
    grid-row: 3 / span 2;
  }

  #ws-groups > .ws-group:nth-child(8) {
    grid-column: 1;
    grid-row: 3;
  }

  #ws-groups > .ws-group:nth-child(9) {
    grid-column: 1;
    grid-row: 4;
  }

  .ws-group .options:has(.swatch) {
    row-gap: 10px;
  }

  .ws-card .card-head h2 {
    font-size: 34px;
  }
}

/* ---------------------------------------------------------------- Playing by touch: hints that never look like buttons */
/* The serve hint is plain outlined text under the scoreboard (like the callouts), not a card where the thumb rests. */
#app.touching #hint {
  top: calc(max(12px, env(safe-area-inset-top)) + 84px);
  bottom: auto;
  left: 50%;
  transform: translateX(-50%);
  width: calc(100% - 32px);
  padding: 0;
  border-radius: 0;
  background: none;
  box-shadow: none;
  text-align: center;
  animation: hint-in 0.4s var(--ease-out);
}

#app.touching #hint-main {
  font-size: 26px;
  line-height: 1.1;
  color: var(--light);
  -webkit-text-stroke: 6px var(--plum-ink);
  paint-order: stroke fill;
  text-shadow: 0 4px 0 rgba(42, 22, 48, 0.35);
  animation: soft-blink 1.6s ease-in-out infinite;
}

#app.touching #hint-sub {
  margin-top: 6px !important;
  font-size: 15px;
  font-weight: 700;
  color: var(--light);
  -webkit-text-stroke: 4px var(--plum-ink);
  paint-order: stroke fill;
}

@keyframes soft-blink {
  50% {
    opacity: 0.85;
  }
}

.reduced #app.touching #hint-main,
#app.reduced.touching #hint-main {
  animation: none;
}

/* "Tap anywhere": a ring that ripples low on the screen, where the thumb is. Not a target: it takes no touches. */
.tap-ring {
  position: absolute;
  left: 50%;
  top: 82%;
  width: 0;
  height: 0;
  pointer-events: none;
}

.tap-ring i {
  position: absolute;
  left: -60px;
  top: -60px;
  width: 120px;
  height: 120px;
  border-radius: 50%;
  border: 3px solid rgba(255, 247, 234, 0.9);
  opacity: 0;
  animation: tap-ripple 1.6s ease-out infinite;
}

.tap-ring i + i {
  animation-delay: 0.25s;
}

@keyframes tap-ripple {
  0% {
    transform: scale(0.47);
    opacity: 0.55;
  }
  70%,
  100% {
    transform: scale(1);
    opacity: 0;
  }
}

.reduced .tap-ring i {
  animation: none;
  transform: scale(0.6);
  opacity: 0.4;
}

/* First-time lesson. Only the Skip button takes touches: the drag itself happens on the game, as in play. */
.lesson {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.lesson-text {
  position: absolute;
  left: 16px;
  right: 16px;
  top: calc(max(12px, env(safe-area-inset-top)) + 96px);
  text-align: center;
}

.lesson-text p {
  margin: 0;
  color: var(--light);
  paint-order: stroke fill;
}

#lesson-title {
  font-family: var(--display);
  font-size: 26px;
  letter-spacing: 0.01em;
  line-height: 1.1;
  -webkit-text-stroke: 7px var(--plum-ink);
  text-shadow: 0 5px 0 rgba(42, 22, 48, 0.35);
}

#lesson-title:empty {
  display: none;
}

#lesson-sub {
  max-width: 330px;
  margin: 8px auto 0;
  font-size: 16px;
  font-weight: 700;
  line-height: 1.3;
  -webkit-text-stroke: 4.5px var(--plum-ink);
}

.lesson.warn #lesson-sub,
.lesson.tip #lesson-sub {
  color: var(--gold);
}

.lesson.done #lesson-title {
  color: #9ff0b0;
  animation: pop-in 0.9s var(--ease-spring);
}

.lesson-skip {
  position: absolute;
  left: max(10px, env(safe-area-inset-left));
  top: calc(max(12px, env(safe-area-inset-top)) + 54px);
  min-width: 64px;
  min-height: 44px;
  padding: 0 12px;
  border: 0;
  background: none;
  color: var(--light);
  font-weight: 700;
  font-size: 15px;
  text-decoration: underline;
  text-underline-offset: 3px;
  -webkit-text-stroke: 3.5px var(--plum-ink);
  paint-order: stroke fill;
  pointer-events: auto;
  cursor: pointer;
}

.lesson.tip .lesson-skip,
.lesson.tip .lesson-zone,
.lesson.done .lesson-skip {
  display: none;
}

.lesson-zone {
  position: absolute;
  left: max(16px, env(safe-area-inset-left));
  right: max(16px, env(safe-area-inset-right));
  top: 75%;
  bottom: max(48px, calc(env(safe-area-inset-bottom) + 16px));
  border: 2px dashed rgba(255, 255, 255, 0.6);
  border-radius: 24px;
  background: rgba(255, 247, 234, 0.16);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  padding: 8px 10px 10px;
  transition: opacity 0.3s;
}

.lesson.warn .lesson-zone {
  animation: zone-pulse 0.5s ease-in-out 2;
}

@keyframes zone-pulse {
  50% {
    background: rgba(255, 195, 90, 0.4);
    border-color: var(--gold);
  }
}

.lesson-zone-label {
  font-size: 13px;
  font-weight: 700;
  color: var(--light);
  -webkit-text-stroke: 3px var(--plum-ink);
  paint-order: stroke fill;
}

.lesson-goal {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 14px;
  font-weight: 700;
  color: var(--light);
  -webkit-text-stroke: 3px var(--plum-ink);
  paint-order: stroke fill;
}

.lesson-arrow {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: rgba(42, 22, 48, 0.45);
  transition:
    background 0.2s,
    transform 0.2s var(--ease-spring);
}

.lesson-arrow svg {
  width: 20px;
  height: 20px;
  stroke: var(--light);
}

.lesson-arrow.lit {
  background: #2fae62;
  transform: scale(1.15);
}

.lesson-finger {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 64px;
  height: 64px;
  margin: -36px 0 0 -32px;
  will-change: transform;
}

.lesson-finger svg {
  width: 100%;
  height: 100%;
  fill: #fff7ea;
  stroke: var(--plum-ink);
  filter: drop-shadow(0 4px 0 rgba(42, 22, 48, 0.35));
}

.lesson.live .lesson-finger {
  opacity: 0;
  transition: opacity 0.25s;
}

@media (max-height: 460px) {
  .lesson-text {
    top: calc(max(8px, env(safe-area-inset-top)) + 60px);
  }
  .lesson-zone {
    top: 64%;
    bottom: max(10px, env(safe-area-inset-bottom));
    left: 22%;
    right: 22%;
  }
  .lesson-finger {
    width: 48px;
    height: 48px;
    margin: -24px 0 0 -24px;
  }
  .tap-ring {
    top: 80%;
  }
  #app.touching #hint {
    top: calc(max(8px, env(safe-area-inset-top)) + 56px);
  }
}

/* ---------------------------------------------------------------- Play online: one situation at a time */
.online-card .card-head h2 {
  flex: 1;
  min-width: 0;
  font-size: clamp(28px, 7.6vw, 38px);
}

.online-card .ol {
  display: none;
  flex-direction: column;
  align-items: stretch;
  gap: 10px;
}

.online-card[data-state='home'] .ol-home,
.online-card[data-state='invite'] .ol-invite,
.online-card[data-state='gone'] .ol-gone,
.online-card[data-state='code'] .ol-code,
.online-card[data-state='resume'] .ol-resume {
  display: flex;
}

.ol-lead {
  margin: 0;
  font-size: 17px;
  font-weight: 600;
  line-height: 1.35;
  color: var(--paper);
}

.invite-code {
  justify-content: center;
  margin: 4px 0 0;
}

.invite-code .flip {
  font-size: clamp(34px, 10vw, 48px);
}

.ol-invite .ol-lead {
  text-align: center;
}

/* A secondary choice: the same size as the main one, outlined instead of filled. */
.btn.outline {
  min-height: 56px;
  background: transparent;
  color: var(--accent-text);
  box-shadow: inset 0 0 0 2.5px currentColor;
  font-weight: 700;
}

.btn.outline:active {
  transform: translateY(2px);
  box-shadow: inset 0 0 0 2.5px currentColor;
}

.btn.outline.camp-btn small {
  color: var(--paper-dim);
}

.link-btn {
  align-self: center;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  padding: 0 12px;
  border: 0;
  background: none;
  color: var(--paper);
  font-weight: 700;
  font-size: 16px;
  text-decoration: underline;
  text-decoration-thickness: 2px;
  text-underline-offset: 4px;
  text-decoration-color: var(--glass-line);
  cursor: pointer;
}

.link-btn.danger {
  color: var(--accent-text);
}

.link-btn svg {
  width: 22px;
  height: 22px;
  stroke: currentColor;
}

.link-btn:disabled {
  opacity: 0.5;
}

/* "You play as Bia · Change": shown, not asked. */
.name-row {
  min-height: 44px;
  justify-content: center;
}

.name-show {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 2px 4px;
  margin: 0;
  font-size: 16px;
  color: var(--paper-dim);
}

.name-show[hidden],
.name-edit[hidden] {
  display: none;
}

.name-show b {
  color: var(--paper);
}

.name-show .link-btn {
  min-height: 40px;
  padding: 0 6px;
}

.name-edit {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
}

.name-edit input,
.code-input {
  width: 100%;
  min-height: 52px;
  padding: 0 14px;
  border: 2px solid var(--glass-line);
  border-radius: 14px;
  background: var(--card-paper);
  color: var(--paper);
  font: inherit;
  font-size: 20px;
  font-weight: 600;
  -webkit-user-select: text;
  user-select: text;
}

.name-edit input:focus,
.code-input:focus {
  outline: none;
  border-color: var(--coral-ui);
  box-shadow: 0 0 0 4px rgba(224, 68, 47, 0.16);
}

.name-edit .btn {
  width: auto;
  min-height: 52px;
  padding: 0 20px;
}

.code-input {
  min-height: 64px;
  text-align: center;
  font-family: var(--display);
  font-weight: 400;
  font-size: 32px;
  letter-spacing: 0.3em;
  text-transform: uppercase;
}

.code-error {
  margin: 0;
  font-size: 15px;
  font-weight: 700;
  color: var(--accent-text);
}

/* Problems: above the action that fixes them. */
.online-alert {
  display: grid;
  grid-template-columns: 1fr;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border-radius: 16px;
  background: rgba(224, 68, 47, 0.1);
  box-shadow: inset 0 0 0 2px rgba(224, 68, 47, 0.22);
}

.online-alert[hidden] {
  display: none;
}

.online-alert.with-icon {
  grid-template-columns: 48px 1fr;
  background: var(--well);
  box-shadow: none;
}

.alert-icon {
  display: none;
  width: 48px;
  height: 48px;
  fill: var(--paper-faint);
  stroke: var(--paper-faint);
}

.online-alert.with-icon .alert-icon {
  display: block;
}

.online-alert b {
  display: block;
  color: var(--accent-text);
  font-size: 16px;
}

.online-alert b:empty {
  display: none;
}

.online-alert p {
  margin: 2px 0 0;
  font-size: 15px;
  font-weight: 600;
  line-height: 1.35;
  color: var(--paper);
}

.net-note {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 0 6px;
  text-align: center;
}

.net-note .link-btn {
  min-height: 36px;
  font-size: 14px;
}

/* The pressed button says it is working; a small spinner before the text. */
.btn.loading {
  pointer-events: none;
}

.btn.loading::before {
  content: '';
  display: inline-block;
  width: 0.8em;
  height: 0.8em;
  margin-right: 0.45em;
  border: 3px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  vertical-align: -0.08em;
  animation: spin 0.8s linear infinite;
}

.btn.primary.loading {
  font-size: 22px;
}

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

/* Phones: the open keyboard lifts the sheet so the field, its button and any error stay in view. */
@media (max-width: 640px) {
  #online.overlay {
    padding-bottom: calc(max(10px, env(safe-area-inset-bottom)) + var(--kb, 0px));
    transition: padding-bottom 0.2s ease-out;
  }
  #app.kb-open #online.overlay {
    padding-bottom: calc(10px + var(--kb, 0px));
  }
  #app.kb-open .online-card {
    max-height: 100%;
  }
}

/* ---------------------------------------------------------------- Lobby on phones */
.lobby-share[hidden] {
  display: none;
}

.share-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  font-size: 26px;
}

.share-btn svg {
  width: 26px;
  height: 26px;
  stroke: currentColor;
  flex: none;
}

.copy-btn {
  width: auto;
  min-height: 60px;
  padding: 0 16px;
  font-size: 16px;
}

.lobby-tip {
  margin: 0;
  padding: 10px 12px;
  border-radius: 14px;
  background: var(--well);
  font-size: 15px;
  font-weight: 600;
  line-height: 1.35;
  color: var(--paper);
}

.lobby-tip[hidden] {
  display: none;
}

.lobby-count {
  margin: -6px 0 0;
  text-align: center;
  font-family: var(--display);
  font-size: 72px;
  line-height: 1;
  color: var(--accent-text);
}

.lobby-count[hidden] {
  display: none;
}

.lobby-count.beat {
  animation: count-beat 0.5s var(--ease-spring);
}

@keyframes count-beat {
  from {
    transform: scale(1.4);
    opacity: 0.4;
  }
}

.reduced .lobby-count.beat {
  animation: none;
}

/* ---------------------------------------------------------------- Result and pause, online */
.result-note {
  margin: 0;
  font-size: 15px;
  font-weight: 700;
  color: var(--accent-text);
  text-align: center;
}

.result-note[hidden] {
  display: none;
}

.menu-item.danger {
  color: var(--accent-text);
}

/* A short line over everything that goes away by itself ("You left. Bia won by forfeit."). */
.notice {
  position: absolute;
  z-index: 40;
  left: 50%;
  top: calc(max(12px, env(safe-area-inset-top)) + 12px);
  max-width: calc(100% - 32px);
  padding: 10px 18px;
  border-radius: 18px;
  background: #fff7ea;
  box-shadow: var(--panel-shadow);
  color: var(--paper);
  font-size: 15px;
  font-weight: 700;
  text-align: center;
  transform: translateX(-50%);
  pointer-events: none;
}

.notice.show {
  animation: notice-in 0.35s var(--ease-out);
}

@keyframes notice-in {
  from {
    transform: translate(-50%, -16px);
    opacity: 0;
  }
}

.online-card:not([data-state='home']) .net-note {
  display: none;
}

.share-btn {
  font-size: 23px;
  white-space: nowrap;
}

.share-btn svg {
  width: 22px;
  height: 22px;
}

.ol-resume .btn.primary,
.ol-invite .btn.primary {
  font-size: 24px;
  white-space: nowrap;
}

.copy-btn {
  white-space: nowrap;
}

.lobby-share {
  grid-template-columns: minmax(0, 1fr) auto;
}

.share-btn {
  padding: 0 12px;
  font-size: clamp(19px, 5.6vw, 23px);
}

.copy-btn {
  padding: 0 12px;
  font-size: 15px;
}

#pause.confirm .quiet {
  display: none;
}

/* Review pass: readable, never mistaken for buttons, nothing covered. */
.notice {
  top: calc(max(12px, env(safe-area-inset-top)) + 64px);
}

.lesson-text p,
#app.touching #hint p {
  text-wrap: balance;
}

.lesson-arrow {
  width: 30px;
  height: 30px;
  background: none;
}

.lesson-arrow svg {
  filter: drop-shadow(0 0 2px var(--plum-ink)) drop-shadow(0 0 1px var(--plum-ink));
}

.lesson-arrow.lit {
  background: #2fae62;
}

.lesson-skip {
  left: auto;
  right: max(10px, env(safe-area-inset-right));
  top: calc(max(12px, env(safe-area-inset-top)) + 56px);
  min-height: 44px;
  padding: 0 16px;
  border-radius: 999px;
  background: rgba(42, 22, 48, 0.5);
  text-decoration: none;
  -webkit-text-stroke: 0;
  font-size: 15px;
}

.lesson-text {
  top: calc(max(12px, env(safe-area-inset-top)) + 108px);
}

@media (max-width: 640px) {
  .scoreboard .name {
    max-width: 8ch;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
}

.code-input::placeholder {
  color: var(--paper-faint);
  opacity: 0.5;
}

.online-card[data-state='name'] .ol-name {
  display: flex;
}

.ol-name .name-edit .btn.primary {
  min-height: 52px;
  margin: 0;
  padding: 0 18px;
  font-size: 22px;
}

.aim-toggle {
  align-items: flex-start;
  margin-top: 6px;
}

.aim-toggle input {
  margin-top: 2px;
  flex: none;
}

.aim-toggle span {
  display: grid;
  gap: 2px;
}

.aim-toggle b {
  color: var(--paper);
}

.aim-toggle small {
  font-size: 13px;
  line-height: 1.3;
}

/* ---------------------------------------------------------------- Portal ads: always optional, always labelled */
.ad-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 52px;
  background: #fff;
  color: var(--paper);
  box-shadow:
    inset 0 0 0 2.5px var(--gold-deep),
    0 4px 0 rgba(120, 52, 34, 0.2);
  font-weight: 700;
  font-size: 17px;
}

.ad-btn.small {
  width: auto;
  min-height: 44px;
  padding: 0 14px;
  font-size: 15px;
}

.ad-ico {
  width: 24px;
  height: 24px;
  flex: none;
  fill: var(--gold-deep);
  stroke: var(--gold-deep);
}

.ad-btn .ad-ico rect,
.chance-btn .ad-ico rect {
  fill: none;
}

/* Second chance: the three choices are the same size, font and colour (CrazyGames rule for rewarded offers). */
.chance-card {
  width: min(400px, 100%);
  gap: 10px;
}

.chance-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 54px;
  background: #fff;
  color: var(--paper);
  box-shadow:
    inset 0 0 0 2px var(--glass-line),
    0 4px 0 rgba(120, 52, 34, 0.2);
  font-weight: 700;
  font-size: 18px;
}

.chance-btn .coin {
  flex: none;
}

.chance-timer {
  display: block;
  height: 4px;
  margin-top: 4px;
  border-radius: 2px;
  background: var(--gold-deep);
  transform-origin: left center;
}

/* While a portal ad is requested or plays: everything waits (no double taps, no progress). */
.ad-wait {
  position: absolute;
  inset: 0;
  z-index: 60;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 12px;
  background: rgba(42, 22, 48, 0.55);
  color: var(--light);
  font-weight: 700;
}

.ad-wait p {
  margin: 0;
}

.ad-spin {
  width: 36px;
  height: 36px;
  border: 4px solid var(--light);
  border-right-color: transparent;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

/* Development stand-in for a portal ad (?ads=test). */
.ad-test {
  position: absolute;
  inset: 0;
  z-index: 70;
  display: grid;
  place-items: center;
  background: #111;
  color: #fff;
  font:
    700 18px/1.4 system-ui,
    sans-serif;
  letter-spacing: 0.04em;
}
.privacy-note {
  margin: 10px auto 0;
  max-width: 380px;
  font-size: 11px;
  line-height: 1.4;
  text-align: center;
}
.privacy-note summary {
  cursor: pointer;
}

/* Touch assist switch: bottom-left of the match screen, small, a real switch (on/off), never a big target. */
.assist-toggle {
  position: absolute;
  z-index: 5;
  left: max(12px, env(safe-area-inset-left));
  bottom: max(12px, env(safe-area-inset-bottom));
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 40px;
  padding: 0 14px 0 8px;
  border: 0;
  border-radius: 999px;
  background: rgba(42, 22, 48, 0.55);
  color: var(--light);
  font-weight: 700;
  font-size: 14px;
  cursor: pointer;
}

.assist-toggle .sw {
  position: relative;
  width: 34px;
  height: 20px;
  border-radius: 10px;
  background: rgba(255, 247, 234, 0.35);
  transition: background 0.2s;
}

.assist-toggle .sw::after {
  content: '';
  position: absolute;
  left: 2px;
  top: 2px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #fff;
  transition: transform 0.2s var(--ease-out);
}

.assist-toggle.on .sw {
  background: #2fae62;
}

.assist-toggle.on .sw::after {
  transform: translateX(14px);
}

.assist-toggle.nudge {
  animation: assist-nudge 0.6s ease-in-out 4;
}

@keyframes assist-nudge {
  50% {
    transform: scale(1.12);
    box-shadow: 0 0 0 6px rgba(255, 195, 90, 0.55);
  }
}

.reduced .assist-toggle.nudge {
  animation: none;
  box-shadow: 0 0 0 3px var(--gold);
}
