/* One theme only: a late-90s movie-site look (black starfield, planet nav,
   chunky logo, beveled panels), drawn entirely in CSS. */
:root {
  --bg: #000;
  --surface: rgba(10, 10, 46, 0.86);
  --surface-2: #1b1b55;
  --border: #4b4bc8;
  --bevel-light: #8f8fff;
  --bevel-dark: #20206a;
  --text: #ffffff;
  --muted: #b9b9e6;
  --accent: #ff8a1c;
  --accent-hover: #ffab4a;
  --accent-soft: rgba(255, 138, 28, 0.18);
  --on-accent: #1a0800;
  --gold: #ffe14d;
  --link: #66ccff;
  --link-visited: #d29bff;
  --sea: #3fd3ff;
  --sea-soft: rgba(63, 211, 255, 0.15);
  --cooked: #ffc93c;
  --cooked-soft: rgba(255, 201, 60, 0.16);
  --danger: #ff6b6b;
  --danger-soft: rgba(255, 107, 107, 0.14);
  --bar-other: #6262b8;
  --shadow: 0 0 0 1px rgba(0, 0, 0, 0.6), 0 0 28px rgba(80, 80, 255, 0.22);
  --radius: 6px;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --font-body: "Times New Roman", Times, "Liberation Serif", serif;
  --font-display: "Arial Black", "Arial Bold", Gadget, Impact, "Helvetica Neue", Arial, sans-serif;
  --font-ui: Verdana, Geneva, "DejaVu Sans", Tahoma, sans-serif;
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

html { background: var(--bg); }

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  color: var(--text);
  font: 17px/1.5 var(--font-body);
}

/* Tiled starfield, like a 1996 background GIF. Two fixed layers: still stars,
   and a sparser layer that twinkles (opacity only, so it stays cheap). */
body::before, body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
}
body::before {
  background:
    radial-gradient(1px 1px at 23px 41px, #fff 50%, transparent 51%),
    radial-gradient(1px 1px at 97px 13px, #cfd8ff 50%, transparent 51%),
    radial-gradient(1.5px 1.5px at 151px 88px, #fff 50%, transparent 51%),
    radial-gradient(1px 1px at 61px 132px, #ffe9c4 50%, transparent 51%),
    radial-gradient(1px 1px at 183px 171px, #fff 50%, transparent 51%),
    radial-gradient(1px 1px at 9px 197px, #b8c4ff 50%, transparent 51%),
    radial-gradient(1px 1px at 128px 211px, #fff 50%, transparent 51%);
  background-size: 223px 229px;
  opacity: 0.85;
}
body::after {
  background:
    radial-gradient(2px 2px at 71px 63px, #fff 50%, transparent 51%),
    radial-gradient(1.5px 1.5px at 311px 241px, #ffd27a 50%, transparent 51%),
    radial-gradient(2px 2px at 203px 389px, #9fd8ff 50%, transparent 51%),
    radial-gradient(1.5px 1.5px at 389px 107px, #fff 50%, transparent 51%);
  background-size: 457px 443px;
  animation: twinkle 3.2s ease-in-out infinite alternate;
}

::selection { background: var(--accent); color: var(--on-accent); }

a { color: var(--link); }
a:visited { color: var(--link-visited); }
a:hover { color: var(--gold); }

button { font: inherit; color: inherit; }
button, input, select, textarea, .btn { font-family: var(--font-ui); }

.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

[hidden] { display: none !important; }

/* ---------- Top bar ---------- */

/* The header is a little solar system: the logo in the middle, the pages as
   planets floating below it, and the account controls tucked in the corner. */
.topbar {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  max-width: 1120px;
  width: 100%;
  margin: 0 auto;
  padding: 18px 24px 4px;
}

.brand {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 26px;
  text-decoration: none;
  color: var(--text);
}
.brand:visited { color: var(--text); }

/* The swoosh around the logo. */
.brand-orbit {
  position: absolute;
  left: -6%; right: -6%;
  top: 18%; bottom: 8%;
  border-radius: 50%;
  border: 3px solid transparent;
  border-top-color: #ff5a1f;
  border-right-color: #ffb03a;
  transform: rotate(-9deg);
  filter: drop-shadow(0 0 6px rgba(255, 120, 30, 0.7));
  pointer-events: none;
}

.brand-mark {
  display: block;
  width: 54px; height: 54px;
  filter: drop-shadow(0 0 10px rgba(255, 60, 40, 0.65));
  animation: spin-slow 24s linear infinite;
}

.brand-text {
  display: flex;
  flex-direction: column;
  line-height: 0.88;
  font-family: var(--font-display);
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.01em;
  transform: rotate(-4deg) skewX(-6deg);
}
.brand-top, .brand-bottom {
  background: linear-gradient(180deg, #fff6a8 0%, #ffd23a 30%, #ff8a1c 62%, #e0400f 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  -webkit-text-stroke: 1px #5a1400;
  filter: drop-shadow(3px 3px 0 #2a0a6e) drop-shadow(0 0 12px rgba(255, 140, 30, 0.45));
}
.brand-top { font-size: 2.3rem; }
.brand-bottom { font-size: 1.62rem; padding-left: 0.6em; }

.topbar-right {
  position: absolute;
  top: 14px;
  right: 24px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.skip-link {
  position: absolute;
  left: 12px;
  top: -60px;
  z-index: 100;
  padding: 8px 14px;
  border-radius: 10px;
  background: var(--accent);
  color: var(--on-accent);
  font-weight: 650;
  text-decoration: none;
  transition: top 0.2s var(--ease);
}
.skip-link:focus { top: 12px; }

/* ---------- Navigation ---------- */

/* Each page is a planet. The planet is the link's ::before, so the markup
   stays a plain list of text links. */
.nav {
  display: flex;
  align-items: flex-start;
  justify-content: center;
  flex-wrap: wrap;
  gap: 8px 44px;
  margin-top: 6px;
}
.nav-link {
  --size: 64px;
  --planet: radial-gradient(circle at 32% 30%, #fff 0 4%, #9a9aff 18%, #3d3dc4 55%, #0b0b3a 100%);
  --glow: rgba(120, 120, 255, 0.5);
  --bob: 5.5s;
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  padding: 4px 6px;
  color: var(--gold);
  font: 900 0.8rem/1.1 var(--font-display);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  text-align: center;
  text-decoration: none;
  text-shadow: 2px 2px 0 #000, 0 0 8px rgba(0, 0, 0, 0.9);
  animation: bob var(--bob) ease-in-out infinite;
}
.nav-link:visited { color: var(--gold); }
.nav-link::before {
  content: "";
  display: block;
  width: var(--size);
  height: var(--size);
  border-radius: 50%;
  background: var(--planet);
  box-shadow: inset -8px -10px 18px rgba(0, 0, 0, 0.55), 0 0 18px var(--glow);
  transition: transform 0.3s var(--ease), box-shadow 0.3s var(--ease);
}
.nav-link:hover { color: #fff; }
.nav-link:hover::before { transform: scale(1.1) rotate(-8deg); box-shadow: inset -8px -10px 18px rgba(0, 0, 0, 0.5), 0 0 30px var(--glow); }
.nav-link:focus-visible { outline: 2px dashed var(--gold); outline-offset: 4px; border-radius: 8px; }

/* Classify: a basketball planet. */
.nav-link[href="/"] {
  --planet:
    linear-gradient(90deg, transparent 48%, rgba(40, 10, 0, 0.85) 48% 52%, transparent 52%),
    linear-gradient(0deg, transparent 48%, rgba(40, 10, 0, 0.85) 48% 52%, transparent 52%),
    radial-gradient(circle calc(var(--size) * 0.6) at -32% 50%, transparent 93%, rgba(40, 10, 0, 0.85) 93% 100%, transparent 100%),
    radial-gradient(circle calc(var(--size) * 0.6) at 132% 50%, transparent 93%, rgba(40, 10, 0, 0.85) 93% 100%, transparent 100%),
    radial-gradient(circle at 32% 30%, #ffd9a0 0 5%, #ff9a2e 30%, #d9530c 70%, #5a1c00 100%);
  --glow: rgba(255, 130, 30, 0.6);
  --bob: 5s;
}
/* Gallery: a banded ocean planet. */
.nav-link[href="/gallery"] {
  --planet:
    repeating-linear-gradient(-18deg, transparent 0 9px, rgba(255, 255, 255, 0.14) 9px 13px),
    radial-gradient(circle at 32% 30%, #e2fbff 0 5%, #47d2ff 28%, #136e9e 65%, #031a33 100%);
  --glow: rgba(60, 200, 255, 0.55);
  --bob: 6.2s;
  animation-delay: -2s;
}
/* Lobster Tinder: a pink ringed planet. */
.nav-link[href="/tinder"] {
  --planet: radial-gradient(circle at 32% 30%, #ffe1f3 0 5%, #ff6ec7 30%, #a3137a 68%, #2b0021 100%);
  --glow: rgba(255, 90, 200, 0.55);
  --bob: 5.7s;
  animation-delay: -3.5s;
}
.nav-link[href="/tinder"]::after {
  content: "";
  position: absolute;
  top: calc(4px + var(--size) * 0.36);
  left: 50%;
  width: calc(var(--size) * 1.6);
  height: calc(var(--size) * 0.3);
  margin-left: calc(var(--size) * -0.8);
  border-radius: 50%;
  border: 3px solid rgba(255, 200, 240, 0.75);
  border-top-color: transparent;
  transform: rotate(-14deg);
  pointer-events: none;
}

/* The page you're on gets a dashed orbit. */
.nav-link[aria-current="page"] { color: #fff; }
.nav-link[aria-current="page"]::before {
  outline: 2px dashed rgba(255, 225, 77, 0.8);
  outline-offset: 7px;
}

/* ---------- Account menu ---------- */

.account { position: relative; }
.account-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 38px;
  padding: 0 8px 0 4px;
  border-radius: 4px;
  border: 2px outset var(--bevel-light);
  background: var(--surface-2);
  cursor: pointer;
  transition: background-color 0.2s var(--ease);
}
.account-btn:hover { background: var(--surface-2); }
.account-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.account-name { max-width: 12ch; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; font-size: 0.9rem; }
.chevron { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; transition: transform 0.2s var(--ease); }
.account-btn[aria-expanded="true"] .chevron { transform: rotate(180deg); }

.avatar {
  width: 30px; height: 30px;
  border-radius: 50%;
  object-fit: cover;
  flex: none;
}
.avatar.initials {
  display: grid;
  place-items: center;
  font-size: 0.75rem;
  font-weight: 750;
  color: #fff;
  background: hsl(var(--hue, 10) 60% 45%);
}

.menu {
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  z-index: 50;
  min-width: 220px;
  padding: 6px;
  border-radius: 4px;
  border: 3px ridge var(--border);
  background: #0a0a2e;
  box-shadow: var(--shadow);
  animation: pop 0.18s var(--ease);
  transform-origin: top right;
}
.menu-head { margin: 6px 10px 8px; font-size: 0.82rem; color: var(--muted); }
.menu-head strong { color: var(--text); }
.menu-item {
  display: block;
  width: 100%;
  padding: 9px 10px;
  border: 0;
  border-radius: 9px;
  background: none;
  color: var(--text);
  font: inherit;
  font-size: 0.92rem;
  text-align: left;
  text-decoration: none;
  cursor: pointer;
}
.menu-item:hover, .menu-item:focus-visible { background: var(--surface-2); outline: none; }

.badge {
  font-size: 0.78rem;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--cooked-soft);
  color: var(--cooked);
  white-space: nowrap;
}

.icon-btn {
  display: grid;
  place-items: center;
  width: 38px; height: 38px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface);
  cursor: pointer;
  transition: background-color 0.2s var(--ease), transform 0.2s var(--ease);
}
.icon-btn:hover { background: var(--surface-2); }
.icon-btn:active { transform: scale(0.94); }
.icon-btn svg {
  width: 18px; height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
}

/* ---------- Layout ---------- */

main {
  flex: 1;
  width: 100%;
  max-width: 1120px;
  margin: 0 auto;
  padding: 8px 24px 40px;
}

.intro { max-width: 640px; margin: 24px 0 28px; }
.intro h1 {
  margin: 0 0 10px;
  font: 900 clamp(1.6rem, 4vw, 2.4rem)/1.1 var(--font-display);
  color: var(--gold);
  text-shadow: 3px 3px 0 #3a1a9e, 0 0 18px rgba(255, 200, 60, 0.35);
}
.intro p { margin: 0; color: var(--muted); font-size: 1.1rem; }
.intro { margin-left: auto; margin-right: auto; text-align: center; }

.workspace {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 20px;
  align-items: start;
}

/* Panels: a beveled ridge border, like a table cell from 1996. */
.card {
  background: var(--surface);
  border: 3px ridge var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px;
}

.results-card { min-height: 420px; }

/* ---------- Upload ---------- */

.dropzone {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  min-height: 360px;
  padding: 32px 20px;
  border: 2px dashed var(--border);
  border-radius: 12px;
  cursor: pointer;
  transition: border-color 0.2s var(--ease), background-color 0.2s var(--ease), transform 0.25s var(--ease);
}
.dropzone:hover, .dropzone:focus-visible { border-color: var(--accent); background: var(--accent-soft); outline: none; }
.dropzone.dragging { border-color: var(--accent); background: var(--accent-soft); transform: scale(0.985); }

.drop-icon {
  width: 56px; height: 56px;
  margin-bottom: 12px;
  fill: none;
  stroke: var(--accent);
  stroke-width: 2.2;
  stroke-linejoin: round;
  stroke-linecap: round;
  transition: transform 0.3s var(--ease);
}
.dropzone:hover .drop-icon, .dropzone.dragging .drop-icon { transform: translateY(-4px); }
.drop-title { margin: 0 0 4px; font-weight: 650; font-size: 1.1rem; }
.drop-hint { margin: 0; color: var(--muted); font-size: 0.9rem; max-width: 34ch; }
.link { color: var(--accent); font-weight: 600; text-decoration: underline; text-underline-offset: 2px; }

kbd {
  font: 600 0.78rem ui-monospace, SFMono-Regular, Menlo, monospace;
  padding: 1px 5px;
  border-radius: 5px;
  border: 1px solid var(--border);
  background: var(--surface-2);
}

.preview { margin: 0; animation: rise 0.4s var(--ease); }
.preview-frame {
  position: relative;
  overflow: hidden;
  border-radius: 12px;
  background: var(--surface-2);
  display: grid;
  place-items: center;
}
.preview-stack { position: relative; display: inline-block; max-width: 100%; line-height: 0; }
.preview-stack #preview-img {
  display: block;
  max-width: 100%;
  max-height: 420px;
  object-fit: contain;
}
.heatmap {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.45s var(--ease);
}
.heatmap.on { opacity: 1; }

/* ---------- Switch ---------- */

.switch {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin-top: 14px;
  font-size: 0.92rem;
  font-weight: 600;
  cursor: pointer;
  user-select: none;
}
.switch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.switch-track {
  position: relative;
  width: 40px; height: 24px;
  border-radius: 999px;
  background: var(--border);
  transition: background-color 0.25s var(--ease);
  flex: none;
}
.switch-thumb {
  position: absolute;
  top: 3px; left: 3px;
  width: 18px; height: 18px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25);
  transition: transform 0.25s var(--ease);
}
.switch input:checked + .switch-track { background: var(--accent); }
.switch input:checked + .switch-track .switch-thumb { transform: translateX(16px); }
.switch input:focus-visible + .switch-track { outline: 2px solid var(--accent); outline-offset: 2px; }
.preview figcaption {
  margin-top: 8px;
  font-size: 0.85rem;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Scanning sweep shown while a request is in flight. */
.scan {
  position: absolute;
  inset: 0;
  opacity: 0;
  pointer-events: none;
  background: linear-gradient(180deg, transparent 0%, var(--accent-soft) 45%, var(--accent) 50%, var(--accent-soft) 55%, transparent 100%);
  background-size: 100% 40%;
  background-repeat: no-repeat;
  transition: opacity 0.2s;
}
.busy .scan { opacity: 0.55; animation: scan 1.1s linear infinite; }

.actions { display: flex; gap: 10px; margin-top: 16px; }

/* Buttons: chunky and beveled; the bevel flips when pressed. */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  padding: 0 20px;
  border-radius: 4px;
  border: 3px outset var(--bevel-light);
  font-weight: 700;
  cursor: pointer;
  transition: background-color 0.2s var(--ease), transform 0.15s var(--ease), opacity 0.2s, filter 0.2s;
}
.btn:active { transform: translateY(1px); border-style: inset; }
.btn:focus-visible, .icon-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.btn.primary {
  flex: 1;
  background: linear-gradient(180deg, #ffe066 0%, #ffab2e 45%, #f06a0c 100%);
  border-color: #ffc46b;
  color: var(--on-accent);
  font-family: var(--font-display);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.45);
}
.btn.primary:hover { filter: brightness(1.1); }
.btn.ghost { background: var(--surface-2); border-color: var(--bevel-light); color: var(--text); }
.btn.ghost:hover { background: var(--surface-2); }
.btn:disabled { opacity: 0.6; cursor: progress; }
.btn.small { min-height: 36px; padding: 0 14px; font-size: 0.88rem; border-radius: 9px; text-decoration: none; }
a.btn { text-decoration: none; color: inherit; }
a.btn.primary { color: var(--on-accent); }
.btn.wide { width: 100%; }
.btn.danger { background: var(--danger); color: #fff; }
.btn.danger:hover { filter: brightness(1.08); }
.topbar .btn.small { border-color: var(--bevel-light); background: var(--surface-2); color: var(--text); }
.topbar .btn.small:hover { background: var(--surface-2); }

.hint { margin: 10px 0 0; font-size: 0.85rem; color: var(--muted); }

.muted { color: var(--muted); }

.spinner {
  width: 16px; height: 16px;
  border-radius: 50%;
  border: 2px solid color-mix(in srgb, var(--on-accent) 35%, transparent);
  border-top-color: var(--on-accent);
  animation: spin 0.7s linear infinite;
}

.error {
  margin: 14px 0 0;
  padding: 10px 14px;
  border-radius: 10px;
  background: var(--danger-soft);
  color: var(--danger);
  font-size: 0.92rem;
  animation: rise 0.3s var(--ease);
}

/* ---------- Results ---------- */

.state { animation: fade 0.35s var(--ease); }

.empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 380px;
  color: var(--muted);
  text-align: center;
}
.empty p { margin: 16px 0 0; }
.empty-graphic { display: flex; flex-direction: column; gap: 8px; width: 160px; }
.empty-graphic span { height: 10px; border-radius: 99px; background: var(--surface-2); transform-origin: left; }
.empty-graphic span:nth-child(1) { transform: scaleX(0.9); }
.empty-graphic span:nth-child(2) { transform: scaleX(0.55); }
.empty-graphic span:nth-child(3) { transform: scaleX(0.3); }

.loading { display: flex; flex-direction: column; gap: 14px; padding-top: 4px; }
.skeleton {
  height: 18px;
  border-radius: 8px;
  background: linear-gradient(90deg, var(--surface-2) 0%, var(--border) 50%, var(--surface-2) 100%);
  background-size: 200% 100%;
  animation: shimmer 1.2s linear infinite;
}
.skeleton.big { height: 88px; border-radius: 12px; }
.skeleton.short { width: 60%; }

.eyebrow {
  margin: 0 0 4px;
  font: 700 0.72rem var(--font-ui);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--gold);
}

.verdict {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 18px;
  border-radius: 12px;
  background: var(--sea-soft);
  --tone: var(--sea);
}
.verdict.is-lobster { background: var(--accent-soft); --tone: var(--accent); }
.verdict-text {
  margin: 0;
  font: 900 clamp(1.5rem, 3vw, 2rem) var(--font-display);
  line-height: 1.1;
  color: var(--tone);
}

.gauge { position: relative; width: 100px; height: 100px; flex: none; }
.gauge svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.gauge circle { fill: none; stroke-width: 9; }
.gauge-track { stroke: var(--border); }
.gauge-fill {
  stroke: var(--tone);
  stroke-linecap: round;
  stroke-dasharray: 0 100;
}
.gauge-value {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  padding-bottom: 12px;
  font-weight: 800;
  font-size: 1.15rem;
  font-variant-numeric: tabular-nums;
}
.gauge-label {
  position: absolute;
  left: 0; right: 0; bottom: 30px;
  text-align: center;
  font-size: 0.6rem;
  color: var(--muted);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.top-class { margin: 20px 0 0; }
.taxon-name { margin: 0; font-size: 1.5rem; font-weight: 700; }
.taxon-sci { margin: 0; color: var(--muted); }
.taxon-sci.species { font-style: italic; }
.taxon-note { margin: 8px 0 0; font-size: 0.93rem; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.chip {
  font-size: 0.82rem;
  font-weight: 650;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--muted);
}
.chip.cooked { background: var(--cooked-soft); color: var(--cooked); }
.chip.raw { background: var(--sea-soft); color: var(--sea); }

.cooked-warning {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 12px 0 0;
  padding: 10px 14px;
  border-radius: 10px;
  background: var(--cooked-soft);
  color: var(--cooked);
  font-weight: 650;
  font-size: 0.92rem;
  animation: rise 0.4s var(--ease);
}
.cooked-warning::before { content: "♨"; font-size: 1.1rem; }

.result-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.result-actions:not(:has(> :not([hidden]))) { display: none; }

.breakdown { margin-top: 22px; }
.bars { list-style: none; margin: 8px 0 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.bar-row {
  display: grid;
  grid-template-columns: minmax(0, 11rem) minmax(0, 1fr) 3.4rem;
  align-items: center;
  gap: 12px;
  font-size: 0.9rem;
  opacity: 0;
  transform: translateY(6px);
  animation: rise 0.45s var(--ease) forwards;
  animation-delay: calc(var(--i) * 45ms);
}
.bar-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar-track { display: block; height: 8px; border-radius: 99px; background: var(--surface-2); overflow: hidden; }
.bar-fill {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--bar-other);
  transform-origin: left;
  transform: scaleX(0);
  transition: transform 0.9s var(--ease);
  transition-delay: calc(var(--i) * 45ms + 120ms);
}
.bar-row.lobster .bar-fill { background: var(--accent); }
.bar-pct { text-align: right; font-variant-numeric: tabular-nums; color: var(--muted); }
.bar-row.top .bar-name { font-weight: 700; }
.bar-row.top .bar-pct { color: var(--text); font-weight: 700; }

.legend { display: flex; align-items: center; gap: 6px; margin: 14px 0 0; font-size: 0.8rem; color: var(--muted); }
.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.dot.lobster { background: var(--accent); }
.dot.other { background: var(--bar-other); margin-left: 10px; }

.meta { margin: 18px 0 0; padding-top: 14px; border-top: 1px solid var(--border); font-size: 0.8rem; color: var(--muted); }

.footer {
  max-width: 1120px;
  width: 100%;
  margin: 0 auto;
  padding: 24px 24px 32px;
  font-size: 0.85rem;
  color: var(--muted);
  text-align: center;
}
.footer p { margin: 0; }
.footer-motto { font-weight: 700; color: var(--text); }
.footer-links { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px 10px; margin-top: 6px !important; }
.footer-retro { margin-top: 10px !important; font-size: 0.75rem; font-style: italic; opacity: 0.75; }

/* ---------- Forms ---------- */

.field { display: flex; flex-direction: column; gap: 6px; margin: 0 0 14px; font-size: 0.9rem; font-weight: 600; }
.field input, .field textarea, .field select {
  width: 100%;
  min-height: 44px;
  padding: 10px 12px;
  border: 2px inset var(--border);
  border-radius: 3px;
  background: var(--bg);
  color: var(--text);
  font: inherit;
  font-weight: 400;
  transition: border-color 0.2s var(--ease), box-shadow 0.2s var(--ease);
}
.field textarea { resize: vertical; min-height: 84px; }
.field input:focus, .field textarea:focus, .field select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.form-status { margin: 10px 0 0; font-size: 0.9rem; color: var(--sea); }

/* ---------- Motion ---------- */

@keyframes rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }
@keyframes scan { from { background-position: 0 -60%; } to { background-position: 0 160%; } }
@keyframes pop { from { opacity: 0; transform: scale(0.96) translateY(-4px); } to { opacity: 1; transform: none; } }
@keyframes grow { from { transform: scaleX(0); } to { transform: scaleX(1); } }
@keyframes twinkle { from { opacity: 0.25; } to { opacity: 1; } }
@keyframes bob { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-7px); } }
@keyframes spin-slow { to { transform: rotate(360deg); } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    animation-delay: 0ms !important;
    transition-duration: 0.01ms !important;
    transition-delay: 0ms !important;
  }
}

/* ---------- Small screens ---------- */

@media (max-width: 820px) {
  .topbar { padding-top: 60px; }
  .topbar-right { right: 16px; top: 12px; }
  .nav { gap: 8px 22px; }
  .nav-link { --size: 50px; font-size: 0.72rem; }
  .account-name { display: none; }
  .workspace { grid-template-columns: minmax(0, 1fr); }
  .results-card { min-height: 0; }
  .empty { min-height: 200px; }
  .dropzone { min-height: 240px; }
}

@media (max-width: 480px) {
  .topbar, main, .footer { padding-left: 16px; padding-right: 16px; }
  .brand-mark { width: 40px; height: 40px; }
  .brand-top { font-size: 1.7rem; }
  .brand-bottom { font-size: 1.2rem; }
  .nav { gap: 6px 14px; }
  .nav-link { --size: 44px; }
  .badge { display: none; }
  .field-row { grid-template-columns: 1fr; gap: 0; }
  .card { padding: 16px; }
  .bar-row { grid-template-columns: minmax(0, 7.5rem) minmax(0, 1fr) 3rem; gap: 8px; font-size: 0.85rem; }
  .gauge { width: 92px; height: 92px; }
  .gauge-label { bottom: 27px; }
}

/* ---------- Print ---------- */

@media print {
  .topbar, .footer, .skip-link { display: none !important; }
  html, body { background: #fff; color: #000; }
  body::before, body::after { display: none; }
}
