/* ============================================================
   光芽小院 · Sunbud Garden
   Original hand-drawn garden tower defense
   ============================================================ */

:root {
  --ink: #20382a;
  --ink-soft: #617563;
  --forest: #173f2e;
  --forest-2: #20563a;
  --leaf: #34704a;
  --leaf-light: #78a965;
  --cream: #fbf5e5;
  --cream-2: #f2e7cd;
  --paper: #f7ecd4;
  --paper-deep: #e7d5b1;
  --sun: #efad2f;
  --sun-light: #ffd967;
  --berry: #c95456;
  --line: rgba(40, 62, 43, 0.16);
  --shadow: 0 20px 60px rgba(29, 46, 31, 0.18);
  --font-display: "Iowan Old Style", "Palatino Linotype", "Book Antiqua", Georgia, "Songti SC", "STSong", serif;
  --font-sans: "Avenir Next", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Segoe UI", sans-serif;
  --ease-out: cubic-bezier(0.2, 0.75, 0.24, 1);
  --ease-spring: cubic-bezier(0.34, 1.46, 0.64, 1);
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  background: #142f23;
}

body {
  margin: 0;
  color: var(--ink);
  font-family: var(--font-sans);
  background: #142f23;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overscroll-behavior: none;
}

button,
input,
select {
  font: inherit;
}

button {
  color: inherit;
  -webkit-tap-highlight-color: transparent;
}

button:focus-visible {
  outline: 3px solid rgba(255, 205, 85, 0.95);
  outline-offset: 3px;
}

svg {
  display: block;
}

.hidden {
  display: none !important;
}

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

.screen {
  position: relative;
  width: 100%;
  min-height: 100vh;
  min-height: 100dvh;
}

/* ============================================================
   Shared bits
   ============================================================ */

.eyebrow {
  margin: 0;
  color: var(--leaf);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.22em;
  line-height: 1.5;
  text-transform: uppercase;
}

.eyebrow-small {
  margin: 0 0 3px;
  color: var(--ink-soft);
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.2em;
}

.eyebrow-line {
  display: inline-block;
  width: 34px;
  height: 1px;
  margin-right: 10px;
  vertical-align: 3px;
  background: currentColor;
  opacity: 0.55;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 44px;
  padding: 0 21px;
  border: 1.5px solid transparent;
  border-radius: 999px;
  font-size: 14px;
  font-weight: 800;
  letter-spacing: 0.02em;
  text-decoration: none;
  cursor: pointer;
  transition: transform 180ms var(--ease-out), background 180ms ease, box-shadow 180ms ease, color 180ms ease;
}

.btn:hover {
  transform: translateY(-2px);
}

.btn:active {
  transform: translateY(0) scale(0.985);
}

.btn-primary {
  color: #fff9e7;
  background:
    radial-gradient(circle at 18% 0%, rgba(255, 255, 255, 0.19), transparent 33%),
    linear-gradient(145deg, #2c643f, #183e2b);
  border-color: rgba(26, 58, 39, 0.75);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.18),
    0 8px 0 rgba(19, 45, 29, 0.9),
    0 15px 25px rgba(18, 51, 31, 0.23);
}

.btn-primary:hover {
  background:
    radial-gradient(circle at 18% 0%, rgba(255, 255, 255, 0.24), transparent 33%),
    linear-gradient(145deg, #35784b, #1b472f);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.22),
    0 6px 0 rgba(19, 45, 29, 0.95),
    0 14px 26px rgba(18, 51, 31, 0.26);
}

.btn-primary:active {
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.16),
    0 2px 0 rgba(19, 45, 29, 0.95);
}

.btn-ghost {
  color: var(--ink);
  background: rgba(251, 245, 229, 0.48);
  border-color: rgba(43, 70, 49, 0.26);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.5);
  backdrop-filter: blur(10px);
}

.btn-ghost:hover {
  background: rgba(251, 245, 229, 0.8);
}

.btn-lg {
  min-height: 54px;
  padding: 0 27px;
  font-size: 15px;
}

.btn-arrow {
  display: grid;
  width: 25px;
  height: 25px;
  margin-left: 3px;
  place-items: center;
  border-radius: 50%;
  color: var(--forest);
  background: var(--sun-light);
  font-family: Georgia, serif;
  font-size: 15px;
  font-weight: 400;
  transition: transform 180ms var(--ease-out);
}

.btn-primary:hover .btn-arrow {
  transform: translateX(3px);
}

.text-button {
  padding: 8px 3px;
  border: 0;
  color: var(--ink-soft);
  background: transparent;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  text-decoration: underline;
  text-decoration-color: rgba(32, 56, 42, 0.2);
  text-underline-offset: 4px;
  transition: color 160ms ease;
}

.text-button:hover {
  color: var(--ink);
}

.btn-danger-ghost {
  flex: 0 0 auto;
  min-height: 38px;
  padding: 0 15px;
  border: 1px solid rgba(146, 62, 54, 0.27);
  border-radius: 999px;
  color: #8e433d;
  background: rgba(255, 250, 239, 0.85);
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
  transition: background 160ms ease, color 160ms ease;
}

.btn-danger-ghost:hover {
  color: #fff7e7;
  background: #a65049;
}

.btn-danger-ghost.armed {
  color: #fff7e7;
  border-color: #8e3d38;
  background: #a65049;
}

.icon-button {
  display: grid;
  width: 40px;
  height: 40px;
  padding: 0;
  place-items: center;
  border: 1px solid rgba(40, 68, 47, 0.24);
  border-radius: 50%;
  color: var(--ink);
  background: rgba(251, 245, 229, 0.55);
  cursor: pointer;
  backdrop-filter: blur(8px);
  transition: background 160ms ease, transform 160ms var(--ease-out);
}

.icon-button:hover {
  background: rgba(251, 245, 229, 0.92);
  transform: translateY(-1px);
}

.icon-button svg {
  width: 19px;
  height: 19px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}

#menuSoundBtn .sound-off-icon {
  display: none;
}

#menuSoundBtn.muted .sound-on-icon {
  display: none;
}

#menuSoundBtn.muted .sound-off-icon {
  display: block;
}

/* ============================================================
   Main menu
   ============================================================ */

.menu-screen {
  display: flex;
  flex-direction: column;
  overflow: hidden auto;
  background:
    radial-gradient(circle at 82% 13%, rgba(255, 226, 147, 0.8), transparent 26%),
    linear-gradient(145deg, #e7dcc0 0%, #c1d0a3 48%, #5e8569 100%);
  isolation: isolate;
}

#menuCanvas {
  position: absolute;
  z-index: -3;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.menu-vignette {
  position: absolute;
  z-index: -2;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(90deg, rgba(243, 237, 216, 0.91) 0%, rgba(243, 237, 216, 0.66) 31%, rgba(243, 237, 216, 0.06) 58%, rgba(23, 50, 36, 0.1) 100%),
    linear-gradient(180deg, rgba(239, 235, 214, 0.55) 0%, transparent 25%, transparent 60%, rgba(22, 49, 33, 0.52) 100%);
}

.menu-vignette::after {
  content: "";
  position: absolute;
  inset: 0;
  opacity: 0.26;
  mix-blend-mode: multiply;
  background-image:
    radial-gradient(rgba(44, 60, 38, 0.28) 0.55px, transparent 0.7px),
    radial-gradient(rgba(255, 255, 255, 0.4) 0.5px, transparent 0.7px);
  background-position: 0 0, 4px 7px;
  background-size: 9px 9px, 13px 13px;
  pointer-events: none;
}

.site-header {
  position: relative;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  max-width: 1460px;
  margin: 0 auto;
  padding: 22px clamp(22px, 4vw, 58px) 10px;
  pointer-events: none;
}

.site-header > * {
  pointer-events: auto;
}

.mini-brand {
  display: inline-flex;
  align-items: center;
  gap: 11px;
}

.brand-mark {
  position: relative;
  display: block;
  width: 36px;
  height: 36px;
  border: 1px solid rgba(31, 64, 43, 0.38);
  border-radius: 50%;
  background: rgba(251, 245, 229, 0.3);
}

.brand-mark i {
  position: absolute;
  width: 11px;
  height: 17px;
  border-radius: 100% 0 100% 0;
  background: #2e6744;
  transform-origin: 50% 100%;
}

.brand-mark i:nth-child(1) {
  left: 12px;
  top: 4px;
  transform: rotate(-27deg);
}

.brand-mark i:nth-child(2) {
  left: 17px;
  top: 8px;
  background: #5d8a55;
  transform: rotate(48deg) scale(0.83);
}

.brand-mark b {
  position: absolute;
  left: 17px;
  bottom: 8px;
  width: 1.5px;
  height: 15px;
  border-radius: 2px;
  background: #27563a;
  transform: rotate(7deg);
}

.brand-word {
  display: flex;
  flex-direction: column;
  color: var(--ink);
  font-family: var(--font-display);
  font-size: 19px;
  font-weight: 800;
  letter-spacing: 0.11em;
  line-height: 1.06;
}

.brand-word small {
  margin-top: 4px;
  color: rgba(32, 56, 42, 0.55);
  font-family: var(--font-sans);
  font-size: 7px;
  font-weight: 900;
  letter-spacing: 0.24em;
}

.site-actions {
  display: flex;
  gap: 8px;
}

.menu-main {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  width: 100%;
  max-width: 1460px;
  margin: 0 auto;
  padding: clamp(8px, 2.6vh, 34px) clamp(22px, 5.5vw, 88px);
  flex: 1 1 auto;
}

.hero-copy {
  width: min(640px, 56vw);
  animation: hero-in 900ms var(--ease-out) both;
}

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

.hero-eyebrow {
  display: flex;
  align-items: center;
  gap: 2px;
  margin-bottom: 14px;
  color: #476b4d;
  font-size: 10px;
  letter-spacing: 0.2em;
}

.hero-title {
  position: relative;
  width: fit-content;
  margin: 0;
  color: #183d2b;
}

.hero-title::before {
  content: "";
  position: absolute;
  z-index: -1;
  top: -52px;
  right: -88px;
  width: 160px;
  height: 160px;
  border-radius: 50%;
  opacity: 0.6;
  background: repeating-conic-gradient(from 0deg, rgba(255, 208, 84, 0.38) 0deg 3deg, transparent 3deg 13deg);
  -webkit-mask: radial-gradient(circle, transparent 0 37%, #000 38% 50%, transparent 51%);
  mask: radial-gradient(circle, transparent 0 37%, #000 38% 50%, transparent 51%);
  animation: sun-turn 34s linear infinite;
}

@keyframes sun-turn {
  to { transform: rotate(360deg); }
}

.title-cn {
  display: block;
  font-family: var(--font-display);
  font-size: clamp(66px, 8.4vw, 120px);
  font-weight: 800;
  letter-spacing: 0.055em;
  line-height: 0.95;
  text-shadow:
    0 1px 0 rgba(255, 255, 255, 0.64),
    0 12px 34px rgba(51, 79, 49, 0.16);
}

.title-cn::after {
  content: "";
  display: block;
  width: 42%;
  height: 10px;
  margin-top: 4px;
  border-radius: 50%;
  opacity: 0.34;
  background: radial-gradient(ellipse at center, #f4b32e 0 40%, transparent 72%);
}

.title-en {
  display: block;
  margin-top: 11px;
  color: rgba(31, 60, 42, 0.66);
  font-family: var(--font-sans);
  font-size: clamp(8px, 0.9vw, 11px);
  font-weight: 900;
  letter-spacing: 0.52em;
}

.hero-lead {
  margin: 23px 0 0;
  color: #4b624f;
  font-family: var(--font-display);
  font-size: clamp(15px, 1.45vw, 19px);
  font-weight: 500;
  letter-spacing: 0.055em;
  line-height: 1.9;
}

.hero-actions {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-top: 27px;
}

.save-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 19px;
  color: rgba(47, 74, 53, 0.66);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.save-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #7b9760;
  box-shadow: 0 0 0 3px rgba(78, 111, 69, 0.12);
}

.hero-tip {
  display: none;
  align-self: flex-end;
  width: 205px;
  margin: 0 0 42px auto;
  padding: 18px 21px;
  border-left: 1px solid rgba(36, 65, 43, 0.25);
  color: rgba(31, 55, 39, 0.64);
  font-family: var(--font-display);
  font-size: 13px;
  font-weight: 600;
  line-height: 1.72;
  letter-spacing: 0.03em;
  transform: rotate(-1.5deg);
  animation: tip-in 1s 250ms var(--ease-out) both;
}

@keyframes tip-in {
  from { opacity: 0; transform: translateX(12px) rotate(-1.5deg); }
  to { opacity: 1; transform: translateX(0) rotate(-1.5deg); }
}

.hero-tip-no {
  display: block;
  margin-bottom: 9px;
  color: rgba(37, 63, 42, 0.42);
  font-family: var(--font-sans);
  font-size: 7px;
  font-weight: 900;
  letter-spacing: 0.25em;
}

.hero-tip p {
  margin: 0;
}

.hero-tip-scribble {
  display: block;
  width: 49px;
  height: 8px;
  margin-top: 10px;
  border-top: 1px solid rgba(47, 80, 50, 0.35);
  border-radius: 50%;
  transform: rotate(-4deg);
}

/* Level dock */

.level-dock {
  position: relative;
  z-index: 4;
  width: min(calc(100% - clamp(48px, 9vw, 180px)), 1180px);
  margin: 0 auto;
  padding: 18px 22px 21px;
  border: 1px solid rgba(255, 255, 255, 0.46);
  border-radius: 26px;
  background:
    linear-gradient(135deg, rgba(255, 252, 242, 0.92), rgba(236, 225, 196, 0.88)),
    rgba(250, 243, 226, 0.9);
  box-shadow:
    0 22px 55px rgba(20, 45, 30, 0.23),
    inset 0 1px 0 rgba(255, 255, 255, 0.8);
  backdrop-filter: blur(22px) saturate(1.1);
  animation: dock-in 800ms 120ms var(--ease-out) both;
}

@keyframes dock-in {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}

.dock-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 12px;
  padding: 0 3px;
}

.dock-heading h2 {
  margin: 0;
  color: #243f2e;
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 800;
  letter-spacing: 0.08em;
  line-height: 1.2;
}

.dock-note {
  margin: 0;
  color: rgba(53, 78, 57, 0.55);
  font-size: 10px;
  font-weight: 600;
  line-height: 1.6;
  letter-spacing: 0.025em;
  text-align: right;
}

.dock-heading-side {
  display: flex;
  align-items: flex-end;
  gap: 15px;
}

.level-list {
  display: grid;
  width: 100%;
  min-width: 0;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.level-card {
  position: relative;
  display: block;
  width: auto;
  max-width: 100%;
  min-width: 0;
  padding: 0;
  overflow: hidden;
  border: 1px solid rgba(81, 62, 39, 0.2);
  border-radius: 17px;
  color: var(--ink);
  background: #f8eed8;
  text-align: left;
  cursor: pointer;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.7);
  transition: transform 210ms var(--ease-out), box-shadow 210ms ease, border-color 210ms ease;
}

.level-card::after {
  content: "";
  position: absolute;
  inset: 0;
  border: 1px solid rgba(255, 255, 255, 0.35);
  border-radius: inherit;
  pointer-events: none;
}

.level-card:hover:not(.locked) {
  z-index: 2;
  border-color: rgba(44, 85, 55, 0.4);
  box-shadow: 0 12px 24px rgba(32, 56, 39, 0.15), inset 0 1px 0 rgba(255, 255, 255, 0.8);
  transform: translateY(-3px);
}

.level-card:active:not(.locked) {
  transform: translateY(-1px) scale(0.995);
}

.level-card.locked {
  cursor: not-allowed;
}

.level-card.locked .level-thumb {
  filter: grayscale(0.8) brightness(0.78);
}

.level-card.locked .level-card-body {
  opacity: 0.62;
}

.level-thumb-wrap {
  position: relative;
  display: block;
  height: 76px;
  overflow: hidden;
  background: linear-gradient(135deg, #b8d19a, #5f8d68);
}

.level-thumb {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 500ms var(--ease-out);
}

.level-card:hover .level-thumb {
  transform: scale(1.035);
}

.level-thumb-wrap::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(25, 49, 31, 0.18), transparent 37%, rgba(33, 53, 36, 0.28));
  pointer-events: none;
}

.level-topline {
  position: absolute;
  z-index: 2;
  top: 9px;
  left: 11px;
  right: 11px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: rgba(255, 251, 232, 0.9);
  font-size: 8px;
  font-weight: 900;
  letter-spacing: 0.19em;
  text-shadow: 0 1px 6px rgba(17, 35, 22, 0.3);
}

.level-number {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.level-number::before {
  content: "";
  width: 15px;
  height: 1px;
  background: currentColor;
  opacity: 0.65;
}

.level-stars {
  display: inline-flex;
  gap: 1px;
  font-family: Georgia, serif;
  font-size: 11px;
  letter-spacing: 0;
  text-shadow: 0 1px 4px rgba(20, 40, 25, 0.25);
}

.level-stars .lit {
  color: #ffe08b;
}

.level-stars .dim {
  color: rgba(255, 255, 255, 0.28);
}

.level-card-body {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  gap: 8px;
  padding: 10px 13px 11px;
}

.level-card-copy {
  display: block;
  min-width: 0;
}

.level-title {
  display: block;
  margin: 0;
}

.level-text {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.new-seed-goal {
  color: #7d5b1d;
  border-color: rgba(177, 127, 36, 0.22) !important;
  background: rgba(240, 190, 74, 0.11) !important;
}

body.in-game,
body.modal-open {
  overflow: hidden;
}

.level-card h3,
.level-title {
  margin: 0;
  font-family: var(--font-display);
  font-size: 17px;
  font-weight: 800;
  letter-spacing: 0.06em;
  line-height: 1.3;
}

.level-card p,
.level-text {
  margin: 3px 0 0;
  overflow: hidden;
  color: rgba(50, 72, 52, 0.58);
  font-size: 9.5px;
  font-weight: 600;
  letter-spacing: 0.015em;
  line-height: 1.5;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.level-state {
  display: flex;
  align-items: center;
  gap: 4px;
  min-height: 21px;
  padding: 0 8px;
  border-radius: 999px;
  color: #4c6d4e;
  background: rgba(62, 95, 61, 0.08);
  font-size: 8px;
  font-weight: 900;
  letter-spacing: 0.08em;
  white-space: nowrap;
}

.level-state.ready {
  color: #764f18;
  background: rgba(240, 181, 61, 0.16);
}

.level-state.done {
  color: #3c6c46;
  background: rgba(72, 117, 66, 0.12);
}

.level-state.locked-state {
  color: rgba(55, 74, 56, 0.6);
}

.level-state svg {
  width: 10px;
  height: 10px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.lock-ribbon {
  position: absolute;
  z-index: 3;
  top: 31px;
  left: 50%;
  display: flex;
  width: 25px;
  height: 25px;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  color: #f8efd9;
  background: rgba(26, 49, 32, 0.7);
  transform: translateX(-50%);
  backdrop-filter: blur(3px);
}

.lock-ribbon svg {
  width: 11px;
  height: 11px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
}

.menu-footer {
  position: relative;
  z-index: 4;
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  max-width: 1460px;
  margin: 0 auto;
  padding: 12px clamp(22px, 5vw, 58px) 16px;
  color: rgba(241, 239, 218, 0.55);
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.035em;
}

.menu-footer p {
  margin: 0;
}

.footer-hint {
  display: flex;
  align-items: center;
  gap: 7px;
}

.pulse-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: #d6c88c;
  box-shadow: 0 0 0 0 rgba(214, 200, 140, 0.5);
  animation: pulse-dot 2.4s ease-out infinite;
}

@keyframes pulse-dot {
  0% { box-shadow: 0 0 0 0 rgba(214, 200, 140, 0.45); }
  65%, 100% { box-shadow: 0 0 0 6px rgba(214, 200, 140, 0); }
}

/* ============================================================
   Game screen & HUD
   ============================================================ */

.game-screen {
  position: relative;
  display: flex;
  height: 100vh;
  height: 100dvh;
  flex-direction: column;
  gap: 7px;
  overflow: hidden;
  padding: 10px clamp(10px, 1.8vw, 24px) max(7px, env(safe-area-inset-bottom));
  background:
    radial-gradient(circle at 12% 4%, rgba(74, 128, 87, 0.26), transparent 30%),
    radial-gradient(circle at 88% 96%, rgba(224, 181, 91, 0.06), transparent 32%),
    linear-gradient(150deg, #0f2b1e, #173b29 58%, #102b1e);
}

.game-screen::before {
  content: "";
  position: absolute;
  inset: 0;
  opacity: 0.16;
  pointer-events: none;
  background-image:
    radial-gradient(rgba(255, 247, 221, 0.24) 0.6px, transparent 0.7px),
    radial-gradient(rgba(0, 0, 0, 0.2) 0.5px, transparent 0.7px);
  background-position: 0 0, 5px 8px;
  background-size: 12px 12px, 16px 16px;
}

.game-hud {
  position: relative;
  z-index: 30;
  display: flex;
  width: min(100%, 1490px);
  min-height: 86px;
  margin: 0 auto;
  padding: 7px 9px;
  align-items: center;
  gap: 9px;
  border: 1px solid #d1bc8d;
  border-radius: 19px;
  background:
    linear-gradient(180deg, rgba(255, 251, 238, 0.99), rgba(237, 223, 193, 0.99)),
    #f5e9cf;
  box-shadow:
    0 12px 28px rgba(0, 0, 0, 0.26),
    inset 0 1px 0 rgba(255, 255, 255, 0.9),
    inset 0 -1px 0 rgba(105, 79, 44, 0.13);
}

.hud-meta {
  display: flex;
  width: 132px;
  flex: 0 0 132px;
  flex-direction: column;
  gap: 2px;
  padding: 0 9px 0 7px;
}

.hud-eyebrow {
  color: #75856d;
  font-size: 8px;
  font-weight: 900;
  letter-spacing: 0.19em;
}

.hud-meta strong {
  overflow: hidden;
  color: #233d2b;
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 800;
  letter-spacing: 0.06em;
  line-height: 1.2;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sun-bank {
  position: relative;
  display: flex;
  width: 100px;
  height: 66px;
  flex: 0 0 100px;
  align-items: center;
  gap: 7px;
  padding: 0 9px;
  border: 1px solid rgba(25, 56, 36, 0.5);
  border-radius: 14px;
  color: #fff7dd;
  background:
    radial-gradient(circle at 23% 12%, rgba(255, 231, 156, 0.14), transparent 35%),
    linear-gradient(150deg, #2a5b3d, #173c2a);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.13),
    0 3px 0 rgba(58, 72, 46, 0.16);
}

.sun-bank.bump {
  animation: sun-bump 330ms var(--ease-spring);
}

@keyframes sun-bump {
  0% { transform: scale(1); }
  35% { transform: scale(1.065) rotate(-1.5deg); }
  70% { transform: scale(0.985); }
  100% { transform: scale(1); }
}

.sun-bank-copy {
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: 1px;
}

.sun-bank-copy small {
  color: rgba(255, 247, 220, 0.62);
  font-size: 8px;
  font-weight: 700;
  letter-spacing: 0.13em;
}

.sun-bank-copy strong {
  font-family: var(--font-display);
  font-size: 23px;
  font-variant-numeric: tabular-nums;
  font-weight: 800;
  letter-spacing: 0.01em;
  line-height: 1;
}

.sun-bank-copy strong.large {
  font-size: 18px;
  letter-spacing: -0.035em;
}

.sun-glyph {
  position: relative;
  display: block;
  width: 28px;
  height: 28px;
  flex: 0 0 28px;
  border-radius: 50%;
  background:
    radial-gradient(circle at 38% 32%, #fffef1 0 12%, #ffe690 34%, #ffa845 70%, #ea6a32);
  box-shadow:
    0 0 0 1px rgba(112, 52, 15, 0.36),
    0 0 16px rgba(255, 153, 69, 0.48),
    inset -2px -3px 5px rgba(151, 65, 25, 0.24);
}

.sun-glyph::before {
  content: "";
  position: absolute;
  inset: -5px;
  border-radius: 50%;
  opacity: 0.7;
  background: repeating-conic-gradient(from 8deg, rgba(255, 166, 85, 0.8) 0deg 7deg, transparent 7deg 42deg);
  -webkit-mask: radial-gradient(circle, transparent 0 59%, #000 60% 74%, transparent 75%);
  mask: radial-gradient(circle, transparent 0 59%, #000 60% 74%, transparent 75%);
  animation: sun-turn 28s linear infinite reverse;
}

.sun-glyph i {
  position: absolute;
  top: 10px;
  left: 9px;
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: rgba(116, 72, 13, 0.62);
  box-shadow: 8px 0 0 rgba(116, 72, 13, 0.62);
}

.sun-glyph b {
  position: absolute;
  top: 16px;
  left: 12px;
  width: 6px;
  height: 3px;
  border-bottom: 1.2px solid rgba(116, 72, 13, 0.56);
  border-radius: 0 0 50% 50%;
}

.sun-pop {
  position: absolute;
  top: -3px;
  right: 3px;
  color: #ffd294;
  font-family: var(--font-display);
  font-size: 11px;
  font-weight: 800;
  opacity: 0;
  pointer-events: none;
}

.sun-pop.show {
  animation: sun-float 760ms var(--ease-out) both;
}

@keyframes sun-float {
  0% { opacity: 0; transform: translateY(5px) scale(0.8); }
  20% { opacity: 1; }
  75% { opacity: 1; }
  100% { opacity: 0; transform: translateY(-17px) scale(0.95); }
}

.seed-bank {
  display: flex;
  min-width: 0;
  flex: 1 1 auto;
  align-items: stretch;
  gap: 6px;
  overflow-x: auto;
  overflow-y: hidden;
  padding: 2px 1px 4px;
  scrollbar-width: thin;
  scrollbar-color: rgba(91, 112, 72, 0.4) transparent;
}

.seed-bank::-webkit-scrollbar {
  height: 4px;
}

.seed-bank::-webkit-scrollbar-thumb {
  border-radius: 9px;
  background: rgba(91, 112, 72, 0.35);
}

.seed-card {
  position: relative;
  width: 91px;
  height: 70px;
  flex: 0 0 91px;
  padding: 0;
  overflow: hidden;
  border: 1.5px solid #a79368;
  border-radius: 12px;
  color: var(--ink);
  background:
    radial-gradient(circle at 83% 8%, rgba(255, 255, 255, 0.7), transparent 28%),
    linear-gradient(155deg, #fffaf0, #eee0c4);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.8),
    0 2px 0 rgba(110, 86, 48, 0.13);
  cursor: pointer;
  text-align: left;
  transition: transform 160ms var(--ease-out), border-color 160ms ease, box-shadow 160ms ease;
}

.seed-card:hover {
  border-color: #6e8c5c;
  transform: translateY(-1px);
}

.seed-card.selected {
  z-index: 2;
  border-color: #264f34;
  background:
    radial-gradient(circle at 83% 8%, rgba(255, 244, 189, 0.86), transparent 35%),
    linear-gradient(155deg, #fffcef, #f5e5a9);
  box-shadow:
    0 0 0 2px rgba(246, 190, 65, 0.55),
    0 6px 15px rgba(28, 61, 37, 0.22);
  transform: translateY(-3px);
}

.seed-card.selected::after {
  content: "";
  position: absolute;
  inset: 4px;
  border: 1px dashed rgba(78, 113, 65, 0.25);
  border-radius: 8px;
  pointer-events: none;
}

.seed-card.dim {
  opacity: 0.68;
  filter: saturate(0.7);
}

.seed-card.shake {
  animation: card-shake 320ms ease;
}

@keyframes card-shake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-4px) rotate(-1deg); }
  45% { transform: translateX(4px) rotate(1deg); }
  70% { transform: translateX(-2px); }
}

.seed-cost {
  position: absolute;
  z-index: 3;
  top: 5px;
  left: 5px;
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 1px 5px 1px 2px;
  border-radius: 7px;
  color: #5d4a24;
  background: rgba(255, 252, 239, 0.86);
  box-shadow: 0 1px 2px rgba(74, 56, 25, 0.08);
  font-size: 11px;
  font-variant-numeric: tabular-nums;
  font-weight: 900;
  line-height: 1.5;
}

.cost-sun {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: radial-gradient(circle at 38% 35%, #fffdf0, #ffe28b 42%, #ffa748 72%, #ea6b34);
  box-shadow: 0 0 0 0.5px rgba(132, 67, 22, 0.38);
}

.seed-art {
  position: absolute;
  z-index: 1;
  top: 2px;
  right: 1px;
  width: 53px;
  height: 53px;
  pointer-events: none;
}

.seed-name {
  position: absolute;
  z-index: 3;
  bottom: 5px;
  left: 7px;
  max-width: calc(100% - 24px);
  overflow: hidden;
  color: #344b38;
  font-size: 10.5px;
  font-weight: 800;
  letter-spacing: 0.015em;
  line-height: 1.25;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.seed-key {
  position: absolute;
  z-index: 3;
  right: 5px;
  bottom: 5px;
  display: grid;
  width: 13px;
  height: 13px;
  place-items: center;
  border: 1px solid rgba(57, 78, 48, 0.18);
  border-radius: 4px;
  color: rgba(55, 76, 48, 0.52);
  background: rgba(255, 252, 242, 0.66);
  font-size: 7px;
  font-weight: 900;
}

.cool-mask {
  position: absolute;
  z-index: 2;
  right: 0;
  bottom: 0;
  left: 0;
  height: 0%;
  background:
    repeating-linear-gradient(135deg, rgba(32, 59, 38, 0.55) 0 4px, rgba(34, 62, 40, 0.5) 4px 8px);
  opacity: 0.84;
  pointer-events: none;
}

.cool-time {
  position: absolute;
  z-index: 4;
  top: 50%;
  left: 50%;
  display: none;
  padding: 2px 6px;
  border-radius: 7px;
  color: #fff8e3;
  background: rgba(24, 47, 30, 0.82);
  font-size: 11px;
  font-weight: 900;
  font-variant-numeric: tabular-nums;
  transform: translate(-50%, -50%);
}

.seed-card.cooling .cool-time {
  display: block;
}

.hud-tools {
  display: flex;
  flex: 0 0 auto;
  align-items: stretch;
  gap: 5px;
  padding-left: 4px;
  border-left: 1px solid rgba(75, 94, 62, 0.15);
}

.tool-button {
  display: flex;
  width: 49px;
  min-height: 64px;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 4px;
  border: 1px solid rgba(83, 103, 70, 0.28);
  border-radius: 12px;
  color: #45583d;
  background: rgba(255, 251, 240, 0.5);
  font-size: 8px;
  font-weight: 800;
  letter-spacing: 0.05em;
  cursor: pointer;
  transition: background 160ms ease, color 160ms ease, transform 160ms var(--ease-out), border-color 160ms ease;
}

.tool-button:hover {
  background: rgba(255, 252, 242, 0.95);
  transform: translateY(-1px);
}

.tool-button svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.tool-button.active {
  color: #fff8de;
  border-color: #244d32;
  background: linear-gradient(145deg, #3b704b, #244d32);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.17), 0 3px 0 rgba(29, 58, 36, 0.25);
}

/* Board */

.board-stage {
  position: relative;
  z-index: 2;
  display: flex;
  min-height: 0;
  flex: 1 1 auto;
  align-items: center;
  justify-content: center;
  padding: 1px 0;
  overflow: hidden;
}

.board-frame {
  position: relative;
  width: 100%;
  max-width: 1440px;
  border: 6px solid transparent;
  border-radius: 25px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.09), transparent 18%) padding-box,
    linear-gradient(140deg, #826341, #3d2b1b 53%, #765538) border-box;
  box-shadow:
    0 25px 60px rgba(2, 15, 8, 0.39),
    0 4px 0 rgba(12, 29, 18, 0.38),
    inset 0 1px 0 rgba(255, 239, 204, 0.28);
  transform: translateZ(0);
}

.board-frame::after {
  content: "";
  position: absolute;
  z-index: 2;
  inset: 0;
  border: 1px solid rgba(255, 238, 194, 0.16);
  border-radius: 19px;
  pointer-events: none;
}

#gameCanvas {
  display: block;
  width: 100%;
  height: 100%;
  border-radius: 18px;
  cursor: crosshair;
  touch-action: none;
}

#gameCanvas:focus,
#gameCanvas:focus-visible {
  outline: none;
}

#gameCanvas.pointer-grab {
  cursor: grab;
}

#gameCanvas.shovel-cursor {
  cursor: cell;
}

.stage-grain {
  position: absolute;
  z-index: 3;
  inset: 6px;
  border-radius: 18px;
  opacity: 0.17;
  mix-blend-mode: soft-light;
  pointer-events: none;
  background-image:
    radial-gradient(rgba(255, 255, 255, 0.32) 0.5px, transparent 0.6px),
    radial-gradient(rgba(0, 0, 0, 0.28) 0.5px, transparent 0.6px);
  background-position: 0 0, 4px 6px;
  background-size: 8px 8px, 11px 11px;
}

.wave-banner {
  position: absolute;
  z-index: 8;
  top: 14%;
  left: 50%;
  display: flex;
  min-width: 230px;
  padding: 9px 25px 11px;
  flex-direction: column;
  align-items: center;
  gap: 1px;
  border: 1px solid rgba(255, 225, 156, 0.34);
  border-radius: 4px;
  color: #fff5d8;
  background:
    radial-gradient(circle at 50% 0%, rgba(255, 225, 150, 0.15), transparent 65%),
    rgba(20, 45, 29, 0.91);
  box-shadow: 0 13px 35px rgba(7, 20, 11, 0.28);
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, -8px) scale(0.97);
  transition: opacity 360ms ease, transform 460ms var(--ease-out);
  backdrop-filter: blur(6px);
}

.wave-banner::before,
.wave-banner::after {
  content: "";
  position: absolute;
  top: 50%;
  width: 22px;
  height: 1px;
  background: rgba(255, 225, 156, 0.45);
}

.wave-banner::before { right: 100%; margin-right: 12px; }
.wave-banner::after { left: 100%; margin-left: 12px; }

.wave-banner.show {
  opacity: 1;
  transform: translate(-50%, 0) scale(1);
}

.wave-banner-kicker {
  color: #dfbf78;
  font-size: 8px;
  font-weight: 900;
  letter-spacing: 0.27em;
}

.wave-banner strong {
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 700;
  letter-spacing: 0.13em;
  white-space: nowrap;
}

.boss-track {
  position: absolute;
  z-index: 9;
  top: 12px;
  left: 50%;
  width: min(54%, 560px);
  padding: 8px 13px 9px;
  border: 1px solid rgba(255, 230, 179, 0.32);
  border-radius: 12px;
  color: #fff4d8;
  background: rgba(27, 34, 31, 0.82);
  box-shadow: 0 8px 24px rgba(5, 14, 8, 0.25);
  transform: translateX(-50%);
  backdrop-filter: blur(8px);
}

.boss-track-label {
  display: flex;
  justify-content: space-between;
  margin-bottom: 5px;
  color: rgba(255, 241, 207, 0.82);
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.06em;
}

.boss-track-label b {
  color: #efd16f;
  font-variant-numeric: tabular-nums;
}

.boss-track-bar {
  height: 5px;
  overflow: hidden;
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.34);
}

.boss-track-bar i {
  display: block;
  width: 100%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #9f4150, #e1775b 62%, #f5c862);
  box-shadow: 0 0 10px rgba(244, 160, 94, 0.45);
  transition: width 220ms ease;
}

.coach {
  position: absolute;
  z-index: 10;
  bottom: 15px;
  left: 16px;
  display: flex;
  width: min(430px, calc(100% - 32px));
  align-items: flex-start;
  gap: 9px;
  padding: 10px 34px 10px 12px;
  border: 1px solid rgba(255, 233, 178, 0.28);
  border-radius: 12px;
  color: #f9f1d8;
  background:
    linear-gradient(145deg, rgba(27, 58, 37, 0.95), rgba(17, 42, 26, 0.94));
  box-shadow: 0 12px 29px rgba(8, 21, 12, 0.28);
  opacity: 0;
  transform: translateY(7px);
  transition: opacity 260ms ease, transform 300ms var(--ease-out);
  backdrop-filter: blur(7px);
  pointer-events: none;
}

.coach.show {
  opacity: 1;
  transform: translateY(0);
}

.coach-mark {
  display: grid;
  width: 20px;
  height: 20px;
  flex: 0 0 20px;
  place-items: center;
  margin-top: 1px;
  border-radius: 50%;
  color: #4a431e;
  background: #f2cd6c;
  font-size: 10px;
}

.coach p {
  margin: 0;
  color: rgba(252, 244, 219, 0.91);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.025em;
  line-height: 1.6;
}

.coach-close {
  position: absolute;
  top: 6px;
  right: 7px;
  display: grid;
  width: 19px;
  height: 19px;
  padding: 0;
  place-items: center;
  border: 0;
  border-radius: 50%;
  color: rgba(251, 243, 218, 0.62);
  background: transparent;
  font-size: 14px;
  line-height: 1;
  cursor: pointer;
  pointer-events: auto;
}

.coach-close:hover {
  color: #fff4d8;
  background: rgba(255, 255, 255, 0.1);
}

.stage-toast {
  position: absolute;
  z-index: 11;
  top: 58px;
  right: 15px;
  max-width: 250px;
  padding: 8px 12px;
  border: 1px solid rgba(255, 237, 190, 0.28);
  border-radius: 10px;
  color: #fbf3dd;
  background: rgba(27, 57, 36, 0.9);
  box-shadow: 0 8px 22px rgba(5, 16, 9, 0.2);
  font-size: 10px;
  font-weight: 600;
  line-height: 1.5;
  opacity: 0;
  pointer-events: none;
  transform: translateY(-4px);
  transition: opacity 220ms ease, transform 220ms ease;
}

.stage-toast.show {
  opacity: 1;
  transform: translateY(0);
}

.game-bottom {
  position: relative;
  z-index: 20;
  display: flex;
  width: min(100%, 1480px);
  min-height: 28px;
  margin: 0 auto;
  align-items: center;
  justify-content: space-between;
  gap: 15px;
  padding: 0 4px;
  color: rgba(240, 237, 214, 0.6);
  font-size: 9px;
  letter-spacing: 0.03em;
}

.wave-status {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 10px;
}

.wave-count {
  color: rgba(242, 236, 209, 0.68);
  font-size: 9px;
  font-weight: 700;
  white-space: nowrap;
}

.wave-count b {
  color: #f1d47d;
  font-weight: 800;
}

.wave-track {
  display: flex;
  align-items: center;
  gap: 4px;
}

.wave-pip {
  display: block;
  width: 15px;
  height: 5px;
  border-radius: 5px;
  background: rgba(241, 238, 215, 0.16);
  transition: background 300ms ease, box-shadow 300ms ease;
}

.wave-pip.active {
  background: #f0cb66;
  box-shadow: 0 0 8px rgba(240, 203, 102, 0.45);
}

.wave-pip.done {
  background: rgba(185, 204, 146, 0.56);
}

.game-tip {
  margin: 0;
  overflow: hidden;
  color: rgba(239, 236, 211, 0.52);
  font-size: 9px;
  font-weight: 500;
  text-align: center;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mower-status {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 4px;
  white-space: nowrap;
}

.mower-status svg {
  width: 22px;
  height: 16px;
  margin-right: 1px;
  fill: none;
  stroke: rgba(246, 233, 196, 0.55);
  stroke-width: 1.3;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.mower-status b {
  color: #efd582;
  font-size: 10px;
  font-variant-numeric: tabular-nums;
}

.mower-status.empty {
  opacity: 0.46;
}

/* ============================================================
   Overlays
   ============================================================ */

.overlay {
  position: absolute;
  z-index: 80;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: clamp(14px, 3vw, 34px);
  background:
    radial-gradient(circle at 50% 40%, rgba(39, 81, 54, 0.18), transparent 55%),
    rgba(7, 24, 14, 0.7);
  backdrop-filter: blur(10px) saturate(0.85);
  animation: overlay-in 280ms ease both;
}

@keyframes overlay-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

.intro-card {
  display: grid;
  width: min(940px, 100%);
  max-height: calc(100dvh - 40px);
  overflow: hidden auto;
  grid-template-columns: minmax(0, 0.89fr) minmax(0, 1.11fr);
  border: 1px solid rgba(255, 245, 218, 0.57);
  border-radius: 24px;
  background: var(--cream);
  box-shadow:
    0 35px 100px rgba(2, 13, 7, 0.5),
    inset 0 1px 0 rgba(255, 255, 255, 0.9);
  animation: card-in 540ms var(--ease-out) both;
}

@keyframes card-in {
  from { opacity: 0; transform: translateY(14px) scale(0.985); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.intro-art {
  position: relative;
  min-height: 390px;
  overflow: hidden;
  background: #274d34;
}

.intro-art::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, transparent 50%, rgba(17, 39, 24, 0.33));
  pointer-events: none;
}

#introArt {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.level-stamp {
  position: absolute;
  z-index: 2;
  top: 19px;
  left: 20px;
  padding: 6px 10px;
  border: 1px solid rgba(255, 245, 215, 0.35);
  border-radius: 4px;
  color: rgba(255, 247, 223, 0.9);
  background: rgba(16, 38, 22, 0.36);
  font-size: 8px;
  font-weight: 900;
  letter-spacing: 0.23em;
  backdrop-filter: blur(5px);
}

.intro-copy {
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: clamp(26px, 4vw, 46px);
  background:
    radial-gradient(circle at 100% 0%, rgba(241, 195, 84, 0.11), transparent 35%),
    var(--cream);
}

.intro-copy .eyebrow {
  margin-bottom: 13px;
}

.intro-copy h2 {
  margin: 0;
  color: #223e2c;
  font-family: var(--font-display);
  font-size: clamp(28px, 3.3vw, 40px);
  font-weight: 800;
  letter-spacing: 0.045em;
  line-height: 1.22;
}

.intro-lore {
  margin: 15px 0 0;
  color: #5d705b;
  font-family: var(--font-display);
  font-size: 14px;
  font-weight: 500;
  letter-spacing: 0.035em;
  line-height: 1.8;
}

.intro-goals {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 19px 0 0;
  padding: 0;
  list-style: none;
}

.intro-goals li {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-height: 25px;
  padding: 0 9px;
  border: 1px solid rgba(79, 108, 70, 0.15);
  border-radius: 7px;
  color: #5d735a;
  background: rgba(72, 101, 57, 0.06);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.intro-goals li::before {
  content: "";
  width: 5px;
  height: 5px;
  border-radius: 50% 0 50% 50%;
  background: #8aa76b;
  transform: rotate(-24deg);
}

.intro-actions {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-top: 28px;
}

.orientation-tip {
  display: none;
  margin: 14px 0 0;
  color: #8a917d;
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.04em;
}

.board-rotate-tip {
  display: none;
}

.simple-card {
  width: min(460px, 100%);
  padding: clamp(28px, 4vw, 42px);
  border: 1px solid rgba(255, 243, 215, 0.48);
  border-radius: 23px;
  background:
    radial-gradient(circle at 90% 0%, rgba(238, 188, 73, 0.13), transparent 35%),
    var(--cream);
  box-shadow: 0 30px 80px rgba(2, 13, 7, 0.4);
  text-align: center;
  animation: card-in 500ms var(--ease-out) both;
}

.round-emblem {
  display: grid;
  width: 58px;
  height: 58px;
  margin: 0 auto 17px;
  place-items: center;
  border: 1px solid rgba(73, 104, 62, 0.18);
  border-radius: 50%;
  color: var(--leaf);
  background: rgba(74, 106, 60, 0.07);
}

.round-emblem svg {
  width: 35px;
  height: 35px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.5;
  stroke-linecap: round;
}

.simple-card h2 {
  margin: 8px 0 0;
  color: #223e2c;
  font-family: var(--font-display);
  font-size: 34px;
  font-weight: 800;
  letter-spacing: 0.06em;
}

.simple-copy {
  margin: 11px 0 0;
  color: #718070;
  font-size: 12px;
  line-height: 1.7;
}

.simple-actions {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 9px;
  margin-top: 25px;
}

.simple-actions .btn {
  width: 100%;
}

.result-card {
  width: min(520px, 100%);
  max-height: calc(100dvh - 30px);
  overflow: hidden auto;
  padding: 20px clamp(24px, 4vw, 43px) 29px;
  border: 1px solid rgba(255, 243, 215, 0.5);
  border-radius: 24px;
  background:
    radial-gradient(circle at 50% 0%, rgba(244, 195, 79, 0.2), transparent 31%),
    var(--cream);
  box-shadow: 0 32px 90px rgba(2, 13, 7, 0.47);
  text-align: center;
  animation: card-in 560ms var(--ease-spring) both;
}

.result-crest {
  width: 188px;
  height: 130px;
  margin: -4px auto 3px;
  overflow: hidden;
  border-radius: 50% 50% 45% 45%;
  background: #dce7c5;
}

#resultArt {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.result-card .eyebrow {
  margin-top: 8px;
}

.result-card h2 {
  margin: 8px 0 0;
  color: #213c29;
  font-family: var(--font-display);
  font-size: clamp(31px, 4vw, 40px);
  font-weight: 800;
  letter-spacing: 0.065em;
  line-height: 1.15;
}

.result-sub {
  margin: 9px 0 0;
  color: #71806e;
  font-family: var(--font-display);
  font-size: 12px;
  font-weight: 500;
  line-height: 1.6;
}

.result-stars {
  display: flex;
  min-height: 43px;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin: 13px 0 5px;
  color: rgba(87, 104, 74, 0.18);
  font-family: Georgia, "Songti SC", serif;
  font-size: 34px;
  letter-spacing: 0.02em;
}

.result-stars .star {
  display: inline-block;
  transform: scale(0.7) rotate(-7deg);
  opacity: 0;
}

.result-stars .star.lit {
  color: #edb631;
  text-shadow: 0 3px 0 rgba(161, 111, 25, 0.2);
}

.result-stars.play .star {
  animation: star-pop 510ms var(--ease-spring) forwards;
}

.result-stars.play .star:nth-child(2) { animation-delay: 120ms; }
.result-stars.play .star:nth-child(3) { animation-delay: 240ms; }

@keyframes star-pop {
  0% { opacity: 0; transform: scale(0.5) rotate(-12deg); }
  75% { opacity: 1; transform: scale(1.15) rotate(3deg); }
  100% { opacity: 1; transform: scale(1) rotate(0); }
}

.result-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  margin: 13px 0 21px;
  padding: 12px 0;
  border-top: 1px solid rgba(64, 88, 56, 0.12);
  border-bottom: 1px solid rgba(64, 88, 56, 0.12);
}

.result-stats > div {
  display: flex;
  flex-direction: column;
  gap: 4px;
  border-right: 1px solid rgba(64, 88, 56, 0.11);
}

.result-stats > div:last-child {
  border-right: 0;
}

.result-stats span {
  color: #86917c;
  font-size: 8px;
  font-weight: 700;
  letter-spacing: 0.06em;
}

.result-stats strong {
  color: #2c4834;
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

.result-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 9px;
}

.result-actions .text-button {
  width: 100%;
}

/* ============================================================
   Modals
   ============================================================ */

.modal-layer {
  position: fixed;
  z-index: 150;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px;
  background: rgba(8, 27, 16, 0.67);
  backdrop-filter: blur(11px);
  animation: overlay-in 220ms ease both;
}

.modal-card {
  position: relative;
  width: min(880px, 100%);
  max-height: min(90dvh, 880px);
  padding: clamp(22px, 3.6vw, 42px);
  overflow: hidden auto;
  border: 1px solid rgba(255, 247, 221, 0.62);
  border-radius: 25px;
  background:
    radial-gradient(circle at 95% 5%, rgba(244, 195, 79, 0.12), transparent 30%),
    linear-gradient(160deg, #fcf6e7, #f3e7ce);
  box-shadow: 0 30px 100px rgba(2, 13, 7, 0.42), inset 0 1px 0 rgba(255, 255, 255, 0.85);
  animation: card-in 400ms var(--ease-out) both;
}

.modal-close {
  position: absolute;
  z-index: 3;
  top: 15px;
  right: 16px;
  display: grid;
  width: 33px;
  height: 33px;
  padding: 0;
  place-items: center;
  border: 1px solid rgba(78, 95, 65, 0.17);
  border-radius: 50%;
  color: #687562;
  background: rgba(255, 252, 241, 0.64);
  font-size: 20px;
  font-weight: 300;
  line-height: 1;
  cursor: pointer;
  transition: background 160ms ease, color 160ms ease, transform 160ms var(--ease-out);
}

.modal-close:hover {
  color: #2e4835;
  background: rgba(255, 252, 241, 0.98);
  transform: rotate(5deg);
}

.modal-card .eyebrow {
  margin-bottom: 9px;
}

.modal-card > h2 {
  margin: 0;
  color: #233d2b;
  font-family: var(--font-display);
  font-size: clamp(27px, 4vw, 38px);
  font-weight: 800;
  letter-spacing: 0.05em;
  line-height: 1.25;
}

.how-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-top: 25px;
}

.how-step {
  position: relative;
  min-height: 188px;
  padding: 18px 17px;
  overflow: hidden;
  border: 1px solid rgba(74, 98, 62, 0.13);
  border-radius: 15px;
  background: rgba(255, 252, 243, 0.57);
}

.how-no {
  position: absolute;
  top: 12px;
  right: 13px;
  color: rgba(59, 81, 53, 0.27);
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 700;
  letter-spacing: 0.03em;
}

.how-step h3 {
  margin: 15px 0 0;
  color: #2d4934;
  font-family: var(--font-display);
  font-size: 19px;
  font-weight: 800;
  letter-spacing: 0.05em;
}

.how-step p {
  margin: 6px 0 0;
  color: #748070;
  font-size: 11px;
  line-height: 1.75;
}

.how-doodle {
  position: relative;
  display: block;
  width: 48px;
  height: 48px;
}

.sun-doodle {
  border-radius: 50%;
  background: radial-gradient(circle at 36% 33%, #fffef1, #ffe18a 46%, #ffa344 72%, #e86a33);
  box-shadow: 0 0 0 7px rgba(241, 139, 56, 0.13);
}

.sun-doodle::before {
  content: "";
  position: absolute;
  inset: -12px;
  border-radius: 50%;
  background: repeating-conic-gradient(from 6deg, rgba(240, 145, 65, 0.52) 0deg 5deg, transparent 5deg 35deg);
  -webkit-mask: radial-gradient(circle, transparent 0 65%, #000 66% 74%, transparent 75%);
  mask: radial-gradient(circle, transparent 0 65%, #000 66% 74%, transparent 75%);
}

.sun-doodle i {
  position: absolute;
  top: 19px;
  left: 15px;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: rgba(103, 67, 17, 0.52);
  box-shadow: 11px 0 0 rgba(103, 67, 17, 0.52);
}

.card-doodle {
  border: 1.5px solid #95a87c;
  border-radius: 9px;
  background: linear-gradient(150deg, #fffdf6, #e9dbbd);
  transform: rotate(-4deg);
}

.card-doodle i {
  position: absolute;
  top: 6px;
  left: 8px;
  width: 19px;
  height: 19px;
  border-radius: 50%;
  background: radial-gradient(circle at 38% 33%, #fff5b5, #f3be3d 56%, #df9826);
}

.card-doodle b {
  position: absolute;
  right: 6px;
  bottom: 8px;
  width: 19px;
  height: 14px;
  border-radius: 100% 0 100% 0;
  background: #5c8e58;
  transform: rotate(-32deg);
}

.shield-doodle i {
  position: absolute;
  top: 4px;
  left: 4px;
  width: 39px;
  height: 40px;
  border: 1.5px solid #6f8b5f;
  border-radius: 46% 46% 55% 55% / 35% 35% 70% 70%;
  background:
    radial-gradient(circle at 50% 44%, rgba(68, 111, 65, 0.15), transparent 55%),
    #f2edd9;
}

.shield-doodle i::after {
  content: "✦";
  position: absolute;
  top: 50%;
  left: 50%;
  color: #7f9b60;
  font-size: 15px;
  transform: translate(-50%, -50%);
}

.shortcut-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 18px;
  margin-top: 16px;
  padding: 11px 14px;
  border: 1px dashed rgba(76, 98, 61, 0.24);
  border-radius: 11px;
  color: #77836f;
  font-size: 9px;
  font-weight: 600;
}

kbd {
  display: inline-grid;
  min-width: 17px;
  height: 17px;
  padding: 0 4px;
  place-items: center;
  border: 1px solid rgba(74, 97, 62, 0.26);
  border-bottom-width: 2px;
  border-radius: 4px;
  color: #4c6446;
  background: rgba(255, 252, 243, 0.72);
  font-family: var(--font-sans);
  font-size: 8px;
  font-weight: 800;
}

.how-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-top: 21px;
}

.how-foot p {
  max-width: 520px;
  margin: 0;
  color: #899481;
  font-size: 10px;
  line-height: 1.65;
}

.how-foot .btn {
  min-height: 42px;
  flex: 0 0 auto;
  padding: 0 21px;
  font-size: 12px;
}

.settings-card {
  width: min(610px, 100%);
}

.settings-card h2 {
  margin-bottom: 15px;
}

.setting-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 22px;
  padding: 17px 2px;
  border-bottom: 1px solid rgba(73, 95, 60, 0.12);
}

.setting-row:first-of-type {
  border-top: 1px solid rgba(73, 95, 60, 0.12);
  margin-top: 17px;
}

.setting-row h3 {
  margin: 0;
  color: #344d39;
  font-family: var(--font-display);
  font-size: 16px;
  font-weight: 800;
  letter-spacing: 0.04em;
}

.setting-row p {
  margin: 4px 0 0;
  color: #899283;
  font-size: 10px;
  line-height: 1.55;
}

.switch {
  position: relative;
  width: 45px;
  height: 26px;
  flex: 0 0 45px;
  padding: 0;
  border: 1px solid rgba(74, 96, 62, 0.22);
  border-radius: 999px;
  background: #d6cbb3;
  cursor: pointer;
  transition: background 200ms ease, border-color 200ms ease;
}

.switch span {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #fffaf0;
  box-shadow: 0 2px 5px rgba(48, 61, 37, 0.21);
  transition: transform 230ms var(--ease-spring);
}

.switch[aria-checked="true"] {
  border-color: #3f6d46;
  background: #4d7d52;
}

.switch[aria-checked="true"] span {
  transform: translateX(19px);
}

.settings-foot {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  margin-top: 20px;
  color: #9aa28f;
  font-size: 8px;
  line-height: 1.6;
}

#storageState {
  color: #7e927a;
  text-align: right;
}

/* Toasts */

.toast-stack {
  position: fixed;
  z-index: 300;
  bottom: 24px;
  left: 50%;
  display: flex;
  width: min(420px, calc(100% - 32px));
  flex-direction: column;
  align-items: center;
  gap: 7px;
  pointer-events: none;
  transform: translateX(-50%);
}

.toast {
  max-width: 100%;
  padding: 10px 16px;
  border: 1px solid rgba(255, 235, 185, 0.3);
  border-radius: 999px;
  color: #faf2d9;
  background: rgba(25, 55, 35, 0.93);
  box-shadow: 0 9px 25px rgba(4, 15, 7, 0.27);
  font-size: 11px;
  font-weight: 600;
  line-height: 1.4;
  opacity: 0;
  transform: translateY(8px);
  animation: toast-in 240ms var(--ease-out) forwards, toast-out 260ms ease 2.7s forwards;
  backdrop-filter: blur(8px);
}

@keyframes toast-in {
  to { opacity: 1; transform: translateY(0); }
}

@keyframes toast-out {
  to { opacity: 0; transform: translateY(5px); }
}

/* ============================================================
   Responsive
   ============================================================ */

@media (max-width: 1180px) {
  .hero-copy {
    width: min(580px, 55vw);
  }

  .hero-tip {
    width: 180px;
    margin-right: 4px;
  }

  .hud-meta {
    width: 112px;
    flex-basis: 112px;
  }

  .hud-meta strong {
    font-size: 16px;
  }

  .sun-bank {
    width: 91px;
    flex-basis: 91px;
    padding: 0 7px;
  }

  .sun-bank-copy strong {
    font-size: 21px;
  }

  .seed-card {
    width: 85px;
    flex-basis: 85px;
  }

  .seed-art {
    width: 49px;
    height: 49px;
  }

  .seed-name {
    font-size: 10px;
  }
}

@media (max-width: 980px) {
  .hero-tip {
    display: none;
  }

  .hero-copy {
    width: min(640px, 82vw);
  }

  .level-dock {
    width: min(calc(100% - 40px), 900px);
  }

  .level-thumb-wrap {
    height: 66px;
  }

  .level-card h3,
.level-title {
    font-size: 15px;
  }

  .level-card-body {
    padding: 9px 10px;
  }

  .level-state {
    display: none;
  }

  .hud-meta {
    display: none;
  }

  .game-hud {
    gap: 7px;
  }

  .hud-tools {
    padding-left: 3px;
  }

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

  .how-grid {
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .how-step {
    display: grid;
    min-height: 0;
    grid-template-columns: 54px minmax(0, 1fr);
    column-gap: 12px;
    padding: 13px 15px;
  }

  .how-doodle {
    grid-row: span 2;
    width: 44px;
    height: 44px;
    margin-top: 2px;
  }

  .how-step h3 {
    margin-top: 3px;
    font-size: 17px;
  }

  .how-step p {
    grid-column: 2;
    margin-top: 1px;
  }

  .how-no {
    font-size: 18px;
  }
}

@media (max-width: 820px) {
  .site-header {
    padding: 16px 19px 6px;
  }

  .menu-main {
    padding-top: 10px;
    padding-bottom: 14px;
  }

  .title-cn {
    font-size: clamp(58px, 13vw, 88px);
  }

  .hero-title::before {
    right: -55px;
    top: -40px;
    width: 125px;
    height: 125px;
  }

  .hero-lead {
    margin-top: 17px;
  }

  .level-dock {
    width: calc(100% - 28px);
    padding: 14px 15px 16px;
    border-radius: 20px;
  }

  .dock-note {
    display: none;
  }

  .level-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
  }

  .dock-heading-side {
    gap: 8px;
  }

  .menu-footer {
    padding: 10px 20px 13px;
    color: rgba(241, 239, 218, 0.49);
  }

  .menu-footer > p:first-child {
    max-width: 240px;
    line-height: 1.55;
  }

  .footer-hint {
    display: none;
  }

  .game-screen {
    padding: 7px 7px max(6px, env(safe-area-inset-bottom));
    gap: 6px;
  }

  .game-hud {
    min-height: 76px;
    padding: 5px 6px;
    border-radius: 16px;
    gap: 6px;
  }

  .sun-bank {
    width: 79px;
    height: 59px;
    flex-basis: 79px;
    gap: 5px;
    padding: 0 6px;
    border-radius: 12px;
  }

  .sun-glyph {
    width: 23px;
    height: 23px;
    flex-basis: 23px;
  }

  .sun-glyph i {
    top: 8px;
    left: 7px;
    width: 2.5px;
    height: 2.5px;
    box-shadow: 7px 0 0 rgba(116, 72, 13, 0.62);
  }

  .sun-glyph b {
    top: 13px;
    left: 10px;
    width: 5px;
    height: 3px;
  }

  .sun-bank-copy strong {
    font-size: 19px;
  }

  .sun-bank-copy small {
    font-size: 7px;
  }

  .seed-bank {
    gap: 4px;
  }

  .seed-card {
    width: 76px;
    height: 61px;
    flex-basis: 76px;
    border-radius: 10px;
  }

  .seed-art {
    top: 1px;
    right: -3px;
    width: 43px;
    height: 43px;
  }

  .seed-cost {
    top: 3px;
    left: 3px;
    padding: 0 4px 0 2px;
    font-size: 9.5px;
  }

  .cost-sun {
    width: 8px;
    height: 8px;
  }

  .seed-name {
    bottom: 4px;
    left: 5px;
    max-width: calc(100% - 18px);
    font-size: 9px;
  }

  .seed-key {
    right: 4px;
    bottom: 4px;
    width: 11px;
    height: 11px;
    font-size: 6px;
  }

  .hud-tools {
    gap: 3px;
  }

  .tool-button {
    width: 39px;
    min-height: 57px;
    border-radius: 10px;
    font-size: 0;
    gap: 3px;
  }

  .tool-button svg {
    width: 19px;
    height: 19px;
  }

  .board-frame {
    border-width: 4px;
    border-radius: 19px;
  }

  #gameCanvas {
    border-radius: 14px;
  }

  .stage-grain {
    inset: 4px;
    border-radius: 14px;
  }

  .game-bottom {
    min-height: 21px;
    font-size: 8px;
  }

  .game-tip {
    display: none;
  }

  .wave-pip {
    width: 12px;
  }

  .boss-track {
    top: 8px;
    width: min(70%, 420px);
    padding: 6px 10px 7px;
  }

  .boss-track-label {
    font-size: 8px;
    margin-bottom: 3px;
  }

  .coach {
    bottom: 9px;
    left: 9px;
    width: min(380px, calc(100% - 18px));
    padding: 8px 28px 8px 9px;
  }

  .coach p {
    font-size: 10px;
    line-height: 1.5;
  }

  .wave-banner {
    top: 11%;
    min-width: 190px;
    padding: 7px 18px 8px;
  }

  .wave-banner strong {
    font-size: 18px;
  }

  .intro-card {
    grid-template-columns: 1fr;
    max-height: calc(100dvh - 24px);
    border-radius: 19px;
  }

  .intro-art {
    min-height: 145px;
    height: 26vh;
    max-height: 210px;
  }

  .intro-copy {
    padding: 20px 22px 24px;
  }

  .intro-copy h2 {
    font-size: clamp(25px, 6vw, 32px);
  }

  .intro-lore {
    margin-top: 9px;
    font-size: 12px;
    line-height: 1.65;
  }

  .intro-goals {
    margin-top: 12px;
  }

  .intro-goals li {
    min-height: 22px;
    padding: 0 7px;
    font-size: 8px;
  }

  .intro-actions {
    margin-top: 17px;
    gap: 12px;
  }

  .intro-actions .btn {
    min-height: 45px;
    font-size: 13px;
  }

  .result-card {
    padding: 16px 20px 22px;
  }

  .result-crest {
    width: 145px;
    height: 100px;
  }

  .result-card h2 {
    font-size: 31px;
  }

  .result-stars {
    min-height: 36px;
    margin-top: 8px;
    font-size: 29px;
  }

  .result-stats {
    margin: 10px 0 15px;
    padding: 9px 0;
  }

  .result-stats strong {
    font-size: 16px;
  }

  .modal-card {
    max-height: 92dvh;
    border-radius: 19px;
  }

  .how-foot {
    align-items: flex-start;
    flex-direction: column;
    gap: 13px;
  }

  .how-foot .btn {
    width: 100%;
  }

  .settings-foot {
    flex-direction: column;
    gap: 3px;
  }

  #storageState {
    text-align: left;
  }
}

@media (max-width: 560px) {
  .menu-screen {
    overflow-y: auto;
  }

  .brand-word {
    font-size: 16px;
  }

  .site-actions {
    gap: 5px;
  }

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

  .icon-button svg {
    width: 17px;
    height: 17px;
  }

  .hero-copy {
    width: 100%;
  }

  .menu-main {
    flex: 1 1 auto;
    padding: 7px 20px 17px;
  }

  .hero-eyebrow {
    font-size: 8px;
    letter-spacing: 0.15em;
    margin-bottom: 9px;
  }

  .title-cn {
    font-size: clamp(54px, 17vw, 78px);
    letter-spacing: 0.03em;
  }

  .title-en {
    margin-top: 7px;
    font-size: 7px;
    letter-spacing: 0.42em;
  }

  .hero-title::before {
    right: -36px;
    top: -30px;
    width: 100px;
    height: 100px;
  }

  .hero-lead {
    margin-top: 14px;
    font-size: 13.5px;
    line-height: 1.75;
  }

  .hero-actions {
    gap: 9px;
    margin-top: 19px;
  }

  .btn {
    min-height: 42px;
    padding: 0 16px;
    font-size: 12px;
  }

  .btn-lg {
    min-height: 48px;
    padding: 0 17px;
    font-size: 13px;
  }

  .btn-arrow {
    width: 22px;
    height: 22px;
    font-size: 13px;
  }

  .save-meta {
    margin-top: 13px;
    font-size: 9.5px;
  }

  .level-dock {
    width: calc(100% - 24px);
    margin-top: 0;
    padding: 13px 12px 14px;
  }

  .dock-heading {
    margin-bottom: 9px;
    padding: 0 2px;
  }

  .dock-heading h2 {
    font-size: 19px;
  }

  .level-thumb-wrap {
    height: 62px;
  }

  .level-card h3,
.level-title {
    font-size: 14.5px;
  }

  .level-card p,
.level-text {
    font-size: 9px;
  }

  .menu-footer {
    padding: 9px 16px 12px;
    font-size: 8px;
  }

  .game-screen {
    padding: 5px 5px max(5px, env(safe-area-inset-bottom));
    gap: 5px;
  }

  .game-hud {
    min-height: 67px;
    padding: 4px;
    border-radius: 14px;
    gap: 4px;
  }

  .sun-bank {
    width: 60px;
    height: 53px;
    flex-basis: 60px;
    gap: 4px;
    padding: 0 5px;
    border-radius: 10px;
  }

  .sun-glyph {
    width: 20px;
    height: 20px;
    flex-basis: 20px;
  }

  .sun-glyph i {
    top: 7px;
    left: 6px;
    width: 2px;
    height: 2px;
    box-shadow: 6px 0 0 rgba(116, 72, 13, 0.62);
  }

  .sun-glyph b {
    top: 11px;
    left: 8px;
    width: 4px;
    height: 2.5px;
  }

  .sun-bank-copy small {
    display: none;
  }

  .sun-bank-copy strong {
    font-size: 17px;
  }

  .seed-card {
    width: 68px;
    height: 55px;
    flex-basis: 68px;
    border-radius: 9px;
  }

  .seed-art {
    width: 37px;
    height: 37px;
  }

  .seed-cost {
    font-size: 8.5px;
    top: 2px;
    left: 2px;
  }

  .seed-name {
    left: 4px;
    bottom: 3px;
    font-size: 8.5px;
  }

  .seed-key {
    display: none;
  }

  .tool-button {
    width: 33px;
    min-height: 51px;
  }

  .tool-button svg {
    width: 17px;
    height: 17px;
  }

  .hud-tools {
    gap: 2px;
  }

  .game-bottom {
    min-height: 19px;
    padding: 0 2px;
  }

  .mower-status span {
    display: none;
  }

  .boss-track {
    width: min(86%, 380px);
  }

  .coach {
    border-radius: 9px;
  }

  .wave-banner {
    top: 10%;
  }

  .wave-banner::before,
  .wave-banner::after {
    display: none;
  }

  .intro-art {
    height: 18vh;
    min-height: 112px;
  }

  .intro-copy {
    padding: 17px 18px 20px;
  }

  .intro-copy .eyebrow {
    font-size: 8px;
    margin-bottom: 8px;
  }

  .intro-copy h2 {
    font-size: 24px;
  }

  .intro-lore {
    display: -webkit-box;
    overflow: hidden;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    font-size: 11px;
  }

  .intro-goals {
    display: none;
  }

  .intro-actions {
    margin-top: 14px;
  }

  .simple-card {
    padding: 25px 21px;
  }

  .simple-card h2 {
    font-size: 28px;
  }

  .round-emblem {
    width: 48px;
    height: 48px;
    margin-bottom: 12px;
  }

  .round-emblem svg {
    width: 29px;
    height: 29px;
  }

  .result-crest {
    width: 120px;
    height: 83px;
  }

  .result-card h2 {
    font-size: 28px;
  }

  .result-sub {
    font-size: 11px;
  }

  .result-actions .btn {
    padding: 0 13px;
    font-size: 11px;
  }

  .modal-layer {
    padding: 10px;
  }

  .modal-card {
    padding: 20px 16px;
    border-radius: 16px;
  }

  .modal-close {
    top: 10px;
    right: 10px;
  }

  .how-step {
    grid-template-columns: 42px minmax(0, 1fr);
    padding: 11px 12px;
  }

  .how-doodle {
    width: 35px;
    height: 35px;
    transform: scale(0.82);
    transform-origin: top left;
  }

  .shortcut-strip {
    gap: 7px 12px;
    padding: 9px 10px;
    font-size: 8px;
  }

  .setting-row {
    gap: 10px;
    padding: 13px 0;
  }

  .setting-row h3 {
    font-size: 14px;
  }

  .setting-row p {
    font-size: 9px;
  }

  .btn-danger-ghost {
    min-height: 34px;
    padding: 0 10px;
    font-size: 10px;
  }
}

@media (orientation: portrait) and (max-width: 700px) {
  .board-rotate-tip {
    display: block;
    position: absolute;
    z-index: 12;
    top: calc(100% + 12px);
    left: 50%;
    padding: 6px 12px;
    border: 1px solid rgba(248, 239, 203, 0.17);
    border-radius: 999px;
    color: rgba(250, 245, 222, 0.66);
    background: rgba(16, 39, 24, 0.58);
    font-size: 9px;
    font-weight: 700;
    letter-spacing: 0.06em;
    pointer-events: none;
    transform: translateX(-50%);
    white-space: nowrap;
  }

  .orientation-tip {
    display: block;
  }

  .intro-actions {
    margin-top: 15px;
  }
}

/* A short phone in landscape gets a taller field and a slimmer shelf. */
@media (orientation: landscape) and (max-height: 520px) {
  .game-screen {
    gap: 3px;
    padding: 5px 7px max(4px, env(safe-area-inset-bottom));
  }

  .game-hud {
    min-height: 56px;
    height: 56px;
    padding: 3px 5px;
    gap: 5px;
    border-radius: 12px;
  }

  .hud-meta {
    display: none;
  }

  .sun-bank {
    width: 73px;
    height: 48px;
    flex-basis: 73px;
    gap: 4px;
    padding: 0 6px;
    border-radius: 9px;
  }

  .sun-glyph {
    width: 21px;
    height: 21px;
    flex-basis: 21px;
  }

  .sun-bank-copy strong {
    font-size: 16px;
  }

  .sun-bank-copy small {
    display: none;
  }

  .seed-bank {
    gap: 4px;
    padding-bottom: 2px;
  }

  .seed-card {
    width: 73px;
    height: 48px;
    flex-basis: 73px;
    border-radius: 8px;
  }

  .seed-art {
    top: 0;
    right: -2px;
    width: 34px;
    height: 34px;
  }

  .seed-cost {
    top: 2px;
    left: 2px;
    font-size: 8px;
    padding: 0 4px 0 2px;
  }

  .seed-name {
    bottom: 3px;
    left: 4px;
    max-width: calc(100% - 14px);
    font-size: 8px;
  }

  .seed-key {
    display: none;
  }

  .cool-time {
    font-size: 9px;
  }

  .hud-tools {
    gap: 2px;
    padding-left: 2px;
  }

  .tool-button {
    width: 30px;
    min-height: 48px;
    padding: 2px;
    border-radius: 8px;
    font-size: 0;
  }

  .tool-button svg {
    width: 16px;
    height: 16px;
  }

  .board-frame {
    border-width: 4px;
    border-radius: 17px;
  }

  #gameCanvas {
    border-radius: 13px;
  }

  .stage-grain {
    inset: 4px;
    border-radius: 13px;
  }

  .game-bottom {
    min-height: 12px;
    font-size: 7px;
  }

  .game-tip {
    display: none;
  }

  .wave-pip {
    width: 10px;
    height: 4px;
  }

  .mower-status svg {
    width: 18px;
    height: 13px;
  }

  .mower-status span {
    display: none;
  }

  .boss-track {
    top: 5px;
    padding: 4px 8px 5px;
  }

  .boss-track-label {
    margin-bottom: 2px;
    font-size: 7px;
  }

  .boss-track-bar {
    height: 4px;
  }

  .wave-banner {
    top: 9%;
    padding: 5px 16px 6px;
  }

  .wave-banner strong {
    font-size: 16px;
  }

  .coach {
    bottom: 6px;
    left: 6px;
    padding: 6px 24px 6px 8px;
  }

  .coach p {
    font-size: 9px;
    line-height: 1.4;
  }

  .stage-toast {
    top: 38px;
    right: 8px;
    font-size: 8px;
    padding: 5px 8px;
  }

  .intro-card {
    width: min(720px, 100%);
    max-height: calc(100dvh - 12px);
    grid-template-columns: 0.8fr 1.2fr;
    border-radius: 16px;
  }

  .intro-art {
    min-height: 0;
    height: auto;
  }

  .intro-copy {
    padding: 14px 20px 16px;
  }

  .intro-copy h2 {
    font-size: 22px;
  }

  .intro-copy .eyebrow {
    margin-bottom: 6px;
    font-size: 8px;
  }

  .intro-lore {
    margin-top: 6px;
    font-size: 10px;
    line-height: 1.55;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
  }

  .intro-goals {
    display: none;
  }

  .intro-actions {
    margin-top: 12px;
  }

  .intro-actions .btn {
    min-height: 38px;
    font-size: 11px;
  }

  .text-button {
    font-size: 10px;
  }

  .level-stamp {
    top: 12px;
    left: 12px;
  }
}

@media (max-height: 720px) and (min-width: 821px) {
  .site-header {
    padding-top: 13px;
    padding-bottom: 4px;
  }

  .menu-main {
    padding-top: 0;
    padding-bottom: 7px;
  }

  .title-cn {
    font-size: clamp(58px, 7.2vw, 88px);
  }

  .hero-lead {
    margin-top: 13px;
    font-size: 14px;
    line-height: 1.7;
  }

  .hero-actions {
    margin-top: 17px;
  }

  .save-meta {
    margin-top: 11px;
  }

  .hero-tip {
    margin-bottom: 18px;
  }

  .level-dock {
    padding-top: 13px;
    padding-bottom: 13px;
  }

  .dock-heading {
    margin-bottom: 8px;
  }

  .level-thumb-wrap {
    height: 59px;
  }

  .level-card-body {
    padding: 8px 11px 9px;
  }

  .level-card h3,
.level-title {
    font-size: 15px;
  }

  .level-card p,
.level-text {
    margin-top: 1px;
    font-size: 9px;
  }

  .menu-footer {
    padding-top: 7px;
    padding-bottom: 8px;
  }

  .game-hud {
    min-height: 74px;
  }

  .sun-bank {
    height: 59px;
  }

  .tool-button {
    min-height: 57px;
  }

  .seed-card {
    height: 61px;
  }
}

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

/* Final phone-landscape pass: it must win over the short-desktop tuning. */
@media (orientation: landscape) and (max-height: 520px) {
  .game-hud {
    height: 56px;
    min-height: 56px;
    padding: 3px 5px;
  }

  .sun-bank {
    height: 48px;
    flex-basis: 73px;
    width: 73px;
  }

  .seed-card {
    height: 48px;
    flex-basis: 73px;
  }

  .tool-button {
    min-height: 48px;
    height: 48px;
  }

  .game-bottom {
    min-height: 12px;
  }
}


@media (min-width: 821px) and (max-height: 820px) {
  .menu-footer {
    padding-top: 8px;
    padding-bottom: 8px;
  }
}


@media (max-width: 820px) {
  .sun-bank-copy strong.large {
    font-size: 14px;
  }
}

@media (max-width: 560px) {
  .sun-bank-copy strong.large {
    font-size: 12px;
  }
}


@media (max-width: 560px) {
  .dock-heading {
    align-items: center;
  }

  .dock-heading-side {
    gap: 6px;
  }

  .level-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }
}

@media (min-width: 821px) and (max-height: 820px) {
  .menu-footer {
    padding-top: 6px;
    padding-bottom: 6px;
  }
}

/* Short landscape phones: a compact one-screen garden library. */
@media (orientation: landscape) and (max-height: 520px) {
  .site-header {
    padding: 8px 16px 2px;
  }

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

  .brand-mark i {
    width: 9px;
    height: 14px;
  }

  .brand-mark i:nth-child(1) { left: 10px; top: 3px; }
  .brand-mark i:nth-child(2) { left: 14px; top: 7px; }
  .brand-mark b { left: 14px; bottom: 7px; height: 12px; }

  .brand-word {
    font-size: 16px;
  }

  .menu-main {
    align-items: flex-start;
    flex: 0 0 auto;
    padding: 0 20px 4px;
  }

  .hero-copy {
    width: min(440px, 55vw);
  }

  .hero-eyebrow {
    margin-bottom: 4px;
    font-size: 8px;
    letter-spacing: 0.14em;
  }

  .hero-title::before {
    display: none;
  }

  .title-cn {
    font-size: clamp(42px, 8.6vw, 56px);
    letter-spacing: 0.02em;
  }

  .title-cn::after {
    height: 5px;
    margin-top: 2px;
  }

  .title-en {
    margin-top: 4px;
    font-size: 6px;
    letter-spacing: 0.4em;
  }

  .hero-lead {
    display: none;
  }

  .hero-actions {
    margin-top: 11px;
    gap: 8px;
  }

  .hero-actions .btn-lg {
    min-height: 38px;
    padding: 0 14px;
    font-size: 11px;
  }

  .hero-actions .btn-ghost {
    min-height: 38px;
    padding: 0 13px;
    font-size: 11px;
  }

  .btn-arrow {
    width: 20px;
    height: 20px;
    font-size: 12px;
  }

  .save-meta {
    display: none;
  }

  .level-dock {
    width: calc(100% - 28px);
    padding: 9px 12px 10px;
    border-radius: 16px;
  }

  .dock-heading {
    align-items: center;
    margin-bottom: 6px;
    padding: 0;
  }

  .eyebrow-small {
    margin-bottom: 1px;
    font-size: 6.5px;
  }

  .dock-heading h2 {
    font-size: 16px;
  }

  .dock-note {
    display: none;
  }

  .dock-heading-side {
    gap: 7px;
  }

  .level-list {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
  }

  .level-thumb-wrap {
    height: 42px;
  }

  .level-topline {
    top: 5px;
    right: 7px;
    left: 7px;
    font-size: 6px;
  }

  .level-number::before {
    width: 8px;
  }

  .level-stars {
    font-size: 8px;
  }

  .level-card-body {
    padding: 4px 7px 5px;
    gap: 3px;
  }

  .level-card h3,
  .level-title {
    font-size: 12px;
  }

  .level-card p,
  .level-text {
    margin-top: 0;
    font-size: 7.5px;
    line-height: 1.35;
  }

  .level-state {
    display: none;
  }

  .menu-footer {
    display: none;
  }

  .menu-screen {
    overflow-y: auto;
  }
}

/* Two-row level library needs less air on shorter laptops. */
@media (min-width: 821px) and (max-height: 920px) {
  .site-header {
    padding-top: 11px;
    padding-bottom: 4px;
  }

  .menu-main {
    padding-top: 0;
    padding-bottom: 8px;
  }

  .hero-eyebrow {
    margin-bottom: 6px;
  }

  .title-cn {
    font-size: clamp(54px, 6.8vw, 88px);
  }

  .title-en {
    margin-top: 5px;
  }

  .hero-lead {
    margin-top: 12px;
    font-size: 15px;
    line-height: 1.72;
  }

  .hero-actions {
    margin-top: 14px;
  }

  .save-meta {
    margin-top: 10px;
  }

  .hero-actions .btn-lg {
    min-height: 46px;
  }

  .level-dock {
    padding: 13px 18px 14px;
    border-radius: 21px;
  }

  .dock-heading {
    margin-bottom: 8px;
  }

  .level-list {
    gap: 10px;
  }

  .level-thumb-wrap {
    height: 63px;
  }

  .level-card-body {
    padding: 8px 11px 9px;
    gap: 5px;
  }

  .level-card h3,
  .level-title {
    font-size: 16px;
  }

  .level-card p,
  .level-text {
    margin-top: 1px;
    font-size: 9px;
  }
}

/* Very short laptop windows: keep both rows above the fold. */
@media (min-width: 821px) and (max-height: 800px) {
  .hero-lead,
  .save-meta {
    display: none;
  }

  .site-header {
    padding-top: 8px;
    padding-bottom: 2px;
  }

  .menu-main {
    padding-bottom: 4px;
  }

  .title-cn {
    font-size: clamp(48px, 6.1vw, 74px);
  }

  .hero-title::before {
    top: -30px;
    right: -55px;
    width: 110px;
    height: 110px;
  }

  .hero-actions {
    margin-top: 11px;
  }

  .hero-actions .btn-lg {
    min-height: 42px;
    font-size: 13px;
  }

  .level-dock {
    padding: 10px 16px 11px;
  }

  .dock-heading {
    margin-bottom: 6px;
  }

  .level-thumb-wrap {
    height: 55px;
  }

  .level-card-body {
    padding: 7px 10px 8px;
  }

  .menu-footer {
    padding-top: 5px;
    padding-bottom: 5px;
  }
}

/* Keep the short landscape layout inside one screen. */
@media (orientation: landscape) and (max-height: 520px) {
  .level-dock {
    padding: 7px 10px 8px;
  }

  .dock-heading {
    margin-bottom: 4px;
  }

  .level-list {
    gap: 7px;
  }

  .level-thumb-wrap {
    height: 34px;
  }

  .level-card-body {
    padding: 3px 6px 4px;
  }

  .level-card h3,
  .level-title {
    font-size: 11px;
  }

  .level-card p,
  .level-text {
    display: none;
  }
}

/* Immersive level gallery: let the garden show through and never crop previews. */
.level-dock {
  background:
    linear-gradient(135deg, rgba(255, 251, 239, 0.58), rgba(235, 224, 197, 0.42));
  box-shadow:
    0 24px 60px rgba(18, 42, 28, 0.17),
    inset 0 1px 0 rgba(255, 255, 255, 0.66);
  backdrop-filter: blur(16px) saturate(1.1);
}

.dock-note {
  color: rgba(45, 70, 48, 0.66);
}

.level-card {
  background: rgba(249, 240, 220, 0.62);
  backdrop-filter: blur(9px) saturate(1.02);
}

.level-card:hover:not(.locked) {
  background: rgba(253, 246, 229, 0.92);
}

.level-card.locked .level-thumb {
  filter: none;
}

.level-card.locked .level-card-body {
  opacity: 1;
}

/* The small corner lock still marks an unopened garden without dimming its art. */
.lock-ribbon {
  top: auto;
  right: 6px;
  bottom: 6px;
  left: auto;
  width: 18px;
  height: 18px;
  transform: none;
  background: rgba(26, 49, 32, 0.62);
}

.lock-ribbon svg {
  width: 8px;
  height: 8px;
}

@media (min-width: 561px) {
  .level-card {
    display: grid;
    grid-template-columns: minmax(0, 47%) minmax(0, 1fr);
    min-height: 80px;
    align-items: stretch;
  }

  .level-thumb-wrap {
    width: 100%;
    height: 100%;
    min-height: 80px;
    background: linear-gradient(135deg, #7f9f7b, #355d46);
  }

  .level-thumb {
    object-fit: contain;
  }

  .level-card:hover .level-thumb {
    transform: none;
  }

  .level-card-body {
    align-items: center;
    padding: 9px 11px;
    gap: 7px;
  }

  .level-card h3,
  .level-title {
    font-size: 16px;
  }

  .level-card p,
  .level-text {
    margin-top: 2px;
    font-size: 9px;
    line-height: 1.45;
  }

  .level-state {
    min-height: 19px;
    padding: 0 7px;
    gap: 3px;
    font-size: 7.5px;
  }

  .level-state svg {
    width: 8px;
    height: 8px;
  }

  .level-topline {
    top: 6px;
    right: 8px;
    left: 8px;
    font-size: 6.5px;
  }

  .level-number::before {
    width: 9px;
  }

  .level-stars {
    font-size: 9px;
  }
}

/* Phones keep the stacked card, now at the artwork's own aspect ratio. */
@media (max-width: 560px) {
  .level-card {
    display: block;
    min-height: 0;
  }

  .level-thumb-wrap {
    width: 100%;
    height: auto;
    min-height: 0;
    aspect-ratio: 680 / 248;
  }

  .level-thumb {
    object-fit: contain;
  }

  .level-card:hover .level-thumb {
    transform: none;
  }
}

/* Short landscape screens: image on the left, full art, two slim rows. */
@media (orientation: landscape) and (max-height: 520px) {
  .level-card {
    min-height: 52px;
    grid-template-columns: minmax(0, 38%) minmax(0, 1fr);
  }

  .level-thumb-wrap {
    min-height: 52px;
  }

  .level-card-body {
    padding: 3px 6px;
    gap: 0;
  }

  .level-card h3,
  .level-title {
    font-size: 11px;
  }

  .level-card p,
  .level-text {
    display: none;
  }

  .level-state {
    display: none;
  }

  .level-topline {
    top: 4px;
    right: 5px;
    left: 5px;
    font-size: 5.5px;
  }

  .level-stars {
    font-size: 8px;
  }

  .lock-ribbon {
    right: 4px;
    bottom: 4px;
    width: 15px;
    height: 15px;
  }

  .lock-ribbon svg {
    width: 7px;
    height: 7px;
  }
}

/* ============================================================
   Menu as a full-screen garden plate, with the chapter library below
   ============================================================ */
html {
  scroll-behavior: smooth;
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
}

.menu-screen {
  display: block;
  overflow: visible;
  background: #173b2b;
}

.menu-hero {
  position: relative;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-height: 100dvh;
  overflow: hidden;
  isolation: isolate;
}

.menu-hero #menuCanvas {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.menu-hero .menu-vignette {
  background:
    linear-gradient(90deg, rgba(243, 237, 216, 0.91) 0%, rgba(243, 237, 216, 0.64) 31%, rgba(243, 237, 216, 0.05) 58%, rgba(23, 50, 36, 0.08) 100%),
    linear-gradient(180deg, rgba(239, 235, 214, 0.52) 0%, transparent 25%, transparent 72%, rgba(22, 49, 33, 0.24) 100%);
}

.menu-hero .menu-main {
  flex: 1 1 auto;
}

.menu-scroll-cue {
  position: absolute;
  z-index: 7;
  bottom: clamp(16px, 3.5vh, 34px);
  left: 50%;
  display: inline-flex;
  min-height: 40px;
  align-items: center;
  gap: 9px;
  padding: 0 15px 0 18px;
  border: 1px solid rgba(53, 82, 54, 0.26);
  border-radius: 999px;
  color: #31503a;
  background: rgba(251, 246, 233, 0.74);
  box-shadow:
    0 10px 28px rgba(23, 51, 33, 0.14),
    inset 0 1px 0 rgba(255, 255, 255, 0.62);
  backdrop-filter: blur(11px);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-decoration: none;
  white-space: nowrap;
  transform: translateX(-50%);
  transition: background 180ms ease, box-shadow 180ms ease, transform 180ms var(--ease-out);
}

.menu-scroll-cue:hover {
  background: rgba(255, 251, 240, 0.92);
  box-shadow:
    0 13px 30px rgba(23, 51, 33, 0.18),
    inset 0 1px 0 rgba(255, 255, 255, 0.72);
  transform: translateX(-50%) translateY(-2px);
}

.menu-scroll-cue i {
  display: grid;
  width: 20px;
  height: 20px;
  place-items: center;
  border-radius: 50%;
  background: rgba(49, 80, 58, 0.1);
  font-family: Georgia, serif;
  font-size: 12px;
  font-style: normal;
  font-weight: 400;
  animation: cue-bob 2.1s ease-in-out infinite;
}

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

/* The chapter cards now begin beneath the picture, not over it. */
.level-section {
  position: relative;
  z-index: 3;
  padding: clamp(38px, 6vw, 72px) 0 0;
  border-top: 1px solid rgba(249, 240, 216, 0.14);
  background:
    radial-gradient(ellipse at 12% -5%, rgba(137, 176, 113, 0.19), transparent 37%),
    radial-gradient(ellipse at 92% 3%, rgba(203, 183, 118, 0.1), transparent 30%),
    linear-gradient(180deg, #214a35 0%, #143126 100%);
  scroll-margin-top: 0;
}

.level-section .level-dock {
  width: min(calc(100% - clamp(48px, 9vw, 180px)), 1180px);
  margin: 0 auto;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  backdrop-filter: none;
}

.level-section .dock-heading {
  align-items: flex-end;
  margin-bottom: 17px;
  padding: 0 2px;
}

.level-section .eyebrow-small {
  color: rgba(235, 225, 197, 0.6);
}

.level-section .dock-heading h2 {
  color: #f8efda;
  font-size: clamp(24px, 2.3vw, 31px);
}

.level-section .dock-note {
  color: rgba(235, 228, 207, 0.55);
  font-size: 10.5px;
}

.level-section .level-list {
  gap: 16px;
}

.level-section .level-card {
  display: block;
  min-height: 0;
  max-width: 100%;
  border-color: rgba(255, 255, 255, 0.2);
  background: #f8eed8;
  box-shadow:
    0 16px 34px rgba(6, 22, 14, 0.22),
    inset 0 1px 0 rgba(255, 255, 255, 0.75);
  backdrop-filter: none;
}

.level-section .level-card:hover:not(.locked) {
  border-color: rgba(255, 235, 188, 0.45);
  background: #fbf3e1;
  box-shadow:
    0 22px 44px rgba(6, 22, 14, 0.28),
    inset 0 1px 0 rgba(255, 255, 255, 0.85);
}

/* Equal aspect to the 680×248 preview canvas: the whole artwork is visible. */
.level-section .level-thumb-wrap {
  width: 100%;
  height: auto;
  min-height: 0;
  aspect-ratio: 680 / 248;
  background: linear-gradient(135deg, #7f9f7b, #355d46);
}

.level-section .level-thumb {
  object-fit: contain;
}

.level-section .level-card:hover .level-thumb {
  transform: none;
}

.level-section .level-card-body {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  gap: 9px;
  padding: 12px 14px 13px;
}

.level-section .level-card h3,
.level-section .level-title {
  font-size: clamp(16px, 1.35vw, 18px);
}

.level-section .level-card p,
.level-section .level-text {
  margin-top: 3px;
  font-size: 10px;
  line-height: 1.5;
}

.level-section .level-state {
  min-height: 22px;
  padding: 0 8px;
  gap: 4px;
  font-size: 8px;
}

.level-section .level-state svg {
  width: 9px;
  height: 9px;
}

.level-section .level-topline {
  top: 9px;
  right: 11px;
  left: 11px;
  font-size: 8px;
}

.level-section .level-stars {
  font-size: 11px;
}

.level-section .lock-ribbon {
  right: 9px;
  bottom: 9px;
  width: 20px;
  height: 20px;
}

.level-section .lock-ribbon svg {
  width: 9px;
  height: 9px;
}

.level-section .menu-footer {
  width: min(calc(100% - clamp(48px, 9vw, 180px)), 1180px);
  margin-top: clamp(28px, 4vw, 44px);
  padding: 15px 2px 22px;
  border-top: 1px solid rgba(247, 237, 213, 0.11);
  color: rgba(241, 239, 218, 0.5);
}

@media (min-height: 521px) {
  .menu-hero .hero-lead {
    display: block;
  }

  .menu-hero .save-meta {
    display: flex;
  }
}

@media (max-width: 560px) {
  .menu-scroll-cue {
    bottom: 16px;
    min-height: 38px;
    padding: 0 13px 0 15px;
    font-size: 9px;
  }

  .level-section {
    padding-top: 34px;
  }

  .level-section .level-dock {
    width: calc(100% - 28px);
  }

  .level-section .dock-heading {
    align-items: center;
    margin-bottom: 13px;
  }

  .level-section .dock-note {
    display: none;
  }

  .level-section .level-list {
    gap: 9px;
  }

  .level-section .level-card-body {
    padding: 8px 9px 9px;
    gap: 5px;
  }

  .level-section .level-card h3,
  .level-section .level-title {
    font-size: 14.5px;
  }

  .level-section .level-card p,
  .level-section .level-text {
    font-size: 9px;
    margin-top: 2px;
  }

  .level-section .level-topline {
    top: 6px;
    right: 7px;
    left: 7px;
    font-size: 6.5px;
  }

  .level-section .level-stars {
    font-size: 9px;
  }

  .level-section .lock-ribbon {
    right: 5px;
    bottom: 5px;
    width: 16px;
    height: 16px;
  }

  .level-section .lock-ribbon svg {
    width: 7px;
    height: 7px;
  }

  .level-section .menu-footer {
    width: calc(100% - 28px);
    margin-top: 24px;
    padding-bottom: 16px;
  }
}

@media (orientation: landscape) and (max-height: 520px) {
  .menu-scroll-cue {
    bottom: 10px;
  }

  .level-section {
    padding-top: 26px;
  }

  .level-section .dock-heading {
    margin-bottom: 10px;
  }

  .level-section .level-list {
    gap: 9px;
  }

  .level-section .level-card h3,
  .level-section .level-title {
    font-size: 13px;
  }

  .level-section .level-card-body {
    padding: 6px 8px 7px;
  }

  .level-section .level-text {
    display: none;
  }

  .level-section .menu-footer {
    margin-top: 20px;
    padding-top: 10px;
  }
}

/* Blend the picture into the chapter floor below instead of cutting hard. */
.menu-hero::after {
  content: "";
  position: absolute;
  z-index: 1;
  right: 0;
  bottom: 0;
  left: 0;
  height: 31%;
  pointer-events: none;
  background: linear-gradient(180deg, rgba(25, 63, 46, 0) 0%, rgba(25, 63, 46, 0.2) 43%, #214a35 100%);
}

/* ============================================================
   Per-level paused runs
   ============================================================ */
.pause-save-hint {
  margin: 13px 0 0;
  color: rgba(70, 99, 68, 0.72);
  font-size: 10px;
  font-weight: 700;
  line-height: 1.65;
}

.level-state.saved {
  color: #75551b;
  background: rgba(232, 172, 62, 0.2);
}

.level-card.has-run {
  border-color: rgba(213, 163, 69, 0.44);
}

.level-card.has-run::after {
  border-color: rgba(255, 229, 158, 0.52);
}

.resume-card {
  width: min(520px, 100%);
  padding: clamp(26px, 4vw, 40px);
  text-align: center;
}

.resume-emblem {
  margin-bottom: 15px;
}

.resume-card .simple-copy {
  max-width: 390px;
  margin-right: auto;
  margin-left: auto;
}

.resume-stats {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-top: 21px;
  text-align: left;
}

.resume-stats > div {
  display: flex;
  min-height: 54px;
  padding: 9px 12px;
  flex-direction: column;
  justify-content: center;
  border: 1px solid rgba(58, 83, 53, 0.12);
  border-radius: 12px;
  background: rgba(255, 251, 239, 0.54);
}

.resume-stats span {
  color: rgba(61, 85, 58, 0.58);
  font-size: 8px;
  font-weight: 800;
  letter-spacing: 0.12em;
}

.resume-stats strong {
  margin-top: 3px;
  color: #29452f;
  font-family: var(--font-display);
  font-size: 16px;
  font-weight: 800;
  letter-spacing: 0.03em;
}

.resume-actions {
  margin-top: 20px;
}

.resume-actions .text-button {
  align-self: center;
}

@media (max-width: 560px) {
  .resume-card {
    padding: 25px 20px;
    border-radius: 20px;
  }

  .resume-stats {
    gap: 7px;
  }

  .resume-stats > div {
    min-height: 50px;
    padding: 8px 10px;
  }

  .resume-stats strong {
    font-size: 15px;
  }
}

.level-state.saved svg {
  fill: currentColor;
  stroke: none;
}

.level-card.has-run .level-thumb-wrap::before {
  content: "可继续";
  position: absolute;
  z-index: 3;
  bottom: 7px;
  left: 8px;
  padding: 3px 7px;
  border: 1px solid rgba(255, 240, 193, 0.4);
  border-radius: 999px;
  color: #fff5d4;
  background: rgba(83, 63, 22, 0.66);
  font-size: 7px;
  font-weight: 900;
  letter-spacing: 0.08em;
  line-height: 1;
  backdrop-filter: blur(5px);
  pointer-events: none;
}

.pause-overlay .simple-card {
  max-height: calc(100dvh - 28px);
  overflow: hidden auto;
}
