:root {
  --ink: #24312f;
  --muted-ink: #5d6d68;
  --surface: rgba(248, 246, 238, 0.9);
  --surface-solid: #f8f6ee;
  --line: rgba(36, 49, 47, 0.18);
  --teal: #226d68;
  --teal-dark: #174f4b;
  --leaf: #7aa85c;
  --leaf-dark: #4d7f42;
  --sun: #f2c85b;
  --coral: #e7745e;
  --berry: #8d5a8c;
  --sky: #6aa8b6;
  --bone: #e8dcc3;
  --shadow: rgba(27, 41, 39, 0.2);
  --safe-top: env(safe-area-inset-top);
  --safe-bottom: env(safe-area-inset-bottom);
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  height: 100%;
  margin: 0;
}

body {
  overflow: hidden;
  color: var(--ink);
  background: #d7eee4;
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", "Segoe UI", sans-serif;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  user-select: none;
}

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

button:disabled {
  cursor: default;
  opacity: 0.55;
}

#therapyCanvas {
  position: fixed;
  inset: 0;
  z-index: 0;
  width: 100%;
  height: 100%;
  background: #e7f2e2;
}

.app {
  position: relative;
  z-index: 1;
  min-height: 100dvh;
  display: grid;
  grid-template-rows: auto 1fr;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: calc(10px + var(--safe-top)) 18px 10px;
}

.brand {
  display: flex;
  align-items: center;
  min-width: 0;
  gap: 10px;
  color: var(--teal-dark);
}

.brand-mark {
  width: 50px;
  height: 50px;
  flex: 0 0 auto;
  filter: drop-shadow(0 4px 8px rgba(23, 79, 75, 0.24));
}

.brand-text {
  display: grid;
  gap: 2px;
}

.brand-text strong {
  font-size: 1.08rem;
  font-weight: 500;
}

.brand-text span {
  color: var(--muted-ink);
  font-size: 0.88rem;
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.icon-button {
  display: inline-grid;
  place-items: center;
  width: 48px;
  height: 48px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--teal-dark);
  background: rgba(248, 246, 238, 0.76);
  box-shadow: 0 6px 18px rgba(27, 41, 39, 0.08);
}

.icon-button svg {
  width: 24px;
  height: 24px;
  fill: currentColor;
}

.icon-button.is-muted {
  color: var(--muted-ink);
}

.training-shell {
  min-height: 0;
  display: grid;
  grid-template-rows: auto 1fr;
  gap: 10px;
  padding: 0 18px calc(18px + var(--safe-bottom));
}

.session-panel {
  display: grid;
  grid-template-columns: minmax(250px, 1.05fr) minmax(330px, 1.1fr) minmax(260px, 0.8fr);
  align-items: center;
  gap: 12px;
  width: min(1120px, 100%);
  margin: 0 auto;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: 0 10px 30px rgba(27, 41, 39, 0.08);
  backdrop-filter: blur(10px);
}

.target-prompt {
  display: flex;
  align-items: center;
  min-width: 0;
  gap: 12px;
}

.eyebrow {
  margin: 0 0 3px;
  color: var(--teal-dark);
  font-size: 0.82rem;
  font-weight: 500;
}

.task-text {
  margin: 0;
  color: var(--ink);
  font-size: 1.05rem;
  font-weight: 500;
}

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

.game-choice {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
  min-height: 54px;
  gap: 7px;
  padding: 0 9px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--teal-dark);
  background: rgba(255, 255, 255, 0.42);
  font-size: 0.94rem;
  font-weight: 500;
}

.game-choice.is-active {
  color: #f8f6ee;
  background: var(--teal);
  box-shadow: 0 8px 20px rgba(23, 79, 75, 0.22);
}

.game-symbol {
  display: inline-block;
  width: 26px;
  height: 26px;
  flex: 0 0 auto;
}

.game-symbol-egg {
  border-radius: 54% 54% 48% 48% / 62% 62% 38% 38%;
  background:
    radial-gradient(circle at 35% 34%, var(--coral) 0 14%, transparent 15%),
    radial-gradient(circle at 63% 58%, var(--coral) 0 12%, transparent 13%),
    var(--surface-solid);
}

.game-symbol-star,
.star-preview,
.star-target::before {
  clip-path: polygon(50% 0, 62% 34%, 98% 35%, 69% 57%, 80% 92%, 50% 72%, 20% 92%, 31% 57%, 2% 35%, 38% 34%);
}

.game-symbol-star {
  background: var(--sun);
}

.game-symbol-fossil {
  position: relative;
  border-radius: 999px;
  background: var(--bone);
}

.game-symbol-fossil::before,
.game-symbol-fossil::after {
  content: "";
  position: absolute;
  left: 5px;
  right: 5px;
  height: 4px;
  border-radius: 999px;
  background: var(--teal-dark);
}

.game-symbol-fossil::before {
  top: 8px;
  transform: rotate(25deg);
}

.game-symbol-fossil::after {
  bottom: 8px;
  transform: rotate(-25deg);
}

.game-symbol-leaf {
  border-radius: 72% 0 72% 0;
  background: var(--leaf);
  transform: rotate(-18deg);
}

.metrics {
  display: grid;
  grid-template-columns: repeat(3, minmax(74px, 1fr));
  gap: 8px;
}

.metrics div,
.report-summary div {
  display: grid;
  gap: 2px;
  padding: 8px 10px;
  border-left: 4px solid rgba(34, 109, 104, 0.45);
  background: rgba(255, 255, 255, 0.38);
}

.metrics span,
.report-summary span {
  color: var(--muted-ink);
  font-size: 0.8rem;
}

.metrics strong,
.report-summary strong {
  font-size: 1.18rem;
  font-weight: 500;
}

.scene {
  position: relative;
  width: min(1120px, 100%);
  min-height: 0;
  margin: 0 auto;
  overflow: hidden;
  border-radius: 8px;
  border: 1px solid rgba(36, 49, 47, 0.12);
  background: rgba(250, 253, 244, 0.1);
  box-shadow:
    inset 0 -24px 55px rgba(23, 79, 75, 0.1),
    inset 0 0 0 1px rgba(255, 255, 255, 0.22);
}

.scene.is-paused .cloud,
.scene.is-paused .egg,
.scene.is-paused .leaf-target {
  animation-play-state: paused;
}

.sun-disc {
  position: absolute;
  top: 8%;
  right: 12%;
  width: 78px;
  height: 78px;
  border-radius: 999px;
  background: rgba(242, 200, 91, 0.34);
  box-shadow: 0 0 35px rgba(242, 200, 91, 0.15);
}

.cloud {
  position: absolute;
  width: 112px;
  height: 38px;
  border-radius: 999px;
  background: rgba(248, 246, 238, 0.34);
  filter: blur(0.2px);
}

.cloud::before,
.cloud::after {
  content: "";
  position: absolute;
  border-radius: 999px;
  background: inherit;
}

.cloud::before {
  left: 18px;
  bottom: 16px;
  width: 48px;
  height: 48px;
}

.cloud::after {
  right: 20px;
  bottom: 11px;
  width: 38px;
  height: 38px;
}

.cloud-one {
  top: 14%;
  left: 9%;
  animation: drift 24s linear infinite;
}

.cloud-two {
  top: 24%;
  right: 24%;
  transform: scale(0.78);
  animation: driftSmall 30s linear infinite reverse;
}

.hill {
  position: absolute;
  left: 50%;
  bottom: -88px;
  transform: translateX(-50%);
  border-radius: 50% 50% 0 0;
}

.hill-back {
  width: 118%;
  height: 210px;
  background: rgba(122, 168, 92, 0.2);
}

.hill-front {
  width: 102%;
  height: 160px;
  bottom: -70px;
  background: rgba(34, 109, 104, 0.18);
}

.dino-buddy {
  position: absolute;
  left: 2%;
  bottom: 3%;
  width: min(31vw, 275px);
  min-width: 168px;
  color: var(--leaf);
  filter: drop-shadow(0 15px 18px rgba(27, 41, 39, 0.18));
  pointer-events: none;
}

.dino-shadow {
  fill: rgba(27, 41, 39, 0.16);
}

.dino-body,
.dino-tail {
  fill: currentColor;
}

.dino-belly {
  fill: #cfe8a9;
}

.dino-eye {
  fill: #f8f6ee;
}

.dino-eye-dot {
  fill: var(--ink);
}

.dino-smile {
  stroke: var(--ink);
  stroke-width: 6;
}

.dino-spike,
.dino-leg {
  fill: none;
  stroke: var(--teal-dark);
  stroke-width: 12;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.play-field {
  position: absolute;
  inset: 0;
}

.training-preview {
  display: inline-block;
  width: 54px;
  height: 68px;
  flex: 0 0 auto;
  box-shadow: 0 10px 18px rgba(27, 41, 39, 0.14);
}

.egg,
.egg-preview {
  --egg-base: #f8f6ee;
  --egg-accent: #e7745e;
  border-radius: 54% 54% 48% 48% / 62% 62% 38% 38%;
  background-color: var(--egg-base);
  box-shadow:
    inset -10px -14px 0 rgba(36, 49, 47, 0.12),
    inset 8px 8px 0 rgba(255, 255, 255, 0.4),
    0 12px 18px rgba(27, 41, 39, 0.16);
}

.egg {
  position: absolute;
  left: var(--x);
  top: var(--y);
  width: 112px;
  height: 138px;
  border: 0;
  transform: translate(-50%, -50%) scale(1);
  transition: transform 160ms ease, filter 160ms ease, opacity 180ms ease;
  animation: eggWiggle 3.8s ease-in-out infinite;
  animation-delay: var(--delay);
}

.egg:active {
  transform: translate(-50%, -50%) scale(0.94);
}

.egg.is-correct {
  animation: none;
  filter: drop-shadow(0 0 20px rgba(242, 200, 91, 0.9));
  transform: translate(-50%, -50%) scale(1.14);
}

.egg.is-wrong,
.fossil-piece.is-wrong {
  animation: shake 230ms linear 2;
}

.pattern-spots {
  --egg-accent: #e7745e;
  background-image:
    radial-gradient(circle at 34% 30%, var(--egg-accent) 0 9%, transparent 10%),
    radial-gradient(circle at 64% 48%, var(--egg-accent) 0 8%, transparent 9%),
    radial-gradient(circle at 43% 68%, var(--egg-accent) 0 7%, transparent 8%);
}

.pattern-stripes {
  --egg-accent: #226d68;
  background-image: repeating-linear-gradient(140deg, transparent 0 13px, var(--egg-accent) 14px 24px, transparent 25px 38px);
}

.pattern-rings {
  --egg-accent: #8d5a8c;
  background-image:
    radial-gradient(circle at 50% 45%, transparent 0 14%, var(--egg-accent) 15% 22%, transparent 23% 35%, var(--egg-accent) 36% 43%, transparent 44%);
}

.pattern-zigzag {
  --egg-accent: #f2c85b;
  background-image:
    linear-gradient(135deg, transparent 0 42%, var(--egg-accent) 43% 52%, transparent 53%),
    linear-gradient(45deg, transparent 0 42%, var(--egg-accent) 43% 52%, transparent 53%);
  background-size: 38px 38px;
}

.pattern-leaf {
  --egg-accent: #7aa85c;
  background-image:
    radial-gradient(ellipse at 35% 35%, var(--egg-accent) 0 10%, transparent 11%),
    radial-gradient(ellipse at 65% 50%, var(--egg-accent) 0 10%, transparent 11%),
    radial-gradient(ellipse at 45% 70%, var(--egg-accent) 0 9%, transparent 10%);
}

.star-preview {
  width: 64px;
  height: 64px;
  background: var(--sun);
}

.fossil-preview {
  position: relative;
  width: 64px;
  height: 54px;
  border-radius: 999px;
  background: var(--bone);
}

.fossil-preview::before,
.fossil-preview::after {
  content: "";
  position: absolute;
  left: 10px;
  right: 10px;
  height: 8px;
  border-radius: 999px;
  background: var(--teal-dark);
}

.fossil-preview::before {
  top: 16px;
  transform: rotate(24deg);
}

.fossil-preview::after {
  bottom: 16px;
  transform: rotate(-24deg);
}

.leaf-preview {
  width: 60px;
  height: 58px;
  border-radius: 72% 0 72% 0;
  background: var(--leaf);
  transform: rotate(-18deg);
}

.track-ring {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 128px;
  height: 128px;
  border: 3px dashed rgba(34, 109, 104, 0.42);
  border-radius: 999px;
  transform: translate(-50%, -50%);
  pointer-events: none;
}

.star-target {
  position: absolute;
  left: 50%;
  top: 44%;
  display: grid;
  place-items: center;
  width: 94px;
  height: 94px;
  border: 0;
  background: transparent;
  transform: translate(-50%, -50%);
  filter: drop-shadow(0 12px 15px rgba(27, 41, 39, 0.18));
}

.star-target::before {
  content: "";
  width: 78px;
  height: 78px;
  background: var(--sun);
  box-shadow: 0 0 0 10px rgba(242, 200, 91, 0.18);
}

.ptero-dragger {
  position: absolute;
  left: 34%;
  top: 64%;
  display: grid;
  place-items: center;
  width: 132px;
  height: 96px;
  border: 0;
  background: transparent;
  transform: translate(-50%, -50%);
  touch-action: none;
  filter: drop-shadow(0 12px 15px rgba(27, 41, 39, 0.2));
}

.ptero-dragger svg {
  width: 100%;
  height: 100%;
}

.ptero-wing {
  fill: var(--sky);
}

.ptero-body {
  fill: var(--teal);
}

.ptero-eye {
  fill: var(--surface-solid);
}

.ptero-eye-dot {
  fill: var(--ink);
}

.fossil-board {
  position: absolute;
  inset: 7% 8% 12%;
}

.fossil-slot,
.fossil-piece {
  position: absolute;
  display: grid;
  place-items: center;
  width: 126px;
  height: 92px;
  transform: translate(-50%, -50%);
}

.fossil-slot {
  left: var(--x);
  top: var(--y);
  border: 3px dashed rgba(34, 109, 104, 0.34);
  border-radius: 8px;
  background: rgba(248, 246, 238, 0.25);
}

.fossil-slot svg {
  width: 76px;
  height: 56px;
  color: rgba(36, 49, 47, 0.28);
  fill: currentColor;
}

.fossil-slot.is-filled {
  border-style: solid;
  background: rgba(122, 168, 92, 0.18);
}

.fossil-piece {
  left: var(--home-x);
  top: var(--home-y);
  z-index: 2;
  border: 0;
  border-radius: 8px;
  color: var(--teal-dark);
  background: rgba(248, 246, 238, 0.94);
  box-shadow:
    inset -8px -10px 0 rgba(36, 49, 47, 0.08),
    0 12px 18px rgba(27, 41, 39, 0.18);
  touch-action: none;
}

.fossil-piece svg {
  width: 84px;
  height: 62px;
  fill: currentColor;
}

.fossil-piece.is-dragging {
  z-index: 4;
  transform: translate(-50%, -50%) scale(1.06);
}

.fossil-piece.is-placed {
  color: var(--leaf-dark);
  background: var(--bone);
  pointer-events: none;
}

.brachio-catcher {
  position: absolute;
  right: 4%;
  bottom: 1%;
  width: min(27vw, 270px);
  min-width: 178px;
  color: var(--leaf);
  filter: drop-shadow(0 13px 16px rgba(27, 41, 39, 0.18));
  pointer-events: none;
}

.brachio-catcher svg {
  width: 100%;
  height: auto;
}

.leaf-target {
  position: absolute;
  left: var(--x);
  top: -82px;
  width: 92px;
  height: 80px;
  border: 0;
  background: transparent;
  transform: translateX(-50%);
  animation: leafFall var(--fall-time) linear forwards;
}

.leaf-target::before {
  content: "";
  display: block;
  width: 72px;
  height: 66px;
  margin: 4px auto;
  border-radius: 72% 0 72% 0;
  background: var(--leaf);
  box-shadow:
    inset -8px -8px 0 rgba(36, 49, 47, 0.1),
    0 10px 15px rgba(27, 41, 39, 0.16);
  transform: rotate(var(--leaf-tilt));
}

.leaf-target.is-yellow::before {
  background: var(--sun);
}

.leaf-target.is-rock::before {
  width: 66px;
  height: 60px;
  border-radius: 45% 55% 50% 48%;
  background: var(--berry);
}

.leaf-target.is-caught {
  animation: none;
  filter: drop-shadow(0 0 18px rgba(242, 200, 91, 0.8));
}

.start-button,
.secondary-button {
  border: 0;
  border-radius: 8px;
  color: #f8f6ee;
  background: var(--teal);
  box-shadow: 0 12px 28px rgba(23, 79, 75, 0.28);
}

.start-button {
  position: absolute;
  left: 50%;
  bottom: 9%;
  min-width: 210px;
  min-height: 76px;
  padding: 0 32px;
  transform: translateX(-50%);
  font-size: 1.4rem;
  font-weight: 500;
}

.start-button[hidden] {
  display: none;
}

.secondary-button {
  min-height: 48px;
  padding: 0 18px;
  font-size: 1rem;
}

.feedback {
  position: absolute;
  left: 50%;
  top: 18%;
  min-width: 180px;
  padding: 12px 20px;
  border-radius: 8px;
  color: var(--ink);
  background: rgba(248, 246, 238, 0.9);
  box-shadow: 0 8px 24px rgba(27, 41, 39, 0.16);
  text-align: center;
  font-size: 1.15rem;
  font-weight: 500;
  opacity: 0;
  transform: translate(-50%, 10px);
  transition: opacity 160ms ease, transform 160ms ease;
  pointer-events: none;
}

.feedback.is-visible {
  opacity: 1;
  transform: translate(-50%, 0);
}

.sparkle {
  position: absolute;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--sun);
  box-shadow: 0 0 0 7px rgba(242, 200, 91, 0.28);
  animation: pop 620ms ease-out forwards;
  pointer-events: none;
}

.modal,
.rest-screen {
  position: fixed;
  inset: 0;
  z-index: 5;
  display: grid;
  place-items: center;
  padding: 18px;
}

.modal[hidden],
.rest-screen[hidden] {
  display: none;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(20, 31, 30, 0.34);
  backdrop-filter: blur(4px);
}

.modal-sheet,
.rest-card {
  position: relative;
  width: min(720px, 100%);
  max-height: calc(100dvh - 36px);
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-solid);
  box-shadow: 0 24px 60px rgba(20, 31, 30, 0.28);
}

.modal-sheet {
  padding: 18px;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.modal-header h1 {
  margin: 0;
  font-size: 1.55rem;
  font-weight: 500;
}

.tabbar {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
  margin-bottom: 16px;
}

.tab {
  min-height: 48px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--teal-dark);
  background: transparent;
  font-weight: 500;
}

.tab.is-active {
  color: #f8f6ee;
  background: var(--teal);
}

.tab-panel {
  display: none;
}

.tab-panel.is-active {
  display: block;
}

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

.field {
  display: grid;
  gap: 8px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.44);
}

.field span,
.choice-group legend,
.switch-row span {
  color: var(--muted-ink);
  font-size: 0.9rem;
  font-weight: 500;
}

.field output {
  color: var(--ink);
  font-size: 1.05rem;
  font-weight: 500;
}

.field input[type="range"] {
  width: 100%;
  accent-color: var(--teal);
}

.field select {
  width: 100%;
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 10px;
  color: var(--ink);
  background: #fff;
}

.choice-group {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 14px 0 0;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.choice-group label {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  gap: 7px;
  padding: 0 12px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.48);
}

.choice-group input,
.switch-row input {
  accent-color: var(--teal);
}

.switch-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 14px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.44);
}

.switch-row input {
  width: 28px;
  height: 28px;
}

.medical-note {
  margin: 14px 0 0;
  color: #7d3c30;
  font-size: 0.92rem;
  line-height: 1.55;
}

.report-summary {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 12px;
}

.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
}

table {
  width: 100%;
  border-collapse: collapse;
  background: rgba(255, 255, 255, 0.36);
}

th,
td {
  padding: 11px 12px;
  border-bottom: 1px solid rgba(36, 49, 47, 0.12);
  text-align: left;
  white-space: nowrap;
}

th {
  color: var(--muted-ink);
  font-size: 0.86rem;
  font-weight: 500;
}

td {
  font-size: 0.96rem;
}

tbody tr:last-child td {
  border-bottom: 0;
}

#clearReportsButton {
  margin-top: 12px;
  background: var(--coral);
}

.rest-screen {
  background: rgba(20, 31, 30, 0.36);
  backdrop-filter: blur(5px);
}

.rest-card {
  display: grid;
  place-items: center;
  gap: 8px;
  width: min(430px, 100%);
  padding: 24px;
  text-align: center;
}

.rest-dino {
  width: 160px;
  color: var(--leaf);
  fill: currentColor;
}

.rest-card h2 {
  margin: 0;
  font-size: 1.6rem;
  font-weight: 500;
}

.rest-card p {
  margin: 0 0 8px;
  color: var(--muted-ink);
  font-size: 1.12rem;
}

@keyframes drift {
  from {
    transform: translateX(-10px);
  }
  to {
    transform: translateX(24px);
  }
}

@keyframes driftSmall {
  from {
    transform: translateX(-10px) scale(0.78);
  }
  to {
    transform: translateX(24px) scale(0.78);
  }
}

@keyframes eggWiggle {
  0%,
  100% {
    transform: translate(-50%, -50%) rotate(-1.5deg);
  }
  50% {
    transform: translate(-50%, -50%) rotate(2deg);
  }
}

@keyframes shake {
  0%,
  100% {
    transform: translate(-50%, -50%);
  }
  25% {
    transform: translate(calc(-50% - 8px), -50%);
  }
  75% {
    transform: translate(calc(-50% + 8px), -50%);
  }
}

@keyframes leafFall {
  from {
    transform: translate(-50%, -84px) rotate(-6deg);
  }
  to {
    transform: translate(-50%, var(--fall-distance)) rotate(18deg);
  }
}

@keyframes pop {
  from {
    opacity: 1;
    transform: translate(-50%, -50%) scale(0.5);
  }
  to {
    opacity: 0;
    transform: translate(-50%, -120%) scale(2.1);
  }
}

@media (max-width: 1030px) {
  .session-panel {
    grid-template-columns: 1fr;
  }

  .game-selector {
    order: 3;
  }
}

@media (max-width: 760px) {
  .topbar {
    padding-inline: 10px;
  }

  .brand-mark {
    width: 44px;
    height: 44px;
  }

  .brand-text span {
    display: none;
  }

  .training-shell {
    padding-inline: 10px;
  }

  .metrics {
    min-width: 0;
  }

  .game-selector {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .game-choice {
    min-height: 50px;
  }

  .egg {
    width: 92px;
    height: 116px;
  }

  .star-target {
    width: 82px;
    height: 82px;
  }

  .star-target::before {
    width: 68px;
    height: 68px;
  }

  .ptero-dragger {
    width: 112px;
    height: 82px;
  }

  .fossil-board {
    inset: 5% 5% 10%;
  }

  .fossil-slot,
  .fossil-piece {
    width: 108px;
    height: 82px;
  }

  .fossil-piece svg,
  .fossil-slot svg {
    width: 72px;
    height: 54px;
  }

  .dino-buddy {
    width: 170px;
  }

  .form-grid,
  .report-summary {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 480px) {
  body {
    overflow-x: hidden;
    overflow-y: auto;
  }

  .app {
    min-height: 100dvh;
  }

  .topbar {
    gap: 8px;
    padding: calc(8px + var(--safe-top)) 8px 8px;
  }

  .brand {
    gap: 7px;
  }

  .brand-mark {
    width: 40px;
    height: 40px;
  }

  .brand-text strong {
    font-size: 0.98rem;
  }

  .top-actions {
    gap: 5px;
  }

  .icon-button {
    width: 44px;
    height: 44px;
  }

  .training-shell {
    grid-template-rows: auto minmax(340px, 1fr);
    gap: 8px;
    padding: 0 8px calc(10px + var(--safe-bottom));
  }

  .session-panel {
    gap: 8px;
    padding: 8px;
  }

  .target-prompt {
    gap: 8px;
  }

  .training-preview {
    width: 44px;
    height: 56px;
  }

  .star-preview,
  .fossil-preview,
  .leaf-preview {
    width: 52px;
    height: 52px;
  }

  .task-text {
    font-size: 0.96rem;
  }

  .metrics {
    gap: 5px;
  }

  .metrics div {
    padding: 7px 8px;
  }

  .metrics strong {
    font-size: 1.04rem;
  }

  .game-choice {
    min-height: 48px;
    gap: 6px;
    padding: 0 8px;
    font-size: 0.9rem;
  }

  .game-symbol {
    width: 24px;
    height: 24px;
  }

  .scene {
    min-height: 340px;
  }

  .egg {
    width: 76px;
    height: 96px;
  }

  .star-target {
    width: 74px;
    height: 74px;
  }

  .star-target::before {
    width: 60px;
    height: 60px;
  }

  .ptero-dragger {
    width: 102px;
    height: 76px;
  }

  .fossil-slot,
  .fossil-piece {
    width: 94px;
    height: 72px;
  }

  .fossil-piece svg,
  .fossil-slot svg {
    width: 62px;
    height: 46px;
  }

  .dino-buddy {
    width: 130px;
    min-width: 130px;
  }

  .brachio-catcher {
    width: 138px;
    min-width: 138px;
  }

  .start-button {
    min-width: 0;
    width: min(220px, calc(100% - 64px));
    min-height: 64px;
    padding: 0 16px;
    font-size: 1.2rem;
  }
}

@media (max-width: 760px) and (max-height: 500px) and (orientation: landscape) {
  body {
    overflow-x: hidden;
    overflow-y: auto;
  }

  .app {
    min-height: 640px;
  }

  .training-shell {
    grid-template-rows: auto minmax(390px, 1fr);
  }

  .scene {
    min-height: 390px;
  }
}

@media (max-height: 620px) and (orientation: landscape) {
  .brand-mark {
    width: 40px;
    height: 40px;
  }

  .icon-button {
    width: 42px;
    height: 42px;
  }

  .session-panel {
    padding: 8px 10px;
  }

  .training-preview {
    width: 46px;
    height: 58px;
  }

  .star-preview,
  .fossil-preview,
  .leaf-preview {
    width: 54px;
    height: 54px;
  }

  .start-button {
    min-height: 62px;
    bottom: 7%;
  }

  .game-choice {
    min-height: 46px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .cloud,
  .egg,
  .leaf-target {
    animation: none;
  }

  .feedback,
  .egg,
  .fossil-piece {
    transition: none;
  }
}
