:root {
  --bg: #15161d;
  --panel: #1e2029;
  --panel-2: #262934;
  --ink: #f2f0e6;
  --muted: #8b90a0;
  --accent: #ffc857;
  --mood: #7f8ba3;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  height: 100%;
  background: var(--bg);
  color: var(--ink);
  font-family: "Press Start 2P", "Courier New", monospace;
  overflow: hidden;
  touch-action: none;
  -webkit-user-select: none;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  -webkit-touch-callout: none;
  overscroll-behavior: none;
}

body {
  display: flex;
  flex-direction: column;
  height: 100dvh;
  padding-top: var(--safe-top);
  padding-bottom: var(--safe-bottom);
}

.px {
  image-rendering: pixelated;
  image-rendering: crisp-edges;
}

/* ---------- HUD ---------- */

#hud {
  flex: 0 0 auto;
  background: var(--panel);
  border-bottom: 3px solid #0c0d12;
  padding: 5px 10px 4px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.hud-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.label {
  font-size: 8px;
  color: var(--muted);
  letter-spacing: 1px;
}

.hud-row.top {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: start;
  gap: 8px;
  /* the top row is one compact band: big number, tiny label, nothing else */
}

.hud-col.left {
  text-align: left;
}

.hud-col.center {
  text-align: center;
}

.hud-col.right {
  text-align: right;
}

.score {
  font-size: 22px;
  line-height: 1;
  color: var(--accent);
  text-shadow: 3px 3px 0 #000;
  margin-top: 3px;
}

.timer {
  font-size: 20px;
  line-height: 1;
  color: var(--ink);
  text-shadow: 3px 3px 0 #000;
  margin-top: 4px;
}

.timer.hot {
  color: #ff5a5a;
  animation: blink 0.5s steps(2, end) infinite;
}

.sub {
  margin-top: 4px;
  font-size: 8px;
  color: var(--ink);
}

.sub .label {
  margin-left: 2px;
}

#diff {
  font-size: 8px;
}

.hearts {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 6px;
  margin-top: 3px;
  font-size: 14px;
  line-height: 1;
  color: #3ddc97;
  text-shadow: 3px 3px 0 #000;
}

.hearts .heart-icon {
  width: 17px;
  height: 15px;
}

#hp.low {
  color: #ff5a5a;
  animation: blink 0.5s steps(2, end) infinite;
}

.hp-bar {
  margin: 5px 0 0 auto;
  width: 100%;
  max-width: 110px;
  height: 8px;
  background: #0c0d12;
  border: 2px solid #3a3d49;
  border-radius: 2px;
  overflow: hidden;
}

#hp-fill {
  height: 100%;
  width: 100%;
  background: #3ddc97;
  transition: width 0.15s linear, background 0.3s;
}

#hp-fill.low {
  background: #ff5a5a;
}

.card.donut .card-name::before {
  content: "🐱 ";
}

.hud-row.ai {
  position: relative;
  overflow: hidden;
  background: var(--panel-2);
  border: 2px solid #0c0d12;
  border-radius: 4px;
  padding: 4px 8px 5px;
  align-items: flex-start;
}

#orb {
  flex: 0 0 auto;
  width: 36px;
  height: 32px;
  display: grid;
  place-items: center;
  animation: bob 1.6s ease-in-out infinite;
}

#orb canvas {
  width: 36px;
  height: 32px;
}

body[data-mood="3"] #orb,
body[data-mood="4"] #orb {
  animation: shiver 0.12s linear infinite;
}

.ai-text {
  flex: 1 1 auto;
  min-width: 0;
}

.ai-head {
  display: flex;
  align-items: baseline;
  gap: 8px;
  flex-wrap: wrap;
}

.mood {
  font-size: 10px;
  color: var(--mood);
}

.combo {
  margin-left: auto;
  font-size: 12px;
  color: #3ddc97;
  text-shadow: 2px 2px 0 #000;
}

#ai-line {
  margin: 3px 0 4px;
  font-size: 9px;
  line-height: 1.55;
  min-height: 3.1em; /* two lines; the third, when it happens, grows the panel */
  color: var(--ink);
}

.meter {
  height: 7px;
  background: #0c0d12;
  border: 2px solid #3a3d49;
  border-radius: 2px;
  overflow: hidden;
}

#meter-fill {
  height: 100%;
  width: 0%;
  background: var(--mood);
  transition: width 0.15s linear, background 0.4s;
  background-image: repeating-linear-gradient(
    90deg,
    rgba(255, 255, 255, 0.18) 0 4px,
    transparent 4px 8px
  );
}

/* ---------- stage ---------- */

#stage {
  position: relative;
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
  box-shadow: inset 0 0 0 0 transparent;
  transition: box-shadow 0.4s;
}

body[data-mood="4"] #stage {
  animation: glow 0.7s ease-in-out infinite alternate;
}

/* the AI's tantrum: the room goes red and the mood label shakes. The glow
   is an overlay because the canvas would paint over an inset shadow. */
body[data-mood="tantrum"] #stage::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  animation: rage 0.35s ease-in-out infinite alternate;
}

body[data-mood="tantrum"] .mood,
body[data-mood="tantrum"] #orb {
  animation: shiver 0.08s linear infinite;
}

@keyframes rage {
  from {
    box-shadow: inset 0 0 24px 8px rgba(255, 90, 90, 0.25);
  }
  to {
    box-shadow: inset 0 0 60px 18px rgba(255, 90, 90, 0.55);
  }
}

#game {
  display: block;
  width: 100%;
  height: 100%;
  cursor: crosshair;
}

/* the iOS haptic switch: covers the floor, under the panels, invisible */
#haptic {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  opacity: 0;
  z-index: 1;
  touch-action: none;
  -webkit-tap-highlight-color: transparent;
  -webkit-user-select: none;
  user-select: none;
  cursor: crosshair;
}

#toast {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 3px;
  padding: 6px 10px;
  background: #0c0d12;
  border-left: 4px solid var(--accent);
  color: var(--ink);
  text-align: center;
  font-size: 8px;
  line-height: 1.5;
  transform: translateY(-110%);
  transition: transform 0.25s cubic-bezier(0.2, 1.4, 0.4, 1);
  pointer-events: none;
  z-index: 3;
}

#toast.show {
  transform: translateY(0);
}

.toast-label {
  color: var(--accent);
  font-size: 7px;
  letter-spacing: 1px;
}

#toast-title {
  font-size: 11px;
}

#toast-reward {
  color: var(--muted);
}

.panel {
  position: absolute;
  inset: 0;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  justify-content: flex-start;
  gap: 14px;
  padding: 20px;
  text-align: center;
  background: rgba(12, 13, 18, 0.86);
  cursor: pointer;
}

/* auto margins centre the content when there is room and collapse to zero
   when there is not, which turns the panel into a scroller instead of
   clipping the top */
.panel > :first-child {
  margin-top: auto;
}

/* a panel that overflows scrolls; its children must never be squashed */
.panel > * {
  flex-shrink: 0;
}

.panel > :last-child {
  margin-bottom: auto;
}

.panel.hidden {
  display: none;
}

.panel h2 {
  margin: 0;
  font-size: clamp(18px, 6vw, 30px);
  color: var(--accent);
  text-shadow: 4px 4px 0 #000;
}

#loot {
  gap: 10px;
  padding: 14px;
}

#loot-cards {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
  width: 100%;
  max-width: 640px;
}

.card {
  font: inherit;
  color: var(--ink);
  text-align: left;
  background: #0c0d12;
  border: 3px solid var(--rarity, #b8bcc8);
  box-shadow: 4px 4px 0 #000;
  padding: 10px 12px;
  flex: 1 1 150px;
  max-width: 200px;
  min-height: 118px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  cursor: pointer;
  touch-action: manipulation;
  transition: transform 0.12s;
}

.card:disabled {
  opacity: 0.55;
  cursor: wait;
}

.card:not(:disabled):hover,
.card:not(:disabled):focus-visible {
  transform: translateY(-3px);
  outline: none;
}

.card .rarity {
  font-size: 7px;
  letter-spacing: 1px;
  color: var(--rarity, #b8bcc8);
}

.card .card-name {
  font-size: 10px;
  line-height: 1.4;
}

.card .card-desc {
  font-size: 7px;
  line-height: 1.7;
  color: #c9c7bd;
  flex: 1 1 auto;
}

.card .card-stack {
  font-size: 7px;
  color: var(--muted);
}

.card.common { --rarity: #b8bcc8; }
.card.rare { --rarity: #5fb2ff; }
.card.legendary {
  --rarity: #ffc857;
  animation: glint 1.2s ease-in-out infinite alternate;
}

.boss-panel {
  background: rgba(70, 8, 12, 0.92);
  gap: 8px;
}

.boss-warning {
  font-size: 12px;
  letter-spacing: 4px;
  color: #ff5a5a;
  animation: blink 0.35s steps(2, end) infinite;
}

.boss-h {
  color: #ff5a5a !important;
  text-shadow: 4px 4px 0 #000, 0 0 24px rgba(255, 90, 90, 0.6) !important;
  line-height: 1.25;
}

/* the stutter: each piece pops in on its own beat */
.boss-h .stutter {
  display: inline-block;
  opacity: 0;
  transform: scale(1.7);
  animation: stutter 0.16s steps(2, end) forwards;
}

.boss-h .stutter.final {
  display: block;
}

.boss-initiated {
  font-size: 9px;
  letter-spacing: 3px;
  color: #ffb3b3;
  opacity: 0;
  animation: fadein 0.3s 1.15s forwards;
}

@keyframes stutter {
  to {
    opacity: 1;
    transform: scale(1);
  }
}

@keyframes fadein {
  to {
    opacity: 1;
  }
}

.boss-tier {
  margin-top: 6px;
  font-size: 9px;
  letter-spacing: 2px;
  color: #ffb3b3;
}

.boss-name {
  font-size: clamp(14px, 5vw, 24px);
  color: var(--accent);
  text-shadow: 3px 3px 0 #000;
  line-height: 1.3;
}

.boss-level {
  font-size: 9px;
  color: var(--muted);
}

.boss-desc {
  max-width: 30em;
}

.boss-bar {
  width: 70%;
  max-width: 320px;
  height: 8px;
  background: #0c0d12;
  border: 2px solid #3a3d49;
  margin-top: 4px;
}

#boss-bar-fill {
  height: 100%;
  width: 100%;
  background: #ff5a5a;
  transition: width 0.1s linear;
}

/* round recap */
.recap {
  background: radial-gradient(circle at 50% 22%, rgba(61, 220, 151, 0.22), rgba(10, 30, 22, 0.94) 55%);
  gap: 10px;
}

.recap-badge {
  font-size: 9px;
  letter-spacing: 3px;
  color: var(--accent);
  animation: pop-in 0.3s cubic-bezier(0.2, 1.4, 0.4, 1) both;
}

.recap-h {
  color: #3ddc97 !important;
  font-size: clamp(26px, 9vw, 44px) !important;
  text-shadow: 4px 4px 0 #000, 0 0 28px rgba(61, 220, 151, 0.6) !important;
  animation: pop-in 0.35s 0.05s cubic-bezier(0.2, 1.4, 0.4, 1) both;
}

.medals.hidden {
  display: none;
}

.medals {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px;
  min-height: 1px;
}

.medal {
  font-size: 7px;
  letter-spacing: 1px;
  padding: 5px 9px;
  background: var(--accent);
  color: #0c0d12;
  border: 2px solid #a86e12;
  box-shadow: 2px 2px 0 #000;
  animation: pop-in 0.4s cubic-bezier(0.2, 1.4, 0.4, 1) both;
}

.tiles {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  width: 100%;
  max-width: 420px;
}

.tile {
  background: rgba(12, 13, 18, 0.9);
  border: 2px solid #3a3d49;
  box-shadow: 3px 3px 0 #000;
  padding: 9px 4px 7px;
  text-align: center;
  animation: pop-in 0.35s cubic-bezier(0.2, 1.4, 0.4, 1) both;
}

.tile.good {
  border-color: #3ddc97;
}

.tile.bad {
  border-color: #ff5a5a;
}

.tile-num {
  font-size: 15px;
  line-height: 1.1;
  color: var(--ink);
  text-shadow: 2px 2px 0 #000;
}

.tile-num.tile-text {
  font-size: 8px;
  line-height: 1.4;
  min-height: 17px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.tile.good .tile-num {
  color: #3ddc97;
}

.tile.bad .tile-num {
  color: #ff5a5a;
}

.tile-label {
  margin-top: 5px;
  font-size: 6px;
  letter-spacing: 1px;
  color: var(--muted);
}

.over {
  background: radial-gradient(circle at 50% 18%, rgba(255, 90, 90, 0.22), rgba(30, 10, 12, 0.94) 55%);
  gap: 9px;
}

.over-badge {
  color: #ff5a5a;
}

.over-h {
  color: #ff5a5a !important;
  text-shadow: 3px 3px 0 #000, 0 0 22px rgba(255, 90, 90, 0.45) !important;
}

.over-tiles {
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
  max-width: 460px;
}

.over .tile {
  padding: 7px 2px 6px;
}

.over .tile-num {
  font-size: 12px;
}

.over .tile-num.tile-text {
  font-size: 7px;
  min-height: 14px;
}

.over .tile-label {
  font-size: 5.5px;
  margin-top: 4px;
}

.slain {
  width: 100%;
  max-width: 640px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}

.slain .owned-head {
  margin-bottom: 0;
}

.slain .chip {
  cursor: default;
}

.over .build {
  margin-top: 0;
  padding-top: 8px;
  border-top-color: #4a2a2c;
}

.over .blurb {
  margin: 4px 0 0;
}

/* Donut's last word: a speech bubble in her colours */
.donut-say {
  width: 100%;
  max-width: 34em;
  padding: 8px 12px 9px;
  background: rgba(60, 20, 40, 0.85);
  border: 2px solid #ff9ecf;
  box-shadow: 3px 3px 0 #000;
  position: relative;
  animation: pop-in 0.35s 0.5s cubic-bezier(0.2, 1.4, 0.4, 1) both;
}

.donut-say::before {
  content: "";
  position: absolute;
  top: -9px;
  left: 22px;
  width: 12px;
  height: 12px;
  background: rgba(60, 20, 40, 1);
  border-left: 2px solid #ff9ecf;
  border-top: 2px solid #ff9ecf;
  transform: rotate(45deg);
}

.donut-who {
  font-size: 6.5px;
  letter-spacing: 2px;
  color: #ffc857;
  margin-bottom: 4px;
}

.donut-say .blurb {
  color: #ffd6ea;
}

.record {
  letter-spacing: 1px;
  color: var(--accent);
}

.cta.gold {
  border-color: var(--accent);
  color: var(--accent);
}

/* the Safe Room is a fast food joint the dungeon lifted from Earth */
.diner {
  background:
    repeating-conic-gradient(rgba(255, 255, 255, 0.045) 0 25%, transparent 0 50%) 0 0 / 36px 36px,
    linear-gradient(180deg, rgba(122, 20, 24, 0.94), rgba(58, 10, 12, 0.96));
  gap: 9px;
}

.awning {
  width: 100%;
  height: 10px;
  margin-top: -14px;
  background: repeating-linear-gradient(90deg, #d62828 0 14px, #fff1b0 14px 28px);
  border-bottom: 3px solid #0c0d12;
  box-shadow: 0 3px 0 rgba(0, 0, 0, 0.4);
}

.diner .title-small {
  color: #ffd9a0;
}

.sign {
  color: #fff1b0 !important;
  background: #1a1210;
  border: 3px solid var(--accent);
  padding: 8px 18px;
  line-height: 1.2;
  text-shadow: 0 0 14px rgba(255, 200, 87, 0.9), 3px 3px 0 #000 !important;
  box-shadow: 4px 4px 0 #000, 0 0 24px rgba(255, 200, 87, 0.35);
}

.diner .blurb {
  color: #ffe9c9;
}

.menu-head {
  width: 100%;
  max-width: 640px;
  font-size: 8px;
  letter-spacing: 2px;
  color: var(--accent);
  background: #1a1210;
  border: 2px solid #3a2a1a;
  padding: 5px 8px;
  text-align: left;
}

.diner .card {
  background: #1a1210;
}

.diner .owned {
  border-top-color: #7a4a22;
}

.diner .owned-head,
.diner .tiny {
  color: #d9b878;
}

@keyframes pop-in {
  from {
    transform: scale(0.4);
    opacity: 0;
  }
}

/* through the door: iris then doorway */
#iris {
  position: absolute;
  inset: 0;
  z-index: 5;
  pointer-events: none;
}

#door {
  position: absolute;
  inset: 0;
  z-index: 6;
  pointer-events: none;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: door-bg 0.65s ease-in forwards;
}

#door::before {
  content: "";
  width: 62%;
  height: 78%;
  border: 4px solid #a86e12;
  background: linear-gradient(180deg, #fff6d0 0%, #ffc857 35%, #d9931f 100%);
  box-shadow: 0 0 40px 18px rgba(255, 200, 87, 0.65), inset 0 0 40px rgba(255, 255, 255, 0.5);
  animation: door-open 0.65s ease-in-out forwards;
}

#iris.hidden,
#door.hidden {
  display: none;
}

@keyframes door-open {
  0% {
    transform: scaleX(0.03);
    opacity: 1;
  }
  55% {
    transform: scaleX(1);
    opacity: 1;
  }
  100% {
    transform: scale(1.25, 1.1);
    opacity: 0;
  }
}

@keyframes door-bg {
  0%,
  55% {
    background: rgba(8, 8, 12, 0.985);
  }
  100% {
    background: transparent;
  }
}

.panel.enter {
  animation: panel-in 0.45s ease-out both;
}

@keyframes panel-in {
  from {
    opacity: 0;
    transform: scale(1.04);
  }
}

.stat-grid {
  display: grid;
  grid-template-columns: auto auto;
  gap: 4px 16px;
  font-size: 9px;
  line-height: 1.6;
  text-align: left;
}

.stat-grid .label {
  text-align: right;
}

.perk-list {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 4px;
  max-width: 100%;
}

.owned {
  width: 100%;
  max-width: 640px;
  margin-top: 4px;
  padding-top: 8px;
  border-top: 2px solid #3a3d49;
}

.owned.hidden {
  display: none;
}

.owned-head {
  font-size: 7px;
  letter-spacing: 1px;
  color: var(--muted);
  margin-bottom: 6px;
}

/* a perk's description, over whichever panel is up */
.pop-wrap {
  position: absolute;
  inset: 0;
  z-index: 4;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(0, 0, 0, 0.55);
}

.pop-wrap.hidden {
  display: none;
}

.pop-card {
  --rarity: #b8bcc8;
  width: 100%;
  max-width: 300px;
  background: #0c0d12;
  border: 3px solid var(--rarity);
  box-shadow: 4px 4px 0 #000;
  padding: 12px 14px;
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.pop-card.common { --rarity: #b8bcc8; }
.pop-card.rare { --rarity: #5fb2ff; }
.pop-card.legendary { --rarity: #ffc857; }

.pop-card .rarity {
  font-size: 7px;
  letter-spacing: 1px;
  color: var(--rarity);
}

.pop-name {
  font-size: 12px;
  color: var(--ink);
}

.chip {
  font: inherit;
  font-size: 7px;
  cursor: pointer;
  touch-action: manipulation;
  padding: 3px 5px;
  border: 2px solid var(--rarity, #b8bcc8);
  color: var(--rarity, #b8bcc8);
  background: #0c0d12;
  white-space: nowrap;
}

.chip.common { --rarity: #b8bcc8; }
.chip.rare { --rarity: #5fb2ff; }
.chip.legendary { --rarity: #ffc857; }

.title-small {
  font-size: 9px;
  color: var(--muted);
  letter-spacing: 2px;
  margin-bottom: 8px;
}

#overlay h1 {
  margin: 0;
  font-size: clamp(22px, 7vw, 40px);
  line-height: 1.2;
  color: var(--accent);
  text-shadow: 4px 4px 0 #000, 0 0 24px rgba(255, 200, 87, 0.35);
}

.blurb {
  margin: 0;
  max-width: 34em;
  font-size: 9px;
  line-height: 1.8;
  color: #d8d6cc;
}

.blurb strong {
  color: var(--ink);
}

/* the start screen can run tall on a short phone: let it scroll */
#overlay {
  padding-top: 14px;
  gap: 10px;
}

.mission {
  width: 100%;
  max-width: 38em;
  background: rgba(12, 13, 18, 0.78);
  border: 2px solid #3a3d49;
  padding: 10px 12px;
  text-align: left;
}

.mission-head {
  font-size: 8px;
  letter-spacing: 2px;
  color: var(--accent);
  margin-bottom: 6px;
}

.howto {
  margin: 0;
  padding-left: 1.6em;
  font-size: 8px;
  line-height: 1.65;
  color: #d8d6cc;
}

.howto li + li {
  margin-top: 5px;
}

.howto strong {
  color: var(--ink);
}

.howto em {
  font-style: normal;
  color: var(--accent);
}

.wink {
  color: var(--accent);
}

.cta-btn {
  font: inherit;
  color: var(--ink);
  cursor: pointer;
  touch-action: manipulation;
}

.cta-btn:active {
  transform: translate(2px, 2px);
  box-shadow: 2px 2px 0 #000;
}

#pick {
  gap: 12px;
}

.cta {
  margin-top: 8px;
  padding: 12px 20px;
  border: 3px solid var(--ink);
  background: #0c0d12;
  font-size: 13px;
  box-shadow: 4px 4px 0 #000;
  animation: blink 1.1s steps(2, end) infinite;
}

.diff-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  width: 100%;
  max-width: 560px;
  margin-top: 6px;
}

.diff-btn {
  --d: #b8bcc8;
  font: inherit;
  color: var(--ink);
  text-align: left;
  background: #0c0d12;
  border: 3px solid var(--d);
  box-shadow: 4px 4px 0 #000;
  padding: 10px 12px;
  flex: 1 1 150px;
  max-width: 180px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  cursor: pointer;
  touch-action: manipulation;
  opacity: 0.8;
  transition: transform 0.12s, opacity 0.12s;
}

.diff-btn.active {
  opacity: 1;
  background: #1e2029;
  box-shadow: 4px 4px 0 #000, 0 0 16px var(--d);
}

.diff-btn:not(.active):hover,
.diff-btn:focus-visible {
  opacity: 1;
  transform: translateY(-2px);
  outline: none;
}

.diff-name {
  font-size: 11px;
  color: var(--d);
  display: flex;
  justify-content: space-between;
}

.diff-key {
  color: var(--muted);
  font-size: 8px;
}

.diff-blurb {
  font-size: 7px;
  line-height: 1.7;
  color: #c9c7bd;
  flex: 1 1 auto;
}

.diff-best {
  font-size: 7px;
  color: var(--muted);
}

.linkish {
  font: inherit;
  font-size: 8px;
  color: var(--muted);
  background: none;
  border: none;
  text-decoration: underline;
  cursor: pointer;
  padding: 6px;
  touch-action: manipulation;
}

.linkish:hover {
  color: var(--ink);
}

.tiny {
  margin: 0;
  font-size: 7px;
  color: var(--muted);
  line-height: 1.7;
}

/* ---------- footer ---------- */

#foot {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 4px 10px;
  background: var(--panel);
  border-top: 3px solid #0c0d12;
  font-size: 8px;
}

#mute {
  font: inherit;
  font-size: 7px;
  color: var(--ink);
  background: var(--panel-2);
  border: 2px solid #0c0d12;
  padding: 5px 7px;
  cursor: pointer;
  touch-action: manipulation;
}

#mute:active {
  transform: translateY(1px);
}

#stage.slowmo::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: rgba(95, 178, 255, 0.14);
}

#stage.ouch::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: rgba(255, 60, 60, 0.28);
}

/* ---------- motion ---------- */

@keyframes bob {
  0%,
  100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-3px);
  }
}

@keyframes shiver {
  0% {
    transform: translate(-1px, 0);
  }
  50% {
    transform: translate(1px, -1px);
  }
  100% {
    transform: translate(-1px, 1px);
  }
}

@keyframes blink {
  50% {
    opacity: 0.35;
  }
}

@keyframes glint {
  from {
    box-shadow: 4px 4px 0 #000, 0 0 0 rgba(255, 200, 87, 0);
  }
  to {
    box-shadow: 4px 4px 0 #000, 0 0 18px rgba(255, 200, 87, 0.55);
  }
}

@keyframes glow {
  from {
    box-shadow: inset 0 0 20px 6px rgba(255, 90, 165, 0.25);
  }
  to {
    box-shadow: inset 0 0 40px 14px rgba(255, 90, 165, 0.55);
  }
}

@media (prefers-reduced-motion: reduce) {
  #orb,
  .cta,
  body[data-mood="4"] #stage {
    animation: none;
  }
}

@media (min-width: 700px) {
  .label {
    font-size: 9px;
  }
  .score {
    font-size: 34px;
  }
  .timer {
    font-size: 28px;
  }
  .hearts {
    font-size: 20px;
  }
  .sub {
    font-size: 10px;
  }
  #ai-line {
    font-size: 11px;
  }
  .blurb {
    font-size: 11px;
  }
  #toast {
    font-size: 9px;
  }
  .howto {
    font-size: 10px;
  }
  .mission-head {
    font-size: 9px;
  }
  .card .card-name {
    font-size: 11px;
  }
  .card .card-desc,
  .card .card-stack,
  .card .rarity {
    font-size: 8px;
  }
  .chip {
    font-size: 8px;
  }
  .diff-blurb,
  .diff-best {
    font-size: 8px;
  }
}
