:root {
  --bg-deep: #203229;
  --bg-moss: #4c6758;
  --bg-sage: #93a48c;
  --bg-mist: #dce6da;
  --sand: #d9c7a5;
  --wood: #7e5d35;
  --wood-dark: #5f4326;
  --wood-soft: #b79362;
  --accent: #dce6b8;
  --card: rgba(246, 241, 231, 0.88);
  --card-strong: rgba(250, 247, 239, 0.95);
  --ink: #24332d;
  --muted: #5f6d63;
  --shadow: 0 20px 50px rgba(26, 35, 29, 0.22);
  --font-display: "Palatino Linotype", "Book Antiqua", Georgia, serif;
  --font-body: "Segoe UI", "Noto Sans TC", sans-serif;
}

* {
  box-sizing: border-box;
}

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

body {
  overflow: hidden;
  background:
    radial-gradient(circle at top, rgba(226, 233, 214, 0.55), transparent 35%),
    linear-gradient(180deg, var(--bg-sage) 0%, var(--bg-moss) 32%, var(--bg-deep) 100%);
  color: var(--ink);
  font-family: var(--font-body);
}

body::after {
  content: "";
  position: fixed;
  inset: 0;
  background:
    linear-gradient(180deg, rgba(14, 24, 20, 0.08), rgba(14, 24, 20, 0.22));
  pointer-events: none;
  z-index: 0;
}

button {
  font: inherit;
  cursor: pointer;
}

.hidden {
  display: none !important;
}

.app-shell {
  position: relative;
  min-height: 100vh;
  overflow: hidden;
}

.screen-stack::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 2rem;
  background-size: cover;
  background-position: center;
  opacity: 0;
  transform: scale(1.02);
  transition: opacity 700ms ease, transform 700ms ease;
  pointer-events: none;
}

body[data-screen="home-screen"] .screen-stack::before {
  background-image:
    linear-gradient(90deg, rgba(24, 38, 32, 0.46), rgba(24, 38, 32, 0.12) 40%, rgba(24, 38, 32, 0.26)),
    url("../image/generated/home-forest-mural.png");
  opacity: 0.72;
  transform: scale(1);
}

body[data-screen="menu-screen"] .screen-stack::before {
  background-image:
    linear-gradient(180deg, rgba(39, 49, 42, 0.22), rgba(39, 49, 42, 0.14)),
    url("../image/generated/menu-ecology-map.png");
  opacity: 0.88;
  transform: scale(1);
}

body[data-screen="memory-screen"] .screen-stack::before,
body[data-screen="title-screen"] .screen-stack::before {
  background-image:
    linear-gradient(180deg, rgba(37, 52, 44, 0.18), rgba(37, 52, 44, 0.12)),
    url("../image/generated/home-forest-mural.png");
  opacity: 0.3;
  transform: scale(1);
}

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

.atmosphere-back {
  background:
    radial-gradient(circle at 20% 25%, rgba(255, 255, 255, 0.2), transparent 18%),
    radial-gradient(circle at 80% 18%, rgba(255, 248, 220, 0.16), transparent 16%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.06), rgba(34, 53, 46, 0.08));
  animation: slowGlow 16s ease-in-out infinite alternate;
}

.atmosphere-mid {
  background:
    radial-gradient(circle at 50% 80%, rgba(190, 204, 164, 0.16), transparent 25%),
    radial-gradient(circle at 12% 90%, rgba(244, 230, 188, 0.12), transparent 14%);
  opacity: 0.85;
}

.atmosphere-front::before,
.atmosphere-front::after {
  content: "";
  position: absolute;
  width: 45vw;
  height: 35vh;
  background: radial-gradient(circle at 50% 0%, rgba(31, 46, 40, 0.36), transparent 72%);
  filter: blur(8px);
}

.atmosphere-front::before {
  left: -6vw;
  bottom: -12vh;
}

.atmosphere-front::after {
  right: -6vw;
  bottom: -16vh;
}

.floating-seeds {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 0;
}

.floating-seeds span {
  position: absolute;
  width: 0.5rem;
  height: 0.5rem;
  border-radius: 50%;
  background: rgba(250, 246, 234, 0.7);
  box-shadow: 0 0 14px rgba(255, 246, 222, 0.28);
  animation: drift 16s linear infinite;
}

.floating-seeds span:nth-child(1) { left: 8%; top: 74%; animation-delay: 0s; }
.floating-seeds span:nth-child(2) { left: 22%; top: 58%; animation-delay: 3s; }
.floating-seeds span:nth-child(3) { left: 41%; top: 81%; animation-delay: 6s; }
.floating-seeds span:nth-child(4) { left: 62%; top: 70%; animation-delay: 2s; }
.floating-seeds span:nth-child(5) { left: 76%; top: 60%; animation-delay: 8s; }
.floating-seeds span:nth-child(6) { left: 88%; top: 76%; animation-delay: 10s; }

.top-bar {
  position: relative;
  z-index: 2;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding: 1.3rem 1.6rem 0;
}

.brand-mark h1,
.section-heading h2,
.dialog-card h2,
.title-card h2,
.hero-panel h2,
.info-panel h3,
.game-toolbar h3,
.home-observation-card h3 {
  margin: 0;
  font-family: var(--font-display);
  letter-spacing: 0.03em;
  font-weight: 600;
}

.brand-kicker,
.eyebrow,
.card-label,
.zone-type {
  display: inline-block;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  font-size: 0.72rem;
  color: #eef2dc;
}

.hero-panel .eyebrow,
.section-heading .eyebrow,
.card-label,
.zone-type,
.info-panel .card-label,
.game-toolbar .card-label,
.dialog-card .card-label {
  color: #8b7a5e;
}

.brand-mark h1 {
  margin-top: 0.15rem;
  font-size: clamp(1.4rem, 2vw, 2rem);
  color: #f6f1e6;
}

.ghost-button,
.wood-button,
.menu-zone {
  border: 0;
  transition: transform 180ms ease, box-shadow 180ms ease, filter 180ms ease;
}

.ghost-button {
  border-radius: 999px;
  padding: 0.75rem 1.1rem;
  background: rgba(247, 241, 226, 0.2);
  color: #f6f1e6;
  backdrop-filter: blur(8px);
  box-shadow: inset 0 0 0 1px rgba(255, 248, 231, 0.18);
}

.ghost-button:hover,
.ghost-button:focus-visible,
.wood-button:hover,
.wood-button:focus-visible,
.menu-zone:hover,
.menu-zone:focus-visible {
  transform: translateY(-2px) scale(1.01);
  filter: saturate(1.05);
}

.ghost-button:active,
.wood-button:active,
.menu-zone:active {
  transform: scale(0.97);
}

.wood-button {
  min-width: 10rem;
  border-radius: 999px;
  padding: 0.95rem 1.5rem;
  box-shadow: var(--shadow);
}

.primary-button {
  background: linear-gradient(180deg, var(--wood-soft), var(--wood-dark));
  color: #fff8ea;
  animation: buttonBreath 4.8s ease-in-out infinite;
}

.secondary-button {
  background: linear-gradient(180deg, #e4d5b6, #cdb388);
  color: #4c3b29;
}

.screen-stack {
  position: relative;
  z-index: 1;
  height: calc(100vh - 5.5rem);
  padding: 1.2rem 1.6rem 1.6rem;
  overflow: hidden;
}

.screen {
  display: none;
  height: 100%;
}

.screen-active {
  display: grid;
  animation: fadeScreen 600ms ease;
  position: relative;
  z-index: 1;
}

.hero-panel,
.home-observation-card,
.title-card,
.dialog-card,
.info-panel,
.metric-chip,
.card-grid,
.menu-zone,
.habitat-panel,
.card-panel {
  background: var(--card);
  border: 1px solid rgba(255, 255, 255, 0.38);
  box-shadow: var(--shadow);
  backdrop-filter: blur(10px);
}

#home-screen {
  grid-template-columns: 1.3fr 0.8fr;
  gap: 1.25rem;
  align-items: stretch;
}

.hero-panel {
  position: relative;
  border-radius: 2rem;
  padding: clamp(1.8rem, 4vw, 3.2rem);
  align-content: center;
  overflow: hidden;
  background:
    linear-gradient(135deg, rgba(255, 249, 238, 0.94), rgba(240, 234, 220, 0.76)),
    radial-gradient(circle at top left, rgba(221, 231, 191, 0.28), transparent 42%);
}

.hero-panel::after {
  content: "";
  position: absolute;
  inset: auto -12% -12% auto;
  width: 40%;
  height: 70%;
  background:
    radial-gradient(circle at center, rgba(105, 134, 115, 0.32), transparent 60%);
  transform: rotate(-12deg);
}

.hero-panel h2 {
  margin: 0.4rem 0 0.9rem;
  font-size: clamp(2.3rem, 5vw, 4.4rem);
  line-height: 1.05;
  color: #23322d;
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.28);
}

.hero-copy,
.section-heading p,
.dialog-card p,
.title-summary,
.info-panel p,
.menu-zone small {
  margin: 0;
  color: #55645d;
  line-height: 1.75;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.85rem;
  margin-top: 1.6rem;
}

.home-observation-card,
.title-card,
.dialog-card {
  border-radius: 1.7rem;
  padding: 1.6rem;
}

.home-observation-card {
  align-self: end;
  background:
    linear-gradient(180deg, rgba(248, 244, 234, 0.94), rgba(225, 235, 224, 0.82));
  box-shadow: 0 30px 60px rgba(15, 29, 22, 0.18);
}

.home-observation-card ul,
.dialog-card ul {
  margin: 1rem 0 0;
  padding-left: 1.25rem;
  line-height: 1.7;
  color: var(--muted);
}

#menu-screen,
#title-screen {
  gap: 1.2rem;
  align-content: start;
}

#menu-screen .section-heading {
  padding: 1.2rem 1.4rem;
  border-radius: 1.6rem;
  max-width: 54rem;
  background: rgba(247, 241, 228, 0.82);
  box-shadow: 0 22px 42px rgba(25, 37, 31, 0.12);
}

.section-heading {
  max-width: 48rem;
}

.section-heading.compact h2 {
  font-size: 1.7rem;
}

.menu-map {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1.2rem;
  height: 100%;
  align-items: end;
  padding: 2rem;
  border-radius: 2rem;
  background:
    linear-gradient(180deg, rgba(247, 240, 225, 0.18), rgba(247, 240, 225, 0.08)),
    url("../image/generated/menu-ecology-map.png");
  background-size: cover;
  background-position: center;
  box-shadow: inset 0 0 0 1px rgba(255, 248, 231, 0.18), var(--shadow);
}

.menu-zone {
  position: relative;
  overflow: hidden;
  border-radius: 1.8rem;
  padding: 1.8rem;
  text-align: left;
  min-height: 16rem;
  align-self: end;
  box-shadow: 0 24px 46px rgba(46, 36, 18, 0.2);
}

.zone-memory {
  background:
    linear-gradient(160deg, rgba(133, 100, 60, 0.95), rgba(89, 68, 43, 0.94)),
    linear-gradient(180deg, rgba(255, 255, 255, 0.1), transparent);
}

.zone-puzzle {
  background:
    linear-gradient(160deg, rgba(205, 187, 150, 0.96), rgba(150, 127, 93, 0.94)),
    linear-gradient(180deg, rgba(255, 255, 255, 0.16), transparent);
}

.menu-zone strong {
  display: block;
  margin: 0.7rem 0 0.5rem;
  font-family: var(--font-display);
  font-size: clamp(1.8rem, 4vw, 3rem);
}

.zone-memory strong,
.zone-memory small,
.zone-memory .zone-type {
  color: #f9f3e6;
}

.zone-puzzle strong {
  color: #47351e;
}

.zone-puzzle small,
.zone-puzzle .zone-type {
  color: rgba(71, 53, 30, 0.82);
}

.zone-memory::after,
.zone-puzzle::after {
  content: "";
  position: absolute;
  inset: auto -4rem -4rem auto;
  width: 13rem;
  height: 13rem;
  border-radius: 50%;
  opacity: 0.26;
}

.zone-memory::after {
  background: radial-gradient(circle, rgba(106, 144, 138, 0.62), transparent 68%);
}

.zone-puzzle::after {
  background: radial-gradient(circle, rgba(148, 124, 92, 0.55), transparent 68%);
}

#memory-screen {
  display: none;
}

#memory-screen.screen-active {
  display: block;
}

.memory-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.18fr) minmax(24rem, 0.82fr);
  gap: 1rem;
  height: 100%;
}

.habitat-panel,
.card-panel {
  border-radius: 2rem;
  padding: 1.2rem;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.habitat-panel {
  background:
    linear-gradient(180deg, rgba(250, 247, 241, 0.9), rgba(226, 236, 220, 0.72));
  overflow: hidden;
}

.habitat-stage {
  flex: 1;
  margin-top: 1rem;
  border-radius: 1.6rem;
  padding: 0;
  background:
    linear-gradient(180deg, rgba(245, 241, 231, 0.2), rgba(213, 224, 207, 0.12));
  overflow: hidden;
  display: flex;
  align-items: center;
  box-shadow:
    0 18px 38px rgba(33, 43, 36, 0.18),
    inset 0 0 0 1px rgba(255, 255, 255, 0.3);
}

.habitat-map {
  position: relative;
  width: 100%;
  margin: 0 auto;
  aspect-ratio: 1672 / 941;
  overflow: hidden;
  border-radius: inherit;
  background: #dde6d8;
}

.habitat-map-base {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.habitat-bird-layer {
  position: absolute;
  inset: 0;
}

.habitat-bird {
  position: absolute;
  margin: 0;
  transform: translate(-50%, -50%);
  pointer-events: none;
  transform-origin: 50% 85%;
}

.habitat-bird img {
  display: block;
  width: 100%;
  height: auto;
  filter: drop-shadow(0 0.25rem 0.35rem rgba(43, 50, 43, 0.2));
  transition: opacity 900ms ease, filter 900ms ease, transform 900ms ease;
}

.habitat-bird .bird-color {
  position: absolute;
  inset: 0;
  opacity: 0;
  transform: scale(0.96);
}

.habitat-bird .bird-silhouette {
  opacity: 0.68;
  filter:
    drop-shadow(0 0.18rem 0.22rem rgba(35, 42, 39, 0.22))
    blur(0.1px);
}

.habitat-bird.is-awake .bird-color {
  opacity: 1;
  transform: scale(1);
}

.habitat-bird.is-awake .bird-silhouette {
  opacity: 0;
}

.habitat-bird.is-ambient .bird-color {
  opacity: 0.82;
  filter:
    saturate(0.86)
    opacity(0.9)
    drop-shadow(0 0.18rem 0.28rem rgba(43, 50, 43, 0.14));
}

.habitat-bird.is-question.is-silhouette {
  animation: silhouetteSleep 5s ease-in-out infinite;
}

.habitat-bird.just-awakened {
  animation: awakenReturn 1500ms ease forwards, birdBreath 5.8s ease-in-out infinite 1500ms;
  z-index: 4;
}

.habitat-bird.is-awake:not(.just-awakened) {
  animation: birdBreath 5.8s ease-in-out infinite;
}

.habitat-bird figcaption {
  position: absolute;
  left: 50%;
  bottom: -0.55rem;
  transform: translateX(-50%);
  padding: 0.12rem 0.38rem;
  border-radius: 999px;
  background: rgba(249, 245, 234, 0.75);
  color: rgba(49, 64, 56, 0.8);
  font-size: clamp(0.48rem, 0.9vw, 0.68rem);
  white-space: nowrap;
  opacity: 0;
  transition: opacity 500ms ease, transform 500ms ease;
}

.habitat-bird.is-awake figcaption {
  opacity: 1;
  transform: translateX(-50%) translateY(0.16rem);
}

.info-panel {
  margin-top: 1rem;
  border-radius: 1.2rem;
  padding: 1rem 1.1rem;
  min-height: 7.5rem;
}

.card-panel {
  background:
    linear-gradient(180deg, rgba(248, 243, 232, 0.94), rgba(229, 220, 198, 0.88));
}

.game-toolbar,
.card-panel-actions {
  display: flex;
  justify-content: space-between;
  gap: 0.9rem;
  align-items: center;
}

.toolbar-metrics {
  display: flex;
  gap: 0.75rem;
}

.metric-chip {
  border-radius: 1rem;
  padding: 0.75rem 0.9rem;
  min-width: 7rem;
}

.metric-chip span {
  display: block;
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.metric-chip strong {
  font-size: 1.4rem;
  font-family: var(--font-display);
}

.card-grid {
  flex: 1;
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 0.9rem;
  margin: 1rem 0;
  border-radius: 1.5rem;
  padding: 1rem;
  background:
    linear-gradient(180deg, rgba(255, 252, 247, 0.78), rgba(233, 227, 214, 0.84));
}

.memory-card {
  position: relative;
  aspect-ratio: 0.78;
  border-radius: 1rem;
  transform-style: preserve-3d;
  transition: transform 400ms ease;
  box-shadow: 0 12px 24px rgba(53, 40, 24, 0.18);
}

.memory-card.is-flipped,
.memory-card.is-matched {
  transform: rotateY(180deg);
}

.memory-card.is-returning {
  animation: matchedPause 1.05s ease forwards;
}

.memory-card button {
  position: absolute;
  inset: 0;
  border: 0;
  border-radius: 1rem;
  padding: 0;
  transform-style: preserve-3d;
  background: transparent;
}

.card-face {
  position: absolute;
  inset: 0;
  backface-visibility: hidden;
  border-radius: inherit;
  overflow: hidden;
}

.card-face img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.card-front {
  transform: rotateY(180deg);
  background: #fbf7ef;
}

.card-front::after {
  content: attr(data-name);
  position: absolute;
  inset: auto 0.55rem 0.55rem;
  padding: 0.45rem 0.6rem;
  border-radius: 0.7rem;
  background: rgba(248, 243, 231, 0.82);
  font-size: 0.82rem;
  color: #314038;
}

.card-back {
  background: #cbb086;
}

.card-back::after {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.16), transparent 30%),
    linear-gradient(135deg, rgba(95, 67, 38, 0.18), transparent 55%);
}

.card-panel-actions {
  justify-content: flex-end;
}

.title-card {
  max-width: 54rem;
  background:
    linear-gradient(160deg, rgba(249, 245, 236, 0.96), rgba(227, 238, 221, 0.86));
}

.overlay-dialog {
  border: 0;
  padding: 0;
  background: transparent;
  width: min(90vw, 38rem);
}

.overlay-dialog::backdrop {
  background: rgba(19, 27, 24, 0.48);
  backdrop-filter: blur(6px);
}

.dialog-card {
  background: var(--card-strong);
}

.species-dialog-card {
  background:
    linear-gradient(160deg, rgba(250, 246, 237, 0.96), rgba(232, 240, 226, 0.92));
}

.species-virtue-line {
  margin-top: 1rem !important;
  color: #31453b !important;
}

.species-dialog-hint,
.idle-countdown {
  margin-top: 1rem !important;
}

@keyframes fadeScreen {
  from {
    opacity: 0;
    transform: translateY(8px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes slowGlow {
  from {
    opacity: 0.74;
    transform: scale(1);
  }

  to {
    opacity: 1;
    transform: scale(1.04);
  }
}

@keyframes habitatAwaken {
  0% {
    transform: scale(1.03);
    filter: saturate(0.75);
  }

  100% {
    transform: scale(1);
    filter: saturate(1);
  }
}

@keyframes birdBreath {
  0%,
  100% {
    transform: translate(-50%, -50%) scale(1) translateY(0);
  }

  50% {
    transform: translate(-50%, -50%) scale(1.018) translateY(-2px);
  }
}

@keyframes silhouetteSleep {
  0%,
  100% {
    opacity: 0.72;
    transform: translate(-50%, -50%) scale(1);
  }

  50% {
    opacity: 0.48;
    transform: translate(-50%, -50%) scale(0.985);
  }
}

@keyframes awakenReturn {
  0% {
    opacity: 0.55;
    transform: translate(-50%, -50%) scale(0.84);
    filter: brightness(1.2) saturate(0.7);
  }

  58% {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1.08);
    filter: brightness(1.08) saturate(1.08);
  }

  100% {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
    filter: brightness(1) saturate(1);
  }
}

@keyframes matchedPause {
  0% {
    transform: rotateY(180deg) scale(1);
    box-shadow: 0 12px 24px rgba(53, 40, 24, 0.18);
  }

  50% {
    transform: rotateY(180deg) scale(1.04);
    box-shadow: 0 22px 34px rgba(127, 98, 53, 0.26);
  }

  100% {
    transform: rotateY(180deg) scale(1);
    box-shadow: 0 14px 24px rgba(53, 40, 24, 0.18);
  }
}

@keyframes buttonBreath {
  0%,
  100% {
    box-shadow: 0 16px 28px rgba(68, 46, 24, 0.18);
    transform: translateY(0);
  }

  50% {
    box-shadow: 0 22px 38px rgba(68, 46, 24, 0.24);
    transform: translateY(-2px);
  }
}

@keyframes drift {
  0% {
    transform: translate3d(0, 0, 0) scale(0.7);
    opacity: 0;
  }

  15% {
    opacity: 0.7;
  }

  100% {
    transform: translate3d(4vw, -34vh, 0) scale(1.12);
    opacity: 0;
  }
}

@media (max-width: 1100px) {
  body {
    overflow: auto;
  }

  .screen-stack {
    height: auto;
  }

  #home-screen,
  .memory-layout,
  .menu-map {
    grid-template-columns: 1fr;
  }

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

  .toolbar-metrics {
    flex-wrap: wrap;
  }
}

/* Exhibition scene revision: let the illustration become the space, not a picture under cards. */
.app-shell::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 0;
  background-size: cover;
  background-position: center;
  transform: scale(1.015);
  transition: background-image 500ms ease, opacity 500ms ease, transform 700ms ease;
}

.app-shell::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background:
    linear-gradient(90deg, rgba(14, 27, 22, 0.5), rgba(14, 27, 22, 0.08) 46%, rgba(14, 27, 22, 0.38)),
    linear-gradient(180deg, rgba(18, 31, 26, 0.22), rgba(18, 31, 26, 0.4));
}

body[data-screen="home-screen"] .app-shell::before {
  background-image: url("../image/generated/home-forest-mural.png");
  opacity: 1;
}

body[data-screen="menu-screen"] .app-shell::before {
  background-image: url("../image/generated/menu-ecology-map.png");
  opacity: 1;
}

body[data-screen="memory-screen"] .app-shell::before,
body[data-screen="title-screen"] .app-shell::before {
  background-image: url("../image/generated/home-forest-mural.png");
  opacity: 0.78;
}

body[data-screen="memory-screen"] .app-shell::before {
  background-image: url("../image/generated/habitat-stage-background-v3-left-focus.png");
  background-position: left center;
  opacity: 0.84;
}

.screen-stack::before {
  display: none;
}

.atmosphere-back,
.atmosphere-mid {
  opacity: 0.25;
}

.top-bar {
  padding: 1.8rem 2.4rem 0;
}

.brand-mark h1 {
  text-shadow: 0 2px 18px rgba(16, 28, 22, 0.4);
}

.brand-kicker {
  color: rgba(255, 252, 238, 0.88);
  text-shadow: 0 2px 14px rgba(16, 28, 22, 0.35);
}

.ghost-button {
  background: rgba(246, 239, 222, 0.2);
  color: #fff8ea;
  box-shadow:
    inset 0 0 0 1px rgba(255, 248, 231, 0.34),
    0 14px 30px rgba(17, 28, 23, 0.18);
}

.screen-stack {
  height: calc(100vh - 5.2rem);
  padding: 0 2.4rem 2.2rem;
  overflow: visible;
}

#home-screen {
  grid-template-columns: minmax(28rem, 0.72fr) minmax(18rem, 0.38fr);
  gap: clamp(2rem, 6vw, 7rem);
  align-items: end;
  padding-bottom: 3.2rem;
}

.hero-panel,
.home-observation-card {
  border: 0;
  box-shadow: none;
  backdrop-filter: none;
  background: transparent;
}

.hero-panel {
  padding: 0;
  max-width: 58rem;
  align-content: end;
  overflow: visible;
}

.hero-panel::after {
  display: none;
}

.hero-panel .eyebrow {
  color: rgba(255, 248, 225, 0.86);
  text-shadow: 0 2px 16px rgba(21, 34, 28, 0.55);
}

.hero-panel h2 {
  max-width: 52rem;
  color: #fff8e8;
  font-size: clamp(3.2rem, 6.4vw, 6.8rem);
  line-height: 1.02;
  text-shadow:
    0 3px 20px rgba(11, 20, 16, 0.56),
    0 1px 1px rgba(11, 20, 16, 0.36);
}

.hero-copy {
  max-width: 45rem;
  color: rgba(255, 250, 237, 0.9);
  font-size: 1.08rem;
  text-shadow: 0 2px 14px rgba(15, 27, 22, 0.58);
}

.home-observation-card {
  align-self: end;
  max-width: 29rem;
  padding: 1.2rem 0 0 1.25rem;
  border-left: 1px solid rgba(255, 248, 231, 0.45);
}

.home-observation-card .card-label,
.home-observation-card h3,
.home-observation-card li {
  color: rgba(255, 250, 237, 0.9);
  text-shadow: 0 2px 12px rgba(15, 27, 22, 0.55);
}

.home-observation-card h3 {
  margin-top: 0.6rem;
}

.home-observation-card ul {
  padding-left: 1.1rem;
  color: rgba(255, 250, 237, 0.84);
}

.wood-button {
  border-radius: 0.8rem;
  min-width: 10.5rem;
  box-shadow:
    inset 0 1px 0 rgba(255, 248, 226, 0.24),
    0 20px 36px rgba(37, 26, 12, 0.26);
}

.primary-button {
  background:
    linear-gradient(180deg, rgba(177, 127, 69, 0.98), rgba(91, 60, 27, 0.98)),
    linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.12), transparent);
}

.secondary-button {
  background: rgba(242, 223, 183, 0.9);
  color: #4a351d;
}

#menu-screen {
  align-content: end;
  padding-bottom: 3rem;
}

#menu-screen .section-heading {
  max-width: 46rem;
  padding: 0;
  background: transparent;
  box-shadow: none;
}

#menu-screen .section-heading .eyebrow,
#menu-screen .section-heading h2,
#menu-screen .section-heading p {
  color: #fff8e8;
  text-shadow: 0 2px 16px rgba(14, 27, 22, 0.6);
}

#menu-screen .section-heading h2 {
  font-size: clamp(2.4rem, 4vw, 4.2rem);
}

.menu-map {
  height: auto;
  min-height: 20rem;
  align-items: end;
  padding: 0;
  gap: 1rem;
  background: transparent;
  box-shadow: none;
  grid-template-columns: repeat(2, minmax(18rem, 32rem));
}

.menu-zone {
  min-height: 12rem;
  border-radius: 0.75rem;
  padding: 1.45rem 1.65rem;
  border: 1px solid rgba(255, 244, 218, 0.28);
  transform-origin: center bottom;
}

.menu-zone::before {
  content: "";
  position: absolute;
  inset: 0.65rem;
  border: 1px solid rgba(255, 244, 218, 0.22);
  border-radius: 0.55rem;
  pointer-events: none;
}

.zone-memory {
  background:
    linear-gradient(180deg, rgba(126, 88, 45, 0.96), rgba(74, 51, 27, 0.96));
}

.zone-puzzle {
  background:
    linear-gradient(180deg, rgba(217, 191, 143, 0.96), rgba(159, 131, 83, 0.96));
}

.menu-zone strong {
  font-size: clamp(2.2rem, 4.5vw, 4.2rem);
  line-height: 1.1;
}

.menu-zone small {
  display: block;
  margin-top: 1rem;
  font-size: 1rem;
}

.zone-memory::after,
.zone-puzzle::after {
  opacity: 0.16;
}

.memory-card.is-returning {
  animation: matchedPause 1.3s ease forwards;
}

@media (max-width: 1100px) {
  .top-bar {
    padding: 1.2rem 1rem 0;
  }

  .screen-stack {
    padding: 0 1rem 1.2rem;
  }

  #home-screen {
    grid-template-columns: 1fr;
    padding-bottom: 2rem;
  }

  .hero-panel h2 {
    font-size: clamp(2.7rem, 14vw, 4.5rem);
  }

  .home-observation-card {
    max-width: none;
  }

  .menu-map {
    grid-template-columns: 1fr;
  }
}

/* Memory scene refinement: the habitat image becomes the game space itself. */
body[data-screen="memory-screen"] .app-shell::before {
  opacity: 1;
  transform: none;
}

body[data-screen="memory-screen"] .app-shell::after {
  background:
    radial-gradient(circle at 30% 22%, rgba(255, 250, 223, 0.14), transparent 23%),
    linear-gradient(90deg, rgba(11, 22, 18, 0.58), rgba(11, 22, 18, 0.08) 42%, rgba(11, 22, 18, 0.52)),
    linear-gradient(180deg, rgba(13, 24, 20, 0.16), rgba(13, 24, 20, 0.5));
}

body[data-screen="memory-screen"] .screen-stack {
  padding: 0 clamp(1.4rem, 3vw, 3.2rem) clamp(1rem, 2vw, 1.8rem);
}

body[data-screen="memory-screen"] #memory-screen.screen-active {
  display: block;
}

body[data-screen="memory-screen"] .memory-layout {
  position: relative;
  z-index: 2;
  display: grid;
  grid-template-columns: minmax(26rem, 1fr) minmax(28rem, 38rem);
  gap: clamp(1.5rem, 3vw, 3.2rem);
  height: 100%;
  align-items: stretch;
}

body[data-screen="memory-screen"] .habitat-panel,
body[data-screen="memory-screen"] .card-panel {
  border: 0;
  box-shadow: none;
  backdrop-filter: none;
}

body[data-screen="memory-screen"] .habitat-panel {
  position: relative;
  z-index: 2;
  display: flex;
  justify-content: space-between;
  padding: clamp(0.4rem, 1.4vw, 1.2rem) 0 0.2rem;
  overflow: visible;
  background: transparent;
  pointer-events: none;
}

body[data-screen="memory-screen"] .section-heading.compact {
  width: min(34rem, 92%);
  padding: 0.95rem 1.2rem 1.05rem;
  border-left: 1px solid rgba(255, 246, 220, 0.48);
  background:
    linear-gradient(90deg, rgba(21, 35, 28, 0.48), rgba(21, 35, 28, 0.08));
  box-shadow: none;
}

body[data-screen="memory-screen"] .section-heading.compact .eyebrow,
body[data-screen="memory-screen"] .section-heading.compact h2 {
  color: #fff8e8;
  text-shadow: 0 3px 18px rgba(8, 18, 14, 0.72);
}

body[data-screen="memory-screen"] .section-heading.compact h2 {
  font-size: clamp(2rem, 3.5vw, 3.55rem);
}

body[data-screen="memory-screen"] .habitat-stage {
  position: fixed;
  left: 0;
  top: 50%;
  z-index: 1;
  width: 100vw;
  aspect-ratio: 1672 / 941;
  margin: 0;
  padding: 0;
  transform: translateY(-50%);
  border-radius: 0;
  overflow: visible;
  pointer-events: none;
  background: transparent;
  box-shadow: none;
}

body[data-screen="memory-screen"] .habitat-map {
  width: 100%;
  height: 100%;
  overflow: visible;
  border-radius: 0;
  background: transparent;
}

body[data-screen="memory-screen"] .habitat-map-base {
  opacity: 0;
}

body[data-screen="memory-screen"] .habitat-bird {
  filter: drop-shadow(0 0.45rem 0.65rem rgba(10, 18, 14, 0.24));
}

body[data-screen="memory-screen"] .habitat-bird.is-question.is-silhouette {
  opacity: 0.72;
}

body[data-screen="memory-screen"] .habitat-bird figcaption {
  background: rgba(247, 238, 214, 0.78);
  color: rgba(31, 45, 38, 0.86);
  box-shadow: 0 0.35rem 1rem rgba(10, 18, 14, 0.18);
}

body[data-screen="memory-screen"] .info-panel {
  width: min(34rem, 92%);
  min-height: 0;
  margin: auto 0 0;
  padding: 1.05rem 1.15rem;
  border: 1px solid rgba(255, 246, 220, 0.42);
  border-radius: 0.95rem;
  background:
    linear-gradient(180deg, rgba(252, 246, 229, 0.82), rgba(228, 220, 194, 0.68));
  box-shadow:
    0 1.2rem 2.4rem rgba(7, 16, 12, 0.26),
    inset 0 1px 0 rgba(255, 255, 255, 0.42);
  backdrop-filter: blur(8px);
}

body[data-screen="memory-screen"] .info-panel .card-label {
  color: #846d4d;
}

body[data-screen="memory-screen"] .info-panel h3,
body[data-screen="memory-screen"] .info-panel p {
  color: #26372f;
}

body[data-screen="memory-screen"] .card-panel {
  position: relative;
  z-index: 3;
  align-self: end;
  max-height: min(100%, 46rem);
  padding: clamp(1rem, 2vw, 1.45rem);
  border: 1px solid rgba(255, 244, 216, 0.3);
  border-radius: 1.15rem;
  background:
    linear-gradient(180deg, rgba(77, 61, 42, 0.86), rgba(41, 35, 27, 0.78)),
    radial-gradient(circle at 30% 8%, rgba(255, 246, 211, 0.18), transparent 38%);
  box-shadow:
    0 1.7rem 3rem rgba(7, 16, 12, 0.34),
    inset 0 0 0 1px rgba(255, 246, 222, 0.12);
  backdrop-filter: blur(9px) saturate(0.9);
}

body[data-screen="memory-screen"] .game-toolbar {
  align-items: flex-start;
}

body[data-screen="memory-screen"] .game-toolbar .card-label {
  color: rgba(246, 232, 199, 0.78);
}

body[data-screen="memory-screen"] .game-toolbar h3 {
  color: #fff8e8;
  text-shadow: 0 2px 14px rgba(7, 16, 12, 0.46);
}

body[data-screen="memory-screen"] .metric-chip {
  min-width: 5.6rem;
  padding: 0.65rem 0.75rem;
  border: 1px solid rgba(255, 248, 226, 0.4);
  background:
    linear-gradient(180deg, rgba(252, 244, 222, 0.9), rgba(224, 207, 171, 0.82));
  color: #26372f;
  box-shadow: 0 0.85rem 1.8rem rgba(12, 18, 13, 0.2);
}

body[data-screen="memory-screen"] .metric-chip span {
  color: rgba(60, 51, 37, 0.7);
}

body[data-screen="memory-screen"] .card-grid {
  flex: 1;
  min-height: 0;
  gap: clamp(0.5rem, 1.1vw, 0.85rem);
  margin: 1rem 0 0.95rem;
  padding: clamp(0.75rem, 1.5vw, 1rem);
  border: 1px solid rgba(255, 244, 216, 0.25);
  border-radius: 0.95rem;
  background:
    linear-gradient(180deg, rgba(255, 248, 225, 0.18), rgba(255, 248, 225, 0.08)),
    repeating-linear-gradient(90deg, rgba(255, 248, 225, 0.04) 0 1px, transparent 1px 3.2rem);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.12),
    inset 0 -1rem 3rem rgba(8, 14, 10, 0.12);
}

body[data-screen="memory-screen"] .memory-card {
  border-radius: 0.72rem;
  box-shadow:
    0 0.8rem 1.35rem rgba(8, 14, 10, 0.28),
    0 0 0 1px rgba(255, 244, 216, 0.12);
}

body[data-screen="memory-screen"] .memory-card button {
  border-radius: 0.72rem;
}

body[data-screen="memory-screen"] .card-front::after {
  inset: auto 0.38rem 0.38rem;
  padding: 0.34rem 0.42rem;
  border-radius: 0.5rem;
  background: rgba(251, 246, 231, 0.88);
  color: #25352e;
  font-size: 0.76rem;
  text-align: center;
}

body[data-screen="memory-screen"] .card-panel-actions .ghost-button {
  color: #fff8e8;
  background: rgba(255, 248, 226, 0.16);
  box-shadow:
    inset 0 0 0 1px rgba(255, 248, 226, 0.34),
    0 0.85rem 1.8rem rgba(8, 14, 10, 0.2);
}

@media (max-aspect-ratio: 1672/941) {
  body[data-screen="memory-screen"] .habitat-stage {
    left: 50%;
    top: 0;
    width: auto;
    height: 100vh;
    transform: translateX(-50%);
  }
}

@media (max-width: 1100px) {
  body[data-screen="memory-screen"] .screen-stack {
    height: auto;
    min-height: calc(100vh - 5.2rem);
    overflow: visible;
  }

  body[data-screen="memory-screen"] .memory-layout {
    grid-template-columns: 1fr;
    gap: 1rem;
  }

  body[data-screen="memory-screen"] .habitat-panel {
    min-height: 18rem;
  }

  body[data-screen="memory-screen"] .info-panel,
  body[data-screen="memory-screen"] .section-heading.compact {
    width: 100%;
  }

  body[data-screen="memory-screen"] .card-panel {
    max-height: none;
  }

  body[data-screen="memory-screen"] .card-grid {
    grid-template-columns: repeat(5, minmax(0, 1fr));
  }
}

@media (max-width: 720px) {
  body[data-screen="memory-screen"] .card-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  body[data-screen="memory-screen"] .game-toolbar,
  body[data-screen="memory-screen"] .card-panel-actions {
    align-items: stretch;
    flex-direction: column;
  }

  body[data-screen="memory-screen"] .toolbar-metrics {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

/* Memory panel art direction v2: field-station specimen board. */
body[data-screen="memory-screen"] .card-panel {
  --panel-walnut: #3f3020;
  --panel-walnut-dark: #211b14;
  --panel-brass: #c4a56b;
  --panel-paper: #f4ead4;
  --panel-sage: #788b63;
  --panel-ink: #26372f;
  isolation: isolate;
  border-color: rgba(245, 226, 178, 0.46);
  border-radius: 1.45rem;
  background:
    radial-gradient(circle at 18% 0%, rgba(255, 239, 183, 0.24), transparent 34%),
    linear-gradient(135deg, rgba(84, 63, 37, 0.96), rgba(39, 31, 22, 0.93) 62%, rgba(26, 24, 19, 0.9)),
    repeating-linear-gradient(90deg, rgba(255, 242, 205, 0.04) 0 1px, transparent 1px 3.7rem);
  box-shadow:
    0 1.9rem 3.4rem rgba(7, 16, 12, 0.42),
    inset 0 0 0 1px rgba(255, 246, 222, 0.16),
    inset 0 1.2rem 3rem rgba(255, 239, 185, 0.08);
}

body[data-screen="memory-screen"] .card-panel::before,
body[data-screen="memory-screen"] .card-panel::after {
  content: "";
  position: absolute;
  pointer-events: none;
  z-index: -1;
}

body[data-screen="memory-screen"] .card-panel::before {
  inset: 0.55rem;
  border: 1px solid rgba(245, 226, 178, 0.24);
  border-radius: 1.05rem;
  background:
    linear-gradient(90deg, transparent, rgba(255, 242, 205, 0.08), transparent),
    radial-gradient(circle at 100% 0%, rgba(170, 202, 150, 0.13), transparent 32%);
}

body[data-screen="memory-screen"] .card-panel::after {
  right: 1.1rem;
  bottom: 1rem;
  width: 8rem;
  height: 8rem;
  border-radius: 999px;
  background:
    radial-gradient(circle, rgba(255, 240, 190, 0.13), transparent 64%),
    conic-gradient(from 30deg, transparent, rgba(255, 238, 190, 0.13), transparent 34%);
  filter: blur(1px);
}

body[data-screen="memory-screen"] .game-toolbar {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 1rem;
  align-items: stretch;
  padding-bottom: 0.15rem;
}

body[data-screen="memory-screen"] .game-toolbar > div:first-child {
  align-self: center;
  padding-left: 0.3rem;
}

body[data-screen="memory-screen"] .game-toolbar h3 {
  margin-top: 0.28rem;
  font-size: clamp(1.45rem, 2.3vw, 2.05rem);
  letter-spacing: 0.08em;
}

body[data-screen="memory-screen"] .toolbar-metrics {
  display: grid;
  grid-template-columns: repeat(2, minmax(6.5rem, 1fr));
  gap: 0.7rem;
}

body[data-screen="memory-screen"] .metric-chip {
  --metric-progress: 1;
  --timer-glow: rgba(142, 160, 98, 0.2);
  position: relative;
  overflow: hidden;
  min-width: 0;
  padding: 0.75rem 0.8rem 0.68rem;
  border-radius: 1rem;
  border: 1px solid rgba(255, 247, 219, 0.64);
  background:
    linear-gradient(180deg, rgba(255, 250, 236, 0.94), rgba(226, 207, 165, 0.9)),
    radial-gradient(circle at 85% 15%, rgba(255, 255, 255, 0.45), transparent 34%);
  box-shadow:
    0 0.95rem 1.8rem rgba(10, 16, 12, 0.24),
    inset 0 1px 0 rgba(255, 255, 255, 0.46),
    0 0 0 rgba(0, 0, 0, 0);
}

body[data-screen="memory-screen"] .metric-chip::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(135deg, rgba(93, 116, 81, 0.1), transparent 40%),
    repeating-linear-gradient(45deg, rgba(82, 61, 34, 0.035) 0 1px, transparent 1px 0.48rem);
  opacity: 0.85;
  pointer-events: none;
}

body[data-screen="memory-screen"] .metric-chip > span,
body[data-screen="memory-screen"] .metric-chip > strong,
body[data-screen="memory-screen"] .metric-bar,
body[data-screen="memory-screen"] .timer-status,
body[data-screen="memory-screen"] .match-status,
body[data-screen="memory-screen"] .match-pips {
  position: relative;
  z-index: 1;
}

body[data-screen="memory-screen"] .metric-chip > span {
  color: rgba(63, 48, 32, 0.72);
  font-size: 0.68rem;
  letter-spacing: 0.16em;
}

body[data-screen="memory-screen"] .metric-chip > strong {
  display: flex;
  align-items: baseline;
  gap: 0.24rem;
  margin-top: 0.08rem;
  color: #27382f;
  font-size: clamp(1.55rem, 2.7vw, 2.2rem);
  line-height: 1;
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.36);
}

body[data-screen="memory-screen"] .metric-chip small {
  font-size: 0.72rem;
  font-family: var(--font-body);
  font-weight: 600;
  color: rgba(63, 48, 32, 0.62);
}

body[data-screen="memory-screen"] .timer-status,
body[data-screen="memory-screen"] .match-status {
  margin: 0.42rem 0 0;
  min-height: 1em;
  color: rgba(63, 48, 32, 0.66);
  font-size: 0.66rem;
  letter-spacing: 0.08em;
  white-space: nowrap;
}

body[data-screen="memory-screen"] .metric-bar {
  display: block;
  height: 0.34rem;
  margin-top: 0.52rem;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(67, 58, 38, 0.18);
  box-shadow: inset 0 1px 2px rgba(46, 36, 20, 0.28);
}

body[data-screen="memory-screen"] .metric-bar i {
  display: block;
  position: relative;
  width: calc(var(--metric-progress, 1) * 100%);
  height: 100%;
  border-radius: inherit;
  background:
    linear-gradient(90deg, #788b63, #d9c678 58%, #b56f44),
    linear-gradient(180deg, rgba(255, 255, 255, 0.35), transparent);
  transition: width 450ms ease;
}

body[data-screen="memory-screen"] .metric-bar i::after {
  content: "";
  position: absolute;
  inset: 0;
  transform: translateX(-70%);
  background: linear-gradient(90deg, transparent, rgba(255, 255, 235, 0.65), transparent);
  animation: timerFlow 1.8s ease-in-out infinite;
}

body[data-screen="memory-screen"] .timer-chip::after {
  display: none;
}

body[data-screen="memory-screen"] .timer-chip.timer-state-warning {
  --timer-glow: rgba(218, 186, 94, 0.32);
  animation: timerWarningPulse 1.35s ease-in-out infinite;
}

body[data-screen="memory-screen"] .timer-chip.timer-state-warning .metric-bar i {
  background:
    linear-gradient(90deg, #d0b75e, #d18b4c),
    linear-gradient(180deg, rgba(255, 255, 255, 0.35), transparent);
}

body[data-screen="memory-screen"] .timer-chip.timer-state-danger {
  --timer-glow: rgba(194, 83, 55, 0.42);
  animation: timerDangerPulse 760ms ease-in-out infinite;
}

body[data-screen="memory-screen"] .timer-chip.timer-state-danger > strong {
  color: #7d2f21;
  animation: timerDigitJolt 760ms steps(2, end) infinite;
}

body[data-screen="memory-screen"] .timer-chip.timer-state-danger .metric-bar i,
body[data-screen="memory-screen"] .timer-chip.timer-state-expired .metric-bar i {
  background:
    linear-gradient(90deg, #b96e3e, #bf3f34),
    linear-gradient(180deg, rgba(255, 255, 255, 0.35), transparent);
}

body[data-screen="memory-screen"] .timer-chip.timer-state-expired {
  animation: none;
  background:
    linear-gradient(180deg, rgba(253, 224, 204, 0.96), rgba(195, 114, 84, 0.9));
}

body[data-screen="memory-screen"] .match-pips {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 0.28rem;
  margin-top: 0.58rem;
}

body[data-screen="memory-screen"] .match-pips i {
  position: relative;
  height: 1.05rem;
  border-radius: 0.35rem 0.65rem 0.35rem 0.65rem;
  background:
    linear-gradient(180deg, rgba(84, 72, 45, 0.16), rgba(84, 72, 45, 0.09));
  box-shadow:
    inset 0 1px 2px rgba(46, 36, 20, 0.2),
    0 1px 0 rgba(255, 255, 255, 0.2);
  transform: rotate(-8deg);
  transition: background 350ms ease, transform 350ms ease, box-shadow 350ms ease;
}

body[data-screen="memory-screen"] .match-pips i::before {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: 0.38rem;
  height: 0.38rem;
  border-radius: 50%;
  transform: translate(-50%, -50%);
  background: rgba(255, 248, 226, 0.28);
}

body[data-screen="memory-screen"] .match-count-1 .match-pips i:nth-child(-n + 1),
body[data-screen="memory-screen"] .match-count-2 .match-pips i:nth-child(-n + 2),
body[data-screen="memory-screen"] .match-count-3 .match-pips i:nth-child(-n + 3),
body[data-screen="memory-screen"] .match-count-4 .match-pips i:nth-child(-n + 4),
body[data-screen="memory-screen"] .match-count-5 .match-pips i:nth-child(-n + 5) {
  background:
    radial-gradient(circle at 45% 40%, rgba(255, 247, 196, 0.85), transparent 35%),
    linear-gradient(180deg, #d9c678, #7f9961);
  box-shadow:
    0 0 0.75rem rgba(220, 205, 123, 0.38),
    inset 0 1px 0 rgba(255, 255, 255, 0.38);
  transform: translateY(-2px) rotate(-8deg);
}

body[data-screen="memory-screen"] .match-chip.just-progressed {
  animation: progressCardLift 860ms ease;
}

body[data-screen="memory-screen"] .match-chip.just-progressed .match-pips i {
  animation: matchStamp 780ms ease;
}

body[data-screen="memory-screen"] .time-up-flash {
  position: absolute;
  inset: 1rem;
  z-index: 8;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 0.35rem;
  border: 1px solid rgba(255, 238, 194, 0.36);
  border-radius: 1.1rem;
  background:
    radial-gradient(circle at 50% 44%, rgba(255, 238, 188, 0.36), transparent 32%),
    linear-gradient(180deg, rgba(31, 25, 18, 0.84), rgba(29, 24, 19, 0.92));
  color: #fff8e8;
  opacity: 0;
  pointer-events: none;
  transform: scale(0.96);
  transition: opacity 260ms ease, transform 260ms ease;
  backdrop-filter: blur(5px);
}

body[data-screen="memory-screen"] .time-up-flash span {
  font-family: var(--font-display);
  font-size: clamp(2.2rem, 6vw, 4.6rem);
  letter-spacing: 0.18em;
  text-shadow:
    0 0 1.1rem rgba(255, 212, 126, 0.42),
    0 0.18rem 0.6rem rgba(0, 0, 0, 0.38);
}

body[data-screen="memory-screen"] .time-up-flash small {
  color: rgba(255, 242, 210, 0.76);
  letter-spacing: 0.18em;
}

body[data-screen="memory-screen"] .card-panel.is-time-up .time-up-flash {
  opacity: 1;
  transform: scale(1);
  animation: timeUpReveal 1200ms ease;
}

body[data-screen="memory-screen"] .card-panel.is-time-up .card-grid,
body[data-screen="memory-screen"] .card-panel.is-time-up .game-toolbar,
body[data-screen="memory-screen"] .card-panel.is-time-up .card-panel-actions {
  filter: saturate(0.65) brightness(0.7);
}

body[data-timer-state="danger"] .card-panel {
  box-shadow:
    0 1.9rem 3.4rem rgba(7, 16, 12, 0.42),
    inset 0 0 0 1px rgba(255, 246, 222, 0.16),
    0 0 1.4rem rgba(194, 83, 55, 0.24);
}

body[data-screen="memory-screen"] .card-grid {
  position: relative;
  gap: clamp(0.58rem, 1vw, 0.82rem);
  padding: clamp(0.82rem, 1.3vw, 1.05rem);
  border-radius: 1.2rem;
  border-color: rgba(245, 226, 178, 0.34);
  background:
    radial-gradient(circle at 14% 10%, rgba(255, 239, 190, 0.16), transparent 36%),
    linear-gradient(180deg, rgba(255, 247, 222, 0.2), rgba(91, 71, 42, 0.15)),
    repeating-linear-gradient(0deg, rgba(255, 248, 225, 0.045) 0 1px, transparent 1px 2.55rem),
    rgba(31, 27, 21, 0.18);
}

body[data-screen="memory-screen"] .card-grid::before {
  content: "";
  position: absolute;
  inset: 0.55rem;
  border-radius: 0.86rem;
  border: 1px dashed rgba(255, 238, 194, 0.16);
  pointer-events: none;
}

body[data-screen="memory-screen"] .memory-card {
  border-radius: 0.95rem;
  box-shadow:
    0 0.95rem 1.45rem rgba(7, 14, 10, 0.32),
    0 0 0 1px rgba(255, 239, 197, 0.15);
}

body[data-screen="memory-screen"] .memory-card button {
  border-radius: 0.95rem;
}

body[data-screen="memory-screen"] .card-face {
  border: 1px solid rgba(255, 242, 208, 0.46);
  box-shadow:
    inset 0 0 0 0.24rem rgba(255, 252, 237, 0.22),
    inset 0 0 0 1px rgba(104, 79, 44, 0.16);
}

body[data-screen="memory-screen"] .card-back {
  background: #d8cba8;
}

body[data-screen="memory-screen"] .card-back img {
  object-fit: cover;
  transform: scale(1.02);
  filter: saturate(0.96) contrast(1.02);
}

body[data-screen="memory-screen"] .card-back::after {
  background:
    radial-gradient(circle at 50% 12%, rgba(255, 252, 230, 0.28), transparent 34%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.12), transparent 38%, rgba(63, 43, 22, 0.12));
}

body[data-screen="memory-screen"] .card-front {
  background:
    linear-gradient(180deg, #fbf7ef, #e8dcc4);
}

body[data-screen="memory-screen"] .card-front img {
  object-fit: cover;
  transform: scale(1.01);
}

body[data-screen="memory-screen"] .card-front::after {
  inset: auto 0.44rem 0.44rem;
  border: 1px solid rgba(111, 84, 45, 0.18);
  background:
    linear-gradient(180deg, rgba(255, 250, 236, 0.94), rgba(234, 222, 194, 0.9));
  box-shadow: 0 0.45rem 1rem rgba(40, 31, 18, 0.18);
  letter-spacing: 0.08em;
}

body[data-screen="memory-screen"] .memory-card:not(.is-flipped):not(.is-matched):hover {
  transform: translateY(-3px) rotateX(2deg);
}

body[data-screen="memory-screen"] .memory-card.is-matched {
  filter: saturate(0.9) brightness(1.05);
  box-shadow:
    0 0.75rem 1.3rem rgba(7, 14, 10, 0.22),
    0 0 0 1px rgba(217, 198, 120, 0.5),
    0 0 1.2rem rgba(217, 198, 120, 0.18);
}

body[data-screen="memory-screen"] .card-panel-actions {
  position: relative;
  justify-content: space-between;
  gap: 0.7rem;
}

body[data-screen="memory-screen"] .card-panel-actions .ghost-button {
  position: relative;
  overflow: hidden;
  min-width: 8.4rem;
  border-radius: 0.82rem;
  border: 1px solid rgba(255, 239, 197, 0.38);
  background:
    linear-gradient(180deg, rgba(255, 247, 222, 0.2), rgba(99, 72, 38, 0.3)),
    rgba(38, 31, 22, 0.34);
  color: #fff8e8;
  letter-spacing: 0.08em;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.16),
    0 0.9rem 1.7rem rgba(8, 14, 10, 0.24);
}

body[data-screen="memory-screen"] .card-panel-actions .ghost-button::before {
  content: "";
  position: absolute;
  inset: 0;
  transform: translateX(-120%);
  background: linear-gradient(90deg, transparent, rgba(255, 248, 220, 0.18), transparent);
  transition: transform 420ms ease;
}

body[data-screen="memory-screen"] .card-panel-actions .ghost-button:hover::before,
body[data-screen="memory-screen"] .card-panel-actions .ghost-button:focus-visible::before {
  transform: translateX(120%);
}

body[data-screen="memory-screen"] #restart-memory-button {
  background:
    linear-gradient(180deg, rgba(137, 105, 59, 0.94), rgba(74, 54, 30, 0.94));
}

body[data-screen="memory-screen"] #back-to-menu-button {
  background:
    linear-gradient(180deg, rgba(112, 132, 91, 0.86), rgba(53, 68, 48, 0.88));
}

@media (max-width: 720px) {
  body[data-screen="memory-screen"] .game-toolbar {
    grid-template-columns: 1fr;
  }

  body[data-screen="memory-screen"] .card-panel-actions {
    justify-content: stretch;
  }

  body[data-screen="memory-screen"] .card-panel-actions .ghost-button {
    width: 100%;
  }
}

@keyframes timerFlow {
  0% {
    transform: translateX(-80%);
  }

  100% {
    transform: translateX(120%);
  }
}

@keyframes timerWarningPulse {
  0%,
  100% {
    box-shadow:
      0 0.95rem 1.8rem rgba(10, 16, 12, 0.24),
      inset 0 1px 0 rgba(255, 255, 255, 0.46),
      0 0 0 rgba(218, 186, 94, 0);
  }

  50% {
    box-shadow:
      0 0.95rem 1.8rem rgba(10, 16, 12, 0.24),
      inset 0 1px 0 rgba(255, 255, 255, 0.46),
      0 0 1rem rgba(218, 186, 94, 0.32);
  }
}

@keyframes timerDangerPulse {
  0%,
  100% {
    transform: translateY(0);
    box-shadow:
      0 0.95rem 1.8rem rgba(10, 16, 12, 0.24),
      inset 0 1px 0 rgba(255, 255, 255, 0.46),
      0 0 0 rgba(194, 83, 55, 0);
  }

  50% {
    transform: translateY(-1px);
    box-shadow:
      0 0.95rem 1.8rem rgba(10, 16, 12, 0.24),
      inset 0 1px 0 rgba(255, 255, 255, 0.46),
      0 0 1.2rem rgba(194, 83, 55, 0.42);
  }
}

@keyframes timerDigitJolt {
  0%,
  100% {
    transform: translateX(0);
  }

  50% {
    transform: translateX(1px);
  }
}

@keyframes progressCardLift {
  0%,
  100% {
    transform: translateY(0);
  }

  45% {
    transform: translateY(-4px);
  }
}

@keyframes matchStamp {
  0% {
    transform: translateY(0) scale(0.88) rotate(-8deg);
  }

  55% {
    transform: translateY(-3px) scale(1.18) rotate(-8deg);
  }

  100% {
    transform: translateY(-2px) scale(1) rotate(-8deg);
  }
}

@keyframes timeUpReveal {
  0% {
    opacity: 0;
    transform: scale(0.92);
    filter: brightness(1.45);
  }

  28% {
    opacity: 1;
    transform: scale(1.025);
    filter: brightness(1.18);
  }

  100% {
    opacity: 1;
    transform: scale(1);
    filter: brightness(1);
  }
}

@media (prefers-reduced-motion: reduce) {
  body[data-screen="memory-screen"] .timer-chip,
  body[data-screen="memory-screen"] .timer-chip > strong,
  body[data-screen="memory-screen"] .timer-chip.just-ticked .timer-hand,
  body[data-screen="memory-screen"] .timer-chip.just-threshold .timer-dial,
  body[data-screen="memory-screen"] .timer-chip.just-threshold .timer-status,
  body[data-screen="memory-screen"] .metric-bar i::after,
  body[data-screen="memory-screen"] .match-chip.just-progressed,
  body[data-screen="memory-screen"] .match-chip.just-progressed .match-pips i,
  body[data-screen="memory-screen"] .card-panel.is-time-up .time-up-flash {
    animation: none;
  }
}

/* 1920x1080 exhibition tuning: larger habitat animals and vertical card play. */
body[data-screen="memory-screen"] .memory-layout {
  grid-template-columns: minmax(0, 1fr) clamp(30rem, 27vw, 34rem);
  gap: clamp(1.4rem, 2.4vw, 2.8rem);
}

body[data-screen="memory-screen"] .info-panel {
  display: none;
}

body[data-screen="memory-screen"] .habitat-panel {
  justify-content: flex-start;
}

body[data-screen="memory-screen"] .habitat-bird {
  transform: translate(-50%, -50%) scale(1.34);
}

body[data-screen="memory-screen"] .habitat-bird.is-question.is-silhouette {
  animation: memorySilhouetteSleepLarge 5s ease-in-out infinite;
}

body[data-screen="memory-screen"] .habitat-bird.just-awakened {
  animation: memoryAwakenReturnLarge 1500ms ease forwards, memoryBirdBreathLarge 5.8s ease-in-out infinite 1500ms;
}

body[data-screen="memory-screen"] .habitat-bird.is-awake:not(.just-awakened) {
  animation: memoryBirdBreathLarge 5.8s ease-in-out infinite;
}

body[data-screen="memory-screen"] .habitat-bird figcaption {
  bottom: -0.72rem;
  padding: 0.16rem 0.46rem;
  font-size: clamp(0.58rem, 0.9vw, 0.82rem);
}

body[data-screen="memory-screen"] .card-panel {
  align-self: stretch;
  max-height: none;
  padding: clamp(1rem, 1.45vw, 1.35rem);
}

body[data-screen="memory-screen"] .game-toolbar {
  grid-template-columns: minmax(8rem, 0.8fr) minmax(13rem, 1fr);
  gap: 0.75rem;
}

body[data-screen="memory-screen"] .game-toolbar h3 {
  font-size: clamp(1.75rem, 2.6vw, 2.5rem);
}

body[data-screen="memory-screen"] .toolbar-metrics {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

body[data-screen="memory-screen"] .metric-chip {
  padding: 0.62rem 0.72rem 0.58rem;
}

body[data-screen="memory-screen"] .metric-chip > strong {
  font-size: clamp(1.35rem, 2vw, 1.85rem);
}

body[data-screen="memory-screen"] .timer-status,
body[data-screen="memory-screen"] .match-status {
  white-space: normal;
}

body[data-screen="memory-screen"] .card-grid {
  flex: 1 1 auto;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  grid-template-rows: repeat(5, minmax(0, 1fr));
  align-items: stretch;
  justify-items: center;
  gap: clamp(0.52rem, 0.95vw, 0.82rem);
  min-height: 0;
  margin: clamp(0.7rem, 1.2vw, 1rem) 0;
  padding: clamp(0.7rem, 1vw, 0.95rem);
}

body[data-screen="memory-screen"] .memory-card {
  width: auto;
  height: 100%;
  max-width: 100%;
  aspect-ratio: 0.72;
}

body[data-screen="memory-screen"] .memory-card.is-flipped,
body[data-screen="memory-screen"] .memory-card.is-matched,
body[data-screen="memory-screen"] .memory-card.is-returning {
  transform: rotateY(180deg);
}

body[data-screen="memory-screen"] .memory-card.is-matched:not(.is-returning) {
  animation: none;
}

body[data-screen="memory-screen"] .memory-card.is-locked-front {
  transform: none;
}

body[data-screen="memory-screen"] .memory-card.is-locked-front .card-front {
  z-index: 2;
  transform: none;
}

body[data-screen="memory-screen"] .memory-card.is-locked-front .card-back {
  opacity: 0;
}

body[data-screen="memory-screen"] .memory-card.is-matched .card-front {
  box-shadow:
    inset 0 0 0 0.24rem rgba(255, 252, 237, 0.24),
    inset 0 0 0 1px rgba(104, 79, 44, 0.16),
    0 0 1.3rem rgba(222, 202, 119, 0.28);
}

body[data-screen="memory-screen"] .memory-card.is-matched .card-front::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background:
    radial-gradient(circle at 50% 20%, rgba(255, 245, 185, 0.18), transparent 38%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.08), transparent);
  pointer-events: none;
}

body[data-screen="memory-screen"] .card-panel-actions {
  flex: 0 0 auto;
}

@keyframes memoryBirdBreathLarge {
  0%,
  100% {
    transform: translate(-50%, -50%) scale(1.34) translateY(0);
  }

  50% {
    transform: translate(-50%, -50%) scale(1.37) translateY(-3px);
  }
}

@keyframes memorySilhouetteSleepLarge {
  0%,
  100% {
    opacity: 0.72;
    transform: translate(-50%, -50%) scale(1.34);
  }

  50% {
    opacity: 0.5;
    transform: translate(-50%, -50%) scale(1.3);
  }
}

@keyframes memoryAwakenReturnLarge {
  0% {
    opacity: 0.55;
    transform: translate(-50%, -50%) scale(1.08);
    filter: brightness(1.2) saturate(0.7);
  }

  58% {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1.43);
    filter: brightness(1.08) saturate(1.08);
  }

  100% {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1.34);
    filter: brightness(1) saturate(1);
  }
}

@media (max-width: 1100px) {
  body[data-screen="memory-screen"] .memory-layout {
    grid-template-columns: 1fr;
  }

  body[data-screen="memory-screen"] .habitat-bird {
    transform: translate(-50%, -50%) scale(1.12);
  }

  body[data-screen="memory-screen"] .card-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    grid-template-rows: repeat(5, minmax(7rem, 1fr));
  }
}

/* Memory board v3: 12 cards, no title block, animated status instruments. */
body[data-screen="memory-screen"] .memory-layout {
  grid-template-columns: minmax(0, 1fr) clamp(32rem, 29vw, 36rem);
}

body[data-screen="memory-screen"] .game-toolbar {
  grid-template-columns: 1fr;
}

body[data-screen="memory-screen"] .game-toolbar > div:first-child {
  display: none;
}

body[data-screen="memory-screen"] .toolbar-metrics {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.85rem;
}

body[data-screen="memory-screen"] .metric-chip {
  min-height: 6.4rem;
  padding: 0.75rem 0.78rem 0.68rem;
  border-color: rgba(255, 238, 190, 0.74);
  background:
    radial-gradient(circle at 82% 18%, rgba(255, 255, 238, 0.58), transparent 18%),
    radial-gradient(circle at 20% 12%, rgba(221, 198, 113, 0.24), transparent 30%),
    linear-gradient(145deg, rgba(255, 248, 225, 0.97), rgba(212, 188, 133, 0.88));
  box-shadow:
    0 1rem 1.9rem rgba(7, 14, 10, 0.28),
    inset 0 1px 0 rgba(255, 255, 255, 0.58),
    inset 0 -0.65rem 1.2rem rgba(91, 62, 29, 0.08);
}

body[data-screen="memory-screen"] .timer-chip {
  display: grid;
  grid-template-columns: 3.15rem minmax(0, 1fr);
  grid-template-areas:
    "dial label"
    "dial value"
    "dial bar"
    "dial status";
  column-gap: 0.7rem;
  align-items: center;
}

body[data-screen="memory-screen"] .timer-chip > span {
  grid-area: label;
}

body[data-screen="memory-screen"] .timer-chip > strong {
  grid-area: value;
}

body[data-screen="memory-screen"] .timer-chip .metric-bar {
  grid-area: bar;
}

body[data-screen="memory-screen"] .timer-chip .timer-status {
  grid-area: status;
}

body[data-screen="memory-screen"] .timer-dial {
  grid-area: dial;
  position: relative;
  z-index: 1;
  width: 3.15rem;
  aspect-ratio: 1;
  border-radius: 999px;
  background:
    radial-gradient(circle, rgba(255, 250, 236, 0.96) 0 43%, transparent 44%),
    repeating-conic-gradient(from -90deg, rgba(79, 68, 43, 0.36) 0 2deg, transparent 2deg 30deg),
    conic-gradient(from -90deg, rgba(126, 151, 92, 0.42) calc(var(--metric-progress, 1) * 1turn), rgba(68, 58, 38, 0.12) 0);
  border: 1px solid rgba(86, 78, 52, 0.2);
  box-shadow:
    inset 0 0 0 0.18rem rgba(255, 250, 236, 0.72),
    0 0.35rem 0.8rem rgba(45, 34, 20, 0.16);
}

body[data-screen="memory-screen"] .timer-dial::before {
  content: "";
  position: absolute;
  inset: 0.48rem;
  border-radius: inherit;
  background:
    radial-gradient(circle at 50% 20%, rgba(255, 255, 255, 0.55), transparent 35%),
    linear-gradient(180deg, rgba(244, 232, 197, 0.96), rgba(221, 199, 157, 0.92));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.52);
}

body[data-screen="memory-screen"] .timer-hand {
  position: absolute;
  z-index: 2;
  left: calc(50% - 1px);
  top: 50%;
  width: 2px;
  height: 1.12rem;
  border-radius: 999px;
  background: #7d3c2b;
  transform: translateY(-100%) rotate(var(--timer-angle, 0deg));
  transform-origin: 50% 100%;
  transition: transform 180ms steps(1, end);
  box-shadow: 0 0 0.35rem rgba(125, 60, 43, 0.28);
}

body[data-screen="memory-screen"] .timer-pin {
  position: absolute;
  z-index: 3;
  left: 50%;
  top: 50%;
  width: 0.42rem;
  height: 0.42rem;
  border-radius: 999px;
  background:
    radial-gradient(circle at 35% 30%, #fff7df, #ba8b4e 46%, #6b4e2d 100%);
  transform: translate(-50%, -50%);
  box-shadow: 0 0.12rem 0.2rem rgba(45, 34, 20, 0.25);
}

body[data-screen="memory-screen"] .timer-chip.just-ticked .timer-hand {
  animation: secondHandTick 320ms ease;
}

body[data-screen="memory-screen"] .timer-chip.just-threshold .timer-dial {
  animation: timerBell 1100ms ease;
}

body[data-screen="memory-screen"] .timer-chip.just-threshold .timer-status {
  animation: statusNotice 1100ms ease;
}

body[data-screen="memory-screen"] .metric-chip::after {
  content: "";
  position: absolute;
  inset: 0;
  transform: translateX(-120%);
  background: linear-gradient(105deg, transparent 35%, rgba(255, 255, 235, 0.42), transparent 66%);
  animation: metricSweep 3.2s ease-in-out infinite;
  pointer-events: none;
}

body[data-screen="memory-screen"] .timer-chip::before {
  opacity: 0;
  background:
    conic-gradient(from -90deg, rgba(126, 151, 92, 0.32) calc(var(--metric-progress, 1) * 1turn), rgba(68, 58, 38, 0.12) 0),
    radial-gradient(circle at 50% 50%, rgba(255, 250, 236, 0.9) 0 34%, transparent 35%),
    repeating-linear-gradient(45deg, rgba(82, 61, 34, 0.035) 0 1px, transparent 1px 0.48rem);
  clip-path: circle(1.1rem at calc(100% - 1.3rem) 1.3rem);
}

body[data-screen="memory-screen"] .match-chip {
  --match-progress: 0;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  grid-template-areas:
    "badge label"
    "badge value"
    "pips pips"
    "status status";
  column-gap: 0.7rem;
  align-items: center;
}

body[data-screen="memory-screen"] .match-chip::after {
  content: "";
  grid-area: badge;
  position: relative;
  inset: auto;
  z-index: 1;
  width: 3rem;
  aspect-ratio: 1;
  border-radius: 42% 58% 48% 52%;
  background:
    radial-gradient(circle at 50% 42%, rgba(255, 248, 206, 0.82), transparent 36%),
    conic-gradient(from 0deg, #879d67 calc(var(--match-progress, 0) * 1turn), rgba(88, 72, 43, 0.18) 0);
  border: 1px solid rgba(93, 81, 51, 0.18);
  box-shadow:
    inset 0 0 0 0.22rem rgba(255, 250, 236, 0.62),
    0 0.35rem 0.75rem rgba(45, 34, 20, 0.14);
  animation: none;
  pointer-events: none;
  transform: none;
}

body[data-screen="memory-screen"] .match-chip > span {
  grid-area: label;
}

body[data-screen="memory-screen"] .match-chip > strong {
  grid-area: value;
}

body[data-screen="memory-screen"] .match-chip .match-pips {
  grid-area: pips;
}

body[data-screen="memory-screen"] .match-chip .match-status {
  grid-area: status;
}

body[data-screen="memory-screen"] .match-chip::before {
  opacity: 1;
  background:
    linear-gradient(90deg, rgba(126, 151, 92, 0.34) calc(var(--match-progress, 0) * 100%), rgba(82, 67, 43, 0.08) 0),
    repeating-linear-gradient(45deg, rgba(82, 61, 34, 0.035) 0 1px, transparent 1px 0.48rem);
}

body[data-screen="memory-screen"] .metric-chip > span {
  font-size: 0.64rem;
  letter-spacing: 0.18em;
}

body[data-screen="memory-screen"] .metric-chip > strong {
  margin-top: 0.1rem;
  font-size: clamp(1.7rem, 2.35vw, 2.15rem);
}

body[data-screen="memory-screen"] .timer-status,
body[data-screen="memory-screen"] .match-status {
  margin-top: 0.36rem;
  min-height: 1.1rem;
  font-size: 0.62rem;
  letter-spacing: 0.12em;
}

body[data-screen="memory-screen"] .metric-bar {
  height: 0.42rem;
  margin-top: 0.46rem;
  background: rgba(64, 50, 30, 0.2);
}

body[data-screen="memory-screen"] .match-pips {
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 0.28rem;
  margin-top: 0.56rem;
}

body[data-screen="memory-screen"] .match-pips i {
  height: 1rem;
  border-radius: 0.28rem 0.58rem 0.28rem 0.58rem;
  transform: rotate(-7deg);
  background:
    linear-gradient(180deg, rgba(91, 76, 46, 0.18), rgba(91, 76, 46, 0.08));
}

body[data-screen="memory-screen"] .match-pips i::after {
  content: "";
  position: absolute;
  inset: 0.26rem;
  border-radius: 50%;
  background: rgba(255, 250, 230, 0.3);
}

body[data-screen="memory-screen"] .match-count-1 .match-pips i:nth-child(-n + 1),
body[data-screen="memory-screen"] .match-count-2 .match-pips i:nth-child(-n + 2),
body[data-screen="memory-screen"] .match-count-3 .match-pips i:nth-child(-n + 3),
body[data-screen="memory-screen"] .match-count-4 .match-pips i:nth-child(-n + 4),
body[data-screen="memory-screen"] .match-count-5 .match-pips i:nth-child(-n + 5),
body[data-screen="memory-screen"] .match-count-6 .match-pips i:nth-child(-n + 6) {
  transform: translateY(-2px) rotate(-7deg);
}

body[data-screen="memory-screen"] .card-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  grid-template-rows: repeat(3, minmax(0, 1fr));
  gap: clamp(0.62rem, 1vw, 0.9rem);
  padding: clamp(0.75rem, 1.1vw, 1rem);
}

body[data-screen="memory-screen"] .memory-card {
  width: 100%;
  height: auto;
  aspect-ratio: 0.72;
}

body[data-screen="memory-screen"] .memory-card.is-locked-front,
body[data-screen="memory-screen"] .memory-card.is-returning.is-locked-front {
  transform: none;
}

body[data-screen="memory-screen"] .memory-card.is-returning.is-locked-front {
  animation: lockedFrontPulse 1.2s ease forwards;
}

body[data-screen="memory-screen"] .memory-card.is-locked-front .card-front {
  z-index: 3;
  transform: none;
}

body[data-screen="memory-screen"] .memory-card.is-locked-front .card-back {
  opacity: 0;
}

@keyframes metricSweep {
  0%,
  35% {
    transform: translateX(-120%);
  }

  62%,
  100% {
    transform: translateX(120%);
  }
}

@keyframes secondHandTick {
  0% {
    filter: brightness(1);
  }

  45% {
    filter: brightness(1.45);
    box-shadow: 0 0 0.55rem rgba(125, 60, 43, 0.42);
  }

  100% {
    filter: brightness(1);
  }
}

@keyframes timerBell {
  0%,
  100% {
    transform: scale(1);
    box-shadow:
      inset 0 0 0 0.18rem rgba(255, 250, 236, 0.72),
      0 0.35rem 0.8rem rgba(45, 34, 20, 0.16);
  }

  28% {
    transform: scale(1.12) rotate(-3deg);
    box-shadow:
      inset 0 0 0 0.18rem rgba(255, 250, 236, 0.72),
      0 0.35rem 0.8rem rgba(45, 34, 20, 0.16),
      0 0 1rem rgba(210, 139, 77, 0.45);
  }

  58% {
    transform: scale(1.08) rotate(3deg);
  }
}

@keyframes statusNotice {
  0%,
  100% {
    color: rgba(63, 48, 32, 0.66);
    transform: translateX(0);
  }

  45% {
    color: #8b3b28;
    transform: translateX(2px);
  }
}

@keyframes lockedFrontPulse {
  0% {
    filter: brightness(1);
    transform: translateY(0) scale(1);
  }

  45% {
    filter: brightness(1.12) saturate(1.08);
    transform: translateY(-2px) scale(1.025);
  }

  100% {
    filter: brightness(1.04);
    transform: translateY(0) scale(1);
  }
}

@media (max-width: 1100px) {
  body[data-screen="memory-screen"] .card-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    grid-template-rows: repeat(4, minmax(7rem, 1fr));
  }
}

/* Memory board v4: give the orange-line area to cards and make countdown feel urgent. */
body[data-screen="memory-screen"] .memory-layout {
  grid-template-columns: minmax(0, 1fr) clamp(44rem, 40vw, 50rem);
  gap: clamp(0.65rem, 1.1vw, 1.35rem);
}

body[data-screen="memory-screen"] {
  overflow: hidden;
}

body[data-screen="memory-screen"] .app-shell {
  height: 100vh;
  min-height: 100vh;
}

body[data-screen="memory-screen"] .top-bar {
  position: fixed;
  left: 0;
  right: 0;
  top: 0;
  z-index: 12;
  height: 5.35rem;
}

body[data-screen="memory-screen"] .screen-stack {
  position: fixed;
  inset: 5.35rem 0 0;
  height: auto;
  padding: 0 clamp(1.4rem, 2.65vw, 3.2rem) clamp(1rem, 1.4vw, 1.6rem);
  overflow: visible;
}

body[data-screen="memory-screen"] #memory-screen.screen-active,
body[data-screen="memory-screen"] .memory-layout {
  height: 100%;
}

body[data-screen="memory-screen"] .habitat-panel .section-heading.compact {
  display: none;
}

body[data-screen="memory-screen"] .card-panel {
  align-self: stretch;
  min-height: calc(100vh - 7.3rem);
  padding: clamp(1rem, 1.35vw, 1.45rem);
}

body[data-screen="memory-screen"] .toolbar-metrics {
  gap: clamp(0.95rem, 1.2vw, 1.35rem);
}

body[data-screen="memory-screen"] .metric-chip {
  min-height: 8.2rem;
  padding: 1rem 1.05rem 0.95rem;
  border-width: 2px;
}

body[data-screen="memory-screen"] .metric-chip > span {
  font-size: clamp(0.9rem, 1.05vw, 1.12rem);
  letter-spacing: 0.18em;
}

body[data-screen="memory-screen"] .metric-chip > strong {
  font-size: clamp(2.1rem, 2.7vw, 3rem);
  line-height: 1.05;
}

body[data-screen="memory-screen"] .metric-chip small {
  font-size: clamp(0.95rem, 1.1vw, 1.2rem);
}

body[data-screen="memory-screen"] .timer-status,
body[data-screen="memory-screen"] .match-status {
  font-size: clamp(0.82rem, 0.9vw, 1rem);
  font-weight: 700;
}

body[data-screen="memory-screen"] .timer-chip {
  grid-template-columns: 4.7rem minmax(0, 1fr);
  column-gap: 1rem;
}

body[data-screen="memory-screen"] .timer-dial {
  width: 4.7rem;
  box-shadow:
    inset 0 0 0 0.24rem rgba(255, 250, 236, 0.78),
    0 0.45rem 1rem rgba(45, 34, 20, 0.2),
    0 0 0 rgba(194, 83, 55, 0);
}

body[data-screen="memory-screen"] .timer-dial::before {
  inset: 0.68rem;
}

body[data-screen="memory-screen"] .timer-hand {
  width: 3px;
  height: 1.78rem;
  left: calc(50% - 1.5px);
  background: #8e3f2b;
}

body[data-screen="memory-screen"] .timer-pin {
  width: 0.58rem;
  height: 0.58rem;
}

body[data-screen="memory-screen"] .timer-chip.just-ticked .timer-dial {
  animation: clockMicroPulse 360ms ease;
}

body[data-screen="memory-screen"] .timer-chip.timer-state-warning .timer-dial {
  animation: clockWarningBreath 950ms ease-in-out infinite;
}

body[data-screen="memory-screen"] .timer-chip.timer-state-warning .timer-hand {
  animation: timerHandWarning 720ms ease-in-out infinite;
}

body[data-screen="memory-screen"] .timer-chip.timer-state-danger {
  animation: dangerPanelTremble 520ms ease-in-out infinite;
}

body[data-screen="memory-screen"] .timer-chip.timer-state-danger .timer-dial {
  animation: clockDangerAlarm 440ms ease-in-out infinite;
}

body[data-screen="memory-screen"] .timer-chip.timer-state-danger .timer-hand {
  animation: timerHandPanic 320ms linear infinite;
  background: #b33a2e;
  box-shadow: 0 0 0.72rem rgba(189, 65, 49, 0.72);
}

body[data-screen="memory-screen"] .timer-chip.timer-state-danger .timer-status {
  color: #8b2d23;
  animation: pressureTextJolt 520ms steps(2, end) infinite;
}

body[data-screen="memory-screen"] .timer-chip.timer-state-danger .metric-bar {
  box-shadow:
    inset 0 1px 2px rgba(46, 36, 20, 0.28),
    0 0 0.9rem rgba(190, 70, 48, 0.36);
}

body[data-screen="memory-screen"] .timer-chip.timer-state-danger .metric-bar i::after {
  animation-duration: 520ms;
}

body[data-screen="memory-screen"] .match-pips i {
  height: 1.22rem;
}

body[data-screen="memory-screen"] .card-grid {
  gap: clamp(0.8rem, 1.15vw, 1.15rem);
  padding: clamp(0.9rem, 1.15vw, 1.2rem);
}

body[data-screen="memory-screen"] .memory-card {
  max-height: 100%;
  min-height: 0;
}

.returning-bird {
  position: fixed;
  z-index: 30;
  margin: 0;
  pointer-events: none;
  transform-origin: 50% 70%;
  filter:
    drop-shadow(0 0.65rem 0.7rem rgba(7, 14, 10, 0.26))
    drop-shadow(0 0 0.8rem rgba(255, 245, 190, 0.18));
}

.returning-bird img {
  display: block;
  width: 100%;
  height: auto;
}

.returning-bird-fly img {
  animation: returningWingBeat 280ms ease-in-out infinite alternate;
}

.returning-bird-walk img {
  animation: returningWalkBob 360ms ease-in-out infinite;
}

body[data-screen="memory-screen"] .habitat-bird.is-receiving {
  filter:
    drop-shadow(0 0.45rem 0.65rem rgba(10, 18, 14, 0.24))
    drop-shadow(0 0 1rem rgba(236, 221, 143, 0.42));
}

.memory-sunbeam-effect {
  position: fixed;
  inset: 0;
  z-index: 34;
  overflow: hidden;
  pointer-events: none;
}

.memory-sunbeam {
  position: fixed;
  left: var(--target-x);
  top: -5vh;
  width: clamp(8.5rem, 12vw, 14rem);
  height: calc(var(--target-y) + 9rem);
  opacity: 0;
  transform: translateX(-50%) scaleY(0.58);
  transform-origin: 50% 0;
  background:
    linear-gradient(90deg, transparent, rgba(255, 232, 143, 0.38) 34%, rgba(255, 236, 158, 0.42) 50%, rgba(255, 232, 143, 0.34) 66%, transparent);
  clip-path: polygon(46% 0, 54% 0, 100% 100%, 0 100%);
  filter: blur(0.75px);
  animation: memorySunbeamFall 2600ms ease forwards;
}

.memory-sunbeam::before {
  content: "";
  position: absolute;
  left: 50%;
  top: 0;
  width: 18%;
  height: 100%;
  opacity: 0;
  transform: translateX(-50%);
  background:
    linear-gradient(90deg, transparent, rgba(255, 255, 238, 0.86) 48%, transparent);
  filter: blur(0.28rem);
  animation: memorySunbeamCoreFade 1300ms ease forwards;
}

.memory-sunbeam-hotspot {
  position: fixed;
  left: var(--target-x);
  top: var(--target-y);
  width: calc(var(--target-size) * 1.2);
  aspect-ratio: 1;
  border-radius: 50%;
  opacity: 0;
  transform: translate(-50%, -50%) scale(0.72);
  background:
    radial-gradient(circle, rgba(255, 248, 195, 0.28) 0 18%, rgba(255, 231, 139, 0.34) 42%, transparent 72%);
  filter: blur(0.6px);
  animation: memorySunbeamHotspotGlow 2400ms ease 160ms forwards;
}

.memory-sunbeam-particles {
  position: fixed;
  left: var(--target-x);
  top: var(--target-y);
  width: calc(var(--target-size) * 1.05);
  height: calc(var(--target-size) * 1.5);
  opacity: 0;
  transform: translate(-50%, -62%);
  animation: memorySunbeamParticlesAppear 2100ms ease 260ms forwards;
}

.memory-sunbeam-particles span {
  position: absolute;
  width: 0.32rem;
  height: 0.32rem;
  border-radius: 50%;
  background: rgba(255, 246, 198, 0.72);
  box-shadow: 0 0 0.8rem rgba(255, 239, 168, 0.62);
  animation: memorySunbeamDustDrift 1500ms ease-in-out infinite;
}

.memory-sunbeam-particles span:nth-child(1) { left: 16%; top: 10%; animation-delay: 0ms; }
.memory-sunbeam-particles span:nth-child(2) { left: 54%; top: 18%; animation-delay: 180ms; }
.memory-sunbeam-particles span:nth-child(3) { left: 34%; top: 38%; animation-delay: 320ms; }
.memory-sunbeam-particles span:nth-child(4) { left: 72%; top: 48%; animation-delay: 120ms; }
.memory-sunbeam-particles span:nth-child(5) { left: 20%; top: 64%; animation-delay: 440ms; }
.memory-sunbeam-particles span:nth-child(6) { left: 62%; top: 76%; animation-delay: 260ms; }

body[data-screen="memory-screen"] .habitat-bird.is-sunbeam-lit .bird-silhouette {
  animation: memorySunbeamSilhouetteMelt 1080ms ease 980ms forwards;
}

body[data-screen="memory-screen"] .habitat-bird.is-sunbeam-lit .bird-color {
  animation: memorySunbeamColorReveal 1120ms ease 1040ms forwards;
}

@keyframes clockMicroPulse {
  0%,
  100% {
    transform: scale(1);
  }

  50% {
    transform: scale(1.06);
  }
}

@keyframes clockWarningBreath {
  0%,
  100% {
    box-shadow:
      inset 0 0 0 0.24rem rgba(255, 250, 236, 0.78),
      0 0.45rem 1rem rgba(45, 34, 20, 0.2),
      0 0 0.45rem rgba(211, 158, 77, 0.28);
  }

  50% {
    box-shadow:
      inset 0 0 0 0.24rem rgba(255, 250, 236, 0.78),
      0 0.45rem 1rem rgba(45, 34, 20, 0.2),
      0 0 1.2rem rgba(211, 158, 77, 0.62);
  }
}

@keyframes clockDangerAlarm {
  0%,
  100% {
    transform: rotate(-1deg) scale(1);
    box-shadow:
      inset 0 0 0 0.24rem rgba(255, 250, 236, 0.78),
      0 0.45rem 1rem rgba(45, 34, 20, 0.2),
      0 0 1rem rgba(190, 70, 48, 0.45);
  }

  50% {
    transform: rotate(1deg) scale(1.08);
    box-shadow:
      inset 0 0 0 0.24rem rgba(255, 250, 236, 0.78),
      0 0.45rem 1rem rgba(45, 34, 20, 0.2),
      0 0 1.7rem rgba(190, 70, 48, 0.78);
  }
}

@keyframes timerHandWarning {
  0%,
  100% {
    transform: translateY(-100%) rotate(var(--timer-angle, 0deg));
  }

  50% {
    transform: translateY(-100%) rotate(calc(var(--timer-angle, 0deg) + 10deg));
  }
}

@keyframes timerHandPanic {
  0% {
    transform: translateY(-100%) rotate(var(--timer-angle, 0deg));
  }

  100% {
    transform: translateY(-100%) rotate(calc(var(--timer-angle, 0deg) + 360deg));
  }
}

@keyframes dangerPanelTremble {
  0%,
  100% {
    transform: translateX(0);
  }

  25% {
    transform: translateX(-1px);
  }

  75% {
    transform: translateX(1px);
  }
}

@keyframes pressureTextJolt {
  0%,
  100% {
    transform: translateX(0);
  }

  50% {
    transform: translateX(2px);
  }
}

@keyframes returningWingBeat {
  0% {
    transform: translateY(0) rotate(-2deg) scaleX(1);
  }

  100% {
    transform: translateY(-6px) rotate(3deg) scaleX(0.96);
  }
}

@keyframes returningWalkBob {
  0%,
  100% {
    transform: translateY(0) rotate(-1deg);
  }

  50% {
    transform: translateY(-7px) rotate(2deg);
  }
}

/* Memory board v5: make timer feedback truthful and animal returns feel alive. */
body[data-screen="memory-screen"] .timer-chip {
  --timer-tick-duration: 360ms;
  grid-template-areas:
    "dial label"
    "dial value"
    "dial bar";
  grid-template-rows: auto 1fr auto;
  transform-origin: 50% 55%;
}

body[data-screen="memory-screen"] .timer-chip .timer-status {
  display: none;
}

body[data-screen="memory-screen"] .timer-chip > strong {
  font-size: clamp(3.05rem, 4.35vw, 4.85rem);
  letter-spacing: -0.045em;
}

body[data-screen="memory-screen"] .timer-chip small {
  margin-left: 0.08rem;
  font-size: clamp(1rem, 1.2vw, 1.32rem);
}

body[data-screen="memory-screen"] .timer-chip.just-ticked {
  animation: timerWholeTick var(--timer-tick-duration) cubic-bezier(0.18, 0.82, 0.28, 1);
}

body[data-screen="memory-screen"] .timer-chip.just-ticked > strong {
  animation: timerNumberSnap var(--timer-tick-duration) ease;
}

body[data-screen="memory-screen"] .timer-chip.just-ticked .timer-dial,
body[data-screen="memory-screen"] .timer-chip.just-ticked .timer-hand,
body[data-screen="memory-screen"] .timer-chip.just-threshold .timer-dial,
body[data-screen="memory-screen"] .timer-chip.just-threshold .timer-status,
body[data-screen="memory-screen"] .timer-chip.timer-state-warning,
body[data-screen="memory-screen"] .timer-chip.timer-state-warning .timer-dial,
body[data-screen="memory-screen"] .timer-chip.timer-state-warning .timer-hand,
body[data-screen="memory-screen"] .timer-chip.timer-state-danger,
body[data-screen="memory-screen"] .timer-chip.timer-state-danger .timer-dial,
body[data-screen="memory-screen"] .timer-chip.timer-state-danger .timer-hand,
body[data-screen="memory-screen"] .timer-chip.timer-state-danger > strong {
  animation: none;
}

body[data-screen="memory-screen"] .timer-chip.timer-state-warning {
  box-shadow:
    0 0.95rem 1.8rem rgba(10, 16, 12, 0.24),
    inset 0 1px 0 rgba(255, 255, 255, 0.46),
    0 0 1.25rem rgba(217, 169, 75, 0.22);
}

body[data-screen="memory-screen"] .timer-chip.timer-state-danger {
  box-shadow:
    0 0.95rem 1.8rem rgba(10, 16, 12, 0.28),
    inset 0 1px 0 rgba(255, 255, 255, 0.46),
    0 0 1.55rem rgba(190, 70, 48, 0.3);
}

body[data-screen="memory-screen"] .timer-chip.timer-state-danger .timer-hand {
  background: #b33a2e;
  box-shadow: 0 0 0.72rem rgba(189, 65, 49, 0.54);
}

body[data-screen="memory-screen"] .metric-bar i::after {
  display: none;
  animation: none;
}

.returning-bird {
  will-change: transform, opacity;
}

.returning-bird::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: -0.35rem;
  width: 62%;
  height: 0.7rem;
  border-radius: 50%;
  background: rgba(7, 14, 10, 0.2);
  filter: blur(0.25rem);
  transform: translateX(-50%) scale(0.9);
}

.returning-bird-fly::after {
  animation: returningFlightShadow 1750ms ease forwards;
}

.returning-bird-fly img {
  transform-origin: 50% 58%;
  animation: returningWingBeat 220ms cubic-bezier(0.42, 0, 0.58, 1) infinite alternate;
}

.returning-bird-walk::after {
  animation: returningGroundShadow 360ms ease-in-out infinite;
}

.returning-bird-walk img {
  transform-origin: 50% 88%;
  animation: returningWalkStep 410ms steps(2, end) infinite;
}

.returning-bird-crane-walk {
  --crane-facing: 1;
  transform-origin: 50% 88%;
}

.returning-bird-crane-walk.is-facing-right {
  --crane-facing: -1;
}

.returning-bird-crane-walk::after {
  width: 48%;
  bottom: 0.15rem;
  animation: craneWalkingShadow 560ms ease-in-out infinite;
}

.returning-bird-inner {
  position: relative;
  display: block;
  width: 100%;
  aspect-ratio: 704 / 1399;
  transform-origin: 50% 86%;
  animation: craneBodyLift 560ms ease-in-out infinite;
}

.crane-part {
  position: absolute;
  inset: 0;
  background-image: var(--returning-art);
  background-repeat: no-repeat;
  background-size: 100% 100%;
  transform-origin: 50% 80%;
  will-change: transform;
}

.crane-body {
  z-index: 5;
  clip-path: polygon(7% 39%, 30% 36%, 60% 37%, 89% 41%, 98% 58%, 85% 68%, 50% 70%, 20% 64%, 4% 51%);
  animation: craneBodySettle 560ms ease-in-out infinite;
}

.crane-neck {
  z-index: 6;
  clip-path: polygon(0 0, 28% 0, 42% 18%, 34% 43%, 19% 52%, 3% 45%);
  transform-origin: 22% 43%;
  animation: craneNeckReach 1120ms ease-in-out infinite;
}

.crane-tail {
  z-index: 4;
  clip-path: polygon(61% 34%, 100% 35%, 100% 62%, 75% 66%, 56% 55%);
  transform-origin: 63% 49%;
  animation: craneTailLag 1120ms ease-in-out infinite;
}

.crane-leg {
  z-index: 1;
  transform-origin: 50% 69%;
}

.crane-leg-front {
  clip-path: polygon(51% 66%, 61% 66%, 66% 100%, 39% 100%, 44% 80%);
  animation: craneFrontStep 560ms ease-in-out infinite;
}

.crane-leg-back {
  clip-path: polygon(25% 66%, 39% 66%, 45% 100%, 12% 100%, 18% 80%);
  animation: craneBackStep 560ms ease-in-out infinite;
}

@keyframes timerWholeTick {
  0%,
  100% {
    transform: translateY(0) scale(1);
  }

  42% {
    transform: translateY(-0.18rem) scale(1.035);
  }
}

@keyframes timerNumberSnap {
  0%,
  100% {
    transform: translateY(0);
    text-shadow: 0 1px 0 rgba(255, 255, 255, 0.36);
  }

  48% {
    transform: translateY(-0.1rem);
    text-shadow:
      0 1px 0 rgba(255, 255, 255, 0.36),
      0 0 0.75rem rgba(210, 139, 77, 0.36);
  }
}

@keyframes returningFlightShadow {
  0% {
    opacity: 0;
    transform: translateX(-50%) scale(0.55);
  }

  35% {
    opacity: 0.12;
    transform: translateX(-50%) scale(0.72);
  }

  100% {
    opacity: 0.24;
    transform: translateX(-50%) scale(1);
  }
}

@keyframes returningWalkStep {
  0% {
    transform: translateY(0) rotate(-2deg) skewX(-1.5deg);
  }

  50% {
    transform: translateY(-0.42rem) rotate(2deg) skewX(1.5deg);
  }

  100% {
    transform: translateY(0) rotate(-2deg) skewX(-1.5deg);
  }
}

@keyframes returningGroundShadow {
  0%,
  100% {
    opacity: 0.2;
    transform: translateX(-50%) scaleX(0.82);
  }

  50% {
    opacity: 0.12;
    transform: translateX(-50%) scaleX(0.62);
  }
}

@keyframes memorySunbeamFall {
  0% {
    opacity: 0;
    transform: translateX(-50%) scaleY(0.55);
  }

  18%,
  42% {
    opacity: 0.82;
    transform: translateX(-50%) scaleY(1);
  }

  64% {
    opacity: 0.46;
    transform: translateX(-50%) scaleY(1.02);
  }

  82% {
    opacity: 0.24;
    transform: translateX(-50%) scaleY(1.05);
  }

  100% {
    opacity: 0;
    transform: translateX(-50%) scaleY(1.08);
  }
}

@keyframes memorySunbeamCoreFade {
  0% {
    opacity: 0;
  }

  18%,
  40% {
    opacity: 1;
  }

  54%,
  100% {
    opacity: 0;
  }
}

@keyframes memorySunbeamHotspotGlow {
  0%,
  100% {
    opacity: 0;
    transform: translate(-50%, -50%) scale(0.72);
  }

  22%,
  46% {
    opacity: 0.72;
    transform: translate(-50%, -50%) scale(1);
  }

  66% {
    opacity: 0.34;
    transform: translate(-50%, -50%) scale(1.08);
  }
}

@keyframes memorySunbeamParticlesAppear {
  0%,
  100% {
    opacity: 0;
  }

  24%,
  58% {
    opacity: 1;
  }

  78% {
    opacity: 0.34;
  }
}

@keyframes memorySunbeamDustDrift {
  0%,
  100% {
    transform: translate3d(0, 0, 0) scale(0.78);
  }

  50% {
    transform: translate3d(0.4rem, 1.4rem, 0) scale(1);
  }
}

@keyframes memorySunbeamSilhouetteMelt {
  0% {
    opacity: 0.68;
    filter:
      blur(0.5px)
      brightness(0.35)
      drop-shadow(0 0.18rem 0.22rem rgba(35, 42, 39, 0.22));
  }

  35% {
    opacity: 0.48;
    filter:
      blur(1.5px)
      brightness(1.35)
      drop-shadow(0 0.18rem 0.22rem rgba(35, 42, 39, 0.18));
  }

  100% {
    opacity: 0;
    filter:
      blur(5px)
      brightness(1.12)
      drop-shadow(0 0.18rem 0.22rem rgba(35, 42, 39, 0.14));
    transform: scale(1.03);
  }
}

@keyframes memorySunbeamColorReveal {
  0% {
    opacity: 0;
    filter:
      brightness(1.18)
      saturate(0.72)
      drop-shadow(0 0.25rem 0.35rem rgba(43, 50, 43, 0.2));
    transform: scale(0.96);
  }

  42% {
    opacity: 0.72;
    filter:
      brightness(1.08)
      saturate(0.9)
      drop-shadow(0 0.25rem 0.35rem rgba(43, 50, 43, 0.2));
  }

  100% {
    opacity: 1;
    filter:
      brightness(1)
      saturate(1)
      drop-shadow(0 0.25rem 0.35rem rgba(43, 50, 43, 0.2));
    transform: scale(1);
  }
}

@keyframes craneBodyLift {
  0%,
  100% {
    transform: scaleX(var(--crane-facing)) translateY(0) rotate(-0.7deg);
  }

  50% {
    transform: scaleX(var(--crane-facing)) translateY(-0.36rem) rotate(0.8deg);
  }
}

@keyframes craneBodySettle {
  0%,
  100% {
    transform: translateY(0) rotate(-0.3deg);
  }

  50% {
    transform: translateY(0.08rem) rotate(0.4deg);
  }
}

@keyframes craneNeckReach {
  0%,
  100% {
    transform: rotate(-2.4deg) translateX(-0.08rem);
  }

  50% {
    transform: rotate(4deg) translateX(0.18rem) translateY(-0.18rem);
  }
}

@keyframes craneTailLag {
  0%,
  100% {
    transform: rotate(3.2deg) translateX(-0.08rem);
  }

  50% {
    transform: rotate(-4.6deg) translateX(0.14rem) translateY(0.08rem);
  }
}

@keyframes craneFrontStep {
  0%,
  100% {
    transform: rotate(-7deg) translateX(-0.16rem) translateY(0.04rem);
  }

  42% {
    transform: rotate(9deg) translateX(0.16rem) translateY(-0.46rem);
  }

  68% {
    transform: rotate(4deg) translateX(0.08rem) translateY(0.04rem);
  }
}

@keyframes craneBackStep {
  0%,
  100% {
    transform: rotate(8deg) translateX(0.14rem) translateY(-0.36rem);
  }

  42% {
    transform: rotate(-8deg) translateX(-0.12rem) translateY(0.05rem);
  }

  68% {
    transform: rotate(-3deg) translateX(-0.06rem) translateY(-0.08rem);
  }
}

@keyframes craneWalkingShadow {
  0%,
  100% {
    opacity: 0.2;
    transform: translateX(-50%) scaleX(0.88);
  }

  50% {
    opacity: 0.13;
    transform: translateX(-50%) scaleX(0.68);
  }
}

/* Memory board v6: glowing jade collection and species intro templates. */
body[data-screen="memory-screen"] .match-chip {
  grid-template-columns: 4.65rem minmax(0, 1fr);
  grid-template-areas:
    "badge label"
    "badge value"
    "pips pips"
    "status status";
}

body[data-screen="memory-screen"] .match-chip::after {
  width: 3.85rem;
  border-radius: 46% 54% 42% 58%;
  background:
    radial-gradient(circle at 38% 25%, rgba(255, 255, 225, 0.86), transparent 18%),
    radial-gradient(circle at 50% 58%, rgba(146, 207, 168, 0.62), transparent 42%),
    conic-gradient(from -18deg, #78aa80 calc(var(--match-progress, 0) * 1turn), rgba(93, 75, 44, 0.2) 0);
  box-shadow:
    inset 0 0 0 0.24rem rgba(255, 250, 225, 0.62),
    0 0.4rem 0.82rem rgba(45, 34, 20, 0.14),
    0 0 1rem rgba(119, 187, 139, calc(var(--match-progress, 0) * 0.45));
}

body[data-screen="memory-screen"] .jade-collection {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  align-items: end;
  gap: 0.36rem;
  margin-top: 0.68rem;
  padding: 0.42rem 0.45rem 0.32rem;
  border-radius: 999px;
  background:
    linear-gradient(180deg, rgba(84, 63, 36, 0.18), rgba(255, 250, 226, 0.14)),
    repeating-linear-gradient(45deg, rgba(91, 70, 42, 0.06) 0 1px, transparent 1px 0.42rem);
  box-shadow:
    inset 0 1px 1px rgba(72, 48, 24, 0.18),
    inset 0 -1px 0 rgba(255, 255, 240, 0.36);
}

body[data-screen="memory-screen"] .jade-collection .jade-stone {
  position: relative;
  height: 1.28rem;
  min-width: 0;
  opacity: 0.34;
  transform: translateY(0.1rem) scale(0.86) rotate(var(--jade-tilt, -7deg));
  border: 1px solid rgba(255, 249, 218, 0.36);
  background: var(--jade-fill);
  filter: grayscale(0.42) saturate(0.68);
  box-shadow:
    inset 0 0.12rem 0.28rem rgba(255, 255, 235, 0.32),
    inset 0 -0.18rem 0.34rem rgba(42, 54, 44, 0.2);
  transition:
    opacity 360ms ease,
    transform 360ms cubic-bezier(0.2, 0.85, 0.28, 1.2),
    filter 360ms ease,
    box-shadow 360ms ease;
}

body[data-screen="memory-screen"] .jade-collection .jade-stone::after {
  content: "";
  position: absolute;
  inset: 18% 18% auto auto;
  width: 32%;
  aspect-ratio: 1;
  border-radius: 50%;
  background: rgba(255, 255, 235, 0.5);
  filter: blur(1px);
}

body[data-screen="memory-screen"] .jade-1 {
  --jade-fill:
    radial-gradient(circle at 38% 25%, rgba(255, 255, 230, 0.82), transparent 22%),
    linear-gradient(145deg, #9bc99e, #477f62);
  --jade-tilt: -10deg;
  border-radius: 55% 45% 52% 48%;
}

body[data-screen="memory-screen"] .jade-2 {
  --jade-fill:
    radial-gradient(circle at 36% 28%, rgba(255, 255, 230, 0.75), transparent 22%),
    linear-gradient(145deg, #b8dfd5, #5b9a94);
  --jade-tilt: 6deg;
  border-radius: 35% 65% 42% 58%;
}

body[data-screen="memory-screen"] .jade-3 {
  --jade-fill:
    radial-gradient(circle at 38% 25%, rgba(255, 255, 230, 0.76), transparent 22%),
    linear-gradient(145deg, #e3c978, #9a8040);
  --jade-tilt: -3deg;
  border-radius: 0.3rem 0.75rem 0.32rem 0.7rem;
}

body[data-screen="memory-screen"] .jade-4 {
  --jade-fill:
    radial-gradient(circle at 34% 25%, rgba(255, 255, 230, 0.75), transparent 22%),
    linear-gradient(145deg, #c8d790, #718b4d);
  --jade-tilt: 9deg;
  border-radius: 58% 42% 38% 62%;
}

body[data-screen="memory-screen"] .jade-5 {
  --jade-fill:
    radial-gradient(circle at 36% 28%, rgba(255, 255, 230, 0.78), transparent 22%),
    linear-gradient(145deg, #d5b3a0, #a15f4d);
  --jade-tilt: -8deg;
  border-radius: 42% 58% 58% 42%;
}

body[data-screen="memory-screen"] .jade-6 {
  --jade-fill:
    radial-gradient(circle at 38% 26%, rgba(255, 255, 230, 0.78), transparent 22%),
    linear-gradient(145deg, #b8c4df, #667da8);
  --jade-tilt: 4deg;
  border-radius: 0.7rem 0.34rem 0.72rem 0.34rem;
}

body[data-screen="memory-screen"] .match-count-1 .jade-stone:nth-child(-n + 1),
body[data-screen="memory-screen"] .match-count-2 .jade-stone:nth-child(-n + 2),
body[data-screen="memory-screen"] .match-count-3 .jade-stone:nth-child(-n + 3),
body[data-screen="memory-screen"] .match-count-4 .jade-stone:nth-child(-n + 4),
body[data-screen="memory-screen"] .match-count-5 .jade-stone:nth-child(-n + 5),
body[data-screen="memory-screen"] .match-count-6 .jade-stone:nth-child(-n + 6) {
  opacity: 1;
  transform: translateY(-0.16rem) scale(1) rotate(var(--jade-tilt, -7deg));
  filter: grayscale(0) saturate(1.16);
  box-shadow:
    inset 0 0.13rem 0.32rem rgba(255, 255, 238, 0.56),
    inset 0 -0.16rem 0.34rem rgba(32, 48, 42, 0.18),
    0 0 0.65rem rgba(207, 233, 181, 0.62);
}

body[data-screen="memory-screen"] .match-chip.just-progressed .jade-stone {
  animation: jadeAwaken 900ms ease both;
}

body[data-screen="memory-screen"] .match-chip.just-progressed.match-count-1 .jade-stone:nth-child(1),
body[data-screen="memory-screen"] .match-chip.just-progressed.match-count-2 .jade-stone:nth-child(2),
body[data-screen="memory-screen"] .match-chip.just-progressed.match-count-3 .jade-stone:nth-child(3),
body[data-screen="memory-screen"] .match-chip.just-progressed.match-count-4 .jade-stone:nth-child(4),
body[data-screen="memory-screen"] .match-chip.just-progressed.match-count-5 .jade-stone:nth-child(5),
body[data-screen="memory-screen"] .match-chip.just-progressed.match-count-6 .jade-stone:nth-child(6) {
  animation: jadeCollected 900ms cubic-bezier(0.17, 0.82, 0.28, 1.18) both;
}

.species-dialog-card {
  position: relative;
  overflow: hidden;
  width: min(58rem, calc(100vw - 2rem));
  min-height: clamp(26rem, 52vw, 34rem);
  padding: clamp(5.5rem, 8vw, 7.4rem) clamp(5rem, 8vw, 8rem);
  border: 0;
  border-radius: 1.2rem;
  background-color: #f4ead1;
  background-image: var(--species-intro-art, url("../image/generated/species-intro-bamboo-scroll.png"));
  background-repeat: no-repeat;
  background-position: center;
  background-size: 100% 100%;
  box-shadow:
    0 2.2rem 4rem rgba(8, 13, 10, 0.38),
    0 0 0 1px rgba(255, 248, 221, 0.35);
}

.species-dialog-card::before {
  content: "";
  position: absolute;
  inset: clamp(4.1rem, 6vw, 5.4rem) clamp(4.5rem, 7vw, 7.2rem);
  border-radius: 1.2rem;
  background: radial-gradient(circle at 50% 38%, rgba(255, 250, 224, 0.56), rgba(255, 246, 214, 0.24) 58%, transparent 76%);
  pointer-events: none;
}

.species-dialog-card > * {
  position: relative;
  z-index: 1;
}

.species-dialog-card.intro-scroll {
  --species-intro-art: url("../image/generated/species-intro-scroll.png");
}

.species-dialog-card.intro-bamboo-scroll {
  --species-intro-art: url("../image/generated/species-intro-bamboo-scroll.png");
}

.species-dialog-card.intro-woodblock {
  --species-intro-art: url("../image/generated/species-intro-woodblock.png");
}

.species-dialog-card .card-label {
  color: #7e6a45;
}

.species-dialog-card h2 {
  margin-top: 0.55rem;
  color: #26382f;
  text-shadow: 0 1px 0 rgba(255, 255, 240, 0.48);
}

.species-dialog-card p {
  max-width: 38rem;
  color: rgba(44, 57, 50, 0.82);
}

.species-dialog-card .species-virtue-line {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  margin-top: 1rem;
  padding: 0.45rem 0.85rem;
  border-radius: 999px;
  background: rgba(232, 216, 162, 0.38);
  color: #5d4f32;
}

@keyframes jadeAwaken {
  0%,
  100% {
    filter: saturate(1);
  }

  48% {
    filter: saturate(1.28) brightness(1.1);
  }
}

@keyframes jadeCollected {
  0% {
    transform: translateY(0.3rem) scale(0.52) rotate(var(--jade-tilt, -7deg));
    opacity: 0;
  }

  55% {
    transform: translateY(-0.42rem) scale(1.18) rotate(var(--jade-tilt, -7deg));
    opacity: 1;
    box-shadow:
      inset 0 0.13rem 0.32rem rgba(255, 255, 238, 0.56),
      inset 0 -0.16rem 0.34rem rgba(32, 48, 42, 0.18),
      0 0 1.35rem rgba(220, 245, 180, 0.72);
  }

  100% {
    transform: translateY(-0.16rem) scale(1) rotate(var(--jade-tilt, -7deg));
    opacity: 1;
  }
}

@media (max-width: 760px) {
  body[data-screen="memory-screen"] .timer-chip,
  body[data-screen="memory-screen"] .match-chip {
    grid-template-columns: 4.1rem minmax(0, 1fr);
  }

  .species-dialog-card {
    min-height: 24rem;
    padding: 4.6rem 2.35rem;
    background-size: cover;
  }
}

/* Puzzle selection: a quiet wooden tabletop with the supplied bird cards scattered naturally. */
body[data-screen="puzzle-screen"] .puzzle-prototype.is-selecting {
  display: block;
  width: min(1920px, 100vw);
  max-width: none;
  min-height: min(100vh, 1080px);
  margin: 0 auto;
}

body[data-screen="puzzle-screen"] .puzzle-drawer-selection.puzzle-tabletop-selection {
  position: relative;
  display: block;
  min-height: min(100vh, 1080px);
  overflow: hidden;
  isolation: isolate;
  border: 0;
  border-radius: 0;
  background:
    linear-gradient(90deg, rgba(19, 7, 2, .5), transparent 19%, transparent 76%, rgba(19, 7, 2, .52)),
    linear-gradient(180deg, rgba(15, 5, 1, .26), transparent 30%, rgba(15, 5, 1, .44)),
    url("../image/generated/puzzle-tabletop-bg.png") center / cover no-repeat;
  box-shadow: none;
}

body[data-screen="puzzle-screen"] .puzzle-tabletop-vignette {
  position: absolute;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background:
    radial-gradient(ellipse at 50% 47%, transparent 25%, rgba(21, 7, 2, .2) 76%, rgba(7, 2, 0, .5) 100%),
    radial-gradient(ellipse at 50% 46%, rgba(238, 170, 76, .16), transparent 41%);
}

body[data-screen="puzzle-screen"] .puzzle-tabletop-header {
  position: absolute;
  top: clamp(1.5rem, 3vw, 3rem);
  left: 50%;
  z-index: 20;
  width: min(48vw, 760px);
  transform: translateX(-50%);
  padding: .86rem 1.6rem .74rem;
  border: 2px solid #bd8537;
  border-radius: 1.35rem;
  background: linear-gradient(180deg, rgba(50, 22, 8, .94), rgba(35, 13, 4, .94));
  box-shadow: inset 0 0 0 3px rgba(255, 205, 107, .14), 0 .65rem 1.2rem rgba(9, 2, 0, .35);
  color: #ffe19c;
  text-align: center;
}

body[data-screen="puzzle-screen"] .puzzle-tabletop-header h2,
body[data-screen="puzzle-screen"] .puzzle-tabletop-header p {
  margin: 0;
}

body[data-screen="puzzle-screen"] .puzzle-tabletop-header h2 {
  font-family: "Noto Serif TC", "Source Han Serif TC", Georgia, serif;
  font-size: clamp(1.55rem, 2.65vw, 3rem);
  letter-spacing: .05em;
  line-height: 1.16;
  text-shadow: 0 2px 0 rgba(42, 15, 2, .65);
}

body[data-screen="puzzle-screen"] .puzzle-tabletop-header p {
  margin-top: .25rem;
  color: rgba(255, 229, 172, .78);
  font-size: clamp(.72rem, 1vw, 1rem);
}

body[data-screen="puzzle-screen"] .puzzle-bird-list {
  position: absolute;
  inset: 0;
  display: block;
  width: auto;
  height: auto;
  padding: 0;
}

body[data-screen="puzzle-screen"] .puzzle-drawer-slot {
  position: absolute;
  top: var(--card-y);
  left: var(--card-x);
  z-index: var(--card-depth);
  width: clamp(135px, 12.8vw, 245px);
  min-height: 0;
  overflow: visible;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: none;
  box-shadow: none;
}

body[data-screen="puzzle-screen"] .puzzle-bird-card {
  position: relative;
  display: block;
  width: 100%;
  min-height: 0;
  aspect-ratio: .58;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: none;
  box-shadow: 0 .8rem 1.3rem rgba(24, 7, 1, .35);
  cursor: pointer;
  transform: rotate(var(--card-tilt));
  transform-origin: center;
  transition: transform 260ms cubic-bezier(.2, .8, .2, 1), filter 220ms ease, box-shadow 260ms ease;
}

body[data-screen="puzzle-screen"] .puzzle-bird-card:hover,
body[data-screen="puzzle-screen"] .puzzle-bird-card:focus-visible {
  z-index: 20;
  outline: none;
  filter: brightness(1.05);
  transform: translateY(-.75rem) rotate(calc(var(--card-tilt) * .35)) scale(1.025);
  box-shadow: 0 1.35rem 1.9rem rgba(24, 7, 1, .48);
}

body[data-screen="puzzle-screen"] .puzzle-drawer-slot.is-selected {
  z-index: 30;
}

body[data-screen="puzzle-screen"] .puzzle-drawer-slot.is-selected .puzzle-bird-card {
  filter: brightness(1.075) saturate(1.04);
  transform: translateY(-2.05rem) rotate(0deg) scale(1.09);
  box-shadow: 0 2.1rem 2.4rem rgba(23, 6, 1, .54), 0 0 0 .2rem rgba(255, 223, 151, .36);
}

body[data-screen="puzzle-screen"] .puzzle-bird-card-media {
  position: absolute;
  inset: 0;
  z-index: 1;
  border-radius: 0;
  background: center / contain no-repeat;
}

body[data-screen="puzzle-screen"] .puzzle-bird-card-image,
body[data-screen="puzzle-screen"] .puzzle-bird-card-glow,
body[data-screen="puzzle-screen"] .puzzle-bird-card-caption {
  display: none !important;
}

body[data-screen="puzzle-screen"] .puzzle-tabletop-back {
  position: absolute;
  top: clamp(1.6rem, 4vw, 3.5rem);
  right: clamp(1.2rem, 5vw, 5.8rem);
  z-index: 25;
  min-width: 10.5rem;
  padding: .66rem 1.25rem;
  border: 2px solid #c58c39;
  border-radius: .85rem;
  background: linear-gradient(180deg, #5b3014, #351603);
  box-shadow: inset 0 0 0 2px rgba(255, 218, 139, .15), 0 .5rem .85rem rgba(17, 4, 0, .35);
  color: #ffe4a6;
  font: 800 clamp(.88rem, 1.2vw, 1.12rem) / 1.25 "Noto Sans TC", sans-serif;
  cursor: pointer;
}

body[data-screen="puzzle-screen"] .puzzle-tabletop-selection-action {
  position: absolute;
  bottom: clamp(1.1rem, 3vw, 2.6rem);
  left: 50%;
  z-index: 40;
  display: flex;
  align-items: center;
  gap: .7rem;
  transform: translateX(-50%);
  padding: .55rem .65rem .55rem 1rem;
  border: 1px solid rgba(255, 221, 148, .5);
  border-radius: 999px;
  background: rgba(40, 16, 5, .9);
  box-shadow: 0 .8rem 1.4rem rgba(15, 3, 0, .38);
  color: #fff1cb;
  white-space: nowrap;
}

body[data-screen="puzzle-screen"] .puzzle-tabletop-selection-action[hidden] { display: none; }
body[data-screen="puzzle-screen"] .puzzle-tabletop-selection-action strong { color: #ffdc87; }

body[data-screen="puzzle-screen"] .puzzle-tabletop-cancel,
body[data-screen="puzzle-screen"] .puzzle-tabletop-confirm {
  padding: .55rem 1rem;
  border-radius: 999px;
  font: 800 .92rem / 1.2 "Noto Sans TC", sans-serif;
  cursor: pointer;
}

body[data-screen="puzzle-screen"] .puzzle-tabletop-cancel {
  border: 1px solid rgba(255, 225, 164, .42);
  background: transparent;
  color: #fff1d2;
}

body[data-screen="puzzle-screen"] .puzzle-tabletop-confirm {
  border: 1px solid #e3b45e;
  background: linear-gradient(180deg, #b8762e, #70400e);
  color: #fff4ce;
  box-shadow: inset 0 1px 0 rgba(255, 236, 175, .46);
}

body[data-screen="puzzle-screen"] .puzzle-tabletop-confirm:disabled {
  opacity: .45;
  cursor: not-allowed;
}

body[data-screen="puzzle-screen"] .puzzle-drawer-art,
body[data-screen="puzzle-screen"] .puzzle-drawer-title,
body[data-screen="puzzle-screen"] .puzzle-drawer-instruction,
body[data-screen="puzzle-screen"] .puzzle-bird-choice-actions,
body[data-screen="puzzle-screen"] .puzzle-home-latch,
body[data-screen="puzzle-screen"] .puzzle-selection-copy,
body[data-screen="puzzle-screen"] .puzzle-selection-gallery,
body[data-screen="puzzle-screen"] .puzzle-selection-preview,
body[data-screen="puzzle-screen"] .puzzle-selection-back-button {
  display: none !important;
}

@media (max-width: 760px) {
  body[data-screen="puzzle-screen"] .puzzle-drawer-selection.puzzle-tabletop-selection {
    min-height: 100svh;
    background-position: center;
  }

  body[data-screen="puzzle-screen"] .puzzle-tabletop-header {
    top: 1rem;
    width: 70vw;
    padding: .55rem .8rem;
  }

  body[data-screen="puzzle-screen"] .puzzle-tabletop-header p { display: none; }
  body[data-screen="puzzle-screen"] .puzzle-tabletop-back { top: 1rem; right: .7rem; min-width: auto; padding: .55rem .75rem; }
  body[data-screen="puzzle-screen"] .puzzle-drawer-slot { width: clamp(86px, 21vw, 145px); }
  body[data-screen="puzzle-screen"] .puzzle-tabletop-selection-action { max-width: calc(100vw - 1rem); gap: .35rem; padding-left: .7rem; }
  body[data-screen="puzzle-screen"] .puzzle-tabletop-selection-action span { display: none; }
  body[data-screen="puzzle-screen"] .puzzle-tabletop-cancel,
  body[data-screen="puzzle-screen"] .puzzle-tabletop-confirm { padding: .55rem .75rem; }
}

/* Memory board v7: pocket-watch timer and wider bamboo species cards. */
body[data-screen="memory-screen"] .timer-chip {
  min-height: 8.85rem;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(7rem, 0.74fr);
  grid-template-areas: "dial steps";
  column-gap: 0.45rem;
  place-items: center;
  padding: 0.16rem 0.65rem 0.46rem 0.34rem;
  overflow: visible;
  border-color: rgba(220, 190, 127, 0.34);
  background:
    radial-gradient(ellipse at 50% 76%, rgba(255, 231, 161, 0.22), transparent 46%),
    linear-gradient(180deg, rgba(88, 67, 43, 0.42), rgba(45, 37, 29, 0.3));
  box-shadow:
    inset 0 1px 0 rgba(255, 245, 218, 0.2),
    inset 0 -0.8rem 1.6rem rgba(31, 24, 18, 0.16);
}

body[data-screen="memory-screen"] .timer-chip::before,
body[data-screen="memory-screen"] .timer-chip::after {
  display: none;
}

body[data-screen="memory-screen"] .pocket-timer {
  grid-area: dial;
  position: relative;
  width: min(9.4rem, 100%);
  aspect-ratio: 1;
  filter:
    drop-shadow(0 0.52rem 0.42rem rgba(20, 14, 9, 0.27))
    drop-shadow(0 0 0.42rem rgba(234, 201, 132, 0.16));
}

body[data-screen="memory-screen"] .pocket-timer img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

body[data-screen="memory-screen"] .timer-readout {
  position: absolute;
  left: 50%;
  top: 58%;
  z-index: 2;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.08rem;
  width: 58%;
  margin: 0;
  color: #53351f;
  font-family: var(--font-display);
  font-size: clamp(3.1rem, 4.25vw, 4.85rem);
  line-height: 1;
  letter-spacing: -0.045em;
  text-shadow:
    0 1px 0 rgba(255, 249, 220, 0.72),
    0 0 0.75rem rgba(235, 196, 118, 0.24);
  transform: translate(-50%, -50%);
}

body[data-screen="memory-screen"] .timer-readout small {
  margin-left: 0.1rem;
  font-size: 0.28em;
  letter-spacing: 0.04em;
}

body[data-screen="memory-screen"] .timer-chip > span {
  position: absolute;
  left: 32.5%;
  top: 2.85rem;
  z-index: 3;
  transform: translateX(-50%);
  color: rgba(88, 60, 34, 0.72);
  font-size: clamp(0.64rem, 0.72vw, 0.8rem);
  letter-spacing: 0.18em;
  white-space: nowrap;
}

body[data-screen="memory-screen"] .timer-chip .metric-bar {
  position: absolute;
  left: 32.5%;
  bottom: 0.78rem;
  z-index: 3;
  width: min(5.6rem, 58%);
  height: 0.3rem;
  transform: translateX(-50%);
  background: rgba(70, 47, 25, 0.22);
}

body[data-screen="memory-screen"] .timer-chip .timer-status {
  position: absolute;
  left: 32.5%;
  bottom: 0.06rem;
  z-index: 3;
  width: 55%;
  min-height: 0;
  margin: 0;
  transform: translateX(-50%);
  color: rgba(62, 45, 29, 0.72);
  text-align: center;
  font-size: clamp(0.58rem, 0.66vw, 0.74rem);
  letter-spacing: 0.12em;
}

body[data-screen="memory-screen"] .step-counter {
  grid-area: steps;
  position: relative;
  z-index: 4;
  width: min(10.6rem, 100%);
  aspect-ratio: 1.55;
  align-self: center;
  filter:
    drop-shadow(0 0.42rem 0.42rem rgba(20, 14, 9, 0.22))
    drop-shadow(0 0 0.35rem rgba(206, 225, 162, 0.12));
}

body[data-screen="memory-screen"] .step-counter img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

body[data-screen="memory-screen"] .step-counter > span {
  position: absolute;
  left: 50%;
  top: 33%;
  transform: translate(-50%, -50%);
  color: rgba(84, 58, 34, 0.78);
  font-size: clamp(0.58rem, 0.7vw, 0.78rem);
  font-weight: 800;
  letter-spacing: 0.16em;
  white-space: nowrap;
}

body[data-screen="memory-screen"] .step-counter > strong {
  position: absolute;
  left: 50%;
  top: 56%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 4.2rem;
  margin: 0;
  color: #4f351f;
  font-family: var(--font-display);
  font-size: clamp(1.7rem, 2.1vw, 2.45rem);
  line-height: 1;
  letter-spacing: -0.035em;
  transform: translate(-50%, -50%);
  text-shadow:
    0 1px 0 rgba(255, 249, 220, 0.7),
    0 0 0.65rem rgba(206, 225, 162, 0.24);
}

body[data-screen="memory-screen"] .step-counter small {
  margin-left: 0.08rem;
  font-size: 0.36em;
  letter-spacing: 0.04em;
}

body[data-screen="memory-screen"] .step-counter.just-stepped {
  animation: stepCounterPulse 720ms cubic-bezier(0.17, 0.82, 0.28, 1.18);
}

body[data-screen="memory-screen"] .timer-chip.just-ticked .pocket-timer {
  animation: pocketTimerTick var(--timer-tick-duration) cubic-bezier(0.18, 0.82, 0.28, 1);
}

body[data-screen="memory-screen"] .timer-chip.just-threshold .pocket-timer {
  animation: pocketTimerBell 1180ms ease;
}

body[data-screen="memory-screen"] .timer-chip.timer-state-warning .pocket-timer {
  filter:
    drop-shadow(0 0.45rem 0.6rem rgba(28, 19, 12, 0.28))
    drop-shadow(0 0 0.85rem rgba(218, 167, 72, 0.42));
}

body[data-screen="memory-screen"] .timer-chip.timer-state-danger {
  animation: dangerPanelTremble 520ms ease-in-out infinite;
}

body[data-screen="memory-screen"] .timer-chip.timer-state-danger .timer-readout {
  color: #8f2e25;
  animation: pocketTimerNumberPulse 520ms steps(2, end) infinite;
}

body[data-screen="memory-screen"] .timer-chip.timer-state-danger .pocket-timer {
  filter:
    drop-shadow(0 0.45rem 0.6rem rgba(28, 19, 12, 0.28))
    drop-shadow(0 0 1.1rem rgba(192, 73, 49, 0.52));
}

.species-dialog-card.intro-bamboo-scroll {
  width: min(72rem, calc(100vw - 5rem));
  max-height: calc(100vh - 5rem);
  min-height: auto;
  aspect-ratio: 16 / 9;
  padding: clamp(4.35rem, 5.2vw, 6.1rem) clamp(4.6rem, 6.1vw, 7rem);
  background-size: 100% 100%;
}

.species-dialog-layout {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: minmax(12rem, 0.82fr) minmax(18rem, 1.18fr);
  gap: clamp(1.2rem, 2.4vw, 2.6rem);
  height: 100%;
  align-items: center;
}

.species-dialog-portrait {
  position: relative;
  display: grid;
  place-items: center;
  align-self: stretch;
  min-height: 0;
  margin: 0;
  border-radius: 1.4rem;
  background:
    radial-gradient(circle at 50% 52%, rgba(255, 246, 201, 0.46), transparent 54%),
    linear-gradient(180deg, rgba(214, 196, 143, 0.18), rgba(126, 151, 111, 0.08));
}

.species-dialog-portrait::before {
  content: "";
  position: absolute;
  inset: 12% 10%;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(228, 209, 145, 0.26), transparent 66%);
  filter: blur(0.35rem);
}

.species-dialog-portrait img {
  position: relative;
  z-index: 1;
  width: min(100%, 18rem);
  max-height: min(100%, 20rem);
  object-fit: contain;
  filter:
    drop-shadow(0 0.85rem 0.85rem rgba(32, 24, 15, 0.22))
    drop-shadow(0 0 0.65rem rgba(242, 226, 166, 0.22));
  animation: speciesPortraitBreath 2.8s ease-in-out infinite;
}

.species-dialog-copy {
  min-width: 0;
}

.species-dialog-copy .card-label {
  font-size: clamp(0.7rem, 0.85vw, 0.92rem);
}

.species-dialog-copy h2 {
  margin: 0.28rem 0 0;
  font-size: clamp(2rem, 3vw, 3.25rem);
}

.species-dialog-phonetic {
  margin: 0.15rem 0 0.85rem;
  color: #8d7143;
  font-weight: 800;
  letter-spacing: 0.18em;
  line-height: 1.25;
}

.species-dialog-copy > p:not(.card-label):not(.species-dialog-phonetic):not(.species-virtue-line):not(.species-dialog-hint) {
  font-size: clamp(1rem, 1.25vw, 1.25rem);
  line-height: 1.8;
}

.species-dialog-copy .species-dialog-hint {
  margin-top: 0.9rem;
}

@keyframes pocketTimerTick {
  0%,
  100% {
    transform: translateY(0) scale(1);
  }

  45% {
    transform: translateY(-0.12rem) scale(1.025);
  }
}

@keyframes pocketTimerBell {
  0%,
  100% {
    transform: rotate(0) scale(1);
  }

  26% {
    transform: rotate(-3deg) scale(1.06);
  }

  56% {
    transform: rotate(3deg) scale(1.04);
  }
}

@keyframes pocketTimerNumberPulse {
  0%,
  100% {
    transform: translate(-50%, -50%) scale(1);
  }

  50% {
    transform: translate(-50%, -50%) scale(1.06);
  }
}

@keyframes stepCounterPulse {
  0%,
  100% {
    transform: translateY(0) scale(1);
    filter:
      drop-shadow(0 0.42rem 0.42rem rgba(20, 14, 9, 0.22))
      drop-shadow(0 0 0.35rem rgba(206, 225, 162, 0.12));
  }

  48% {
    transform: translateY(-0.12rem) scale(1.045);
    filter:
      drop-shadow(0 0.48rem 0.48rem rgba(20, 14, 9, 0.24))
      drop-shadow(0 0 0.85rem rgba(206, 225, 162, 0.36));
  }
}

@keyframes speciesPortraitBreath {
  0%,
  100% {
    transform: translateY(0) scale(1);
  }

  50% {
    transform: translateY(-0.22rem) scale(1.025);
  }
}

@media (max-width: 900px) {
  body[data-screen="memory-screen"] .timer-chip {
    grid-template-columns: 1fr;
    grid-template-areas:
      "dial"
      "steps";
    row-gap: 0.25rem;
  }

  body[data-screen="memory-screen"] .timer-chip > span,
  body[data-screen="memory-screen"] .timer-chip .metric-bar,
  body[data-screen="memory-screen"] .timer-chip .timer-status {
    left: 50%;
  }

  body[data-screen="memory-screen"] .step-counter {
    width: min(9rem, 84%);
  }

  .species-dialog-card.intro-bamboo-scroll {
    width: min(44rem, calc(100vw - 2rem));
    max-height: calc(100vh - 2rem);
    aspect-ratio: auto;
    padding: 4.8rem 2.45rem;
    background-size: cover;
  }

  .species-dialog-layout {
    grid-template-columns: 1fr;
    gap: 0.8rem;
  }

  .species-dialog-portrait {
    min-height: 10rem;
  }

  .species-dialog-portrait img {
    max-height: 12rem;
  }
}

/* Let the supplied wood image be the entire selection-page background. */
body[data-screen="puzzle-screen"] .top-bar {
  display: none;
}

body[data-screen="puzzle-screen"] #puzzle-screen {
  width: 100%;
  max-width: none;
  min-height: 100svh;
  margin: 0;
  padding: 0;
}

body[data-screen="puzzle-screen"] .screen-stack {
  padding: 0 !important;
}

/* Final puzzle rules typography and rhythm. */
#puzzle-dialog .puzzle-rules-card {
  padding: clamp(1.45rem, 3.4vw, 2.45rem) !important;
}

#puzzle-dialog .puzzle-rules-card h2 {
  margin: 0 0 .8rem !important;
  font-size: clamp(2.25rem, 3.4vw, 3.45rem) !important;
}

#puzzle-dialog .puzzle-rules-intro {
  margin-bottom: 1.35rem !important;
  font-size: clamp(1.05rem, 1.45vw, 1.32rem) !important;
}

#puzzle-dialog .puzzle-rules-list {
  gap: .78rem;
}

#puzzle-dialog .puzzle-rules-list li {
  grid-template-columns: 2.65rem 1fr;
  gap: .85rem;
  padding: .82rem 1rem;
}

#puzzle-dialog .puzzle-rules-list span {
  width: 2.28rem;
  height: 2.28rem;
  font-size: 1rem;
}

#puzzle-dialog .puzzle-rules-list p {
  font-size: clamp(1rem, 1.35vw, 1.2rem) !important;
  line-height: 1.55;
}

#puzzle-dialog .puzzle-rules-actions {
  margin-top: 1.5rem;
  gap: .9rem;
}

#puzzle-dialog .puzzle-rules-actions .brass-action-button {
  min-height: 3rem;
  padding: .78rem 1.35rem;
  font-size: 1.08rem;
}

#puzzle-dialog .puzzle-rules-crest,
#puzzle-dialog .card-label {
  display: none !important;
}

body[data-screen="puzzle-screen"] .puzzle-prototype.is-playing {
  display: block !important;
}

body[data-screen="puzzle-screen"] .puzzle-prototype.is-playing .puzzle-sidebar {
  display: none !important;
}

body[data-screen="puzzle-screen"] .puzzle-prototype.is-playing .puzzle-workshop {
  display: grid !important;
}

/* Final rules-dialog fit guard. */
#puzzle-dialog.puzzle-rules-dialog {
  width: min(39rem, calc(100vw - 2rem)) !important;
  max-width: calc(100vw - 2rem) !important;
  max-height: calc(100dvh - 2rem) !important;
  margin: auto !important;
  padding: 0 !important;
  box-sizing: border-box !important;
}

#puzzle-dialog .puzzle-rules-card {
  width: 100% !important;
  max-width: 100% !important;
  max-height: calc(100dvh - 2rem) !important;
  padding: clamp(1rem, 3vw, 2rem) !important;
  overflow: auto !important;
  box-sizing: border-box !important;
}

#puzzle-dialog .puzzle-rules-note { display: none !important; }

@media (max-width: 520px) {
  #puzzle-dialog.puzzle-rules-dialog { width: calc(100vw - 1rem) !important; max-width: calc(100vw - 1rem) !important; }
  #puzzle-dialog .puzzle-rules-card { padding: .9rem !important; border-radius: .9rem; }
  #puzzle-dialog .puzzle-rules-card h2 { font-size: 1.65rem; }
  #puzzle-dialog .puzzle-rules-list { gap: .45rem; }
  #puzzle-dialog .puzzle-rules-list li { grid-template-columns: 1.7rem 1fr; gap: .45rem; padding: .55rem; }
  #puzzle-dialog .puzzle-rules-list span { width: 1.55rem; height: 1.55rem; }
  #puzzle-dialog .puzzle-rules-list p { font-size: .82rem; }
  #puzzle-dialog .puzzle-rules-actions .brass-action-button { flex-basis: 0; padding: .6em .45em; font-size: .86rem; }
}

/* Puzzle play screen: a warm worktable with a clear paper-and-brass work area. */
body[data-screen="puzzle-screen"] .puzzle-prototype.is-playing {
  display: block;
  width: 100%;
  min-height: 100svh;
  padding: clamp(1rem, 2.4vw, 2.8rem);
  background: url("../image/generated/puzzle-selection-wood-background-1920x1080.png") center / cover no-repeat;
}

body[data-screen="puzzle-screen"] .puzzle-prototype.is-playing .puzzle-workshop {
  display: grid;
  min-height: calc(100svh - clamp(2rem, 4.8vw, 5.6rem));
  padding: clamp(.9rem, 1.45vw, 1.45rem);
  border: 2px solid rgba(222, 174, 103, .78);
  border-radius: 1.45rem;
  background: linear-gradient(180deg, rgba(255, 250, 238, .97), rgba(239, 222, 188, .94));
  box-shadow: 0 1rem 2.4rem rgba(27, 10, 3, .52), inset 0 1px 0 #fff;
}

body[data-screen="puzzle-screen"] .puzzle-prototype.is-playing .puzzle-workshop-head {
  padding: .85rem 1rem;
  border-color: #b88349;
  background: linear-gradient(180deg, #633919, #42220e);
  box-shadow: inset 0 1px 0 rgba(255, 224, 168, .26), 0 .3rem .65rem rgba(39, 15, 3, .24);
}

body[data-screen="puzzle-screen"] .puzzle-prototype.is-playing .puzzle-workshop-head .card-label,
body[data-screen="puzzle-screen"] .puzzle-prototype.is-playing .puzzle-workshop-head h3 {
  color: #fff2d1;
}

body[data-screen="puzzle-screen"] .puzzle-prototype.is-playing .puzzle-progress-chip {
  border-color: #ab753a;
  background: linear-gradient(180deg, #f7deb1, #d2a262);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.75), 0 .25rem .5rem rgba(54, 24, 6, .24);
}

body[data-screen="puzzle-screen"] .puzzle-prototype.is-playing .puzzle-progress-chip span {
  color: #603719;
}

body[data-screen="puzzle-screen"] .puzzle-prototype.is-playing .puzzle-progress-chip strong {
  color: #3a1e0b;
}

body[data-screen="puzzle-screen"] .puzzle-prototype.is-playing .puzzle-workbench {
  border: 2px solid #9f6e39;
  border-radius: 1.15rem;
  background:
    linear-gradient(180deg, rgba(255, 247, 224, .18), rgba(57, 28, 10, .12)),
    url("../image/generated/puzzle-selection-wood-background-1920x1080.png") center / cover;
  box-shadow: inset 0 0 0 1px rgba(255, 230, 172, .34), inset 0 -2rem 4.5rem rgba(47, 20, 5, .26);
}

body[data-screen="puzzle-screen"] .puzzle-prototype.is-playing .puzzle-target-frame {
  border: 2px dashed rgba(255, 230, 166, .86);
  background: rgba(255, 249, 231, .2);
  box-shadow: inset 0 0 0 1px rgba(67, 30, 10, .16), 0 .45rem .9rem rgba(33, 12, 2, .24);
}

body[data-screen="puzzle-screen"] .puzzle-prototype.is-playing .puzzle-piece-tray {
  border-color: #b78349;
  background: linear-gradient(180deg, rgba(99, 57, 25, .95), rgba(59, 29, 11, .95));
}

body[data-screen="puzzle-screen"] .puzzle-prototype.is-playing .puzzle-piece-tray span {
  color: #ffedc5;
}

body[data-screen="puzzle-screen"] .puzzle-prototype.is-playing .puzzle-actions .puzzle-tool-button {
  border-color: #b78349;
  background: #5b3217;
  color: #fff2d4;
  box-shadow: inset 0 1px 0 rgba(255, 224, 164, .22), 0 .25rem .45rem rgba(36, 13, 3, .24);
}

/* Rules dialog: always fit within the viewport, including small screens. */
#puzzle-dialog.puzzle-rules-dialog {
  width: min(39rem, calc(100vw - 2rem));
  max-width: calc(100vw - 2rem);
  max-height: calc(100dvh - 2rem);
  margin: auto;
  padding: 0;
  overflow: visible;
  box-sizing: border-box;
}

#puzzle-dialog .puzzle-rules-card {
  width: 100%;
  max-width: 100%;
  max-height: calc(100dvh - 2rem);
  padding: clamp(1rem, 3vw, 2rem);
  overflow: auto;
  box-sizing: border-box;
}

#puzzle-dialog .puzzle-rules-note {
  display: none;
}

@media (max-width: 520px) {
  #puzzle-dialog.puzzle-rules-dialog {
    width: calc(100vw - 1rem);
    max-width: calc(100vw - 1rem);
  }

  #puzzle-dialog .puzzle-rules-card {
    padding: .9rem;
    border-radius: .9rem;
  }

  #puzzle-dialog .puzzle-rules-card h2 { font-size: 1.65rem; }
  #puzzle-dialog .puzzle-rules-list { gap: .45rem; }
  #puzzle-dialog .puzzle-rules-list li { grid-template-columns: 1.7rem 1fr; gap: .45rem; padding: .55rem; }
  #puzzle-dialog .puzzle-rules-list span { width: 1.55rem; height: 1.55rem; }
  #puzzle-dialog .puzzle-rules-list p { font-size: .82rem; }
  #puzzle-dialog .puzzle-rules-actions .brass-action-button { flex-basis: 0; padding: .6em .45em; font-size: .86rem; }
}

/* Wood-table palette and direct-start selection behaviour. */
body[data-screen="puzzle-screen"] .puzzle-drawer-selection.puzzle-gallery-selection {
  background-image: url("../image/generated/puzzle-selection-wood-background-1920x1080.png");
  background-size: cover;
}

body[data-screen="puzzle-screen"] .puzzle-gallery-header h2 {
  color: #fff0d2;
  font-size: clamp(2.35rem, 3.65vw, 4.15rem);
}

body[data-screen="puzzle-screen"] .puzzle-gallery-selection .puzzle-bird-card {
  border-color: #9a6a3c;
  box-shadow: 0 .55rem 1rem rgba(24, 10, 3, .4);
}

body[data-screen="puzzle-screen"] .puzzle-gallery-selection .puzzle-bird-card:hover,
body[data-screen="puzzle-screen"] .puzzle-gallery-selection .puzzle-bird-card:focus-visible {
  box-shadow: 0 .9rem 1.45rem rgba(24, 10, 3, .52);
}

body[data-screen="puzzle-screen"] .puzzle-gallery-selection .puzzle-bird-card-caption {
  min-height: 25%;
  background: #4a2d18;
  color: #fff7e7;
  font-size: clamp(1.2rem, 1.8vw, 2rem);
  letter-spacing: .04em;
}

body[data-screen="puzzle-screen"] .puzzle-gallery-back {
  border-color: #d8a45e;
  background: #6a3e1e;
  box-shadow: inset 0 1px 0 rgba(255, 232, 190, .28), 0 .3rem .55rem rgba(26, 10, 3, .42);
  color: #fff4de;
}

body[data-screen="puzzle-screen"] .puzzle-gallery-action {
  display: none !important;
}

/* Result screen: leaderboard replaces the old level/title feedback. */
.leaderboard-card {
  width: min(74rem, calc(100vw - 4rem));
  max-width: 74rem;
}

.leaderboard-card .title-summary {
  max-width: 54rem;
  color: rgba(39, 56, 47, 0.78);
  font-size: clamp(1rem, 1.25vw, 1.28rem);
  line-height: 1.75;
}

.result-spotlight {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: clamp(0.8rem, 1.2vw, 1.2rem);
  margin: clamp(1.2rem, 2vw, 1.8rem) 0;
}

.result-spotlight article {
  position: relative;
  overflow: hidden;
  padding: clamp(1rem, 1.5vw, 1.35rem);
  border: 1px solid rgba(116, 91, 53, 0.18);
  border-radius: 1.15rem;
  background:
    radial-gradient(circle at 82% 20%, rgba(255, 247, 200, 0.44), transparent 36%),
    linear-gradient(160deg, rgba(255, 250, 235, 0.88), rgba(219, 202, 160, 0.72));
  box-shadow:
    0 0.9rem 1.8rem rgba(26, 32, 25, 0.12),
    inset 0 1px 0 rgba(255, 255, 255, 0.42);
}

.result-spotlight span {
  display: block;
  color: rgba(70, 54, 34, 0.68);
  font-size: clamp(0.72rem, 0.8vw, 0.88rem);
  font-weight: 800;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.result-spotlight strong {
  display: block;
  margin-top: 0.35rem;
  color: #26382e;
  font-family: var(--font-display);
  font-size: clamp(1.8rem, 3.3vw, 3.1rem);
  line-height: 1;
}

.leaderboard-panel {
  margin-top: clamp(1rem, 1.6vw, 1.45rem);
  padding: clamp(1rem, 1.6vw, 1.4rem);
  border: 1px solid rgba(86, 112, 88, 0.16);
  border-radius: 1.35rem;
  background:
    linear-gradient(180deg, rgba(255, 252, 241, 0.74), rgba(226, 236, 215, 0.54)),
    repeating-linear-gradient(90deg, rgba(83, 96, 71, 0.035) 0 1px, transparent 1px 1.8rem);
}

.leaderboard-panel-head {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.85rem;
}

.leaderboard-panel h3 {
  margin: 0.2rem 0 0;
  color: #26382e;
  font-family: var(--font-display);
  font-size: clamp(1.6rem, 2.5vw, 2.35rem);
}

.leaderboard-panel-head p:last-child {
  max-width: 32rem;
  margin: 0;
  color: rgba(55, 70, 58, 0.72);
  text-align: right;
  line-height: 1.55;
}

.leaderboard-list {
  display: grid;
  gap: 0.55rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.leaderboard-row,
.leaderboard-empty {
  display: grid;
  grid-template-columns: 3.4rem minmax(9rem, 1fr) 7.2rem 7.2rem;
  align-items: center;
  gap: 0.7rem;
  padding: 0.72rem 0.85rem;
  border-radius: 0.95rem;
  background: rgba(255, 252, 241, 0.68);
  color: rgba(39, 56, 47, 0.86);
}

.leaderboard-row:nth-child(-n + 3) {
  background:
    radial-gradient(circle at 8% 50%, rgba(228, 196, 111, 0.32), transparent 28%),
    rgba(255, 252, 241, 0.82);
}

.leaderboard-rank {
  display: inline-grid;
  place-items: center;
  width: 2.3rem;
  aspect-ratio: 1;
  border-radius: 999px;
  background: linear-gradient(180deg, #8b6a3f, #5f4023);
  color: #fff6df;
  font-family: var(--font-display);
  font-weight: 900;
}

.leaderboard-row strong {
  color: #26382e;
  font-size: clamp(1rem, 1.2vw, 1.18rem);
}

.leaderboard-row span:not(.leaderboard-rank) {
  color: rgba(70, 54, 34, 0.78);
  font-weight: 800;
  text-align: right;
}

.leaderboard-empty {
  grid-template-columns: 1fr;
  color: rgba(55, 70, 58, 0.66);
  text-align: center;
}

.leaderboard-name-card {
  width: min(34rem, calc(100vw - 2rem));
}

.leaderboard-name-card h2 {
  margin-bottom: 0.65rem;
}

.leaderboard-name-field {
  display: grid;
  gap: 0.45rem;
  margin-top: 1.1rem;
  color: #26382e;
  font-weight: 800;
}

.leaderboard-name-field input {
  width: 100%;
  padding: 0.9rem 1rem;
  border: 1px solid rgba(116, 91, 53, 0.28);
  border-radius: 0.85rem;
  background: rgba(255, 252, 241, 0.92);
  color: #26382e;
  font: inherit;
  font-size: 1.1rem;
  outline: none;
}

.leaderboard-name-field input:focus {
  border-color: rgba(126, 151, 92, 0.72);
  box-shadow: 0 0 0 0.22rem rgba(126, 151, 92, 0.18);
}

.input-error {
  min-height: 1.4rem;
  margin: 0.65rem 0 1rem;
  color: #9b3128;
  font-weight: 800;
}

@media (max-width: 760px) {
  .leaderboard-card {
    width: min(100%, calc(100vw - 1.4rem));
  }

  .result-spotlight {
    grid-template-columns: 1fr;
  }

  .leaderboard-panel-head {
    display: block;
  }

  .leaderboard-panel-head p:last-child {
    margin-top: 0.45rem;
    text-align: left;
  }

  .leaderboard-row {
    grid-template-columns: 2.8rem minmax(0, 1fr);
  }

  .leaderboard-row span:not(.leaderboard-rank) {
    text-align: left;
  }
}

/* Refinement: complete bird record, native name input, designed leaderboard layers. */
#species-dialog.overlay-dialog {
  width: min(94vw, 72rem);
  overflow: visible;
}

#species-dialog .species-dialog-card.intro-bamboo-scroll {
  width: 100%;
  max-height: calc(100vh - 2.5rem);
  min-height: min(42rem, calc(100vh - 2.5rem));
  aspect-ratio: auto;
  overflow: visible;
  padding: clamp(3.4rem, 4.3vw, 5.2rem) clamp(3.7rem, 5vw, 6.4rem);
}

#species-dialog .species-dialog-layout {
  grid-template-columns: minmax(12rem, 0.9fr) minmax(17rem, 1.1fr);
  min-height: 0;
}

#species-dialog .species-dialog-copy {
  max-height: calc(100vh - 10.5rem);
  overflow: auto;
  padding-right: 0.35rem;
}

#species-dialog .species-dialog-copy::-webkit-scrollbar {
  width: 0.42rem;
}

#species-dialog .species-dialog-copy::-webkit-scrollbar-thumb {
  border-radius: 999px;
  background: rgba(124, 96, 54, 0.34);
}

#species-dialog .species-dialog-copy h2 {
  font-size: clamp(2rem, 3.4vw, 3.7rem);
}

#species-dialog .species-dialog-copy > p:not(.card-label):not(.species-dialog-phonetic):not(.species-virtue-line):not(.species-dialog-hint) {
  font-size: clamp(0.95rem, 1.12vw, 1.18rem);
  line-height: 1.72;
}

#species-dialog .species-dialog-portrait img {
  max-height: min(48vh, 20rem);
}

@media (max-height: 680px) {
  #species-dialog .species-dialog-card.intro-bamboo-scroll {
    padding: 2.7rem 3.2rem;
  }

  #species-dialog .species-dialog-copy {
    max-height: calc(100vh - 7rem);
  }
}

#leaderboard-name-dialog.overlay-dialog {
  width: min(94vw, 54rem);
}

.leaderboard-name-card {
  width: 100%;
  max-height: calc(100vh - 2rem);
  overflow: auto;
  padding: clamp(1.25rem, 2vw, 1.8rem);
}

.leaderboard-card {
  width: min(86rem, calc(100vw - 3rem));
  max-width: 86rem;
  background:
    radial-gradient(circle at 72% 12%, rgba(243, 223, 150, 0.3), transparent 28%),
    linear-gradient(160deg, rgba(249, 245, 236, 0.96), rgba(221, 234, 213, 0.86));
}

.leaderboard-list {
  gap: clamp(0.9rem, 1.4vw, 1.25rem);
}

.leaderboard-podium {
  display: grid;
  grid-template-columns: minmax(0, 0.92fr) minmax(0, 1.12fr) minmax(0, 0.92fr);
  gap: clamp(0.75rem, 1.25vw, 1.1rem);
  align-items: end;
}

.podium-card {
  position: relative;
  overflow: hidden;
  min-height: 10.5rem;
  padding: clamp(1rem, 1.55vw, 1.4rem);
  border: 1px solid rgba(116, 91, 53, 0.2);
  border-radius: 1.35rem;
  background:
    radial-gradient(circle at 50% 0%, rgba(255, 244, 186, 0.72), transparent 42%),
    linear-gradient(180deg, rgba(255, 251, 231, 0.94), rgba(218, 202, 156, 0.82));
  box-shadow:
    0 1.1rem 2rem rgba(28, 34, 27, 0.14),
    inset 0 1px 0 rgba(255, 255, 255, 0.48);
}

.podium-card::after {
  content: "";
  position: absolute;
  left: -12%;
  right: -12%;
  bottom: -2.4rem;
  height: 5.6rem;
  border-radius: 50% 50% 0 0;
  background: rgba(119, 93, 55, 0.1);
}

.podium-rank-1 {
  grid-column: 2;
  min-height: 12.2rem;
  background:
    radial-gradient(circle at 50% 0%, rgba(255, 239, 151, 0.9), transparent 43%),
    linear-gradient(180deg, rgba(255, 252, 224, 0.96), rgba(213, 179, 98, 0.88));
}

.podium-rank-2 {
  grid-column: 1;
  min-height: 10.8rem;
}

.podium-rank-3 {
  grid-column: 3;
  min-height: 10rem;
}

.podium-medal {
  display: inline-grid;
  place-items: center;
  width: 2.8rem;
  aspect-ratio: 1;
  border-radius: 999px;
  background: linear-gradient(180deg, #9f7440, #5f4023);
  color: #fff7df;
  font-family: var(--font-display);
  font-size: 1.35rem;
  font-weight: 900;
  box-shadow: 0 0.45rem 0.85rem rgba(64, 42, 20, 0.2);
}

.podium-card strong {
  display: block;
  position: relative;
  z-index: 1;
  margin-top: 0.72rem;
  color: #26382e;
  font-family: var(--font-display);
  font-size: clamp(1.35rem, 2.4vw, 2.15rem);
  line-height: 1.1;
}

.podium-card dl {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.55rem;
  margin: 1rem 0 0;
}

.podium-card dl div {
  padding: 0.45rem 0.55rem;
  border-radius: 0.72rem;
  background: rgba(255, 252, 238, 0.48);
}

.podium-card dt {
  color: rgba(70, 54, 34, 0.58);
  font-size: 0.68rem;
  font-weight: 900;
  letter-spacing: 0.16em;
}

.podium-card dd {
  margin: 0.12rem 0 0;
  color: rgba(39, 56, 47, 0.92);
  font-weight: 900;
}

.leaderboard-runners {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.55rem 0.75rem;
  padding: clamp(0.7rem, 1.1vw, 1rem);
  border-radius: 1.15rem;
  background:
    linear-gradient(180deg, rgba(255, 252, 241, 0.54), rgba(226, 236, 215, 0.34)),
    repeating-linear-gradient(0deg, rgba(82, 98, 76, 0.05) 0 1px, transparent 1px 2.2rem);
}

.leaderboard-runners .leaderboard-row {
  grid-template-columns: 2.8rem minmax(7rem, 1fr) 5.5rem 5.5rem;
  padding: 0.62rem 0.75rem;
}

.leaderboard-runners .leaderboard-row:nth-child(-n + 3) {
  background: rgba(255, 252, 241, 0.68);
}

@media (max-width: 900px) {
  .leaderboard-podium,
  .leaderboard-runners {
    grid-template-columns: 1fr;
  }

  .podium-card,
  .podium-rank-1,
  .podium-rank-2,
  .podium-rank-3 {
    grid-column: auto;
    min-height: auto;
  }
}

/* Current polish: remove the home note block and center scroll-dialog content. */
body[data-screen="home-screen"] #home-screen {
  grid-template-columns: minmax(0, 1fr);
  align-items: end;
}

body[data-screen="home-screen"] .hero-panel {
  max-width: min(64rem, 92vw);
}

#species-dialog .species-dialog-card.intro-bamboo-scroll {
  display: grid;
  place-items: center;
}

#species-dialog .species-dialog-layout {
  width: min(100%, 58rem);
  align-items: center;
}

#species-dialog .species-dialog-portrait {
  align-self: center;
  min-height: clamp(16rem, 36vh, 24rem);
}

#species-dialog .species-dialog-portrait img {
  width: min(100%, 24rem);
  max-height: min(44vh, 22rem);
  border-radius: 1rem;
  object-fit: contain;
}

#species-dialog .species-dialog-copy {
  display: grid;
  align-content: center;
  align-self: center;
  max-height: min(62vh, 26rem);
}

#species-dialog .species-dialog-copy h2 {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.04em;
  margin-bottom: 0.35rem;
}

#species-dialog .species-dialog-phonetic {
  display: none;
}

.name-phonetic-unit {
  display: inline-grid;
  grid-template-columns: auto 0.42em;
  align-items: center;
  column-gap: 0.03em;
}

.name-character {
  color: #21362d;
  line-height: 0.96;
}

.name-phonetic {
  writing-mode: vertical-rl;
  text-orientation: upright;
  color: #21362d;
  font-family: var(--font-body);
  font-size: 0.34em;
  font-weight: 900;
  letter-spacing: -0.08em;
  line-height: 1;
  text-shadow:
    -1px -1px 0 rgba(255, 250, 232, 0.72),
    1px 1px 0 rgba(255, 250, 232, 0.72);
}

@media (max-width: 760px) {
  #species-dialog .species-dialog-layout {
    width: min(100%, 34rem);
  }
}

/* Current refinement: source photos, side tone marks, timer label, and podium Top 3. */
body[data-screen="memory-screen"] .timer-chip > span {
  top: 0.88rem;
  padding: 0.16rem 0.56rem 0.14rem;
  border: 1px solid rgba(120, 84, 44, 0.2);
  border-radius: 999px;
  background: rgba(255, 246, 211, 0.78);
  color: rgba(84, 53, 28, 0.92);
  font-size: clamp(0.92rem, 1.05vw, 1.18rem);
  letter-spacing: 0.16em;
  box-shadow:
    0 0.28rem 0.75rem rgba(44, 31, 18, 0.16),
    inset 0 1px 0 rgba(255, 255, 255, 0.7);
}

#species-dialog .species-dialog-portrait {
  grid-template-rows: minmax(0, 1fr) auto;
  gap: clamp(0.72rem, 1vw, 1rem);
  padding: clamp(0.25rem, 0.7vw, 0.55rem);
  background:
    radial-gradient(circle at 48% 42%, rgba(255, 244, 196, 0.36), transparent 58%),
    radial-gradient(ellipse at 50% 88%, rgba(87, 103, 70, 0.16), transparent 58%);
}

#species-dialog .species-dialog-portrait::before {
  z-index: 0;
}

#species-dialog .species-dialog-portrait img {
  align-self: end;
  width: min(100%, 25rem);
  max-height: min(40vh, 20.5rem);
  padding: clamp(0.44rem, 0.72vw, 0.68rem);
  border: 2px solid rgba(91, 58, 18, 0.78);
  border-radius: 1.05rem;
  background:
    linear-gradient(135deg, rgba(255, 244, 193, 0.98) 0%, rgba(214, 156, 48, 0.98) 36%, rgba(105, 63, 19, 0.96) 68%, rgba(248, 218, 105, 0.95) 100%),
    radial-gradient(circle at 26% 18%, rgba(255, 255, 238, 0.88), transparent 38%);
  filter: saturate(1.02) contrast(1.04) sepia(0.04);
  mix-blend-mode: normal;
  opacity: 1;
  box-shadow:
    0 1.05rem 1.55rem rgba(45, 40, 25, 0.28),
    0 0.34rem 0.48rem rgba(55, 35, 13, 0.24),
    0 0 0 0.1rem rgba(255, 247, 205, 0.94),
    0 0 0 0.22rem rgba(194, 132, 35, 0.92),
    0 0 0 0.38rem rgba(67, 43, 16, 0.72),
    0 0 0 0.5rem rgba(255, 224, 112, 0.36),
    inset 0 0 0 2px rgba(255, 255, 240, 0.74),
    inset 0 0 0 4px rgba(142, 86, 22, 0.42),
    inset 0 0 1.2rem rgba(62, 39, 14, 0.24);
  object-fit: contain;
}

.species-dialog-credit {
  position: relative;
  z-index: 1;
  justify-self: center;
  max-width: 100%;
  margin-top: 0.22rem;
  padding: 0.24rem 0.58rem;
  border-radius: 999px;
  background: rgba(255, 248, 222, 0.74);
  color: rgba(67, 53, 33, 0.78);
  font-size: clamp(0.72rem, 0.82vw, 0.9rem);
  font-weight: 800;
  letter-spacing: 0.06em;
  text-align: center;
  white-space: nowrap;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.72);
}

#species-dialog .species-dialog-copy h2 {
  gap: 0.09em;
  font-size: clamp(3rem, 4.2vw, 5rem);
}

#species-dialog-name {
  display: block;
  width: fit-content;
  max-width: 100%;
  margin: -0.26rem 0 0.28rem;
  padding: 0;
  isolation: isolate;
  transform: none;
}

#species-dialog-name[data-bird-id="junglefowl"] {
  width: fit-content;
  margin: 0.12rem 0 0.44rem;
  padding: 0.08rem 0.1rem;
  isolation: isolate;
  transform: rotate(-1deg);
}

#species-dialog-name[data-bird-id="junglefowl"] .name-character {
  color: #fffdf3;
  font-family: "DFKai-SB", "BiauKai", "KaiTi", "Noto Serif TC", serif;
  font-size: 1.16em;
  font-weight: 900;
  line-height: 0.86;
  -webkit-text-fill-color: #fffdf3;
  -webkit-text-stroke: 0.055em #101411;
  paint-order: stroke fill;
  text-shadow:
    0.03em 0.035em 0 #101411,
    0.08em 0.1em 0 rgba(44, 42, 30, 0.28);
}

#species-dialog-name[data-bird-id="junglefowl"] .name-phonetic-wrap {
  width: 0.66em;
  height: 1.05em;
  margin-left: 0.04em;
}

#species-dialog-name[data-bird-id="junglefowl"] .name-phonetic-base,
#species-dialog-name[data-bird-id="junglefowl"] .name-tone-mark {
  color: #fffdf3;
  font-family: "DFKai-SB", "BiauKai", "KaiTi", "Noto Serif TC", serif;
  font-weight: 900;
  -webkit-text-fill-color: #fffdf3;
  -webkit-text-stroke: 0.07em #101411;
  paint-order: stroke fill;
  text-shadow:
    0.055em 0.06em 0 #101411,
    0.12em 0.13em 0 rgba(44, 42, 30, 0.2);
}

#species-dialog-name[data-bird-id="junglefowl"] .name-phonetic-base {
  left: 0;
  font-size: 0.31em;
  letter-spacing: -0.09em;
}

#species-dialog-name[data-bird-id="junglefowl"] .name-tone-mark {
  left: 0.38em;
  font-size: 0.29em;
}

#species-dialog-name[data-bird-id="duck"] {
  display: block;
  width: fit-content;
  max-width: 100%;
  margin: -0.26rem 0 0.28rem;
  padding: 0;
  isolation: isolate;
  transform: none;
}

.species-title-image {
  display: block;
  width: min(19.2rem, 100%);
  max-height: 6rem;
  height: auto;
  object-fit: contain;
  filter: drop-shadow(0.08rem 0.14rem 0.08rem rgba(71, 55, 34, 0.18));
}

.species-title-fallback {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
}

#species-dialog-name[data-bird-id="duck"] .name-phonetic-unit {
  align-items: center;
  gap: 0.005em;
  filter: drop-shadow(0.05em 0.075em 0.03em rgba(57, 45, 28, 0.24));
}

#species-dialog-name[data-bird-id="duck"] .name-phonetic-unit:nth-child(1) {
  transform: translateY(0.025em) rotate(-2.2deg) skewX(-1.5deg);
}

#species-dialog-name[data-bird-id="duck"] .name-phonetic-unit:nth-child(2) {
  transform: translateY(-0.02em) rotate(1.4deg) skewX(1deg);
}

#species-dialog-name[data-bird-id="duck"] .name-character {
  color: #11100b;
  font-family: "DFKai-SB", "BiauKai", "KaiTi", "Noto Serif TC", serif;
  font-size: 1.38em;
  font-weight: 800;
  line-height: 0.82;
  -webkit-text-fill-color: #11100b;
  -webkit-text-stroke: 0.002em rgba(5, 6, 4, 0.55);
  paint-order: stroke fill;
  text-shadow:
    0.012em 0.01em 0 rgba(5, 5, 3, 0.72),
    -0.006em 0.01em 0 rgba(5, 5, 3, 0.42),
    0.052em 0.066em 0 rgba(87, 70, 42, 0.2);
}

#species-dialog-name[data-bird-id="duck"] .name-phonetic-wrap {
  width: 0.48em;
  height: 0.9em;
  margin-left: -0.04em;
}

#species-dialog-name[data-bird-id="duck"] .name-phonetic-base,
#species-dialog-name[data-bird-id="duck"] .name-tone-mark {
  color: #15120d;
  font-family: "DFKai-SB", "BiauKai", "KaiTi", "Noto Serif TC", serif;
  font-weight: 800;
  -webkit-text-fill-color: #15120d;
  -webkit-text-stroke: 0.004em rgba(5, 6, 4, 0.42);
  paint-order: stroke fill;
  text-shadow:
    0.028em 0.034em 0 rgba(67, 55, 35, 0.18);
}

#species-dialog-name[data-bird-id="duck"] .name-phonetic-base {
  left: -0.01em;
  font-size: 0.22em;
  letter-spacing: -0.08em;
}

#species-dialog-name[data-bird-id="duck"] .name-tone-mark {
  left: 0.25em;
  font-size: 0.21em;
}

.name-phonetic-unit {
  display: inline-flex;
  align-items: center;
  gap: 0.03em;
}

.name-phonetic-wrap {
  position: relative;
  display: inline-block;
  align-self: center;
  width: 0.6em;
  height: 1.18em;
  margin-left: 0.01em;
}

.name-phonetic-wrap[aria-hidden="true"] {
  display: none;
}

.name-phonetic-base {
  position: absolute;
  left: 0.02em;
  top: 50%;
  writing-mode: vertical-rl;
  text-orientation: upright;
  color: #21362d;
  font-family: var(--font-body);
  font-size: 0.34em;
  font-weight: 900;
  letter-spacing: -0.08em;
  line-height: 1;
  transform: translateY(-50%);
  text-shadow:
    -1px -1px 0 rgba(255, 250, 232, 0.72),
    1px 1px 0 rgba(255, 250, 232, 0.72);
}

.name-tone-mark {
  position: absolute;
  left: 0.4em;
  top: 50%;
  color: #21362d;
  font-family: var(--font-body);
  font-size: 0.31em;
  font-weight: 900;
  line-height: 1;
  transform: translateY(-50%);
  text-shadow:
    -1px -1px 0 rgba(255, 250, 232, 0.72),
    1px 1px 0 rgba(255, 250, 232, 0.72);
}

#species-dialog .species-dialog-copy > p:not(.species-dialog-phonetic):not(.species-virtue-line):not(.species-dialog-hint) {
  position: relative;
  margin: 0.22rem 0 0.62rem;
  padding: clamp(0.62rem, 0.8vw, 0.82rem) clamp(0.78rem, 1vw, 1rem) clamp(0.62rem, 0.8vw, 0.82rem) clamp(1.05rem, 1.2vw, 1.22rem);
  border: 1px solid rgba(132, 104, 54, 0.22);
  border-left: 0.28rem solid rgba(42, 74, 58, 0.56);
  border-radius: 0.72rem;
  background:
    linear-gradient(90deg, rgba(255, 250, 229, 0.9), rgba(255, 246, 206, 0.5)),
    radial-gradient(circle at 92% 30%, rgba(172, 132, 50, 0.12), transparent 32%);
  color: rgba(37, 52, 44, 0.9);
  font-size: clamp(1.04rem, 1.16vw, 1.28rem);
  line-height: 1.72;
  box-shadow:
    0 0.42rem 0.8rem rgba(65, 49, 25, 0.08),
    inset 0 1px 0 rgba(255, 255, 255, 0.76);
}

#species-dialog .species-dialog-copy > p:not(.species-dialog-phonetic):not(.species-virtue-line):not(.species-dialog-hint)::before {
  content: "";
  position: absolute;
  left: 0.38rem;
  top: 0.5rem;
  bottom: 0.5rem;
  width: 0.08rem;
  border-radius: 999px;
  background: linear-gradient(180deg, rgba(34, 76, 58, 0.72), rgba(196, 145, 41, 0.42));
}

#species-dialog .species-dialog-copy .species-virtue-line {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  min-width: min(100%, 15rem);
  margin: 0 0 0.62rem;
  padding: 0.5rem 0.95rem 0.5rem 0.7rem;
  border: 1px solid rgba(119, 80, 27, 0.32);
  border-radius: 999px;
  background:
    linear-gradient(90deg, rgba(255, 244, 198, 0.95), rgba(239, 216, 148, 0.62)),
    radial-gradient(circle at 10% 50%, rgba(41, 91, 67, 0.18), transparent 34%);
  color: rgba(68, 54, 29, 0.92);
  font-size: clamp(1.04rem, 1.14vw, 1.26rem);
  font-weight: 800;
  line-height: 1.2;
  box-shadow:
    0 0.42rem 0.8rem rgba(68, 48, 18, 0.1),
    inset 0 1px 0 rgba(255, 255, 255, 0.7);
}

#species-dialog .species-dialog-copy .species-virtue-line::before {
  content: "";
  width: 0.58rem;
  height: 0.58rem;
  margin-right: 0.46rem;
  border-radius: 50%;
  background:
    radial-gradient(circle at 35% 28%, rgba(255, 250, 210, 0.92), transparent 28%),
    linear-gradient(135deg, #2d654d, #183a2e);
  box-shadow:
    0 0 0 0.12rem rgba(255, 238, 176, 0.86),
    0 0 0 0.2rem rgba(101, 72, 25, 0.28);
}

#species-dialog .species-dialog-copy .species-virtue-line strong {
  margin-left: 0.32rem;
  color: #173d30;
  font-size: 1.08em;
}

#species-dialog .species-dialog-copy .species-dialog-hint {
  margin-top: 0.1rem;
  color: rgba(48, 62, 54, 0.72);
  font-size: clamp(0.98rem, 1.02vw, 1.12rem);
}

#species-dialog #close-species-dialog {
  justify-self: start;
  width: auto;
  min-width: 8.2rem;
  margin-top: 0.55rem;
  padding: 0.72rem 1.28rem;
  border: 1px solid rgba(151, 101, 32, 0.48);
  background:
    linear-gradient(180deg, rgba(255, 236, 178, 0.98), rgba(169, 103, 38, 0.94));
  color: #fff9e6;
  font-size: clamp(1rem, 1.05vw, 1.16rem);
  font-weight: 900;
  letter-spacing: 0.08em;
  box-shadow:
    0 0.48rem 0.9rem rgba(91, 54, 17, 0.2),
    inset 0 1px 0 rgba(255, 255, 255, 0.52);
}

#species-dialog #close-species-dialog:hover,
#species-dialog #close-species-dialog:focus-visible {
  transform: translateY(-1px);
  box-shadow:
    0 0.62rem 1rem rgba(91, 54, 17, 0.25),
    0 0 0 0.18rem rgba(238, 181, 76, 0.28),
    inset 0 1px 0 rgba(255, 255, 255, 0.58);
}

.leaderboard-podium {
  position: relative;
  align-items: end;
  gap: clamp(1.05rem, 1.8vw, 1.55rem);
  padding: clamp(1.8rem, 2.2vw, 2.45rem) clamp(0.7rem, 1.1vw, 1rem) clamp(2.7rem, 3.1vw, 3.35rem);
  border-radius: 1.35rem;
  background:
    linear-gradient(180deg, rgba(255, 251, 229, 0.54), rgba(224, 232, 205, 0.16)),
    radial-gradient(ellipse at 50% 100%, rgba(133, 94, 45, 0.18), transparent 64%);
}

.leaderboard-podium::before {
  content: "";
  position: absolute;
  left: 8%;
  right: 8%;
  bottom: 0.86rem;
  height: 0.35rem;
  border-radius: 999px;
  background: linear-gradient(90deg, transparent, rgba(125, 91, 43, 0.36), transparent);
  filter: blur(0.08rem);
}

.podium-card {
  overflow: visible;
  display: grid;
  align-content: start;
  isolation: isolate;
  border-color: rgba(125, 91, 43, 0.28);
  transform: translateY(0);
}

.podium-card::before {
  content: "";
  position: absolute;
  left: 7%;
  right: 7%;
  bottom: -2.15rem;
  z-index: -1;
  height: 2.35rem;
  border: 1px solid rgba(108, 76, 36, 0.2);
  border-radius: 0.72rem 0.72rem 0.26rem 0.26rem;
  background:
    linear-gradient(90deg, rgba(255, 255, 255, 0.22), transparent 22% 78%, rgba(73, 47, 24, 0.12)),
    linear-gradient(180deg, #d9c3a0, #a68155);
  box-shadow:
    0 0.8rem 1.2rem rgba(36, 28, 17, 0.18),
    inset 0 1px 0 rgba(255, 250, 225, 0.55);
}

.podium-card::after {
  content: "";
  position: absolute;
  right: 0.85rem;
  top: 0.75rem;
  width: 3.8rem;
  height: 1.85rem;
  border-radius: 50%;
  background:
    radial-gradient(circle at 18% 54%, rgba(123, 88, 38, 0.22) 0 0.12rem, transparent 0.14rem),
    radial-gradient(circle at 46% 38%, rgba(123, 88, 38, 0.18) 0 0.1rem, transparent 0.12rem),
    radial-gradient(circle at 74% 58%, rgba(123, 88, 38, 0.16) 0 0.11rem, transparent 0.13rem);
  opacity: 0.7;
  pointer-events: none;
}

.podium-rank-1 {
  transform: translateY(-0.72rem);
  box-shadow:
    0 1.25rem 2.2rem rgba(80, 56, 25, 0.18),
    0 0 0 0.12rem rgba(214, 168, 73, 0.22),
    inset 0 1px 0 rgba(255, 255, 255, 0.62);
}

.podium-rank-1::before {
  bottom: -2.95rem;
  height: 3.22rem;
  background:
    linear-gradient(90deg, rgba(255, 255, 255, 0.28), transparent 24% 76%, rgba(96, 59, 21, 0.13)),
    linear-gradient(180deg, #e9ca74, #a9782e);
}

.podium-rank-2::before {
  background:
    linear-gradient(90deg, rgba(255, 255, 255, 0.3), transparent 24% 76%, rgba(63, 64, 57, 0.12)),
    linear-gradient(180deg, #e1e0d3, #a6a69a);
}

.podium-rank-3::before {
  background:
    linear-gradient(90deg, rgba(255, 255, 255, 0.25), transparent 24% 76%, rgba(85, 45, 20, 0.14)),
    linear-gradient(180deg, #e5b996, #9d6f4d);
}

.podium-medal {
  position: absolute;
  left: 1rem;
  top: -1.2rem;
  z-index: 2;
  width: 3rem;
  border: 0.12rem solid rgba(255, 247, 219, 0.65);
}

.podium-rank-1 .podium-medal {
  background: linear-gradient(180deg, #e7bd4f, #83551e);
}

.podium-rank-2 .podium-medal {
  background: linear-gradient(180deg, #d9ded7, #777b73);
}

.podium-rank-3 .podium-medal {
  background: linear-gradient(180deg, #cf966a, #744324);
}

@media (max-width: 900px) {
  .leaderboard-podium {
    padding-bottom: 1rem;
  }

  .podium-rank-1 {
    transform: none;
  }

  .podium-card::before {
    display: none;
  }
}

/* Current iteration: expedition record meter and 1920x1080 leaderboard layout. */
body[data-screen="memory-screen"] .toolbar-metrics {
  grid-template-columns: minmax(0, 1.55fr) minmax(13rem, 0.9fr);
}

body[data-screen="memory-screen"] .record-meter.timer-chip {
  --step-progress: 0;
  min-height: 11.6rem;
  grid-template-columns: minmax(0, 0.94fr) minmax(0, 1.02fr);
  grid-template-rows: minmax(7.9rem, 1fr) 1.55rem 1rem;
  grid-template-areas:
    "dial steps"
    "bar footbar"
    "status status";
  gap: 0 0.75rem;
  padding: 0.95rem 1.25rem 0.9rem;
  overflow: hidden;
  border: 2px solid rgba(215, 188, 131, 0.46);
  border-radius: 1.35rem;
  background:
    linear-gradient(180deg, rgba(83, 69, 48, 0.18), rgba(45, 37, 28, 0.12)),
    url("../image/generated/record-panel-background.png");
  background-size: cover;
  background-position: center;
  box-shadow:
    inset 0 0 0 1px rgba(88, 70, 43, 0.26),
    inset 0 0.65rem 1.1rem rgba(255, 248, 221, 0.24),
    inset 0 -0.9rem 1.4rem rgba(71, 50, 29, 0.14),
    0 0.85rem 1.2rem rgba(22, 17, 11, 0.16);
}

body[data-screen="memory-screen"] .record-meter.timer-chip::before,
body[data-screen="memory-screen"] .record-meter.timer-chip::after {
  display: block;
  pointer-events: none;
}

body[data-screen="memory-screen"] .record-meter.timer-chip::before {
  content: "";
  position: absolute;
  inset: 0.35rem;
  border: 1px solid rgba(111, 87, 52, 0.22);
  border-radius: 1.05rem;
  background: linear-gradient(90deg, rgba(255, 250, 223, 0.1), transparent 36% 64%, rgba(255, 250, 223, 0.1));
}

body[data-screen="memory-screen"] .record-meter.timer-chip::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 16%;
  bottom: 20%;
  width: 1px;
  background: linear-gradient(180deg, transparent, rgba(103, 80, 49, 0.18), transparent);
}

body[data-screen="memory-screen"] .record-meter .pocket-timer {
  width: min(8.2rem, 88%);
  align-self: end;
  justify-self: center;
}

body[data-screen="memory-screen"] .record-meter .timer-readout {
  top: 57%;
  width: 66%;
  gap: 0.06rem;
  font-size: clamp(0.85rem, 4vw, 1.55rem);
  letter-spacing: -0.035em;
  white-space: nowrap;
}

body[data-screen="memory-screen"] .record-meter .timer-readout small {
  font-size: 0.3em;
  transform: translateY(0.04em);
}

body[data-screen="memory-screen"] .record-meter > span {
  left: 24.5%;
  top: 1.05rem;
  z-index: 5;
  padding: 0.42rem 0.9rem;
  border-radius: 999px;
  border: 1px solid rgba(139, 109, 64, 0.18);
  background:
    radial-gradient(circle at 78% 18%, rgba(255, 255, 244, 0.88), transparent 28%),
    linear-gradient(180deg, rgba(255, 250, 222, 0.96), rgba(220, 202, 157, 0.9));
  color: rgba(87, 58, 31, 0.88);
  box-shadow:
    0 0.35rem 0.65rem rgba(67, 45, 22, 0.16),
    inset 0 1px 0 rgba(255, 255, 255, 0.65);
  font-size: clamp(0.9rem, 1vw, 1.1rem);
  letter-spacing: 0.1em;
}

body[data-screen="memory-screen"] .record-meter .metric-bar {
  grid-area: bar;
  position: relative;
  left: auto;
  bottom: auto;
  z-index: 4;
  width: min(8.2rem, 88%);
  align-self: center;
  justify-self: center;
  transform: none;
  height: 0.38rem;
  border-radius: 999px;
  background: rgba(76, 62, 40, 0.22);
}

body[data-screen="memory-screen"] .record-meter .metric-bar i {
  border-radius: inherit;
  background: linear-gradient(90deg, #a6c878, #f0cf68, #c87845);
}

body[data-screen="memory-screen"] .record-meter .timer-status {
  grid-area: status;
  position: relative;
  left: auto;
  bottom: auto;
  z-index: 4;
  width: auto;
  margin-top: 0.1rem;
  align-self: center;
  justify-self: center;
  transform: none;
  color: rgba(71, 49, 29, 0.64);
}

body[data-screen="memory-screen"] .record-meter .step-counter {
  width: min(10.6rem, 96%);
  aspect-ratio: 1.18;
  align-self: end;
  justify-self: center;
}

body[data-screen="memory-screen"] .record-meter .step-counter > span {
  top: 1.08rem;
  padding: 0.38rem 0.95rem;
  border-radius: 999px;
  border: 1px solid rgba(139, 109, 64, 0.18);
  background:
    radial-gradient(circle at 78% 18%, rgba(255, 255, 244, 0.88), transparent 28%),
    linear-gradient(180deg, rgba(255, 250, 222, 0.96), rgba(220, 202, 157, 0.9));
  color: rgba(87, 58, 31, 0.88);
  box-shadow:
    0 0.35rem 0.65rem rgba(67, 45, 22, 0.16),
    inset 0 1px 0 rgba(255, 255, 255, 0.65);
  font-size: clamp(0.88rem, 0.96vw, 1.08rem);
  letter-spacing: 0.12em;
}

body[data-screen="memory-screen"] .record-meter .step-counter > strong {
  top: 54.5%;
  min-width: 5.2rem;
  color: #5d3d23;
  font-size: clamp(0.83rem, 2.05vw, 1.35rem);
}

body[data-screen="memory-screen"] .footstep-progress {
  grid-area: footbar;
  position: relative;
  z-index: 4;
  width: min(9.8rem, 94%);
  aspect-ratio: 7.8;
  align-self: center;
  justify-self: center;
  filter:
    drop-shadow(0 0.25rem 0.28rem rgba(24, 18, 11, 0.22))
    drop-shadow(0 0 0.45rem rgba(232, 200, 108, 0.14));
}

body[data-screen="memory-screen"] .footstep-progress img {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

body[data-screen="memory-screen"] .footstep-progress i {
  position: absolute;
  left: 11%;
  right: 11%;
  top: 44%;
  height: 15%;
  border-radius: 999px;
  background:
    linear-gradient(90deg, rgba(255, 236, 151, 0.94), rgba(237, 184, 83, 0.84) calc(var(--step-progress, 0) * 100%), transparent 0);
  box-shadow:
    0 0 0.45rem rgba(243, 207, 102, 0.42),
    0 0 0.75rem rgba(181, 218, 132, calc(var(--step-progress, 0) * 0.35));
  transform-origin: left center;
  pointer-events: none;
}

body[data-screen="title-screen"] .leaderboard-card {
  width: min(88rem, calc(100vw - 3rem));
  min-height: min(52rem, calc(100vh - 7rem));
  padding: clamp(1.15rem, 1.7vw, 1.7rem);
  display: grid;
  grid-template-rows: auto auto 1fr auto;
  gap: clamp(0.8rem, 1.2vw, 1.2rem);
  background:
    linear-gradient(90deg, rgba(255, 252, 240, 0.82), rgba(255, 252, 240, 0.36) 44%, rgba(230, 238, 219, 0.42)),
    url("../image/generated/home-forest-mural.png");
  background-size: cover;
  background-position: center;
}

body[data-screen="title-screen"] .leaderboard-card > .eyebrow,
body[data-screen="title-screen"] .leaderboard-card > h2 {
  text-align: center;
}

body[data-screen="title-screen"] .leaderboard-card > h2 {
  margin: 0;
  font-size: clamp(2.45rem, 4.2vw, 4.5rem);
  text-shadow:
    0 1px 0 rgba(255, 255, 242, 0.74),
    0 0.65rem 1.3rem rgba(45, 52, 38, 0.16);
}

body[data-screen="title-screen"] .leaderboard-card .title-summary {
  max-width: none;
  min-height: 5.25rem;
  display: grid;
  place-items: center;
  padding: clamp(1rem, 1.5vw, 1.35rem);
  border: 2px solid rgba(67, 54, 34, 0.18);
  border-radius: 1.1rem;
  background:
    linear-gradient(180deg, rgba(255, 247, 222, 0.84), rgba(214, 226, 198, 0.68));
  color: rgba(39, 56, 47, 0.86);
  text-align: center;
  font-size: clamp(1.08rem, 1.55vw, 1.55rem);
  font-weight: 800;
}

body[data-screen="title-screen"] .result-spotlight {
  margin: 0;
}

body[data-screen="title-screen"] .leaderboard-list {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: clamp(1.25rem, 2vw, 2rem);
  min-height: 0;
  align-items: stretch;
}

body[data-screen="title-screen"] .leaderboard-panel {
  min-height: 0;
  margin: 0;
  padding: clamp(0.8rem, 1.1vw, 1rem);
  background: rgba(255, 251, 232, 0.18);
  backdrop-filter: blur(2px);
}

body[data-screen="title-screen"] .leaderboard-panel-head {
  display: none;
}

body[data-screen="title-screen"] .leaderboard-podium,
body[data-screen="title-screen"] .leaderboard-runners {
  position: relative;
  min-height: clamp(20rem, 31vw, 28rem);
  padding: 0;
  border-radius: 1.2rem;
  background: rgba(255, 251, 232, 0.18);
  overflow: visible;
}

body[data-screen="title-screen"] .leaderboard-podium-art,
body[data-screen="title-screen"] .leaderboard-runners-art {
  position: absolute;
  inset: auto 0 0;
  z-index: 1;
  width: 100%;
  height: auto;
  object-fit: contain;
  pointer-events: none;
  filter:
    drop-shadow(0 1rem 1.1rem rgba(37, 28, 16, 0.22))
    drop-shadow(0 0 0.55rem rgba(255, 244, 180, 0.12));
}

body[data-screen="title-screen"] .leaderboard-podium-art {
  bottom: -0.25rem;
}

body[data-screen="title-screen"] .leaderboard-runners-art {
  top: 0.7rem;
  bottom: auto;
}

body[data-screen="title-screen"] .podium-card {
  position: absolute;
  z-index: 3;
  min-height: 0;
  width: min(12rem, 30%);
  padding: 0.58rem 0.65rem;
  border: 1px solid rgba(245, 226, 170, 0.48);
  border-radius: 0.9rem;
  background:
    radial-gradient(circle at 50% 0%, rgba(255, 242, 184, 0.44), transparent 42%),
    rgba(255, 249, 226, 0.78);
  backdrop-filter: blur(4px);
  text-align: center;
  box-shadow:
    0 0.65rem 1rem rgba(42, 31, 18, 0.18),
    inset 0 1px 0 rgba(255, 255, 245, 0.58);
}

body[data-screen="title-screen"] .podium-card::before,
body[data-screen="title-screen"] .podium-card::after {
  display: none;
}

body[data-screen="title-screen"] .podium-rank-1 {
  left: 50%;
  bottom: 47%;
  transform: translateX(-50%);
}

body[data-screen="title-screen"] .podium-rank-2 {
  left: 8%;
  bottom: 31%;
}

body[data-screen="title-screen"] .podium-rank-3 {
  right: 8%;
  bottom: 24%;
}

body[data-screen="title-screen"] .podium-card.is-empty {
  left: 50%;
  bottom: 44%;
  width: min(16rem, 54%);
  transform: translateX(-50%);
  color: rgba(70, 54, 34, 0.78);
  font-weight: 900;
}

body[data-screen="title-screen"] .podium-medal {
  position: static;
  width: 2.2rem;
  margin: -1.45rem auto 0.28rem;
  font-size: 1.12rem;
}

body[data-screen="title-screen"] .podium-card strong {
  margin: 0.1rem 0 0;
  font-size: clamp(1rem, 1.3vw, 1.24rem);
}

body[data-screen="title-screen"] .podium-card dl {
  grid-template-columns: 1fr;
  gap: 0.26rem;
  margin: 0.45rem 0 0;
}

body[data-screen="title-screen"] .podium-card dl div {
  padding: 0.26rem 0.38rem;
}

body[data-screen="title-screen"] .leaderboard-runners {
  display: grid;
  align-content: center;
  gap: 0.4rem;
  padding: clamp(4.25rem, 6.2vw, 5.8rem) clamp(2rem, 3.2vw, 3.2rem) clamp(2rem, 3vw, 3rem);
}

body[data-screen="title-screen"] .leaderboard-runners .leaderboard-row,
body[data-screen="title-screen"] .leaderboard-runners .leaderboard-empty {
  position: relative;
  z-index: 3;
  grid-template-columns: 2.4rem minmax(0, 1fr) 4.6rem 4.6rem;
  gap: 0.45rem;
  padding: 0.36rem 0.48rem;
  border: 0;
  border-radius: 0.65rem;
  background: rgba(255, 250, 225, 0.58);
  box-shadow: inset 0 1px 0 rgba(255, 255, 245, 0.4);
}

body[data-screen="title-screen"] .leaderboard-runners .leaderboard-rank {
  width: 1.85rem;
  background: linear-gradient(180deg, #a7834d, #614323);
}

body[data-screen="title-screen"] .hero-actions {
  justify-content: center;
  margin-top: 0;
}

@media (max-width: 1100px) {
  body[data-screen="memory-screen"] .toolbar-metrics {
    grid-template-columns: 1fr;
  }

  body[data-screen="title-screen"] .leaderboard-list {
    grid-template-columns: 1fr;
  }
}

/* Current refinement: centered record instruments and open-stage result page. */
body[data-screen="memory-screen"] .toolbar-metrics {
  grid-template-columns: minmax(0, 1.95fr) minmax(13.5rem, 0.9fr);
  align-items: stretch;
}

body[data-screen="memory-screen"] .record-meter.timer-chip {
  min-height: clamp(13.2rem, 17.4vw, 16.25rem);
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  grid-template-rows: minmax(9.4rem, 1fr) 1.75rem 1.05rem;
  gap: 0.2rem clamp(1rem, 1.65vw, 1.9rem);
  padding: clamp(1rem, 1.35vw, 1.35rem) clamp(1.3rem, 2vw, 2rem) 0.95rem;
}

body[data-screen="memory-screen"] .record-meter .pocket-timer {
  width: min(11rem, 90%);
  align-self: center;
  justify-self: center;
  transform-origin: 50% 58%;
}

body[data-screen="memory-screen"] .record-meter .timer-readout {
  top: 57.8%;
  width: 72%;
  gap: 0.12rem;
  font-size: clamp(4.25rem, 5.55vw, 6.25rem);
  letter-spacing: -0.055em;
  line-height: 0.92;
}

body[data-screen="memory-screen"] .record-meter .timer-readout span {
  display: inline-block;
  min-width: 1.95ch;
  color: inherit;
  font-family: inherit;
  font-size: 1em;
  font-weight: inherit;
  letter-spacing: inherit;
  line-height: inherit;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

body[data-screen="memory-screen"] .record-meter .timer-readout small {
  font-size: 0.42em;
  letter-spacing: 0.02em;
}

body[data-screen="memory-screen"] .record-meter.just-ticked .timer-readout span {
  animation: recordNumberFlip 360ms cubic-bezier(0.16, 0.84, 0.28, 1.18);
}

body[data-screen="memory-screen"] .record-meter > span {
  left: 25%;
  top: clamp(0.78rem, 1.05vw, 1.18rem);
  min-width: 7.6rem;
  text-align: center;
  font-size: clamp(1.22rem, 1.7vw, 1.72rem);
  letter-spacing: 0.08em;
}

body[data-screen="memory-screen"] .record-meter .metric-bar {
  width: min(10.4rem, 78%);
  height: 0.48rem;
}

body[data-screen="memory-screen"] .record-meter .timer-status {
  font-size: clamp(0.72rem, 0.86vw, 0.92rem);
}

body[data-screen="memory-screen"] .record-meter .step-counter {
  width: min(13.8rem, 96%);
  aspect-ratio: 1.35;
  align-self: center;
  justify-self: center;
}

body[data-screen="memory-screen"] .record-meter .step-counter > span {
  top: clamp(0.72rem, 1.05vw, 1.2rem);
  min-width: 6.8rem;
  padding: 0.42rem 1rem;
  text-align: center;
  font-size: clamp(1.18rem, 1.52vw, 1.58rem);
  letter-spacing: 0.08em;
}

body[data-screen="memory-screen"] .record-meter .step-counter > strong {
  left: 50.5%;
  top: 50.4%;
  width: 7.1rem;
  min-width: 7.1rem;
  height: 2.7rem;
  font-size: clamp(2.45rem, 3.2vw, 3.55rem);
  letter-spacing: -0.035em;
  text-align: center;
  font-variant-numeric: tabular-nums;
}

body[data-screen="memory-screen"] .record-meter .step-counter > strong span {
  display: inline-block;
  min-width: 1.75ch;
  color: inherit;
  font-family: inherit;
  font-size: 1em;
  font-weight: inherit;
  letter-spacing: inherit;
  line-height: inherit;
  text-align: right;
}

body[data-screen="memory-screen"] .record-meter .step-counter small {
  font-size: 0.44em;
}

body[data-screen="memory-screen"] .record-meter .step-counter.just-stepped > strong span {
  animation: odometerDigitRoll 520ms cubic-bezier(0.17, 0.82, 0.28, 1.18);
}

body[data-screen="memory-screen"] .footstep-progress {
  width: min(12.2rem, 94%);
}

body[data-screen="memory-screen"] .footstep-progress i {
  left: 11.5%;
  right: auto;
  width: calc(77% * var(--step-progress, 0));
  transition: width 420ms cubic-bezier(0.22, 0.84, 0.28, 1), box-shadow 420ms ease;
}

body[data-screen="title-screen"] .screen-stack::before {
  border-radius: 1.2rem;
  background-image:
    linear-gradient(90deg, rgba(255, 252, 238, 0.22), rgba(255, 252, 238, 0.04) 18%, rgba(31, 43, 34, 0.05)),
    linear-gradient(180deg, rgba(255, 248, 216, 0.3), rgba(24, 37, 31, 0.1)),
    url("../image/generated/home-forest-mural.png");
  opacity: 0.96;
}

body[data-screen="title-screen"] #title-screen {
  align-items: stretch;
  justify-items: center;
}

body[data-screen="title-screen"] .leaderboard-card {
  width: min(100%, 96rem);
  max-width: none;
  min-height: 100%;
  height: 100%;
  padding: clamp(0.7rem, 1vw, 1rem) clamp(1.25rem, 2.1vw, 2.4rem) clamp(0.75rem, 1.15vw, 1.25rem);
  display: grid;
  grid-template-rows: auto auto 1fr auto;
  gap: clamp(0.45rem, 0.9vw, 0.85rem);
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  backdrop-filter: none;
}

body[data-screen="title-screen"] .leaderboard-card > .eyebrow {
  display: none;
}

body[data-screen="title-screen"] .leaderboard-card > h2 {
  position: relative;
  z-index: 2;
  align-self: start;
  margin: 0;
  color: #31361d;
  font-size: clamp(2.65rem, 3.6vw, 4.6rem);
  line-height: 1;
}

body[data-screen="title-screen"] .leaderboard-card .title-summary {
  position: relative;
  z-index: 2;
  width: min(64rem, 72vw);
  min-height: 4.4rem;
  margin: 0 auto;
  padding: 0.85rem clamp(1.4rem, 2.2vw, 2.4rem);
  border: 2px solid rgba(116, 88, 45, 0.34);
  border-radius: 999px;
  background:
    radial-gradient(circle at 50% 0%, rgba(255, 246, 187, 0.58), transparent 42%),
    linear-gradient(180deg, rgba(253, 239, 198, 0.92), rgba(220, 191, 124, 0.86));
  box-shadow:
    0 0.7rem 1.2rem rgba(33, 27, 15, 0.18),
    inset 0 1px 0 rgba(255, 255, 242, 0.68);
  color: #3c3f20;
  font-size: clamp(1.08rem, 1.45vw, 1.48rem);
}

body[data-screen="title-screen"] .result-spotlight {
  position: relative;
  z-index: 3;
  width: min(59rem, 70vw);
  margin: 0.15rem auto 0;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: clamp(0.85rem, 1.2vw, 1.25rem);
}

body[data-screen="title-screen"] .result-stat {
  --rank-progress: 0.5;
  min-height: clamp(5.8rem, 7.2vw, 7.6rem);
  display: grid;
  grid-template-columns: 3.4rem minmax(0, 1fr);
  grid-template-rows: auto 1fr auto;
  grid-template-areas:
    "icon label"
    "icon value"
    "icon note";
  align-items: center;
  padding: clamp(0.75rem, 1vw, 0.95rem) clamp(0.9rem, 1.3vw, 1.2rem);
  border: 2px solid rgba(111, 82, 39, 0.38);
  border-radius: 1rem;
  background:
    linear-gradient(180deg, rgba(255, 246, 212, 0.92), rgba(221, 198, 141, 0.82)),
    repeating-linear-gradient(90deg, rgba(111, 82, 39, 0.08) 0 1px, transparent 1px 0.7rem);
  box-shadow:
    0 0.65rem 1.2rem rgba(28, 22, 12, 0.16),
    inset 0 0 0 1px rgba(255, 255, 242, 0.48);
}

body[data-screen="title-screen"] .result-stat > i {
  grid-area: icon;
  position: relative;
  width: 2.9rem;
  aspect-ratio: 1;
  border-radius: 50%;
  background:
    radial-gradient(circle at 50% 50%, rgba(255, 247, 211, 0.92) 0 36%, transparent 37%),
    conic-gradient(from -90deg, #6c7b3f 0 25%, rgba(120, 88, 42, 0.25) 0 100%);
  box-shadow:
    inset 0 0 0 0.18rem rgba(92, 64, 31, 0.34),
    0 0.25rem 0.5rem rgba(47, 34, 18, 0.22);
}

body[data-screen="title-screen"] .result-stat-time > i::before,
body[data-screen="title-screen"] .result-stat-time > i::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: 0.15rem;
  border-radius: 999px;
  background: #4f3b22;
  transform-origin: 50% 100%;
}

body[data-screen="title-screen"] .result-stat-time > i::before {
  height: 0.86rem;
  transform: translate(-50%, -100%) rotate(-42deg);
}

body[data-screen="title-screen"] .result-stat-time > i::after {
  height: 1.08rem;
  transform: translate(-50%, -100%) rotate(34deg);
}

body[data-screen="title-screen"] .result-stat-steps > i {
  border-radius: 47% 53% 55% 45% / 58% 58% 42% 42%;
  background:
    radial-gradient(circle at 50% 28%, rgba(115, 130, 67, 0.96) 0 22%, transparent 23%),
    radial-gradient(circle at 26% 11%, rgba(115, 130, 67, 0.86) 0 10%, transparent 11%),
    radial-gradient(circle at 42% 6%, rgba(115, 130, 67, 0.86) 0 10%, transparent 11%),
    radial-gradient(circle at 58% 8%, rgba(115, 130, 67, 0.86) 0 10%, transparent 11%),
    radial-gradient(circle at 74% 15%, rgba(115, 130, 67, 0.86) 0 10%, transparent 11%);
  box-shadow: none;
}

body[data-screen="title-screen"] .result-stat-rank > i {
  border-radius: 0.6rem;
  background:
    linear-gradient(90deg, transparent 0 18%, #7b6335 18% 34%, transparent 34% 40%, #9b7b42 40% 58%, transparent 58% 64%, #c09a52 64% 82%, transparent 82%),
    linear-gradient(180deg, rgba(255, 248, 213, 0.88), rgba(218, 193, 132, 0.74));
}

body[data-screen="title-screen"] .result-stat-rank::after {
  content: "";
  position: absolute;
  inset: auto 1rem 0.55rem 1rem;
  height: 0.28rem;
  border-radius: 999px;
  background:
    linear-gradient(90deg, #6e7f42 calc(var(--rank-progress, 0) * 100%), rgba(92, 73, 41, 0.24) 0);
}

body[data-screen="title-screen"] .result-stat span {
  grid-area: label;
  color: rgba(62, 55, 28, 0.78);
  font-size: clamp(0.78rem, 0.9vw, 0.94rem);
  letter-spacing: 0.12em;
}

body[data-screen="title-screen"] .result-stat strong {
  grid-area: value;
  margin: 0;
  color: #35391d;
  font-family: "Consolas", "Courier New", monospace;
  font-size: clamp(2.05rem, 3.15vw, 3.35rem);
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.08em;
}

body[data-screen="title-screen"] .result-stat small {
  grid-area: note;
  color: rgba(62, 55, 28, 0.76);
  font-weight: 900;
  letter-spacing: 0.08em;
}

body[data-screen="title-screen"] .leaderboard-panel {
  position: relative;
  z-index: 2;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  backdrop-filter: none;
}

body[data-screen="title-screen"] .leaderboard-list {
  height: 100%;
  display: grid;
  grid-template-columns: minmax(0, 1.58fr) minmax(24rem, 0.84fr);
  gap: clamp(1.3rem, 2vw, 2.2rem);
  align-items: stretch;
}

body[data-screen="title-screen"] .leaderboard-podium,
body[data-screen="title-screen"] .leaderboard-runners {
  min-height: 0;
  height: 100%;
  border-radius: 0;
  background: transparent;
}

body[data-screen="title-screen"] .leaderboard-podium {
  min-height: clamp(27rem, 40vw, 36rem);
}

body[data-screen="title-screen"] .leaderboard-podium-art {
  left: 0;
  right: auto;
  bottom: -0.9rem;
  width: min(100%, 55rem);
  max-height: 92%;
  object-fit: contain;
  object-position: left bottom;
}

body[data-screen="title-screen"] .podium-card {
  width: clamp(8.8rem, 10.4vw, 11.2rem);
  height: clamp(6rem, 6.8vw, 7.3rem);
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  align-items: center;
  padding: 0.45rem 0.62rem 0.55rem;
  border: 2px solid rgba(118, 86, 39, 0.38);
  border-radius: 0.8rem;
  background:
    radial-gradient(circle at 50% 0%, rgba(255, 246, 189, 0.46), transparent 45%),
    linear-gradient(180deg, rgba(255, 245, 206, 0.94), rgba(220, 190, 121, 0.86));
}

body[data-screen="title-screen"] .podium-rank-1 {
  left: 50%;
  bottom: 55%;
  transform: translateX(-50%);
}

body[data-screen="title-screen"] .podium-rank-2 {
  left: 14%;
  bottom: 37%;
  transform: none;
}

body[data-screen="title-screen"] .podium-rank-3 {
  right: 11%;
  bottom: 30%;
  transform: none;
}

body[data-screen="title-screen"] .podium-card.is-empty {
  color: rgba(72, 58, 32, 0.62);
}

body[data-screen="title-screen"] .podium-medal {
  width: 1.95rem;
  margin: -1.05rem auto 0.05rem;
  font-size: 1rem;
}

body[data-screen="title-screen"] .podium-card strong {
  max-width: 100%;
  overflow: hidden;
  color: #39391e;
  font-size: clamp(0.98rem, 1.1vw, 1.18rem);
  line-height: 1.15;
  text-overflow: ellipsis;
  white-space: nowrap;
}

body[data-screen="title-screen"] .podium-card dl {
  width: 100%;
  grid-template-columns: 1fr 1fr;
  gap: 0.28rem;
  margin: 0.2rem 0 0;
}

body[data-screen="title-screen"] .podium-card dl div {
  padding: 0.22rem 0.18rem;
  border-radius: 0.42rem;
  background: rgba(255, 252, 232, 0.52);
}

body[data-screen="title-screen"] .podium-card dt {
  font-size: 0.58rem;
}

body[data-screen="title-screen"] .podium-card dd {
  font-family: "Consolas", "Courier New", monospace;
  font-size: clamp(0.82rem, 0.92vw, 1rem);
  font-variant-numeric: tabular-nums;
}

body[data-screen="title-screen"] .leaderboard-runners {
  align-self: end;
  min-height: clamp(26rem, 36vw, 34rem);
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-auto-flow: row;
  grid-auto-rows: minmax(clamp(1.58rem, 1.86vw, 1.95rem), auto);
  align-content: center;
  gap: clamp(0.08rem, 0.16vw, 0.18rem);
  padding: clamp(5.8rem, 6.55vw, 6.8rem) clamp(2.15rem, 2.6vw, 2.85rem) clamp(2.85rem, 3.25vw, 3.55rem);
}

body[data-screen="title-screen"] .leaderboard-runners-art {
  top: auto;
  bottom: 0;
  left: 50%;
  width: min(100%, 31rem);
  height: 100%;
  object-fit: contain;
  transform: translateX(-50%);
}

body[data-screen="title-screen"] .leaderboard-runners .leaderboard-row {
  grid-template-columns: 2.1rem minmax(4.1rem, 1fr) 4.2rem 3.1rem;
  min-height: clamp(1.58rem, 1.86vw, 1.95rem);
  gap: 0.22rem;
  padding: 0.12rem 0.24rem;
  border-radius: 0.48rem;
  background: rgba(255, 244, 204, 0.52);
  color: #3b3d21;
  font-size: clamp(0.7rem, 0.82vw, 0.86rem);
}

body[data-screen="title-screen"] .leaderboard-runners .leaderboard-row.is-empty {
  opacity: 0.58;
}

body[data-screen="title-screen"] .leaderboard-runners .leaderboard-rank {
  width: 1.58rem;
  font-size: 0.78rem;
}

body[data-screen="title-screen"] .leaderboard-runners .leaderboard-row strong {
  overflow: hidden;
  color: #3b3d21;
  text-overflow: ellipsis;
  white-space: nowrap;
}

body[data-screen="title-screen"] .leaderboard-runners .leaderboard-row span:not(.leaderboard-rank) {
  font-family: "Consolas", "Courier New", monospace;
  font-variant-numeric: tabular-nums;
  text-align: right;
}

body[data-screen="title-screen"] .hero-actions {
  position: relative;
  z-index: 4;
  justify-content: center;
  margin-top: -0.15rem;
}

@keyframes recordNumberFlip {
  0% {
    transform: translateY(-0.16rem) scale(0.96);
    opacity: 0.68;
  }

  52% {
    transform: translateY(0.08rem) scale(1.06);
    opacity: 1;
  }

  100% {
    transform: translateY(0) scale(1);
    opacity: 1;
  }
}

@keyframes odometerDigitRoll {
  0% {
    transform: translateY(-0.45rem);
    opacity: 0.35;
    filter: blur(1px);
  }

  58% {
    transform: translateY(0.08rem);
    opacity: 1;
    filter: blur(0);
  }

  100% {
    transform: translateY(0);
    opacity: 1;
    filter: blur(0);
  }
}

@media (max-width: 1100px) {
  body[data-screen="title-screen"] .result-spotlight,
  body[data-screen="title-screen"] .leaderboard-card .title-summary {
    width: min(100%, calc(100vw - 2rem));
  }

  body[data-screen="title-screen"] .leaderboard-list {
    grid-template-columns: 1fr;
  }

  body[data-screen="title-screen"] .leaderboard-runners {
    min-height: 28rem;
  }
}

/* Refinement: exhibition-ready record panel, ranking board, and first puzzle prototype. */
.brand-mark h1 {
  margin-top: 0;
}

body[data-screen="memory-screen"] .record-meter.timer-chip {
  grid-template-rows: minmax(8.8rem, 1fr) 1.25rem 0.95rem;
  grid-template-areas:
    "dial steps"
    "bar footbar"
    "status footbar";
  align-items: center;
  min-height: clamp(12.6rem, 16.2vw, 15.4rem);
}

body[data-screen="memory-screen"] .record-meter .pocket-timer,
body[data-screen="memory-screen"] .record-meter .step-counter {
  width: clamp(8.8rem, 10.6vw, 11.4rem);
  height: clamp(8.8rem, 10.6vw, 11.4rem);
  align-self: center;
  justify-self: center;
}

body[data-screen="memory-screen"] .record-meter .pocket-timer img,
body[data-screen="memory-screen"] .record-meter .step-counter img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

body[data-screen="memory-screen"] .record-meter .step-counter img {
  transform: scale(1.12);
}

body[data-screen="memory-screen"] .record-meter .timer-readout {
  top: 57%;
  font-size: clamp(4.7rem, 6.2vw, 6.9rem);
}

body[data-screen="memory-screen"] .record-meter .step-counter > strong {
  top: 51.6%;
  width: 7.8rem;
  min-width: 7.8rem;
  height: 3.15rem;
  font-size: clamp(3rem, 4.1vw, 4.45rem);
}

body[data-screen="memory-screen"] .record-meter .step-counter > span {
  top: 0.75rem;
  z-index: 5;
}

body[data-screen="memory-screen"] .record-meter .metric-bar,
body[data-screen="memory-screen"] .footstep-progress {
  width: min(11.2rem, 78%);
  align-self: start;
}

body[data-screen="memory-screen"] .footstep-progress {
  min-height: 1.1rem;
  aspect-ratio: auto;
}

body[data-screen="memory-screen"] .footstep-progress::before {
  content: "";
  position: absolute;
  left: 8%;
  right: 8%;
  top: 50%;
  height: 0.46rem;
  border-radius: 999px;
  background: rgba(78, 61, 34, 0.34);
  box-shadow: inset 0 1px 0 rgba(255, 248, 218, 0.36);
  transform: translateY(-50%);
}

body[data-screen="memory-screen"] .footstep-progress img {
  z-index: 2;
  opacity: 0.82;
  filter: saturate(1.1) contrast(1.05);
}

body[data-screen="memory-screen"] .footstep-progress i {
  z-index: 3;
  min-width: 0.45rem;
  height: 0.5rem;
  background:
    linear-gradient(90deg, rgba(255, 236, 151, 0.98), rgba(224, 150, 72, 0.9));
}

body[data-screen="title-screen"] .leaderboard-card {
  grid-template-rows: auto auto auto minmax(0, 1fr) auto;
  padding-top: clamp(0.35rem, 0.8vw, 0.85rem);
}

body[data-screen="title-screen"] .leaderboard-card > h2 {
  padding-inline: 2.2rem;
}

body[data-screen="title-screen"] .leaderboard-card > h2::before,
body[data-screen="title-screen"] .leaderboard-card > h2::after {
  content: "◦";
  display: inline-block;
  margin: 0 0.45rem;
  color: rgba(106, 123, 63, 0.8);
  font-size: 0.5em;
  transform: translateY(-0.12em);
}

body[data-screen="title-screen"] .leaderboard-card .title-summary {
  min-height: 2.8rem;
  width: min(43rem, 62vw);
  padding: 0.45rem 1.35rem;
  border-radius: 0.5rem;
  font-family: var(--font-display);
  font-size: clamp(1.05rem, 1.25vw, 1.28rem);
  letter-spacing: 0.08em;
}

body[data-screen="title-screen"] .result-spotlight {
  width: min(45rem, 56vw);
  margin-top: 0.1rem;
  gap: clamp(0.75rem, 1vw, 1rem);
}

body[data-screen="title-screen"] .result-stat {
  min-height: clamp(5.6rem, 6.3vw, 6.8rem);
  grid-template-columns: 3.25rem minmax(0, 1fr);
  padding: 0.72rem 1rem;
  border-radius: 0.72rem;
}

body[data-screen="title-screen"] .result-stat strong {
  font-size: clamp(2rem, 2.75vw, 2.95rem);
}

body[data-screen="title-screen"] .leaderboard-list {
  grid-template-columns: minmax(0, 1.45fr) minmax(22rem, 0.82fr);
  align-items: end;
}

body[data-screen="title-screen"] .leaderboard-podium {
  min-height: clamp(28rem, 38vw, 35rem);
}

body[data-screen="title-screen"] .leaderboard-podium-art {
  width: min(100%, 58rem);
  max-height: 98%;
  bottom: -0.45rem;
}

body[data-screen="title-screen"] .podium-card {
  width: clamp(11rem, 13.2vw, 14.2rem);
  height: clamp(6.4rem, 7.4vw, 8.2rem);
  grid-template-columns: 3.2rem minmax(0, 1fr);
  grid-template-rows: auto auto 1fr;
  grid-template-areas:
    "avatar medal"
    "avatar name"
    "stats stats";
  column-gap: 0.55rem;
  align-items: center;
  padding: 0.58rem 0.7rem 0.65rem;
}

body[data-screen="title-screen"] .podium-rank-1 {
  left: 50%;
  bottom: 61%;
}

body[data-screen="title-screen"] .podium-rank-2 {
  left: 12.5%;
  bottom: 40%;
}

body[data-screen="title-screen"] .podium-rank-3 {
  right: 7.5%;
  bottom: 34%;
}

body[data-screen="title-screen"] .podium-medal {
  grid-area: medal;
  justify-self: start;
  margin: -1.25rem 0 0;
}

body[data-screen="title-screen"] .podium-avatar {
  grid-area: avatar;
  width: 3.05rem;
  aspect-ratio: 1;
  border-radius: 50%;
  border: 0.18rem solid rgba(138, 102, 43, 0.68);
  background:
    radial-gradient(circle at 50% 38%, #d4c08a 0 18%, transparent 19%),
    radial-gradient(circle at 40% 68%, #8f6b39 0 13%, transparent 14%),
    radial-gradient(circle at 60% 70%, #6f823f 0 14%, transparent 15%),
    linear-gradient(145deg, rgba(114, 133, 75, 0.8), rgba(247, 229, 170, 0.92));
  box-shadow:
    inset 0 0 0 0.12rem rgba(255, 250, 220, 0.6),
    0 0.3rem 0.55rem rgba(42, 30, 14, 0.18);
}

body[data-screen="title-screen"] .podium-card strong {
  grid-area: name;
  align-self: end;
  text-align: left;
  font-size: clamp(1.18rem, 1.35vw, 1.45rem);
}

body[data-screen="title-screen"] .podium-card dl {
  grid-area: stats;
  margin-top: 0.35rem;
}

body[data-screen="title-screen"] .leaderboard-runners {
  min-height: clamp(27rem, 34vw, 32rem);
  padding: clamp(5.6rem, 6vw, 6.35rem) clamp(2.05rem, 2.45vw, 2.65rem) clamp(4.25rem, 4.8vw, 5rem);
}

body[data-screen="title-screen"] .leaderboard-runners-title {
  position: absolute;
  left: 50%;
  top: clamp(2.2rem, 3vw, 3rem);
  z-index: 4;
  margin: 0;
  color: #fff4d4;
  font-family: var(--font-display);
  font-size: clamp(1.1rem, 1.45vw, 1.55rem);
  letter-spacing: 0.08em;
  text-shadow: 0 2px 0 rgba(62, 39, 18, 0.55);
  transform: translateX(-50%);
}

body[data-screen="title-screen"] .leaderboard-runners-head {
  position: relative;
  z-index: 3;
  display: grid;
  grid-template-columns: 2.1rem minmax(4.1rem, 1fr) 4.2rem 3.1rem;
  gap: 0.22rem;
  padding: 0 0.24rem 0.15rem;
  color: rgba(65, 52, 28, 0.8);
  font-size: 0.68rem;
  font-weight: 900;
  letter-spacing: 0.08em;
}

body[data-screen="title-screen"] .leaderboard-self-rank {
  position: absolute;
  left: 50%;
  bottom: clamp(1.05rem, 1.55vw, 1.55rem);
  z-index: 4;
  width: 78%;
  margin: 0;
  padding: 0.38rem 0.7rem;
  border-radius: 999px;
  background: rgba(72, 43, 20, 0.8);
  color: #fff1c9;
  font-size: clamp(0.9rem, 1.1vw, 1.1rem);
  font-weight: 900;
  letter-spacing: 0.08em;
  text-align: center;
  transform: translateX(-50%);
}

body[data-screen="title-screen"] .leaderboard-runners .leaderboard-row {
  z-index: 3;
}

body[data-screen="title-screen"] .hero-actions {
  margin-top: -0.6rem;
}

body[data-screen="puzzle-screen"] .screen-stack::before {
  background-image:
    linear-gradient(90deg, rgba(98, 72, 42, 0.16), rgba(255, 248, 225, 0.12) 52%, rgba(120, 82, 44, 0.12)),
    repeating-linear-gradient(90deg, rgba(124, 86, 45, 0.16) 0 1px, transparent 1px 9rem),
    linear-gradient(180deg, #ead8b9, #d8bd91);
  opacity: 1;
  transform: scale(1);
}

#puzzle-screen.screen-active {
  display: block;
}

.puzzle-prototype {
  display: grid;
  grid-template-columns: minmax(18rem, 0.42fr) minmax(34rem, 1fr);
  gap: clamp(0.9rem, 1.35vw, 1.45rem);
  height: 100%;
  min-height: 0;
}

.puzzle-prototype.is-selecting {
  grid-template-columns: minmax(32rem, 0.72fr);
  justify-content: center;
}

.puzzle-prototype.is-selecting .puzzle-workshop {
  display: none;
}

.puzzle-prototype.is-playing {
  grid-template-columns: minmax(34rem, 1fr);
}

.puzzle-prototype.is-playing .puzzle-sidebar {
  display: none;
}

.puzzle-sidebar,
.puzzle-workshop {
  min-height: 0;
  border: 1px solid rgba(255, 246, 218, 0.34);
  border-radius: 1.25rem;
  background:
    linear-gradient(180deg, rgba(252, 247, 229, 0.92), rgba(222, 234, 213, 0.74)),
    rgba(247, 239, 212, 0.78);
  box-shadow: var(--shadow);
}

.puzzle-sidebar {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  gap: 0.85rem;
  padding: clamp(1rem, 1.4vw, 1.45rem);
}

.puzzle-sidebar .section-heading {
  margin: 0;
}

.puzzle-sidebar .section-heading h2 {
  font-size: clamp(1.75rem, 2.4vw, 2.45rem);
}

.puzzle-sidebar .section-heading p:last-child {
  margin-bottom: 0;
  color: rgba(47, 62, 53, 0.78);
  line-height: 1.65;
}

.puzzle-bird-list {
  display: grid;
  align-content: start;
  gap: 0.8rem;
  overflow: auto;
  padding-right: 0.2rem;
}

.puzzle-bird-card {
  display: grid;
  grid-template-columns: 4.4rem minmax(0, 1fr);
  gap: 0.3rem 0.85rem;
  align-items: center;
  min-height: 7rem;
  padding: 0.72rem;
  border: 1px solid rgba(103, 82, 48, 0.2);
  border-radius: 0.85rem;
  background:
    radial-gradient(circle at 16% 18%, rgba(255, 249, 205, 0.76), transparent 42%),
    linear-gradient(135deg, rgba(238, 227, 185, 0.88), rgba(198, 221, 195, 0.74));
  color: #2c3b31;
  text-align: left;
  cursor: pointer;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 245, 0.34);
}

.puzzle-bird-card:hover,
.puzzle-bird-card:focus-visible {
  border-color: rgba(183, 139, 61, 0.55);
  transform: translateY(-0.08rem);
}

.puzzle-bird-card img {
  grid-row: span 3;
  width: 100%;
  height: 5.4rem;
  object-fit: cover;
  border-radius: 0.45rem;
  filter: drop-shadow(0 0.35rem 0.25rem rgba(40, 30, 18, 0.18));
}

.puzzle-bird-card span,
.puzzle-bird-card small {
  color: rgba(58, 66, 52, 0.74);
  font-weight: 800;
}

.puzzle-bird-card span {
  font-size: 0.74rem;
  letter-spacing: 0.08em;
}

.puzzle-bird-card strong {
  font-family: var(--font-display);
  font-size: clamp(1.25rem, 1.7vw, 1.65rem);
}

.puzzle-bird-card small {
  line-height: 1.45;
}

.puzzle-workshop {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  gap: clamp(0.7rem, 1vw, 1rem);
  padding: clamp(0.9rem, 1.35vw, 1.35rem);
  overflow: hidden;
}

.puzzle-workshop-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.75rem 0.85rem;
  border: 1px solid rgba(98, 67, 34, 0.22);
  border-radius: 0.95rem;
  background:
    linear-gradient(180deg, rgba(255, 252, 237, 0.94), rgba(238, 224, 184, 0.78)),
    rgba(255, 248, 226, 0.64);
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 245, 0.58),
    0 0.45rem 0.9rem rgba(74, 48, 24, 0.12);
}

.puzzle-workshop-head h3 {
  margin: 0.15rem 0 0;
  color: #26362e;
  font-family: var(--font-display);
  font-size: clamp(1.85rem, 2.6vw, 2.75rem);
}

.puzzle-status-cluster {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.puzzle-progress-chip {
  min-width: 8.1rem;
  padding: 0.68rem 0.9rem;
  border: 1px solid rgba(83, 55, 25, 0.28);
  border-radius: 0.65rem;
  background:
    linear-gradient(180deg, rgba(255, 247, 216, 0.98), rgba(221, 184, 111, 0.92));
  text-align: center;
  box-shadow:
    inset 0 0.08rem 0 rgba(255, 255, 246, 0.82),
    inset 0 -0.16rem 0 rgba(128, 82, 33, 0.18),
    0 0.42rem 0.72rem rgba(77, 50, 23, 0.18);
}

.puzzle-progress-chip span {
  display: block;
  color: #5d4329;
  font-size: 0.75rem;
  font-weight: 900;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.puzzle-progress-chip strong {
  display: block;
  margin-top: 0.12rem;
  color: #223127;
  font-family: "Consolas", "Courier New", monospace;
  font-size: clamp(1.45rem, 2vw, 1.9rem);
  text-shadow: 0 0.06rem 0 rgba(255, 255, 235, 0.76);
}

.puzzle-workbench {
  position: relative;
  min-height: 0;
  overflow: hidden;
  border: 1px solid rgba(146, 104, 55, 0.32);
  border-radius: 1rem;
  background:
    linear-gradient(180deg, rgba(255, 248, 224, 0.06), rgba(98, 73, 39, 0.08)),
    url("../image/generated/puzzle-tabletop-bg.png");
  background-size: cover;
  background-position: center;
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 235, 0.28),
    inset 0 -2.5rem 6rem rgba(104, 66, 28, 0.14),
    0 0.95rem 1.6rem rgba(80, 52, 25, 0.18);
  touch-action: none;
}

.puzzle-workbench::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image: radial-gradient(circle at 18% 20%, rgba(255, 252, 235, 0.36), transparent 18%);
  opacity: 0.46;
  pointer-events: none;
}

.puzzle-target-frame {
  position: absolute;
  left: var(--target-x, 33%);
  top: var(--target-y, 12%);
  width: var(--target-width, 38%);
  height: var(--target-height, 74%);
  display: grid;
  place-items: center;
  border: 1px dashed rgba(255, 235, 162, 0.62);
  border-radius: 1rem;
  background:
    radial-gradient(circle at 50% 50%, rgba(252, 235, 168, 0.22), transparent 62%),
    rgba(12, 22, 17, 0.16);
}

.puzzle-target-frame img {
  width: 100%;
  height: 100%;
  object-fit: fill;
  opacity: 0.2;
  filter:
    sepia(0.2)
    saturate(0.6)
    brightness(1.45)
    drop-shadow(0 0 0.55rem rgba(255, 235, 170, 0.28));
}

.puzzle-cutline-overlay {
  position: absolute;
  inset: 0;
  z-index: 24;
  opacity: 0;
  pointer-events: none;
}

.puzzle-cutline-overlay path {
  fill: none;
  stroke: rgba(255, 255, 255, 0.86);
  stroke-width: 0.55;
  stroke-linecap: square;
  stroke-linejoin: miter;
  filter: drop-shadow(0 0.08rem 0 rgba(43, 34, 22, 0.52));
}

.puzzle-piece-layer {
  position: absolute;
  inset: 0;
}

.puzzle-svg-board {
  position: absolute;
  inset: 0;
  z-index: 4;
  display: none;
  width: 100%;
  height: 100%;
  touch-action: none;
  user-select: none;
}

.puzzle-svg-frame {
  filter:
    drop-shadow(0.55rem 0.8rem 0.8rem rgba(46, 29, 15, 0.34))
    drop-shadow(0 0.05rem 0 rgba(255, 241, 191, 0.18));
}

.puzzle-svg-hint-panel {
  fill: rgba(255, 251, 235, 0.08);
  stroke: rgba(255, 255, 255, 0.18);
  stroke-width: 1;
}

.puzzle-complete-image {
  opacity: 0;
  filter:
    drop-shadow(0 0 1.1rem rgba(255, 218, 99, 0.36))
    saturate(1.04);
  transition: opacity 520ms ease;
  pointer-events: none;
}

.svg-puzzle-piece {
  cursor: grab;
  filter:
    drop-shadow(0.22rem 0.32rem 0 rgba(87, 60, 33, 0.58))
    drop-shadow(0.42rem 0.58rem 0.45rem rgba(46, 29, 15, 0.38));
  transition: filter 160ms ease, opacity 180ms ease;
}

.svg-puzzle-piece.dragging {
  cursor: grabbing;
  filter:
    drop-shadow(0.32rem 0.45rem 0 rgba(87, 60, 33, 0.6))
    drop-shadow(0.7rem 0.9rem 0.65rem rgba(46, 29, 15, 0.46));
}

.svg-puzzle-piece.locked {
  cursor: default;
  filter: drop-shadow(0 0 0.08rem rgba(50, 39, 25, 0.3));
}

.svg-puzzle-border {
  fill: none;
  stroke: rgba(255, 255, 255, 0.9);
  stroke-width: 2.2;
  stroke-linejoin: miter;
  stroke-linecap: square;
  filter: drop-shadow(0 0.06rem 0 rgba(43, 34, 22, 0.45));
}

.puzzle-workbench.is-celebrating .svg-puzzle-piece {
  animation: puzzlePieceSettle 820ms cubic-bezier(0.2, 0.8, 0.2, 1) both;
}

.puzzle-workbench.is-complete .svg-puzzle-piece {
  opacity: 0;
  pointer-events: none;
}

.puzzle-workbench.is-complete .svg-puzzle-border,
.puzzle-workbench.is-complete .puzzle-svg-hint-panel {
  opacity: 0;
}

.puzzle-workbench.is-complete .puzzle-complete-image {
  opacity: 1;
}

.puzzle-workbench.is-complete::after {
  content: "";
  position: absolute;
  inset: 12% 31% 12% 13%;
  z-index: 8;
  border-radius: 0.5rem;
  background:
    radial-gradient(circle at 50% 50%, rgba(255, 230, 126, 0.34), transparent 58%),
    linear-gradient(135deg, transparent, rgba(255, 255, 229, 0.18), transparent);
  filter: blur(0.15rem);
  pointer-events: none;
  animation: puzzleGoldGlow 1.8s ease-in-out infinite alternate;
}

.puzzle-celebration,
.camera-flash {
  position: absolute;
  inset: 0;
  z-index: 40;
  pointer-events: none;
  opacity: 0;
}

.puzzle-celebration span {
  position: absolute;
  width: 0.55rem;
  height: 0.55rem;
  border-radius: 999px;
  background: #f6d36a;
  box-shadow:
    0 0 0 0.18rem rgba(255, 243, 180, 0.18),
    1.8rem 1.2rem 0 #df6a57,
    -1.4rem 1.8rem 0 #81a86b,
    1.1rem -1.2rem 0 #f5efc8,
    -2rem -0.5rem 0 #d79c3b;
}

.puzzle-celebration span:nth-child(1) { left: 18%; top: 18%; }
.puzzle-celebration span:nth-child(2) { left: 72%; top: 20%; }
.puzzle-celebration span:nth-child(3) { left: 28%; top: 72%; }
.puzzle-celebration span:nth-child(4) { left: 78%; top: 68%; }

.puzzle-workbench.is-celebrating .puzzle-celebration,
.puzzle-workbench.is-complete .puzzle-celebration {
  opacity: 1;
}

.puzzle-workbench.is-celebrating .puzzle-celebration span,
.puzzle-workbench.is-complete .puzzle-celebration span {
  animation: puzzleFirework 1.25s ease-out both;
}

.camera-flash {
  background: rgba(255, 255, 248, 0.88);
}

.puzzle-workbench.is-complete .camera-flash {
  animation: cameraFlash 620ms ease-out both;
}

.puzzle-piece-tray {
  position: absolute;
  right: 2.6%;
  top: 11%;
  width: 27%;
  height: 78%;
  border: 1px solid rgba(111, 77, 36, 0.28);
  border-radius: 0.95rem;
  background:
    linear-gradient(180deg, rgba(248, 229, 188, 0.84), rgba(190, 140, 76, 0.62)),
    rgba(214, 171, 103, 0.72);
  box-shadow:
    inset 0 0 0 1px rgba(255, 250, 226, 0.28),
    inset 0 0.9rem 1.6rem rgba(255, 248, 226, 0.2),
    0 0.75rem 1.1rem rgba(82, 52, 24, 0.2);
}

.puzzle-piece-tray span {
  position: absolute;
  left: 50%;
  top: 0.65rem;
  transform: translateX(-50%);
  color: rgba(77, 50, 25, 0.72);
  font-size: 0.72rem;
  font-weight: 900;
  letter-spacing: 0.11em;
  text-transform: uppercase;
}

.restoration-piece {
  position: absolute;
  left: var(--piece-left);
  top: var(--piece-top);
  width: var(--piece-width);
  height: var(--piece-height);
  overflow: hidden;
  padding: 0;
  border: 2px solid rgba(255, 245, 208, 0.78);
  border-radius: 0.24rem;
  background: rgba(253, 241, 197, 0.88);
  clip-path: var(--piece-clip);
  cursor: grab;
  touch-action: none;
  box-shadow:
    inset 0 0 0 1px rgba(70, 49, 24, 0.2),
    0 0.18rem 0 rgba(94, 68, 37, 0.65),
    0 0.58rem 0.85rem rgba(72, 47, 24, 0.28);
  transition: filter 160ms ease, transform 160ms ease, opacity 180ms ease;
}

.restoration-piece img {
  position: absolute;
  left: var(--art-left);
  top: var(--art-top);
  width: var(--art-width);
  height: var(--art-height);
  object-fit: fill;
  pointer-events: none;
  user-select: none;
}

.restoration-piece::after {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.18), transparent 48%),
    radial-gradient(circle at 20% 20%, rgba(255, 249, 206, 0.16), transparent 32%);
  mix-blend-mode: screen;
  pointer-events: none;
}

.restoration-piece:hover,
.restoration-piece:focus-visible,
.restoration-piece.is-dragging {
  filter: brightness(1.08) saturate(1.04);
  transform: translateY(-0.08rem) scale(1.015);
}

.restoration-piece.is-dragging {
  cursor: grabbing;
  z-index: 80 !important;
}

.restoration-piece.is-placed {
  cursor: default;
  border-color: rgba(218, 195, 112, 0.9);
  filter: brightness(1.04);
  transform: none;
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.34),
    0 0 0 1px rgba(255, 255, 255, 0.5);
}

.puzzle-mode-irregular .restoration-piece {
  border-radius: 0.5rem;
}

.puzzle-mode-tangram .restoration-piece {
  border-radius: 0.08rem;
  border-color: rgba(255, 255, 255, 0.92);
  background-color: rgba(246, 242, 225, 0.95);
  box-shadow:
    inset 0 0 0 1px rgba(62, 54, 38, 0.28),
    0 0.2rem 0 rgba(95, 73, 43, 0.6),
    0 0.55rem 0.9rem rgba(75, 47, 22, 0.25);
}

.puzzle-mode-tangram .puzzle-svg-board {
  display: block;
}

.puzzle-mode-tangram .puzzle-piece-layer,
.puzzle-mode-tangram .puzzle-target-frame {
  display: none;
}

.puzzle-mode-tangram .puzzle-target-frame {
  border-style: solid;
  border-color: rgba(110, 78, 39, 0.48);
  border-radius: 0.28rem;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.72), rgba(242, 235, 218, 0.58)),
    rgba(246, 242, 225, 0.3);
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.62),
    0 0.08rem 0 rgba(116, 84, 46, 0.7),
    0 0.85rem 1.2rem rgba(90, 58, 27, 0.18);
}

.puzzle-mode-tangram .puzzle-target-frame img {
  opacity: 0.18;
  filter: grayscale(0.15) brightness(1.16);
}

.puzzle-mode-tangram .puzzle-cutline-overlay {
  opacity: 1;
}

.puzzle-mode-tangram .restoration-piece.is-placed {
  border-color: rgba(255, 255, 255, 0.96);
  box-shadow:
    inset 0 0 0 1px rgba(58, 47, 31, 0.18),
    0 0 0 1px rgba(255, 255, 255, 0.72);
}

.puzzle-mode-tangram .restoration-piece:not(.is-placed) {
  border-color: rgba(255, 255, 255, 0.96);
  box-shadow:
    inset 0 0 0 1px rgba(65, 50, 28, 0.2),
    0 0.25rem 0 rgba(92, 64, 34, 0.62),
    0 0.7rem 1rem rgba(66, 42, 21, 0.26);
}

.puzzle-actions .puzzle-tool-button,
.puzzle-menu-actions .ghost-button {
  color: #2b1c10;
  font-weight: 900;
  text-shadow: none;
  background:
    linear-gradient(180deg, rgba(255, 248, 223, 0.98), rgba(224, 188, 117, 0.94));
  box-shadow:
    inset 0 0 0 1px rgba(95, 63, 31, 0.28),
    0 0.52rem 0.9rem rgba(63, 41, 22, 0.2);
}

.puzzle-actions .puzzle-tool-button:hover,
.puzzle-actions .puzzle-tool-button:focus-visible,
.puzzle-menu-actions .ghost-button:hover,
.puzzle-menu-actions .ghost-button:focus-visible {
  color: #1e130a;
  background:
    linear-gradient(180deg, rgba(255, 252, 235, 1), rgba(235, 201, 132, 0.98));
}

.puzzle-complete-card {
  width: min(46rem, calc(100vw - 2rem));
  overflow: hidden;
  border-color: rgba(181, 132, 48, 0.38);
  background:
    radial-gradient(circle at 50% 0%, rgba(255, 226, 122, 0.3), transparent 36%),
    linear-gradient(180deg, rgba(255, 250, 229, 0.98), rgba(233, 219, 179, 0.96));
  text-align: center;
}

.puzzle-complete-card h2 {
  margin-bottom: 0.75rem;
  color: #2d2a1b;
}

.puzzle-complete-photo {
  margin: 0 auto 1rem;
  width: min(34rem, 100%);
  aspect-ratio: 3 / 2;
  padding: 0.55rem;
  border: 1px solid rgba(109, 72, 33, 0.28);
  border-radius: 0.8rem;
  background:
    linear-gradient(180deg, rgba(255, 255, 242, 0.98), rgba(232, 211, 158, 0.78));
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 248, 0.64),
    0 1rem 1.8rem rgba(50, 35, 18, 0.22);
  animation: puzzlePhotoSnap 680ms ease both;
}

.puzzle-complete-photo img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 0.45rem;
}

.puzzle-complete-summary {
  display: grid;
  gap: 0.45rem;
  margin: 0 auto 1.1rem;
  color: #2e3326;
  font-weight: 900;
}

.puzzle-complete-summary strong {
  color: #8d5f11;
  font-size: clamp(1.35rem, 2.2vw, 2rem);
  letter-spacing: 0.04em;
  text-shadow: 0 0.08rem 0 rgba(255, 255, 235, 0.84);
}

.puzzle-complete-summary span {
  font-size: clamp(1rem, 1.35vw, 1.25rem);
}

.puzzle-complete-actions {
  justify-content: center;
}

.restoration-piece.is-hinting {
  animation: pieceHintPulse 1.35s ease both;
}

.puzzle-mode-body .puzzle-target-frame {
  border-style: solid;
  border-color: rgba(214, 177, 103, 0.58);
  border-radius: 0.7rem;
  background:
    radial-gradient(circle at 50% 50%, rgba(246, 229, 169, 0.2), transparent 58%),
    rgba(245, 234, 205, 0.12);
}

.puzzle-mode-body .puzzle-target-frame img {
  opacity: 0.24;
  object-fit: fill;
  filter:
    grayscale(0.08)
    brightness(1.18)
    drop-shadow(0 0 0.55rem rgba(255, 226, 156, 0.2));
}

.puzzle-mode-body .restoration-piece {
  border-radius: 0.5rem;
  border-color: rgba(139, 105, 51, 0.86);
  background-color: rgba(246, 238, 210, 0.9);
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.36),
    0 0.55rem 0.9rem rgba(10, 14, 11, 0.3);
}

.puzzle-workbench.is-complete .puzzle-target-frame {
  border-color: rgba(246, 220, 122, 0.9);
  box-shadow: 0 0 1.4rem rgba(236, 214, 132, 0.32);
}

.puzzle-workbench.is-complete .restoration-piece {
  animation: restorationPulse 900ms ease both;
}

.puzzle-empty-note {
  position: absolute;
  left: 50%;
  top: 50%;
  width: min(28rem, 72%);
  margin: 0;
  transform: translate(-50%, -50%);
  color: rgba(255, 245, 208, 0.9);
  font-weight: 900;
  line-height: 1.8;
  text-align: center;
  text-shadow: 0 2px 12px rgba(10, 16, 13, 0.42);
}

.puzzle-actions,
.puzzle-menu-actions {
  margin-top: 0;
}

@keyframes restorationPulse {
  0%,
  100% {
    filter: brightness(1.03);
  }

  50% {
    filter: brightness(1.18) saturate(1.16);
  }
}

@keyframes pieceHintPulse {
  0%,
  100% {
    filter: brightness(1);
    transform: translateY(0);
  }

  35%,
  70% {
    filter: brightness(1.22) saturate(1.16);
    transform: translateY(-0.18rem) scale(1.025);
  }
}

@keyframes puzzlePieceSettle {
  0% {
    transform: translate(var(--celebrate-x, 0), var(--celebrate-y, 0)) scale(1.035);
    filter: drop-shadow(0.55rem 0.75rem 0.65rem rgba(46, 29, 15, 0.42));
  }

  100% {
    transform: translate(0, 0) scale(1);
    filter: drop-shadow(0 0 0.08rem rgba(50, 39, 25, 0.22));
  }
}

@keyframes puzzleGoldGlow {
  from {
    opacity: 0.42;
    transform: scale(0.98);
  }

  to {
    opacity: 0.84;
    transform: scale(1.02);
  }
}

@keyframes puzzleFirework {
  0% {
    opacity: 0;
    transform: scale(0.25);
  }

  28% {
    opacity: 1;
  }

  100% {
    opacity: 0;
    transform: scale(2.8);
  }
}

@keyframes cameraFlash {
  0%,
  100% {
    opacity: 0;
  }

  12% {
    opacity: 1;
  }

  34% {
    opacity: 0.28;
  }
}

@keyframes puzzlePhotoSnap {
  0% {
    opacity: 0;
    transform: translateY(0.4rem) scale(0.94) rotate(-1.5deg);
  }

  68% {
    opacity: 1;
    transform: translateY(-0.08rem) scale(1.025) rotate(0.4deg);
  }

  100% {
    opacity: 1;
    transform: none;
  }
}

@media (max-width: 1100px) {
  .puzzle-prototype {
    grid-template-columns: 1fr;
    overflow: auto;
  }

  .puzzle-sidebar,
  .puzzle-workshop {
    min-height: 34rem;
  }

  .puzzle-bird-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    overflow: visible;
  }

  .puzzle-status-cluster {
    justify-content: flex-start;
  }

  .puzzle-piece-tray {
    right: 3%;
    width: 28%;
  }
}

@media (max-width: 1100px) {
  body[data-screen="memory-screen"] .record-meter.timer-chip {
    min-height: 12.2rem;
    gap: 0.05rem 0.45rem;
    padding-inline: 0.75rem;
  }

  body[data-screen="memory-screen"] .record-meter .pocket-timer,
  body[data-screen="memory-screen"] .record-meter .step-counter {
    width: clamp(7.7rem, 19vw, 9.4rem);
    height: clamp(7.7rem, 19vw, 9.4rem);
  }

  body[data-screen="memory-screen"] .record-meter .timer-readout {
    font-size: clamp(3.8rem, 9vw, 4.9rem);
  }

  body[data-screen="memory-screen"] .record-meter .step-counter > strong {
    width: 6.4rem;
    min-width: 6.4rem;
    font-size: clamp(2.65rem, 6.4vw, 3.3rem);
  }

}

/* Fine tune: keep timer and step values inside their illustrated instruments. */
body[data-screen="memory-screen"] .record-meter .timer-readout {
  top: 56.8%;
  width: 58%;
  font-size: clamp(3.55rem, 4.6vw, 5.25rem);
  letter-spacing: -0.06em;
}

body[data-screen="memory-screen"] .record-meter .timer-readout span {
  min-width: 1.78ch;
}

body[data-screen="memory-screen"] .record-meter .timer-readout small {
  margin-left: 0.02rem;
  font-size: 0.36em;
}

body[data-screen="memory-screen"] .record-meter .step-counter > strong {
  left: 50%;
  top: 51.5%;
  width: 6.1rem;
  min-width: 6.1rem;
  height: 2.5rem;
  font-size: clamp(2.15rem, 2.85vw, 3.15rem);
}

body[data-screen="memory-screen"] .record-meter .step-counter > strong span {
  min-width: 1.35ch;
}

body[data-screen="memory-screen"] .record-meter .step-counter small {
  font-size: 0.38em;
}

body[data-screen="memory-screen"] .record-meter .step-counter > span {
  top: clamp(1rem, 1.22vw, 1.32rem);
}

@media (max-width: 1100px) {
  body[data-screen="memory-screen"] .record-meter .timer-readout {
    width: 56%;
    font-size: clamp(3.05rem, 6.5vw, 3.85rem);
  }

  body[data-screen="memory-screen"] .record-meter .timer-readout small {
    font-size: 0.34em;
  }

  body[data-screen="memory-screen"] .record-meter .step-counter > strong {
    width: 5rem;
    min-width: 5rem;
    height: 2.15rem;
    font-size: clamp(1.9rem, 4.7vw, 2.7rem);
  }

  body[data-screen="memory-screen"] .record-meter .step-counter > span {
    top: 1.03rem;
  }
}

/* User-marked refinements: smaller instrument values and anchored ranking boards. */
body[data-screen="memory-screen"] .record-meter .timer-readout {
  top: 58%;
  width: 60%;
  font-size: clamp(2.0rem, 2.5vw, 2.85rem);
  letter-spacing: -0.035em;
}

body[data-screen="memory-screen"] .record-meter .timer-readout span {
  min-width: 1.65ch;
}

body[data-screen="memory-screen"] .record-meter .timer-readout small {
  margin-left: 0.03rem;
  font-size: 0.42em;
}

body[data-screen="memory-screen"] .record-meter .step-counter {
  position: absolute;
  right: clamp(1.7rem, 2.15vw, 2.4rem);
  top: 50%;
  /* width: clamp(7.5rem, 8.9vw, 9.45rem); */
  width: clamp(8.5rem, 9.9vw, 10.45rem);
  height: clamp(8.5rem, 9.9vw, 10.45rem);
  margin: 0;
  align-self: auto;
  justify-self: auto;
  transform: translateY(1.5rem);
}

body[data-screen="memory-screen"] .record-meter .step-counter img {
  transform: scale(1);
}

body[data-screen="memory-screen"] .record-meter .step-counter > strong {
  top: 40.5%;
  width: 3.45rem;
  min-width: 3.45rem;
  height: 1.42rem;
  /* font-size: clamp(1.1rem, 1.42vw, 1.58rem); */
  font-size: clamp(2.1rem, 2.42vw, 2.58rem);
}

body[data-screen="memory-screen"] .record-meter .step-counter > strong span {
  min-width: 1.05ch;
}

body[data-screen="memory-screen"] .record-meter .step-counter small {
  margin-left: 0.23rem;
  font-size: 0.5em;
}

body[data-screen="memory-screen"] .record-meter > span,
body[data-screen="memory-screen"] .record-meter .step-counter > span {
  min-width: 7.3rem;
  padding: 0.36rem 0.82rem;
  border: 1px solid rgba(139, 109, 64, 0.18);
  border-radius: 999px;
  background:
    radial-gradient(circle at 78% 18%, rgba(255, 255, 244, 0.88), transparent 28%),
    linear-gradient(180deg, rgba(255, 250, 222, 0.96), rgba(220, 202, 157, 0.9));
  color: rgba(87, 58, 31, 0.88);
  box-shadow:
    0 0.35rem 0.65rem rgba(67, 45, 22, 0.16),
    inset 0 1px 0 rgba(255, 255, 255, 0.65);
  font-size: clamp(0.9rem, 1vw, 1.1rem);
  letter-spacing: 0.1em;
  text-align: center;
}

body[data-screen="memory-screen"] .record-meter > span {
  /* top: clamp(0.78rem, 1.05vw, 1.18rem); */
  top: clamp(2.48rem, 2.75vw, 2.88rem);
  left: 8rem;
}

body[data-screen="memory-screen"] .record-meter .step-counter > span {
  /* top: clamp(0.78rem, 1.05vw, 1.18rem); */
  top: clamp(0.55rem, 0.72vw, 0.85rem);
  left: 4.75rem;
}

body[data-screen="memory-screen"] .record-meter .metric-bar,
body[data-screen="memory-screen"] .footstep-progress {
  height: 0.5rem;
}

body[data-screen="memory-screen"] .footstep-progress {
  aspect-ratio: auto;
}

body[data-screen="memory-screen"] .footstep-progress::before,
body[data-screen="memory-screen"] .footstep-progress i {
  top: 50%;
  height: 0.5rem;
  transform: translateY(-50%);
}

body[data-screen="memory-screen"] .footstep-progress img {
  display: none;
}

body[data-screen="title-screen"] .leaderboard-podium {
  min-height: clamp(29rem, 39vw, 36rem);
}

body[data-screen="title-screen"] .leaderboard-podium-art {
  bottom: -0.25rem;
  width: min(100%, 60rem);
  max-height: 100%;
}

body[data-screen="title-screen"] .podium-card {
  width: clamp(8.9rem, 10.5vw, 11rem);
  height: clamp(5.4rem, 6.2vw, 6.5rem);
  grid-template-columns: 2.35rem minmax(0, 1fr);
  column-gap: 0.42rem;
  padding: 0.42rem 0.52rem 0.48rem;
}

body[data-screen="title-screen"] .podium-rank-1 {
  left: 50%;
  bottom: 54.5%;
  transform: translateX(-50%);
}

body[data-screen="title-screen"] .podium-rank-2 {
  left: 9.8%;
  bottom: 36.5%;
}

body[data-screen="title-screen"] .podium-rank-3 {
  right: 5.4%;
  bottom: 29.5%;
}

body[data-screen="title-screen"] .podium-avatar {
  width: 2.28rem;
}

body[data-screen="title-screen"] .podium-card strong {
  font-size: clamp(0.86rem, 1vw, 1.02rem);
}

body[data-screen="title-screen"] .podium-card dl {
  gap: 0.18rem;
  margin-top: 0.18rem;
}

body[data-screen="title-screen"] .podium-card dl div {
  padding: 0.16rem 0.12rem;
}

body[data-screen="title-screen"] .podium-card dd {
  font-size: clamp(0.68rem, 0.78vw, 0.82rem);
}

body[data-screen="title-screen"] .leaderboard-runners {
  min-height: clamp(24rem, 31vw, 29.5rem);
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  align-content: stretch;
  padding: clamp(2.2rem, 3vw, 3rem) clamp(1.45rem, 1.9vw, 2rem) clamp(1.5rem, 2vw, 2.2rem);
  border-radius: 1.25rem;
  background:
    radial-gradient(circle at 50% 0%, rgba(255, 235, 164, 0.16), transparent 48%),
    linear-gradient(180deg, rgba(76, 47, 24, 0.38), rgba(39, 27, 17, 0.58));
  box-shadow:
    inset 0 0 0 1px rgba(255, 232, 169, 0.2),
    0 1.1rem 1.8rem rgba(20, 16, 10, 0.24);
}

body[data-screen="title-screen"] .leaderboard-runners-art {
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: fill;
  opacity: 0.95;
  transform: none;
}

body[data-screen="title-screen"] .leaderboard-runners-title {
  position: relative;
  left: auto;
  top: auto;
  z-index: 5;
  justify-self: center;
  width: min(100%, 18rem);
  padding: 0.28rem 0.7rem;
  border-radius: 0.55rem;
  background: linear-gradient(180deg, rgba(113, 68, 29, 0.94), rgba(69, 42, 22, 0.96));
  box-shadow:
    inset 0 1px 0 rgba(255, 238, 185, 0.38),
    0 0.45rem 0.75rem rgba(24, 16, 8, 0.24);
  text-align: center;
  transform: none;
}

body[data-screen="title-screen"] .leaderboard-scroll {
  position: relative;
  z-index: 5;
  min-height: 0;
  margin-top: 0.6rem;
  padding: 0.55rem 0.5rem;
  overflow-y: auto;
  border: 1px solid rgba(87, 55, 28, 0.36);
  border-radius: 0.75rem;
  background:
    linear-gradient(180deg, rgba(255, 238, 184, 0.84), rgba(222, 174, 95, 0.74)),
    repeating-linear-gradient(0deg, rgba(88, 52, 24, 0.08) 0 1px, transparent 1px 1.35rem);
  box-shadow:
    inset 0 0 0 1px rgba(255, 250, 220, 0.46),
    inset 0 0.65rem 1.1rem rgba(255, 246, 200, 0.22);
  scrollbar-width: thin;
  scrollbar-color: rgba(98, 64, 31, 0.7) rgba(255, 240, 190, 0.36);
}

body[data-screen="title-screen"] .leaderboard-scroll::-webkit-scrollbar {
  width: 0.45rem;
}

body[data-screen="title-screen"] .leaderboard-scroll::-webkit-scrollbar-thumb {
  border-radius: 999px;
  background: rgba(98, 64, 31, 0.7);
}

body[data-screen="title-screen"] .leaderboard-runners-head {
  position: sticky;
  top: 0;
  z-index: 6;
  margin-bottom: 0.22rem;
  padding: 0.18rem 0.24rem;
  border-radius: 0.38rem;
  background: rgba(255, 241, 195, 0.86);
}

body[data-screen="title-screen"] .leaderboard-runners .leaderboard-row {
  grid-template-columns: 2rem minmax(4.2rem, 1fr) 4.1rem 3rem;
  min-height: 1.82rem;
  margin-top: 0.16rem;
  background: rgba(255, 246, 211, 0.64);
  box-shadow: inset 0 -1px 0 rgba(98, 64, 31, 0.16);
}

body[data-screen="title-screen"] .leaderboard-self-rank {
  position: relative;
  left: auto;
  bottom: auto;
  z-index: 5;
  width: min(100%, 18rem);
  justify-self: center;
  margin-top: 0.65rem;
  transform: none;
}

@media (max-width: 1100px) {
  body[data-screen="memory-screen"] .record-meter .timer-readout {
    width: 48%;
    font-size: clamp(1.65rem, 3.25vw, 2.05rem);
  }

  body[data-screen="memory-screen"] .record-meter .timer-readout small {
    font-size: 0.18em;
  }

  body[data-screen="memory-screen"] .record-meter .step-counter > strong {
    width: 3.05rem;
    min-width: 3.05rem;
    height: 1.22rem;
    font-size: clamp(1rem, 2.35vw, 1.35rem);
  }
}

/* Final placement pass from browser comments: keep top-3 cards on their own stumps. */
body[data-screen="title-screen"] .podium-card,
body[data-screen="title-screen"] .podium-card.is-empty {
  /* width: clamp(8.9rem, 10.5vw, 11rem); */
  width: clamp(10.9rem, 10.5vw, 12rem);
  height: clamp(6.4rem, 6.2vw, 7.5rem);
  color: rgba(72, 58, 32, 0.8);
}

body[data-screen="title-screen"] .podium-rank-1,
body[data-screen="title-screen"] .podium-rank-1.is-empty {
  left: 50%;
  bottom: 50%;
  transform: translateX(-50%);
}

body[data-screen="title-screen"] .podium-rank-2,
body[data-screen="title-screen"] .podium-rank-2.is-empty {
  left: 13%;
  bottom: 43%;
  transform: none;
}

body[data-screen="title-screen"] .podium-rank-3,
body[data-screen="title-screen"] .podium-rank-3.is-empty {
  right: 8%;
  bottom: 34%;
  transform: none;
}

body[data-screen="title-screen"] .leaderboard-runners {
  align-content: start;
  padding-top: clamp(2.8rem, 3.55vw, 3.55rem);
  background:
    radial-gradient(circle at 50% 4%, rgba(255, 231, 150, 0.18), transparent 38%),
    linear-gradient(180deg, rgba(64, 39, 21, 0.56), rgba(33, 25, 17, 0.7));
}

body[data-screen="title-screen"] .leaderboard-scroll {
  height: clamp(12.5rem, 12vw, 13.8rem);
  max-height: clamp(12.5rem, 12vw, 13.8rem);
  margin-top: clamp(0.7rem, 0.9vw, 1rem);
  border: 0.22rem solid rgba(92, 56, 27, 0.58);
  border-radius: 0.9rem;
  background:
    linear-gradient(90deg, rgba(103, 61, 28, 0.34), transparent 9% 91%, rgba(77, 45, 22, 0.34)),
    repeating-linear-gradient(0deg, rgba(255, 247, 203, 0.9) 0 1.68rem, rgba(230, 179, 91, 0.76) 1.68rem 1.82rem);
  box-shadow:
    inset 0 0 0 1px rgba(255, 244, 195, 0.56),
    inset 0 0.5rem 0.8rem rgba(255, 246, 210, 0.24),
    0 0.55rem 1rem rgba(22, 16, 9, 0.18);
  overscroll-behavior: contain;
}

body[data-screen="title-screen"] .leaderboard-runners-head {
  background: linear-gradient(180deg, rgba(255, 238, 180, 0.96), rgba(210, 157, 76, 0.86));
  box-shadow: inset 0 -1px 0 rgba(95, 57, 26, 0.18);
}

body[data-screen="title-screen"] .leaderboard-runners .leaderboard-row {
  min-height: 1.95rem;
  margin-top: 0.2rem;
  border: 1px solid rgba(108, 67, 31, 0.16);
  background:
    linear-gradient(90deg, rgba(93, 57, 29, 0.08), transparent 12% 88%, rgba(93, 57, 29, 0.08)),
    linear-gradient(180deg, rgba(255, 248, 209, 0.88), rgba(225, 178, 94, 0.7));
}

/* Challenge Report final layout: report shelf + podium left + wooden board right. */
body[data-screen="title-screen"] .leaderboard-card {
  width: min(91rem, calc(100vw - 3rem));
  min-height: min(58rem, calc(100vh - 3rem));
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr) auto;
  align-content: center;
  gap: clamp(0.8rem, 1.2vw, 1.25rem);
  padding: clamp(0.9rem, 1.35vw, 1.35rem);
  border: 0;
  background: transparent;
  box-shadow: none;
}

body[data-screen="title-screen"] .leaderboard-card > .eyebrow {
  display: none;
}

body[data-screen="title-screen"] #title-screen-heading {
  margin: 0;
  color: rgba(43, 39, 23, 0.96);
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(2.35rem, 3vw, 3.9rem);
  letter-spacing: 0.02em;
  text-align: center;
  text-shadow: 0 2px 0 rgba(255, 247, 207, 0.56);
}

body[data-screen="title-screen"] .title-summary {
  width: min(100%, 48rem);
  margin: 0 auto;
  padding: 0.48rem 1.2rem;
  border: 1px solid rgba(117, 79, 37, 0.28);
  border-radius: 999px;
  background: linear-gradient(180deg, rgba(255, 239, 180, 0.96), rgba(215, 158, 70, 0.88));
  color: rgba(55, 42, 24, 0.94);
  font-weight: 900;
  text-align: center;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 236, 0.66),
    0 0.52rem 1rem rgba(50, 33, 16, 0.14);
}

body[data-screen="title-screen"] .result-spotlight {
  width: min(100%, 76rem);
  justify-self: center;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.55rem;
  margin: 0;
  padding: 0.62rem 0.78rem;
  border: 0.18rem solid rgba(92, 57, 29, 0.5);
  border-radius: 0.55rem;
  background:
    linear-gradient(90deg, rgba(74, 47, 26, 0.82), rgba(123, 82, 43, 0.84), rgba(73, 45, 24, 0.82)),
    repeating-linear-gradient(90deg, rgba(255, 228, 161, 0.12) 0 1px, transparent 1px 3.4rem);
  box-shadow:
    inset 0 0 0 1px rgba(255, 232, 170, 0.24),
    0 0.75rem 1.35rem rgba(24, 17, 10, 0.22);
}

body[data-screen="title-screen"] .result-stat {
  min-height: clamp(4.9rem, 5.8vw, 6rem);
  padding: 0.62rem 0.9rem;
  border: 1px solid rgba(88, 55, 29, 0.36);
  border-radius: 0.38rem;
  background:
    radial-gradient(circle at 12% 50%, rgba(255, 246, 201, 0.65), transparent 28%),
    linear-gradient(180deg, rgba(254, 240, 199, 0.94), rgba(214, 184, 124, 0.88));
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 235, 0.72),
    inset 0 -0.35rem 0.65rem rgba(112, 71, 32, 0.1);
}

body[data-screen="title-screen"] .result-stat strong {
  color: rgba(54, 48, 27, 0.98);
  font-size: clamp(1.85rem, 2.45vw, 3rem);
}

body[data-screen="title-screen"] .leaderboard-list {
  width: min(100%, 86rem);
  height: clamp(30rem, 40vw, 38rem);
  justify-self: center;
  grid-template-columns: minmax(0, 1.42fr) minmax(24rem, 0.86fr);
  gap: clamp(1rem, 1.6vw, 1.55rem);
  align-items: end;
}

body[data-screen="title-screen"] .leaderboard-podium {
  min-height: 100%;
}

body[data-screen="title-screen"] .leaderboard-runners {
  min-height: 100%;
  border-radius: 0.65rem;
  background:
    linear-gradient(180deg, rgba(75, 48, 29, 0.86), rgba(45, 31, 22, 0.9)),
    repeating-linear-gradient(0deg, rgba(255, 238, 180, 0.08) 0 1px, transparent 1px 2.2rem);
}

body[data-screen="title-screen"] .leaderboard-runners-title {
  width: min(100%, 18.5rem);
  border: 1px solid rgba(247, 218, 151, 0.26);
  background: linear-gradient(180deg, rgba(119, 78, 43, 0.96), rgba(69, 43, 26, 0.98));
}

body[data-screen="title-screen"] .leaderboard-scroll {
  height: clamp(17rem, 19vw, 22rem);
  max-height: clamp(17rem, 19vw, 22rem);
}

body[data-screen="title-screen"] .hero-actions {
  justify-content: center;
  margin-top: -0.25rem;
}

/* Podium integration: soften the transparent podium so it grows out of the forest floor. */
body[data-screen="title-screen"] .leaderboard-podium {
  isolation: isolate;
  overflow: visible;
}

body[data-screen="title-screen"] .leaderboard-podium::before {
  content: "";
  position: absolute;
  left: 4%;
  right: 1%;
  bottom: 1.6rem;
  z-index: 0;
  height: 42%;
  border-radius: 50%;
  background:
    radial-gradient(ellipse at 45% 90%, rgba(18, 28, 18, 0.42), transparent 64%),
    radial-gradient(ellipse at 52% 76%, rgba(245, 224, 151, 0.22), transparent 54%),
    linear-gradient(180deg, transparent 0 42%, rgba(40, 57, 35, 0.24));
  filter: blur(0.12rem);
  pointer-events: none;
}

body[data-screen="title-screen"] .leaderboard-podium::after {
  content: "";
  position: absolute;
  left: 0;
  right: 2%;
  bottom: -0.35rem;
  z-index: 2;
  height: 24%;
  border-radius: 0 0 48% 48%;
  background:
    radial-gradient(ellipse at 18% 74%, rgba(213, 198, 122, 0.28), transparent 26%),
    radial-gradient(ellipse at 62% 76%, rgba(232, 218, 145, 0.2), transparent 24%),
    linear-gradient(180deg, transparent 0 28%, rgba(38, 59, 38, 0.22) 58%, rgba(16, 34, 28, 0.42));
  mix-blend-mode: multiply;
  pointer-events: none;
}

body[data-screen="title-screen"] .leaderboard-podium-art {
  z-index: 1;
  filter:
    drop-shadow(0 1.3rem 1.1rem rgba(18, 24, 17, 0.3))
    drop-shadow(0 -0.18rem 0.28rem rgba(255, 238, 168, 0.12));
}

body[data-screen="title-screen"] .podium-card {
  z-index: 4;
}

/* Final user refinements: wood floor, ranking list style, and stable step counter. */
body[data-screen="memory-screen"] .step-counter.just-stepped,
body[data-screen="memory-screen"] .record-meter .step-counter.just-stepped,
body[data-screen="memory-screen"] .record-meter .step-counter.just-stepped > strong span {
  animation: none;
}

body[data-screen="memory-screen"] .record-meter.just-ticked {
  animation: none;
  transform: none;
}

body[data-screen="memory-screen"] .record-meter.just-ticked .step-counter {
  animation: none;
  transform: translateY(1.5rem);
}

body[data-screen="title-screen"] .leaderboard-podium {
  padding-bottom: clamp(2.2rem, 3vw, 3.2rem);
}

body[data-screen="title-screen"] .leaderboard-podium .podium-floor,
body[data-screen="title-screen"] .leaderboard-podium::before {
  content: "";
  position: absolute;
}

body[data-screen="title-screen"] .leaderboard-podium::before {
  left: 1%;
  right: 0;
  bottom: 0.2rem;
  z-index: 0;
  height: clamp(5.8rem, 8vw, 8.2rem);
  border: 1px solid rgba(105, 68, 34, 0.35);
  border-radius: 52% 48% 40% 44% / 42% 46% 54% 56%;
  background:
    radial-gradient(ellipse at 22% 36%, rgba(255, 221, 134, 0.22), transparent 22%),
    radial-gradient(ellipse at 68% 64%, rgba(44, 65, 33, 0.28), transparent 30%),
    repeating-linear-gradient(8deg, rgba(104, 62, 29, 0.28) 0 0.18rem, transparent 0.18rem 1.18rem),
    linear-gradient(180deg, rgba(144, 94, 47, 0.78), rgba(74, 47, 27, 0.9));
  box-shadow:
    inset 0 0.35rem 0.45rem rgba(255, 226, 161, 0.22),
    inset 0 -1.2rem 1.4rem rgba(36, 25, 16, 0.28),
    0 1.1rem 1.6rem rgba(18, 23, 15, 0.32);
}

body[data-screen="title-screen"] .leaderboard-podium::after {
  bottom: 0.15rem;
  z-index: 2;
  height: clamp(4.2rem, 5.8vw, 5.9rem);
  background:
    radial-gradient(ellipse at 10% 82%, rgba(222, 208, 130, 0.34), transparent 18%),
    radial-gradient(ellipse at 42% 78%, rgba(225, 212, 134, 0.24), transparent 22%),
    radial-gradient(ellipse at 78% 84%, rgba(238, 220, 144, 0.22), transparent 18%),
    linear-gradient(180deg, transparent 0 16%, rgba(33, 54, 34, 0.2) 54%, rgba(13, 31, 25, 0.46));
}

body[data-screen="title-screen"] .leaderboard-podium-art {
  bottom: clamp(1rem, 1.5vw, 1.55rem);
}

body[data-screen="title-screen"] .leaderboard-runners {
  padding-inline: clamp(1.65rem, 2.25vw, 2.35rem);
  background:
    radial-gradient(circle at 50% 0%, rgba(255, 226, 150, 0.18), transparent 34%),
    linear-gradient(180deg, rgba(82, 53, 32, 0.92), rgba(42, 29, 21, 0.96));
}

body[data-screen="title-screen"] .leaderboard-scroll {
  height: clamp(22rem, 23.5vw, 27rem);
  max-height: clamp(22rem, 23.5vw, 27rem);
  border: 0.18rem solid rgba(80, 48, 25, 0.68);
  border-radius: 0.42rem;
  background:
    linear-gradient(90deg, rgba(83, 48, 24, 0.18), transparent 10% 90%, rgba(83, 48, 24, 0.18)),
    linear-gradient(180deg, rgba(255, 245, 205, 0.96), rgba(229, 198, 132, 0.92));
}

body[data-screen="title-screen"] .leaderboard-runners-head,
body[data-screen="title-screen"] .leaderboard-runners .leaderboard-row {
  grid-template-columns: 2.4rem minmax(6.2rem, 1fr) 4.25rem 3.45rem 5.6rem;
}

body[data-screen="title-screen"] .leaderboard-runners-head {
  top: 0.18rem;
  margin-bottom: 0.26rem;
  border-bottom: 2px solid rgba(102, 65, 31, 0.28);
  border-radius: 0;
  background:
    linear-gradient(180deg, rgba(255, 240, 190, 0.96), rgba(218, 171, 92, 0.86));
}

body[data-screen="title-screen"] .leaderboard-runners .leaderboard-row {
  min-height: 2.12rem;
  margin-top: 0;
  border: 0;
  border-radius: 0;
  background:
    linear-gradient(90deg, rgba(101, 60, 28, 0.08), transparent 14% 86%, rgba(101, 60, 28, 0.08)),
    linear-gradient(180deg, rgba(255, 248, 213, 0.9), rgba(236, 206, 143, 0.84));
  box-shadow:
    inset 0 -1px 0 rgba(107, 67, 33, 0.28),
    inset 0 1px 0 rgba(255, 255, 235, 0.38);
}

body[data-screen="title-screen"] .leaderboard-runners .leaderboard-row:nth-child(even) {
  background:
    linear-gradient(90deg, rgba(101, 60, 28, 0.1), transparent 14% 86%, rgba(101, 60, 28, 0.1)),
    linear-gradient(180deg, rgba(246, 228, 180, 0.9), rgba(220, 186, 119, 0.84));
}

/* Target leaderboard composition: full Top 10 report board like the reference mockup. */
body[data-screen="title-screen"] .leaderboard-card {
  width: min(94rem, calc(100vw - 2.4rem));
  min-height: min(60rem, calc(100vh - 2.2rem));
  gap: clamp(0.62rem, 0.95vw, 1rem);
}

body[data-screen="title-screen"] #title-screen-heading {
  font-size: clamp(2.7rem, 3.65vw, 4.8rem);
  letter-spacing: 0.05em;
}

body[data-screen="title-screen"] .title-summary {
  position: relative;
  width: min(100%, 46rem);
  border-radius: 0.36rem;
}

body[data-screen="title-screen"] .title-summary::before,
body[data-screen="title-screen"] .title-summary::after {
  content: "";
  position: absolute;
  top: 50%;
  width: 4.2rem;
  height: 1.55rem;
  background:
    radial-gradient(circle at 28% 50%, rgba(91, 118, 54, 0.72) 0 0.22rem, transparent 0.24rem),
    linear-gradient(90deg, transparent, rgba(91, 118, 54, 0.48), transparent);
  transform: translateY(-50%);
  pointer-events: none;
}

body[data-screen="title-screen"] .title-summary::before {
  left: -3rem;
}

body[data-screen="title-screen"] .title-summary::after {
  right: -3rem;
  transform: translateY(-50%) scaleX(-1);
}

body[data-screen="title-screen"] .result-spotlight {
  width: min(100%, 63rem);
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

body[data-screen="title-screen"] .result-stat {
  min-height: clamp(5rem, 5.7vw, 6.25rem);
  border: 2px solid rgba(151, 104, 50, 0.34);
  border-radius: 0.65rem;
  background:
    radial-gradient(circle at 92% 14%, rgba(255, 255, 235, 0.48), transparent 22%),
    linear-gradient(180deg, rgba(255, 248, 218, 0.95), rgba(224, 191, 125, 0.86));
}

body[data-screen="title-screen"] .leaderboard-list {
  width: min(100%, 88rem);
  height: clamp(32rem, 41.5vw, 40rem);
  grid-template-columns: minmax(0, 1.34fr) minmax(27rem, 0.9fr);
  gap: clamp(0.8rem, 1.35vw, 1.3rem);
}

body[data-screen="title-screen"] .leaderboard-podium-art {
  bottom: clamp(0.85rem, 1.25vw, 1.35rem);
  width: min(100%, 59rem);
}

body[data-screen="title-screen"] .leaderboard-runners {
  align-self: center;
  min-height: clamp(26rem, 31vw, 33rem);
  padding: clamp(3.1rem, 3.8vw, 4rem) clamp(1.25rem, 1.8vw, 1.9rem) clamp(1.7rem, 2.3vw, 2.35rem);
  border: 2px solid rgba(122, 77, 38, 0.46);
  border-radius: 0.82rem;
  box-shadow:
    inset 0 0 0 1px rgba(255, 221, 152, 0.18),
    0 1.1rem 1.6rem rgba(20, 15, 10, 0.24);
}

body[data-screen="title-screen"] .leaderboard-runners-title {
  top: clamp(1.05rem, 1.3vw, 1.45rem);
  width: min(100%, 19.5rem);
  padding-block: 0.36rem;
  border-radius: 0.42rem;
}

body[data-screen="title-screen"] .leaderboard-scroll {
  height: clamp(20.5rem, 25vw, 27.5rem);
  max-height: clamp(20.5rem, 25vw, 27.5rem);
  margin-top: 0.15rem;
  padding: 0.55rem 0.68rem 0.68rem;
}

body[data-screen="title-screen"] .leaderboard-runners-head {
  padding-block: 0.22rem;
  font-size: clamp(0.6rem, 0.72vw, 0.78rem);
  white-space: nowrap;
}

body[data-screen="title-screen"] .leaderboard-runners .leaderboard-row {
  min-height: clamp(1.82rem, 2.05vw, 2.18rem);
  padding: 0.12rem 0.32rem;
  font-size: clamp(0.72rem, 0.88vw, 0.98rem);
}

body[data-screen="title-screen"] .leaderboard-runners .leaderboard-rank {
  width: 1.72rem;
  aspect-ratio: 1;
  border-radius: 50%;
  background: linear-gradient(180deg, rgba(137, 99, 56, 0.96), rgba(78, 52, 29, 0.96));
}

/* New ink-wash ranking report. This replaces the older podium/report page. */
body[data-screen="title-screen"] .app-shell::before {
  background-image: url("../image/generated/habitat-stage-background-v3-left-focus.png");
  background-position: center;
  opacity: 0.96;
}

body[data-screen="title-screen"] .app-shell::after {
  background:
    radial-gradient(circle at 52% 8%, rgba(255, 253, 239, 0.7), transparent 26rem),
    linear-gradient(90deg, rgba(250, 250, 238, 0.28), rgba(255, 255, 245, 0.58) 38%, rgba(239, 248, 237, 0.34)),
    linear-gradient(180deg, rgba(29, 47, 39, 0.08), rgba(22, 42, 36, 0.22));
}

body[data-screen="title-screen"] .brand-mark {
  visibility: hidden;
}

body[data-screen="title-screen"] .screen-stack {
  height: calc(100vh - 4.7rem);
  padding: 0 1.6rem 1rem;
}

body[data-screen="title-screen"] #title-screen {
  align-content: center;
}

body[data-screen="title-screen"] .ranking-page {
  position: relative;
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr) auto;
  gap: clamp(0.65rem, 1vw, 1rem);
  width: min(100%, 92rem);
  height: min(100%, 56.5rem);
  margin: 0 auto;
  padding: clamp(0.45rem, 0.7vw, 0.8rem) clamp(1rem, 1.4vw, 1.5rem) clamp(0.8rem, 1vw, 1.1rem);
  color: rgba(48, 48, 41, 0.94);
  isolation: isolate;
}

body[data-screen="title-screen"] .ranking-page::before,
body[data-screen="title-screen"] .ranking-page::after {
  content: "";
  position: absolute;
  pointer-events: none;
  z-index: -1;
}

body[data-screen="title-screen"] .ranking-page::before {
  inset: 0;
  border: 2px solid rgba(99, 99, 86, 0.38);
  border-radius: 0.28rem;
  background:
    linear-gradient(90deg, rgba(246, 247, 232, 0.16), rgba(255, 255, 245, 0.42) 50%, rgba(246, 247, 232, 0.14)),
    radial-gradient(circle at 52% 45%, rgba(255, 255, 248, 0.34), transparent 34rem);
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 245, 0.38),
    0 1.25rem 3.4rem rgba(13, 32, 27, 0.16);
}

body[data-screen="title-screen"] .ranking-page::after {
  right: 1.2rem;
  top: 0;
  width: 20rem;
  height: 16rem;
  opacity: 0.6;
  background:
    linear-gradient(100deg, transparent 20%, rgba(46, 84, 60, 0.38) 20.4% 21.1%, transparent 21.5%),
    linear-gradient(78deg, transparent 44%, rgba(46, 84, 60, 0.32) 44.3% 45%, transparent 45.3%),
    radial-gradient(ellipse at 70% 8%, rgba(70, 119, 78, 0.38), transparent 54%);
  transform: rotate(-2deg);
}

body[data-screen="title-screen"] #title-screen-heading {
  margin: 0;
  color: rgba(53, 53, 48, 0.96);
  font-family: "Noto Serif TC", "Source Han Serif TC", Georgia, serif;
  font-size: clamp(1.8rem, 2.45vw, 3rem);
  font-weight: 700;
  letter-spacing: 0.08em;
  text-align: center;
  text-shadow: 0 2px 0 rgba(255, 255, 244, 0.72);
}

body[data-screen="title-screen"] .ranking-current-card {
  position: relative;
  justify-self: center;
  display: grid;
  grid-template-columns: minmax(16rem, 1fr) repeat(3, minmax(6rem, 0.42fr));
  align-items: center;
  width: min(54rem, 100%);
  min-height: clamp(6rem, 7.2vw, 7.7rem);
  margin: 0;
  padding: clamp(0.9rem, 1.1vw, 1.1rem) clamp(1.2rem, 1.5vw, 1.7rem);
  border: 2px solid rgba(99, 99, 86, 0.38);
  border-radius: 0.22rem;
  background:
    radial-gradient(circle at 94% 22%, rgba(88, 92, 81, 0.12) 0 1rem, transparent 1.05rem),
    radial-gradient(circle at 8% 20%, rgba(66, 95, 76, 0.16) 0 0.34rem, transparent 0.36rem),
    linear-gradient(90deg, rgba(244, 244, 235, 0.88), rgba(252, 252, 245, 0.82), rgba(235, 238, 228, 0.78));
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 248, 0.72),
    0 0.6rem 1.2rem rgba(31, 49, 42, 0.12);
}

body[data-screen="title-screen"] .ranking-current-card::before,
body[data-screen="title-screen"] .ranking-current-card::after {
  content: "";
  position: absolute;
  top: 50%;
  height: 60%;
  width: 1px;
  background: rgba(121, 117, 103, 0.28);
  transform: translateY(-50%);
}

body[data-screen="title-screen"] .ranking-current-card::before {
  left: 38%;
}

body[data-screen="title-screen"] .ranking-current-card::after {
  left: 74%;
}

body[data-screen="title-screen"] .ranking-current-copy {
  text-align: center;
}

body[data-screen="title-screen"] .ranking-current-copy span {
  display: block;
  margin-bottom: 0.28rem;
  font-family: "Noto Serif TC", "Source Han Serif TC", Georgia, serif;
  font-size: clamp(1rem, 1.22vw, 1.35rem);
  font-weight: 800;
  letter-spacing: 0.08em;
}

body[data-screen="title-screen"] .ranking-current-card .title-summary {
  width: auto;
  max-width: 17rem;
  margin: 0 auto;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: rgba(72, 72, 64, 0.9);
  font-size: clamp(0.82rem, 0.95vw, 1.05rem);
  font-weight: 700;
  line-height: 1.45;
  box-shadow: none;
}

body[data-screen="title-screen"] .ranking-current-card .title-summary::before,
body[data-screen="title-screen"] .ranking-current-card .title-summary::after {
  content: none;
}

body[data-screen="title-screen"] .ranking-current-card .result-stat {
  min-height: auto;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  text-align: center;
}

body[data-screen="title-screen"] .ranking-current-card .result-stat > i,
body[data-screen="title-screen"] .ranking-current-card .result-stat small {
  display: none;
}

body[data-screen="title-screen"] .ranking-current-card .result-stat::before,
body[data-screen="title-screen"] .ranking-current-card .result-stat::after {
  content: none;
}

body[data-screen="title-screen"] .ranking-current-card .result-stat span {
  display: block;
  color: rgba(62, 62, 55, 0.92);
  font-size: clamp(1rem, 1.18vw, 1.3rem);
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: none;
}

body[data-screen="title-screen"] .ranking-current-card .result-stat strong {
  display: block;
  margin-top: 0.26rem;
  color: var(--leaderboard-dynamic-color, rgba(175, 47, 34, 0.96));
  font-family: "Noto Serif TC", "Source Han Serif TC", Georgia, serif;
  font-size: clamp(1.15rem, 1.45vw, 1.65rem);
  font-weight: 800;
  line-height: 1.1;
  white-space: nowrap;
}

body[data-screen="title-screen"] .ranking-board-layer {
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

body[data-screen="title-screen"] .ranking-board-layer > #leaderboard-heading,
body[data-screen="title-screen"] .ranking-board-layer > #ranking-note {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

body[data-screen="title-screen"] .leaderboard-list {
  display: grid;
  grid-template-columns: minmax(31rem, 0.95fr) minmax(25rem, 0.74fr);
  align-items: end;
  gap: clamp(2rem, 4.2vw, 5rem);
  width: min(100%, 82rem);
  height: 100%;
  margin: 0 auto;
}

body[data-screen="title-screen"] .ranking-podium {
  position: relative;
  display: grid;
  grid-template-columns: 0.92fr 1fr 0.92fr;
  align-items: end;
  gap: clamp(1rem, 1.8vw, 1.8rem);
  min-height: clamp(27rem, 32vw, 33rem);
  padding: 0 clamp(0.2rem, 0.7vw, 0.8rem) clamp(1.7rem, 2.4vw, 2.6rem);
}

body[data-screen="title-screen"] .ranking-podium::before {
  content: "";
  position: absolute;
  left: 2%;
  right: 0;
  bottom: 0;
  height: 6rem;
  border-radius: 50% 50% 18% 18% / 55% 55% 32% 32%;
  background:
    radial-gradient(ellipse at 48% 22%, rgba(237, 220, 160, 0.7), transparent 17rem),
    linear-gradient(180deg, rgba(117, 82, 45, 0.56), rgba(67, 45, 27, 0.68)),
    repeating-linear-gradient(12deg, rgba(255, 232, 173, 0.18) 0 0.2rem, transparent 0.2rem 0.55rem);
  filter: blur(0.2px);
  box-shadow:
    inset 0 0.75rem 1.2rem rgba(255, 237, 177, 0.2),
    0 1.1rem 2.2rem rgba(25, 38, 30, 0.26);
}

body[data-screen="title-screen"] .ranking-medal-card {
  position: relative;
  z-index: 1;
  display: grid;
  justify-items: center;
  align-content: start;
  min-height: clamp(15rem, 18vw, 19rem);
  padding: clamp(3.2rem, 4vw, 4rem) clamp(0.9rem, 1.2vw, 1.15rem) clamp(1.3rem, 1.7vw, 1.7rem);
  border: 2px solid rgba(84, 82, 73, 0.48);
  border-radius: 0.18rem;
  background:
    linear-gradient(160deg, rgba(255, 255, 248, 0.88), rgba(232, 234, 224, 0.82)),
    radial-gradient(circle at 70% 22%, rgba(255, 255, 250, 0.68), transparent 4rem);
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 250, 0.64),
    0 0.55rem 1.2rem rgba(29, 38, 30, 0.16);
}

body[data-screen="title-screen"] .ranking-medal-1 {
  min-height: clamp(19rem, 22vw, 23rem);
  transform: translateY(-1.8rem);
}

body[data-screen="title-screen"] .ranking-medal-2 {
  min-height: clamp(16.6rem, 19.5vw, 20.5rem);
  transform: translateY(1.6rem);
}

body[data-screen="title-screen"] .ranking-medal-3 {
  min-height: clamp(15.3rem, 18.2vw, 19.2rem);
  transform: translateY(3rem);
}

body[data-screen="title-screen"] .ranking-medal-ribbon {
  position: absolute;
  top: -0.2rem;
  width: 4.3rem;
  height: 4.2rem;
  background:
    linear-gradient(110deg, transparent 0 24%, rgba(44, 47, 45, 0.78) 24% 38%, transparent 38% 62%, rgba(44, 47, 45, 0.78) 62% 76%, transparent 76%),
    linear-gradient(180deg, rgba(88, 90, 83, 0.24), transparent);
}

body[data-screen="title-screen"] .ranking-medal-badge {
  position: absolute;
  top: 1.1rem;
  display: grid;
  place-items: center;
  width: 3.25rem;
  aspect-ratio: 1;
  border-radius: 50%;
  color: rgba(61, 44, 22, 0.92);
  font-family: Georgia, serif;
  font-size: 1.55rem;
  font-weight: 800;
  box-shadow:
    inset 0 0 0 2px rgba(255, 247, 210, 0.44),
    0 0.32rem 0.7rem rgba(48, 36, 20, 0.22);
}

body[data-screen="title-screen"] .ranking-medal-1 .ranking-medal-badge {
  background: linear-gradient(180deg, #f7df82, #b78322);
}

body[data-screen="title-screen"] .ranking-medal-2 .ranking-medal-badge {
  background: linear-gradient(180deg, #eef0ec, #9a9d99);
}

body[data-screen="title-screen"] .ranking-medal-3 .ranking-medal-badge {
  background: linear-gradient(180deg, #ecc29c, #a46235);
}

body[data-screen="title-screen"] .ranking-medal-card strong {
  margin-top: 0.2rem;
  color: rgba(54, 48, 38, 0.96);
  font-family: "Noto Serif TC", "Source Han Serif TC", Georgia, serif;
  font-size: clamp(1.35rem, 1.65vw, 1.85rem);
  font-weight: 900;
  letter-spacing: 0.08em;
}

body[data-screen="title-screen"] .ranking-player-name,
body[data-screen="title-screen"] .ranking-player-time,
body[data-screen="title-screen"] .ranking-player-steps {
  color: var(--leaderboard-dynamic-color, rgba(175, 47, 34, 0.96));
  font-weight: 800;
  line-height: 1.4;
  text-align: center;
}

body[data-screen="title-screen"] .ranking-player-name {
  margin-top: clamp(1.5rem, 2.5vw, 2.5rem);
  font-size: clamp(1rem, 1.24vw, 1.35rem);
}

body[data-screen="title-screen"] .ranking-player-time,
body[data-screen="title-screen"] .ranking-player-steps {
  font-size: clamp(0.95rem, 1.16vw, 1.25rem);
}

body[data-screen="title-screen"] .honor-board {
  position: relative;
  align-self: center;
  min-height: clamp(24rem, 30vw, 31rem);
  padding: clamp(2.8rem, 3.4vw, 3.55rem) clamp(1rem, 1.35vw, 1.35rem) clamp(1.2rem, 1.55vw, 1.6rem);
  border: 2px solid rgba(99, 99, 86, 0.42);
  border-radius: 0.22rem;
  background:
    linear-gradient(180deg, rgba(242, 241, 230, 0.88), rgba(228, 230, 219, 0.82)),
    radial-gradient(circle at 95% 0%, rgba(255, 255, 250, 0.76), transparent 6rem);
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 248, 0.66),
    0 0.9rem 1.6rem rgba(30, 43, 36, 0.15);
}

body[data-screen="title-screen"] .honor-board h3 {
  position: absolute;
  top: 0.72rem;
  left: 50%;
  margin: 0;
  color: rgba(66, 62, 53, 0.96);
  font-family: "Noto Serif TC", "Source Han Serif TC", Georgia, serif;
  font-size: clamp(1.15rem, 1.35vw, 1.55rem);
  letter-spacing: 0.08em;
  transform: translateX(-50%);
}

body[data-screen="title-screen"] .honor-scroll {
  display: grid;
  gap: 0.48rem;
  max-height: clamp(18.6rem, 23vw, 24rem);
  overflow-y: auto;
  padding: 0.1rem 0.12rem 0.4rem;
  scrollbar-width: thin;
  scrollbar-color: rgba(103, 92, 72, 0.72) rgba(255, 255, 244, 0.28);
}

body[data-screen="title-screen"] .honor-head,
body[data-screen="title-screen"] .honor-row {
  display: grid;
  grid-template-columns: 2.2rem 2rem minmax(5rem, 1fr) 4.5rem 4.2rem;
  align-items: center;
  gap: 0.5rem;
}

body[data-screen="title-screen"] .honor-head {
  padding: 0 0.65rem 0.18rem;
  color: rgba(68, 64, 55, 0.88);
  font-size: clamp(0.78rem, 0.88vw, 0.96rem);
  font-weight: 800;
  text-align: center;
}

body[data-screen="title-screen"] .honor-row {
  min-height: clamp(2.45rem, 2.75vw, 2.95rem);
  padding: 0.2rem 0.62rem;
  border: 2px solid rgba(99, 99, 86, 0.34);
  border-radius: 0.2rem;
  background:
    linear-gradient(90deg, rgba(255, 255, 250, 0.7), rgba(237, 238, 229, 0.76)),
    linear-gradient(180deg, transparent 48%, rgba(116, 108, 90, 0.08) 50%, transparent 52%);
  color: rgba(54, 54, 47, 0.94);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 247, 0.58);
}

body[data-screen="title-screen"] .honor-row > *:not(:last-child) {
  border-right: 1px solid rgba(106, 101, 88, 0.28);
}

body[data-screen="title-screen"] .honor-rank {
  font-family: Georgia, serif;
  font-size: clamp(1rem, 1.08vw, 1.25rem);
  text-align: center;
}

body[data-screen="title-screen"] .honor-avatar {
  width: 1.65rem;
  aspect-ratio: 1;
  border-radius: 50%;
  background:
    radial-gradient(circle at 50% 28%, rgba(244, 205, 177, 0.95) 0 24%, transparent 25%),
    radial-gradient(ellipse at 50% 78%, rgba(68, 101, 130, 0.94) 0 42%, transparent 43%),
    linear-gradient(180deg, rgba(231, 238, 238, 0.9), rgba(149, 172, 180, 0.74));
  box-shadow: inset 0 0 0 1px rgba(70, 79, 79, 0.18);
}

body[data-screen="title-screen"] .honor-row strong,
body[data-screen="title-screen"] .honor-row span:nth-last-child(-n + 2) {
  color: var(--leaderboard-dynamic-color, rgba(175, 47, 34, 0.96));
  font-size: clamp(0.95rem, 1.08vw, 1.22rem);
  font-weight: 800;
  white-space: nowrap;
}

body[data-screen="title-screen"] .honor-row.is-empty strong,
body[data-screen="title-screen"] .honor-row.is-empty span:nth-last-child(-n + 2),
body[data-screen="title-screen"] .ranking-medal-card.is-empty .ranking-player-name,
body[data-screen="title-screen"] .ranking-medal-card.is-empty .ranking-player-time,
body[data-screen="title-screen"] .ranking-medal-card.is-empty .ranking-player-steps {
  color: rgba(119, 78, 65, 0.72);
}

body[data-screen="title-screen"] .leaderboard-self-rank {
  margin: clamp(0.7rem, 1vw, 1rem) auto 0;
  padding: 0.35rem 1.2rem;
  width: min(100%, 17rem);
  border-radius: 999px;
  background: rgba(64, 50, 36, 0.82);
  color: rgba(255, 247, 221, 0.94);
  font-weight: 800;
  text-align: center;
}

body[data-screen="title-screen"] .hero-actions {
  justify-content: center;
  margin: 0;
}

@media (max-width: 980px) {
  body[data-screen="title-screen"] .screen-stack {
    height: auto;
    overflow: auto;
  }

  body[data-screen="title-screen"] .ranking-page {
    height: auto;
  }

  body[data-screen="title-screen"] .ranking-current-card,
  body[data-screen="title-screen"] .leaderboard-list {
    grid-template-columns: 1fr;
  }

  body[data-screen="title-screen"] .ranking-current-card::before,
  body[data-screen="title-screen"] .ranking-current-card::after {
    content: none;
  }
}

/* Ranking typography and optical-centering refinement. */
body[data-screen="title-screen"] .ranking-current-card .result-stat {
  align-items: center !important;
  justify-items: center !important;
  box-sizing: border-box;
}

body[data-screen="title-screen"] .ranking-current-card .result-stat strong,
body[data-screen="title-screen"] .ranking-player-name,
body[data-screen="title-screen"] .ranking-player-time,
body[data-screen="title-screen"] .ranking-player-steps,
body[data-screen="title-screen"] .honor-row strong,
body[data-screen="title-screen"] .honor-row span:nth-last-child(-n + 2) {
  font-family: "Microsoft JhengHei UI", "Microsoft JhengHei", "Noto Sans TC", sans-serif !important;
  font-optical-sizing: auto;
  -webkit-font-smoothing: antialiased;
  text-rendering: geometricPrecision;
}

body[data-screen="title-screen"] .ranking-current-card .result-stat strong {
  font-size: clamp(.94rem, 2.05cqw, 2.42rem) !important;
  font-weight: 700 !important;
  letter-spacing: .01em !important;
  line-height: 1.08 !important;
}

body[data-screen="title-screen"] .ranking-player-info {
  position: absolute;
  right: 10%;
  left: 10%;
  display: grid;
  grid-template-rows: repeat(3, minmax(0, 1fr));
  align-items: center;
  justify-items: center;
  box-sizing: border-box;
}

body[data-screen="title-screen"] .ranking-medal-1 .ranking-player-info {
  top: 44%;
  height: 27%;
}

body[data-screen="title-screen"] .ranking-medal-2 .ranking-player-info {
  top: 53.5%;
  height: 27%;
}

body[data-screen="title-screen"] .ranking-medal-3 .ranking-player-info {
  top: 58.5%;
  height: 29%;
}

body[data-screen="title-screen"] .ranking-player-info .ranking-player-name,
body[data-screen="title-screen"] .ranking-player-info .ranking-player-time,
body[data-screen="title-screen"] .ranking-player-info .ranking-player-steps {
  position: static !important;
  display: flex;
  width: 100%;
  min-width: 0;
  height: 100%;
  margin: 0 !important;
  align-items: center;
  justify-content: center;
  color: #2e271f !important;
  line-height: 1.2 !important;
  text-align: center !important;
}

body[data-screen="title-screen"] .ranking-player-info .ranking-player-name {
  font-size: clamp(.76rem, 1.48cqw, 1.76rem) !important;
  font-weight: 700 !important;
  letter-spacing: .015em;
}

body[data-screen="title-screen"] .ranking-player-info .ranking-player-time,
body[data-screen="title-screen"] .ranking-player-info .ranking-player-steps {
  font-size: clamp(.68rem, 1.25cqw, 1.48rem) !important;
  font-weight: 650 !important;
  letter-spacing: .025em !important;
}

body[data-screen="title-screen"] .ranking-current-mark {
  position: absolute;
  z-index: 2;
  top: -1.5em;
  right: -1%;
  padding: .16em .62em .18em;
  border: 1px solid rgba(139, 88, 27, .46);
  border-radius: 999px;
  background: linear-gradient(180deg, rgba(255, 247, 195, .96), rgba(225, 180, 81, .92));
  color: #6f3517;
  font-family: "Microsoft JhengHei UI", "Microsoft JhengHei", sans-serif;
  font-size: clamp(.48rem, .72cqw, .84rem);
  font-weight: 700;
  letter-spacing: .08em;
  line-height: 1.2;
  white-space: nowrap;
  box-shadow: 0 .12em .45em rgba(99, 60, 17, .25);
}

body[data-screen="title-screen"] .ranking-medal-card.is-current-player {
  filter:
    drop-shadow(0 0 .28rem rgba(255, 234, 137, .94))
    drop-shadow(0 0 .72rem rgba(222, 158, 48, .72));
}

body[data-screen="title-screen"] .ranking-medal-card.is-current-player .ranking-player-info {
  border-radius: .45rem;
  background: radial-gradient(ellipse at center, rgba(255, 239, 157, .3), transparent 72%);
  box-shadow: inset 0 0 0 1px rgba(205, 146, 44, .28);
}

body[data-screen="title-screen"] .honor-row {
  position: relative;
  align-items: center !important;
}

body[data-screen="title-screen"] .honor-row strong,
body[data-screen="title-screen"] .honor-row span:nth-last-child(-n + 2) {
  display: flex !important;
  height: 100%;
  align-items: center;
  justify-content: center;
  padding: 0 .2em !important;
  font-size: clamp(.7rem, 1.46cqw, 1.72rem) !important;
  font-weight: 650 !important;
  letter-spacing: .015em !important;
  line-height: 1.15 !important;
  text-align: center !important;
}

body[data-screen="title-screen"] .honor-row.is-current-player {
  border-radius: .42rem;
  background:
    linear-gradient(90deg, transparent, rgba(255, 225, 128, .55) 16% 84%, transparent),
    radial-gradient(ellipse at center, rgba(255, 245, 191, .64), transparent 72%);
  box-shadow:
    inset 0 0 0 1px rgba(191, 128, 31, .3),
    0 0 .7rem rgba(230, 171, 62, .35);
}

body[data-screen="title-screen"] .honor-row.is-current-player strong {
  color: #783814 !important;
  font-weight: 750 !important;
}

/* 1920 x 1080 fit pass for the new ranking page. */
body[data-screen="title-screen"] .screen-stack {
  height: calc(100vh - 4.5rem);
  padding: 0.75rem 1.6rem 1rem;
}

body[data-screen="title-screen"] #title-screen {
  align-content: start;
}

body[data-screen="title-screen"] .ranking-page {
  width: min(100%, 84rem);
  height: min(100%, 51.5rem);
  gap: clamp(0.5rem, 0.72vw, 0.76rem);
}

body[data-screen="title-screen"] #title-screen-heading {
  font-size: clamp(1.55rem, 2.05vw, 2.45rem);
  line-height: 1.15;
}

body[data-screen="title-screen"] .ranking-current-card {
  grid-template-columns: minmax(16rem, 1fr) 7rem 7rem 9.2rem;
  width: min(58rem, 100%);
  min-height: clamp(5.2rem, 6.1vw, 6.45rem);
  padding-block: clamp(0.65rem, 0.85vw, 0.86rem);
}

body[data-screen="title-screen"] .ranking-current-card::before {
  left: 38%;
}

body[data-screen="title-screen"] .ranking-current-card::after {
  left: 73%;
}

body[data-screen="title-screen"] .leaderboard-list {
  grid-template-columns: minmax(28rem, 1fr) minmax(23rem, 0.7fr);
  gap: clamp(1.1rem, 1.9vw, 2.2rem);
  width: min(100%, 76rem);
}

body[data-screen="title-screen"] .ranking-podium {
  min-height: clamp(23rem, 27.5vw, 29rem);
}

body[data-screen="title-screen"] .ranking-medal-card {
  min-height: clamp(13.5rem, 15.8vw, 16.8rem);
}

body[data-screen="title-screen"] .ranking-medal-1 {
  min-height: clamp(16.5rem, 18.5vw, 19.5rem);
  transform: translateY(-1.15rem);
}

body[data-screen="title-screen"] .ranking-medal-2 {
  min-height: clamp(14.2rem, 16.6vw, 17.4rem);
  transform: translateY(1.05rem);
}

body[data-screen="title-screen"] .ranking-medal-3 {
  min-height: clamp(13.4rem, 15.5vw, 16.4rem);
  transform: translateY(2rem);
}

body[data-screen="title-screen"] .honor-board {
  min-height: clamp(22rem, 25.5vw, 27rem);
  padding-top: clamp(2.45rem, 2.85vw, 3rem);
}

body[data-screen="title-screen"] .honor-scroll {
  max-height: clamp(17rem, 20vw, 21.4rem);
}

body[data-screen="title-screen"] .honor-head,
body[data-screen="title-screen"] .honor-row {
  grid-template-columns: 1.9rem 1.8rem minmax(4.6rem, 1fr) 3.9rem 3.8rem;
  gap: 0.38rem;
}

body[data-screen="title-screen"] .honor-row {
  min-height: clamp(2.1rem, 2.32vw, 2.48rem);
}

/* Asset-backed layouts: the painted frames stay fixed while live game data is
   overlaid at deliberately mapped positions. This prevents legacy instrument
   rules from changing the art's proportions. */
body[data-screen="memory-screen"] .record-meter.illustrated-record-meter {
  container-type: inline-size;
  position: relative;
  display: block;
  min-height: 0;
  aspect-ratio: 16 / 9;
  padding: 0;
  overflow: hidden;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  isolation: isolate;
}

body[data-screen="memory-screen"] .record-meter.illustrated-record-meter::before,
body[data-screen="memory-screen"] .record-meter.illustrated-record-meter::after {
  display: none;
  content: none;
  animation: none;
}

body[data-screen="memory-screen"] .illustrated-record-art {
  position: absolute;
  inset: 0;
  z-index: 0;
  display: block;
  width: 100%;
  height: 100%;
  object-fit: fill;
  pointer-events: none;
}

body[data-screen="memory-screen"] .illustrated-record-clock,
body[data-screen="memory-screen"] .illustrated-record-steps {
  position: absolute;
  z-index: 1;
  display: grid;
  justify-items: center;
  color: #3f291a;
  text-align: center;
  text-shadow: 0 1px 0 rgba(255, 249, 225, 0.78);
}

body[data-screen="memory-screen"] .illustrated-record-clock {
  left: 13.5%;
  top: 8.5%;
  width: 28%;
  height: 61%;
  grid-template-rows: 25% 1fr;
}

body[data-screen="memory-screen"] .illustrated-record-steps {
  left: 51.5%;
  top: 13%;
  width: 28.5%;
  height: 54%;
  grid-template-rows: 25% 1fr;
}

body[data-screen="memory-screen"] .illustrated-record-label {
  align-self: center;
  color: #f7edcb;
  font-family: "Noto Serif TC", "Source Han Serif TC", Georgia, serif;
  font-size: clamp(0.85rem, 5.2cqw, 1.42rem);
  font-weight: 800;
  letter-spacing: 0.12em;
  line-height: 1;
  white-space: nowrap;
}

body[data-screen="memory-screen"] .illustrated-record-clock strong,
body[data-screen="memory-screen"] .illustrated-record-steps strong {
  align-self: center;
  margin: 0;
  color: #3e2517;
  font-family: "Noto Serif TC", "Source Han Serif TC", Georgia, serif;
  font-variant-numeric: tabular-nums;
  font-weight: 800;
  line-height: 0.9;
  white-space: nowrap;
  animation: none;
}

body[data-screen="memory-screen"] .illustrated-record-clock strong {
  font-size: clamp(1.55rem, 11.5cqw, 3.1rem);
}

body[data-screen="memory-screen"] .illustrated-record-steps strong {
  font-size: clamp(1.38rem, 9.4cqw, 2.55rem);
}

body[data-screen="memory-screen"] .illustrated-record-clock small,
body[data-screen="memory-screen"] .illustrated-record-steps small {
  margin-left: 0.12em;
  color: #3e2517;
  font-family: inherit;
  font-size: 0.46em;
  font-weight: 800;
  vertical-align: 0.08em;
}

body[data-screen="memory-screen"] .illustrated-timer-progress,
body[data-screen="memory-screen"] .illustrated-step-progress {
  position: absolute;
  z-index: 1;
  top: 84.2%;
  height: 2.2%;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(95, 67, 38, 0.2);
  box-shadow: inset 0 1px 2px rgba(66, 45, 25, 0.24);
}

body[data-screen="memory-screen"] .illustrated-timer-progress {
  left: 15.4%;
  width: 28.6%;
}

body[data-screen="memory-screen"] .illustrated-step-progress {
  left: 51.6%;
  width: 29.4%;
}

body[data-screen="memory-screen"] .illustrated-timer-progress > i,
body[data-screen="memory-screen"] .illustrated-step-progress > i {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #a9bd73, #d9ca77 55%, #d08a52);
  transform-origin: left center;
  transition: transform 240ms linear;
}

body[data-screen="memory-screen"] .illustrated-timer-progress > i {
  transform: scaleX(var(--metric-progress, 1));
}

body[data-screen="memory-screen"] .illustrated-step-progress > i {
  transform: scaleX(var(--step-progress, 0));
}

body[data-screen="memory-screen"] .illustrated-record-meter .timer-status {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

body[data-screen="memory-screen"] .illustrated-record-meter.just-ticked,
body[data-screen="memory-screen"] .illustrated-record-meter.timer-state-danger,
body[data-screen="memory-screen"] .illustrated-record-meter .step-counter,
body[data-screen="memory-screen"] .illustrated-record-meter .footstep-progress,
body[data-screen="memory-screen"] .illustrated-record-meter .metric-bar {
  animation: none !important;
}

body[data-screen="memory-screen"] .illustrated-record-meter.just-ticked .illustrated-record-clock strong {
  animation: recordNumberTick 260ms ease-out;
}

@keyframes recordNumberTick {
  0% { filter: brightness(1); }
  50% { filter: brightness(1.45); }
  100% { filter: brightness(1); }
}

/* The leaderboard background is an authored full-screen illustration. HTML
   supplies only text and changing scores, which keeps every character crisp. */
body[data-screen="title-screen"] .screen-stack {
  position: fixed;
  inset: 4.5rem 0 0;
  display: grid;
  place-items: center;
  height: auto;
  padding: 0;
  overflow: hidden;
}

body[data-screen="title-screen"] #title-screen.screen-active {
  display: grid;
  place-items: center;
  width: 100%;
  height: 100%;
}

body[data-screen="title-screen"] .ranking-page {
  position: relative;
  display: block;
  width: min(100vw, calc((100vh - 4.5rem) * 16 / 9));
  height: min(calc(100vh - 4.5rem), calc(100vw * 9 / 16));
  min-height: 0;
  margin: 0;
  padding: 0;
  overflow: hidden;
  border: 0;
  border-radius: 0;
  background: none center / 100% 100% no-repeat;
  box-shadow: none;
}

body[data-screen="title-screen"] .ranking-page::before,
body[data-screen="title-screen"] .ranking-page::after {
  display: none;
  content: none;
}

body[data-screen="title-screen"] #title-screen-heading {
  position: absolute;
  z-index: 2;
  top: 5.6%;
  left: 12%;
  width: 76%;
  margin: 0;
  color: #403426;
  font-family: "Noto Serif TC", "Source Han Serif TC", Georgia, serif;
  font-size: clamp(1.45rem, 2.35vw, 3rem);
  font-weight: 800;
  letter-spacing: 0.12em;
  line-height: 1.2;
  text-align: center;
  text-shadow: 0 1px 0 rgba(255, 251, 231, 0.9);
}

body[data-screen="title-screen"] .ranking-current-card {
  position: absolute;
  z-index: 2;
  top: 24.6%;
  left: 21.6%;
  display: grid;
  grid-template-columns: 1.45fr repeat(3, 1fr);
  align-items: center;
  width: 52.8%;
  height: 14.6%;
  min-height: 0;
  margin: 0;
  padding: 0 1.8%;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

body[data-screen="title-screen"] .ranking-current-card::before,
body[data-screen="title-screen"] .ranking-current-card::after {
  display: none;
  content: none;
}

body[data-screen="title-screen"] .ranking-current-copy,
body[data-screen="title-screen"] .ranking-current-card .result-stat {
  min-height: 0;
  padding: 0;
  border: 0;
  background: transparent;
  box-shadow: none;
  text-align: center;
}

body[data-screen="title-screen"] .ranking-current-copy > span,
body[data-screen="title-screen"] .ranking-current-card .result-stat > span {
  display: block;
  margin: 0 0 0.28em;
  color: #504434;
  font-family: "Noto Serif TC", "Source Han Serif TC", Georgia, serif;
  font-size: clamp(0.78rem, 1.02vw, 1.2rem);
  font-weight: 800;
  letter-spacing: 0.08em;
}

body[data-screen="title-screen"] .ranking-current-card .title-summary {
  max-width: 15rem;
  margin: 0 auto;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  color: #766554;
  font-size: clamp(0.62rem, 0.82vw, 0.98rem);
  font-weight: 700;
  line-height: 1.45;
}

body[data-screen="title-screen"] .ranking-current-card .result-stat strong {
  display: block;
  margin: 0;
  color: #9a3329;
  font-family: "Noto Serif TC", "Source Han Serif TC", Georgia, serif;
  font-size: clamp(1rem, 1.46vw, 1.75rem);
  font-weight: 900;
  line-height: 1.1;
  white-space: nowrap;
}

body[data-screen="title-screen"] .ranking-board-layer {
  position: absolute;
  inset: 0;
  z-index: 2;
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  box-shadow: none;
}

body[data-screen="title-screen"] .ranking-board-layer > #leaderboard-heading,
body[data-screen="title-screen"] .ranking-board-layer > #ranking-note {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

body[data-screen="title-screen"] .leaderboard-list {
  position: absolute;
  inset: 0;
  display: block;
  width: 100% !important;
  height: 100% !important;
  margin: 0;
  justify-self: stretch;
  align-self: stretch;
}

body[data-screen="title-screen"] .ranking-podium {
  position: absolute;
  left: 8.5%;
  top: 43.7%;
  display: block;
  width: 40%;
  height: 43.5%;
  min-height: 0;
  padding: 0;
}

body[data-screen="title-screen"] .ranking-podium::before,
body[data-screen="title-screen"] .ranking-podium::after {
  display: none;
  content: none;
}

body[data-screen="title-screen"] .ranking-medal-card {
  position: absolute;
  display: grid;
  align-content: start;
  justify-items: center;
  min-height: 0;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  color: #403426;
  text-align: center;
  transform: none;
}

body[data-screen="title-screen"] .ranking-medal-2 { left: 0; top: 19%; width: 28%; height: 77%; }
body[data-screen="title-screen"] .ranking-medal-1 { left: 32%; top: 0; width: 34%; height: 96%; }
body[data-screen="title-screen"] .ranking-medal-3 { right: 0; top: 23%; width: 23%; height: 73%; }

body[data-screen="title-screen"] .ranking-medal-ribbon { display: none; }

body[data-screen="title-screen"] .ranking-medal-badge {
  position: absolute;
  top: 6%;
  display: grid;
  place-items: center;
  width: 23%;
  aspect-ratio: 1;
  border: 0;
  border-radius: 50%;
  background: transparent !important;
  box-shadow: none;
  color: #5a4225;
  font-family: Georgia, serif;
  font-size: clamp(1rem, 1.7vw, 2rem);
  font-weight: 800;
}

body[data-screen="title-screen"] .ranking-medal-card > strong {
  margin-top: 31%;
  color: #4c4030;
  font-family: "Noto Serif TC", "Source Han Serif TC", Georgia, serif;
  font-size: clamp(0.9rem, 1.26vw, 1.52rem);
  font-weight: 800;
  letter-spacing: 0.08em;
}

body[data-screen="title-screen"] .ranking-player-name,
body[data-screen="title-screen"] .ranking-player-time,
body[data-screen="title-screen"] .ranking-player-steps {
  color: #9a3329;
  font-family: "Noto Serif TC", "Source Han Serif TC", Georgia, serif;
  font-weight: 800;
  line-height: 1.36;
  white-space: nowrap;
}

body[data-screen="title-screen"] .ranking-player-name {
  margin-top: 7%;
  font-size: clamp(0.76rem, 1.1vw, 1.25rem);
}

body[data-screen="title-screen"] .ranking-player-time,
body[data-screen="title-screen"] .ranking-player-steps {
  font-size: clamp(0.7rem, 0.91vw, 1.05rem);
}

body[data-screen="title-screen"] .honor-board {
  position: absolute;
  left: 53.4%;
  top: 42.4%;
  width: 35.9%;
  height: 40.5%;
  min-height: 0;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

body[data-screen="title-screen"] .honor-board h3 {
  position: absolute;
  top: 2.3%;
  left: 0;
  width: 100%;
  margin: 0;
  color: #493928;
  font-family: "Noto Serif TC", "Source Han Serif TC", Georgia, serif;
  font-size: clamp(0.95rem, 1.32vw, 1.56rem);
  font-weight: 800;
  letter-spacing: 0.12em;
  text-align: center;
  transform: none;
}

body[data-screen="title-screen"] .honor-scroll {
  position: absolute;
  left: 9%;
  top: 16.5%;
  display: grid;
  gap: 0;
  width: 82%;
  height: 67%;
  max-height: none;
  padding: 0;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: rgba(91, 65, 39, 0.62) transparent;
}

body[data-screen="title-screen"] .honor-head,
body[data-screen="title-screen"] .honor-row {
  display: grid;
  grid-template-columns: 12% 10% minmax(0, 1fr) 20% 18%;
  align-items: center;
  gap: 0;
}

body[data-screen="title-screen"] .honor-head {
  min-height: 13%;
  padding: 0 2%;
  color: #5c4c39;
  font-size: clamp(0.54rem, 0.68vw, 0.82rem);
  font-weight: 800;
  text-align: center;
}

body[data-screen="title-screen"] .honor-row {
  min-height: 14.3%;
  padding: 0 2%;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  color: #9a3329;
}

body[data-screen="title-screen"] .honor-row > *:not(:last-child) { border-right: 0; }

body[data-screen="title-screen"] .honor-rank {
  color: #4c4030;
  font-family: Georgia, serif;
  font-size: clamp(0.82rem, 1vw, 1.15rem);
  font-weight: 800;
  text-align: center;
}

body[data-screen="title-screen"] .honor-avatar {
  width: 1.15rem;
  justify-self: center;
  aspect-ratio: 1;
  border: 1px solid rgba(84, 68, 48, 0.28);
  box-shadow: none;
}

body[data-screen="title-screen"] .honor-row strong,
body[data-screen="title-screen"] .honor-row span:nth-last-child(-n + 2) {
  color: #9a3329;
  font-family: "Noto Serif TC", "Source Han Serif TC", Georgia, serif;
  font-size: clamp(0.64rem, 0.86vw, 1rem);
  font-weight: 800;
  text-align: center;
  white-space: nowrap;
}

body[data-screen="title-screen"] .honor-row strong { text-align: left; }

body[data-screen="title-screen"] .leaderboard-self-rank {
  position: absolute;
  left: 58%;
  bottom: 1.2%;
  width: 25%;
  margin: 0;
  padding: 0.35em 0.8em;
  border-radius: 999px;
  background: rgba(79, 55, 30, 0.78);
  color: #fff6d7;
  font-size: clamp(0.68rem, 0.9vw, 1rem);
  font-weight: 800;
  text-align: center;
}

body[data-screen="title-screen"] .hero-actions {
  position: absolute;
  z-index: 3;
  left: 35%;
  bottom: 2.6%;
  display: flex;
  width: 30%;
  justify-content: space-between;
  margin: 0;
}

body[data-screen="title-screen"] .hero-actions .wood-button {
  min-width: 0;
  width: 45%;
  min-height: 0;
  padding: 0.65em 0.8em;
  font-size: clamp(0.68rem, 0.88vw, 1rem);
}

@media (max-width: 980px) {
  body[data-screen="title-screen"] .ranking-page {
    width: 100vw;
    height: calc(100vw * 9 / 16);
  }
}

/* User supplied art pass: fixed bitmap backgrounds with live data overlays.
   Keep future coordinate tweaks in this block so older prototype rules do not
   keep fighting the final artwork. */
body[data-screen="memory-screen"] .record-meter.illustrated-record-meter {
  aspect-ratio: 907 / 512;
}

body[data-screen="memory-screen"] .record-meter.illustrated-record-meter .illustrated-record-art {
  object-fit: fill;
}

body[data-screen="memory-screen"] .illustrated-record-label {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

body[data-screen="memory-screen"] .illustrated-record-clock,
body[data-screen="memory-screen"] .illustrated-record-steps {
  display: block;
  transform: none;
}

body[data-screen="memory-screen"] .illustrated-record-clock {
  left: 14.8%;
  top: 28.6%;
  width: 30.5%;
  height: 46.2%;
}

body[data-screen="memory-screen"] .illustrated-record-steps {
  left: 59.8%;
  top: 40.3%;
  width: 17.8%;
  height: 27.5%;
}

body[data-screen="memory-screen"] .illustrated-record-clock .timer-readout,
body[data-screen="memory-screen"] .illustrated-record-steps strong {
  position: absolute;
  margin: 0;
  color: #1f1811;
  font-family: "Noto Serif TC", "Source Han Serif TC", Georgia, serif;
  font-variant-numeric: tabular-nums;
  font-weight: 800;
  line-height: 1;
  text-align: center;
  text-shadow: 0 1px 0 rgba(255, 248, 222, 0.86);
  transform: translate(-50%, -50%);
  transition: color 180ms ease, filter 180ms ease;
  animation: none !important;
}

body[data-screen="memory-screen"] .illustrated-record-clock .timer-readout {
  left: 47.5%;
  top: 50.5%;
  font-size: clamp(1.45rem, 9.2cqw, 2.85rem);
}

body[data-screen="memory-screen"] .illustrated-record-steps strong {
  left: 40%;
  top: 50%;
  font-size: clamp(1.38rem, 8.1cqw, 2.55rem);
}

body[data-screen="memory-screen"] .illustrated-record-clock .timer-readout span,
body[data-screen="memory-screen"] .illustrated-record-steps strong span {
  display: inline-block !important;
  width: auto !important;
  height: auto !important;
  font: inherit !important;
  line-height: inherit !important;
  transform: none !important;
  animation: none !important;
}

body[data-screen="memory-screen"] .illustrated-record-steps small {
  display: none;
}

body[data-screen="memory-screen"] .illustrated-record-clock small {
  display: none;
}

body[data-screen="memory-screen"] .illustrated-timer-progress,
body[data-screen="memory-screen"] .illustrated-step-progress {
  display: none;
}

body[data-screen="memory-screen"] .illustrated-record-meter.just-ticked .illustrated-record-clock strong {
  animation: recordNumberGlowOnly 220ms ease-out !important;
}

@keyframes recordNumberGlowOnly {
  0% { filter: brightness(1); }
  45% { filter: brightness(1.34); }
  100% { filter: brightness(1); }
}

body[data-screen="title-screen"] #global-home-button {
  position: fixed !important;
  top: clamp(1.25rem, 2.6vw, 2.25rem);
  right: clamp(1.35rem, 3vw, 3.2rem);
  z-index: 8;
  width: clamp(7.2rem, 10.5vw, 11.8rem);
  min-width: 0;
  aspect-ratio: 3.8 / 1;
  padding: 0;
  border: 0;
  border-radius: 999px;
  background-image: url("../image/generated/返回按鍵.png");
  background-size: 147% 372%;
  background-position: center 52%;
  background-repeat: no-repeat;
  box-shadow: 0 0.45rem 1.15rem rgba(20, 24, 20, 0.22);
  color: transparent;
  text-shadow: none;
}

body[data-screen="title-screen"] .screen-stack {
  inset: 0 !important;
}

body[data-screen="title-screen"] .app-shell::before,
body[data-screen="title-screen"] .app-shell::after,
body[data-screen="title-screen"] .screen-stack::before {
  display: none !important;
  opacity: 0 !important;
  content: none !important;
}

body[data-screen="title-screen"]::after {
  display: none !important;
  opacity: 0 !important;
  content: none !important;
}

body[data-screen="title-screen"] .ranking-page {
  width: min(100vw, calc(100vh * 1672 / 941)) !important;
  height: min(100vh, calc(100vw * 941 / 1672)) !important;
  background-image: url("../image/generated/翻翻樂排行榜頁面.png") !important;
}

body[data-screen="title-screen"] .ranking-page[data-leaderboard-mode="puzzle"] {
  background-image: url("../image/generated/拼拼樂排行榜頁面.png") !important;
}

body[data-screen="title-screen"] #title-screen-heading {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

body[data-screen="title-screen"] .ranking-current-card {
  top: 26.25%;
  left: 19.32%;
  width: 63.28%;
  height: 16.9%;
  grid-template-columns: 36.8% 21.05% 17.1% 25.05%;
  padding: 0 2.35%;
}

body[data-screen="title-screen"] .ranking-current-copy > span,
body[data-screen="title-screen"] .ranking-current-card .result-stat > span {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

body[data-screen="title-screen"] .ranking-current-card .title-summary {
  max-width: none;
  width: 82%;
  color: #b82f25;
  font-size: clamp(0.72rem, 1.08vw, 1.22rem);
  font-weight: 800;
  line-height: 1.45;
}

body[data-screen="title-screen"] .ranking-current-card .result-stat {
  display: grid;
  place-items: center;
}

body[data-screen="title-screen"] .ranking-current-card .result-stat strong {
  color: #b82f25;
  font-size: clamp(0.96rem, 1.45vw, 1.75rem);
  line-height: 1;
}

body[data-screen="title-screen"] .ranking-board-layer,
body[data-screen="title-screen"] .leaderboard-list,
body[data-screen="title-screen"] .ranking-podium {
  position: absolute !important;
  inset: 0 !important;
  display: block !important;
  width: 100% !important;
  height: 100% !important;
  min-width: 100% !important;
  max-width: none !important;
  min-height: 100% !important;
  margin: 0 !important;
  padding: 0 !important;
  border: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
  justify-self: stretch !important;
  align-self: stretch !important;
}

body[data-screen="title-screen"] .ranking-board-layer > #leaderboard-heading,
body[data-screen="title-screen"] .ranking-board-layer > #ranking-note,
body[data-screen="title-screen"] .ranking-medal-ribbon,
body[data-screen="title-screen"] .ranking-medal-badge,
body[data-screen="title-screen"] .ranking-medal-card > strong,
body[data-screen="title-screen"] .honor-board h3,
body[data-screen="title-screen"] .honor-head,
body[data-screen="title-screen"] .leaderboard-self-rank {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  overflow: hidden !important;
  clip: rect(0 0 0 0) !important;
  white-space: nowrap !important;
}

body[data-screen="title-screen"] .ranking-medal-card {
  position: absolute !important;
  display: block !important;
  min-width: 0 !important;
  min-height: 0 !important;
  padding: 0 !important;
  border: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
}

body[data-screen="title-screen"] .ranking-medal-2 {
  left: 8.25% !important;
  top: 55.6% !important;
  width: 12.4% !important;
  height: 39.6% !important;
}

body[data-screen="title-screen"] .ranking-medal-1 {
  left: 22.85% !important;
  top: 46.55% !important;
  width: 13.3% !important;
  height: 48.8% !important;
}

body[data-screen="title-screen"] .ranking-medal-3 {
  left: 38.82% !important;
  top: 59.3% !important;
  width: 12.1% !important;
  height: 36.1% !important;
}

body[data-screen="title-screen"] .ranking-player-name,
body[data-screen="title-screen"] .ranking-player-time,
body[data-screen="title-screen"] .ranking-player-steps {
  position: absolute;
  left: 11%;
  width: 78%;
  margin: 0;
  color: #b82f25;
  font-size: clamp(0.78rem, 1.08vw, 1.18rem);
  font-weight: 800;
  line-height: 1.1;
  text-align: center;
  white-space: nowrap;
}

body[data-screen="title-screen"] .ranking-player-name { top: 45%; }
body[data-screen="title-screen"] .ranking-player-time { top: 56%; }
body[data-screen="title-screen"] .ranking-player-steps { top: 65%; }

body[data-screen="title-screen"] .ranking-medal-1 .ranking-player-name { top: 48%; }
body[data-screen="title-screen"] .ranking-medal-1 .ranking-player-time { top: 57%; }
body[data-screen="title-screen"] .ranking-medal-1 .ranking-player-steps { top: 65%; }

body[data-screen="title-screen"] .honor-board {
  position: absolute !important;
  left: 57.45% !important;
  top: 44.72% !important;
  width: 38.1% !important;
  height: 51.05% !important;
  min-height: 0 !important;
  padding: 0 !important;
  border: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
}

body[data-screen="title-screen"] .honor-scroll {
  position: absolute !important;
  left: 4.6% !important;
  top: 15.3% !important;
  display: grid !important;
  grid-template-rows: repeat(7, 1fr);
  gap: 0;
  width: 88.2% !important;
  height: 76.4% !important;
  max-height: none !important;
  padding: 0 !important;
  overflow-y: auto;
  background: transparent !important;
  scrollbar-width: thin;
}

body[data-screen="title-screen"] .honor-row {
  display: grid !important;
  grid-template-columns: 10.8% 0 minmax(0, 42%) 23.6% 23.6%;
  align-items: center;
  min-height: 0 !important;
  padding: 0 !important;
  border: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
}

body[data-screen="title-screen"] .honor-avatar {
  display: none !important;
}

body[data-screen="title-screen"] .honor-rank,
body[data-screen="title-screen"] .honor-row strong,
body[data-screen="title-screen"] .honor-row span:nth-last-child(-n + 2) {
  color: #b82f25 !important;
  font-family: "Noto Serif TC", "Source Han Serif TC", Georgia, serif;
  font-size: clamp(0.72rem, 1.02vw, 1.16rem) !important;
  font-weight: 800 !important;
  line-height: 1 !important;
  text-align: center !important;
  white-space: nowrap !important;
}

body[data-screen="title-screen"] .honor-rank {
  color: #4c4030 !important;
}

body[data-screen="title-screen"] .honor-row strong {
  padding-left: 7%;
  text-align: left !important;
}

body[data-screen="title-screen"] .hero-actions {
  z-index: 4;
  left: auto;
  right: 2.4%;
  bottom: 1.8%;
  width: 18.4%;
  justify-content: flex-end;
  gap: 0.8rem;
}

body[data-screen="title-screen"] .hero-actions .wood-button {
  min-width: 0;
  width: 48%;
  min-height: 0;
  padding: 0.55em 0.7em;
  border-radius: 999px;
  font-size: clamp(0.62rem, 0.82vw, 0.92rem);
}

/* Final placement pass for the supplied ranking and meter art. */
body[data-screen="memory-screen"] .record-meter.illustrated-record-meter {
  width: min(100%, 33rem);
  max-height: none;
  aspect-ratio: 1635 / 811;
  border-radius: clamp(0.72rem, 1vw, 1.08rem);
}

body[data-screen="memory-screen"] .record-meter.illustrated-record-meter .illustrated-record-art {
  border-radius: inherit;
}

body[data-screen="memory-screen"] .illustrated-record-clock {
  left: 17.35%;
  top: 31.2%;
  width: 27.25%;
  height: 44.8%;
}

body[data-screen="memory-screen"] .illustrated-record-clock .timer-readout {
  left: 39%;
  top: 50.2%;
  font-size: clamp(1.35rem, 7.35cqw, 2.45rem);
  letter-spacing: 0;
}

body[data-screen="memory-screen"] .illustrated-record-steps {
  left: 68.5%;
  top: 42.6%;
  width: 16.2%;
  height: 28.8%;
}

body[data-screen="memory-screen"] .illustrated-record-steps strong {
  left: 47.5%;
  right: auto;
  top: 50.2%;
  width: auto;
  font-size: clamp(1.3rem, 7.15cqw, 2.32rem);
  text-align: center;
  transform: translate(-50%, -50%);
  letter-spacing: 0;
}

body[data-screen="memory-screen"] .illustrated-record-clock .timer-readout span,
body[data-screen="memory-screen"] .illustrated-record-steps strong span {
  color: #17120d !important;
  text-shadow: 0 1px 0 rgba(255, 247, 220, 0.7);
}

body[data-screen="title-screen"] .ranking-current-card {
  top: 30.8%;
  left: 19.2%;
  width: 58.2%;
  height: 14.7%;
  grid-template-columns: 35.7% 21.2% 19.2% 21.9%;
  padding: 0 5.25%;
}

body[data-screen="title-screen"] .ranking-current-card .title-summary,
body[data-screen="title-screen"] .ranking-current-card .result-stat strong,
body[data-screen="title-screen"] .ranking-player-name,
body[data-screen="title-screen"] .ranking-player-time,
body[data-screen="title-screen"] .ranking-player-steps,
body[data-screen="title-screen"] .honor-row strong,
body[data-screen="title-screen"] .honor-row span:nth-last-child(-n + 2) {
  color: #14110d !important;
  text-shadow: 0 1px 0 rgba(255, 248, 224, 0.62);
}

body[data-screen="title-screen"] .ranking-current-card .title-summary {
  width: 86%;
  font-size: clamp(1rem, 1.42vw, 1.72rem);
  line-height: 1.55;
}

body[data-screen="title-screen"] .ranking-current-card .result-stat strong {
  font-size: clamp(1.25rem, 1.88vw, 2.28rem);
}

body[data-screen="title-screen"] .ranking-medal-2 {
  left: 8.15% !important;
  top: 55.15% !important;
  width: 12.6% !important;
  height: 39.7% !important;
}

body[data-screen="title-screen"] .ranking-medal-1 {
  left: 22.72% !important;
  top: 46.15% !important;
  width: 13.55% !important;
  height: 49% !important;
}

body[data-screen="title-screen"] .ranking-medal-3 {
  left: 38.7% !important;
  top: 58.95% !important;
  width: 12.35% !important;
  height: 36.4% !important;
}

body[data-screen="title-screen"] .ranking-player-name,
body[data-screen="title-screen"] .ranking-player-time,
body[data-screen="title-screen"] .ranking-player-steps {
  left: 9%;
  width: 82%;
  font-size: clamp(1.95rem, 2.32vw, 2.55rem);
  line-height: 1.15;
}

body[data-screen="title-screen"] .ranking-player-name { top: 45.4%; }
body[data-screen="title-screen"] .ranking-player-time { top: 55.9%; }
body[data-screen="title-screen"] .ranking-player-steps { top: 64.7%; }

body[data-screen="title-screen"] .ranking-medal-1 .ranking-player-name { top: 47.5%; }
body[data-screen="title-screen"] .ranking-medal-1 .ranking-player-time { top: 56.4%; }
body[data-screen="title-screen"] .ranking-medal-1 .ranking-player-steps { top: 64.8%; }

body[data-screen="title-screen"] .honor-board {
  left: 57.55% !important;
  top: 44.1% !important;
  width: 38% !important;
  height: 51.7% !important;
}

body[data-screen="title-screen"] .honor-scroll {
  left: 5.7% !important;
  top: 15.4% !important;
  width: 85.2% !important;
  height: 77.3% !important;
}

body[data-screen="title-screen"] .honor-row {
  grid-template-columns: minmax(0, 43%) 28.5% 28.5%;
  column-gap: 0;
}

body[data-screen="title-screen"] .honor-rank {
  display: none !important;
}

body[data-screen="title-screen"] .honor-row strong {
  padding-left: 18%;
  font-size: clamp(0.95rem, 1.32vw, 1.55rem) !important;
  text-align: left !important;
}

body[data-screen="title-screen"] .honor-row span:nth-last-child(-n + 2) {
  font-size: clamp(0.95rem, 1.32vw, 1.55rem) !important;
}

body[data-screen="title-screen"] .honor-row span:nth-last-child(2)::after {
  content: " /";
  margin-left: 0.18em;
}

body[data-screen="title-screen"] .honor-row.is-empty span:nth-last-child(2)::after {
  content: "";
}

body[data-screen="title-screen"] .ranking-medal-card.is-empty .ranking-player-name,
body[data-screen="title-screen"] .ranking-medal-card.is-empty .ranking-player-time,
body[data-screen="title-screen"] .ranking-medal-card.is-empty .ranking-player-steps {
  display: none !important;
}

/* Puzzle bird selection: illustrated drawer cabinet with semantic interactive overlays. */
body[data-screen="puzzle-screen"] .puzzle-prototype.is-selecting {
  display: block;
  width: min(100%, calc(100vh * 1.776));
  height: auto;
  aspect-ratio: 1672 / 941;
  margin: auto;
}

body[data-screen="puzzle-screen"] .puzzle-drawer-selection {
  position: relative;
  display: block;
  width: 100%;
  height: 100%;
  min-height: 0;
  padding: 0;
  overflow: visible;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

.puzzle-drawer-art {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  object-fit: fill;
  pointer-events: none;
  user-select: none;
}

.puzzle-drawer-title,
.puzzle-drawer-instruction {
  position: absolute;
  z-index: 3;
  left: 50%;
  margin: 0;
  transform: translateX(-50%);
  text-align: center;
  white-space: nowrap;
}

.puzzle-drawer-title {
  top: 6.6%;
  color: #2d1b0c;
  font-family: "Noto Serif TC", "Source Han Serif TC", Georgia, serif;
  font-size: clamp(1rem, 2.15vw, 2.3rem);
  font-weight: 900;
  letter-spacing: 0.12em;
  text-shadow: 0 1px 0 rgba(255, 239, 180, 0.72);
}

.puzzle-drawer-instruction {
  top: 14.75%;
  color: rgba(255, 237, 190, 0.92);
  font-family: "Noto Serif TC", "Source Han Serif TC", Georgia, serif;
  font-size: clamp(0.55rem, 0.84vw, 0.92rem);
  font-weight: 800;
  letter-spacing: 0.08em;
  text-shadow: 0 0.12rem 0.35rem rgba(32, 18, 7, 0.9);
}

.puzzle-bird-list {
  position: absolute;
  z-index: 2;
  left: 3.1%;
  top: 18.6%;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  grid-template-rows: repeat(2, 1fr);
  gap: 5.6% 2.15%;
  width: 93.8%;
  height: 65.1%;
  padding: 0;
  overflow: visible;
}

.puzzle-drawer-slot {
  position: relative;
  min-width: 0;
  min-height: 0;
  isolation: isolate;
}

.puzzle-bird-card {
  position: absolute;
  z-index: 1;
  inset: 8% 7% 7%;
  display: block;
  width: auto;
  min-height: 0;
  padding: 0;
  overflow: visible;
  border: 0;
  border-radius: 0.35rem;
  background: transparent;
  color: #2d2114;
  cursor: pointer;
  filter: drop-shadow(0 0.38rem 0.42rem rgba(10, 5, 1, 0.62));
  transition: inset 380ms cubic-bezier(.2,.85,.25,1), filter 260ms ease;
}

.puzzle-bird-card:focus-visible {
  outline: 0.2rem solid #f5d477;
  outline-offset: 0.25rem;
}

.puzzle-bird-paper {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  overflow: hidden;
  border: 0.25rem solid #e8d5a2;
  border-radius: 0.26rem;
  background:
    radial-gradient(circle at 24% 13%, rgba(255,255,245,.72), transparent 27%),
    linear-gradient(135deg, #eee5c6, #c9bb8c);
  box-shadow:
    inset 0 0 0 0.09rem rgba(90, 62, 30, 0.28),
    inset 0 0.14rem 0 rgba(255, 255, 239, .78),
    0 0.34rem 0.3rem rgba(38, 19, 6, 0.32);
  opacity: 0;
  transform: translateY(67%);
  transition: opacity 170ms ease, transform 390ms cubic-bezier(.2,.85,.25,1);
}

.puzzle-bird-paper img {
  width: 88%;
  height: 72%;
  object-fit: contain;
  object-position: center 43%;
  filter: drop-shadow(0 0.44rem 0.28rem rgba(53, 35, 15, .3));
}

.puzzle-bird-paper strong {
  position: absolute;
  bottom: 8%;
  left: 0;
  width: 100%;
  color: #382311;
  font-family: "Noto Serif TC", "Source Han Serif TC", Georgia, serif;
  font-size: clamp(0.9rem, 1.45vw, 1.5rem);
  font-weight: 900;
  letter-spacing: .16em;
  text-align: center;
  text-shadow: 0 1px 0 rgba(255,255,236,.85);
}

.puzzle-bird-nameplate {
  position: absolute;
  z-index: 2;
  bottom: 0;
  left: 4%;
  display: grid;
  width: 92%;
  min-height: 20%;
  place-items: center;
  padding: .18em .2em;
  border: 1px solid #5b3511;
  border-radius: .26rem;
  background:
    linear-gradient(180deg, #f4d88c, #ae742b 56%, #714219);
  box-shadow:
    inset 0 1px 0 rgba(255, 238, 173, .75),
    inset 0 -0.13rem 0 rgba(55, 26, 5, .35),
    0 0.18rem 0.28rem rgba(17, 7, 1, .58);
  color: #2d1909;
  font-family: "Noto Serif TC", "Source Han Serif TC", Georgia, serif;
  font-size: clamp(.62rem, .97vw, 1.05rem);
  font-weight: 900;
  letter-spacing: .09em;
  line-height: 1.1;
  text-align: center;
  text-shadow: 0 1px 0 rgba(255, 237, 166, .62);
}

.puzzle-drawer-slot:not(.is-selected) .puzzle-bird-card:hover .puzzle-bird-nameplate,
.puzzle-drawer-slot:not(.is-selected) .puzzle-bird-card:focus-visible .puzzle-bird-nameplate {
  filter: brightness(1.16);
  transform: translateY(-.12rem);
}

.puzzle-drawer-slot.is-selected { z-index: 8; }

.puzzle-drawer-slot.is-selected .puzzle-bird-card {
  z-index: 3;
  inset: -9% 1.5% 1%;
  filter: drop-shadow(0 0.95rem .72rem rgba(10, 5, 1, .72));
}

.puzzle-drawer-slot.is-selected .puzzle-bird-paper {
  opacity: 1;
  transform: translateY(0);
}

.puzzle-drawer-slot.is-selected .puzzle-bird-paper strong { bottom: 29%; }

.puzzle-drawer-slot.is-selected .puzzle-bird-nameplate {
  bottom: 21%;
  min-height: 16%;
  font-size: clamp(.66rem, 1.08vw, 1.15rem);
}

.puzzle-bird-choice-actions {
  position: absolute;
  z-index: 4;
  right: 5%;
  bottom: 5.5%;
  left: 5%;
  display: none;
  gap: 4%;
}

.puzzle-drawer-slot.is-selected .puzzle-bird-choice-actions { display: flex; }

.brass-action-button {
  flex: 1 1 0;
  min-width: 0;
  padding: .46em .25em;
  border: 1px solid #593312;
  border-radius: .3rem;
  background: linear-gradient(180deg, #fae3a1, #b37a2b 54%, #754417);
  box-shadow: inset 0 1px 0 rgba(255, 243, 188, .78), inset 0 -.14rem 0 rgba(70, 36, 7, .34), 0 .18rem .22rem rgba(18, 7, 0, .45);
  color: #2c1809;
  font-family: "Noto Serif TC", "Source Han Serif TC", Georgia, serif;
  font-size: clamp(.53rem, .75vw, .82rem);
  font-weight: 900;
  letter-spacing: .03em;
  line-height: 1.1;
  cursor: pointer;
  text-shadow: 0 1px 0 rgba(255, 240, 182, .65);
}

.brass-action-button:hover,
.brass-action-button:focus-visible { filter: brightness(1.14); transform: translateY(-.08rem); }

.brass-action-button--quiet { background: linear-gradient(180deg, #e8d0a0, #9a6730 54%, #5d371a); }

.puzzle-home-latch {
  position: absolute;
  z-index: 4;
  bottom: 4.5%;
  left: 50%;
  width: 9%;
  height: 9.7%;
  padding: 0 0.15rem;
  transform: translateX(-50%);
  border: 0;
  border-radius: .2rem;
  background: transparent;
  color: #2d1a09;
  font-family: "Noto Serif TC", "Source Han Serif TC", Georgia, serif;
  font-size: clamp(.52rem, .8vw, .86rem);
  font-weight: 900;
  cursor: pointer;
  text-shadow: 0 1px 0 rgba(255, 238, 179, .65);
}

.puzzle-home-latch:hover,
.puzzle-home-latch:focus-visible { filter: brightness(1.25); outline: none; }

.puzzle-rules-dialog { border: 0; background: transparent; }
.puzzle-rules-dialog::backdrop { background: rgba(15, 9, 3, .68); backdrop-filter: blur(.3rem); }

.puzzle-rules-card {
  position: relative;
  width: min(39rem, calc(100vw - 2rem));
  padding: clamp(1.7rem, 4vw, 3rem);
  overflow: hidden;
  border: .18rem solid #967033;
  border-radius: 1.35rem;
  background:
    radial-gradient(circle at 50% -16%, rgba(255, 232, 148, .48), transparent 42%),
    linear-gradient(135deg, #f1e2bb, #c99e5e 48%, #705020);
  box-shadow: inset 0 0 0 .28rem rgba(255, 244, 203, .38), 0 1.3rem 4rem rgba(0,0,0,.55);
  color: #35220e;
  text-align: center;
}

.puzzle-rules-crest { color: #7d4d13; font-size: 2.2rem; line-height: 1; text-shadow: 0 1px 0 #ffeeb9; }
.puzzle-rules-card h2 { margin: .35rem 0 .45rem; color: #2d1b0a; font-family: "Noto Serif TC", "Source Han Serif TC", Georgia, serif; font-size: clamp(2rem, 4vw, 3rem); }
.puzzle-rules-intro { margin: 0 auto 1.2rem; max-width: 29rem; font-weight: 800; line-height: 1.65; }

.puzzle-rules-list { display: grid; gap: .64rem; margin: 0; padding: 0; list-style: none; text-align: left; }
.puzzle-rules-list li { display: grid; grid-template-columns: 2.5rem 1fr; gap: .75rem; align-items: center; padding: .72rem .88rem; border: 1px solid rgba(92, 55, 14, .38); border-radius: .65rem; background: rgba(255, 246, 211, .48); box-shadow: inset 0 1px 0 rgba(255,255,242,.56); }
.puzzle-rules-list span { display: grid; width: 2.1rem; height: 2.1rem; place-items: center; border-radius: 50%; background: #704315; color: #ffedba; font-family: Georgia, serif; font-weight: 900; }
.puzzle-rules-list p { margin: 0; font-size: clamp(.9rem, 1.35vw, 1.08rem); line-height: 1.45; }
.puzzle-rules-list strong { display: inline-block; margin-right: .38em; color: #492a0d; }
.puzzle-rules-note { margin: 1rem 0 1.15rem; color: #5b3513; font-size: .92rem; font-weight: 800; }
.puzzle-rules-actions { display: flex; justify-content: center; gap: .7rem; }
.puzzle-rules-actions .brass-action-button { flex: 0 1 12rem; padding: .75em 1em; font-size: 1rem; }

@media (max-width: 760px) {
  body[data-screen="puzzle-screen"] .puzzle-prototype.is-selecting { width: 100vw; }
  .puzzle-drawer-title { font-size: clamp(.82rem, 3vw, 1.1rem); }
  .puzzle-drawer-instruction { display: none; }
  .puzzle-bird-nameplate { font-size: clamp(.43rem, 1.85vw, .65rem); }
  .puzzle-bird-paper strong { font-size: clamp(.62rem, 2.6vw, .9rem); }
  .brass-action-button { font-size: clamp(.4rem, 1.55vw, .58rem); }
  .puzzle-home-latch { font-size: clamp(.43rem, 1.55vw, .58rem); }
}

/* Card-file drawer refinement: five bays with a rear and front card layer. */
body[data-screen="puzzle-screen"] .app-shell::after {
  display: none;
}

body[data-screen="puzzle-screen"] .puzzle-bird-list {
  left: 8.9%;
  top: 20.8%;
  width: 82.2%;
  height: 48.7%;
  grid-template-columns: repeat(5, 1fr);
  grid-template-rows: 48% 48%;
  column-gap: 2.7%;
  row-gap: 4%;
}

body[data-screen="puzzle-screen"] .puzzle-drawer-title {
  top: 4.6%;
  color: #e7c989;
  font-size: clamp(.95rem, 1.82vw, 2rem);
  text-shadow: 0 1px 0 #1b0d05, 0 0.16rem 0.25rem rgba(0,0,0,.78);
}

body[data-screen="puzzle-screen"] .puzzle-drawer-instruction {
  top: 14.6%;
  color: rgba(246, 226, 179, .82);
}

body[data-screen="puzzle-screen"] .puzzle-drawer-slot {
  overflow: visible;
}

body[data-screen="puzzle-screen"] .puzzle-bird-card {
  inset: 3% 8% 1%;
  border-radius: .48rem;
  filter: drop-shadow(0 .36rem .34rem rgba(8, 3, 0, .68));
}

body[data-screen="puzzle-screen"] .puzzle-bird-paper {
  inset: 0;
  border-width: .22rem;
  border-radius: .46rem;
  opacity: 1;
  transform: none;
  background: linear-gradient(135deg, #f5efd9, #bdb18c);
}

body[data-screen="puzzle-screen"] .puzzle-bird-paper img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 42%;
  opacity: .6;
  filter: sepia(.1) saturate(.78) contrast(.92);
}

body[data-screen="puzzle-screen"] .puzzle-bird-paper strong {
  display: none;
}

body[data-screen="puzzle-screen"] .puzzle-bird-nameplate {
  top: -8%;
  bottom: auto;
  left: 4%;
  min-height: 24%;
  font-size: clamp(.58rem, .92vw, 1rem);
}

body[data-screen="puzzle-screen"] .puzzle-drawer-slot[data-puzzle-depth="front"] .puzzle-bird-card {
  inset: 1% 8% 3%;
}

body[data-screen="puzzle-screen"] .puzzle-drawer-slot.is-selected .puzzle-bird-card {
  z-index: 6;
  inset: -46% 1% -24%;
  filter: drop-shadow(0 .95rem .72rem rgba(8, 3, 0, .78));
}

body[data-screen="puzzle-screen"] .puzzle-drawer-slot[data-puzzle-depth="front"].is-selected .puzzle-bird-card {
  inset: -91% 1% -20%;
}

body[data-screen="puzzle-screen"] .puzzle-drawer-slot.is-selected .puzzle-bird-paper {
  border-width: .28rem;
  background: linear-gradient(135deg, #fff8df, #d6c390);
  box-shadow: inset 0 0 0 .1rem rgba(82, 50, 20, .22), inset 0 .16rem 0 rgba(255,255,246,.88), 0 .35rem .4rem rgba(20,8,0,.38);
}

body[data-screen="puzzle-screen"] .puzzle-drawer-slot.is-selected .puzzle-bird-paper img {
  width: 88%;
  height: 67%;
  object-fit: cover;
  object-position: center 58%;
  opacity: 1;
  filter: none;
}

body[data-screen="puzzle-screen"] .puzzle-drawer-slot.is-selected .puzzle-bird-paper strong {
  display: block;
  bottom: 27%;
}

body[data-screen="puzzle-screen"] .puzzle-drawer-slot.is-selected .puzzle-bird-nameplate {
  top: -4%;
  bottom: auto;
  min-height: 13%;
}

body[data-screen="puzzle-screen"] .puzzle-bird-choice-actions {
  z-index: 7;
  right: 5%;
  bottom: -16%;
  left: 5%;
}

body[data-screen="puzzle-screen"] .puzzle-home-latch {
  bottom: 7.1%;
  width: 9.4%;
  height: 10.5%;
  color: #2a1808;
}

@media (max-width: 760px) {
  body[data-screen="puzzle-screen"] .puzzle-bird-nameplate { font-size: clamp(.41rem, 1.52vw, .62rem); }
  body[data-screen="puzzle-screen"] .puzzle-bird-choice-actions { bottom: -17%; }
}

/* Supplied artwork pass: the drawer and card are fixed images; HTML only supplies birds and interaction. */
body[data-screen="puzzle-screen"] .puzzle-drawer-title,
body[data-screen="puzzle-screen"] .puzzle-drawer-instruction {
  display: none;
}

body[data-screen="puzzle-screen"] .puzzle-bird-list {
  left: 8.2%;
  top: 20.1%;
  width: 83.6%;
  height: 49.5%;
  grid-template-rows: repeat(2, 1fr);
  column-gap: 1.4%;
  row-gap: 0;
}

body[data-screen="puzzle-screen"] .puzzle-drawer-slot {
  z-index: 1;
}

body[data-screen="puzzle-screen"] .puzzle-bird-card {
  z-index: 1;
  top: auto;
  right: auto;
  bottom: 1%;
  left: 19%;
  width: 62%;
  height: auto;
  aspect-ratio: 2 / 3;
  overflow: visible;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  filter: drop-shadow(0 .28rem .28rem rgba(16, 8, 1, .48));
  transition: transform 360ms cubic-bezier(.2,.84,.2,1), width 360ms cubic-bezier(.2,.84,.2,1), left 360ms cubic-bezier(.2,.84,.2,1), bottom 360ms cubic-bezier(.2,.84,.2,1), filter 360ms ease;
}

body[data-screen="puzzle-screen"] .puzzle-bird-card-art {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  clip-path: polygon(22% 4%, 78% 4%, 91% 8%, 91% 92%, 82% 98%, 18% 98%, 9% 92%, 9% 8%);
  pointer-events: none;
  user-select: none;
}

body[data-screen="puzzle-screen"] .puzzle-bird-paper {
  position: absolute;
  inset: 0;
  display: block;
  overflow: visible;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  opacity: 1;
  transform: none;
}

body[data-screen="puzzle-screen"] .puzzle-bird-paper > img {
  position: absolute;
  top: 16.3%;
  right: 14.5%;
  bottom: auto;
  left: 14.5%;
  width: 71%;
  height: 50%;
  object-fit: cover;
  object-position: center 52%;
  opacity: 1;
  filter: none;
}

body[data-screen="puzzle-screen"] .puzzle-bird-paper strong {
  position: absolute;
  top: 70.1%;
  right: 13%;
  bottom: auto;
  left: 13%;
  display: none;
  width: auto;
  color: #4c3118;
  font-size: clamp(.56rem, .83vw, .95rem);
  letter-spacing: .12em;
  line-height: 1.1;
  text-shadow: 0 1px 0 rgba(255,255,244,.85);
}

body[data-screen="puzzle-screen"] .puzzle-bird-nameplate {
  top: 4.2%;
  right: 19%;
  bottom: auto;
  left: 19%;
  display: grid;
  width: auto;
  min-height: 0;
  height: 8.2%;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  color: #4a3018;
  font-size: clamp(.46rem, .7vw, .78rem);
  letter-spacing: .06em;
  text-shadow: 0 1px 0 rgba(255,255,242,.85);
}

body[data-screen="puzzle-screen"] .puzzle-drawer-slot[data-puzzle-depth="front"] .puzzle-bird-card {
  bottom: 1%;
}

body[data-screen="puzzle-screen"] .puzzle-drawer-slot.is-selected {
  z-index: 10;
}

body[data-screen="puzzle-screen"] .puzzle-drawer-slot.is-selected .puzzle-bird-card,
body[data-screen="puzzle-screen"] .puzzle-drawer-slot[data-puzzle-depth="front"].is-selected .puzzle-bird-card {
  z-index: 6;
  right: auto;
  bottom: -5%;
  left: 7%;
  width: 86%;
  transform: translateY(-35%);
  filter: drop-shadow(0 1.05rem .78rem rgba(14, 7, 1, .64));
}

body[data-screen="puzzle-screen"] .puzzle-drawer-slot.is-selected .puzzle-bird-paper > img {
  top: 15.5%;
  right: 14%;
  left: 14%;
  width: 72%;
  height: 50.5%;
  object-fit: cover;
  object-position: center 53%;
}

body[data-screen="puzzle-screen"] .puzzle-drawer-slot.is-selected .puzzle-bird-paper {
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

body[data-screen="puzzle-screen"] .puzzle-drawer-slot.is-selected .puzzle-bird-paper strong {
  top: 70%;
  display: block;
  font-size: clamp(.72rem, 1.22vw, 1.35rem);
}

body[data-screen="puzzle-screen"] .puzzle-drawer-slot.is-selected .puzzle-bird-nameplate {
  top: 4.2%;
  bottom: auto;
  min-height: 0;
  font-size: clamp(.62rem, .95vw, 1.08rem);
}

body[data-screen="puzzle-screen"] .puzzle-bird-choice-actions {
  z-index: 8;
  top: auto;
  right: 11%;
  bottom: 6.6%;
  left: 11%;
  height: 9.7%;
  gap: 13%;
}

body[data-screen="puzzle-screen"] .puzzle-bird-choice-actions .brass-action-button {
  padding: 0;
  border: 0;
  border-radius: 999px;
  background: transparent;
  box-shadow: none;
  color: transparent;
  font-size: 0;
  text-shadow: none;
}

body[data-screen="puzzle-screen"] .puzzle-bird-choice-actions .brass-action-button:hover,
body[data-screen="puzzle-screen"] .puzzle-bird-choice-actions .brass-action-button:focus-visible {
  filter: brightness(1.12);
  outline: .12rem solid rgba(255, 237, 172, .9);
  outline-offset: .08rem;
  transform: none;
}

body[data-screen="puzzle-screen"] .puzzle-home-latch {
  top: 75.2%;
  bottom: auto;
  width: 16%;
  height: 19%;
  color: transparent;
  font-size: 0;
  text-shadow: none;
}

body[data-screen="puzzle-screen"] .puzzle-home-latch:hover,
body[data-screen="puzzle-screen"] .puzzle-home-latch:focus-visible {
  filter: brightness(1.15);
  outline: .14rem solid rgba(255, 229, 148, .9);
  outline-offset: -.55rem;
}

@media (max-width: 760px) {
  body[data-screen="puzzle-screen"] .puzzle-bird-card { left: 17%; width: 66%; }
  body[data-screen="puzzle-screen"] .puzzle-bird-paper strong { font-size: clamp(.38rem, 1.36vw, .56rem); }
  body[data-screen="puzzle-screen"] .puzzle-bird-nameplate { font-size: clamp(.34rem, 1.15vw, .48rem); }
}

/* Ten individual animal cards: title artwork + cutout illustration + virtue label. */
body[data-screen="puzzle-screen"] .puzzle-drawer-slot:not(.is-selected) {
  overflow: hidden;
}

body[data-screen="puzzle-screen"] .puzzle-drawer-slot:not(.is-selected) .puzzle-bird-card {
  bottom: -14%;
  filter: drop-shadow(0 .18rem .22rem rgba(12, 6, 1, .55));
}

body[data-screen="puzzle-screen"] .puzzle-drawer-slot:not(.is-selected) .puzzle-bird-card-art {
  clip-path: polygon(22% 4%, 78% 4%, 91% 8%, 91% 80%, 82% 86%, 18% 86%, 9% 80%, 9% 8%);
}

body[data-screen="puzzle-screen"] .puzzle-bird-paper > img,
body[data-screen="puzzle-screen"] .puzzle-drawer-slot.is-selected .puzzle-bird-paper > img {
  top: 17%;
  right: 15.5%;
  left: 15.5%;
  width: 69%;
  height: 49%;
  object-fit: contain;
  object-position: center;
  opacity: 1;
  filter: drop-shadow(0 .16rem .12rem rgba(65, 41, 18, .18));
}

body[data-screen="puzzle-screen"] .puzzle-bird-nameplate {
  display: grid;
  place-items: center;
}

body[data-screen="puzzle-screen"] .puzzle-bird-nameplate img {
  display: block;
  width: 94%;
  height: 94%;
  object-fit: contain;
}

body[data-screen="puzzle-screen"] .puzzle-bird-paper strong,
body[data-screen="puzzle-screen"] .puzzle-drawer-slot.is-selected .puzzle-bird-paper strong {
  top: 70.5%;
  right: 16%;
  left: 16%;
  display: block;
  width: auto;
  color: #292015;
  font-family: "Noto Serif TC", "Source Han Serif TC", Georgia, serif;
  font-size: clamp(.48rem, .72vw, .8rem);
  font-weight: 900;
  letter-spacing: .12em;
  text-shadow: 0 1px 0 rgba(255,255,245,.82);
}

body[data-screen="puzzle-screen"] .puzzle-drawer-slot.is-selected .puzzle-bird-card,
body[data-screen="puzzle-screen"] .puzzle-drawer-slot[data-puzzle-depth="front"].is-selected .puzzle-bird-card {
  bottom: -5%;
  transform: translateY(-35%) scale(1.01);
}

body[data-screen="puzzle-screen"] .puzzle-drawer-slot.is-selected .puzzle-bird-card-art {
  clip-path: polygon(22% 4%, 78% 4%, 91% 8%, 91% 92%, 82% 98%, 18% 98%, 9% 92%, 9% 8%);
}

body[data-screen="puzzle-screen"] .puzzle-drawer-slot.is-selected .puzzle-bird-paper strong {
  font-size: clamp(.7rem, 1.1vw, 1.2rem);
}

/* Final drawer selection pass: use the supplied full-card artwork and let the
   drawer crop/lift it naturally instead of rebuilding the card in HTML. */
body[data-screen="puzzle-screen"] .puzzle-drawer-title,
body[data-screen="puzzle-screen"] .puzzle-drawer-instruction,
body[data-screen="puzzle-screen"] .puzzle-bird-card-art,
body[data-screen="puzzle-screen"] .puzzle-bird-paper,
body[data-screen="puzzle-screen"] .puzzle-bird-nameplate {
  display: none !important;
}

body[data-screen="puzzle-screen"] .puzzle-prototype.is-selecting {
  width: min(100vw, calc(100vh * 1672 / 941));
  aspect-ratio: 1672 / 941;
}

body[data-screen="puzzle-screen"] .puzzle-drawer-selection {
  position: relative;
  width: 100%;
  height: 100%;
  overflow: visible;
}

body[data-screen="puzzle-screen"] .puzzle-drawer-art {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: fill;
}

body[data-screen="puzzle-screen"] .puzzle-bird-list {
  position: absolute;
  inset: auto;
  left: 8.35%;
  top: 19.2%;
  width: 83.4%;
  height: 49.8%;
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  grid-template-rows: repeat(2, minmax(0, 1fr));
  column-gap: 2.45%;
  row-gap: 3.1%;
  overflow: visible;
}

body[data-screen="puzzle-screen"] .puzzle-drawer-slot {
  position: relative;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  isolation: isolate;
}

body[data-screen="puzzle-screen"] .puzzle-bird-card {
  position: absolute;
  left: 20%;
  width: 58%;
  height: auto;
  aspect-ratio: 2 / 3;
  padding: 0;
  border: 0;
  background: transparent;
  cursor: pointer;
  box-shadow: none;
  overflow: visible;
  transform-origin: center bottom;
  transition:
    transform 320ms cubic-bezier(.2, .84, .2, 1),
    bottom 320ms cubic-bezier(.2, .84, .2, 1),
    left 320ms cubic-bezier(.2, .84, .2, 1),
    width 320ms cubic-bezier(.2, .84, .2, 1),
    filter 320ms ease;
}

body[data-screen="puzzle-screen"] .puzzle-bird-card:focus-visible {
  outline: .18rem solid rgba(255, 227, 140, .95);
  outline-offset: .18rem;
}

body[data-screen="puzzle-screen"] .puzzle-bird-card-image {
  display: block;
  width: 100%;
  height: auto;
  pointer-events: none;
  user-select: none;
}

body[data-screen="puzzle-screen"] .puzzle-drawer-slot[data-puzzle-depth="rear"] .puzzle-bird-card {
  bottom: -42%;
  filter: drop-shadow(0 .28rem .34rem rgba(20, 10, 2, .34));
}

body[data-screen="puzzle-screen"] .puzzle-drawer-slot[data-puzzle-depth="front"] .puzzle-bird-card {
  bottom: -54%;
  filter: drop-shadow(0 .26rem .28rem rgba(18, 9, 2, .28));
}

body[data-screen="puzzle-screen"] .puzzle-drawer-slot:not(.is-selected) .puzzle-bird-card:hover,
body[data-screen="puzzle-screen"] .puzzle-drawer-slot:not(.is-selected) .puzzle-bird-card:focus-visible {
  transform: translateY(-2%);
  filter: drop-shadow(0 .42rem .46rem rgba(20, 10, 2, .44));
}

body[data-screen="puzzle-screen"] .puzzle-drawer-slot.is-selected {
  z-index: 12;
  overflow: visible;
}

body[data-screen="puzzle-screen"] .puzzle-drawer-slot.is-selected .puzzle-bird-card {
  left: 11%;
  width: 76%;
  bottom: -26%;
  transform: translateY(-46%);
  filter: drop-shadow(0 1.15rem .92rem rgba(16, 8, 1, .54));
}

body[data-screen="puzzle-screen"] .puzzle-bird-choice-actions {
  position: absolute;
  z-index: 14;
  display: none !important;
  left: 21%;
  bottom: 2.8%;
  width: 58%;
  height: 12.5%;
  gap: 9%;
  align-items: stretch;
}

body[data-screen="puzzle-screen"] .puzzle-drawer-slot.is-selected .puzzle-bird-choice-actions {
  display: flex !important;
}

body[data-screen="puzzle-screen"] .puzzle-bird-choice-actions .brass-action-button {
  flex: 1 1 0;
  padding: 0;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: transparent;
  font-size: 0;
  box-shadow: none;
  text-shadow: none;
}

body[data-screen="puzzle-screen"] .puzzle-bird-choice-actions .brass-action-button:hover,
body[data-screen="puzzle-screen"] .puzzle-bird-choice-actions .brass-action-button:focus-visible {
  outline: .12rem solid rgba(255, 235, 165, .96);
  outline-offset: .06rem;
  filter: brightness(1.08);
  transform: none;
}

body[data-screen="puzzle-screen"] .puzzle-home-latch {
  top: 75.1%;
  width: 16.2%;
  height: 18.8%;
  color: transparent;
  font-size: 0;
  text-shadow: none;
}

@media (max-width: 760px) {
  body[data-screen="puzzle-screen"] .puzzle-bird-list {
    left: 8.1%;
    width: 84%;
    column-gap: 2.1%;
  }

  body[data-screen="puzzle-screen"] .puzzle-drawer-slot[data-puzzle-depth="rear"] .puzzle-bird-card {
    width: 62%;
    left: 18%;
  }

  body[data-screen="puzzle-screen"] .puzzle-drawer-slot[data-puzzle-depth="front"] .puzzle-bird-card {
    width: 62%;
    left: 18%;
  }

  body[data-screen="puzzle-screen"] .puzzle-drawer-slot.is-selected .puzzle-bird-card {
    left: 8%;
    width: 82%;
    transform: translateY(-40%);
  }
}

/* Final selection redesign: exhibition-style card wall + spotlight preview. */
body[data-screen="puzzle-screen"] .puzzle-prototype.is-selecting {
  display: block;
  width: min(1380px, calc(100vw - 2rem));
  max-width: 1380px;
  aspect-ratio: auto;
  margin: 1.1rem auto 0;
}

body[data-screen="puzzle-screen"] .puzzle-drawer-selection.puzzle-selection-stage {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1.18fr) minmax(320px, 430px);
  gap: 1.35rem;
  min-height: min(82vh, 860px);
  padding: clamp(1.2rem, 2vw, 1.8rem);
  overflow: hidden;
  border: 1px solid rgba(255, 245, 222, 0.18);
  border-radius: 2rem;
  background:
    radial-gradient(circle at top left, rgba(244, 221, 157, 0.2), transparent 24%),
    radial-gradient(circle at 88% 18%, rgba(145, 197, 171, 0.16), transparent 20%),
    linear-gradient(145deg, rgba(11, 26, 25, 0.94), rgba(18, 39, 34, 0.92) 42%, rgba(74, 56, 28, 0.84)),
    url("../image/generated/home-forest-mural.png");
  background-size: auto, auto, auto, cover;
  background-position: 0 0, 0 0, 0 0, center;
  box-shadow:
    inset 0 1px 0 rgba(255, 247, 227, 0.08),
    0 1.8rem 4rem rgba(3, 9, 10, 0.45);
}

body[data-screen="puzzle-screen"] .puzzle-selection-backdrop {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(115deg, rgba(255, 244, 211, 0.08), transparent 30%),
    radial-gradient(circle at 20% 24%, rgba(255, 232, 158, 0.14), transparent 22%),
    linear-gradient(180deg, rgba(255,255,255,0.06), transparent 38%);
}

body[data-screen="puzzle-screen"] .puzzle-selection-copy,
body[data-screen="puzzle-screen"] .puzzle-selection-gallery,
body[data-screen="puzzle-screen"] .puzzle-selection-preview,
body[data-screen="puzzle-screen"] .puzzle-selection-back-button {
  position: relative;
  z-index: 1;
}

body[data-screen="puzzle-screen"] .puzzle-selection-copy {
  grid-column: 1 / 2;
  display: grid;
  gap: .55rem;
  align-self: start;
  padding: .35rem .15rem 0;
}

body[data-screen="puzzle-screen"] .puzzle-selection-eyebrow {
  margin: 0;
  color: #f4d796;
  font-size: .88rem;
  font-weight: 800;
  letter-spacing: .26em;
  text-transform: uppercase;
}

body[data-screen="puzzle-screen"] .puzzle-selection-title {
  margin: 0;
  color: #fff6dc;
  font-family: "Noto Serif TC", "Source Han Serif TC", Georgia, serif;
  font-size: clamp(2rem, 3.2vw, 3.5rem);
  line-height: 1.1;
  text-shadow: 0 .18rem .8rem rgba(8, 10, 7, 0.42);
}

body[data-screen="puzzle-screen"] .puzzle-selection-lead {
  max-width: 48rem;
  margin: 0;
  color: rgba(249, 244, 229, 0.88);
  font-size: clamp(.98rem, 1.2vw, 1.12rem);
  line-height: 1.7;
}

body[data-screen="puzzle-screen"] .puzzle-selection-gallery {
  grid-column: 1 / 2;
  display: grid;
  gap: 1rem;
  align-self: stretch;
  margin-top: .3rem;
  padding: clamp(1rem, 1.6vw, 1.4rem);
  border: 1px solid rgba(255, 243, 214, 0.12);
  border-radius: 1.6rem;
  background: linear-gradient(180deg, rgba(255,255,255,0.08), rgba(255,255,255,0.03));
  backdrop-filter: blur(12px);
}

body[data-screen="puzzle-screen"] .puzzle-selection-gallery-head {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: end;
  color: #f7ebc8;
}

body[data-screen="puzzle-screen"] .puzzle-selection-gallery-head p,
body[data-screen="puzzle-screen"] .puzzle-selection-gallery-head small {
  margin: 0;
}

body[data-screen="puzzle-screen"] .puzzle-selection-gallery-head p {
  font-family: "Noto Serif TC", "Source Han Serif TC", Georgia, serif;
  font-size: clamp(1.1rem, 1.35vw, 1.38rem);
  font-weight: 800;
}

body[data-screen="puzzle-screen"] .puzzle-selection-gallery-head small {
  color: rgba(246, 239, 220, 0.68);
  font-size: .88rem;
}

body[data-screen="puzzle-screen"] .puzzle-bird-list {
  position: relative;
  inset: auto;
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  grid-auto-rows: minmax(18rem, 1fr);
  align-items: stretch;
  gap: 1.05rem;
  width: 100%;
  height: auto;
  padding: .2rem;
}

body[data-screen="puzzle-screen"] .puzzle-drawer-slot {
  overflow: visible;
  min-height: 18rem;
}

body[data-screen="puzzle-screen"] .puzzle-bird-card {
  position: relative;
  left: auto;
  bottom: auto;
  width: 100%;
  min-height: 100%;
  aspect-ratio: 0.72;
  padding: .6rem;
  border: 0;
  border-radius: 1.45rem;
  background: linear-gradient(180deg, rgba(255, 250, 239, 0.14), rgba(255, 248, 235, 0.04));
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.32),
    0 1rem 1.6rem rgba(3, 12, 11, 0.28);
  filter: none;
  transform: translateY(0) rotate(var(--puzzle-tilt, 0deg));
  transition:
    transform 240ms ease,
    box-shadow 240ms ease,
    background 240ms ease;
}

body[data-screen="puzzle-screen"] .puzzle-bird-card:hover,
body[data-screen="puzzle-screen"] .puzzle-bird-card:focus-visible {
  transform: translateY(-10px) rotate(0deg) scale(1.02);
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.38),
    0 1.2rem 2rem rgba(4, 10, 10, 0.34);
}

body[data-screen="puzzle-screen"] .puzzle-drawer-slot.is-selected .puzzle-bird-card {
  left: auto;
  width: 100%;
  bottom: auto;
  transform: translateY(-12px) rotate(0deg) scale(1.03);
  background: linear-gradient(180deg, rgba(255, 236, 174, 0.2), rgba(255,255,255,0.05));
  box-shadow:
    inset 0 1px 0 rgba(255, 252, 240, 0.42),
    0 1.5rem 2.3rem rgba(4, 10, 10, 0.42);
}

body[data-screen="puzzle-screen"] .puzzle-bird-card-image {
  position: absolute;
  width: 1px !important;
  height: 1px !important;
  opacity: 0 !important;
  pointer-events: none;
}

body[data-screen="puzzle-screen"] .puzzle-bird-card-media {
  position: absolute;
  inset: .6rem;
  border-radius: 1rem;
  background-repeat: no-repeat;
  background-position: center;
  background-size: contain;
  z-index: 1;
}

body[data-screen="puzzle-screen"] .puzzle-bird-card-glow {
  position: absolute;
  inset: 8% 15% auto;
  height: 30%;
  border-radius: 999px;
  background: radial-gradient(circle, rgba(255, 238, 177, 0.54), transparent 68%);
  opacity: 0;
  filter: blur(12px);
  transition: opacity 240ms ease;
}

body[data-screen="puzzle-screen"] .puzzle-drawer-slot.is-selected .puzzle-bird-card-glow,
body[data-screen="puzzle-screen"] .puzzle-bird-card:hover .puzzle-bird-card-glow {
  opacity: 1;
}

body[data-screen="puzzle-screen"] .puzzle-bird-card-caption {
  position: absolute;
  right: .95rem;
  bottom: .7rem;
  left: .95rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: .8rem;
  padding: .52rem .75rem;
  border-radius: .95rem;
  background: rgba(22, 32, 29, 0.72);
  color: #f7f1df;
  backdrop-filter: blur(10px);
  z-index: 2;
}

body[data-screen="puzzle-screen"] .puzzle-bird-card-caption strong,
body[data-screen="puzzle-screen"] .puzzle-bird-card-caption small {
  margin: 0;
}

body[data-screen="puzzle-screen"] .puzzle-bird-card-caption strong {
  font-size: .92rem;
}

body[data-screen="puzzle-screen"] .puzzle-bird-card-caption small {
  color: #f3d891;
  font-size: .82rem;
  font-weight: 800;
}

body[data-screen="puzzle-screen"] .puzzle-selection-preview {
  grid-column: 2 / 3;
  grid-row: 1 / span 2;
  display: grid;
  align-content: start;
  gap: 1rem;
  padding: clamp(1rem, 1.8vw, 1.45rem);
  border: 1px solid rgba(255, 243, 214, 0.12);
  border-radius: 1.8rem;
  background:
    linear-gradient(180deg, rgba(255, 251, 242, 0.15), rgba(255, 251, 242, 0.06)),
    linear-gradient(180deg, rgba(15, 27, 25, 0.2), rgba(15, 27, 25, 0.08));
  backdrop-filter: blur(14px);
}

body[data-screen="puzzle-screen"] .puzzle-selection-kicker {
  margin: 0;
  color: #f3d590;
  font-size: .84rem;
  font-weight: 900;
  letter-spacing: .18em;
}

body[data-screen="puzzle-screen"] .puzzle-selection-preview-card {
  display: grid;
  place-items: center;
  min-height: 27rem;
  padding: 1rem;
  border-radius: 1.5rem;
  background:
    radial-gradient(circle at 50% 18%, rgba(255, 236, 188, 0.3), transparent 36%),
    linear-gradient(180deg, rgba(255,255,255,0.08), rgba(255,255,255,0.03));
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.26);
}

body[data-screen="puzzle-screen"] .puzzle-selection-preview-card img {
  position: absolute;
  width: 1px !important;
  height: 1px !important;
  opacity: 0 !important;
  pointer-events: none;
}

body[data-screen="puzzle-screen"] .puzzle-selection-preview-media {
  width: min(100%, 320px);
  height: min(100%, 460px);
  background-repeat: no-repeat;
  background-position: center;
  background-size: contain;
  filter: drop-shadow(0 1.25rem 1.5rem rgba(4, 12, 12, 0.3));
}

body[data-screen="puzzle-screen"] .puzzle-selection-preview-copy {
  display: grid;
  gap: .75rem;
}

body[data-screen="puzzle-screen"] .puzzle-selection-badges {
  display: flex;
  flex-wrap: wrap;
  gap: .55rem;
}

body[data-screen="puzzle-screen"] .puzzle-selection-badges span {
  padding: .46rem .78rem;
  border-radius: 999px;
  background: rgba(252, 244, 224, 0.12);
  color: #f8ecd0;
  font-size: .82rem;
  font-weight: 800;
}

body[data-screen="puzzle-screen"] .puzzle-selection-preview-copy h3,
body[data-screen="puzzle-screen"] .puzzle-selection-preview-copy p {
  margin: 0;
}

body[data-screen="puzzle-screen"] .puzzle-selection-preview-copy h3 {
  color: #fff6dc;
  font-family: "Noto Serif TC", "Source Han Serif TC", Georgia, serif;
  font-size: clamp(1.8rem, 2vw, 2.45rem);
  line-height: 1.15;
}

body[data-screen="puzzle-screen"] .puzzle-selection-preview-virtue {
  color: #f1d591;
  font-size: 1rem;
  font-weight: 900;
}

body[data-screen="puzzle-screen"] .puzzle-selection-preview-symbol {
  color: rgba(248, 241, 225, 0.82);
  font-size: .98rem;
  line-height: 1.7;
}

body[data-screen="puzzle-screen"] .puzzle-selection-preview-actions {
  display: flex;
  gap: .85rem;
  margin-top: .2rem;
}

body[data-screen="puzzle-screen"] .puzzle-selection-preview-actions .ghost-button,
body[data-screen="puzzle-screen"] .puzzle-selection-preview-actions .wood-button {
  flex: 1 1 0;
}

body[data-screen="puzzle-screen"] .puzzle-selection-preview-actions button:disabled {
  opacity: .45;
  cursor: not-allowed;
  transform: none;
  filter: grayscale(.2);
}

body[data-screen="puzzle-screen"] .puzzle-selection-back-button {
  position: absolute;
  top: 1.1rem;
  right: 1.1rem;
  z-index: 2;
}

body[data-screen="puzzle-screen"] #global-home-button {
  opacity: 0;
  pointer-events: none;
}

body[data-screen="puzzle-screen"] .puzzle-drawer-art,
body[data-screen="puzzle-screen"] .puzzle-drawer-title,
body[data-screen="puzzle-screen"] .puzzle-drawer-instruction,
body[data-screen="puzzle-screen"] .puzzle-bird-choice-actions,
body[data-screen="puzzle-screen"] .puzzle-home-latch {
  display: none !important;
}

@media (max-width: 1080px) {
  body[data-screen="puzzle-screen"] .puzzle-drawer-selection.puzzle-selection-stage {
    grid-template-columns: 1fr;
  }

  body[data-screen="puzzle-screen"] .puzzle-selection-preview {
    grid-column: 1 / 2;
    grid-row: auto;
  }

  body[data-screen="puzzle-screen"] .puzzle-bird-list {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    grid-auto-rows: minmax(16rem, 1fr);
  }
}

@media (max-width: 760px) {
  body[data-screen="puzzle-screen"] .puzzle-prototype.is-selecting {
    width: calc(100vw - 1rem);
    margin-top: .55rem;
  }

  body[data-screen="puzzle-screen"] .puzzle-drawer-selection.puzzle-selection-stage {
    min-height: auto;
    padding: .9rem;
    border-radius: 1.35rem;
  }

  body[data-screen="puzzle-screen"] .puzzle-bird-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    grid-auto-rows: minmax(14rem, 1fr);
    gap: .85rem;
  }

  body[data-screen="puzzle-screen"] .puzzle-selection-gallery-head {
    display: grid;
  }

  body[data-screen="puzzle-screen"] .puzzle-selection-preview-card {
    min-height: 20rem;
  }

  body[data-screen="puzzle-screen"] .puzzle-selection-preview-actions {
    flex-direction: column;
  }

  body[data-screen="puzzle-screen"] .puzzle-selection-back-button {
    position: static;
    justify-self: start;
  }
}

/* Final cascade guard: remove every remnant of the former drawer grid. */
body[data-screen="puzzle-screen"] .puzzle-drawer-selection.puzzle-tabletop-selection .puzzle-drawer-slot {
  position: absolute !important;
  top: var(--card-y) !important;
  left: var(--card-x) !important;
  z-index: var(--card-depth) !important;
  width: clamp(135px, 12.8vw, 245px) !important;
  min-height: 0 !important;
  padding: 0 !important;
  overflow: visible !important;
  border: 0 !important;
  border-radius: 0 !important;
  background: none !important;
  box-shadow: none !important;
}

body[data-screen="puzzle-screen"] .puzzle-drawer-selection.puzzle-tabletop-selection .puzzle-bird-list {
  position: absolute !important;
  inset: 0 !important;
  display: block !important;
  width: 100% !important;
  height: 100% !important;
  padding: 0 !important;
}

body[data-screen="puzzle-screen"] .puzzle-drawer-selection.puzzle-tabletop-selection .puzzle-bird-card {
  position: relative !important;
  width: 100% !important;
  min-height: 0 !important;
  aspect-ratio: .58 !important;
  padding: 0 !important;
  border: 0 !important;
  border-radius: 0 !important;
  background: none !important;
  box-shadow: 0 .8rem 1.3rem rgba(24, 7, 1, .35) !important;
  transform: rotate(var(--card-tilt)) !important;
}

body[data-screen="puzzle-screen"] .puzzle-drawer-selection.puzzle-tabletop-selection .puzzle-drawer-slot.is-selected .puzzle-bird-card {
  transform: translateY(-2.05rem) rotate(0deg) scale(1.09) !important;
  box-shadow: 0 2.1rem 2.4rem rgba(23, 6, 1, .54), 0 0 0 .2rem rgba(255, 223, 151, .36) !important;
}

@media (max-width: 760px) {
  body[data-screen="puzzle-screen"] .puzzle-drawer-selection.puzzle-tabletop-selection .puzzle-drawer-slot {
    width: clamp(86px, 21vw, 145px) !important;
  }
}

/* Puzzle selection gallery: intentionally simple, light, and image-led. */
body[data-screen="puzzle-screen"] .puzzle-prototype.is-selecting {
  display: block;
  width: min(100% - 2.5rem, 1540px);
  max-width: 1540px;
  min-height: 840px;
  margin: 1.5rem auto;
}

body[data-screen="puzzle-screen"] .puzzle-drawer-selection.puzzle-gallery-selection {
  position: relative;
  min-height: 840px;
  padding: 8rem clamp(2rem, 11vw, 11.5rem) 4rem;
  overflow: hidden;
  border: 3px solid #536e2e;
  border-radius: 0;
  background: #efeee4;
  box-shadow: 0 .85rem 2rem rgba(25, 35, 14, .15);
}

body[data-screen="puzzle-screen"] .puzzle-gallery-header {
  position: absolute;
  top: 2.4rem;
  right: 17%;
  left: 17%;
  text-align: center;
}

body[data-screen="puzzle-screen"] .puzzle-gallery-header h2 {
  margin: 0;
  color: #294e26;
  font: 800 clamp(2rem, 3vw, 3.5rem) / 1.2 "Noto Serif TC", "Source Han Serif TC", serif;
  letter-spacing: .035em;
}

body[data-screen="puzzle-screen"] .puzzle-gallery-selection .puzzle-bird-list {
  position: relative;
  inset: auto;
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: clamp(1.4rem, 3vw, 3rem);
  width: 100%;
  height: auto;
  padding: 0;
}

body[data-screen="puzzle-screen"] .puzzle-gallery-selection .puzzle-drawer-slot {
  position: relative;
  top: auto;
  left: auto;
  z-index: auto;
  width: 100%;
  min-height: 0;
  padding: 0;
  overflow: visible;
  border: 0;
  background: none;
  box-shadow: none;
}

body[data-screen="puzzle-screen"] .puzzle-gallery-selection .puzzle-bird-card {
  position: relative;
  display: block;
  width: 100%;
  min-height: 0;
  aspect-ratio: .72;
  padding: 0;
  overflow: hidden;
  border: 3px solid #54732d;
  border-radius: 1.05rem;
  background: var(--card-color);
  box-shadow: 0 .5rem .9rem rgba(38, 55, 18, .18);
  cursor: pointer;
  transition: transform 180ms ease, box-shadow 180ms ease, border-color 180ms ease;
}

body[data-screen="puzzle-screen"] .puzzle-gallery-selection .puzzle-bird-card:hover,
body[data-screen="puzzle-screen"] .puzzle-gallery-selection .puzzle-bird-card:focus-visible {
  outline: none;
  transform: translateY(-.35rem);
  box-shadow: 0 .85rem 1.25rem rgba(38, 55, 18, .23);
}

body[data-screen="puzzle-screen"] .puzzle-gallery-selection .puzzle-bird-card-media {
  position: absolute;
  inset: 7% 11% 25%;
  z-index: 1;
  opacity: 0;
  background: center / contain no-repeat;
  transition: opacity 180ms ease, transform 180ms ease;
}

body[data-screen="puzzle-screen"] .puzzle-gallery-selection .is-featured .puzzle-bird-card-media {
  opacity: 1;
}

body[data-screen="puzzle-screen"] .puzzle-gallery-selection .is-selected .puzzle-bird-card {
  top: auto !important;
  left: auto !important;
  bottom: auto !important;
  border-color: #314e20 !important;
  background: var(--card-color) !important;
  transform: translateY(-.45rem) !important;
  box-shadow: 0 1rem 1.5rem rgba(38, 55, 18, .28) !important;
}

body[data-screen="puzzle-screen"] .puzzle-gallery-selection .is-selected .puzzle-bird-card-media {
  transform: scale(1.05);
}

body[data-screen="puzzle-screen"] .puzzle-gallery-selection .puzzle-bird-card-caption {
  position: absolute;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 2;
  display: grid !important;
  min-height: 24%;
  place-items: center;
  padding: .45rem;
  background: #315327;
  color: #fff;
  font: 800 clamp(1rem, 1.55vw, 1.7rem) / 1.1 "Noto Sans TC", sans-serif;
}

body[data-screen="puzzle-screen"] .puzzle-gallery-selection .puzzle-bird-card-image,
body[data-screen="puzzle-screen"] .puzzle-gallery-selection .puzzle-bird-card-glow {
  display: none !important;
}

body[data-screen="puzzle-screen"] .puzzle-gallery-back {
  position: absolute;
  top: 2.35rem;
  right: clamp(1.4rem, 3.2vw, 3.6rem);
  z-index: 5;
  padding: .62rem 1.25rem;
  border: 3px solid #4d6d27;
  border-radius: .85rem;
  background: #668b1d;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.22), 0 .25rem .4rem rgba(46, 65, 20, .18);
  color: #fff;
  font: 800 clamp(.95rem, 1.35vw, 1.35rem) / 1.2 "Noto Sans TC", sans-serif;
  cursor: pointer;
}

body[data-screen="puzzle-screen"] .puzzle-gallery-action {
  position: absolute;
  bottom: 1.6rem;
  left: 50%;
  z-index: 5;
  display: flex;
  align-items: center;
  gap: .55rem;
  transform: translateX(-50%);
  padding: .45rem .5rem .45rem 1rem;
  border: 2px solid #536e2e;
  border-radius: 999px;
  background: #f9f8f0;
  box-shadow: 0 .35rem .7rem rgba(35, 54, 19, .15);
  color: #315327;
  white-space: nowrap;
}

body[data-screen="puzzle-screen"] .puzzle-gallery-action[hidden] { display: none; }
body[data-screen="puzzle-screen"] .puzzle-gallery-action button {
  padding: .48rem .85rem;
  border: 1px solid #4d6d27;
  border-radius: 999px;
  background: #fff;
  color: #315327;
  font: 800 .9rem / 1.15 "Noto Sans TC", sans-serif;
  cursor: pointer;
}
body[data-screen="puzzle-screen"] .puzzle-gallery-action #puzzle-selection-confirm-button { background: #668b1d; color: #fff; }

body[data-screen="puzzle-screen"] .puzzle-gallery-selection .puzzle-drawer-art,
body[data-screen="puzzle-screen"] .puzzle-gallery-selection .puzzle-drawer-title,
body[data-screen="puzzle-screen"] .puzzle-gallery-selection .puzzle-drawer-instruction,
body[data-screen="puzzle-screen"] .puzzle-gallery-selection .puzzle-home-latch {
  display: none !important;
}

@media (max-width: 900px) {
  body[data-screen="puzzle-screen"] .puzzle-prototype.is-selecting { min-height: 0; }
  body[data-screen="puzzle-screen"] .puzzle-drawer-selection.puzzle-gallery-selection { min-height: 0; padding: 7rem 1.6rem 5.5rem; }
  body[data-screen="puzzle-screen"] .puzzle-gallery-selection .puzzle-bird-list { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (max-width: 560px) {
  body[data-screen="puzzle-screen"] .puzzle-prototype.is-selecting { width: calc(100% - 1rem); margin: .5rem auto; }
  body[data-screen="puzzle-screen"] .puzzle-drawer-selection.puzzle-gallery-selection { padding: 6.2rem 1rem 5.5rem; }
  body[data-screen="puzzle-screen"] .puzzle-gallery-header { top: 1.5rem; right: 4rem; left: 1rem; text-align: left; }
  body[data-screen="puzzle-screen"] .puzzle-gallery-header h2 { font-size: 1.6rem; }
  body[data-screen="puzzle-screen"] .puzzle-gallery-back { top: 1.25rem; right: .85rem; padding: .5rem .6rem; font-size: .8rem; }
  body[data-screen="puzzle-screen"] .puzzle-gallery-selection .puzzle-bird-list { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; }
  body[data-screen="puzzle-screen"] .puzzle-gallery-action span { display: none; }
}

/* Final visual direction: supplied wood background + always-visible cutout animals. */
body[data-screen="puzzle-screen"] {
  background: #2c1609;
}

body[data-screen="puzzle-screen"] .app-shell,
body[data-screen="puzzle-screen"] main {
  background: transparent;
}

body[data-screen="puzzle-screen"] .puzzle-prototype.is-selecting {
  width: 100%;
  max-width: none;
  min-height: 100svh;
  margin: 0;
}

body[data-screen="puzzle-screen"] .puzzle-drawer-selection.puzzle-gallery-selection {
  min-height: 100svh;
  padding: 8rem clamp(2rem, 11vw, 11.5rem) 4rem;
  border: 0;
  border-radius: 0;
  background: url("../image/generated/puzzle-selection-wood-background.png") center / cover no-repeat;
  box-shadow: none;
}

body[data-screen="puzzle-screen"] .puzzle-gallery-header h2 {
  color: #fff4db;
  text-shadow: 0 .2rem .45rem rgba(29, 12, 2, .7);
}

body[data-screen="puzzle-screen"] .puzzle-gallery-selection .puzzle-bird-card {
  background: #fbf7ea;
  border-color: #5d7830;
}

body[data-screen="puzzle-screen"] .puzzle-gallery-selection .puzzle-bird-card-media,
body[data-screen="puzzle-screen"] .puzzle-gallery-selection .is-featured .puzzle-bird-card-media {
  opacity: 1;
}

body[data-screen="puzzle-screen"] .puzzle-gallery-selection .is-selected .puzzle-bird-card {
  top: auto !important;
  left: auto !important;
  bottom: auto !important;
  background: #fbf7ea !important;
  border-color: #d2a553 !important;
  transform: translateY(-.35rem) !important;
}

body[data-screen="puzzle-screen"] .puzzle-gallery-selection .puzzle-bird-card-caption {
  place-items: center !important;
  justify-content: center !important;
  text-align: center !important;
}

@media (max-width: 900px) {
  body[data-screen="puzzle-screen"] .puzzle-drawer-selection.puzzle-gallery-selection {
    min-height: 100svh;
  }
}

/* Final selection-page palette. Kept last so old drawer styles cannot override it. */
body[data-screen="puzzle-screen"] .puzzle-drawer-selection.puzzle-gallery-selection {
  background: url("../image/generated/puzzle-selection-wood-background-1920x1080.png") center / cover no-repeat !important;
}

body[data-screen="puzzle-screen"] .puzzle-gallery-header h2 {
  color: #fff0d2 !important;
  font-size: clamp(2.35rem, 3.65vw, 4.15rem) !important;
}

body[data-screen="puzzle-screen"] .puzzle-gallery-selection .puzzle-bird-card {
  border-color: #a16f40 !important;
  background: #fbf7ea !important;
  box-shadow: 0 .55rem 1rem rgba(24, 10, 3, .42) !important;
}

body[data-screen="puzzle-screen"] .puzzle-gallery-selection .puzzle-bird-card-caption {
  min-height: 25% !important;
  background: #4a2d18 !important;
  color: #fff7e7 !important;
  font-size: 24px !important;
  letter-spacing: .035em;
}

body[data-screen="puzzle-screen"] .puzzle-gallery-selection .is-selected .puzzle-bird-card {
  top: auto !important;
  left: auto !important;
  bottom: auto !important;
  background: #fbf7ea !important;
  border-color: #d7a45f !important;
  transform: translateY(-.35rem) !important;
}

body[data-screen="puzzle-screen"] .puzzle-gallery-back {
  border-color: #d7a45f !important;
  background: #6a3e1e !important;
  color: #fff4de !important;
  box-shadow: inset 0 1px 0 rgba(255, 232, 190, .28), 0 .3rem .55rem rgba(26, 10, 3, .42) !important;
}

body[data-screen="puzzle-screen"] .screen-stack {
  padding: 0 !important;
}

/* Final rules dialog sizing and the explicit playing-state visibility guard. */
#puzzle-dialog .puzzle-rules-card {
  padding: clamp(1.45rem, 3.4vw, 2.45rem) !important;
}
#puzzle-dialog .puzzle-rules-card h2 {
  margin: 0 0 .8rem !important;
  font-size: clamp(2.25rem, 3.4vw, 3.45rem) !important;
}
#puzzle-dialog .puzzle-rules-intro {
  margin-bottom: 1.35rem !important;
  font-size: clamp(1.05rem, 1.45vw, 1.32rem) !important;
}
#puzzle-dialog .puzzle-rules-list { gap: .78rem; }
#puzzle-dialog .puzzle-rules-list li { grid-template-columns: 2.65rem 1fr; gap: .85rem; padding: .82rem 1rem; }
#puzzle-dialog .puzzle-rules-list span { width: 2.28rem; height: 2.28rem; font-size: 1rem; }
#puzzle-dialog .puzzle-rules-list p { font-size: clamp(1rem, 1.35vw, 1.2rem) !important; line-height: 1.55; }
#puzzle-dialog .puzzle-rules-actions { margin-top: 1.5rem; gap: .9rem; }
#puzzle-dialog .puzzle-rules-actions .brass-action-button { min-height: 3rem; padding: .78rem 1.35rem; font-size: 1.08rem; }
#puzzle-dialog .puzzle-rules-crest,
#puzzle-dialog .card-label { display: none !important; }
body[data-screen="puzzle-screen"] .puzzle-prototype.is-playing { display: block !important; }
body[data-screen="puzzle-screen"] .puzzle-prototype.is-playing .puzzle-sidebar { display: none !important; }
body[data-screen="puzzle-screen"] .puzzle-prototype.is-playing .puzzle-workshop { display: grid !important; }

/* The gallery replaces the legacy .puzzle-sidebar at runtime, so it needs its
   own playing-state rule. Without this the workshop is rendered below the
   selection cards and appears as though the game has not started. */
body[data-screen="puzzle-screen"] .puzzle-prototype.is-playing > .puzzle-gallery-selection {
  display: none !important;
}

body[data-screen="puzzle-screen"] .puzzle-prototype.is-playing .puzzle-workshop {
  min-height: 100svh;
  margin: 0 !important;
}

/* Keep the rules readable on a full-HD display without crowding the controls. */
#puzzle-dialog .puzzle-rules-intro {
  font-size: clamp(1.12rem, 1.45vw, 1.35rem) !important;
}

#puzzle-dialog .puzzle-rules-list p {
  font-size: clamp(1.1rem, 1.35vw, 1.28rem) !important;
}

/* Puzzle play: one timber tabletop, one central restoration frame, and pieces
   scattered around it. The workshop itself is deliberately transparent so it
   never reads as a second background panel. */
body[data-screen="puzzle-screen"] .puzzle-prototype.is-playing .puzzle-workshop {
  width: 100%;
  min-height: 100svh;
  padding: clamp(1.15rem, 2.25vw, 2.5rem) clamp(1.25rem, 4vw, 5rem) 1.35rem !important;
  gap: clamp(.8rem, 1.6vw, 1.35rem);
  border: 0 !important;
  border-radius: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
  overflow: visible !important;
}

body[data-screen="puzzle-screen"] .puzzle-prototype.is-playing .puzzle-workshop-head {
  padding: .3rem 0 !important;
  border: 0 !important;
  border-radius: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
}

body[data-screen="puzzle-screen"] .puzzle-prototype.is-playing .puzzle-workshop-head .card-label,
body[data-screen="puzzle-screen"] .puzzle-prototype.is-playing .puzzle-workshop-head h3 {
  color: #fff3d8 !important;
  text-shadow: 0 .16rem .35rem rgba(30, 12, 3, .76);
}

body[data-screen="puzzle-screen"] .puzzle-prototype.is-playing .puzzle-workbench {
  min-height: clamp(35rem, 74vh, 51rem);
  border: 0 !important;
  border-radius: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
  overflow: visible !important;
}

body[data-screen="puzzle-screen"] .puzzle-prototype.is-playing .puzzle-workbench::before {
  display: none;
}

body[data-screen="puzzle-screen"] .puzzle-prototype.is-playing .puzzle-piece-tray {
  display: none !important;
}

body[data-screen="puzzle-screen"] .puzzle-prototype.is-playing .puzzle-target-frame {
  border: 0;
  border-radius: .4rem;
  background: rgba(25, 16, 10, .44);
  box-shadow: 0 .8rem 1.5rem rgba(24, 9, 2, .38);
}

body[data-screen="puzzle-screen"] .puzzle-prototype.is-playing .puzzle-actions {
  margin: 0;
  justify-content: center;
}

/* A calmer, story-led rules card: playful enough to invite a child, without
   relying on cartoon decoration. */
#puzzle-dialog .puzzle-rules-card {
  border-color: #d9ad63 !important;
  background:
    radial-gradient(circle at 16% 10%, rgba(255, 247, 211, .92), transparent 32%),
    linear-gradient(145deg, #f7dfa5, #c79343) !important;
  box-shadow: inset 0 0 0 .18rem rgba(255, 242, 199, .46), 0 1.25rem 2.8rem rgba(23, 9, 2, .42) !important;
}

#puzzle-dialog .puzzle-rules-card h2 { color: #3f2412 !important; }
#puzzle-dialog .puzzle-rules-intro { color: #5a351a !important; font-weight: 700; }
#puzzle-dialog .puzzle-rules-list li {
  background: rgba(255, 247, 218, .75) !important;
  border-color: rgba(112, 70, 28, .24) !important;
}
#puzzle-dialog .puzzle-rules-list strong { color: #5c3314; }

@media (max-width: 900px) {
  body[data-screen="puzzle-screen"] .puzzle-prototype.is-playing .puzzle-workshop {
    padding: 1rem .8rem 1.2rem !important;
  }

  body[data-screen="puzzle-screen"] .puzzle-prototype.is-playing .puzzle-workbench {
    min-height: 34rem;
  }
}

/* Final play-screen placement: reserve the full viewport for the board so no
   piece or control bar sits below the fold. */
body[data-screen="puzzle-screen"] .puzzle-prototype.is-playing .puzzle-workshop {
  height: 100svh;
  min-height: 100svh;
  grid-template-rows: auto minmax(0, 1fr) auto !important;
  padding: .45rem clamp(1.1rem, 4vw, 5rem) .7rem !important;
  gap: .45rem;
  box-sizing: border-box;
  overflow: hidden !important;
}

body[data-screen="puzzle-screen"] .puzzle-prototype.is-playing {
  height: 100svh;
  min-height: 100svh;
  padding: 0 !important;
}

body[data-screen="puzzle-screen"] .puzzle-prototype.is-playing #puzzle-mode-label,
body[data-screen="puzzle-screen"] .puzzle-prototype.is-playing .puzzle-status-cluster,
body[data-screen="puzzle-screen"] .puzzle-prototype.is-playing #hint-puzzle-button {
  display: none !important;
}

body[data-screen="puzzle-screen"] .puzzle-prototype.is-playing .puzzle-workshop-head {
  align-items: flex-start;
  min-height: 3.15rem;
}

body[data-screen="puzzle-screen"] .puzzle-prototype.is-playing .puzzle-workshop-head h3 {
  margin: 0 !important;
  font-size: clamp(1.8rem, 2.7vw, 2.8rem) !important;
}

body[data-screen="puzzle-screen"] .puzzle-prototype.is-playing .puzzle-workbench {
  min-height: 0 !important;
  height: auto;
  overflow: hidden !important;
}

body[data-screen="puzzle-screen"] .puzzle-prototype.is-playing .puzzle-actions {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: .75rem;
  min-height: 3.4rem;
  margin: 0 !important;
  padding: .18rem 0 .05rem;
}

body[data-screen="puzzle-screen"] .puzzle-prototype.is-playing .puzzle-actions .puzzle-tool-button {
  min-width: clamp(8.6rem, 12vw, 11.5rem);
  min-height: 2.8rem;
  padding: .58rem 1.2rem;
  border: 1px solid #d5a761;
  border-radius: 999px;
  background:
    linear-gradient(180deg, #8e562d, #4b2714) !important;
  color: #fff3d8 !important;
  font-size: clamp(.94rem, 1.15vw, 1.12rem);
  font-weight: 900;
  letter-spacing: .07em;
  box-shadow:
    inset 0 1px 0 rgba(255, 234, 190, .32),
    0 .28rem .55rem rgba(25, 8, 2, .42);
}

body[data-screen="puzzle-screen"] .puzzle-prototype.is-playing .puzzle-actions .puzzle-tool-button:hover,
body[data-screen="puzzle-screen"] .puzzle-prototype.is-playing .puzzle-actions .puzzle-tool-button:focus-visible {
  background: linear-gradient(180deg, #aa7040, #5d3219) !important;
  transform: translateY(-.1rem);
}

/* The right-side record station is deliberately part of the table: aged wood,
   brass trim, and calm numeric readouts rather than generic dashboard cards. */
body[data-screen="puzzle-screen"] .puzzle-prototype.is-playing .puzzle-workshop-head h3 {
  transform: translateY(.7rem);
}

body[data-screen="puzzle-screen"] .puzzle-prototype.is-playing .puzzle-field-instruments {
  position: absolute;
  top: 10%;
  right: 2.8%;
  z-index: 35;
  width: clamp(10.8rem, 15.6%, 13.6rem);
  display: grid;
  gap: .58rem;
  padding: .72rem;
  border: .12rem solid #c99a51;
  border-radius: .95rem;
  background:
    linear-gradient(145deg, rgba(126, 74, 35, .98), rgba(54, 27, 14, .98)),
    repeating-linear-gradient(0deg, rgba(255, 219, 156, .06) 0 1px, transparent 1px .32rem);
  box-shadow:
    inset 0 0 0 .12rem rgba(42, 19, 8, .58),
    inset 0 .1rem 0 rgba(255, 231, 177, .24),
    0 .7rem 1.2rem rgba(25, 8, 2, .42);
}

body[data-screen="puzzle-screen"] .puzzle-field-instruments > p {
  margin: 0 0 .05rem;
  color: #f9e4b5;
  font-family: "Noto Serif TC", "Source Han Serif TC", serif;
  font-size: clamp(.9rem, 1.05vw, 1.1rem);
  font-weight: 800;
  letter-spacing: .14em;
  text-align: center;
}

body[data-screen="puzzle-screen"] .puzzle-field-instrument,
body[data-screen="puzzle-screen"] .puzzle-field-progress {
  position: relative;
  display: grid;
  justify-items: center;
  gap: .16rem;
  min-height: 4.55rem;
  padding: .58rem .45rem .48rem;
  border: 1px solid rgba(248, 212, 143, .6);
  border-radius: .7rem;
  background:
    radial-gradient(circle at 50% 18%, rgba(255, 244, 205, .3), transparent 36%),
    linear-gradient(180deg, #f5d993, #c08a3f);
  box-shadow: inset 0 0 0 1px rgba(93, 50, 19, .2), inset 0 -.28rem .5rem rgba(101, 53, 16, .15);
}

body[data-screen="puzzle-screen"] .puzzle-field-instrument > span,
body[data-screen="puzzle-screen"] .puzzle-field-progress > span {
  color: #67401e;
  font-size: .7rem;
  font-weight: 900;
  letter-spacing: .12em;
}

body[data-screen="puzzle-screen"] .puzzle-field-instrument strong,
body[data-screen="puzzle-screen"] .puzzle-field-progress strong {
  color: #332313;
  font-family: "Aptos Display", "Segoe UI", "Noto Sans TC", sans-serif;
  font-size: clamp(1.4rem, 1.65vw, 1.85rem);
  font-variant-numeric: tabular-nums lining-nums;
  font-weight: 800;
  letter-spacing: .025em;
  line-height: 1;
}

body[data-screen="puzzle-screen"] .puzzle-field-instrument small,
body[data-screen="puzzle-screen"] .puzzle-field-progress small {
  margin-left: .15rem;
  color: #67401e;
  font-family: "Noto Sans TC", sans-serif;
  font-size: .68em;
}

body[data-screen="puzzle-screen"] .puzzle-field-instrument--time::before,
body[data-screen="puzzle-screen"] .puzzle-field-instrument--moves::before {
  position: absolute;
  top: .4rem;
  left: .5rem;
  color: rgba(101, 60, 26, .62);
  font-family: Georgia, serif;
  font-size: .9rem;
}

body[data-screen="puzzle-screen"] .puzzle-field-instrument--time::before { content: "◷"; }
body[data-screen="puzzle-screen"] .puzzle-field-instrument--moves::before { content: "◇"; }

body[data-screen="puzzle-screen"] .puzzle-field-progress { min-height: 3.6rem; }

body[data-screen="puzzle-screen"] .puzzle-prototype.is-playing .puzzle-actions {
  transform: translateY(-1.2rem);
}

@media (max-width: 900px) {
  body[data-screen="puzzle-screen"] .puzzle-prototype.is-playing .puzzle-field-instruments {
    top: 12%;
    right: 1.4%;
    width: 9.2rem;
    padding: .5rem;
  }
}

/* Ranking: dynamic names and numbers sit on their own grid tracks, never on
   the painted medals or list dividers. Numeric values use one lining font. */
body[data-screen="title-screen"] .ranking-page {
  width: min(96vw, 92rem) !important;
  height: min(calc(100svh - 1.2rem), 62rem) !important;
  grid-template-rows: auto auto minmax(0, 1fr) auto !important;
  gap: clamp(.45rem, .8vw, .85rem) !important;
  padding: clamp(.55rem, 1vw, 1rem) !important;
  box-sizing: border-box;
}

body[data-screen="title-screen"] .ranking-current-card {
  width: min(100%, 62rem) !important;
  grid-template-columns: minmax(17rem, 1.28fr) repeat(3, minmax(6rem, .48fr)) !important;
}

body[data-screen="title-screen"] .leaderboard-list {
  width: min(100%, 82rem) !important;
  height: 100% !important;
  min-height: 0 !important;
  grid-template-columns: minmax(31rem, 1.16fr) minmax(25rem, .84fr) !important;
  align-items: stretch !important;
  gap: clamp(1.2rem, 2.4vw, 2.55rem) !important;
}

body[data-screen="title-screen"] .ranking-podium {
  min-height: 0 !important;
  height: 100%;
  padding-bottom: clamp(1.2rem, 1.8vw, 1.85rem) !important;
}

body[data-screen="title-screen"] .ranking-medal-card {
  display: grid !important;
  grid-template-rows: auto auto auto auto !important;
  align-content: start !important;
  justify-items: center !important;
  min-height: 0 !important;
  padding: clamp(3.6rem, 4.4vw, 4.65rem) .8rem 1rem !important;
  overflow: hidden;
}

body[data-screen="title-screen"] .ranking-medal-1 { height: 76%; }
body[data-screen="title-screen"] .ranking-medal-2 { height: 64%; }
body[data-screen="title-screen"] .ranking-medal-3 { height: 57%; }

body[data-screen="title-screen"] .ranking-medal-card > strong {
  margin: 0 !important;
  line-height: 1.2;
}

body[data-screen="title-screen"] .ranking-player-name {
  margin-top: clamp(.5rem, .85vw, .8rem) !important;
  max-width: 100%;
  overflow-wrap: anywhere;
  line-height: 1.25 !important;
}

body[data-screen="title-screen"] .ranking-player-time,
body[data-screen="title-screen"] .ranking-player-steps {
  margin-top: .1rem;
  line-height: 1.15 !important;
}

body[data-screen="title-screen"] .honor-board {
  min-height: 0 !important;
  height: 100%;
  padding-bottom: 1rem !important;
}

body[data-screen="title-screen"] .honor-scroll {
  min-height: 0;
  max-height: none !important;
  height: 100%;
}

body[data-screen="title-screen"] .honor-head,
body[data-screen="title-screen"] .honor-row {
  grid-template-columns: 2.1rem 1.8rem minmax(5.1rem, 1fr) 4.25rem 4rem !important;
}

body[data-screen="title-screen"] #result-time,
body[data-screen="title-screen"] #result-steps,
body[data-screen="title-screen"] #result-percent,
body[data-screen="title-screen"] .ranking-medal-badge,
body[data-screen="title-screen"] .ranking-player-time,
body[data-screen="title-screen"] .ranking-player-steps,
body[data-screen="title-screen"] .honor-rank,
body[data-screen="title-screen"] .honor-row span:nth-last-child(-n + 2) {
  font-family: "Aptos", "Segoe UI", "Noto Sans TC", Arial, sans-serif !important;
  font-variant-numeric: tabular-nums lining-nums;
  font-feature-settings: "tnum" 1, "lnum" 1;
  line-height: 1 !important;
}

/* Ranking artwork alignment, 2026-08-03.
   The supplied 1672 x 941 illustration is the single coordinate system for
   this screen. Fixed labels, medals, dividers and rank numbers stay in the
   artwork; HTML overlays only the live score data in its authored safe areas. */
body[data-screen="title-screen"] .ranking-page {
  container-type: inline-size;
  display: block !important;
  width: min(100vw, calc(100svh * 1672 / 941)) !important;
  height: min(100svh, calc(100vw * 941 / 1672)) !important;
  aspect-ratio: 1672 / 941;
  margin: auto !important;
  padding: 0 !important;
  overflow: hidden;
}

body[data-screen="title-screen"] #title-screen-heading,
body[data-screen="title-screen"] .ranking-current-copy > span,
body[data-screen="title-screen"] .ranking-medal-badge,
body[data-screen="title-screen"] .ranking-medal-card > strong,
body[data-screen="title-screen"] .honor-head,
body[data-screen="title-screen"] .honor-rank,
body[data-screen="title-screen"] .honor-avatar,
body[data-screen="title-screen"] .leaderboard-self-rank,
body[data-screen="title-screen"] .hero-actions {
  display: none !important;
}

body[data-screen="title-screen"] .ranking-current-card {
  top: 25.72% !important;
  left: 19.92% !important;
  display: block !important;
  width: 62.86% !important;
  height: 16.90% !important;
  padding: 0 !important;
  overflow: hidden;
}

body[data-screen="title-screen"] .ranking-current-card .title-summary {
  display: none !important;
}

body[data-screen="title-screen"] .ranking-current-card .result-stat > span {
  display: none !important;
}

body[data-screen="title-screen"] .ranking-current-card .result-stat {
  position: absolute !important;
  top: 56% !important;
  display: grid !important;
  place-items: center !important;
  height: 28% !important;
  margin: 0 !important;
  padding: 0 !important;
}

body[data-screen="title-screen"] .ranking-current-card .result-stat-time {
  left: 37.1% !important;
  width: 15.6% !important;
}

body[data-screen="title-screen"] .ranking-current-card .result-stat-steps {
  left: 54.2% !important;
  width: 15.6% !important;
}

body[data-screen="title-screen"] .ranking-current-card .result-stat-rank {
  left: 69.5% !important;
  width: 19.2% !important;
}

body[data-screen="title-screen"] .ranking-current-card .result-stat strong,
body[data-screen="title-screen"] .ranking-player-time,
body[data-screen="title-screen"] .ranking-player-steps,
body[data-screen="title-screen"] .honor-row span:nth-last-child(-n + 2) {
  color: #2f2419 !important;
  font-family: "Noto Serif TC", "Source Han Serif TC", Georgia, serif !important;
  font-variant-numeric: tabular-nums lining-nums !important;
  font-feature-settings: "tnum" 1, "lnum" 1 !important;
  font-weight: 800 !important;
  letter-spacing: .015em !important;
}

body[data-screen="title-screen"] .ranking-current-card .result-stat strong {
  max-width: 100%;
  margin: 0 !important;
  font-size: clamp(.96rem, 2.28cqw, 2.7rem) !important;
  line-height: 1 !important;
  text-align: center;
  white-space: nowrap;
}

body[data-screen="title-screen"] .ranking-podium {
  left: 0 !important;
  top: 0 !important;
  width: 100% !important;
  height: 100% !important;
}

body[data-screen="title-screen"] .ranking-medal-card {
  overflow: visible !important;
  padding: 0 !important;
}

body[data-screen="title-screen"] .ranking-medal-2 { left: 8.19% !important; top: 54.94% !important; width: 12.14% !important; height: 41.23% !important; }
body[data-screen="title-screen"] .ranking-medal-1 { left: 22.61% !important; top: 47.29% !important; width: 13.10% !important; height: 49.10% !important; }
body[data-screen="title-screen"] .ranking-medal-3 { left: 38.70% !important; top: 59.19% !important; width: 12.20% !important; height: 37.20% !important; }

body[data-screen="title-screen"] .ranking-player-name,
body[data-screen="title-screen"] .ranking-player-time,
body[data-screen="title-screen"] .ranking-player-steps {
  position: absolute;
  right: 5%;
  left: 5%;
  margin: 0 !important;
  color: #35281d !important;
  overflow: hidden;
  text-align: center;
  text-overflow: ellipsis;
}

body[data-screen="title-screen"] .ranking-player-name {
  font-family: "Noto Serif TC", "Source Han Serif TC", Georgia, serif !important;
  font-size: clamp(.78rem, 1.72cqw, 2rem) !important;
  font-weight: 800 !important;
  line-height: 1.1 !important;
  white-space: nowrap;
}

body[data-screen="title-screen"] .ranking-player-time,
body[data-screen="title-screen"] .ranking-player-steps {
  font-size: clamp(.72rem, 1.38cqw, 1.62rem) !important;
  line-height: 1 !important;
}

body[data-screen="title-screen"] .ranking-medal-1 .ranking-player-name { top: 45.5%; }
body[data-screen="title-screen"] .ranking-medal-1 .ranking-player-time { top: 56.2%; }
body[data-screen="title-screen"] .ranking-medal-1 .ranking-player-steps { top: 64.4%; }
body[data-screen="title-screen"] .ranking-medal-2 .ranking-player-name { top: 55.0%; }
body[data-screen="title-screen"] .ranking-medal-2 .ranking-player-time { top: 65.0%; }
body[data-screen="title-screen"] .ranking-medal-2 .ranking-player-steps { top: 73.0%; }
body[data-screen="title-screen"] .ranking-medal-3 .ranking-player-name { top: 60.0%; }
body[data-screen="title-screen"] .ranking-medal-3 .ranking-player-time { top: 70.0%; }
body[data-screen="title-screen"] .ranking-medal-3 .ranking-player-steps { top: 78.0%; }

body[data-screen="title-screen"] .ranking-medal-card.is-empty > :not(.ranking-medal-ribbon) {
  display: none !important;
}

body[data-screen="title-screen"] .honor-board {
  left: 57.30% !important;
  top: 44.63% !important;
  width: 38.46% !important;
  height: 52.71% !important;
}

body[data-screen="title-screen"] .honor-board h3 {
  display: none !important;
}

body[data-screen="title-screen"] .honor-scroll {
  left: 4.65% !important;
  top: 13.55% !important;
  width: 90.55% !important;
  height: 83.05% !important;
  display: grid !important;
  grid-template-rows: repeat(7, 1fr) !important;
  overflow: hidden !important;
}

body[data-screen="title-screen"] .honor-row {
  min-height: 0 !important;
  padding: 0 2% 0 14.5% !important;
  grid-template-columns: minmax(0, 38%) 28% 34% !important;
  color: #35281d !important;
}

body[data-screen="title-screen"] .honor-row strong,
body[data-screen="title-screen"] .honor-row span:nth-last-child(-n + 2) {
  display: block !important;
  min-width: 0;
  color: #35281d !important;
  font-size: clamp(.72rem, 1.72cqw, 2rem) !important;
  line-height: 1 !important;
  text-align: center !important;
  text-overflow: ellipsis;
  white-space: nowrap;
  overflow: hidden;
}

body[data-screen="title-screen"] .honor-row strong {
  padding-left: 0 !important;
  text-align: left !important;
}

body[data-screen="title-screen"] .honor-row span:nth-last-child(2)::after {
  content: none !important;
}
body[data-screen="title-screen"] .honor-row.is-empty strong,
body[data-screen="title-screen"] .honor-row.is-empty span:nth-last-child(-n + 2) {
  display: none !important;
}

@media (max-width: 980px) {
  body[data-screen="title-screen"] .ranking-page {
    width: min(100vw, calc(100svh * 1672 / 941)) !important;
    height: min(100svh, calc(100vw * 941 / 1672)) !important;
  }

  body[data-screen="title-screen"] .leaderboard-list,
  body[data-screen="title-screen"] .ranking-podium,
  body[data-screen="title-screen"] .honor-board {
    min-height: 0 !important;
  }
}

/* Keep the typography refinement after every artwork-placement override. */
body[data-screen="title-screen"] .ranking-current-card .result-stat strong,
body[data-screen="title-screen"] .honor-row strong,
body[data-screen="title-screen"] .honor-row span:nth-last-child(-n + 2) {
  font-family: "Microsoft JhengHei UI", "Microsoft JhengHei", "Noto Sans TC", sans-serif !important;
  -webkit-font-smoothing: antialiased;
  text-rendering: geometricPrecision;
}

body[data-screen="title-screen"] .ranking-current-card .result-stat strong {
  font-size: clamp(.94rem, 2.05cqw, 2.42rem) !important;
  font-weight: 700 !important;
  letter-spacing: .01em !important;
  line-height: 1.08 !important;
}

body[data-screen="title-screen"] .honor-row strong,
body[data-screen="title-screen"] .honor-row span:nth-last-child(-n + 2) {
  display: flex !important;
  height: 100%;
  align-items: center;
  justify-content: center;
  padding: 0 .2em !important;
  font-size: clamp(.7rem, 1.46cqw, 1.72rem) !important;
  font-weight: 650 !important;
  letter-spacing: .015em !important;
  line-height: 1.15 !important;
  text-align: center !important;
}

body[data-screen="title-screen"] .honor-row.is-current-player strong {
  color: #783814 !important;
  font-weight: 750 !important;
}

/* Final selected result presentation: C summary / B podium seal / C honor board. */
body[data-screen="title-screen"] .ranking-current-card .result-stat {
  grid-template-columns: 1fr !important;
  grid-template-rows: 1fr !important;
}

body[data-screen="title-screen"] .ranking-current-card .result-stat strong {
  grid-column: 1 !important;
  grid-row: 1 !important;
  align-self: center !important;
  justify-self: center !important;
}

body[data-screen="title-screen"] .ranking-current-copy {
  position: absolute !important;
  top: 18% !important;
  left: 2.6% !important;
  display: grid !important;
  width: 31.6% !important;
  height: 66% !important;
  align-items: center;
  justify-items: center;
  margin: 0 !important;
  padding: 0 !important;
}

body[data-screen="title-screen"] .ranking-current-card .title-summary {
  display: grid !important;
  width: 100% !important;
  height: 100%;
  max-width: none !important;
  margin: 0 !important;
  padding: 0 5% !important;
  align-content: center;
  justify-items: center;
  gap: .46em;
  border: 0 !important;
  background: transparent !important;
  color: #3c3024 !important;
  font-family: "Noto Serif TC", "Source Han Serif TC", "PMingLiU", serif !important;
  line-height: 1.25 !important;
  text-align: center;
  text-shadow: 0 1px 0 rgba(255, 250, 226, .82);
  box-shadow: none !important;
  box-sizing: border-box;
}

body[data-screen="title-screen"] .ranking-current-card .title-summary::before,
body[data-screen="title-screen"] .ranking-current-card .title-summary::after {
  content: none !important;
}

body[data-screen="title-screen"] .title-summary .achievement-primary,
body[data-screen="title-screen"] .title-summary .achievement-secondary {
  display: block;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

body[data-screen="title-screen"] .title-summary .achievement-primary {
  font-size: clamp(.72rem, 1.28cqw, 1.5rem);
  font-weight: 650;
  letter-spacing: .06em;
}

body[data-screen="title-screen"] .title-summary .achievement-secondary {
  color: #583923;
  font-size: clamp(.76rem, 1.42cqw, 1.66rem);
  font-weight: 750;
  letter-spacing: .045em;
}

body[data-screen="title-screen"] .title-summary .achievement-rank-number {
  display: inline-grid;
  min-width: .78em;
  place-items: center;
  color: #4b2b19;
  font-family: "Palatino Linotype", "Book Antiqua", Palatino, serif;
  font-size: 1.12em;
  font-variant-numeric: lining-nums proportional-nums;
  font-weight: 700;
  letter-spacing: 0;
  line-height: .9;
  vertical-align: .07em;
}

body[data-screen="title-screen"] .ranking-medal-card.is-current-player {
  filter: none;
}

body[data-screen="title-screen"] .ranking-medal-card.is-current-player .ranking-player-info {
  border: 0;
  background:
    radial-gradient(ellipse at 50% 52%, rgba(255, 235, 147, .48) 0%, rgba(230, 175, 72, .25) 46%, transparent 78%);
  box-shadow: none;
}

body[data-screen="title-screen"] .ranking-medal-card.is-current-player .ranking-player-name {
  color: #61391f !important;
  font-weight: 750 !important;
}

body[data-screen="title-screen"] .ranking-current-mark {
  position: absolute;
  z-index: 2;
  top: auto;
  right: -7%;
  bottom: -.48em;
  display: grid;
  width: 2.22em;
  height: 4.18em;
  padding: .18em .1em;
  place-items: center;
  border: 1.5px solid rgba(154, 48, 32, .88);
  border-radius: .14em;
  background: rgba(171, 49, 31, .065);
  color: rgba(151, 43, 29, .96);
  font-family: "Noto Serif TC", "PMingLiU", serif;
  font-size: clamp(.64rem, .92cqw, 1.08rem);
  font-weight: 900;
  -webkit-text-stroke: .22px rgba(132, 35, 24, .42);
  letter-spacing: .06em;
  line-height: 1;
  text-shadow: 0 0 .18em rgba(147, 42, 27, .18);
  writing-mode: vertical-rl;
  text-orientation: upright;
  box-shadow: 0 0 .32em rgba(141, 42, 28, .16);
  transform: rotate(-1.4deg);
}

body[data-screen="title-screen"] .honor-row {
  grid-template-columns: minmax(0, 43%) 29% 28% !important;
}

/* Optical correction for the player-name column in the painted row frame. */
body[data-screen="title-screen"] .honor-row strong {
  transform: translateX(-.34em);
}

/* Warm letterpress treatment keeps the current result legible without a modern UI box. */
body[data-screen="title-screen"] .ranking-current-card .result-stat strong {
  color: #4d321f !important;
  font-family: "Palatino Linotype", "Book Antiqua", "Noto Serif TC", "PMingLiU", serif !important;
  font-variant-numeric: lining-nums tabular-nums !important;
  font-weight: 700 !important;
  text-shadow:
    0 1px 0 rgba(255, 248, 220, .82),
    0 .08em .16em rgba(92, 55, 24, .14) !important;
}

body[data-screen="title-screen"] .honor-row.is-current-player {
  border-radius: .3rem;
  background:
    linear-gradient(90deg,
      transparent 0%,
      rgba(212, 157, 72, .1) 8%,
      rgba(246, 220, 153, .3) 25%,
      rgba(250, 229, 171, .34) 50%,
      rgba(246, 220, 153, .3) 75%,
      rgba(212, 157, 72, .1) 92%,
      transparent 100%) !important;
  box-shadow:
    inset 0 .04em 0 rgba(178, 112, 35, .12),
    inset 0 -.04em 0 rgba(178, 112, 35, .1) !important;
}

body[data-screen="title-screen"] .honor-row.is-current-player strong,
body[data-screen="title-screen"] .honor-row.is-current-player span:nth-last-child(-n + 2) {
  color: #6d3d20 !important;
  font-weight: 700 !important;
}

/* Final copy and interaction pass: clear wording hierarchy at the 1920 x 1080 exhibit size. */
body[data-screen="home-screen"] .hero-copy {
  max-width: 37rem;
  display: grid;
  gap: 0.22rem;
  line-height: 1.62;
}

body[data-screen="home-screen"] .hero-copy span {
  display: block;
}

.leaderboard-hub-dialog {
  width: min(90vw, 42rem);
}

.leaderboard-hub-card {
  display: grid;
  gap: 1.1rem;
  text-align: center;
  padding: clamp(1.8rem, 3vw, 2.6rem);
}

.leaderboard-hub-card h2 {
  color: #3e2a1c;
}

.leaderboard-hub-card > p {
  max-width: 27rem;
  margin-inline: auto;
  line-height: 1.7;
}

.leaderboard-hub-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.85rem;
}

.leaderboard-hub-actions .wood-button {
  min-height: 3.5rem;
}

#memory-intro-dialog {
  width: min(92vw, 42rem);
}

#memory-intro-dialog .memory-intro-card {
  display: grid;
  gap: 1rem;
  padding: clamp(1.45rem, 2.25vw, 2.15rem);
  overflow: hidden;
  background:
    radial-gradient(circle at 100% 0%, rgba(185, 143, 72, .17), transparent 31%),
    linear-gradient(145deg, rgba(255, 253, 246, .98), rgba(240, 232, 211, .98));
  border: 1px solid rgba(125, 88, 43, .25);
  box-shadow: 0 1.4rem 3.6rem rgba(25, 31, 22, .27), inset 0 0 0 .32rem rgba(255, 255, 255, .38);
}

#memory-intro-dialog .memory-intro-header {
  display: flex;
  align-items: center;
  gap: .8rem;
  padding-bottom: .72rem;
  border-bottom: 1px solid rgba(112, 78, 39, .2);
}

#memory-intro-dialog .memory-intro-seal {
  display: grid;
  width: 2.5rem;
  height: 2.5rem;
  place-items: center;
  border-radius: 50%;
  background: #934632;
  color: #fff4dd;
  font-family: "Noto Serif TC", "PMingLiU", serif;
  font-weight: 700;
  box-shadow: inset 0 0 0 2px rgba(255, 234, 187, .55);
}

#memory-intro-dialog .memory-intro-kicker {
  margin: 0 0 .1rem;
  color: #86643a;
  font-size: .76rem;
  font-weight: 700;
  letter-spacing: .2em;
}

#memory-intro-dialog h2 {
  margin: 0;
  color: #3d291a;
  font-size: clamp(1.75rem, 2.25vw, 2.25rem);
}

#memory-intro-dialog .memory-intro-lead {
  max-width: 34rem;
  color: #5b4630;
  font-size: clamp(.98rem, 1.2vw, 1.12rem);
  line-height: 1.72;
}

#memory-intro-dialog .memory-rules-list {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: .6rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

#memory-intro-dialog .memory-rules-list li {
  display: grid;
  grid-template-columns: 2rem 1fr;
  gap: .48rem;
  align-items: start;
  min-height: 5.25rem;
  padding: .72rem .6rem;
  border: 1px solid rgba(126, 90, 46, .2);
  border-radius: .7rem;
  background: rgba(255, 255, 255, .43);
}

#memory-intro-dialog .memory-rules-list span {
  display: grid;
  width: 2rem;
  height: 2rem;
  place-items: center;
  border-radius: 50%;
  background: #6e512d;
  color: #fff7e8;
  font-family: Georgia, "Times New Roman", serif;
  font-size: .85rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums lining-nums;
}

#memory-intro-dialog .memory-rules-list p {
  color: #5b4630;
  font-size: .82rem;
  line-height: 1.46;
}

#memory-intro-dialog .memory-rules-list strong {
  display: block;
  color: #422d1d;
  font-size: .9rem;
}

#memory-intro-dialog #confirm-memory-start {
  justify-self: center;
  min-width: 10rem;
  margin-top: .2rem;
}

/* Fixed-width lining figures prevent individual digits from appearing higher or lower in the illustrated meter. */
body[data-screen="memory-screen"] .illustrated-record-clock .timer-readout,
body[data-screen="memory-screen"] .illustrated-record-steps strong,
body[data-screen="memory-screen"] .illustrated-record-clock .timer-readout span,
body[data-screen="memory-screen"] .illustrated-record-steps strong span {
  font-family: Georgia, "Times New Roman", serif !important;
  font-variant-numeric: lining-nums tabular-nums !important;
  font-feature-settings: "lnum" 1, "tnum" 1;
  font-kerning: none;
}

@media (max-width: 720px) {
  .leaderboard-hub-actions,
  #memory-intro-dialog .memory-rules-list {
    grid-template-columns: 1fr;
  }

  #memory-intro-dialog .memory-rules-list li {
    min-height: 0;
  }
}

/* Keep exhibition headings on deliberate phrase breaks at the 16:9 installation ratio. */
body[data-screen="home-screen"] .hero-panel h2 > span,
body[data-screen="menu-screen"] .section-heading h2 > span {
  display: block;
}

/* The memory rules intentionally share the same visual language as the puzzle rules. */
#memory-intro-dialog {
  width: min(94vw, 54rem);
}

#memory-intro-dialog .memory-rules-card {
  padding: clamp(2rem, 3vw, 3rem);
}

#memory-intro-dialog .puzzle-rules-intro {
  max-width: 42rem;
  margin-inline: auto;
}

#memory-intro-dialog .puzzle-rules-list {
  max-width: 46rem;
  margin-inline: auto;
}

/* Use familiar sans-serif lining figures for the illustrated timer and step counter. */
body[data-screen="memory-screen"] .illustrated-record-clock .timer-readout,
body[data-screen="memory-screen"] .illustrated-record-steps strong,
body[data-screen="memory-screen"] .illustrated-record-clock .timer-readout span,
body[data-screen="memory-screen"] .illustrated-record-steps strong span {
  font-family: Arial, Helvetica, sans-serif !important;
  font-weight: 700 !important;
  font-variant-numeric: lining-nums tabular-nums !important;
  font-feature-settings: "lnum" 1, "tnum" 1;
}

/* Sprint refinement: 1920 x 1080 exhibit pass. */
body[data-screen="home-screen"] .hero-copy {
  max-width: 42rem;
  gap: .38rem;
}

body[data-screen="home-screen"] .hero-panel {
  max-width: min(70rem, 92vw);
}

body[data-screen="home-screen"] .hero-panel h2 {
  width: min(100%, 69rem);
  max-width: none !important;
  font-size: clamp(3.35rem, 4.15vw, 5.1rem) !important;
  line-height: 1.12;
}

/* The foreground uses six individually timed leaves rather than a uniform
   particle loop. Their motion is deliberately slow enough to stay peripheral. */
body[data-screen="home-screen"] .floating-seeds span {
  width: .55rem;
  height: .9rem;
  border-radius: 90% 8% 90% 8%;
  background: linear-gradient(135deg, rgba(214, 176, 91, .84), rgba(91, 116, 55, .72));
  box-shadow: .08rem .12rem .16rem rgba(29, 42, 25, .18);
  transform-origin: 50% -180%;
  animation: homeLeafFall var(--leaf-duration, 13s) cubic-bezier(.34, .08, .45, 1) infinite;
}

body[data-screen="home-screen"] .floating-seeds span:nth-child(1) { --leaf-duration: 15.8s; animation-delay: -8.2s; }
body[data-screen="home-screen"] .floating-seeds span:nth-child(2) { --leaf-duration: 18.4s; animation-delay: -3.6s; opacity: .62; }
body[data-screen="home-screen"] .floating-seeds span:nth-child(3) { --leaf-duration: 13.7s; animation-delay: -10.1s; opacity: .72; }
body[data-screen="home-screen"] .floating-seeds span:nth-child(4) { --leaf-duration: 20.2s; animation-delay: -4.8s; opacity: .48; }
body[data-screen="home-screen"] .floating-seeds span:nth-child(5) { --leaf-duration: 16.6s; animation-delay: -12.4s; opacity: .58; }
body[data-screen="home-screen"] .floating-seeds span:nth-child(6) { --leaf-duration: 22.8s; animation-delay: -1.9s; opacity: .42; }

body[data-screen="home-screen"] .atmosphere-front::before,
body[data-screen="home-screen"] .atmosphere-front::after {
  animation: canopySway 9.5s cubic-bezier(.45, 0, .55, 1) infinite alternate;
  transform-origin: 50% 100%;
}

@keyframes homeLeafFall {
  0% { transform: translate3d(0, -8vh, 0) rotate(18deg) scale(.74); opacity: 0; }
  9% { opacity: var(--leaf-opacity, .76); }
  38% { transform: translate3d(2.6vw, 20vh, 0) rotate(132deg) scale(.95); }
  71% { transform: translate3d(-1.9vw, 48vh, 0) rotate(248deg) scale(.82); }
  100% { transform: translate3d(3.2vw, 76vh, 0) rotate(390deg) scale(.72); opacity: 0; }
}

@keyframes canopySway {
  from { transform: translate3d(-.3vw, 0, 0) rotate(-.22deg); }
  to { transform: translate3d(.42vw, .16vh, 0) rotate(.32deg); }
}

body[data-screen="menu-screen"] #menu-screen {
  gap: clamp(2rem, 4vh, 3.1rem);
}

body[data-screen="menu-screen"] #menu-screen .section-heading {
  max-width: 48rem;
  padding: clamp(1.35rem, 2vw, 2rem) clamp(1.5rem, 2.5vw, 2.5rem);
}

body[data-screen="menu-screen"] #menu-screen .section-heading h2 {
  margin-bottom: clamp(1rem, 1.8vh, 1.55rem);
}

body[data-screen="menu-screen"] .menu-map {
  background:
    linear-gradient(180deg, rgba(245, 239, 219, .08), rgba(51, 64, 43, .2)),
    url("../image/generated/exploration-route-map-v1.png") center / cover;
}

body[data-screen="menu-screen"] .menu-zone {
  min-height: clamp(12.5rem, 24vh, 16.5rem);
  border: 1px solid rgba(255, 244, 211, .46);
  backdrop-filter: blur(3px);
}

/* Bring the memory rules card to the puzzle-card rhythm: one visual unit per
   rule, with enough breathing room for a child to scan it in order. */
#memory-intro-dialog .puzzle-rules-card {
  width: min(42rem, calc(100vw - 2rem));
  padding: clamp(2rem, 3.4vw, 2.8rem) !important;
}

#memory-intro-dialog .puzzle-rules-intro {
  margin-bottom: 1.45rem !important;
}

#memory-intro-dialog .puzzle-rules-list {
  gap: .82rem;
}

#memory-intro-dialog .puzzle-rules-list li {
  min-height: 4.55rem;
  padding: .82rem 1rem;
}

/* The artwork already contains the units, so move only the live figures down
   onto the illustrated baseline. */
body[data-screen="memory-screen"] .illustrated-record-clock .timer-readout {
  top: 53.6%;
}

body[data-screen="memory-screen"] .illustrated-record-steps strong {
  top: 53.2%;
}

/* Keep live separators understated; the former bright white SVG outline was
   the visible source of the apparent white halo around puzzle pieces. */
body[data-screen="puzzle-screen"] .svg-puzzle-border {
  stroke: rgba(105, 76, 45, .64);
  stroke-width: 1.15;
  filter: drop-shadow(0 .04rem 0 rgba(31, 20, 11, .38));
}

body[data-screen="puzzle-screen"] .svg-puzzle-piece.locked {
  filter: drop-shadow(0 0 .05rem rgba(50, 39, 25, .2));
}

body[data-screen="puzzle-screen"] .puzzle-prototype.is-playing .puzzle-workshop-head h3 {
  transform: translateY(1.1rem);
}

body[data-screen="puzzle-screen"] .puzzle-prototype.is-playing .puzzle-actions {
  transform: translateY(-1.75rem);
}

/* Generated record art remains purely decorative. All labels and values stay
   semantic HTML so they can update per game and never suffer image-text errors. */
body[data-screen="puzzle-screen"] .puzzle-prototype.is-playing .puzzle-field-instruments {
  aspect-ratio: 2 / 3;
  width: clamp(11.8rem, 16.2%, 14.6rem);
  display: grid;
  grid-template-rows: 11% repeat(3, minmax(0, 1fr));
  gap: 2.4%;
  padding: 11.5% 14% 12%;
  border: 0;
  border-radius: 0;
  background: none center / 100% 100% no-repeat;
  box-shadow: 0 .8rem 1.35rem rgba(25, 8, 2, .34);
}

body[data-screen="puzzle-screen"] .puzzle-field-instruments > p {
  align-self: center;
  margin: 0;
  color: #4b311d;
  font-size: clamp(.82rem, .95vw, 1rem);
  text-shadow: 0 1px 0 rgba(255, 248, 226, .78);
}

body[data-screen="puzzle-screen"] .puzzle-field-instrument,
body[data-screen="puzzle-screen"] .puzzle-field-progress {
  min-height: 0;
  padding: .35rem .2rem;
  border: 0;
  border-radius: .45rem;
  background: transparent;
  box-shadow: none;
}

body[data-screen="puzzle-screen"] .puzzle-field-instrument > span,
body[data-screen="puzzle-screen"] .puzzle-field-progress > span {
  font-size: .63rem;
}

body[data-screen="puzzle-screen"] .puzzle-field-instrument--time::before,
body[data-screen="puzzle-screen"] .puzzle-field-instrument--moves::before {
  display: none;
}

body[data-screen="title-screen"] .hero-actions.leaderboard-actions {
  display: flex !important;
  justify-content: center;
  left: 50%;
  bottom: 1.6%;
  width: auto;
  transform: translateX(-50%);
}

body[data-screen="title-screen"] .leaderboard-actions #play-again-button {
  width: auto;
  min-width: clamp(8.6rem, 10vw, 11.5rem);
}

body[data-screen="title-screen"] .leaderboard-actions #choose-other-button {
  display: none;
}

@media (prefers-reduced-motion: reduce) {
  body[data-screen="home-screen"] .floating-seeds span,
  body[data-screen="home-screen"] .atmosphere-front::before,
  body[data-screen="home-screen"] .atmosphere-front::after {
    animation: none;
  }
}

/* Leaderboard selection: the plaque is an illustration only; the two controls
   above it remain ordinary buttons for keyboard and screen-reader use. */
.leaderboard-hub-dialog {
  width: min(78vw, 60rem);
  border: 0;
  background: transparent;
}

.leaderboard-hub-card {
  min-height: min(50vw, 32rem);
  padding: clamp(2.8rem, 5.6vw, 5.4rem) clamp(3rem, 7vw, 6.8rem) clamp(2.5rem, 4.2vw, 4.2rem);
  background: none center / 100% 100% no-repeat;
  box-shadow: 0 1.2rem 3.8rem rgba(18, 25, 18, .38);
}

.leaderboard-hub-card h2 {
  color: #4c321d;
  text-shadow: 0 1px 0 rgba(255, 247, 222, .85);
}

.leaderboard-hub-card > p {
  max-width: 34rem;
  color: #67513a;
}

.leaderboard-hub-actions {
  align-self: end;
  gap: clamp(1rem, 2.2vw, 2rem);
}

.leaderboard-hub-actions .wood-button {
  min-height: clamp(3.6rem, 5vw, 4.6rem);
}

/* Correction pass: reserve a real interaction-free lane for the puzzle log.
   The record is intentionally not a floating card; it sits directly on the
   timber table while the SVG board is clipped before that lane begins. */
body[data-screen="puzzle-screen"] .puzzle-prototype.is-playing .puzzle-svg-board {
  inset: 0 auto 0 0 !important;
  width: 79% !important;
  overflow: hidden;
}

body[data-screen="puzzle-screen"] .puzzle-prototype.is-playing .puzzle-field-instruments {
  top: 13%;
  right: 2.3%;
  width: clamp(10.6rem, 14.4%, 12.8rem);
  aspect-ratio: auto;
  display: grid;
  grid-template-rows: auto repeat(3, minmax(0, 1fr));
  gap: .45rem;
  padding: .35rem;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

body[data-screen="puzzle-screen"] .puzzle-field-instruments > p {
  margin: 0 0 .3rem;
  color: #f3d69c;
  font-size: clamp(1rem, 1.18vw, 1.26rem);
  font-weight: 900;
  letter-spacing: .16em;
  text-shadow: 0 .12rem .26rem rgba(26, 10, 2, .82);
}

body[data-screen="puzzle-screen"] .puzzle-field-instrument,
body[data-screen="puzzle-screen"] .puzzle-field-progress {
  min-height: clamp(4.8rem, 7.5vh, 6rem);
  padding: .6rem .45rem .5rem;
  border: 1px solid rgba(235, 196, 118, .72);
  border-radius: .65rem;
  background:
    radial-gradient(circle at 50% 12%, rgba(255, 246, 205, .3), transparent 38%),
    linear-gradient(180deg, rgba(248, 221, 157, .96), rgba(183, 121, 51, .96));
  box-shadow: inset 0 0 0 1px rgba(79, 39, 14, .27), 0 .22rem .38rem rgba(18, 7, 1, .32);
}

body[data-screen="puzzle-screen"] .puzzle-field-instrument > span,
body[data-screen="puzzle-screen"] .puzzle-field-progress > span {
  color: #60401f;
  font-size: clamp(.73rem, .78vw, .88rem);
}

body[data-screen="puzzle-screen"] .puzzle-field-instrument strong,
body[data-screen="puzzle-screen"] .puzzle-field-progress strong {
  font-size: clamp(1.75rem, 2vw, 2.2rem);
}

/* Keep one coherent map: the generated workshop art no longer sits beneath
   the two destination cards. It is used only as a quiet puzzle-rules texture. */
body[data-screen="menu-screen"] .menu-map {
  background:
    linear-gradient(180deg, rgba(247, 240, 225, .16), rgba(247, 240, 225, .09)),
    url("../image/generated/menu-ecology-map.png") center / cover;
}

#puzzle-dialog .puzzle-rules-card {
  background:
    linear-gradient(145deg, rgba(247, 223, 165, .94), rgba(197, 147, 67, .94)),
    url("../image/generated/exploration-route-map-v1.png") center / cover !important;
}

/* Match the puzzle explanation's reading rhythm: a wider card, enlarged copy,
   and visible white space between the title, introduction, each rule, and CTA. */
#memory-intro-dialog {
  width: min(94vw, 56rem);
}

#memory-intro-dialog .memory-rules-card {
  width: min(100%, 56rem);
  padding: clamp(2.35rem, 4vw, 3.5rem) !important;
}

#memory-intro-dialog .puzzle-rules-card h2 {
  margin-bottom: 1.2rem !important;
  font-size: clamp(2.35rem, 3.6vw, 3.55rem) !important;
}

#memory-intro-dialog .puzzle-rules-intro {
  margin-bottom: 1.8rem !important;
  font-size: clamp(1.28rem, 1.55vw, 1.55rem) !important;
  line-height: 1.7;
}

#memory-intro-dialog .puzzle-rules-list {
  gap: 1.05rem;
}

#memory-intro-dialog .puzzle-rules-list li {
  grid-template-columns: 3rem 1fr;
  gap: 1rem;
  min-height: 5.4rem;
  padding: 1rem 1.15rem;
}

#memory-intro-dialog .puzzle-rules-list span {
  width: 2.6rem;
  height: 2.6rem;
  font-size: 1.15rem;
}

#memory-intro-dialog .puzzle-rules-list p {
  font-size: clamp(1.2rem, 1.45vw, 1.45rem) !important;
  line-height: 1.62;
}

#memory-intro-dialog .puzzle-rules-list strong {
  font-size: 1.08em;
}

#memory-intro-dialog .puzzle-rules-actions {
  margin-top: 1.8rem;
}

/* The close action belongs outside the two painted selection wells. */
.leaderboard-hub-card > .ghost-button[data-close-dialog="about-dialog"] {
  justify-self: end;
  min-width: 5.5rem;
  margin-top: -.3rem;
  padding: .5rem .95rem;
  background: rgba(82, 54, 29, .74);
  color: #fff2d1;
}

/* User-supplied final artwork pass (1920 x 1080).
   Static labels live in the supplied images; HTML remains only for accessible
   hit areas and values that actually change during play. */

/* Game selection: remove the redundant illustrated panel behind the two cards. */
body[data-screen="menu-screen"] .menu-map {
  background: none !important;
  border: 0 !important;
  border-radius: 0 !important;
  box-shadow: none !important;
  backdrop-filter: none !important;
}

/* Leaderboard selector: one supplied image with three mapped hit regions. */
.leaderboard-hub-dialog {
  width: min(96vw, 96rem, 150vh) !important;
  max-width: none !important;
  padding: 0 !important;
  border: 0 !important;
  background: transparent !important;
  overflow: visible;
}

.leaderboard-hub-card {
  position: relative;
  display: block !important;
  width: 100%;
  min-height: 0 !important;
  aspect-ratio: 3 / 2;
  padding: 0 !important;
  border: 0 !important;
  border-radius: 0 !important;
  background: none !important;
  box-shadow: none !important;
  overflow: visible;
}

.leaderboard-hub-art {
  position: absolute;
  inset: 0;
  z-index: 0;
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  pointer-events: none;
}

.leaderboard-hub-card > h2,
.leaderboard-hub-card > p {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0 0 0 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

.leaderboard-hub-actions {
  position: absolute !important;
  inset: 0 auto auto 0 !important;
  z-index: 2;
  display: block !important;
  width: 100% !important;
  height: 100% !important;
  margin: 0 !important;
  align-self: auto !important;
  pointer-events: none;
}

.leaderboard-hub-actions .wood-button,
.leaderboard-hub-card > .ghost-button[data-close-dialog="about-dialog"] {
  position: absolute !important;
  min-width: 0 !important;
  min-height: 0 !important;
  margin: 0 !important;
  padding: 0 !important;
  border: 0 !important;
  border-radius: 1rem !important;
  background: transparent !important;
  box-shadow: none !important;
  color: transparent !important;
  font-size: 0 !important;
  opacity: 1 !important;
  pointer-events: auto;
  animation: none !important;
}

#view-memory-leaderboard-button {
  left: 9.8%;
  top: 45.5%;
  width: 40%;
  height: 20.5%;
}

#view-puzzle-leaderboard-button {
  left: 51.3%;
  top: 45.5%;
  width: 38.5%;
  height: 20.5%;
}

.leaderboard-hub-card > .ghost-button[data-close-dialog="about-dialog"] {
  z-index: 3;
  left: 77.9%;
  top: 71.7%;
  width: 12%;
  height: 9%;
}

.leaderboard-hub-actions .wood-button:focus-visible,
.leaderboard-hub-card > .ghost-button[data-close-dialog="about-dialog"]:focus-visible {
  outline: .22rem solid #fff2b0 !important;
  outline-offset: -.35rem;
}

/* Puzzle play: exact supplied full-screen artwork. */
body[data-screen="puzzle-screen"] .puzzle-prototype.is-playing {
  position: fixed !important;
  inset: 0 !important;
  z-index: 20;
  width: 100vw !important;
  height: 100vh !important;
  min-height: 0 !important;
  background: url("../image/generated/puzzle-play-frame-3x2-clean-final.png") center / 100% 100% no-repeat !important;
  overflow: hidden !important;
}

body[data-screen="puzzle-screen"] .puzzle-prototype.is-playing .puzzle-workshop {
  position: absolute !important;
  inset: 0 !important;
  display: block !important;
  width: 100% !important;
  height: 100% !important;
  min-height: 0 !important;
  padding: 0 !important;
  margin: 0 !important;
  overflow: hidden !important;
}

body[data-screen="puzzle-screen"] .puzzle-prototype.is-playing .puzzle-workbench {
  position: absolute !important;
  inset: 0 !important;
  width: 100% !important;
  height: 100% !important;
  min-height: 0 !important;
  overflow: hidden !important;
}

body[data-screen="puzzle-screen"] .puzzle-prototype.is-playing .puzzle-workshop-head {
  position: absolute !important;
  z-index: 8;
  top: 3.1%;
  left: 2.5%;
  min-height: 0 !important;
  padding: 0 !important;
}

body[data-screen="puzzle-screen"] .puzzle-prototype.is-playing .puzzle-workshop-head h3 {
  margin: 0 !important;
  transform: none !important;
  font-size: clamp(1.35rem, 1.65vw, 2rem) !important;
  color: #fff4dc !important;
}

body[data-screen="puzzle-screen"] .puzzle-prototype.is-playing .puzzle-svg-board {
  display: block;
  left: -5.762% !important;
  top: 4.747% !important;
  right: auto !important;
  bottom: auto !important;
  width: 96.85% !important;
  height: 82.88% !important;
  overflow: visible !important;
}

body[data-screen="puzzle-screen"] .puzzle-svg-frame {
  display: none !important;
}

body[data-screen="puzzle-screen"] .puzzle-svg-hint-panel {
  fill: rgba(20, 12, 7, .08);
  stroke: rgba(231, 196, 137, .12);
  stroke-width: 1;
}

body[data-screen="puzzle-screen"] .puzzle-prototype.is-playing .puzzle-field-instruments {
  position: absolute !important;
  z-index: 12;
  top: 31.4% !important;
  right: 6.6% !important;
  width: 15.7% !important;
  height: 43.2% !important;
  display: grid !important;
  grid-template-rows: repeat(3, 1fr) !important;
  gap: 2.8% !important;
  padding: 0 !important;
  border: 0 !important;
  background: none !important;
  box-shadow: none !important;
  pointer-events: none;
}

body[data-screen="puzzle-screen"] .puzzle-field-instruments > p,
body[data-screen="puzzle-screen"] .puzzle-field-instrument > span,
body[data-screen="puzzle-screen"] .puzzle-field-progress > span {
  display: none !important;
}

body[data-screen="puzzle-screen"] .puzzle-field-instrument,
body[data-screen="puzzle-screen"] .puzzle-field-progress {
  display: grid !important;
  place-items: end center !important;
  min-height: 0 !important;
  padding: 0 0 8% !important;
  border: 0 !important;
  border-radius: 0 !important;
  background: none !important;
  box-shadow: none !important;
}

body[data-screen="puzzle-screen"] .puzzle-field-instrument strong,
body[data-screen="puzzle-screen"] .puzzle-field-progress strong {
  margin: 0 !important;
  color: #573515 !important;
  font-family: Georgia, "Times New Roman", serif !important;
  font-size: clamp(1.45rem, 2vw, 2.4rem) !important;
  font-weight: 800 !important;
  line-height: 1 !important;
  font-variant-numeric: lining-nums tabular-nums;
  text-shadow: 0 1px 0 rgba(255, 246, 215, .8) !important;
}

body[data-screen="puzzle-screen"] .puzzle-field-instrument small,
body[data-screen="puzzle-screen"] .puzzle-field-progress small {
  display: inline !important;
  margin-left: .16em;
  color: inherit !important;
  font: inherit !important;
  font-size: .58em !important;
  line-height: 1 !important;
}

body[data-screen="puzzle-screen"] .puzzle-field-instrument--time::before,
body[data-screen="puzzle-screen"] .puzzle-field-instrument--moves::before {
  display: none !important;
}

body[data-screen="puzzle-screen"] .puzzle-prototype.is-playing .puzzle-actions {
  position: absolute !important;
  inset: 0 !important;
  z-index: 15;
  display: block !important;
  min-height: 0 !important;
  margin: 0 !important;
  padding: 0 !important;
  transform: none !important;
  pointer-events: none;
}

body[data-screen="puzzle-screen"] .puzzle-prototype.is-playing .puzzle-actions .puzzle-tool-button {
  position: absolute !important;
  min-width: 0 !important;
  min-height: 0 !important;
  padding: 0 !important;
  border: 0 !important;
  border-radius: 1.5rem !important;
  background: transparent !important;
  box-shadow: none !important;
  color: transparent !important;
  font-size: 0 !important;
  opacity: 1 !important;
  pointer-events: auto;
}

/* These controls sit over labels painted into the supplied artwork. Their
   interaction state must never draw a second button over that artwork. */
body[data-screen="puzzle-screen"] .puzzle-prototype.is-playing .puzzle-actions .puzzle-tool-button:hover,
body[data-screen="puzzle-screen"] .puzzle-prototype.is-playing .puzzle-actions .puzzle-tool-button:active {
  background: transparent !important;
  box-shadow: none !important;
  filter: none !important;
  transform: none !important;
}

body[data-screen="puzzle-screen"] #restart-puzzle-button {
  left: 22.7%;
  top: 84.1%;
  width: 16.9%;
  height: 10.5%;
}

body[data-screen="puzzle-screen"] #finish-puzzle-back-button {
  left: 41.1%;
  top: 84.1%;
  width: 17.3%;
  height: 10.5%;
}

body[data-screen="puzzle-screen"] .puzzle-actions .puzzle-tool-button:focus-visible {
  outline: .2rem solid #fff1ad !important;
  outline-offset: -.35rem;
}

/* Clarity and exact-fit pass requested from the 1920 x 1080 review. */

/* Transparent hit areas must never blur the artwork beneath them. */
.leaderboard-hub-actions .wood-button,
.leaderboard-hub-card > .ghost-button[data-close-dialog="about-dialog"],
body[data-screen="puzzle-screen"] .puzzle-prototype.is-playing .puzzle-actions .puzzle-tool-button {
  -webkit-backdrop-filter: none !important;
  backdrop-filter: none !important;
  filter: none !important;
}

/* Memory rules: enlarge both calls to action by 1.5x as one matched pair. */
#memory-intro-dialog .puzzle-rules-actions .brass-action-button {
  min-width: 15rem !important;
  min-height: 4.5rem !important;
  padding: 1.15rem 2rem !important;
  font-size: 1.6rem !important;
}

/* Puzzle play title: twice the previous visual size. */
body[data-screen="puzzle-screen"] .puzzle-prototype.is-playing .puzzle-workshop-head h3 {
  font-size: clamp(2.7rem, 3.3vw, 4rem) !important;
}

/* Puzzle animal menu: double the animal names and enlarge the back action. */
body[data-screen="puzzle-screen"] .puzzle-gallery-selection .puzzle-bird-card-caption {
  min-height: 30% !important;
  padding: .28em .18em !important;
  font-size: clamp(2rem, 2.5vw, 3rem) !important;
  line-height: 1.05 !important;
}

body[data-screen="puzzle-screen"] .puzzle-gallery-back {
  min-height: 3.75rem !important;
  padding: .78rem 1.2rem !important;
  font-size: clamp(1.05rem, 1.25vw, 1.5rem) !important;
}

/* Home: a dedicated foreground leaf layer guarantees visible motion over the
   mural instead of relying on background effects that can be hidden by panels. */
body[data-screen="home-screen"] #home-screen {
  isolation: isolate;
}

body[data-screen="home-screen"] .home-leaf-drift {
  position: absolute;
  inset: 0;
  z-index: 3;
  overflow: hidden;
  pointer-events: none;
}

body[data-screen="home-screen"] .home-leaf-drift span {
  position: absolute;
  top: -12%;
  width: clamp(.7rem, 1.1vw, 1.25rem);
  height: clamp(1rem, 1.55vw, 1.75rem);
  border-radius: 100% 0 100% 0;
  background: linear-gradient(135deg, #d8b365 0%, #7d963f 58%, #425d31 100%);
  box-shadow: .08rem .14rem .22rem rgba(24, 42, 19, .32);
  opacity: .84;
  transform-origin: 0 180%;
  animation: visibleHomeLeafFall var(--leaf-fall-duration) linear infinite;
}

body[data-screen="home-screen"] .home-leaf-drift span:nth-child(1) { left: 9%; --leaf-fall-duration: 10.5s; animation-delay: -2.4s; }
body[data-screen="home-screen"] .home-leaf-drift span:nth-child(2) { left: 23%; --leaf-fall-duration: 13.2s; animation-delay: -8.1s; opacity: .72; }
body[data-screen="home-screen"] .home-leaf-drift span:nth-child(3) { left: 44%; --leaf-fall-duration: 11.6s; animation-delay: -5.5s; }
body[data-screen="home-screen"] .home-leaf-drift span:nth-child(4) { left: 61%; --leaf-fall-duration: 14.8s; animation-delay: -10.8s; opacity: .68; }
body[data-screen="home-screen"] .home-leaf-drift span:nth-child(5) { left: 76%; --leaf-fall-duration: 9.8s; animation-delay: -3.8s; }
body[data-screen="home-screen"] .home-leaf-drift span:nth-child(6) { left: 89%; --leaf-fall-duration: 12.9s; animation-delay: -7.2s; opacity: .7; }
body[data-screen="home-screen"] .home-leaf-drift span:nth-child(7) { left: 35%; --leaf-fall-duration: 15.3s; animation-delay: -12.2s; opacity: .56; }
body[data-screen="home-screen"] .home-leaf-drift span:nth-child(8) { left: 53%; --leaf-fall-duration: 11.1s; animation-delay: -1.5s; opacity: .64; }
body[data-screen="home-screen"] .home-leaf-drift span:nth-child(9) { left: 94%; --leaf-fall-duration: 16s; animation-delay: -11.5s; opacity: .5; }

@keyframes visibleHomeLeafFall {
  0% { transform: translate3d(0, -10vh, 0) rotate(8deg) scale(.72); opacity: 0; }
  9% { opacity: inherit; }
  35% { transform: translate3d(3.6vw, 28vh, 0) rotate(145deg) scale(1); }
  68% { transform: translate3d(-2.4vw, 58vh, 0) rotate(270deg) scale(.83); }
  100% { transform: translate3d(4vw, 96vh, 0) rotate(410deg) scale(.68); opacity: 0; }
}

/* The home calls to action are intentionally twice their original desktop
   footprint, while clamp keeps them usable at narrower display widths. */
body[data-screen="home-screen"] .hero-actions {
  gap: clamp(1rem, 1.8vw, 2rem);
}

body[data-screen="home-screen"] .hero-actions .wood-button {
  width: clamp(16rem, 25vw, 20rem);
  min-width: 0;
  min-height: clamp(6rem, 7.6vw, 7rem);
  padding: clamp(1.4rem, 2vw, 2rem) clamp(1.65rem, 2.8vw, 3rem);
  font-size: clamp(1.5rem, 2vw, 2rem);
}

/* Homepage e-book access and the enlarged memory-game instructions. */
body[data-screen="home-screen"] .ebook-qr-card {
  position: absolute;
  right: clamp(1.4rem, 3vw, 3.8rem);
  bottom: clamp(1.4rem, 3vw, 3.4rem);
  z-index: 3;
  display: grid;
  justify-items: center;
  gap: .45rem;
  width: clamp(8.3rem, 10.5vw, 11rem);
  padding: .6rem;
  color: #fff8e8;
  font-size: clamp(.82rem, 1vw, 1rem);
  font-weight: 800;
  line-height: 1.25;
  letter-spacing: .06em;
  text-align: center;
  text-decoration: none;
  text-shadow: 0 .1rem .45rem rgba(15, 27, 22, .85);
  border: 1px solid rgba(255, 244, 205, .68);
  border-radius: .85rem;
  background: rgba(28, 45, 35, .48);
  box-shadow: 0 .75rem 1.8rem rgba(8, 18, 12, .35);
  backdrop-filter: blur(.3rem);
}

/* Puzzle reference card: it lives in the upper-right timber margin and only
   opens on demand, so the draggable puzzle area remains unobstructed. */
body[data-screen="puzzle-screen"] .puzzle-reference-toggle {
  position: absolute;
  z-index: 14;
  top: 13.4%;
  right: 23.3%;
  min-width: 0;
  padding: .58em 1.05em;
  color: #fff1c7;
  font-family: "Noto Serif TC", "Source Han Serif TC", serif;
  font-size: clamp(.86rem, 1.08vw, 1.12rem);
  font-weight: 800;
  letter-spacing: .08em;
  border: 1px solid #4a280d;
  border-radius: .42rem;
  background: linear-gradient(180deg, #b97c30, #6d3511);
  box-shadow: inset 0 1px 0 rgba(255, 228, 156, .6), 0 .35rem .65rem rgba(25, 8, 2, .34);
}

/* Permanent puzzle reference: a small framed specimen card in the marked
   upper-right timber space, deliberately styled to match the QR badge. */
body[data-screen="puzzle-screen"] .puzzle-reference-toggle {
  display: none !important;
}

body[data-screen="puzzle-screen"] .puzzle-reference-card,
body[data-screen="puzzle-screen"] .puzzle-reference-card.is-open {
  position: absolute;
  z-index: 13;
  top: 4.25%;
  right: 22.2%;
  display: grid;
  width: clamp(7.3rem, 10.8vw, 10.3rem);
  gap: .22rem;
  padding: .3rem;
  opacity: 1;
  visibility: visible;
  transform: none;
  color: #fff6d8;
  text-align: center;
  border: 1px solid #d9b35f;
  border-radius: .58rem;
  background: linear-gradient(145deg, rgba(31, 54, 40, .97), rgba(15, 35, 27, .97));
  box-shadow: inset 0 0 0 .11rem rgba(255, 240, 185, .22), 0 .42rem .85rem rgba(19, 7, 2, .38);
  pointer-events: none;
  transition: none;
}

body[data-screen="puzzle-screen"] .puzzle-reference-card p {
  display: none;
}

body[data-screen="puzzle-screen"] .puzzle-reference-card img {
  width: 100%;
  aspect-ratio: 3 / 2;
  padding: .2rem;
  object-fit: contain;
  background: #fffdf5;
  border: 1px solid rgba(255, 241, 185, .88);
  box-shadow: inset 0 0 0 1px rgba(91, 58, 20, .3);
}

body[data-screen="puzzle-screen"] .puzzle-reference-card span {
  color: #fff1c9;
  font-family: "Noto Serif TC", "Source Han Serif TC", serif;
  font-size: clamp(.58rem, .7vw, .74rem);
  font-weight: 800;
  letter-spacing: .08em;
  line-height: 1.2;
}

/* Give the enlarged rules the matching enlarged canvas and restore a calmer
   reading rhythm: title, lead, three cards, then the actions. */
#memory-intro-dialog {
  width: min(82vw, 70rem) !important;
  max-width: calc(100vw - 2rem) !important;
}

#memory-intro-dialog .memory-rules-card {
  width: 100% !important;
  max-width: none !important;
  padding: clamp(2.2rem, 3.4vw, 3.35rem) clamp(2.4rem, 4.2vw, 4.4rem) !important;
}

#memory-intro-dialog .puzzle-rules-card h2 {
  margin: 0 0 .9rem !important;
  font-size: clamp(3rem, 4.45vw, 3.85rem) !important;
  line-height: 1.16;
}

#memory-intro-dialog .puzzle-rules-intro {
  max-width: 42rem;
  margin: 0 auto 1.5rem !important;
  font-size: clamp(1.32rem, 1.75vw, 1.58rem) !important;
  line-height: 1.68;
}

#memory-intro-dialog .puzzle-rules-list {
  max-width: 58rem;
  gap: .85rem;
}

#memory-intro-dialog .puzzle-rules-list li {
  grid-template-columns: 3.15rem 1fr;
  gap: .95rem;
  min-height: 5.25rem;
  padding: .95rem 1.2rem;
}

#memory-intro-dialog .puzzle-rules-list span {
  width: 2.75rem;
  height: 2.75rem;
  font-size: 1.15rem;
}

#memory-intro-dialog .puzzle-rules-list p {
  font-size: clamp(1.2rem, 1.55vw, 1.4rem) !important;
  line-height: 1.62;
}

#memory-intro-dialog .puzzle-rules-actions {
  margin-top: 1.45rem;
  gap: 1.15rem;
}

#memory-intro-dialog .puzzle-rules-actions .brass-action-button {
  min-width: 13.5rem !important;
  min-height: 3.65rem !important;
  padding: .8rem 1.5rem !important;
  font-size: clamp(1.25rem, 1.55vw, 1.48rem) !important;
  white-space: nowrap;
}

body[data-screen="puzzle-screen"] .puzzle-reference-toggle:hover,
body[data-screen="puzzle-screen"] .puzzle-reference-toggle:focus-visible {
  background: linear-gradient(180deg, #d79a42, #864313);
  outline: .14rem solid rgba(255, 237, 177, .82);
  outline-offset: .14rem;
}

body[data-screen="puzzle-screen"] .puzzle-reference-card {
  position: absolute;
  z-index: 13;
  top: 20.2%;
  right: 22.5%;
  display: grid;
  width: min(18vw, 16.2rem);
  gap: .35rem;
  padding: .55rem;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-.55rem) scale(.97);
  transform-origin: top right;
  color: #4a301a;
  text-align: center;
  border: 1px solid rgba(88, 50, 17, .56);
  border-radius: .35rem;
  background: linear-gradient(145deg, #f7ebc9, #d9bf83);
  box-shadow: 0 .75rem 1.2rem rgba(19, 7, 2, .38), inset 0 0 0 .12rem rgba(255, 247, 210, .62);
  pointer-events: none;
  transition: opacity 180ms ease, transform 180ms ease, visibility 180ms step-end;
}

body[data-screen="puzzle-screen"] .puzzle-reference-card.is-open {
  opacity: 1;
  visibility: visible;
  transform: translateY(0) scale(1);
  pointer-events: auto;
  transition: opacity 180ms ease, transform 180ms ease;
}

body[data-screen="puzzle-screen"] .puzzle-reference-card p {
  margin: 0;
  font-family: "Noto Serif TC", "Source Han Serif TC", serif;
  font-size: clamp(.88rem, 1.12vw, 1.2rem);
  font-weight: 900;
  letter-spacing: .1em;
}

body[data-screen="puzzle-screen"] .puzzle-reference-card img {
  display: block;
  width: 100%;
  aspect-ratio: 3 / 2;
  object-fit: contain;
  background: #fffdf5;
  border: .2rem solid #fff8e7;
  box-shadow: 0 .18rem .38rem rgba(49, 26, 8, .28);
}

body[data-screen="puzzle-screen"] .puzzle-reference-card span {
  color: rgba(74, 48, 26, .78);
  font-size: clamp(.64rem, .74vw, .8rem);
  font-weight: 700;
}

/* Rebalanced memory rules: prominent copy with deliberate breathing room. */
#memory-intro-dialog { width: min(92vw, 52rem) !important; }
#memory-intro-dialog .memory-rules-card {
  width: 100% !important;
  max-height: none !important;
  padding: clamp(1.5rem, 2.5vw, 2.25rem) clamp(1.65rem, 3.2vw, 3rem) !important;
  overflow: visible;
}
#memory-intro-dialog .puzzle-rules-card h2 {
  margin: 0 0 .55rem !important;
  font-size: clamp(2.7rem, 4vw, 3.45rem) !important;
  line-height: 1.18;
}
#memory-intro-dialog .puzzle-rules-intro {
  max-width: 36rem;
  margin: 0 auto 1rem !important;
  font-size: clamp(1.18rem, 1.62vw, 1.38rem) !important;
  line-height: 1.62;
}
#memory-intro-dialog .puzzle-rules-list {
  max-width: 44rem;
  gap: .58rem;
}
#memory-intro-dialog .puzzle-rules-list li {
  grid-template-columns: 2.65rem 1fr;
  gap: .75rem;
  min-height: 0;
  padding: .62rem .85rem;
}
#memory-intro-dialog .puzzle-rules-list span {
  width: 2.35rem;
  height: 2.35rem;
  font-size: 1rem;
}
#memory-intro-dialog .puzzle-rules-list p {
  font-size: clamp(1.08rem, 1.46vw, 1.28rem) !important;
  line-height: 1.55;
}
#memory-intro-dialog .puzzle-rules-actions { margin-top: 1.05rem; gap: .75rem; }
#memory-intro-dialog .puzzle-rules-actions .brass-action-button {
  min-width: 12.5rem !important;
  min-height: 3.2rem !important;
  padding: .7rem 1.15rem !important;
  font-size: clamp(1.12rem, 1.42vw, 1.35rem) !important;
  white-space: nowrap;
}

body[data-screen="home-screen"] .ebook-qr-card img {
  display: block;
  width: 100%;
  aspect-ratio: 1;
  padding: .3rem;
  background: #fff;
  border-radius: .45rem;
}

body[data-screen="home-screen"] .ebook-qr-card:hover,
body[data-screen="home-screen"] .ebook-qr-card:focus-visible {
  transform: translateY(-.2rem);
  background: rgba(49, 73, 55, .72);
  outline: .16rem solid #ffe5a2;
  outline-offset: .16rem;
}

body[data-screen="memory-screen"] .card-front::after {
  content: none !important;
}

#memory-intro-dialog {
  width: min(94vw, 70rem) !important;
}

#memory-intro-dialog .memory-rules-card {
  width: min(100%, 70rem) !important;
}

#memory-intro-dialog .puzzle-rules-card h2 {
  font-size: clamp(3.5rem, 5.4vw, 5.3rem) !important;
}

#memory-intro-dialog .puzzle-rules-intro {
  font-size: clamp(1.9rem, 2.33vw, 2.33rem) !important;
}

#memory-intro-dialog .puzzle-rules-list span {
  width: 3.9rem;
  height: 3.9rem;
  font-size: 1.73rem;
}

#memory-intro-dialog .puzzle-rules-list li {
  grid-template-columns: 4.5rem 1fr;
  min-height: 7.7rem;
}

#memory-intro-dialog .puzzle-rules-list p {
  font-size: clamp(1.8rem, 2.18vw, 2.18rem) !important;
}

#memory-intro-dialog .puzzle-rules-actions .brass-action-button {
  font-size: 2.4rem !important;
}

@media (max-width: 620px) {
  body[data-screen="home-screen"] .hero-actions .wood-button {
    width: min(100%, 20rem);
  }
}

@media (prefers-reduced-motion: reduce) {
  body[data-screen="home-screen"] .home-leaf-drift span {
    animation: none;
    opacity: .32;
  }
}

/* Memory leaderboard entry: the generated artwork owns all static decoration;
   only live score data, the input value and validation feedback sit above it. */
.screen-reader-only {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

#leaderboard-name-dialog.overlay-dialog {
  width: min(81.6vw, 69.7rem);
  border: 0;
  background: transparent;
  overflow: visible;
}

.memory-leaderboard-entry-card {
  position: relative;
  display: block;
  width: 100%;
  max-width: none;
  min-height: 0;
  aspect-ratio: 16 / 9;
  padding: 0 !important;
  overflow: visible;
  border: 0 !important;
  border-radius: 0;
  background: transparent !important;
  box-shadow: none !important;
}

.memory-leaderboard-entry-art {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  pointer-events: none;
  user-select: none;
}

.memory-leaderboard-entry-card > h2,
.memory-leaderboard-entry-card .leaderboard-name-field > span {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
}

.memory-leaderboard-entry-card #leaderboard-name-summary {
  position: absolute;
  z-index: 1;
  top: 32.3%;
  left: 20.5%;
  display: flex;
  width: 59%;
  align-items: baseline;
  justify-content: center;
  gap: clamp(.35rem, .8vw, .85rem);
  margin: 0;
  color: #4c2d19;
  font-family: Arial, Helvetica, sans-serif;
  font-size: clamp(1rem, 1.75vw, 1.75rem);
  font-weight: 700;
  line-height: 1;
  letter-spacing: .03em;
  text-align: left;
  text-shadow: 0 1px 0 rgba(255, 249, 225, .75);
}

.memory-leaderboard-entry-card .entry-score-item,
.memory-leaderboard-entry-card .entry-score-player {
  display: inline-flex;
  align-items: baseline;
  gap: .12em;
  white-space: nowrap;
}

.memory-leaderboard-entry-card .entry-score-item > span,
.memory-leaderboard-entry-card .entry-score-player {
  color: #644126;
  font-weight: 700;
}

.memory-leaderboard-entry-card .entry-score-item strong,
.memory-leaderboard-entry-card .entry-score-player strong {
  color: #6f3417;
  font-family: Arial, Helvetica, sans-serif;
  font-size: 1.35em;
  font-weight: 900;
  letter-spacing: .01em;
  text-shadow: 0 1px 0 rgba(255, 248, 214, .9), 0 .08em .16em rgba(93, 50, 17, .18);
}

.memory-leaderboard-entry-card .entry-score-item small {
  color: #5e4128;
  font-size: .82em;
  font-weight: 800;
}

.memory-leaderboard-entry-card .leaderboard-name-field {
  position: absolute;
  z-index: 1;
  top: 51.1%;
  left: 24.2%;
  display: block;
  width: 52.4%;
  height: 12.3%;
  margin: 0;
}

.memory-leaderboard-entry-card .leaderboard-name-field input {
  width: 100%;
  height: 100%;
  padding: 0 7%;
  border: 0;
  border-radius: 1.2rem;
  background: transparent;
  color: #3f2b1c;
  font-family: Arial, Helvetica, sans-serif;
  font-size: clamp(1.3rem, 2.45vw, 2.55rem);
  font-weight: 800;
  outline: none;
}

.memory-leaderboard-entry-card .leaderboard-name-field input:focus {
  box-shadow: inset 0 0 0 .22rem rgba(94, 123, 58, .72), 0 0 0 .25rem rgba(255, 246, 194, .68);
}

.memory-leaderboard-entry-card .input-error {
  position: absolute;
  z-index: 2;
  top: 63.8%;
  left: 27%;
  width: 48%;
  min-height: 0;
  margin: 0;
  color: #8d241c;
  font-size: clamp(.75rem, 1.2vw, 1.15rem);
  line-height: 1.2;
  text-align: center;
  text-shadow: 0 1px 0 rgba(255, 248, 222, .8);
}

.memory-leaderboard-entry-card #leaderboard-name-confirm {
  position: absolute;
  z-index: 1;
  top: 69%;
  left: 38.5%;
  width: 23.6%;
  height: 12.2%;
  min-width: 0;
  min-height: 0;
  padding: 0;
  border: 0;
  border-radius: 999px;
  background: transparent;
  box-shadow: none;
  color: #fff6df;
  font-family: Arial, Helvetica, sans-serif;
  font-size: clamp(1rem, 1.9vw, 2rem);
  font-weight: 900;
  letter-spacing: .08em;
  text-shadow: 0 .12rem .08rem rgba(61, 27, 7, .8);
  animation: none;
}

.memory-leaderboard-entry-card #leaderboard-name-confirm:hover,
.memory-leaderboard-entry-card #leaderboard-name-confirm:focus-visible {
  background: rgba(255, 227, 145, .12);
  box-shadow: inset 0 0 0 .18rem rgba(255, 241, 180, .72);
  outline: none;
  transform: translateY(-.12rem);
}

.memory-leaderboard-entry-card #leaderboard-name-confirm:active {
  transform: scale(.98);
}

#puzzle-dialog .puzzle-rules-intro {
  display: block;
  width: 100%;
  max-width: none;
  margin-inline: auto;
  text-align: center;
}

@media (max-width: 720px), (max-height: 650px) {
  #leaderboard-name-dialog.overlay-dialog {
    width: min(98vw, 48rem);
  }
}

/* Local leaderboard service pass: the selector is deliberately 80% of its
   previous artwork size, leaving more of the forest visible behind it. */
#about-dialog.leaderboard-hub-dialog {
  width: min(76.8vw, 76.8rem, 120vh) !important;
}

/* Auto-numbered score receipt.  The illustrated card has no baked-in copy;
   live score values and the assigned player number stay accessible HTML. */
.memory-leaderboard-entry-card > h2 {
  position: absolute;
  z-index: 1;
  top: 21.5%;
  left: 18%;
  width: 64%;
  height: auto;
  margin: 0;
  overflow: visible;
  clip: auto;
  color: #4b2d1c;
  font-family: "Noto Serif TC", "PMingLiU", serif;
  font-size: clamp(1.45rem, 2.5vw, 2.6rem);
  font-weight: 900;
  line-height: 1.15;
  letter-spacing: .12em;
  text-align: center;
  text-shadow: 0 1px 0 rgba(255, 248, 220, .92);
  white-space: nowrap;
}

.memory-leaderboard-entry-card #leaderboard-name-summary {
  top: 40.5%;
  left: 18%;
  width: 64%;
  justify-content: center;
  text-align: center;
}

.memory-leaderboard-entry-card .entry-score-player {
  display: none;
}

.memory-leaderboard-entry-card .leaderboard-record-player {
  position: absolute;
  z-index: 1;
  top: 53%;
  left: 18%;
  width: 64%;
  margin: 0;
  color: #644126;
  font-family: Arial, Helvetica, sans-serif;
  font-size: clamp(1rem, 1.7vw, 1.65rem);
  font-weight: 700;
  letter-spacing: .06em;
  text-align: center;
}

.memory-leaderboard-entry-card .leaderboard-record-player strong {
  margin-left: .35em;
  color: #6f3417;
  font-size: 1.28em;
  font-weight: 900;
}

.memory-leaderboard-entry-card #leaderboard-name-confirm {
  top: 67%;
  left: 37%;
  width: 26%;
  border: .14rem solid #4b260f;
  background: linear-gradient(180deg, #d69a36 0%, #a95b18 48%, #723310 100%);
  box-shadow:
    inset 0 .12rem 0 rgba(255, 238, 173, .72),
    inset 0 -.14rem 0 rgba(55, 24, 7, .48),
    0 .18rem .26rem rgba(53, 28, 12, .42);
  color: #fff9e8;
  text-shadow: 0 .11rem 0 #572208, 0 0 .22rem rgba(69, 29, 5, .65);
}

.memory-leaderboard-entry-card #leaderboard-name-confirm:hover,
.memory-leaderboard-entry-card #leaderboard-name-confirm:focus-visible {
  background: linear-gradient(180deg, #f1bd54 0%, #c9781e 48%, #8a3e12 100%);
  box-shadow:
    inset 0 .12rem 0 rgba(255, 248, 205, .88),
    inset 0 -.14rem 0 rgba(70, 29, 7, .48),
    0 0 0 .18rem rgba(255, 237, 165, .86),
    0 .24rem .38rem rgba(53, 28, 12, .46);
}

/* The close action itself is the only prompt after an animal introduction;
   do not show countdown or instructional copy under the illustration. */
#species-dialog .species-dialog-hint {
  display: none !important;
}

@media (max-width: 720px), (max-height: 650px) {
  #about-dialog.leaderboard-hub-dialog {
    width: min(88vw, 43rem) !important;
  }
}

/* Final placement: e-book QR access, image-only memory cards, and 1.5x rules type. */
body[data-screen="home-screen"] .ebook-qr-card {
  position: absolute;
  right: clamp(1.4rem, 3vw, 3.8rem);
  bottom: clamp(1.4rem, 3vw, 3.4rem);
  z-index: 3;
  display: grid;
  justify-items: center;
  gap: .45rem;
  width: clamp(8.3rem, 10.5vw, 11rem);
  padding: .6rem;
  color: #fff8e8;
  font-size: clamp(.82rem, 1vw, 1rem);
  font-weight: 800;
  line-height: 1.25;
  letter-spacing: .06em;
  text-align: center;
  text-decoration: none;
  text-shadow: 0 .1rem .45rem rgba(15, 27, 22, .85);
  border: 1px solid rgba(255, 244, 205, .68);
  border-radius: .85rem;
  background: rgba(28, 45, 35, .48);
  box-shadow: 0 .75rem 1.8rem rgba(8, 18, 12, .35);
  backdrop-filter: blur(.3rem);
}

body[data-screen="home-screen"] .ebook-qr-card img {
  display: block;
  width: 100%;
  aspect-ratio: 1;
  padding: .3rem;
  background: #fff;
  border-radius: .45rem;
}

body[data-screen="home-screen"] .ebook-qr-card:hover,
body[data-screen="home-screen"] .ebook-qr-card:focus-visible {
  transform: translateY(-.2rem);
  background: rgba(49, 73, 55, .72);
  outline: .16rem solid #ffe5a2;
  outline-offset: .16rem;
}

body[data-screen="memory-screen"] .card-front::after { content: none !important; }

#memory-intro-dialog { width: min(94vw, 70rem) !important; }
#memory-intro-dialog .memory-rules-card { width: min(100%, 70rem) !important; }
#memory-intro-dialog .puzzle-rules-card h2 { font-size: clamp(3.5rem, 5.4vw, 5.3rem) !important; }
#memory-intro-dialog .puzzle-rules-intro { font-size: clamp(1.9rem, 2.33vw, 2.33rem) !important; }
#memory-intro-dialog .puzzle-rules-list span { width: 3.9rem; height: 3.9rem; font-size: 1.73rem; }
#memory-intro-dialog .puzzle-rules-list li { grid-template-columns: 4.5rem 1fr; min-height: 7.7rem; }
#memory-intro-dialog .puzzle-rules-list p { font-size: clamp(1.8rem, 2.18vw, 2.18rem) !important; }
#memory-intro-dialog .puzzle-rules-actions .brass-action-button { font-size: 2.4rem !important; }

/* Keep the larger type within a 16:9 exhibition display without hiding rules. */
#memory-intro-dialog .memory-rules-card {
  max-height: calc(100dvh - 2rem) !important;
  padding: clamp(1rem, 1.6vw, 1.55rem) clamp(1.5rem, 2.5vw, 2.5rem) !important;
  overflow: auto;
}
#memory-intro-dialog .puzzle-rules-card h2 { margin: 0 0 .35rem !important; }
#memory-intro-dialog .puzzle-rules-intro { margin-bottom: .55rem !important; }
#memory-intro-dialog .puzzle-rules-list { max-width: none; gap: .45rem; }
#memory-intro-dialog .puzzle-rules-list li { min-height: 4.9rem; padding: .5rem .9rem; }
#memory-intro-dialog .puzzle-rules-actions { margin-top: .65rem; }

/* This badge uses pixel-based dimensions because the exhibition stylesheet
   deliberately scales rem units with the display size. */
body[data-screen="home-screen"] .ebook-qr-card {
  position: fixed;
  right: clamp(18px, 2.5vw, 48px);
  bottom: clamp(18px, 2.5vw, 48px);
  width: clamp(116px, 10vw, 156px);
  padding: 8px;
  gap: 6px;
  font-size: clamp(11px, .9vw, 14px);
}

/* Enlarged e-book QR Code: keeps the homepage badge compact while making the
   code reliably scannable on exhibition displays and touch devices. */
.ebook-qr-dialog {
  width: min(92vw, 34rem);
}

.ebook-qr-dialog-card {
  position: relative;
  display: grid;
  justify-items: center;
  gap: clamp(.7rem, 1.4vw, 1.1rem);
  padding: clamp(1.35rem, 3vw, 2.4rem);
  color: #f8ebc7;
  text-align: center;
  border: 2px solid #d8b368;
  border-radius: 1.1rem;
  background: linear-gradient(145deg, #294536, #152d23);
  box-shadow: inset 0 0 0 .22rem rgba(255, 239, 183, .14), 0 1rem 2.6rem rgba(9, 17, 12, .48);
}

.ebook-qr-dialog-card h2,
.ebook-qr-dialog-card p {
  margin: 0;
}

.ebook-qr-dialog-card h2 {
  color: #fff0c7;
  font-family: "Noto Serif TC", "Source Han Serif TC", serif;
  font-size: clamp(1.45rem, 3vw, 2rem);
}

.ebook-qr-dialog-card img {
  display: block;
  width: min(42vw, 12.5rem);
  aspect-ratio: 1;
  padding: clamp(.35rem, .9vw, .6rem);
  background: #fff;
  border-radius: .55rem;
  image-rendering: pixelated;
}

.ebook-qr-dialog-card p {
  font-size: clamp(.95rem, 1.8vw, 1.12rem);
  line-height: 1.55;
}

.ebook-qr-close {
  position: absolute;
  top: .5rem;
  right: .65rem;
  width: 2.2rem;
  height: 2.2rem;
  padding: 0;
  color: #fff1ce;
  font-size: 2rem;
  line-height: 1;
  cursor: pointer;
  border: 0;
  background: transparent;
}

.ebook-qr-close:hover,
.ebook-qr-close:focus-visible {
  color: #fff;
  outline: .14rem solid #ffe5a2;
  outline-offset: .12rem;
}

/* Final permanent reference-card placement. This must remain visible while
   pieces are moved, but leaves the repair record completely unobstructed. */
body[data-screen="puzzle-screen"] .puzzle-reference-card,
body[data-screen="puzzle-screen"] .puzzle-reference-card.is-open {
  top: 4.25% !important;
  right: 22.2% !important;
  display: grid !important;
  width: clamp(7.3rem, 10.8vw, 10.3rem) !important;
  gap: .22rem !important;
  padding: .3rem !important;
  opacity: 1 !important;
  visibility: visible !important;
  transform: none !important;
  color: #fff6d8 !important;
  border: 1px solid #d9b35f !important;
  border-radius: .58rem !important;
  background: linear-gradient(145deg, rgba(31, 54, 40, .97), rgba(15, 35, 27, .97)) !important;
  box-shadow: inset 0 0 0 .11rem rgba(255, 240, 185, .22), 0 .42rem .85rem rgba(19, 7, 2, .38) !important;
  pointer-events: none !important;
}

body[data-screen="puzzle-screen"] .puzzle-reference-card p { display: none !important; }
body[data-screen="puzzle-screen"] .puzzle-reference-card img {
  width: 100% !important;
  aspect-ratio: 3 / 2 !important;
  padding: .2rem !important;
  object-fit: contain !important;
  background: #fffdf5 !important;
  border: 1px solid rgba(255, 241, 185, .88) !important;
  box-shadow: inset 0 0 0 1px rgba(91, 58, 20, .3) !important;
}
body[data-screen="puzzle-screen"] .puzzle-reference-card span {
  color: #fff1c9 !important;
  font-family: "Noto Serif TC", "Source Han Serif TC", serif !important;
  font-size: clamp(.58rem, .7vw, .74rem) !important;
  font-weight: 800 !important;
  letter-spacing: .08em !important;
  line-height: 1.2 !important;
}

/* Requested 1.5x reference artwork: it keeps its right edge in the marked
   timber space and grows leftward without covering the repair record. */
body[data-screen="puzzle-screen"] .puzzle-reference-card,
body[data-screen="puzzle-screen"] .puzzle-reference-card.is-open {
  width: clamp(10.95rem, 16.2vw, 15.45rem) !important;
}

/* Puzzle rules use a true 1.5x canvas as well as 1.5x content. */
#puzzle-dialog.puzzle-rules-dialog {
  width: min(96vw, 72rem) !important;
  max-width: calc(100vw - 2rem) !important;
  max-height: calc(100dvh - 2rem) !important;
}

#puzzle-dialog .puzzle-rules-card {
  width: 100% !important;
  max-width: none !important;
  max-height: calc(100dvh - 2rem) !important;
  padding: clamp(1.45rem, 2.8vw, 2.25rem) clamp(2.1rem, 4vw, 3.4rem) !important;
  overflow: auto;
}

#puzzle-dialog .puzzle-rules-card h2 {
  margin: 0 0 1.2rem !important;
  font-size: clamp(3.38rem, 5.1vw, 5.18rem) !important;
  line-height: 1.16;
}

#puzzle-dialog .puzzle-rules-intro {
  max-width: 43.5rem;
  margin: 0 auto 1.15rem !important;
  font-size: clamp(1.58rem, 2.18vw, 1.98rem) !important;
  line-height: 1.65;
}

#puzzle-dialog .puzzle-rules-list {
  gap: .68rem !important;
}

#puzzle-dialog .puzzle-rules-list li {
  grid-template-columns: 3.98rem 1fr !important;
  gap: 1.28rem !important;
  padding: .78rem 1.25rem !important;
}

#puzzle-dialog .puzzle-rules-list span {
  width: 3.42rem !important;
  height: 3.42rem !important;
  font-size: 1.5rem !important;
}

#puzzle-dialog .puzzle-rules-list p {
  font-size: clamp(1.5rem, 2.03vw, 1.8rem) !important;
  line-height: 1.55;
}

#puzzle-dialog .puzzle-rules-actions {
  margin-top: 1.15rem !important;
  gap: 1.35rem !important;
}

#puzzle-dialog .puzzle-rules-actions .brass-action-button {
  min-height: 4.5rem !important;
  padding: 1.17rem 2.03rem !important;
  font-size: 1.62rem !important;
  white-space: nowrap;
}

/* The permanent reference grows another 1.25x while retaining its right edge. */
body[data-screen="puzzle-screen"] .puzzle-reference-card,
body[data-screen="puzzle-screen"] .puzzle-reference-card.is-open {
  width: clamp(13.69rem, 20.25vw, 19.31rem) !important;
}

/* Memory rules deliberately share the exact same visual scale as puzzle rules. */
#memory-intro-dialog {
  width: min(96vw, 72rem) !important;
  max-width: calc(100vw - 2rem) !important;
  max-height: calc(100dvh - 2rem) !important;
}

#memory-intro-dialog .memory-rules-card {
  width: 100% !important;
  max-width: none !important;
  max-height: calc(100dvh - 2rem) !important;
  padding: clamp(1.45rem, 2.8vw, 2.25rem) clamp(2.1rem, 4vw, 3.4rem) !important;
  overflow: auto;
}

#memory-intro-dialog .puzzle-rules-card h2 {
  margin: 0 0 1.2rem !important;
  font-size: clamp(3.38rem, 5.1vw, 5.18rem) !important;
  line-height: 1.16;
}

#memory-intro-dialog .puzzle-rules-intro {
  max-width: 43.5rem;
  margin: 0 auto 1.15rem !important;
  font-size: clamp(1.58rem, 2.18vw, 1.98rem) !important;
  line-height: 1.65;
}

#memory-intro-dialog .puzzle-rules-list {
  max-width: none;
  gap: .68rem;
}

#memory-intro-dialog .puzzle-rules-list li {
  grid-template-columns: 3.98rem 1fr;
  gap: 1.28rem;
  min-height: 0;
  padding: .78rem 1.25rem;
}

#memory-intro-dialog .puzzle-rules-list span {
  width: 3.42rem;
  height: 3.42rem;
  font-size: 1.5rem;
}

#memory-intro-dialog .puzzle-rules-list p {
  font-size: clamp(1.5rem, 2.03vw, 1.8rem) !important;
  line-height: 1.55;
}

#memory-intro-dialog .puzzle-rules-actions {
  margin-top: 1.15rem;
  gap: 1.35rem;
}

#memory-intro-dialog .puzzle-rules-actions .brass-action-button {
  min-width: 0 !important;
  min-height: 4.5rem !important;
  padding: 1.17rem 2.03rem !important;
  font-size: 1.62rem !important;
  white-space: nowrap;
}

/* A stronger, exhibition-style frame keeps the enlarged memory rules card
   visually distinct from the softened game board beneath it. */
#memory-intro-dialog .memory-rules-card {
  position: relative;
  isolation: isolate;
  border: .22rem solid #5d3515 !important;
  border-radius: 1.2rem !important;
  box-shadow:
    0 1.15rem 2.4rem rgba(12, 8, 4, .48),
    inset 0 0 0 .14rem #f7dda0,
    inset 0 0 0 .34rem rgba(134, 76, 25, .72),
    inset 0 0 0 .48rem rgba(255, 235, 178, .5) !important;
}

#memory-intro-dialog .memory-rules-card::before {
  content: "";
  position: absolute;
  z-index: -1;
  inset: .58rem;
  pointer-events: none;
  border: .08rem solid rgba(111, 61, 18, .68);
  border-radius: .78rem;
  box-shadow:
    inset 0 0 0 .08rem rgba(255, 239, 190, .66),
    0 0 0 .08rem rgba(244, 202, 111, .28);
}

/* 共用排行榜：成績上傳中提示 */
.leaderboard-sync-toast {
  position: fixed;
  left: 50%;
  bottom: 48px;
  z-index: 9999;
  transform: translateX(-50%);
  padding: 14px 32px;
  border-radius: 999px;
  background: rgba(30, 38, 28, 0.9);
  color: #fdf6e3;
  font-size: 1.3rem;
  letter-spacing: 0.08em;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
  pointer-events: none;
}

.leaderboard-sync-toast[hidden] {
  display: none;
}

/* ---------- 小螢幕提示：畫面放不下遊戲時才顯示 ----------
   依實測，以下尺寸翻翻樂的 12 張牌無法完整顯示：
   1. 寬度 718px 以下（手機直向）
   2. 寬度 1100px 以下且高度 834px 以下（上下排列版面太矮：手機橫向、舊款平板橫向）
   3. 高度 576px 以下（左右排列版面太矮） */
.small-screen-notice {
  display: none;
}

@media (max-width: 718px), (max-width: 1100px) and (max-height: 834px), (max-height: 576px) {
  .small-screen-notice {
    position: fixed;
    inset: 0;
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow-y: auto;
    padding: 24px 16px;
    background:
      radial-gradient(circle at top, rgba(226, 233, 214, 0.35), transparent 45%),
      linear-gradient(180deg, var(--bg-moss) 0%, var(--bg-deep) 100%);
    color: var(--ink);
    font-family: var(--font-body);
  }

  .small-screen-notice-card {
    width: min(100%, 30rem);
    margin: auto;
    padding: clamp(20px, 5vw, 32px);
    border: 2px solid var(--wood-soft, #b79362);
    border-radius: 18px;
    background: var(--card-strong);
    box-shadow: 0 18px 40px rgba(0, 0, 0, 0.35);
    text-align: center;
  }

  .small-screen-notice-brand {
    margin: 0 0 6px;
    color: var(--wood);
    font-size: 0.9rem;
    letter-spacing: 0.12em;
  }

  .small-screen-notice-card h2 {
    margin: 0 0 12px;
    color: var(--wood-dark);
    font-family: var(--font-display);
    font-size: clamp(1.4rem, 6vw, 1.9rem);
    line-height: 1.3;
  }

  .small-screen-notice-lead {
    margin: 0 0 16px;
    font-size: 1rem;
    line-height: 1.7;
  }

  .small-screen-notice-tips {
    margin: 0 0 18px;
    padding: 0;
    list-style: none;
    text-align: left;
  }

  .small-screen-notice-tips li {
    margin: 0 0 8px;
    padding: 10px 12px;
    border-radius: 10px;
    background: rgba(217, 199, 165, 0.35);
    font-size: 0.95rem;
    line-height: 1.6;
  }

  .small-screen-notice-tips strong {
    display: block;
    color: var(--wood-dark);
  }

  .small-screen-notice-ebook {
    margin: 0 0 10px;
    font-size: 0.95rem;
  }

  .small-screen-notice-link {
    display: inline-block;
    padding: 12px 28px;
    border-radius: 999px;
    background: linear-gradient(180deg, var(--wood) 0%, var(--wood-dark) 100%);
    color: #fdf6e3;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-decoration: none;
    box-shadow: 0 6px 14px rgba(60, 40, 20, 0.3);
  }

  .small-screen-notice-link:focus-visible {
    outline: 3px solid var(--accent);
    outline-offset: 3px;
  }

  /* 遊戲本體與彈出視窗暫時隱藏，也不能用鍵盤切換到後面的按鈕 */
  .app-shell,
  dialog[open],
  .leaderboard-sync-toast {
    visibility: hidden !important;
  }
}
