:root {
  --bg-1: #f4edd8;
  --bg-2: #d6c8a6;
  --ink: #213126;
  --ink-soft: #435646;
  --line: #304437;
  --panel: #f8f3e5;
  --panel-alt: #ebe1c8;
  --panel-deep: #d7c7a0;
  --accent: #6e9a62;
  --accent-soft: #b7d3a8;
  --success: #5b9d55;
  --warning: #c48d3c;
  --rare: #8862d7;
  --rope: #d49343;
  --rope-dark: #88521f;
  --rope-glow: rgba(255, 220, 131, 0.58);
  --lasso-duration: 5s;
  --lasso-meter-duration: 5s;
  --shadow: rgba(24, 29, 21, 0.18);
  --shadow-strong: rgba(24, 29, 21, 0.28);
  --radius: 6px;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  color: var(--ink);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.45), rgba(255, 255, 255, 0)),
    repeating-linear-gradient(
      0deg,
      rgba(255, 255, 255, 0.08) 0,
      rgba(255, 255, 255, 0.08) 3px,
      transparent 3px,
      transparent 6px
    ),
    linear-gradient(180deg, var(--bg-1), var(--bg-2));
  font-family: "Trebuchet MS", "Segoe UI", sans-serif;
}

body {
  padding: 20px;
}

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

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

.page-shell {
  width: min(1180px, 100%);
  margin: 0 auto;
}

.console-frame {
  background: linear-gradient(180deg, rgba(255, 252, 246, 0.96), rgba(243, 233, 208, 0.98));
  border: 3px solid var(--line);
  box-shadow:
    0 18px 40px var(--shadow-strong),
    inset 0 0 0 3px rgba(255, 255, 255, 0.45);
  border-radius: var(--radius);
  overflow: hidden;
}

.console-header {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
  padding: 18px 20px 14px;
  border-bottom: 3px solid rgba(48, 68, 55, 0.14);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.45), rgba(255, 255, 255, 0)),
    linear-gradient(90deg, rgba(160, 206, 147, 0.18), rgba(255, 224, 183, 0.1));
}

.header-brand {
  display: grid;
  gap: 10px;
  min-width: 0;
  flex: 1 1 420px;
}

.brand-logo {
  display: block;
  width: min(100%, 440px);
  height: auto;
  image-rendering: pixelated;
  filter: drop-shadow(0 3px 0 rgba(95, 57, 14, 0.1));
}

.header-units {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.unit-filter-btn {
  flex: 1 1 118px;
  min-width: 118px;
  padding: 8px 10px;
  border: 3px solid rgba(48, 68, 55, 0.18);
  border-radius: var(--radius);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.9), rgba(242, 235, 216, 0.96));
  box-shadow: 0 6px 16px rgba(36, 46, 28, 0.1);
  display: grid;
  gap: 2px;
  text-align: left;
  color: var(--ink);
}

.unit-filter-btn strong {
  font-size: 0.94rem;
  line-height: 1;
}

.unit-filter-btn span,
.unit-filter-btn em {
  font-style: normal;
  color: var(--ink-soft);
}

.unit-filter-btn span {
  font-size: 0.8rem;
}

.unit-filter-btn em {
  font-size: 0.74rem;
}

.unit-filter-btn.is-active {
  border-color: rgba(110, 154, 98, 0.54);
  background:
    linear-gradient(180deg, rgba(237, 251, 222, 0.98), rgba(208, 233, 187, 0.98));
  box-shadow: 0 0 0 3px rgba(153, 206, 138, 0.22), 0 8px 18px rgba(36, 46, 28, 0.14);
}

.unit-filter-btn.is-planned {
  background: linear-gradient(180deg, rgba(255, 250, 240, 0.92), rgba(239, 229, 209, 0.96));
}

.header-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
  flex: 0 1 420px;
}

.app-root {
  padding: 18px;
}

.screen {
  display: grid;
  gap: 16px;
}

.screen-title {
  grid-template-columns: 1.2fr 0.8fr;
  align-items: stretch;
}

.title-hero,
.title-side,
.panel,
.detail-panel,
.screen-panel {
  background: var(--panel);
  border: 3px solid rgba(48, 68, 55, 0.18);
  border-radius: var(--radius);
  box-shadow: 0 10px 24px var(--shadow);
}

.title-hero,
.title-side,
.panel,
.detail-panel,
.screen-panel {
  padding: 18px;
}

.title-hero {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.5), rgba(255, 255, 255, 0.18)),
    linear-gradient(135deg, rgba(220, 240, 205, 0.78), rgba(255, 240, 205, 0.76));
  display: grid;
  gap: 16px;
}

.title-art {
  min-height: 300px;
  border: 3px solid rgba(48, 68, 55, 0.18);
  border-radius: var(--radius);
  background:
    linear-gradient(180deg, rgba(248, 252, 255, 0.12), rgba(255, 255, 255, 0) 34%, rgba(250, 238, 201, 0.3) 100%),
    linear-gradient(180deg, rgba(19, 39, 22, 0.02), rgba(19, 39, 22, 0.18)),
    url("./assets/backgrounds/title_sanctuary.png");
  background-position: center center;
  background-size: cover;
  position: relative;
  overflow: hidden;
}

.title-lasso-badge {
  position: absolute;
  top: 16px;
  right: 18px;
  width: 92px;
  height: 92px;
  display: grid;
  place-items: center;
  border: 2px solid rgba(48, 68, 55, 0.16);
  border-radius: 22px;
  background:
    radial-gradient(circle at 35% 30%, rgba(255, 255, 255, 0.6), transparent 32%),
    linear-gradient(180deg, rgba(255, 250, 236, 0.92), rgba(245, 229, 190, 0.86));
  box-shadow: 0 10px 24px rgba(36, 46, 28, 0.14);
  z-index: 2;
  animation: bob 2.8s ease-in-out infinite;
}

.title-rope-mark {
  width: 72px;
  height: 72px;
  image-rendering: pixelated;
  filter: drop-shadow(0 2px 0 rgba(95, 57, 14, 0.16));
}

.unit-preview-card {
  position: absolute;
  inset: auto 20px 20px auto;
  width: min(240px, calc(100% - 40px));
  padding: 14px 16px;
  border: 2px solid rgba(48, 68, 55, 0.16);
  border-radius: calc(var(--radius) + 2px);
  background: rgba(255, 255, 255, 0.82);
  backdrop-filter: blur(4px);
  box-shadow: 0 10px 24px rgba(36, 46, 28, 0.14);
  z-index: 2;
}

.unit-preview-card strong {
  display: block;
  font-size: 1.08rem;
  margin-bottom: 4px;
}

.unit-preview-card p {
  margin: 0;
}

.title-art::before,
.title-art::after {
  content: "";
  position: absolute;
  inset: 0;
  width: auto;
  height: auto;
  pointer-events: none;
}

.title-art::before {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.1), transparent 24%, rgba(37, 62, 37, 0.16) 100%),
    linear-gradient(90deg, rgba(255, 255, 255, 0.08), transparent 12%, transparent 88%, rgba(255, 255, 255, 0.08));
}

.title-art::after {
  inset: auto 0 0 0;
  height: 42%;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0), rgba(242, 232, 198, 0.16) 18%, rgba(58, 85, 47, 0.26) 100%);
}

.pixel-creature-row {
  position: absolute;
  inset: auto 0 18px 0;
  display: flex;
  justify-content: space-around;
  align-items: flex-end;
  padding: 0 18px;
  z-index: 1;
}

.title-copy h2 {
  margin: 0;
  font-size: 1.55rem;
}

.title-copy p,
.panel p,
.detail-panel p,
.screen-panel p {
  margin: 0;
  line-height: 1.5;
}

.title-actions,
.inline-actions,
.button-row,
.chip-row,
.score-row,
.tab-row,
.detail-actions,
.rescue-actions,
.summary-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.btn {
  border: 3px solid var(--line);
  background: linear-gradient(180deg, #fffef4, #ebdfbf);
  color: var(--ink);
  border-radius: var(--radius);
  padding: 10px 14px;
  min-height: 46px;
  box-shadow: 0 4px 0 rgba(48, 68, 55, 0.2);
  transition: transform 120ms ease, box-shadow 120ms ease, background 120ms ease;
}

.btn:hover,
.btn:focus-visible {
  transform: translateY(-1px);
  box-shadow: 0 6px 0 rgba(48, 68, 55, 0.22);
}

.btn:active {
  transform: translateY(2px);
  box-shadow: 0 2px 0 rgba(48, 68, 55, 0.18);
}

.btn-primary {
  background: linear-gradient(180deg, #d3f0be, #90c46f);
}

.btn-secondary {
  background: linear-gradient(180deg, #fff7dc, #e6cd8f);
}

.btn-ghost {
  background: linear-gradient(180deg, #ffffff, #f1ead9);
}

.btn-danger {
  background: linear-gradient(180deg, #ffd4c7, #ea8b74);
}

.btn[disabled] {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none;
  box-shadow: 0 4px 0 rgba(48, 68, 55, 0.08);
}

.small-btn {
  min-height: 36px;
  padding: 8px 10px;
}

.meta-grid,
.stats-grid,
.summary-grid {
  display: grid;
  gap: 12px;
}

.meta-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.stats-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.summary-grid {
  grid-template-columns: 1.1fr 0.9fr;
}

.stat-card,
.meta-card,
.medal-card,
.history-card,
.rescue-card,
.dex-card,
.habitat-section,
.intro-panel,
.encounter-layout,
.world-layout,
.summary-card {
  border: 3px solid rgba(48, 68, 55, 0.16);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.42);
}

.stat-card,
.meta-card,
.medal-card,
.history-card,
.rescue-card,
.dex-card,
.habitat-section,
.summary-card {
  padding: 14px;
}

.eyebrow {
  margin: 0 0 6px;
  font-size: 0.8rem;
  text-transform: uppercase;
  color: var(--ink-soft);
}

.big-number {
  font-size: 1.95rem;
  font-weight: 700;
  line-height: 1;
}

.value-line {
  font-size: 1.35rem;
  font-weight: 700;
}

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

.nav-strip,
.hud-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.chip {
  border: 2px solid rgba(48, 68, 55, 0.2);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.62);
  padding: 8px 10px;
  min-height: 40px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.chip strong {
  font-size: 1rem;
}

.chip-dot {
  width: 12px;
  height: 12px;
  border-radius: 3px;
  background: currentColor;
  box-shadow: inset 0 0 0 2px rgba(0, 0, 0, 0.1);
}

.screen-panel h2,
.panel h2,
.detail-panel h2,
.title-side h2 {
  margin: 0 0 12px;
  font-size: 1.2rem;
}

.world-layout {
  display: grid;
  grid-template-columns: 1.25fr 0.95fr;
  gap: 14px;
  padding: 14px;
}

.map-panel {
  position: relative;
  min-height: 490px;
  padding: 16px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.1), rgba(255, 255, 255, 0) 34%, rgba(25, 44, 28, 0.16) 100%),
    linear-gradient(180deg, rgba(240, 248, 255, 0.08), rgba(253, 243, 212, 0.12)),
    url("./assets/backgrounds/map_overworld.png");
  background-position: center center;
  background-size: cover;
  overflow: hidden;
}

.map-panel::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.08), transparent 26%, rgba(47, 68, 50, 0.18) 100%),
    linear-gradient(90deg, rgba(255, 255, 255, 0.08), transparent 14%, transparent 86%, rgba(255, 255, 255, 0.08));
  pointer-events: none;
}

.map-panel::after {
  content: "";
  position: absolute;
  inset: 16px 16px auto auto;
  width: 220px;
  height: 110px;
  border-radius: 999px;
  background: radial-gradient(circle at center, rgba(255, 244, 197, 0.34), transparent 70%);
  pointer-events: none;
}

.map-label {
  position: absolute;
  left: 18px;
  top: 18px;
  z-index: 3;
  padding: 10px 12px;
  border: 2px solid rgba(48, 68, 55, 0.14);
  border-radius: calc(var(--radius) - 2px);
  background: rgba(255, 255, 255, 0.9);
}

.map-trails {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 1;
  filter: drop-shadow(0 2px 3px rgba(255, 255, 255, 0.3));
}

.map-node {
  position: absolute;
  transform: translate(-50%, -50%);
  width: 128px;
  min-height: 78px;
  padding: 10px;
  border: 3px solid rgba(48, 68, 55, 0.24);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.94);
  box-shadow: 0 10px 22px rgba(36, 46, 28, 0.18);
  display: grid;
  gap: 6px;
  text-align: left;
  z-index: 2;
}

.map-node.is-next {
  animation: pulseGlow 1.6s ease-in-out infinite;
}

.map-node.is-current-habitat {
  box-shadow: 0 0 0 4px rgba(255, 255, 255, 0.45), 0 14px 28px rgba(36, 46, 28, 0.22);
}

.map-node-head {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  align-items: center;
}

.map-node h3,
.habitat-section h3,
.detail-panel h3,
.encounter-card h3,
.summary-card h3,
.rescue-card h3 {
  margin: 0;
  font-size: 1rem;
}

.map-node p,
.tiny-text,
.helper-text,
.status-line,
.audio-note {
  font-size: 0.88rem;
  color: var(--ink-soft);
}

.keeper-marker {
  position: absolute;
  width: 34px;
  height: 34px;
  border: 3px solid var(--line);
  border-radius: var(--radius);
  background:
    linear-gradient(180deg, #fff7da, #e0b866);
  z-index: 3;
  box-shadow: 0 8px 14px rgba(36, 46, 28, 0.18);
  transform: translate(-50%, -50%);
}

.keeper-marker::before,
.keeper-marker::after {
  content: "";
  position: absolute;
  border-radius: 2px;
  background: var(--line);
}

.keeper-marker::before {
  width: 10px;
  height: 10px;
  left: 9px;
  top: 6px;
}

.keeper-marker::after {
  width: 16px;
  height: 7px;
  left: 6px;
  bottom: 6px;
}

.companion-panel {
  display: grid;
  gap: 14px;
}

.next-card,
.medal-track,
.day-banner,
.dex-detail-header,
.encounter-card,
.dialogue-box {
  border: 3px solid rgba(48, 68, 55, 0.16);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.6);
  padding: 14px;
}

.next-card {
  display: grid;
  grid-template-columns: 120px 1fr;
  gap: 14px;
  align-items: center;
}

.creature-stage {
  display: grid;
  justify-items: center;
  align-items: center;
  gap: 8px;
}

.sprite-frame {
  position: relative;
  width: 104px;
  height: 104px;
  border: 3px solid rgba(48, 68, 55, 0.16);
  border-radius: var(--radius);
  background:
    radial-gradient(circle at 50% 26%, rgba(255, 252, 239, 0.66), transparent 34%),
    linear-gradient(180deg, rgba(250, 253, 243, 0.56), rgba(220, 233, 191, 0.46) 58%, rgba(190, 212, 154, 0.34));
  display: grid;
  place-items: center;
  overflow: hidden;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.24);
}

.sprite-frame img {
  width: 88px;
  height: 88px;
  object-fit: contain;
  transition: filter 160ms ease, opacity 160ms ease, transform 160ms ease;
}

.sprite-frame.is-caught img {
  animation: bob 2.1s ease-in-out infinite;
}

.sprite-frame.is-seen img {
  filter: grayscale(1) brightness(0.42) contrast(1.05);
  opacity: 0.96;
}

.sprite-frame.is-preview img {
  filter: none;
  opacity: 1;
}

.sprite-frame.is-unseen img {
  filter: grayscale(1) brightness(0.16) contrast(1.2);
  opacity: 0.92;
}

.sprite-frame.is-seen {
  background:
    radial-gradient(circle at 50% 24%, rgba(235, 239, 234, 0.38), transparent 34%),
    linear-gradient(180deg, rgba(109, 123, 109, 0.28), rgba(199, 205, 196, 0.2));
}

.sprite-frame.is-unseen {
  background:
    radial-gradient(circle at 50% 24%, rgba(204, 210, 201, 0.18), transparent 32%),
    linear-gradient(180deg, rgba(69, 83, 70, 0.28), rgba(103, 117, 101, 0.22));
}

.sprite-frame.is-preview {
  background:
    radial-gradient(circle at 50% 26%, rgba(255, 248, 225, 0.74), transparent 36%),
    linear-gradient(180deg, rgba(255, 249, 233, 0.62), rgba(243, 225, 176, 0.34) 58%, rgba(221, 194, 137, 0.22));
  box-shadow: 0 0 0 3px rgba(255, 239, 192, 0.22);
}

.sprite-frame.is-unseen::after {
  content: "?";
  position: absolute;
  right: 6px;
  top: 6px;
  width: 24px;
  height: 24px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  border: 2px solid rgba(48, 68, 55, 0.18);
  background: rgba(255, 249, 231, 0.88);
  color: var(--ink);
  font-weight: 700;
  font-size: 0.92rem;
  box-shadow: 0 4px 10px rgba(24, 29, 21, 0.12);
}

.status-pill,
.rarity-pill,
.habitat-pill,
.day-pill,
.medal-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 30px;
  padding: 4px 9px;
  border-radius: var(--radius);
  border: 2px solid rgba(48, 68, 55, 0.14);
  font-size: 0.84rem;
  font-weight: 700;
}

.status-pill.unseen {
  background: #f0ead7;
}

.status-pill.seen {
  background: #d8ddcf;
}

.status-pill.caught {
  background: #d8f0ca;
}

.rarity-common {
  background: #f2eddd;
}

.rarity-uncommon {
  background: #d9ecdb;
}

.rarity-rare {
  background: #e4dbfb;
}

.medal-track {
  display: grid;
  gap: 10px;
}

.medal-card {
  display: grid;
  gap: 8px;
}

.meter {
  width: 100%;
  height: 14px;
  border-radius: 999px;
  background: rgba(48, 68, 55, 0.12);
  overflow: hidden;
}

.meter-fill {
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, #8ecb7a, #f1cb65);
}

.meter-fill.gold {
  background: linear-gradient(90deg, #d7b058, #f6e07d);
}

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

.day-track {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.day-chip {
  padding: 8px 10px;
  border: 2px solid rgba(48, 68, 55, 0.16);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.58);
}

.encounter-layout {
  display: grid;
  grid-template-columns: 1.08fr 0.92fr;
  gap: 14px;
  padding: 14px;
}

.encounter-scene {
  min-height: 480px;
  background:
    linear-gradient(180deg, rgba(245, 251, 255, 0.14), rgba(255, 255, 255, 0.03) 30%, rgba(29, 47, 31, 0.16) 100%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.08), transparent 18%, rgba(255, 243, 213, 0.14) 100%),
    var(--scene-image),
    linear-gradient(180deg, var(--scene-sky, #dff3df) 0 48%, var(--scene-ground, #99c57a) 48% 100%);
  background-position: center center;
  background-size: cover;
  border-radius: var(--radius);
  border: 3px solid rgba(48, 68, 55, 0.16);
  padding: 16px;
  display: grid;
  gap: 14px;
  align-content: space-between;
  position: relative;
  overflow: hidden;
}

.encounter-scene.is-lasso-active::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 50% 58%, rgba(255, 236, 169, 0.34), transparent 28%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.12), transparent 36%, rgba(255, 246, 220, 0.18));
  pointer-events: none;
  animation: lassoSceneFlash var(--lasso-duration) steps(6, end) both;
}

.encounter-scene::after {
  content: "";
  position: absolute;
  inset: auto 12px 12px 12px;
  height: 140px;
  border-radius: var(--radius);
  background:
    linear-gradient(90deg, rgba(255, 255, 255, 0.1), transparent 12%, transparent 88%, rgba(255, 255, 255, 0.1)),
    linear-gradient(180deg, rgba(255, 248, 227, 0.06), rgba(45, 66, 45, 0.22));
}

.encounter-top {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
  position: relative;
  z-index: 1;
}

.encounter-top > div:first-child {
  max-width: min(72%, 410px);
  padding: 12px 14px;
  border: 2px solid rgba(48, 68, 55, 0.14);
  border-radius: calc(var(--radius) - 2px);
  background: rgba(255, 255, 255, 0.76);
  backdrop-filter: blur(6px);
  box-shadow: 0 10px 24px rgba(31, 44, 26, 0.12);
}

.encounter-visual {
  position: relative;
  z-index: 1;
  display: grid;
  justify-items: center;
  gap: 12px;
}

.encounter-stage {
  position: relative;
  width: min(100%, 420px);
  min-height: 244px;
  display: grid;
  place-items: center;
}

.encounter-stage .sprite-frame {
  position: relative;
  z-index: 2;
  border: 0;
  background: none;
  box-shadow: none;
  overflow: visible;
}

.encounter-stage.is-cutscene.outcome-caught .sprite-frame,
.encounter-stage.is-cutscene.outcome-duplicate .sprite-frame {
  animation: creatureCinch var(--lasso-duration) steps(7, end) both;
}

.encounter-stage.is-cutscene.outcome-seen .sprite-frame {
  animation: creatureSlip var(--lasso-duration) steps(7, end) both;
}

.encounter-visual .sprite-frame {
  width: 180px;
  height: 180px;
}

.encounter-visual .sprite-frame img {
  width: 152px;
  height: 152px;
  filter: drop-shadow(0 8px 10px rgba(41, 55, 36, 0.22));
}

.sparkle-burst {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.sparkle-burst span {
  position: absolute;
  width: 10px;
  height: 10px;
  border-radius: 3px;
  background: rgba(255, 247, 157, 0.95);
  animation: sparkle 1.2s ease-in-out infinite;
}

.sparkle-burst span:nth-child(1) { left: 24%; top: 20%; animation-delay: 0s; }
.sparkle-burst span:nth-child(2) { right: 20%; top: 26%; animation-delay: 0.18s; }
.sparkle-burst span:nth-child(3) { left: 18%; bottom: 28%; animation-delay: 0.32s; }
.sparkle-burst span:nth-child(4) { right: 24%; bottom: 24%; animation-delay: 0.48s; }
.sparkle-burst span:nth-child(5) { left: 48%; top: 12%; animation-delay: 0.58s; }

.lasso-cutscene {
  position: absolute;
  inset: -10px -8px -16px -8px;
  z-index: 3;
  pointer-events: none;
  overflow: visible;
}

.lasso-sequence,
.lasso-impact,
.lasso-dust,
.lasso-caption,
.lasso-callout {
  position: absolute;
}

.lasso-video {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 128%;
  height: 128%;
  z-index: 4;
  object-fit: contain;
  object-position: center center;
  transform: translate(-50%, -50%);
  transform-origin: center center;
  pointer-events: none;
  will-change: transform, opacity;
  filter:
    drop-shadow(0 0 1px rgba(84, 55, 28, 0.68))
    drop-shadow(0 12px 16px rgba(49, 34, 18, 0.16));
}

.lasso-sequence {
  left: 50%;
  z-index: 4;
  background-position: center;
  background-repeat: no-repeat;
  background-size: contain;
  opacity: 0;
  will-change: transform, opacity;
}

.spin-one,
.spin-two,
.spin-three {
  left: auto;
  right: -138px;
  width: 620px;
  height: 228px;
  background-position: center center;
  background-size: cover;
  filter: drop-shadow(0 12px 16px rgba(49, 34, 18, 0.16));
  transform-origin: 88% 56%;
}

.spin-one {
  background-image: url("./assets/ui/lasso-sequence/01.png");
  top: 78%;
  animation: lassoSpinOne var(--lasso-duration) linear both;
}

.spin-two {
  background-image: url("./assets/ui/lasso-sequence/02.png");
  top: 73%;
  animation: lassoSpinTwo var(--lasso-duration) linear both;
}

.spin-three {
  background-image: url("./assets/ui/lasso-sequence/03.png");
  top: 68%;
  animation: lassoSpinThree var(--lasso-duration) linear both;
}

.catch-four,
.catch-five {
  width: 244px;
  height: 244px;
  background-position: center center;
  background-size: cover;
  filter: drop-shadow(0 10px 14px rgba(53, 37, 20, 0.16));
}

.catch-four {
  background-image: url("./assets/ui/lasso-sequence/04.png");
  top: 52%;
  animation: lassoCatchFour var(--lasso-duration) linear both;
}

.catch-five {
  background-image: url("./assets/ui/lasso-sequence/05.png");
  top: 51%;
  animation: lassoCatchFive var(--lasso-duration) linear both;
}

.lasso-cutscene.outcome-caught .catch-four,
.lasso-cutscene.outcome-caught .catch-five,
.lasso-cutscene.outcome-duplicate .catch-four,
.lasso-cutscene.outcome-duplicate .catch-five {
  filter:
    drop-shadow(0 0 20px var(--rope-glow))
    drop-shadow(0 10px 14px rgba(53, 37, 20, 0.24));
}

.lasso-cutscene.outcome-seen .catch-four,
.lasso-cutscene.outcome-seen .catch-five {
  filter:
    drop-shadow(0 0 14px rgba(201, 223, 240, 0.54))
    drop-shadow(0 10px 14px rgba(53, 37, 20, 0.18));
}

.lasso-impact {
  z-index: 2;
  left: 50%;
  top: 58%;
  width: 194px;
  height: 194px;
  border: 5px solid rgba(255, 249, 228, 0.95);
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 251, 236, 0.16) 0, rgba(255, 251, 236, 0.16) 38%, rgba(255, 251, 236, 0) 66%);
  transform: translate(-50%, -50%) scale(0.14);
  opacity: 0;
  animation: lassoImpactPulse var(--lasso-duration) ease-out both;
}

.lasso-cutscene.outcome-seen .lasso-impact {
  border-color: rgba(214, 239, 255, 0.94);
}

.lasso-dust {
  z-index: 1;
  bottom: 34px;
  width: 72px;
  height: 22px;
  border-radius: 999px;
  background: linear-gradient(180deg, rgba(255, 239, 199, 0.96), rgba(223, 189, 121, 0.74));
  filter: blur(1px);
  opacity: 0;
  animation: lassoDustKick var(--lasso-duration) ease-out both;
}

.dust-left {
  left: 92px;
}

.dust-right {
  right: 92px;
  animation-delay: 0.08s;
}

.lasso-callout {
  z-index: 5;
  left: 50%;
  top: 12%;
  padding: 8px 18px 10px;
  border: 3px solid rgba(76, 49, 23, 0.2);
  border-radius: 999px;
  background: rgba(255, 250, 233, 0.96);
  box-shadow: 0 10px 18px rgba(40, 31, 17, 0.14);
  color: #7a4319;
  text-align: center;
  opacity: 0;
  transform: translate(-50%, 12px) scale(0.72);
  animation: lassoCalloutPop var(--lasso-duration) steps(10, end) both;
}

.lasso-cutscene.outcome-seen .lasso-callout {
  background: rgba(250, 247, 242, 0.96);
  color: #6a5440;
  border-color: rgba(133, 157, 178, 0.32);
}

.lasso-callout strong {
  font-size: 1.08rem;
  letter-spacing: 0;
}

.lasso-caption {
  z-index: 5;
  left: 50%;
  bottom: 10px;
  min-width: 220px;
  padding: 10px 14px;
  display: grid;
  gap: 3px;
  border: 2px solid rgba(48, 68, 55, 0.14);
  border-radius: var(--radius);
  background: rgba(255, 251, 240, 0.9);
  box-shadow: 0 8px 18px rgba(31, 44, 26, 0.12);
  text-align: center;
  opacity: 0;
  transform: translate(-50%, 12px);
  animation: lassoCaptionRise var(--lasso-duration) steps(8, end) both;
}

.lasso-caption strong {
  font-size: 0.86rem;
}

.lasso-caption span {
  font-size: 0.74rem;
  color: var(--ink-soft);
}

.dialogue-box {
  display: grid;
  gap: 12px;
  width: min(100%, 540px);
  padding: 14px 16px;
  border: 2px solid rgba(48, 68, 55, 0.14);
  border-radius: calc(var(--radius) - 2px);
  background: rgba(255, 255, 255, 0.76);
  backdrop-filter: blur(6px);
  box-shadow: 0 10px 24px rgba(31, 44, 26, 0.12);
}

.dialogue-box.is-cutscene {
  background: rgba(255, 248, 233, 0.84);
  border-color: rgba(212, 147, 67, 0.24);
}

.intro-layout {
  display: grid;
  grid-template-columns: 0.9fr 1.1fr;
  gap: 14px;
}

.intro-panel {
  padding: 16px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.32), rgba(255, 255, 255, 0)),
    linear-gradient(180deg, #e6f3d8 0 46%, #aacd8d 46% 100%);
  min-height: 440px;
  display: grid;
  align-content: end;
}

.dialogue-avatar {
  justify-self: center;
  width: min(220px, 70%);
  aspect-ratio: 1;
  border: 3px solid rgba(48, 68, 55, 0.16);
  border-radius: var(--radius);
  background:
    radial-gradient(circle at 45% 30%, rgba(255, 245, 190, 0.9), transparent 18%),
    linear-gradient(180deg, #fff2ca 0 34%, #c79659 34% 100%);
  position: relative;
}

.dialogue-avatar::before,
.dialogue-avatar::after {
  content: "";
  position: absolute;
  background: var(--line);
}

.dialogue-avatar::before {
  width: 44%;
  height: 22%;
  left: 28%;
  top: 26%;
  border-radius: 3px;
}

.dialogue-avatar::after {
  width: 58%;
  height: 16%;
  left: 21%;
  bottom: 18%;
  border-radius: 3px;
}

.intro-copy {
  display: grid;
  gap: 14px;
}

.dialogue-progress {
  display: flex;
  gap: 8px;
}

.dialogue-progress span {
  width: 34px;
  height: 10px;
  border-radius: 999px;
  background: rgba(48, 68, 55, 0.14);
}

.dialogue-progress span.is-active {
  background: linear-gradient(90deg, #99ce8a, #efce78);
}

.encounter-form,
.title-side,
.rescue-list,
.history-list,
.summary-list,
.detail-stack,
.habitat-grid,
.summary-stack {
  display: grid;
  gap: 12px;
}

.field {
  display: grid;
  gap: 8px;
}

.field label {
  font-size: 0.92rem;
  font-weight: 700;
}

.field input {
  width: 100%;
  min-height: 42px;
  border-radius: var(--radius);
  border: 3px solid rgba(48, 68, 55, 0.16);
  padding: 10px 12px;
  background: rgba(255, 255, 255, 0.92);
  color: var(--ink);
}

.score-btn {
  min-width: 52px;
  justify-content: center;
  font-weight: 700;
}

.score-btn.is-selected {
  background: linear-gradient(180deg, #d4efbf, #8fc36d);
}

.resolution-banner {
  padding: 14px;
  border-radius: var(--radius);
  border: 3px solid rgba(48, 68, 55, 0.16);
}

.resolution-banner.caught {
  background: linear-gradient(180deg, rgba(220, 247, 196, 0.96), rgba(173, 226, 132, 0.82));
}

.resolution-banner.seen {
  background: linear-gradient(180deg, rgba(236, 233, 220, 0.95), rgba(208, 200, 176, 0.88));
}

.resolution-banner.duplicate {
  background: linear-gradient(180deg, rgba(255, 239, 195, 0.95), rgba(244, 205, 112, 0.88));
}

.encounter-cutscene-panel h2 {
  margin: 0;
}

.lasso-meter {
  height: 16px;
  border-radius: 999px;
  border: 3px solid rgba(48, 68, 55, 0.16);
  overflow: hidden;
  background: rgba(255, 255, 255, 0.56);
}

.lasso-meter-fill {
  display: block;
  width: 100%;
  height: 100%;
  transform-origin: left center;
  transform: scaleX(0);
  animation: lassoMeterFill var(--lasso-meter-duration) steps(8, end) forwards;
  background: linear-gradient(90deg, #e1b36a, #f3df9f, #e1b36a);
}

.lasso-meter-fill.outcome-caught {
  background: linear-gradient(90deg, #d18d3a, #f3df9f, #7dbd6c);
}

.lasso-meter-fill.outcome-duplicate {
  background: linear-gradient(90deg, #d18d3a, #f6d57d, #efb84d);
}

.lasso-meter-fill.outcome-seen {
  background: linear-gradient(90deg, #d18d3a, #f1d9a4, #9fb6cb);
}

.dex-layout {
  display: grid;
  gap: 14px;
}

.dex-detail-header {
  display: grid;
  grid-template-columns: 116px 1fr;
  gap: 14px;
  align-items: center;
}

.habitat-section {
  display: grid;
  gap: 12px;
}

.habitat-section-header {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
}

.habitat-grid {
  grid-template-columns: repeat(auto-fit, minmax(176px, 1fr));
}

.dex-card {
  display: grid;
  gap: 10px;
  align-content: start;
  text-align: left;
}

.dex-card.is-selected {
  border-color: rgba(110, 154, 98, 0.62);
  box-shadow: 0 0 0 3px rgba(158, 204, 145, 0.25);
}

.dex-card .sprite-frame {
  justify-self: center;
}

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

.status-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

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

.rescue-card {
  display: grid;
  grid-template-columns: 88px 1fr auto;
  gap: 14px;
  align-items: center;
}

.rescue-card .sprite-frame {
  width: 80px;
  height: 80px;
}

.rescue-card .sprite-frame img {
  width: 66px;
  height: 66px;
}

.history-list,
.summary-list,
.rescue-list,
.detail-stack {
  grid-template-columns: minmax(0, 1fr);
}

.history-item,
.summary-item {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: center;
  padding: 10px 12px;
  border: 2px solid rgba(48, 68, 55, 0.12);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.52);
}

.history-item strong,
.summary-item strong {
  display: block;
}

.empty-state {
  padding: 20px;
  text-align: center;
  border: 3px dashed rgba(48, 68, 55, 0.18);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.4);
}

.fx-toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%);
  min-width: 220px;
  max-width: min(420px, calc(100vw - 40px));
  padding: 12px 14px;
  border-radius: var(--radius);
  border: 3px solid var(--line);
  background: linear-gradient(180deg, #fff5d9, #f0cb79);
  box-shadow: 0 16px 36px rgba(24, 29, 21, 0.26);
  z-index: 100;
  animation: toastIn 220ms ease, toastOut 220ms ease 2.4s forwards;
}

.fine-print {
  color: var(--ink-soft);
  font-size: 0.85rem;
}

.legend-grid {
  display: grid;
  gap: 8px;
}

.legend-item {
  display: flex;
  gap: 10px;
  align-items: center;
}

.header-note {
  margin: 0;
  font-size: 0.85rem;
  color: var(--ink-soft);
  text-align: right;
}

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

@keyframes lassoSceneFlash {
  0%, 16% { opacity: 0.08; }
  24%, 58% { opacity: 0.32; }
  66% { opacity: 0.5; }
  82% { opacity: 0.28; }
  100% { opacity: 0.22; }
}

@keyframes lassoSpinOne {
  0%, 3% {
    opacity: 0;
    transform: translate(0, -50%) translate(0, 46px) scale(-1.72, 0.18) rotate(0deg);
  }
  6%, 17% {
    opacity: 0.98;
    transform: translate(0, -50%) translate(0, 28px) scale(-1.68, 0.22) rotate(360deg);
  }
  21%, 100% {
    opacity: 0;
    transform: translate(0, -50%) translate(0, 16px) scale(-1.6, 0.2) rotate(396deg);
  }
}

@keyframes lassoSpinTwo {
  0%, 19% {
    opacity: 0;
    transform: translate(0, -50%) translate(0, 36px) scale(-1.54, 0.22) rotate(0deg);
  }
  23%, 35% {
    opacity: 0.98;
    transform: translate(0, -50%) translate(0, 18px) scale(-1.48, 0.26) rotate(360deg);
  }
  39%, 100% {
    opacity: 0;
    transform: translate(0, -50%) translate(0, 8px) scale(-1.38, 0.24) rotate(394deg);
  }
}

@keyframes lassoSpinThree {
  0%, 37% {
    opacity: 0;
    transform: translate(0, -50%) translate(0, 28px) scale(-1.32, 0.24) rotate(0deg);
  }
  41%, 53% {
    opacity: 0.99;
    transform: translate(0, -50%) translate(0, 12px) scale(-1.26, 0.32) rotate(360deg);
  }
  57%, 100% {
    opacity: 0;
    transform: translate(0, -50%) translate(0, 2px) scale(-1.18, 0.28) rotate(394deg);
  }
}

@keyframes lassoCatchFour {
  0%, 55% {
    opacity: 0;
    transform: translate(-50%, -50%) scale(0.34, 0.58) rotate(0deg);
  }
  60% {
    opacity: 0.88;
    transform: translate(-50%, -50%) scale(0.52, 0.72) rotate(80deg);
  }
  72% {
    opacity: 1;
    transform: translate(-50%, -50%) scale(0.92, 0.96) rotate(360deg);
  }
  78%, 100% {
    opacity: 0;
    transform: translate(-50%, -50%) scale(0.96, 1) rotate(396deg);
  }
}

@keyframes lassoCatchFive {
  0%, 74% {
    opacity: 0;
    transform: translate(-50%, -50%) scale(0.42) rotate(0deg);
  }
  80% {
    opacity: 0.92;
    transform: translate(-50%, -50%) scale(0.72) rotate(120deg);
  }
  90% {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1.04) rotate(360deg);
  }
  100% {
    opacity: 0.98;
    transform: translate(-50%, -50%) scale(0.9) rotate(420deg);
  }
}

@keyframes lassoImpactPulse {
  0%, 60% {
    opacity: 0;
    transform: translate(-50%, -50%) scale(0.14);
  }
  72% {
    opacity: 1;
    transform: translate(-50%, -50%) scale(0.28);
  }
  84% {
    opacity: 0.92;
    transform: translate(-50%, -50%) scale(1);
  }
  100% {
    opacity: 0;
    transform: translate(-50%, -50%) scale(1.24);
  }
}

@keyframes lassoDustKick {
  0%, 64% {
    opacity: 0;
    transform: translateY(8px) scale(0.3);
  }
  76% {
    opacity: 0.92;
    transform: translateY(0) scale(1);
  }
  100% {
    opacity: 0;
    transform: translateY(-10px) scale(1.28);
  }
}

@keyframes lassoCalloutPop {
  0%, 72% {
    opacity: 0;
    transform: translate(-50%, 12px) scale(0.72);
  }
  82% {
    opacity: 1;
    transform: translate(-50%, 0) scale(1.06);
  }
  92% {
    opacity: 1;
    transform: translate(-50%, 0) scale(1);
  }
  100% {
    opacity: 0.98;
    transform: translate(-50%, 0) scale(1);
  }
}

@keyframes lassoCaptionRise {
  0%, 78% {
    opacity: 0;
    transform: translate(-50%, 12px);
  }
  88% {
    opacity: 1;
    transform: translate(-50%, 0);
  }
  100% {
    opacity: 0.98;
    transform: translate(-50%, 0);
  }
}

@keyframes creatureCinch {
  0%, 60% {
    transform: translateY(0) scale(1);
  }
  72% {
    transform: translateY(-8px) scale(1.04, 0.96);
  }
  82% {
    transform: translateY(3px) scale(0.97, 1.03) rotate(-1deg);
  }
  92% {
    transform: translateX(2px) rotate(1.5deg) scale(1.01);
  }
  100% {
    transform: translateY(0) scale(1);
  }
}

@keyframes creatureSlip {
  0%, 60% {
    transform: translateY(0) scale(1);
  }
  74% {
    transform: translateX(-12px) rotate(-4deg) scale(1.02);
  }
  86% {
    transform: translateX(16px) rotate(6deg) scale(0.98);
  }
  100% {
    transform: translateY(0) scale(1);
  }
}

@keyframes lassoMeterFill {
  from { transform: scaleX(0); }
  to { transform: scaleX(1); }
}

@keyframes pulseGlow {
  0%, 100% {
    box-shadow: 0 0 0 0 rgba(255, 239, 166, 0.2), 0 12px 24px rgba(36, 46, 28, 0.18);
  }
  50% {
    box-shadow: 0 0 0 10px rgba(255, 239, 166, 0), 0 18px 30px rgba(36, 46, 28, 0.24);
  }
}

@keyframes sparkle {
  0%, 100% {
    transform: scale(0.8);
    opacity: 0.6;
  }
  50% {
    transform: scale(1.35);
    opacity: 1;
  }
}

@keyframes toastIn {
  from {
    opacity: 0;
    transform: translate(-50%, 14px);
  }
  to {
    opacity: 1;
    transform: translate(-50%, 0);
  }
}

@keyframes toastOut {
  to {
    opacity: 0;
    transform: translate(-50%, 16px);
  }
}

@media (max-width: 1024px) {
  .screen-title,
  .world-layout,
  .encounter-layout,
  .intro-layout,
  .summary-grid {
    grid-template-columns: 1fr;
  }

  .map-panel {
    min-height: 440px;
  }

  .summary-grid-two {
    grid-template-columns: 1fr;
  }

  .encounter-stage {
    width: min(100%, 360px);
  }
}

@media (max-width: 720px) {
  body {
    padding: 10px;
  }

  .console-header,
  .app-root,
  .title-hero,
  .title-side,
  .panel,
  .detail-panel,
  .screen-panel {
    padding: 14px;
  }

  .meta-grid,
  .stats-grid {
    grid-template-columns: 1fr;
  }

  .next-card,
  .dex-detail-header,
  .rescue-card {
    grid-template-columns: 1fr;
    justify-items: center;
    text-align: center;
  }

  .habitat-section-header,
  .day-banner,
  .history-item,
  .summary-item,
  .console-header {
    align-items: flex-start;
    flex-direction: column;
  }

  .header-actions {
    width: 100%;
    justify-content: flex-start;
  }

  .header-brand,
  .header-units {
    width: 100%;
  }

  .brand-logo {
    width: min(100%, 320px);
  }

  .unit-filter-btn {
    min-width: calc(50% - 8px);
  }

  .map-node {
    width: 114px;
    min-height: 74px;
    padding: 8px;
  }

  .map-panel {
    min-height: 520px;
  }

  .lasso-caption {
    left: 50%;
    right: auto;
    width: calc(100% - 20px);
    min-width: 0;
    justify-items: center;
    text-align: center;
  }

  .dust-left {
    left: 66px;
  }

  .dust-right {
    right: 66px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .title-hero,
  .title-rope-mark,
  .encounter-stage .sprite-frame,
  .lasso-video,
  .lasso-sequence,
  .lasso-impact,
  .lasso-dust,
  .lasso-caption,
  .lasso-callout,
  .sparkle-burst span,
  .fx-toast,
  .lasso-meter-fill {
    animation: none !important;
  }

  .encounter-scene.is-lasso-active::before {
    opacity: 0.44;
  }

  .spin-one,
  .spin-two,
  .spin-three {
    opacity: 1;
    transform: translate(0, -50%) scale(-1.56, 0.2) rotate(300deg);
  }

  .catch-four {
    opacity: 1;
    transform: translate(-50%, -50%) scale(0.92, 0.96) rotate(360deg);
  }

  .catch-five {
    opacity: 1;
    transform: translate(-50%, -50%) scale(0.9) rotate(420deg);
  }

  .lasso-impact {
    opacity: 0.7;
    transform: translate(-50%, -50%) scale(1);
  }

  .lasso-dust {
    opacity: 0.54;
    transform: translateY(-2px) scale(1);
  }

  .lasso-caption,
  .lasso-callout {
    opacity: 1;
    transform: translate(-50%, 0);
  }

  .lasso-meter-fill {
    transform: scaleX(1);
  }
}
