:root {
  color-scheme: dark;
  --ink: #f7f5ed;
  --muted: #9aa5bd;
  --night: #070b16;
  --panel: #10182b;
  --panel-2: #18223b;
  --lime: #c8ff45;
  --coral: #ff5f6d;
  --violet: #916cff;
  --cyan: #51e8ff;
  --line: rgba(255, 255, 255, 0.12);
  --radius: 22px;
  --shadow: 0 24px 70px rgba(0, 0, 0, 0.38);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans JP", sans-serif;
}

* { box-sizing: border-box; }

html {
  min-width: 0;
  min-height: 100%;
  background: var(--night);
}

body {
  margin: 0;
  min-width: 0;
  min-height: 100dvh;
  color: var(--ink);
  background:
    radial-gradient(circle at 12% 10%, rgba(145, 108, 255, 0.17), transparent 32%),
    radial-gradient(circle at 88% 84%, rgba(81, 232, 255, 0.12), transparent 30%),
    var(--night);
  overscroll-behavior-x: none;
}

button { font: inherit; }
button:focus-visible { outline: 3px solid var(--cyan); outline-offset: 3px; }

.game-shell {
  position: relative;
  width: min(100%, 480px);
  min-height: 100dvh;
  margin: 0 auto;
  padding: max(10px, env(safe-area-inset-top)) 14px max(14px, env(safe-area-inset-bottom));
  overflow: clip;
}

.game-shell::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: 0.16;
  background-image: linear-gradient(rgba(255,255,255,.025) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,.025) 1px, transparent 1px);
  background-size: 24px 24px;
}

.topbar {
  position: relative;
  z-index: 10;
  display: grid;
  grid-template-columns: auto 1fr auto auto auto;
  align-items: center;
  gap: 10px;
  min-height: 42px;
  border-bottom: 1px solid var(--line);
}

.brand-button, .icon-button {
  border: 0;
  color: var(--ink);
  background: transparent;
  cursor: pointer;
}

.brand-button { display: flex; align-items: center; gap: 7px; padding: 6px 0; font-weight: 900; letter-spacing: .08em; }
.brand-mark { width: 14px; height: 14px; border: 3px solid var(--lime); border-radius: 50% 45% 55% 40%; transform: rotate(-16deg); }
.topbar-status { overflow: hidden; color: var(--muted); font-size: 9px; font-weight: 800; letter-spacing: .11em; text-align: center; white-space: nowrap; text-overflow: ellipsis; }
.icon-button { min-width: 56px; padding: 7px 8px; border: 1px solid var(--line); border-radius: 999px; color: var(--muted); font-size: 9px; font-weight: 900; letter-spacing: .08em; }
.language-button { min-width: 38px; color: var(--cyan); }
.collection-button { display: flex; align-items: center; gap: 4px; min-width: 56px; color: var(--lime); }
.collection-button b { color: var(--muted); font-size: 7px; font-variant-numeric: tabular-nums; }
.icon-button[aria-pressed="true"] { color: var(--coral); border-color: rgba(255,95,109,.45); }
.icon-button:disabled { cursor: default; opacity: .42; }

.screen {
  position: relative;
  z-index: 1;
  display: none;
  min-height: calc(100dvh - 56px - env(safe-area-inset-top) - env(safe-area-inset-bottom));
  padding: clamp(14px, 3vh, 26px) 2px 4px;
}
.screen--active { display: flex; flex-direction: column; }

.eyebrow, .stage-label {
  color: var(--lime);
  font-size: 10px;
  font-weight: 950;
  letter-spacing: .16em;
}

h1, h2, p { margin-top: 0; }
h1 { margin: 8px 0 4px; line-height: .82; letter-spacing: -.055em; }
h1 span { display: block; color: var(--ink); font-size: clamp(38px, 12vw, 62px); font-weight: 950; }
h1 strong { display: block; color: var(--lime); font-size: clamp(52px, 16vw, 82px); font-weight: 1000; }
h2 { margin: 4px 0 0; font-size: clamp(18px, 5.4vw, 25px); line-height: 1.15; letter-spacing: -.03em; }

.intro-screen { align-items: stretch; text-align: center; }
.hero-canvas { display: block; width: 100%; aspect-ratio: 12 / 7; margin: 4px 0 6px; border: 1px solid var(--line); border-radius: var(--radius); background: linear-gradient(145deg, rgba(145,108,255,.13), rgba(81,232,255,.04)); box-shadow: var(--shadow); }
.intro-copy { margin: 3px auto 12px; max-width: 390px; color: #c8d0e1; font-size: clamp(13px, 3.8vw, 16px); font-weight: 700; }
.challenge-card { display: grid; grid-template-columns: auto 1fr; align-items: center; gap: 9px; margin: -2px 0 9px; padding: 8px 11px; border: 1px solid rgba(81,232,255,.32); border-radius: 13px; background: linear-gradient(100deg, rgba(81,232,255,.11), rgba(145,108,255,.12)); text-align: left; }
.challenge-card[hidden], .challenge-result[hidden] { display: none; }
.challenge-card span { color: var(--cyan); font-size: 8px; font-weight: 950; letter-spacing: .1em; }
.challenge-card strong { overflow: hidden; color: var(--ink); font-size: 12px; text-align: right; text-overflow: ellipsis; white-space: nowrap; }

.primary-button, .secondary-button, .ghost-button, .jump-button, .same-course-button {
  min-height: 48px;
  border-radius: 16px;
  cursor: pointer;
  transition: transform .16s ease, filter .16s ease, background .16s ease;
}
.primary-button:active, .secondary-button:active, .ghost-button:active, .jump-button:active, .same-course-button:active { transform: translateY(2px) scale(.985); }
.primary-button { border: 0; color: #11151d; background: var(--lime); font-weight: 950; box-shadow: 0 10px 30px rgba(200,255,69,.18); }
.primary-button--hero { display: flex; align-items: center; justify-content: space-between; width: 100%; min-height: 58px; padding: 10px 18px; text-align: left; }
.primary-button--hero span { font-size: 17px; }
.primary-button--hero small { font-size: 8px; letter-spacing: .12em; }
.secondary-button { border: 1px solid rgba(255,255,255,.18); color: var(--ink); background: var(--panel-2); font-weight: 850; }
.ghost-button { border: 1px solid transparent; color: var(--muted); background: transparent; font-weight: 800; }
.same-course-button { border: 1px solid rgba(81,232,255,.48); color: var(--night); background: linear-gradient(135deg, var(--cyan), #8ef3ff); font-weight: 1000; box-shadow: 0 10px 30px rgba(81,232,255,.16); }

.how-to { display: grid; grid-template-columns: repeat(3, 1fr); gap: 7px; margin: 10px 0 0; padding: 0; list-style: none; }
.how-to li { display: flex; align-items: center; gap: 5px; min-width: 0; padding: 8px 6px; border: 1px solid var(--line); border-radius: 13px; color: var(--muted); background: rgba(16,24,43,.72); font-size: 10px; font-weight: 800; }
.how-to b { display: grid; flex: 0 0 21px; height: 21px; place-items: center; border-radius: 50%; color: var(--night); background: var(--cyan); font-size: 10px; }
.version-label { margin: auto 0 0; padding-top: 8px; color: #64708a; font-size: 8px; letter-spacing: .09em; }

.play-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; margin-bottom: 9px; }
.timer { display: flex; flex-direction: column; align-items: flex-end; line-height: .8; }
.timer strong { color: var(--coral); font-size: 34px; font-variant-numeric: tabular-nums; letter-spacing: -.06em; }
.timer span { margin-top: 6px; color: var(--muted); font-size: 8px; font-weight: 900; letter-spacing: .18em; }
.theme-chip { align-self: flex-start; margin-bottom: 8px; padding: 7px 11px; border: 1px solid rgba(200,255,69,.23); border-radius: 999px; color: var(--muted); background: rgba(200,255,69,.06); font-size: 8px; font-weight: 900; letter-spacing: .09em; }
.theme-chip strong { margin-left: 5px; color: var(--lime); font-size: 11px; letter-spacing: 0; }

.canvas-wrap { position: relative; width: 100%; aspect-ratio: 1; min-height: 0; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; background: #0c1222; box-shadow: var(--shadow); touch-action: none; user-select: none; }
.canvas-wrap canvas { display: block; width: 100%; height: 100%; touch-action: none; }
.canvas-wrap--draw { cursor: crosshair; }
.draw-prompt { position: absolute; inset: 50% auto auto 50%; transform: translate(-50%, -50%); padding: 8px 12px; border: 1px solid var(--line); border-radius: 999px; color: var(--muted); background: rgba(7,11,22,.78); font-size: 11px; font-weight: 800; pointer-events: none; transition: opacity .18s ease; }
.draw-prompt--hidden { opacity: 0; }
.progress-track { height: 5px; margin: 9px 3px 7px; border-radius: 999px; overflow: hidden; background: var(--panel-2); }
.progress-track span { display: block; width: 100%; height: 100%; transform-origin: left; background: linear-gradient(90deg, var(--cyan), var(--lime), var(--coral)); }
.micro-hint { margin: 0; color: var(--muted); font-size: 11px; font-weight: 650; text-align: center; }

.hatch-screen { align-items: center; text-align: center; }
.hatch-screen h2 { margin-bottom: 10px; }
.hatch-canvas { display: block; width: min(100%, 390px); aspect-ratio: 1; border: 1px solid var(--line); border-radius: var(--radius); background: #0c1222; box-shadow: var(--shadow); }
.hatch-screen p { margin: 12px 0 0; color: var(--muted); font-size: 12px; font-weight: 800; }
.hatch-reveal { position: relative; display: grid; width: min(88%, 340px); gap: 3px; margin-top: 9px; padding: 8px 11px; border: 1px solid rgba(200,255,69,.34); border-radius: 13px; background: rgba(200,255,69,.08); }
.hatch-reveal[hidden] { display: none; }
.hatch-reveal strong { color: var(--lime); font-size: 13px; }
.hatch-reveal span { color: var(--ink); font-size: 10px; font-weight: 850; }
.new-family-badge { position: absolute; inset: -11px 8px auto auto; padding: 4px 8px; border-radius: 999px; color: var(--night); background: var(--lime); font-size: 7px; font-weight: 1000; letter-spacing: .08em; box-shadow: 0 0 18px rgba(200,255,69,.36); animation: new-family-pop .62s ease both; }
.new-family-badge[hidden] { display: none; }
.scan-lines { display: flex; width: min(88%, 340px); gap: 5px; margin-top: 10px; }
.scan-lines i { flex: 1; height: 4px; border-radius: 99px; background: var(--panel-2); animation: scan 1s infinite alternate; }
.scan-lines i:nth-child(2) { animation-delay: .2s; }.scan-lines i:nth-child(3) { animation-delay: .4s; }

.run-heading { margin-bottom: 9px; }
.ability-chip { align-self: flex-start; max-width: 100%; margin: -3px 0 7px; padding: 5px 9px; overflow: hidden; border: 1px solid rgba(145,108,255,.32); border-radius: 999px; color: #d8cfff; background: rgba(145,108,255,.1); font-size: 8px; font-weight: 900; text-overflow: ellipsis; white-space: nowrap; }
.run-stats { display: flex; flex-direction: column; align-items: flex-end; gap: 3px; color: var(--muted); font-size: 8px; font-weight: 900; letter-spacing: .1em; }
.run-stats i { font-style: normal; }
.run-stats strong { color: var(--lime); font-size: 14px; font-variant-numeric: tabular-nums; }
.countdown { position: absolute; inset: 50% auto auto 50%; transform: translate(-50%, -50%); color: var(--lime); font-size: 86px; font-weight: 1000; text-shadow: 0 0 35px rgba(200,255,69,.5); pointer-events: none; }
.run-feedback { position: absolute; inset: 14px 14px auto auto; min-width: 88px; min-height: 22px; color: var(--lime); font-size: 16px; font-weight: 1000; letter-spacing: .04em; text-align: right; text-shadow: 0 0 18px currentColor; pointer-events: none; }
.run-feedback[data-kind="hit"] { color: var(--coral); }
.run-feedback[data-kind="clear"] { color: var(--cyan); }
.run-feedback[data-kind="miss"] { color: #ffd26a; }
.run-feedback[data-kind="assist"] { color: var(--cyan); animation: assist-pulse .52s ease-in-out infinite alternate; }
.jump-button { display: flex; align-items: center; justify-content: center; gap: 12px; min-height: 62px; margin-top: 10px; border: 1px solid rgba(81,232,255,.4); color: var(--ink); background: linear-gradient(135deg, rgba(81,232,255,.2), rgba(145,108,255,.2)); box-shadow: 0 10px 32px rgba(81,232,255,.1); }
.jump-button span { color: var(--cyan); font-size: 22px; font-weight: 1000; letter-spacing: .05em; }
.jump-button small { color: var(--muted); font-size: 10px; font-weight: 750; }
.jump-button:disabled { cursor: wait; filter: saturate(.35); opacity: .58; box-shadow: none; }
.jump-button:disabled span { color: var(--muted); }

.result-screen { align-items: stretch; text-align: center; }
.result-screen h2 { margin-bottom: 8px; }
.result-card { display: block; width: min(100%, 360px); aspect-ratio: 1; margin: 0 auto 8px; border: 1px solid var(--line); border-radius: 20px; background: #0c1222; box-shadow: var(--shadow); }
.result-story { display: grid; grid-template-columns: 1.2fr 1fr auto; align-items: center; gap: 5px; margin-bottom: 8px; text-align: left; }
.result-story > * { min-width: 0; padding: 7px 8px; overflow: hidden; border: 1px solid rgba(81,232,255,.24); border-radius: 11px; color: var(--muted); background: rgba(81,232,255,.06); font-size: 7px; font-weight: 900; line-height: 1.25; text-overflow: ellipsis; white-space: nowrap; }
.result-story strong { color: var(--cyan); }
.result-story[data-outcome="wrecked"] strong { border-color: rgba(255,95,109,.42); color: #ff9aa3; background: rgba(255,95,109,.1); }
.result-story[data-new-family="true"] span:last-child { border-color: rgba(200,255,69,.42); color: var(--lime); background: rgba(200,255,69,.09); }
.result-summary { display: grid; grid-template-columns: 1.05fr .92fr .78fr 1fr; gap: 5px; margin-bottom: 8px; }
.result-summary div { padding: 7px 5px; border: 1px solid var(--line); border-radius: 12px; background: rgba(16,24,43,.82); }
.result-summary span { display: block; color: var(--muted); font-size: 7px; font-weight: 900; letter-spacing: .12em; }
.result-summary strong { display: block; margin-top: 2px; color: var(--ink); font-size: 14px; font-variant-numeric: tabular-nums; }
.trait-strip { display: grid; grid-template-columns: repeat(3, 1fr); gap: 5px; margin: -2px 0 8px; }
.trait-strip span { display: flex; align-items: center; justify-content: space-between; gap: 4px; padding: 6px 7px; border: 1px solid rgba(145,108,255,.28); border-radius: 10px; background: rgba(145,108,255,.08); }
.trait-strip i { overflow: hidden; color: var(--muted); font-size: 7px; font-style: normal; font-weight: 900; text-overflow: ellipsis; white-space: nowrap; }
.trait-strip b { color: var(--cyan); font-size: 11px; font-variant-numeric: tabular-nums; }
.challenge-result { margin: 0 0 8px; padding: 9px 12px; border: 1px solid rgba(81,232,255,.32); border-radius: 13px; color: var(--cyan); background: rgba(81,232,255,.08); font-size: 11px; font-weight: 950; }
.challenge-result[data-outcome="beat"] { border-color: rgba(200,255,69,.42); color: var(--lime); background: rgba(200,255,69,.09); }
.challenge-result[data-outcome="record"] { border-color: rgba(200,255,69,.42); color: var(--lime); background: rgba(200,255,69,.09); }
.challenge-result[data-outcome="record-gap"] { border-color: rgba(81,232,255,.32); color: var(--cyan); background: rgba(81,232,255,.08); }
.challenge-result[data-outcome="miss"] { border-color: rgba(255,95,109,.34); color: #ff9aa3; background: rgba(255,95,109,.08); }
.improvement-tip { margin: 0 0 8px; padding: 9px 11px; border-left: 3px solid var(--cyan); border-radius: 6px 12px 12px 6px; color: #d8e3f6; background: rgba(81,232,255,.07); font-size: 10px; font-weight: 800; line-height: 1.45; text-align: left; }
.improvement-tip[hidden] { display: none; }
.action-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.action-grid button { min-height: 43px; font-size: 12px; }
.action-grid .same-course-button { grid-column: 1 / -1; }
.action-grid .ghost-button { border-color: rgba(255,255,255,.12); background: rgba(7,11,22,.46); }
.share-note { margin: 7px 0 0; color: var(--muted); font-size: 9px; }

.error-screen { align-items: center; justify-content: center; text-align: center; }
.error-glyph { display: grid; width: 76px; height: 76px; margin-bottom: 18px; place-items: center; border: 4px solid var(--coral); border-radius: 28% 72% 62% 38%; color: var(--coral); font-size: 42px; font-weight: 1000; transform: rotate(-8deg); }
.error-screen p { color: var(--muted); }.error-screen .primary-button { width: 100%; }

.audio-overlay { position: fixed; z-index: 60; inset: 0; display: grid; place-items: center; padding: max(14px, env(safe-area-inset-top)) 14px max(14px, env(safe-area-inset-bottom)); background: rgba(7,11,22,.9); backdrop-filter: blur(12px); }
.audio-overlay[hidden] { display: none; }
.audio-panel { width: min(100%, 390px); padding: 18px; border: 1px solid var(--line); border-radius: 24px; background: linear-gradient(155deg, rgba(24,34,59,.99), rgba(7,11,22,.99)); box-shadow: var(--shadow); }
.audio-panel header { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.audio-panel h2 { margin-top: 4px; }
.audio-hint { margin: 10px 0 12px; color: var(--muted); font-size: 10px; font-weight: 750; line-height: 1.45; }
.audio-options { display: grid; gap: 8px; }
.audio-option { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 12px; min-height: 70px; padding: 12px; border: 1px solid var(--line); border-radius: 16px; color: var(--ink); background: rgba(7,11,22,.58); text-align: left; cursor: pointer; }
.audio-option span { min-width: 0; }
.audio-option strong, .audio-option small { display: block; }
.audio-option strong { font-size: 13px; }
.audio-option small { margin-top: 4px; color: var(--muted); font-size: 9px; font-weight: 700; line-height: 1.35; }
.audio-option b { min-width: 50px; padding: 7px 8px; border: 1px solid rgba(255,95,109,.38); border-radius: 999px; color: var(--coral); font-size: 9px; text-align: center; }
.audio-option[aria-pressed="true"] { border-color: rgba(200,255,69,.38); background: rgba(200,255,69,.06); }
.audio-option[aria-pressed="true"] b { border-color: rgba(200,255,69,.42); color: var(--lime); }

.resume-overlay { position: absolute; z-index: 30; inset: 0; display: grid; place-items: center; padding: 20px; background: rgba(7,11,22,.88); backdrop-filter: blur(10px); }
.resume-overlay[hidden] { display: none; }
.resume-overlay > div { width: 100%; padding: 26px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel); text-align: center; box-shadow: var(--shadow); }
.resume-overlay h2 { margin: 7px 0 18px; }.resume-overlay .primary-button { width: 100%; }

.collection-overlay { position: fixed; z-index: 50; inset: 0; display: grid; place-items: stretch center; padding: max(10px, env(safe-area-inset-top)) 10px max(10px, env(safe-area-inset-bottom)); background: rgba(7,11,22,.92); backdrop-filter: blur(12px); }
.collection-overlay[hidden] { display: none; }
.collection-panel, .specimen-detail { width: min(100%, 468px); max-height: calc(100dvh - 20px); padding: 17px; overflow-y: auto; overscroll-behavior: contain; border: 1px solid var(--line); border-radius: 24px; background: linear-gradient(155deg, rgba(24,34,59,.98), rgba(7,11,22,.99)); box-shadow: var(--shadow); }
.collection-panel[hidden], .specimen-detail[hidden] { display: none; }
.collection-panel header { position: sticky; z-index: 2; top: -17px; display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin: -17px -17px 0; padding: 17px; border-bottom: 1px solid var(--line); background: rgba(16,24,43,.96); backdrop-filter: blur(10px); }
.collection-panel h2 { margin-top: 4px; }
.collection-panel h3 { margin: 18px 0 8px; color: var(--ink); font-size: 13px; letter-spacing: .08em; }
.collection-hint, .collection-empty { margin: 11px 0; color: var(--muted); font-size: 10px; font-weight: 750; line-height: 1.45; }
.family-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 7px; }
.family-card { display: grid; grid-template-columns: 58px minmax(0, 1fr); align-items: center; min-height: 76px; padding: 7px; border: 1px solid var(--line); border-radius: 15px; background: rgba(16,24,43,.72); text-align: left; }
.family-card--locked { border-style: dashed; opacity: .74; }
.family-card canvas { width: 54px; height: 54px; border-radius: 11px; background: rgba(7,11,22,.68); }
.family-card strong, .recent-copy strong { display: block; overflow: hidden; color: var(--ink); font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
.family-card small, .recent-copy small { display: block; margin-top: 4px; color: var(--muted); font-size: 8px; font-weight: 750; line-height: 1.3; }
.recent-grid { display: grid; gap: 7px; }
.recent-card { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: stretch; gap: 5px; padding: 5px; border: 1px solid var(--line); border-radius: 15px; background: rgba(16,24,43,.72); }
.recent-card[data-favorite="true"] { border-color: rgba(200,255,69,.48); background: rgba(200,255,69,.07); }
.recent-open { display: grid; grid-template-columns: 64px minmax(0, 1fr) 18px; align-items: center; gap: 8px; min-width: 0; min-height: 68px; padding: 3px; border: 0; border-radius: 11px; color: inherit; background: transparent; text-align: left; cursor: pointer; }
.recent-open:hover { background: rgba(255,255,255,.035); }
.recent-open::after { content: "›"; color: var(--cyan); font-size: 22px; font-weight: 700; text-align: center; }
.recent-open canvas { width: 60px; height: 60px; border-radius: 11px; background: rgba(7,11,22,.7); }
.recent-copy { min-width: 0; }
.recent-copy small { font-variant-numeric: tabular-nums; }
.recent-actions { display: grid; gap: 5px; }
.recent-actions button { min-width: 58px; min-height: 29px; padding: 5px 7px; border: 1px solid var(--line); border-radius: 9px; color: var(--muted); background: rgba(7,11,22,.6); font-size: 7px; font-weight: 900; cursor: pointer; }
.recent-actions button:first-child { color: var(--lime); }

.specimen-detail { position: relative; }
.specimen-detail header { display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: center; gap: 11px; margin-bottom: 12px; text-align: left; }
.specimen-detail header h2 { overflow: hidden; margin-top: 3px; text-overflow: ellipsis; white-space: nowrap; }
.detail-back { min-height: 40px; padding: 8px 11px; border: 1px solid var(--line); border-radius: 12px; color: var(--cyan); background: rgba(7,11,22,.6); font-size: 9px; font-weight: 900; cursor: pointer; }
.specimen-result-card { display: block; width: min(100%, 380px); aspect-ratio: 1; margin: 0 auto 9px; border: 1px solid var(--line); border-radius: 20px; background: #0c1222; box-shadow: var(--shadow); }
.specimen-metrics { display: grid; grid-template-columns: 1.05fr .92fr .78fr 1fr; gap: 5px; margin-bottom: 12px; }
.specimen-metrics div { min-width: 0; padding: 7px 5px; border: 1px solid var(--line); border-radius: 12px; background: rgba(16,24,43,.82); text-align: center; }
.specimen-metrics span { display: block; overflow: hidden; color: var(--muted); font-size: 7px; font-weight: 900; letter-spacing: .08em; text-overflow: ellipsis; white-space: nowrap; }
.specimen-metrics strong { display: block; overflow: hidden; margin-top: 2px; color: var(--ink); font-size: 14px; font-variant-numeric: tabular-nums; text-overflow: ellipsis; white-space: nowrap; }
.stored-line-section { padding: 11px; border: 1px solid var(--line); border-radius: 16px; background: rgba(7,11,22,.48); }
.stored-line-heading { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 8px; }
.stored-line-heading h3 { margin: 0; color: var(--ink); font-size: 12px; }
.stored-line-heading span { color: var(--lime); font-size: 9px; font-weight: 950; }
.stored-line-section canvas { display: block; width: 100%; aspect-ratio: 9 / 4; border: 1px solid var(--line); border-radius: 12px; background: var(--night); }
.stored-line-section canvas[hidden] { display: none; }
.stored-line-missing { display: grid; min-height: 94px; margin: 0; place-items: center; padding: 14px; border: 1px dashed rgba(255,255,255,.16); border-radius: 12px; color: var(--muted); font-size: 10px; font-weight: 750; line-height: 1.45; text-align: center; }
.stored-line-missing[hidden] { display: none; }
.specimen-detail-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; margin-top: 10px; }
.specimen-detail-actions button { min-height: 44px; padding: 8px; font-size: 10px; }

@keyframes scan { to { background: var(--lime); box-shadow: 0 0 16px rgba(200,255,69,.45); } }
@keyframes new-family-pop { from { opacity: 0; transform: translateY(7px) scale(.8); } to { opacity: 1; transform: translateY(0) scale(1); } }
@keyframes assist-pulse { to { opacity: .62; transform: scale(.96); } }

@media (max-height: 700px) {
  .screen { padding-top: 6px; }
  .intro-copy { margin-bottom: 8px; }
  .how-to { margin-top: 7px; }
  .canvas-wrap { width: min(100%, calc(100dvh - 205px)); align-self: center; }
  .hatch-canvas { width: min(100%, calc(100dvh - 195px)); }
  .result-screen h2 { margin-bottom: 4px; }
  .result-card { width: min(100%, calc(100dvh - 414px)); min-width: 210px; margin-bottom: 5px; }
  .result-summary, .challenge-result, .improvement-tip { margin-bottom: 5px; }
  .challenge-result, .improvement-tip { padding-block: 7px; }
  .action-grid { gap: 5px; }
  .action-grid button { min-height: 40px; }
}

@media (max-height: 590px) {
  .topbar { min-height: 36px; }
  .screen { min-height: calc(100dvh - 46px); padding-top: 7px; }
  .hero-canvas { width: min(100%, 320px); margin-inline: auto; }
  .how-to { display: none; }
  .version-label { display: none; }
  .canvas-wrap { width: min(100%, calc(100dvh - 180px)); }
  .result-card { width: min(100%, calc(100dvh - 404px)); min-width: 190px; }
  .trait-strip { display: none; }
  .action-grid button { min-height: 39px; }
}

@media (max-width: 350px) {
  .topbar { gap: 6px; }
  .topbar-status { display: none; }
  .icon-button { min-width: 44px; padding-inline: 6px; }
  .language-button { min-width: 38px; }
  .collection-button { min-width: 46px; }
  .collection-button b { display: none; }
  .family-grid { grid-template-columns: 1fr; }
  .recent-open { grid-template-columns: 58px minmax(0, 1fr) 14px; gap: 5px; }
  .recent-open canvas { width: 54px; height: 54px; }
  .recent-actions button { min-width: 51px; padding-inline: 4px; }
  .specimen-detail { padding: 12px; }
  .specimen-detail-actions { grid-template-columns: 1fr; }
}

@media (min-width: 720px) {
  .game-shell { margin-block: 12px; min-height: calc(100dvh - 24px); border: 1px solid var(--line); border-radius: 28px; background: rgba(7,11,22,.72); box-shadow: var(--shadow); }
  .screen { min-height: calc(100dvh - 104px); }
}

@media (min-width: 720px) and (max-height: 820px) {
  .screen { padding-top: 10px; }
  .result-screen h2 { margin-bottom: 5px; }
  .result-card { width: min(100%, 320px); margin-bottom: 5px; }
  .result-summary, .challenge-result, .improvement-tip { margin-bottom: 5px; }
  .challenge-result, .improvement-tip { padding-block: 7px; }
  .action-grid { gap: 5px; }
  .action-grid button { min-height: 40px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
