:root {
  --bg: #ececec;
  --panel: #ffffff;
  --panel-2: #f7f7f7;
  --panel-3: #efefef;
  --ink: #333333;
  --ink-soft: #6f6f6f;
  --accent: #de3e45;
  --accent-2: #8c8c8c;
  --accent-deep: #b8262c;
  --focus: #e7444b;
  --focus-soft: #fff1f1;
  --blue: #5073df;
  --blue-deep: #3552b8;
  --yellow: #ecd631;
  --grid: #d8d8d8;
  --line: #c7c7c7;
  --body-top: #d7d7d7;
  --body-bottom: #c8c8c8;
  --device-frame: #5f5f5f;
  --device-rim: #d8d8d8;
  --screen-top: #f5f5f5;
  --screen-bottom: #e7e7e7;
  --view-border: #888888;
  --view-bg-top: #fcfcfc;
  --view-bg-bottom: #f1f1f1;
  --header-top: #ef4c53;
  --header-bottom: #d9363d;
  --header-border: #b8262c;
  --tile-border: #9c9c9c;
  --tile-bg-top: #ffffff;
  --tile-bg-bottom: #f1f1f1;
  --tab-idle-top: #fafafa;
  --tab-idle-bottom: #ebebeb;
  --overlay: rgba(42, 42, 42, 0.42);
  --scroll-track: #e7e7e7;
  --scroll-thumb-top: #6f8cff;
  --scroll-thumb-bottom: #4f6ad4;
  --scroll-thumb-border: #3650b4;
}

* { box-sizing: border-box; }

html,
body {
  width: 100%;
  height: 100%;
  overflow: hidden;
}

body {
  margin: 0;
  height: 100vh;
  font-family: "Courier New", "Monaco", monospace;
  background: linear-gradient(180deg, var(--body-top) 0%, var(--body-bottom) 100%);
  color: var(--ink);
  display: block;
  padding: 0;
}

.device {
  width: 100vw;
  height: 100vh;
}

.screen {
  width: 100%;
  height: 100%;
  border: 0;
  box-shadow: none;
  background: linear-gradient(180deg, var(--screen-top) 0%, var(--screen-bottom) 100%);
  display: grid;
  grid-template-rows: auto 1fr;
  padding: 0;
  gap: 0;
}

.top-bar {
  border: 1px solid var(--view-border);
  background:
    linear-gradient(180deg, color-mix(in srgb, var(--tile-bg-top) 96%, #d2d2d2) 0%, color-mix(in srgb, var(--tile-bg-bottom) 95%, #c8c8c8) 100%);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.45), inset 0 -1px 0 rgba(0, 0, 0, 0.12);
  min-height: 24px;
}

.top-bar {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 8px;
  padding: 2px 8px;
  position: relative;
}

.top-bar::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 2px;
  background: linear-gradient(90deg, transparent 0%, var(--accent) 12%, var(--accent) 88%, transparent 100%);
  opacity: 0.75;
}

.status-text {
  display: flex;
  align-items: center;
  gap: 4px;
  min-width: 0;
  overflow-x: auto;
  scrollbar-width: none;
}

.status-text::-webkit-scrollbar {
  display: none;
}

.system-meta {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 10px;
  color: var(--ink-soft);
}

.wifi-meta,
.battery-meta {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.wifi-meta {
  padding-right: 6px;
  border-right: 1px solid color-mix(in srgb, var(--view-border) 70%, transparent);
}

.wifi-icon {
  display: inline-flex;
  align-items: flex-end;
  gap: 1.5px;
  height: 11px;
  padding: 0 1px;
}

.wifi-icon span {
  display: block;
  width: 2px;
  background: color-mix(in srgb, var(--ink-soft) 65%, transparent);
  border-radius: 1px;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.06);
}

.wifi-icon span:nth-child(1) { height: 3px; }
.wifi-icon span:nth-child(2) { height: 6px; }
.wifi-icon span:nth-child(3) { height: 9px; }

.wifi-icon[data-level="1"] span:nth-child(1),
.wifi-icon[data-level="2"] span:nth-child(-n+2),
.wifi-icon[data-level="3"] span {
  background: var(--blue-deep);
}

.wifi-icon[data-level="0"] span {
  background: color-mix(in srgb, var(--accent) 55%, transparent);
}

.battery-icon {
  position: relative;
  width: 22px;
  height: 11px;
  border: 1px solid color-mix(in srgb, var(--ink-soft) 88%, #000);
  border-radius: 2px;
  padding: 1px;
  background: color-mix(in srgb, var(--tile-bg-bottom) 70%, transparent);
}

.battery-icon::after {
  content: "";
  position: absolute;
  right: -3px;
  top: 3px;
  width: 2px;
  height: 3px;
  background: color-mix(in srgb, var(--ink-soft) 88%, #000);
  border-radius: 0 1px 1px 0;
}

.battery-fill {
  height: 100%;
  width: 55%;
  background: linear-gradient(90deg, var(--blue) 0%, var(--blue-deep) 100%);
  border-radius: 1px;
}

.view {
  position: relative;
  border: 2px solid var(--view-border);
  background:
    linear-gradient(var(--grid) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid) 1px, transparent 1px),
    linear-gradient(180deg, var(--view-bg-top) 0%, var(--view-bg-bottom) 100%);
  background-size: 24px 24px, 24px 24px, 100% 100%;
  min-height: 0;
  overflow: hidden;
}

.hidden { display: none !important; }

.menu-title {
  font-size: 12px;
  margin: 0;
  padding: 5px 10px 4px;
  color: #fff;
  background: linear-gradient(180deg, var(--header-top) 0%, var(--header-bottom) 100%);
  border-bottom: 2px solid var(--header-border);
}

.menu-list {
  list-style: none;
  margin: 0;
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.menu-item {
  border: 1px solid var(--tile-border);
  background: linear-gradient(180deg, color-mix(in srgb, var(--tile-bg-top) 94%, transparent) 0%, color-mix(in srgb, var(--tile-bg-bottom) 94%, transparent) 100%);
  padding: 8px;
  font-size: 14px;
  line-height: 1.15;
  box-shadow: inset 0 0 0 1px #f7f7f7;
}

.menu-item.active {
  outline: 2px solid var(--focus);
  background: var(--focus-soft);
}

.home-view {
  --home-night: #10243a;
  --home-deep: #163f61;
  --home-water: #65c7ba;
  --home-water-light: #bdf0d1;
  --home-cream: #fff6cf;
  --home-panel: #fff9dc;
  --home-panel-low: #f2cf69;
  --home-ink: #14263b;
  --home-red: var(--accent);
  --home-red-dark: var(--accent-deep);
  --home-blue: var(--blue);
  --home-yellow: var(--yellow);
  position: relative;
  display: grid;
  grid-template-rows: 52% 48%;
  overflow: hidden;
  isolation: isolate;
  font-family: "Press Start 2P", "Silkscreen", "Courier New", monospace;
  background:
    radial-gradient(circle at 18% 18%, rgba(255, 246, 185, 0.88) 0 2px, transparent 3px 100%),
    radial-gradient(circle at 78% 22%, rgba(255, 246, 185, 0.72) 0 2px, transparent 3px 100%),
    radial-gradient(90% 72% at 50% 7%, color-mix(in srgb, var(--home-water-light) 82%, white 18%) 0%, color-mix(in srgb, var(--home-water) 68%, transparent) 35%, transparent 66%),
    linear-gradient(180deg, #fff6bc 0%, #9ce4c1 28%, #65bfba 54%, #245677 100%);
}

.home-view::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 8;
  pointer-events: none;
  background:
    repeating-linear-gradient(
      180deg,
      rgba(255, 255, 255, 0.09) 0 1px,
      rgba(13, 35, 54, 0.08) 1px 3px,
      transparent 3px 5px
    ),
    repeating-linear-gradient(
      0deg,
      transparent 0 10px,
      rgba(255, 255, 255, 0.035) 10px 11px
    );
  mix-blend-mode: soft-light;
  animation: homeScanline 2.8s linear infinite;
}

.home-view::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 9;
  pointer-events: none;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(255, 246, 196, 0.92)),
    repeating-linear-gradient(90deg, var(--home-red) 0 10px, var(--home-blue) 10px 20px, var(--home-yellow) 20px 30px);
  animation: homeBootGate 980ms steps(8, end) 1 both;
}

.home-startup-fx {
  position: absolute;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
}

.home-startup-fx::before {
  content: "";
  position: absolute;
  width: min(58vw, 500px);
  aspect-ratio: 1;
  left: 50%;
  top: 51%;
  transform: translate(-50%, -50%);
  border: clamp(10px, 2vw, 18px) solid rgba(255, 255, 255, 0.2);
  border-radius: 50%;
  background:
    linear-gradient(180deg, rgba(222, 62, 69, 0.25) 0 45%, rgba(20, 38, 59, 0.35) 45% 55%, rgba(255, 255, 255, 0.18) 55% 100%),
    radial-gradient(circle, rgba(255, 246, 207, 0.28) 0 12%, transparent 13% 100%);
  filter: blur(0.2px);
  opacity: 0.78;
}

.home-startup-fx::after {
  content: "";
  position: absolute;
  left: -6%;
  right: -6%;
  bottom: 21%;
  height: 20%;
  background:
    linear-gradient(135deg, transparent 0 18%, rgba(20, 38, 59, 0.64) 18% 35%, transparent 35% 100%),
    linear-gradient(45deg, transparent 0 24%, rgba(20, 38, 59, 0.5) 24% 42%, transparent 42% 100%);
  background-size: 92px 100%, 130px 100%;
  image-rendering: pixelated;
  opacity: 0.44;
  animation: homeHorizonDrift 7s steps(18, end) infinite;
}

.home-grid-plane {
  position: absolute;
  left: -12%;
  right: -12%;
  bottom: -8%;
  height: 42%;
  transform: perspective(320px) rotateX(62deg);
  transform-origin: bottom center;
  background:
    linear-gradient(rgba(255, 246, 207, 0.34) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 246, 207, 0.34) 1px, transparent 1px),
    linear-gradient(180deg, rgba(13, 42, 65, 0.02), rgba(13, 42, 65, 0.42));
  background-size: 28px 28px, 28px 28px, 100% 100%;
  clip-path: polygon(8% 0, 92% 0, 100% 100%, 0 100%);
  opacity: 0.72;
  animation: homeGridDrift 1.4s linear infinite;
}

.home-scan-beam {
  position: absolute;
  left: -15%;
  right: -15%;
  top: 18%;
  height: 18px;
  background: linear-gradient(90deg, transparent, rgba(255, 251, 199, 0.65), transparent);
  box-shadow: 0 0 22px rgba(255, 246, 207, 0.48);
  transform: rotate(-6deg);
  animation: homeScanBeam 4.8s steps(18, end) infinite;
}

.home-pixel-cloud {
  position: absolute;
  width: 26px;
  height: 10px;
  background: rgba(255, 249, 222, 0.94);
  box-shadow:
    10px -6px 0 rgba(255, 249, 222, 0.94),
    20px 0 0 rgba(255, 249, 222, 0.94),
    35px -4px 0 rgba(255, 249, 222, 0.88),
    48px 2px 0 rgba(255, 249, 222, 0.74);
  opacity: 0.66;
  image-rendering: pixelated;
}

.home-pixel-cloud-a {
  left: 8%;
  top: 18%;
  animation: homeCloudA 9s steps(20, end) infinite;
}

.home-pixel-cloud-b {
  right: 18%;
  top: 34%;
  transform: scale(0.72);
  animation: homeCloudB 11s steps(24, end) infinite;
}

.home-pixel-grass {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 24px;
  background:
    repeating-linear-gradient(90deg, rgba(23, 78, 63, 0.88) 0 5px, rgba(48, 121, 86, 0.86) 5px 10px, rgba(255, 214, 83, 0.52) 10px 12px),
    linear-gradient(180deg, transparent, rgba(10, 44, 43, 0.66));
  clip-path: polygon(0 70%, 4% 28%, 8% 74%, 13% 38%, 18% 76%, 23% 30%, 29% 73%, 36% 42%, 42% 80%, 48% 28%, 55% 78%, 61% 36%, 67% 76%, 74% 29%, 81% 80%, 87% 39%, 94% 75%, 100% 31%, 100% 100%, 0 100%);
}

.home-hero {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  gap: clamp(5px, 1.2vh, 10px);
  min-height: 0;
  padding: clamp(12px, 3.6vh, 34px) clamp(12px, 4vw, 34px) 0;
  animation: homeHeroIntro 760ms steps(6, end) 140ms both;
}

.home-system-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 8px;
  border: 2px solid rgba(20, 38, 59, 0.82);
  background:
    linear-gradient(180deg, rgba(255, 249, 220, 0.94), rgba(255, 224, 122, 0.88));
  color: var(--home-ink);
  box-shadow:
    0 3px 0 rgba(20, 38, 59, 0.24),
    inset 0 0 0 2px rgba(255, 255, 255, 0.42);
  font-size: clamp(7px, 1.5vw, 10px);
  font-weight: 900;
  letter-spacing: 1.4px;
}

.home-led {
  width: 8px;
  height: 8px;
  border: 1px solid rgba(20, 38, 59, 0.86);
  background: var(--home-red);
  box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.44) inset, 0 0 8px rgba(222, 62, 69, 0.72);
  animation: homeLedBlink 1.1s steps(2, end) infinite;
}

.home-title-card {
  position: relative;
  z-index: 0;
  display: grid;
  justify-items: center;
  gap: 3px;
  max-width: min(96%, 780px);
  padding: clamp(7px, 1.5vw, 14px) clamp(14px, 4vw, 34px);
  text-align: center;
}

.home-title-card::before {
  content: "";
  position: absolute;
  inset: 7px 0 0;
  z-index: -1;
  background:
    linear-gradient(90deg, transparent 0 18px, rgba(255, 249, 222, 0.36) 18px calc(100% - 18px), transparent calc(100% - 18px)),
    linear-gradient(180deg, rgba(255, 255, 255, 0.22), rgba(20, 38, 59, 0.16));
  border-top: 3px solid rgba(255, 246, 207, 0.56);
  border-bottom: 3px solid rgba(20, 38, 59, 0.22);
  clip-path: polygon(16px 0, calc(100% - 16px) 0, 100% 14px, calc(100% - 12px) 100%, 12px 100%, 0 14px);
}

.home-title-card::after {
  content: "";
  position: absolute;
  right: clamp(8px, 2vw, 22px);
  bottom: clamp(6px, 1.2vw, 12px);
  width: clamp(18px, 4vw, 34px);
  aspect-ratio: 1;
  border: 3px solid rgba(20, 38, 59, 0.78);
  border-radius: 50%;
  background:
    linear-gradient(180deg, var(--home-red) 0 45%, var(--home-ink) 45% 55%, #fff9de 55% 100%);
  box-shadow: inset 0 0 0 3px rgba(255, 255, 255, 0.28), 0 3px 0 rgba(20, 38, 59, 0.26);
  opacity: 0.9;
}

.home-title-art {
  position: relative;
  font-size: clamp(38px, 10vw, 92px);
  line-height: 1;
  letter-spacing: clamp(1px, 0.75vw, 6px);
  font-weight: 900;
  color: var(--home-yellow);
  -webkit-text-stroke: 2px var(--home-blue);
  text-shadow:
    0 2px 0 var(--home-blue),
    2px 0 0 var(--home-blue),
    -2px 0 0 var(--home-blue),
    0 -2px 0 var(--home-blue),
    4px 4px 0 var(--home-red-dark),
    8px 8px 0 rgba(20, 38, 59, 0.28);
  image-rendering: pixelated;
  transform: skewX(-5deg);
  animation: homeTitlePop 1.7s steps(3, end) infinite;
}

.home-title-art::after {
  content: "";
  position: absolute;
  left: -8%;
  right: -8%;
  top: 40%;
  height: 6px;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.76), transparent);
  opacity: 0;
  transform: skewX(-16deg);
  animation: homeTitleShine 3.6s steps(8, end) infinite;
}

.home-title-kicker {
  font-size: clamp(8px, 1.8vw, 13px);
  line-height: 1;
  letter-spacing: clamp(1.8px, 0.9vw, 6px);
  font-weight: 900;
  color: #fff9de;
  text-shadow: 2px 2px 0 rgba(20, 38, 59, 0.46);
  opacity: 0.94;
}

.home-title-shadow {
  font-size: clamp(11px, 2.1vw, 17px);
  letter-spacing: 1.5px;
  color: var(--home-ink);
  font-weight: 900;
  animation: homeCatalogBreathe 1.35s steps(2, end) infinite;
}

.home-catalog-switch {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  max-width: min(92%, 430px);
  min-height: 30px;
  padding: 5px 13px;
  border: 2px solid rgba(20, 38, 59, 0.86);
  background:
    linear-gradient(90deg, rgba(255, 249, 220, 0.92), rgba(255, 224, 122, 0.9) 48%, rgba(255, 249, 220, 0.92));
  box-shadow:
    0 4px 0 rgba(20, 38, 59, 0.22),
    inset 0 0 0 2px rgba(255, 255, 255, 0.38);
  clip-path: polygon(9px 0, calc(100% - 9px) 0, 100% 50%, calc(100% - 9px) 100%, 9px 100%, 0 50%);
  white-space: nowrap;
}

.home-catalog-switch #homeCatalogLabel {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  text-align: center;
}

.home-switch-mark {
  color: var(--home-red);
  font-size: 0.9em;
  text-shadow: 1px 1px 0 rgba(20, 38, 59, 0.28);
  animation: homeSwitchBlink 880ms steps(2, end) infinite;
}

.home-menu-zone {
  position: relative;
  z-index: 2;
  display: grid;
  grid-template-columns: minmax(112px, 0.9fr) minmax(220px, 1.15fr);
  align-items: center;
  justify-content: center;
  gap: clamp(12px, 4vw, 46px);
  min-width: 0;
  min-height: 0;
  padding: 0 clamp(12px, 5vw, 62px) clamp(14px, 3.2vh, 30px);
  animation: homeMenuIntro 720ms steps(5, end) 260ms both;
}

.home-mascot-card {
  position: relative;
  justify-self: end;
  display: grid;
  place-items: center;
  width: clamp(112px, 22vw, 220px);
  aspect-ratio: 1;
  border: 3px solid rgba(20, 38, 59, 0.82);
  background:
    radial-gradient(circle at 50% 36%, rgba(255, 249, 220, 0.96) 0 16%, rgba(255, 224, 122, 0.88) 17% 29%, transparent 30%),
    linear-gradient(180deg, rgba(255, 249, 220, 0.92), rgba(101, 199, 186, 0.58));
  box-shadow:
    0 8px 0 rgba(20, 38, 59, 0.22),
    0 16px 24px rgba(20, 38, 59, 0.22),
    inset 0 0 0 4px rgba(255, 255, 255, 0.32);
  clip-path: polygon(12% 0, 88% 0, 100% 12%, 100% 88%, 88% 100%, 12% 100%, 0 88%, 0 12%);
}

.home-mascot-card::before,
.home-mascot-card::after {
  content: "";
  position: absolute;
  inset: 11px;
  border: 2px dashed rgba(20, 38, 59, 0.22);
  clip-path: inherit;
}

.home-mascot-card::after {
  inset: auto 16px 15px;
  height: 12px;
  border: 0;
  background:
    linear-gradient(90deg, transparent 0 18%, rgba(20, 38, 59, 0.3) 18% 82%, transparent 82% 100%);
  filter: blur(1px);
}

.home-orbit-ring {
  position: absolute;
  width: 72%;
  aspect-ratio: 1;
  border: 3px solid rgba(80, 115, 223, 0.48);
  border-left-color: rgba(222, 62, 69, 0.72);
  border-bottom-color: rgba(236, 214, 49, 0.72);
  border-radius: 50%;
  animation: homeOrbitSpin 5.8s steps(24, end) infinite;
}

.home-mascot-sprite {
  position: relative;
  z-index: 1;
  width: clamp(72px, 15vw, 150px);
  height: auto;
  image-rendering: pixelated;
  filter: drop-shadow(5px 8px 0 rgba(20, 38, 59, 0.22));
  transform-origin: bottom center;
  animation: homeSpriteIdle 1.2s steps(3, end) infinite;
}

.home-pixel-shadow {
  position: absolute;
  bottom: 17%;
  width: 48%;
  height: 9%;
  background: rgba(20, 38, 59, 0.25);
  filter: blur(0.5px);
  animation: homeSpriteShadow 1.2s steps(3, end) infinite;
}

.home-menu-shell {
  position: relative;
  justify-self: start;
  width: min(100%, 332px);
  min-width: min(82vw, 224px);
  max-height: 100%;
  padding: 12px 12px 11px;
  display: grid;
  gap: 8px;
  background:
    linear-gradient(180deg, rgba(255, 249, 220, 0.98) 0%, rgba(255, 235, 154, 0.98) 100%);
  border: 3px solid rgba(20, 38, 59, 0.9);
  clip-path: polygon(14px 0, calc(100% - 30px) 0, 100% 20px, 100% calc(100% - 14px), calc(100% - 14px) 100%, 25px 100%, 0 calc(100% - 22px), 0 12px);
  box-shadow:
    0 0 0 3px rgba(255, 255, 255, 0.42) inset,
    0 9px 0 rgba(20, 38, 59, 0.25),
    0 18px 30px rgba(20, 38, 59, 0.25);
}

.home-menu-shell::before {
  content: "";
  position: absolute;
  left: 13px;
  right: 13px;
  top: 8px;
  height: 5px;
  background:
    linear-gradient(90deg, var(--home-red) 0 24%, var(--home-yellow) 24% 40%, var(--home-blue) 40% 70%, rgba(20, 38, 59, 0.82) 70% 100%);
  box-shadow: 0 7px 0 rgba(20, 38, 59, 0.1);
}

.home-menu-shell::after {
  content: "";
  position: absolute;
  right: 14px;
  bottom: 8px;
  width: 42px;
  height: 7px;
  background: repeating-linear-gradient(90deg, rgba(20, 38, 59, 0.72) 0 6px, transparent 6px 10px);
  opacity: 0.36;
}

.home-menu-caption {
  position: relative;
  z-index: 1;
  justify-self: start;
  margin-top: 4px;
  padding: 2px 7px;
  border: 2px solid rgba(20, 38, 59, 0.84);
  background: var(--home-red);
  color: #fff9de;
  font-size: clamp(8px, 1.4vw, 11px);
  font-weight: 900;
  letter-spacing: 1.6px;
  text-shadow: 1px 1px 0 rgba(20, 38, 59, 0.54);
}

.home-menu-list {
  position: relative;
  z-index: 1;
  width: 100%;
  height: auto;
  min-height: 0;
  max-height: 100%;
  padding: 0 2px 2px;
  margin: 0;
  gap: 5px;
  overflow: visible;
  overflow-x: visible;
  overflow-y: visible;
  overscroll-behavior: none;
}

.home-menu-list .menu-item {
  position: relative;
  display: grid;
  grid-template-columns: 18px minmax(44px, 1fr) auto;
  grid-template-areas:
    "marker label code"
    "marker note code";
  align-items: center;
  column-gap: 8px;
  row-gap: 2px;
  min-height: 40px;
  border: 2px solid rgba(20, 38, 59, 0.78);
  padding: 5px 9px 5px 8px;
  font-size: 14px;
  font-weight: 800;
  letter-spacing: 1px;
  text-align: left;
  color: var(--home-ink);
  background:
    linear-gradient(90deg, rgba(255, 255, 255, 0.42) 0 6px, transparent 6px calc(100% - 6px), rgba(255, 255, 255, 0.3) calc(100% - 6px)),
    linear-gradient(180deg, rgba(255, 253, 235, 0.96), rgba(255, 238, 174, 0.88));
  clip-path: polygon(9px 0, calc(100% - 9px) 0, 100% 50%, calc(100% - 9px) 100%, 9px 100%, 0 50%);
  box-shadow:
    inset 0 0 0 2px rgba(255, 255, 255, 0.36),
    0 3px 0 rgba(20, 38, 59, 0.12);
  transition: transform 120ms steps(2, end), box-shadow 120ms steps(2, end), background 120ms steps(2, end), color 120ms steps(2, end);
}

.home-menu-list .menu-item::after {
  content: "";
  position: absolute;
  left: 18px;
  right: 18px;
  bottom: 5px;
  height: 2px;
  background: repeating-linear-gradient(90deg, rgba(20, 38, 59, 0.22) 0 6px, transparent 6px 10px);
  opacity: 0.34;
}

.home-menu-marker {
  grid-area: marker;
  width: 14px;
  height: 14px;
  border: 2px solid rgba(20, 38, 59, 0.84);
  border-radius: 50%;
  background:
    linear-gradient(180deg, var(--home-red) 0 45%, rgba(20, 38, 59, 0.82) 45% 55%, #fff9de 55% 100%);
  box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.24);
}

.home-menu-label {
  grid-area: label;
  font-size: clamp(15px, 2.7vw, 22px);
  font-weight: 900;
  line-height: 1;
  text-shadow: 1px 1px 0 rgba(255, 255, 255, 0.48);
}

.home-menu-note {
  grid-area: note;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: clamp(8px, 1.4vw, 11px);
  font-weight: 900;
  letter-spacing: 0.8px;
  color: rgba(20, 38, 59, 0.68);
}

.home-menu-code {
  grid-area: code;
  min-width: 38px;
  padding: 3px 5px;
  border: 2px solid rgba(20, 38, 59, 0.72);
  background: rgba(255, 255, 255, 0.42);
  color: rgba(20, 38, 59, 0.78);
  font-size: clamp(8px, 1.5vw, 11px);
  font-weight: 900;
  line-height: 1;
  text-align: center;
}

.home-menu-list .menu-item.active {
  outline: none;
  color: #fff9de;
  transform: translateX(-3px);
  background:
    linear-gradient(90deg, rgba(255, 249, 220, 0.2) 0 6px, transparent 6px calc(100% - 6px), rgba(255, 249, 220, 0.24) calc(100% - 6px)),
    linear-gradient(180deg, color-mix(in srgb, var(--home-red) 92%, #fff 8%) 0%, color-mix(in srgb, var(--home-red-dark) 90%, #000 10%) 100%);
  box-shadow:
    0 0 0 2px rgba(255, 249, 220, 0.88),
    0 6px 0 rgba(20, 38, 59, 0.28),
    0 0 24px rgba(222, 62, 69, 0.35);
  animation: homeMenuPulse 820ms steps(2, end) infinite;
}

.home-menu-list .menu-item.active::before {
  content: "";
  position: absolute;
  left: -10px;
  top: 50%;
  transform: translateY(-50%);
  width: 0;
  height: 0;
  border-top: 8px solid transparent;
  border-bottom: 8px solid transparent;
  border-left: 10px solid var(--home-yellow);
  filter: drop-shadow(2px 2px 0 rgba(20, 38, 59, 0.36));
  animation: homeCursorTick 520ms steps(2, end) infinite;
}

.home-menu-list .menu-item.active::after {
  left: 14px;
  right: 14px;
  bottom: 5px;
  height: 2px;
  background: repeating-linear-gradient(90deg, rgba(255, 249, 220, 0.92) 0 8px, transparent 8px 13px);
  opacity: 0.72;
}

.home-menu-list .menu-item.active .home-menu-marker {
  border-color: #fff9de;
  background:
    linear-gradient(180deg, var(--home-yellow) 0 45%, #fff9de 45% 55%, var(--home-blue) 55% 100%);
  box-shadow: 0 0 0 2px rgba(20, 38, 59, 0.28), inset 0 0 0 2px rgba(255, 255, 255, 0.28);
}

.home-menu-list .menu-item.active .home-menu-note,
.home-menu-list .menu-item.active .home-menu-code {
  color: #fff9de;
}

.home-menu-list .menu-item.active .home-menu-code {
  border-color: #fff9de;
  background: rgba(20, 38, 59, 0.28);
}

@keyframes homeScanline {
  from { transform: translateY(0); }
  to { transform: translateY(5px); }
}

@keyframes homeBootGate {
  0% {
    opacity: 1;
    clip-path: inset(0 0 0 0);
  }
  45% {
    opacity: 0.98;
    clip-path: inset(0 0 0 0);
  }
  68% {
    opacity: 0.74;
    clip-path: inset(42% 0 42% 0);
  }
  100% {
    opacity: 0;
    clip-path: inset(50% 0 50% 0);
  }
}

@keyframes homeHorizonDrift {
  from { transform: translateX(0); }
  to { transform: translateX(-92px); }
}

@keyframes homeGridDrift {
  from { background-position: 0 0, 0 0, 0 0; }
  to { background-position: 0 28px, 28px 0, 0 0; }
}

@keyframes homeScanBeam {
  0%, 68% { transform: translateY(-110px) rotate(-6deg); opacity: 0; }
  74% { opacity: 1; }
  100% { transform: translateY(230px) rotate(-6deg); opacity: 0; }
}

@keyframes homeCloudA {
  from { transform: translateX(0); }
  to { transform: translateX(52px); }
}

@keyframes homeCloudB {
  from { transform: translateX(0) scale(0.72); }
  to { transform: translateX(-60px) scale(0.72); }
}

@keyframes homeHeroIntro {
  from { opacity: 0; transform: translateY(-14px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes homeMenuIntro {
  from { opacity: 0; transform: translateY(18px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes homeLedBlink {
  0%, 45% { opacity: 1; }
  46%, 100% { opacity: 0.35; }
}

@keyframes homeTitlePop {
  0%, 100% { transform: skewX(-5deg) translateY(0) scale(1); }
  35% { transform: skewX(-5deg) translateY(-1px) scale(1.012); }
  70% { transform: skewX(-5deg) translateY(1px) scale(0.996); }
}

@keyframes homeTitleShine {
  0%, 56% { opacity: 0; transform: translateX(-40%) skewX(-16deg); }
  64% { opacity: 0.72; }
  78%, 100% { opacity: 0; transform: translateX(42%) skewX(-16deg); }
}

@keyframes homeCatalogBreathe {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(1px); }
}

@keyframes homeSwitchBlink {
  0%, 55% { opacity: 1; }
  56%, 100% { opacity: 0.42; }
}

@keyframes homeOrbitSpin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

@keyframes homeSpriteIdle {
  0%, 100% { transform: translateY(0) scale(1); }
  50% { transform: translateY(-6px) scale(1.02); }
}

@keyframes homeSpriteShadow {
  0%, 100% { transform: scaleX(1); opacity: 0.28; }
  50% { transform: scaleX(0.84); opacity: 0.18; }
}

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

@keyframes homeMenuPulse {
  0%, 100% { filter: brightness(1); }
  50% { filter: brightness(1.12); }
}

@media (max-width: 720px), (max-height: 520px) {
  .home-view {
    grid-template-rows: 50% 50%;
  }

  .home-hero {
    padding-top: clamp(8px, 2.8vh, 18px);
  }

  .home-title-card {
    padding-inline: clamp(10px, 3vw, 22px);
  }

  .home-title-art {
    font-size: clamp(32px, 9.2vw, 58px);
  }

  .home-title-kicker {
    font-size: clamp(7px, 1.5vw, 10px);
  }

  .home-catalog-switch {
    min-height: 25px;
    padding: 4px 10px;
    font-size: clamp(10px, 2vw, 13px);
  }

  .home-menu-zone {
    grid-template-columns: 1fr;
    padding-inline: clamp(16px, 8vw, 54px);
  }

  .home-mascot-card {
    position: absolute;
    right: clamp(8px, 4vw, 24px);
    top: -54px;
    width: clamp(82px, 22vw, 120px);
    opacity: 0.52;
  }

  .home-menu-shell {
    justify-self: center;
    width: min(86vw, 312px);
  }
}

@media (max-width: 420px), (max-height: 360px) {
  .home-system-badge {
    display: none;
  }

  .home-title-card::after {
    display: none;
  }

  .home-title-art {
    font-size: clamp(29px, 10vw, 44px);
  }

  .home-title-kicker {
    letter-spacing: 1.6px;
  }

  .home-menu-shell {
    width: min(80vw, 272px);
    min-width: min(78vw, 208px);
    padding: 8px 8px 7px;
  }

  .home-menu-caption {
    display: none;
  }

  .home-menu-list {
    gap: 4px;
  }

  .home-menu-list .menu-item {
    min-height: 30px;
    padding-block: 4px;
    grid-template-columns: 16px minmax(38px, 1fr) auto;
  }

  .home-menu-note {
    display: none;
  }

  .home-menu-label {
    font-size: clamp(14px, 5vw, 18px);
  }
}

@media (max-width: 340px), (max-height: 260px) {
  .home-menu-zone {
    padding-inline: 10px;
    padding-bottom: 8px;
  }

  .home-menu-shell {
    width: min(74vw, 236px);
    min-width: min(70vw, 188px);
    padding: 7px 7px 6px;
    gap: 5px;
  }

  .home-menu-shell::before {
    left: 10px;
    right: 10px;
    top: 6px;
    height: 4px;
    box-shadow: 0 5px 0 rgba(20, 38, 59, 0.1);
  }

  .home-menu-shell::after {
    right: 10px;
    bottom: 6px;
    width: 28px;
    height: 5px;
  }

  .home-menu-list {
    gap: 3px;
  }

  .home-menu-list .menu-item {
    min-height: 26px;
    padding: 3px 7px 3px 6px;
    grid-template-columns: 14px minmax(0, 1fr);
    grid-template-areas: "marker label";
    column-gap: 6px;
    row-gap: 0;
  }

  .home-menu-marker {
    width: 11px;
    height: 11px;
  }

  .home-menu-code {
    display: none;
  }

  .home-menu-label {
    font-size: clamp(12px, 4.2vw, 14px);
  }
}

@media (prefers-reduced-motion: reduce) {
  .home-view::before,
  .home-view::after,
  .home-startup-fx::after,
  .home-grid-plane,
  .home-scan-beam,
  .home-pixel-cloud-a,
  .home-pixel-cloud-b,
  .home-hero,
  .home-menu-zone,
  .home-led,
  .home-title-art,
  .home-title-art::after,
  .home-title-shadow,
  .home-switch-mark,
  .home-orbit-ring,
  .home-mascot-sprite,
  .home-pixel-shadow,
  .home-menu-list .menu-item.active,
  .home-menu-list .menu-item.active::before {
    animation: none !important;
  }

  .home-view::after {
    display: none;
  }
}

.scan-wrap {
  position: relative;
  z-index: 1;
  height: 100%;
  display: grid;
  grid-template-rows: 1fr;
  padding: 8px;
}

#scanView {
  isolation: isolate;
  background:
    linear-gradient(135deg, color-mix(in srgb, var(--blue) 22%, transparent) 0 12px, transparent 12px 28px),
    linear-gradient(45deg, color-mix(in srgb, var(--accent) 18%, transparent) 0 10px, transparent 10px 26px),
    linear-gradient(180deg, color-mix(in srgb, var(--view-bg-top) 88%, #dff5ee) 0%, color-mix(in srgb, var(--view-bg-bottom) 82%, #bdd8d1) 100%);
  background-size: 56px 56px, 64px 64px, 100% 100%;
}

#scanView::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    repeating-linear-gradient(180deg, rgba(255, 255, 255, 0.09) 0 1px, transparent 1px 4px),
    radial-gradient(120% 90% at 50% 50%, transparent 0 56%, rgba(30, 42, 56, 0.28) 100%);
  mix-blend-mode: multiply;
  opacity: 0.58;
  z-index: 0;
}

#scanView::after {
  content: "";
  position: absolute;
  left: -12%;
  right: -12%;
  top: 18%;
  height: 18px;
  pointer-events: none;
  background: linear-gradient(90deg, transparent, rgba(255, 246, 207, 0.72), transparent);
  box-shadow: 0 0 18px rgba(255, 246, 207, 0.45);
  transform: rotate(-5deg);
  animation: scanViewSweep 3.8s steps(14, end) infinite;
  z-index: 0;
}

.camera-box {
  position: relative;
  width: 100%;
  height: 100%;
  border: 3px solid color-mix(in srgb, var(--view-border) 80%, #203044);
  background:
    linear-gradient(var(--grid) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid) 1px, transparent 1px),
    linear-gradient(180deg, #182836 0%, #2f4d5e 100%);
  background-size: 18px 18px, 18px 18px, 100% 100%;
  overflow: hidden;
  box-shadow:
    inset 0 0 0 3px rgba(255, 255, 255, 0.24),
    0 8px 0 rgba(32, 48, 68, 0.26),
    0 18px 28px rgba(32, 48, 68, 0.22);
  clip-path: polygon(10px 0, calc(100% - 10px) 0, 100% 10px, 100% calc(100% - 10px), calc(100% - 10px) 100%, 10px 100%, 0 calc(100% - 10px), 0 10px);
}

.camera-box video { width: 100%; height: 100%; object-fit: cover; }

.camera-box::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(90deg, color-mix(in srgb, var(--accent) 72%, transparent) 0 3px, transparent 3px calc(100% - 3px), color-mix(in srgb, var(--accent) 72%, transparent) calc(100% - 3px)),
    linear-gradient(180deg, color-mix(in srgb, var(--accent) 72%, transparent) 0 3px, transparent 3px calc(100% - 3px), color-mix(in srgb, var(--accent) 72%, transparent) calc(100% - 3px)),
    repeating-linear-gradient(180deg, rgba(255, 255, 255, 0.08) 0 1px, rgba(0, 0, 0, 0.08) 1px 3px, transparent 3px 6px);
  z-index: 3;
  opacity: 0.72;
}

.camera-box::after {
  content: "";
  position: absolute;
  left: 8%;
  right: 8%;
  top: 0;
  height: 2px;
  pointer-events: none;
  background: var(--yellow);
  box-shadow: 0 0 12px color-mix(in srgb, var(--yellow) 72%, transparent);
  animation: cameraBoxSweep 1.6s steps(20, end) infinite;
  z-index: 4;
}

.scan-fx-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 2;
}

.camera-loading-overlay {
  position: absolute;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  background: transparent;
  z-index: 7;
  pointer-events: none;
}

.camera-loading-overlay.visible {
  display: flex;
}

.camera-loading-spinner {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 3px solid color-mix(in srgb, var(--accent) 22%, transparent);
  border-top-color: var(--accent);
  animation: cameraSpin 0.9s steps(12, end) infinite;
  box-shadow: 0 0 10px color-mix(in srgb, var(--accent) 40%, transparent);
}

.camera-box.loading .crosshair {
  opacity: 0;
}

@keyframes cameraSpin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

.crosshair {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 56%;
  max-width: 240px;
  aspect-ratio: 1 / 1;
  transform: translate(-50%, -50%);
  border: 2px solid color-mix(in srgb, var(--accent) 90%, #fff);
  box-shadow:
    0 0 0 2px rgba(255, 255, 255, 0.82),
    0 0 18px color-mix(in srgb, var(--accent) 40%, transparent);
  z-index: 5;
  animation: crosshairPulse 1.1s steps(3, end) infinite;
}

.crosshair::before,
.crosshair::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  background: var(--accent);
}

.crosshair::before { width: 2px; height: 34px; }
.crosshair::after { width: 34px; height: 2px; }

@keyframes scanViewSweep {
  0%, 20% { transform: translateY(-80px) rotate(-5deg); opacity: 0; }
  30% { opacity: 1; }
  100% { transform: translateY(260px) rotate(-5deg); opacity: 0; }
}

@keyframes cameraBoxSweep {
  from { transform: translateY(0); }
  to { transform: translateY(100vh); }
}

@keyframes crosshairPulse {
  0%, 100% { filter: brightness(1); }
  50% { filter: brightness(1.35); }
}

.query-head {
  position: relative;
  z-index: 1;
  padding: 8px 8px 0;
}

#queryView {
  isolation: isolate;
  background:
    radial-gradient(140% 80% at 50% 0%, color-mix(in srgb, var(--yellow) 18%, transparent) 0%, transparent 54%),
    linear-gradient(var(--grid) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid) 1px, transparent 1px),
    linear-gradient(180deg, color-mix(in srgb, var(--view-bg-top) 88%, #e7f7f1) 0%, color-mix(in srgb, var(--view-bg-bottom) 88%, #c9dfd9) 100%);
  background-size: 100% 100%, 18px 18px, 18px 18px, 100% 100%;
}

#queryView::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(135deg, transparent 0 18px, rgba(80, 115, 223, 0.11) 18px 21px, transparent 21px 42px),
    repeating-linear-gradient(180deg, rgba(255, 255, 255, 0.07) 0 1px, transparent 1px 5px);
  background-size: 42px 42px, 100% 100%;
  opacity: 0.8;
}

.chip {
  border: 1px solid var(--tile-border);
  background: color-mix(in srgb, var(--tile-bg-top) 96%, transparent);
  font-size: 12px;
  padding: 6px 8px;
  min-height: 32px;
  display: flex;
  align-items: center;
  box-shadow: inset 0 0 0 1px #f4f4f4;
}

.gen-chip {
  display: grid;
  grid-template-columns: 18px 1fr 18px;
  gap: 6px;
  position: relative;
  background:
    linear-gradient(180deg, var(--accent) 0 6px, color-mix(in srgb, var(--tile-bg-top) 96%, transparent) 6px 100%);
  border: 2px solid color-mix(in srgb, var(--accent-deep) 72%, var(--tile-border));
  box-shadow:
    inset 0 0 0 2px rgba(255, 255, 255, 0.38),
    0 4px 0 rgba(40, 48, 60, 0.16);
  clip-path: polygon(8px 0, calc(100% - 8px) 0, 100% 50%, calc(100% - 8px) 100%, 8px 100%, 0 50%);
}

#queryGenLabel {
  text-align: center;
  font-weight: 700;
  padding-top: 2px;
}

.entity-list {
  position: relative;
  z-index: 1;
  list-style: none;
  margin: 0;
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  max-height: calc(100% - 48px);
  overflow: auto;
}

.entity-row {
  position: relative;
  display: grid;
  grid-template-columns: 34px 1fr;
  gap: 6px;
  align-items: center;
  border: 2px solid color-mix(in srgb, var(--tile-border) 76%, #1f3044);
  background:
    linear-gradient(90deg, rgba(255, 255, 255, 0.38) 0 5px, transparent 5px calc(100% - 5px), rgba(255, 255, 255, 0.28) calc(100% - 5px)),
    linear-gradient(180deg, color-mix(in srgb, var(--tile-bg-top) 97%, transparent), color-mix(in srgb, var(--tile-bg-bottom) 94%, transparent));
  padding: 4px;
  font-size: 12px;
  min-height: 40px;
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.54),
    0 2px 0 rgba(40, 48, 60, 0.1);
  clip-path: polygon(7px 0, calc(100% - 7px) 0, 100% 7px, 100% calc(100% - 7px), calc(100% - 7px) 100%, 7px 100%, 0 calc(100% - 7px), 0 7px);
}

.entity-row.active {
  outline: 2px solid var(--focus);
  background:
    linear-gradient(90deg, color-mix(in srgb, var(--yellow) 42%, transparent) 0 5px, transparent 5px calc(100% - 5px), color-mix(in srgb, var(--yellow) 30%, transparent) calc(100% - 5px)),
    linear-gradient(180deg, color-mix(in srgb, var(--focus-soft) 82%, #fff) 0%, color-mix(in srgb, var(--accent) 16%, var(--tile-bg-bottom)) 100%);
  box-shadow:
    inset 0 0 0 2px rgba(255, 255, 255, 0.62),
    0 0 0 2px color-mix(in srgb, var(--yellow) 68%, transparent),
    0 5px 0 rgba(40, 48, 60, 0.16);
}

.entity-row.active::before {
  content: "";
  position: absolute;
  left: -8px;
  top: 50%;
  transform: translateY(-50%);
  width: 0;
  height: 0;
  border-top: 6px solid transparent;
  border-bottom: 6px solid transparent;
  border-left: 8px solid var(--focus);
  animation: queryCursorTick 620ms steps(2, end) infinite;
}
.entity-row img { width: 30px; height: 30px; image-rendering: pixelated; }

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

.samples-wrap {
  position: relative;
  z-index: 1;
  height: 100%;
  display: grid;
  grid-template-rows: auto 1fr;
}

#samplesView {
  isolation: isolate;
  background:
    linear-gradient(135deg, color-mix(in srgb, var(--blue) 14%, transparent) 0 18px, transparent 18px 36px),
    linear-gradient(var(--grid) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid) 1px, transparent 1px),
    linear-gradient(180deg, color-mix(in srgb, var(--view-bg-top) 92%, #e8f3ff) 0%, color-mix(in srgb, var(--view-bg-bottom) 90%, #d7e6f4) 100%);
  background-size: 72px 72px, 20px 20px, 20px 20px, 100% 100%;
}

#samplesView::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: repeating-linear-gradient(180deg, rgba(255, 255, 255, 0.08) 0 1px, transparent 1px 5px);
  opacity: 0.7;
}

.samples-body {
  min-height: 0;
  display: grid;
  grid-template-columns: 250px 1fr;
  gap: 8px;
  padding: 8px;
}

.samples-species-list {
  max-height: 100%;
  padding: 0;
}

.samples-images-grid {
  border: 2px solid color-mix(in srgb, var(--tile-border) 80%, #223344);
  background:
    linear-gradient(var(--grid) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid) 1px, transparent 1px),
    color-mix(in srgb, var(--tile-bg-top) 96%, transparent);
  background-size: 18px 18px, 18px 18px, 100% 100%;
  padding: 6px;
  overflow: auto;
  min-height: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(72px, 1fr));
  gap: 6px;
  align-content: start;
}

.sample-thumb {
  border: 2px solid color-mix(in srgb, var(--tile-border) 80%, #223344);
  padding: 3px;
  background: color-mix(in srgb, var(--tile-bg-top) 98%, transparent);
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.48),
    0 3px 0 rgba(40, 48, 60, 0.1);
}

.sample-thumb img {
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: contain;
  image-rendering: pixelated;
  display: block;
}

.result-head {
  --thumb-rows: 3;
  --thumb-size: 94px;
  position: relative;
  z-index: 1;
  height: 100%;
  display: grid;
  grid-template-columns: var(--thumb-size) minmax(0, 1fr);
  gap: 8px;
  padding: 0;
  align-items: stretch;
}

#resultView {
  --result-type-a: var(--accent);
  --result-type-b: var(--blue);
  isolation: isolate;
  background:
    radial-gradient(120% 90% at 18% 8%, color-mix(in srgb, var(--result-type-a) 40%, transparent) 0%, transparent 48%),
    radial-gradient(120% 90% at 84% 14%, color-mix(in srgb, var(--result-type-b) 34%, transparent) 0%, transparent 50%),
    linear-gradient(var(--grid) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid) 1px, transparent 1px),
    linear-gradient(180deg, color-mix(in srgb, var(--view-bg-top) 88%, #eef7f2) 0%, color-mix(in srgb, var(--view-bg-bottom) 88%, #cfded8) 100%);
  background-size: 100% 100%, 100% 100%, 20px 20px, 20px 20px, 100% 100%;
}

#resultView::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(135deg, color-mix(in srgb, var(--result-type-a) 18%, transparent) 0 12px, transparent 12px 32px),
    linear-gradient(45deg, color-mix(in srgb, var(--result-type-b) 14%, transparent) 0 10px, transparent 10px 30px),
    repeating-linear-gradient(180deg, rgba(255, 255, 255, 0.08) 0 1px, transparent 1px 5px);
  background-size: 64px 64px, 72px 72px, 100% 100%;
  opacity: 0.92;
}

#resultView::after {
  content: "";
  position: absolute;
  inset: auto -8% 0;
  height: 28%;
  pointer-events: none;
  background:
    linear-gradient(90deg, transparent 0 14%, color-mix(in srgb, var(--result-type-a) 22%, transparent) 14% 16%, transparent 16% 32%, color-mix(in srgb, var(--result-type-b) 18%, transparent) 32% 34%, transparent 34% 100%);
  background-size: 74px 100%;
  opacity: 0.64;
  animation: resultTypeDrift 6s steps(18, end) infinite;
}

.left-stack {
  display: grid;
  grid-template-rows: repeat(var(--thumb-rows), minmax(0, 1fr));
  gap: 8px;
  height: 100%;
  min-height: 0;
}

.thumb-box {
  position: relative;
  border: 2px solid color-mix(in srgb, var(--tile-border) 72%, #213044);
  background:
    radial-gradient(circle at 50% 46%, color-mix(in srgb, var(--result-type-a) 22%, transparent) 0 22%, transparent 23% 100%),
    linear-gradient(var(--grid) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid) 1px, transparent 1px),
    linear-gradient(180deg, color-mix(in srgb, var(--tile-bg-top) 92%, #fff) 0%, color-mix(in srgb, var(--tile-bg-bottom) 90%, var(--result-type-b)) 100%);
  background-size: 100% 100%, 18px 18px, 18px 18px, 100% 100%;
  display: grid;
  place-items: center;
  overflow: hidden;
  min-height: 0;
  box-shadow:
    inset 0 0 0 2px rgba(255, 255, 255, 0.44),
    0 4px 0 rgba(40, 48, 60, 0.12);
}

.thumb-box img {
  width: 100%;
  height: 100%;
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  image-rendering: pixelated;
  display: block;
  filter: drop-shadow(4px 6px 0 color-mix(in srgb, var(--result-type-b) 28%, transparent));
}

.shiny-badge {
  position: absolute;
  right: 6px;
  top: 6px;
  width: 20px !important;
  height: 20px !important;
  object-fit: contain;
  image-rendering: auto;
  z-index: 2;
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.65));
  pointer-events: none;
}

.right-main {
  min-width: 0;
  height: 100%;
  min-height: 0;
  display: grid;
  grid-template-rows: auto auto 1fr;
  gap: 6px;
}

.title-row {
  position: relative;
  display: grid;
  grid-template-columns: 18px 1fr 18px;
  gap: 6px;
  align-items: center;
  font-size: 12px;
  min-height: 24px;
  border: 2px solid color-mix(in srgb, var(--result-type-a) 52%, var(--view-border));
  background:
    linear-gradient(90deg, color-mix(in srgb, var(--result-type-a) 14%, transparent) 0 6px, transparent 6px calc(100% - 6px), color-mix(in srgb, var(--result-type-b) 14%, transparent) calc(100% - 6px)),
    color-mix(in srgb, var(--tile-bg-top) 96%, transparent);
  padding: 7px 6px 3px;
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.54),
    0 3px 0 rgba(40, 48, 60, 0.12);
}

.title-row::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  height: 6px;
  background: linear-gradient(90deg, var(--result-type-a) 0%, var(--result-type-b) 100%);
  border-bottom: 1px solid color-mix(in srgb, var(--result-type-a) 66%, #000);
}

.species-title {
  font-size: 14px;
  font-weight: 700;
  overflow: hidden;
  text-overflow: ellipsis;
  text-align: center;
  position: relative;
  z-index: 1;
}

.species-title-main {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  display: block;
  padding: 0 2px;
}

.species-title-main.active {
  color: color-mix(in srgb, var(--focus) 76%, var(--accent-deep));
  text-shadow: 0 0 10px color-mix(in srgb, var(--focus) 24%, transparent);
}

.title-row.picker-active {
  border-color: var(--focus);
  box-shadow:
    inset 0 0 0 2px color-mix(in srgb, var(--focus) 28%, transparent),
    0 0 0 2px color-mix(in srgb, var(--result-type-a) 26%, transparent);
}

.switch-mark {
  text-align: center;
  color: var(--blue-deep);
  font-weight: 700;
  position: relative;
  z-index: 1;
}

.title-row.picker-active .switch-mark {
  color: var(--focus);
}

.switch-mark.vertical {
  font-size: 11px;
  line-height: 1;
}

.title-row.focused {
  border-color: var(--focus);
  box-shadow:
    inset 0 0 0 2px color-mix(in srgb, var(--yellow) 44%, transparent),
    0 0 0 2px color-mix(in srgb, var(--result-type-a) 45%, transparent);
}

.tab-bar {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 4px;
}

.tab-btn {
  border: 2px solid color-mix(in srgb, var(--view-border) 82%, #203044);
  background: linear-gradient(180deg, color-mix(in srgb, var(--tab-idle-top) 96%, transparent) 0%, color-mix(in srgb, var(--tab-idle-bottom) 94%, transparent) 100%);
  font-size: 12px;
  padding: 2px 2px;
  text-align: center;
  color: var(--ink-soft);
}

.tab-btn.active {
  outline: none;
  border-color: color-mix(in srgb, var(--result-type-a) 72%, #203044);
  background: linear-gradient(180deg, color-mix(in srgb, var(--result-type-a) 88%, #fff) 0%, color-mix(in srgb, var(--result-type-b) 76%, #203044) 100%);
  color: #fff;
  text-shadow: 1px 1px 0 rgba(0, 0, 0, 0.32);
}

.tab-btn.focused {
  box-shadow: inset 0 0 0 2px var(--blue);
}

.tab-content {
  position: relative;
  border: 2px solid color-mix(in srgb, var(--result-type-a) 46%, var(--view-border));
  background:
    linear-gradient(135deg, color-mix(in srgb, var(--result-type-a) 10%, transparent) 0 10px, transparent 10px 26px),
    linear-gradient(var(--grid) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid) 1px, transparent 1px),
    linear-gradient(180deg, color-mix(in srgb, var(--tile-bg-top) 96%, transparent) 0%, color-mix(in srgb, var(--view-bg-bottom) 94%, transparent) 100%);
  background-size: 52px 52px, 20px 20px, 20px 20px, 100% 100%;
  color: var(--ink);
  font-size: 12px;
  line-height: 1.35;
  padding: 6px;
  overflow: auto;
  min-height: 0;
  box-shadow:
    inset 0 0 0 2px rgba(255, 255, 255, 0.42),
    0 5px 0 rgba(40, 48, 60, 0.1);
}

.from-query #cameraThumbBox {
  display: none;
}

.from-query .left-stack {
  --thumb-rows: 2;
}

.line-item {
  position: relative;
  border: 1px solid transparent;
  border-bottom-color: color-mix(in srgb, var(--line) 82%, var(--result-type-a));
  padding: 4px 2px;
  background: color-mix(in srgb, var(--tile-bg-top) 78%, transparent);
}

.line-item.active {
  background:
    linear-gradient(90deg, color-mix(in srgb, var(--result-type-a) 18%, transparent) 0 6px, transparent 6px),
    color-mix(in srgb, var(--focus-soft) 86%, transparent);
  border-color: color-mix(in srgb, var(--result-type-a) 66%, var(--focus));
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.6),
    0 0 0 1px color-mix(in srgb, var(--result-type-b) 35%, transparent);
}

.line-title {
  color: color-mix(in srgb, var(--result-type-a) 72%, var(--accent-deep));
  font-weight: 700;
}

.encounter-location-section {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin: 0 0 6px;
  padding: 4px 8px;
  border-radius: 10px;
  background: linear-gradient(
    180deg,
    color-mix(in srgb, var(--result-type-a) 16%, var(--tile-bg-top)) 0%,
    color-mix(in srgb, var(--result-type-b) 12%, var(--view-bg-bottom)) 100%
  );
  color: color-mix(in srgb, var(--result-type-a) 80%, var(--accent-deep));
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.02em;
}

.encounter-location-section > span:first-child {
  min-width: 0;
}

.encounter-location-section .version-tags {
  flex-shrink: 0;
}

.encounter-subgroup-section {
  margin: 0 0 5px;
  padding: 2px 8px;
  border-left: 3px solid color-mix(in srgb, var(--result-type-a) 56%, var(--line));
  color: color-mix(in srgb, var(--result-type-a) 78%, var(--ink));
  font-size: 11px;
  font-weight: 700;
}

.encounter-group-item {
  margin: 0 0 1px;
  border-left: 1px solid color-mix(in srgb, var(--result-type-a) 44%, var(--line));
  border-right: 1px solid color-mix(in srgb, var(--result-type-a) 44%, var(--line));
  border-bottom-color: color-mix(in srgb, var(--line) 70%, var(--result-type-a));
  background:
    linear-gradient(
      180deg,
      color-mix(in srgb, var(--tile-bg-top) 88%, #fff) 0%,
      color-mix(in srgb, var(--view-bg-bottom) 88%, var(--result-type-a)) 100%
    );
}

.encounter-group-start {
  margin-top: 8px;
  border-top: 1px solid color-mix(in srgb, var(--result-type-a) 44%, var(--line));
  border-top-left-radius: 12px;
  border-top-right-radius: 12px;
}

.encounter-group-end {
  margin-bottom: 10px;
  border-bottom-left-radius: 12px;
  border-bottom-right-radius: 12px;
}

.encounter-subgroup-end {
  margin-bottom: 6px;
}

.encounter-summary-row .line-title {
  margin-bottom: 4px;
}

.encounter-times-header,
.encounter-times-row {
  display: grid;
  gap: 2px;
  align-items: stretch;
}

.encounter-times-header-compact-columns,
.encounter-times-row-compact-columns {
  gap: 0;
}

.encounter-times-header-compact-columns > span + span,
.encounter-times-row-compact-columns > span + span {
  margin-left: -1px;
}

.encounter-times-header-compact-columns > span:first-child,
.encounter-times-row-compact-columns > span:first-child {
  border-top-left-radius: 6px;
  border-bottom-left-radius: 6px;
}

.encounter-times-header-compact-columns > span:last-child,
.encounter-times-row-compact-columns > span:last-child {
  border-top-right-radius: 6px;
  border-bottom-right-radius: 6px;
}

.encounter-times-header {
  margin-top: 2px;
}

.encounter-times-header > span,
.encounter-times-row > span {
  padding: 3px 4px;
  border-radius: 6px;
  background: color-mix(in srgb, var(--tile-bg-top) 94%, #fff);
  border: 1px solid color-mix(in srgb, var(--line) 76%, var(--result-type-a));
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}

.encounter-times-header-compact-columns > span,
.encounter-times-row-compact-columns > span {
  padding: 0;
  border-radius: 0;
}

.encounter-times-header-compact-columns > span:not(.encounter-times-label),
.encounter-times-row-compact-columns > span:not(.encounter-times-label) {
  display: flex;
  align-items: center;
  justify-content: center;
  white-space: normal;
  word-break: break-all;
  overflow-wrap: anywhere;
  text-overflow: clip;
  text-align: center;
}

.encounter-times-header > span {
  color: color-mix(in srgb, var(--result-type-a) 78%, var(--accent-deep));
  font-size: 10px;
  font-weight: 800;
  text-align: center;
  line-height: 1.15;
}

.encounter-time-icon {
  width: 22px;
  height: 16px;
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  vertical-align: middle;
}

.encounter-times-header-compact-columns .encounter-time-icon {
  width: 1.1em;
  height: 1.1em;
}

.encounter-time-fallback {
  display: inline-block;
  line-height: 1.1;
}

.encounter-weather-header-icons {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 2px;
}

.encounter-weather-header-icons .encounter-time-icon {
  width: 14px;
  height: 14px;
}

.encounter-times-header-compact-columns .encounter-weather-header-icons {
  gap: 1px;
}

.encounter-times-header-compact-columns .encounter-weather-header-icons .encounter-time-icon {
  width: 0.7em;
  height: 0.7em;
}

.encounter-times-row > span {
  color: color-mix(in srgb, var(--ink) 90%, var(--accent-deep));
  font-size: 10px;
  line-height: 1.25;
  text-align: center;
}

.encounter-times-label {
  font-weight: 800;
  text-align: left;
}

.encounter-times-header > .encounter-times-label {
  white-space: nowrap;
  word-break: normal;
  overflow-wrap: normal;
  text-overflow: ellipsis;
}

.encounter-times-row > .encounter-times-label {
  white-space: normal;
  word-break: break-word;
  overflow-wrap: anywhere;
  text-overflow: clip;
  line-height: 1.25;
}

.encounter-inline-level {
  font-weight: 700;
  color: color-mix(in srgb, var(--muted) 72%, var(--ink));
}

.encounter-line-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-width: 0;
}

.encounter-method-name {
  min-width: 0;
  color: color-mix(in srgb, var(--result-type-a) 82%, var(--accent-deep));
  font-weight: 800;
  letter-spacing: 0.01em;
}

.encounter-chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 4px;
}

.encounter-chip {
  display: inline-flex;
  align-items: center;
  min-height: 18px;
  padding: 0 6px;
  border: 1px solid color-mix(in srgb, var(--result-type-a) 38%, var(--line));
  border-radius: 999px;
  background: color-mix(in srgb, var(--tile-bg-top) 92%, #fff);
  color: color-mix(in srgb, var(--result-type-a) 76%, var(--ink));
  font-size: 10px;
  font-weight: 700;
  line-height: 1;
}

.encounter-chip.muted {
  background: color-mix(in srgb, var(--view-bg-bottom) 88%, #fff);
  color: color-mix(in srgb, var(--muted) 80%, var(--ink));
}

.encounter-breakdown {
  display: grid;
  gap: 4px;
}

.encounter-metric-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
}

.encounter-metric {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 6px;
  padding: 4px 6px;
  border: 1px solid color-mix(in srgb, var(--line) 76%, var(--result-type-a));
  border-radius: 8px;
  background: color-mix(in srgb, var(--tile-bg-top) 94%, #fff);
}

.encounter-metric-label {
  color: color-mix(in srgb, var(--muted) 70%, var(--ink));
  font-size: 10px;
  font-weight: 700;
}

.encounter-metric strong {
  color: color-mix(in srgb, var(--result-type-a) 82%, var(--accent-deep));
  font-size: 12px;
}

.line-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  min-width: 0;
}

.line-head > span:first-child {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.version-tags {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 3px;
  flex: 0 0 auto;
}

.version-tags.compact {
  gap: 2px;
}

.version-tag {
  display: inline-flex;
  align-items: center;
  min-height: 16px;
  padding: 0 4px;
  border: 1px solid color-mix(in srgb, var(--result-type-a) 48%, var(--line));
  border-radius: 999px;
  background: linear-gradient(
    180deg,
    color-mix(in srgb, var(--tile-bg-top) 94%, #fff) 0%,
    color-mix(in srgb, var(--view-bg-bottom) 90%, var(--result-type-a)) 100%
  );
  color: color-mix(in srgb, var(--result-type-a) 82%, var(--ink));
  font-size: 10px;
  line-height: 1;
  font-weight: 700;
  white-space: nowrap;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.55);
}

.move-line-head {
  display: flex;
  align-items: center;
  gap: 5px;
  min-width: 0;
}

.move-source {
  flex: 0 0 42px;
  color: var(--ink-soft);
  font-size: 11px;
  font-weight: 700;
}

.move-name {
  flex: 1 1 auto;
  min-width: 0;
  color: color-mix(in srgb, var(--result-type-a) 72%, var(--accent-deep));
  font-weight: 800;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.move-line-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
  margin-top: 2px;
  padding-left: 47px;
}

.move-line-stat {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 4px;
  min-width: 0;
  color: var(--ink-soft);
  font-size: 11px;
  white-space: nowrap;
}

.move-line-stat-label {
  min-width: 0;
  flex: 0 0 auto;
}

.move-line-stat-value {
  min-width: 12px;
  flex: 0 0 auto;
  text-align: right;
  color: var(--ink);
  font-weight: 700;
}

.evo-title {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.evo-mon {
  display: inline-flex;
  align-items: center;
  gap: 3px;
}

.evo-title img {
  width: 20px;
  height: 20px;
  image-rendering: pixelated;
  flex: 0 0 auto;
}

.evo-arrow {
  color: var(--ink-soft);
}

@media (max-width: 420px) {
  .evo-line-head {
    flex-direction: column-reverse;
    align-items: flex-start;
    gap: 3px;
  }

  .evo-line-head > span:first-child {
    overflow: visible;
    text-overflow: clip;
    white-space: normal;
  }

  .evo-line-head .evo-title {
    flex-wrap: wrap;
  }

  .evo-line-head .version-tags {
    width: 100%;
    justify-content: flex-start;
  }
}

.muted {
  color: var(--ink-soft);
  font-size: 11px;
  margin-top: 6px;
}

.move-detail {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.profile-detail {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.forms-title {
  margin-top: 4px;
}

.variant-summary {
  width: 68px;
}

.variant-summary-text {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}

.variant-summary-text > span:first-child {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.forms-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 4px;
}

.form-mon.active {
  outline: 2px solid var(--focus);
  background: var(--focus-soft);
}

.variant-summary.active {
  outline: 2px solid var(--focus);
  background: var(--focus-soft);
}

.variant-overlay {
  position: absolute;
  inset: 0;
  background: var(--overlay);
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 10px 8px 8px;
  overflow: hidden;
}

.variant-dialog {
  width: 100%;
  max-width: 100%;
  max-height: 100%;
  overflow: auto;
  border: 2px solid var(--view-border);
  background:
    linear-gradient(var(--grid) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid) 1px, transparent 1px),
    linear-gradient(180deg, var(--tile-bg-top) 0%, var(--view-bg-bottom) 100%);
  background-size: 24px 24px, 24px 24px, 100% 100%;
  padding: 8px;
  overscroll-behavior: contain;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.18);
}

.variant-dialog-title {
  margin-bottom: 6px;
}

.eff-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 4px;
}

.eff-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border: 1px solid var(--line);
  padding: 2px 4px;
  background: color-mix(in srgb, var(--tile-bg-top) 92%, transparent);
}

.target-diagram {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.target-summary {
  color: color-mix(in srgb, var(--ink) 92%, var(--result-type-a));
}

.target-diagram-wrap {
  display: flex;
  flex-direction: column;
  gap: 5px;
  margin-top: 3px;
  padding: 6px;
  border: 1px solid color-mix(in srgb, var(--result-type-a) 48%, var(--line));
  background:
    linear-gradient(180deg, color-mix(in srgb, var(--tile-bg-top) 96%, #fff) 0%, color-mix(in srgb, var(--view-bg-bottom) 92%, var(--result-type-a)) 100%);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.55),
    inset 0 0 0 1px rgba(0, 0, 0, 0.04);
}

.target-diagram-row {
  display: grid;
  gap: 4px;
}

.target-diagram-double .target-diagram-row {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.target-diagram-triple .target-diagram-row {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.target-diagram-cell {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 26px;
  padding: 3px 4px;
  border: 1px solid color-mix(in srgb, var(--line) 84%, var(--result-type-a));
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.78) 0%, color-mix(in srgb, var(--tile-bg-top) 88%, #d9dde3) 100%);
  color: color-mix(in srgb, var(--ink-soft) 92%, var(--result-type-a));
  font-size: 11px;
  font-weight: 700;
  text-align: center;
  letter-spacing: 0.02em;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.55);
}

.target-diagram-cell.is-active {
  background:
    linear-gradient(180deg, #f17c7c 0%, #cd4343 100%);
  border-color: #922929;
  color: #fff7f7;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.32),
    0 0 0 1px rgba(111, 22, 22, 0.12);
}

.move-summary-line {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-width: 0;
}

.move-summary-name {
  min-width: 0;
  color: var(--ink);
}

.move-summary-badges {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 4px;
  flex: 0 0 auto;
  flex-wrap: wrap;
}

.move-stats-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 5px;
}

.move-stat-card {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 4px 5px;
  border: 1px solid color-mix(in srgb, var(--line) 84%, var(--result-type-a));
  background:
    linear-gradient(180deg, color-mix(in srgb, var(--tile-bg-top) 96%, #fff) 0%, color-mix(in srgb, var(--view-bg-bottom) 92%, var(--result-type-a)) 100%);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.55),
    inset 0 0 0 1px rgba(0, 0, 0, 0.04);
}

.move-stat-label {
  color: color-mix(in srgb, var(--result-type-a) 72%, var(--accent-deep));
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.04em;
}

.move-stat-value {
  display: block;
  min-height: 16px;
  color: var(--ink);
  font-size: 14px;
  line-height: 1.1;
}

.move-effect-detail {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.effect-primary-card {
  padding: 6px 7px;
  border: 1px solid color-mix(in srgb, var(--line) 84%, var(--result-type-a));
  background:
    linear-gradient(180deg, color-mix(in srgb, var(--tile-bg-top) 97%, #fff) 0%, color-mix(in srgb, var(--view-bg-bottom) 93%, var(--result-type-a)) 100%);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.55),
    inset 0 0 0 1px rgba(0, 0, 0, 0.04);
}

.effect-mechanic-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.effect-mechanic-item {
  padding: 6px 7px;
  border: 1px solid var(--line);
  background: color-mix(in srgb, var(--tile-bg-top) 93%, transparent);
  line-height: 1.45;
}

.base-stats-block {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.base-stat-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
}

.base-stat-name {
  font-size: 11px;
  min-width: 30px;
  color: color-mix(in srgb, var(--ink) 88%, var(--ink-soft));
  font-weight: 700;
}

.base-stat-value {
  font-size: 11px;
  min-width: 28px;
  text-align: right;
  font-weight: 700;
  color: var(--ink);
}

.base-stat-track {
  flex: 1;
  height: 8px;
  border-radius: 999px;
  border: 1px solid color-mix(in srgb, var(--line) 80%, #000);
  background: linear-gradient(180deg, color-mix(in srgb, var(--tile-bg-top) 82%, #fff) 0%, color-mix(in srgb, var(--tile-bg-bottom) 90%, #c9c9c9) 100%);
  overflow: hidden;
}

.base-stat-fill {
  height: 100%;
  border-radius: 999px;
  box-shadow: inset 0 -1px 0 rgba(0, 0, 0, 0.16), inset 0 1px 0 rgba(255, 255, 255, 0.35);
}

.base-stat-fill.tone-hp {
  background: linear-gradient(90deg, #66d68f 0%, #2faa62 100%);
}

.base-stat-fill.tone-atk {
  background: linear-gradient(90deg, #ffb347 0%, #f07a21 100%);
}

.base-stat-fill.tone-def {
  background: linear-gradient(90deg, #c28a64 0%, #8b5a3c 100%);
}

.base-stat-fill.tone-spa {
  background: linear-gradient(90deg, #78c8ff 0%, #2f97e2 100%);
}

.base-stat-fill.tone-spd {
  background: linear-gradient(90deg, #4b7fe0 0%, #214fba 100%);
}

.base-stat-fill.tone-spe {
  background: linear-gradient(90deg, #b382ff 0%, #7b46d2 100%);
}

.base-stat-row.total .base-stat-name,
.base-stat-row.total .base-stat-value {
  font-weight: 700;
}

.base-stat-fill.tone-total {
  background: linear-gradient(90deg, #67b4d9 0%, #2f7db1 100%);
}

.type-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  flex: 0 0 auto;
  border: 1px solid rgba(0, 0, 0, 0.25);
  padding: 1px 4px;
  font-size: 11px;
  color: #fff;
  border-radius: 3px;
  font-weight: 700;
  text-shadow: 0 1px 0 rgba(0, 0, 0, 0.35);
  white-space: nowrap;
}
.type-icon {
  width: 12px;
  height: 12px;
  object-fit: contain;
  image-rendering: auto;
}
.move-class-chip {
  min-width: 44px;
  justify-content: center;
}

.move-line-head .type-chip {
  min-width: 44px;
  justify-content: center;
}
.move-class-icon {
  width: 14px;
  height: 14px;
  object-fit: contain;
  image-rendering: pixelated;
}
.type-normal { background: #777777; }
.type-fire { background: #ff612c; }
.type-water { background: #2992ff; }
.type-electric { background: #ffdb00; color: #3d3500; text-shadow: none; }
.type-grass { background: #42bf24; }
.type-ice { background: #42d8ff; color: #103536; text-shadow: none; }
.type-fighting { background: #ffa202; }
.type-poison { background: #994dcf; }
.type-ground { background: #ab7939; }
.type-flying { background: #95c9ff; color: #23303b; text-shadow: none; }
.type-psychic { background: #ff637f; }
.type-bug { background: #9fa424; }
.type-rock { background: #bcb889; color: #23303b; text-shadow: none; }
.type-ghost { background: #6e4570; }
.type-dragon { background: #5462d6; }
.type-dark { background: #4f4747; }
.type-steel { background: #6aaed3; color: #23303b; text-shadow: none; }
.type-fairy { background: #ffb1ff; color: #4d2242; text-shadow: none; }
.move-class-physical { background: #e74f24; }
.move-class-special { background: #466bd8; }
.move-class-status { background: #8a8f98; }
.move-class-unknown { background: #777777; }

@keyframes resultTypeDrift {
  from { background-position: 0 0; }
  to { background-position: 74px 0; }
}

.learners-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 4px;
}

.mini-mon {
  position: relative;
  overflow: visible;
  border: 1px solid var(--line);
  background: color-mix(in srgb, var(--tile-bg-top) 94%, transparent);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1px;
  padding: 2px;
  box-sizing: border-box;
}

.mini-mon img {
  width: 26px;
  height: 26px;
  image-rendering: pixelated;
}

.mini-mon span {
  font-size: 10px;
  color: var(--ink);
}

.thumb-selecting .mini-mon {
  opacity: 0.38;
}

.thumb-selecting .mini-mon.active {
  opacity: 1;
  border: 4px solid var(--focus);
  background: var(--focus-soft);
  box-shadow:
    inset 0 0 0 2px rgba(255, 255, 255, 0.9),
    0 0 0 2px rgba(0, 0, 0, 0.35);
  transform: scale(1.1);
  z-index: 2;
}

.thumb-selecting .mini-mon.active img {
  filter: brightness(1.12) saturate(1.12);
}

.thumb-selecting .mini-mon.active span {
  color: var(--ink);
  font-weight: 700;
}

.tab-content::-webkit-scrollbar,
.variant-dialog::-webkit-scrollbar,
.entity-list::-webkit-scrollbar {
  width: 10px;
}

.tab-content::-webkit-scrollbar-track,
.variant-dialog::-webkit-scrollbar-track,
.entity-list::-webkit-scrollbar-track {
  background: var(--scroll-track);
  border-left: 1px solid var(--line);
}

.tab-content::-webkit-scrollbar-thumb,
.variant-dialog::-webkit-scrollbar-thumb,
.entity-list::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, var(--scroll-thumb-top) 0%, var(--scroll-thumb-bottom) 100%);
  border: 1px solid var(--scroll-thumb-border);
}

.settings-wrap {
  position: relative;
  z-index: 1;
  height: 100%;
  display: grid;
  grid-template-rows: auto 1fr;
  gap: 6px;
  padding: 8px;
}

#settingsView {
  isolation: isolate;
  background:
    radial-gradient(130% 80% at 50% 0%, color-mix(in srgb, var(--yellow) 18%, transparent) 0%, transparent 58%),
    linear-gradient(135deg, color-mix(in srgb, var(--accent) 12%, transparent) 0 14px, transparent 14px 34px),
    linear-gradient(var(--grid) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid) 1px, transparent 1px),
    linear-gradient(180deg, color-mix(in srgb, var(--view-bg-top) 90%, #f7f1dd) 0%, color-mix(in srgb, var(--view-bg-bottom) 88%, #ded7c2) 100%);
  background-size: 100% 100%, 68px 68px, 20px 20px, 20px 20px, 100% 100%;
}

#settingsView::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: repeating-linear-gradient(180deg, rgba(255, 255, 255, 0.08) 0 1px, transparent 1px 5px);
  opacity: 0.68;
}

#settingsView .menu-title {
  position: relative;
  z-index: 1;
  border-bottom: 3px solid var(--header-border);
  box-shadow: 0 4px 0 rgba(40, 48, 60, 0.14);
}

.settings-section-title {
  color: var(--accent-deep);
  font-size: 12px;
  font-weight: 700;
}

.settings-section-row {
  list-style: none;
  margin-top: 2px;
  padding: 2px 0 0;
}

.theme-preview {
  display: grid;
  grid-template-columns: 8px 1fr auto;
  gap: 8px;
  align-items: center;
  border: 2px solid color-mix(in srgb, var(--tile-border) 78%, #223344);
  background:
    linear-gradient(90deg, rgba(255, 255, 255, 0.38) 0 5px, transparent 5px calc(100% - 5px), rgba(255, 255, 255, 0.24) calc(100% - 5px)),
    linear-gradient(180deg, color-mix(in srgb, var(--tile-bg-top) 96%, transparent), color-mix(in srgb, var(--tile-bg-bottom) 92%, transparent));
  padding: 6px;
  min-height: 48px;
  box-shadow:
    inset 0 0 0 2px rgba(255, 255, 255, 0.42),
    0 4px 0 rgba(40, 48, 60, 0.12);
}

.theme-preview-bar {
  align-self: stretch;
  background: linear-gradient(180deg, var(--header-top) 0%, var(--header-bottom) 100%);
  box-shadow: 0 0 10px color-mix(in srgb, var(--accent) 36%, transparent);
  animation: settingsSignal 1.6s steps(3, end) infinite;
}

.theme-preview-name {
  font-size: 12px;
  font-weight: 700;
}

.theme-preview-note {
  font-size: 10px;
  color: var(--ink-soft);
}

.theme-preview-swatches {
  display: flex;
  gap: 3px;
}

.theme-preview-swatches span {
  width: 10px;
  height: 10px;
  border: 1px solid rgba(0, 0, 0, 0.18);
}

.theme-menu {
  list-style: none;
  margin: 0;
  padding: 0;
  overflow: auto;
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.theme-item {
  position: relative;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  align-items: center;
  border: 2px solid color-mix(in srgb, var(--tile-border) 78%, #223344);
  background:
    linear-gradient(90deg, rgba(255, 255, 255, 0.38) 0 5px, transparent 5px calc(100% - 5px), rgba(255, 255, 255, 0.24) calc(100% - 5px)),
    linear-gradient(180deg, color-mix(in srgb, var(--tile-bg-top) 97%, transparent), color-mix(in srgb, var(--tile-bg-bottom) 92%, transparent));
  padding: 6px;
  min-height: 42px;
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.54),
    0 2px 0 rgba(40, 48, 60, 0.1);
}

.theme-item.active {
  outline: 2px solid var(--focus);
  background:
    linear-gradient(90deg, color-mix(in srgb, var(--yellow) 36%, transparent) 0 5px, transparent 5px calc(100% - 5px), color-mix(in srgb, var(--yellow) 24%, transparent) calc(100% - 5px)),
    linear-gradient(180deg, color-mix(in srgb, var(--focus-soft) 84%, #fff), color-mix(in srgb, var(--accent) 12%, var(--tile-bg-bottom)));
  box-shadow:
    inset 0 0 0 2px rgba(255, 255, 255, 0.58),
    0 0 0 2px color-mix(in srgb, var(--yellow) 56%, transparent),
    0 5px 0 rgba(40, 48, 60, 0.14);
}

.theme-item.active::before {
  content: "";
  position: absolute;
  left: -8px;
  top: 50%;
  transform: translateY(-50%);
  width: 0;
  height: 0;
  border-top: 6px solid transparent;
  border-bottom: 6px solid transparent;
  border-left: 8px solid var(--focus);
  animation: queryCursorTick 620ms steps(2, end) infinite;
}

.theme-item.selected .theme-item-name::after {
  content: " ●";
  color: var(--accent);
}

.theme-item-main {
  min-width: 0;
}

.theme-item-name {
  display: block;
  font-size: 12px;
  font-weight: 700;
}

.theme-item-note,
.theme-item-mark {
  font-size: 10px;
  color: var(--ink-soft);
}

@keyframes settingsSignal {
  0%, 100% { filter: brightness(1); }
  50% { filter: brightness(1.35); }
}

@media (max-width: 340px), (max-height: 260px) {
  .scan-wrap {
    padding: 4px;
  }

  .query-head {
    padding: 5px 5px 0;
  }

  .entity-list {
    padding: 5px;
    gap: 3px;
    max-height: calc(100% - 38px);
  }

  .entity-row {
    min-height: 32px;
    grid-template-columns: 28px 1fr;
    font-size: 11px;
  }

  .entity-row img {
    width: 24px;
    height: 24px;
  }

  .samples-body {
    grid-template-columns: 1fr;
    gap: 5px;
    padding: 5px;
  }

  .samples-species-list {
    max-height: 72px;
  }

  .settings-wrap {
    padding: 5px;
    gap: 4px;
  }

  .theme-preview {
    min-height: 34px;
    padding: 4px;
    grid-template-columns: 6px 1fr auto;
  }

  .theme-preview-note {
    display: none;
  }

  .theme-menu {
    gap: 3px;
  }

  .theme-item {
    min-height: 32px;
    padding: 4px;
  }

  .theme-item-note {
    display: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  #scanView::after,
  .camera-box::after,
  .crosshair,
  .entity-row.active::before,
  .theme-preview-bar,
  .theme-item.active::before,
  #resultView::after {
    animation: none !important;
  }
}

.hint-chip {
  display: inline-flex;
  flex-direction: row;
  justify-content: flex-start;
  align-items: center;
  gap: 4px;
  min-width: 0;
  padding: 1px 5px;
  border: 1px solid var(--tile-border);
  background:
    linear-gradient(180deg, color-mix(in srgb, var(--tile-bg-top) 96%, transparent) 0%, color-mix(in srgb, var(--tile-bg-bottom) 94%, transparent) 100%);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.48);
  white-space: nowrap;
  font-size: 9px;
  color: var(--ink);
  flex: 0 0 auto;
}

.hint-key {
  display: inline-flex;
  min-width: 16px;
  justify-content: center;
  align-items: center;
  padding: 0 2px;
  height: 12px;
  border: 1px solid var(--view-border);
  background: linear-gradient(180deg, var(--header-top) 0%, var(--header-bottom) 100%);
  color: #fff;
  font-size: 8px;
  font-weight: 700;
  letter-spacing: 0.2px;
}

.hint-label {
  font-size: 9px;
  line-height: 1.1;
  color: color-mix(in srgb, var(--ink) 84%, var(--ink-soft));
}

.hint-empty {
  font-size: 10px;
  color: var(--ink-soft);
}

.search-overlay {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 90;
  background: color-mix(in srgb, var(--overlay) 84%, transparent);
  border-top: 2px solid var(--view-border);
  backdrop-filter: blur(3px);
}

.search-panel {
  height: auto;
  max-height: 100%;
  padding: 8px;
  display: grid;
  grid-template-rows: auto auto;
  align-content: start;
  gap: 6px;
  background: linear-gradient(180deg, color-mix(in srgb, var(--view-bg-top) 96%, transparent), color-mix(in srgb, var(--view-bg-bottom) 96%, transparent));
}

.search-input {
  border: 1px solid var(--tile-border);
  background: color-mix(in srgb, var(--tile-bg-top) 96%, transparent);
  min-height: 24px;
  padding: 4px 6px;
  font-size: 12px;
  color: var(--ink);
  box-shadow: inset 0 0 0 1px #f5f5f5;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.search-input.placeholder {
  color: var(--ink-soft);
}

.search-keyboard {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  grid-auto-rows: auto;
  gap: 4px;
  align-content: start;
  justify-content: stretch;
  height: auto;
  min-height: 0;
}

.search-key {
  border: 1px solid var(--tile-border);
  background: linear-gradient(180deg, var(--tile-bg-top), var(--tile-bg-bottom));
  color: var(--ink);
  font-size: 11px;
  font-weight: 700;
  min-height: 20px;
  padding: 2px 0;
}

.search-key.special {
  background: linear-gradient(180deg, var(--tab-idle-top), var(--tab-idle-bottom));
  color: var(--ink-soft);
}

.search-key.submit {
  background: linear-gradient(180deg, var(--header-top), var(--header-bottom));
  border-color: var(--header-border);
  color: #fff;
}

.search-key.active {
  border-color: var(--focus);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--focus) 52%, white 48%);
}

@media (max-width: 420px), (max-height: 420px) {
  .search-overlay {
    left: 0;
    right: 0;
    bottom: 0;
  }

  .search-panel {
    padding: 5px;
    gap: 4px;
    grid-template-rows: auto auto;
  }

  .search-input {
    min-height: 20px;
    padding: 2px 5px;
    font-size: 11px;
  }

  .search-keyboard {
    gap: 3px;
    min-height: 0;
  }

  .search-key {
    font-size: 10px;
    min-height: 14px;
    padding: 1px 0;
  }
}

@media (max-width: 340px), (max-height: 260px) {
  .search-overlay {
    left: 0;
    right: 0;
    bottom: 0;
    border-top-width: 1px;
  }

  .search-panel {
    padding: 3px;
    gap: 2px;
    grid-template-rows: auto auto;
  }

  .search-input {
    min-height: 16px;
    padding: 1px 4px;
    font-size: 9px;
  }

  .search-keyboard {
    gap: 2px;
    min-height: 0;
  }

  .search-key {
    min-height: 11px;
    padding: 0;
    font-size: 8px;
  }
}

@media (max-width: 600px) {
  .device { width: 100%; }
}
