@font-face {
  font-family: 'GameCJK';
  src: url('./fonts/game-cjk.woff2') format('woff2');
  font-style: normal;
  font-weight: 500;
  font-display: block;
}
@font-face {
  font-family: 'GameCJK';
  src: url('./fonts/catalog-cjk.woff2') format('woff2');
  font-style: normal;
  font-weight: 500;
  font-display: block;
  unicode-range: U+3400-9FFF;
}
@font-face {
  font-family: 'GameCJK';
  src: url('./fonts/stroke-supplement.woff2') format('woff2');
  font-style: normal;
  font-weight: 500;
  font-display: block;
  unicode-range: U+31E4-31E5;
}
*,
*::before,
*::after {
  box-sizing: border-box;
}
html,
body {
  margin: 0;
  width: 100%;
  min-height: 100%;
}
body {
  overflow-x: hidden;
  background: radial-gradient(ellipse at 20% 20%, #33405a, #111923 70%);
  color: #f7f3ea;
  font-family: system-ui, 'GameCJK', 'Microsoft YaHei', sans-serif;
}
button,
select {
  font: inherit;
}
button,
select {
  min-width: 44px;
  min-height: 44px;
}
button {
  cursor: pointer;
}
button:disabled {
  opacity: 0.45;
  cursor: default;
}
[hidden] {
  display: none !important;
}
#app {
  position: relative;
  width: min(100%, 360px);
  margin: auto;
  padding-bottom: env(safe-area-inset-bottom);
  background: #1c2430;
  box-shadow: 0 20px 100px #0008;
}
#game-container {
  width: 100%;
  aspect-ratio: 9 / 16;
  direction: ltr;
}
.play-area {
  position: relative;
  isolation: isolate;
}
canvas {
  display: block;
  touch-action: none;
}
.level-controls {
  position: relative;
  padding: max(4px, env(safe-area-inset-top)) 10px 4px;
}
.level-actions {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 6px;
}
.level-actions [data-testid='level-select'] {
  grid-column: 1 / -1;
}
.level-actions select {
  flex: 1;
  min-width: 0;
}
.level-actions button,
.level-actions select {
  border: 1px solid #5b6d80;
  border-radius: 8px;
  background: #253347;
  color: #fff8f0;
  padding: 4px 8px;
  font-size: 12px;
}
.level-goals {
  font-size: 12px;
  line-height: 16px;
  color: #f5d6ba;
  margin-top: 2px;
  white-space: nowrap;
  overflow-x: auto;
  scrollbar-width: none;
}
.play-hint {
  font-size: 11px;
  line-height: 16px;
  color: #bdc7d5;
  white-space: nowrap;
  overflow-x: auto;
  scrollbar-width: none;
}
.slot-count-dom {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  overflow: visible;
  z-index: 40;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  pointer-events: none;
}
.candidate-rail {
  position: absolute;
  left: 10px;
  right: 10px;
  top: 61%;
  height: 19%;
  z-index: 8;
  display: flex;
  gap: 8px;
  align-items: stretch;
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-width: thin;
  scrollbar-color: #b97548 #263347;
  padding-bottom: 4px;
  overscroll-behavior-x: contain;
  touch-action: pan-x pan-y;
}
.candidate-card {
  flex: 0 0 180px;
  min-width: 0;
  display: grid;
  grid-template-columns: 30px 1fr;
  grid-template-rows: minmax(0, 1fr) 44px;
  column-gap: 6px;
  row-gap: 4px;
  border: 1px solid #9c6b45;
  border-radius: 9px;
  background: #273448;
  padding: 6px;
}
.candidate-empty {
  font-size: 11px;
  line-height: 1.6;
  color: #bdc7d5;
  white-space: pre-line;
  margin: 8px;
}
.candidate-target {
  align-self: center;
  font-size: 24px;
  line-height: 1.1;
}
.candidate-meta {
  align-self: stretch;
  min-height: 0;
  min-width: 0;
  font-size: 10px;
  line-height: 12px;
  color: #eee0d2;
  overflow: auto;
  scrollbar-width: none;
}
.candidate-strokes {
  color: #f1c7a2;
}
.candidate-materials {
  color: #a9dfc3;
}
.candidate-materials[data-available='false'] {
  color: #ffce9c;
}
.candidate-gloss {
  display: block;
}
.candidate-card[data-candidate-kind='word'],
.candidate-card[data-candidate-kind='phrase'],
.candidate-card[data-candidate-kind='idiom'] {
  grid-template-columns: 1fr;
  border-color: #70ba97;
}
.candidate-card:not([data-candidate-kind='character']) .candidate-target {
  font-size: 20px;
}
.candidate-card:not([data-candidate-kind='character']) .candidate-meta {
  display: block;
}
.candidate-card:not([data-candidate-kind='character']) {
  grid-template-rows: 20px minmax(0, 1fr) 44px;
  row-gap: 2px;
}
.candidate-btn {
  grid-column: 1 / -1;
  border: 1px solid #d18b59;
  border-radius: 6px;
  background: #87421f;
  color: #fff8f0;
  font-size: 14px;
  font-weight: 650;
}
.candidate-btn:hover {
  background: #a6562a;
}
button:focus-visible,
select:focus-visible {
  outline: 2px solid #fff5db;
  outline-offset: -3px;
}
.discovered-results {
  position: absolute;
  top: 58%;
  left: 12px;
  right: 12px;
  z-index: 6;
  color: #a9dfc3;
  font-size: 10px;
  line-height: 14px;
  white-space: nowrap;
  text-overflow: ellipsis;
  overflow: hidden;
  pointer-events: none;
}
.result-overlay {
  position: absolute;
  inset: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #0c1016db;
  padding: 12px;
  border-radius: 16px;
}
.result-card {
  width: min(300px, 100%);
  max-height: 100%;
  overflow-y: auto;
  text-align: center;
  padding: 16px 12px;
  background: linear-gradient(#2d3b51, #1c2430);
  border: 1px solid #648073;
  border-radius: 18px;
}
.result-card h2 {
  margin: 0 0 12px;
  font-size: 21px;
}
.result-detail {
  margin: 0 0 20px;
  font-size: 14px;
  line-height: 1.6;
  color: #e0d4c8;
}
.result-retry {
  width: 100%;
  margin-top: 8px;
  padding: 10px 18px;
  border: 1px solid #d18b59;
  border-radius: 8px;
  background: #87421f;
  color: #fff8f0;
  font-size: 16px;
  font-weight: 650;
}
@media (prefers-reduced-motion: reduce) {
  * {
    scroll-behavior: auto;
  }
}

/* Shell content may scroll on compact screens; game coordinates never change. */
bdi[lang='zh-CN'] {
  font-family: 'GameCJK', sans-serif;
}
.level-info {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.level-info button {
  font-size: 11px;
  padding: 2px 8px;
}
.help-controls {
  padding: 6px 10px 8px;
}
.prop-bar {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
}
.prop-bar button {
  min-height: 48px;
  padding: 4px;
}
.prop-bar small {
  display: block;
  font-size: 10px;
  line-height: 1.3;
}
.help-controls button,
.level-info button,
.hint-panel button,
.tool-dialog button,
.learning-card button {
  color: #fff8f0;
  background: #304258;
  border: 1px solid #779281;
  border-radius: 8px;
}
.help-status,
.daily-reset {
  font-size: 11px;
  line-height: 1.5;
  margin-top: 4px;
  color: #dcc9b6;
}
.daily-reset {
  font-size: 10px;
  color: #9eb0bd;
}
.help-status:empty {
  display: none;
}
.holding-area {
  position: absolute;
  inset: 0 10px auto;
  height: 44px;
  display: flex;
  gap: 4px;
  align-items: center;
  z-index: 5;
}
.holding-label {
  font-size: 10px;
  flex: 1;
}
.holding-area button {
  min-width: 44px;
  height: 44px;
  background: #44523d;
  border: 1px solid #99c2a4;
  border-radius: 8px;
  color: #fff;
  font-size: 23px;
}
.holding-area [data-hinted='true'] {
  outline: 3px solid #a9dfc3;
}
.hint-panel {
  position: relative;
  z-index: 40;
  max-height: 28dvh;
  overflow: auto;
  padding: 10px;
  background: #283847;
  border-block: 1px solid #76917e;
  font-size: 12px;
}
.hint-record {
  border-bottom: 1px solid #607667;
  padding: 6px 0;
}
.hint-target {
  font-size: 22px;
  display: block;
  color: #d1f1dd;
}
.hint-panel button {
  margin: 6px 4px 0 0;
  padding: 4px 12px;
}
.hint-next {
  margin-top: 4px;
  color: #b7e6d0;
}
.tool-dialog {
  position: absolute;
  inset: 8% 12px auto;
  z-index: 32;
  padding: 16px;
  border-radius: 14px;
  background: #25354af5;
  border: 1px solid #b48f70;
  box-shadow: 0 12px 40px #0009;
}
.tool-dialog p {
  font-size: 13px;
  line-height: 1.5;
  margin: 0 0 12px;
}
.remove-picker {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  direction: ltr;
  margin-bottom: 10px;
}
.remove-picker button {
  font:
    24px 'GameCJK',
    sans-serif;
  width: 44px;
  height: 44px;
}
.remove-picker button[aria-pressed='true'] {
  outline: 3px solid #d9b791;
  background: #795637;
}
.tool-dialog > button {
  padding: 8px;
  margin-inline-end: 8px;
}
.learning-feedback {
  position: absolute;
  inset: 0;
  z-index: 30;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 120px 14px 20px;
  background: #0c10165c;
}
.learning-card {
  width: 100%;
  max-height: 360px;
  overflow: auto;
  background: #17212df5;
  border: 2px solid #bd784c;
  padding: 12px;
  border-radius: 16px;
  text-align: center;
  box-shadow: 0 10px 40px #0008;
}
.learning-target {
  display: block;
  font-size: 48px;
  line-height: 1.3;
}
.stroke-replay {
  display: block;
  width: 104px;
  height: 104px;
  margin: auto;
  direction: ltr;
}
.learning-copy {
  font-size: 14px;
  line-height: 1.6;
  margin-block: 8px;
}
.learning-card button {
  padding: 4px 24px;
}
.candidate-meta .learning-examples {
  font-size: 10px;
  line-height: 1.4;
  color: #d9c6ad;
}
.candidate-meta .candidate-pinyin {
  color: #efbd94;
}
.candidate-card[data-hinted='true'] {
  border: 2px solid #a9dfc3;
}

.play-tools {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  padding-top: 4px;
}
.game-instruction {
  min-width: 0;
  margin: 0;
  padding: 7px 8px;
  border-inline-start: 3px solid #d98a56;
  border-radius: 4px;
  background: #263448;
  color: #fff0d7;
  font-size: 12px;
  line-height: 1.4;
}
.play-tool-buttons {
  display: flex;
  gap: 6px;
}
.play-tool-buttons button {
  min-height: 40px;
  padding: 4px 8px;
  border: 1px solid #687e80;
  border-radius: 6px;
  background: #334155;
  color: #f7f3ea;
  font-size: 11px;
}
.play-tool-buttons button:hover {
  background: #42546b;
}
.play-tool-buttons [data-muted='true'] {
  border-color: #b89a79;
  color: #e2c5a5;
}
.how-to-play-dialog,
.share-dialog {
  width: min(340px, calc(100vw - 24px));
  max-height: min(80dvh, 680px);
  overflow: auto;
  margin: auto;
  padding: 16px;
  border: 1px solid #8da298;
  border-radius: 10px;
  background: #f4efe6;
  color: #1d2a31;
  box-shadow: 0 18px 56px #0009;
}
.how-to-play-dialog::backdrop,
.share-dialog::backdrop {
  background: #0d1720c9;
  backdrop-filter: blur(2px);
}
.dialog-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 1px solid #ced5ce;
  padding-bottom: 12px;
}
.dialog-kicker {
  color: #507268;
  font-size: 10px;
  font-weight: 700;
}
.dialog-heading h2 {
  margin: 4px 0;
  font-size: 22px;
  line-height: 1.25;
}
.dialog-heading p,
.guide-steps p {
  margin: 0;
  color: #33434a;
  font-size: 14px;
  line-height: 1.5;
}
.dialog-heading > button,
.how-to-play-dialog > button,
.share-dialog button {
  min-height: 44px;
  padding: 6px 12px;
  border: 1px solid #80958b;
  border-radius: 6px;
  background: #fffdf8;
  color: #223631;
}
.guide-steps {
  display: grid;
  gap: 4px;
  margin: 12px 0 0;
  padding: 0;
  list-style: none;
}
.guide-steps li {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr);
  align-items: start;
  gap: 8px;
  padding: 10px 0;
  border-bottom: 1px solid #e0e3dc;
}
.guide-steps li > span {
  display: grid;
  width: 28px;
  aspect-ratio: 1;
  place-items: center;
  border-radius: 50%;
  background: #dfe9e1;
  color: #274f45;
  font-size: 13px;
  font-weight: 700;
}
.feedback-character .learning-card {
  border-top: 4px solid #325f54;
}
.feedback-word .learning-card,
.feedback-phrase .learning-card,
.feedback-idiom .learning-card {
  animation: word-arrives 420ms cubic-bezier(0.2, 0.8, 0.2, 1) both;
}
.feedback-phrase .learning-target,
.feedback-idiom .learning-target {
  color: #315e53;
  text-shadow: 0 2px 0 #d8e3d9;
}
.learning-card [data-testid='share-learning-card'] {
  min-height: 44px;
  margin-inline-end: 8px;
}
.share-card-preview {
  display: grid;
  justify-items: center;
  gap: 8px;
  margin: 12px 0;
  padding: 14px;
  border: 1px solid #b8c7bb;
  border-radius: 6px;
  background: #e8eee7;
  text-align: center;
}
.share-glyph {
  font:
    500 88px/1.15 'GameCJK',
    sans-serif;
  color: #1d302b;
}
.share-pinyin {
  color: #a4522c;
  font-size: 18px;
}
.share-gloss {
  color: #33434a;
  font-size: 14px;
}
.share-example {
  font:
    500 22px/1.4 'GameCJK',
    sans-serif;
  color: #315e53;
}
.share-brand {
  margin-top: 8px;
  color: #507268;
  font-size: 10px;
  font-weight: 700;
}
.share-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}
.share-actions button:first-child {
  grid-column: 1 / -1;
  background: #315e53;
  color: #fffdf8;
}
.share-status {
  min-height: 1.5em;
  margin: 8px 0 0;
  color: #315e53;
  font-size: 12px;
}
.share-copy-fallback {
  position: fixed;
  width: 1px;
  height: 1px;
  opacity: 0;
}
@keyframes word-arrives {
  from {
    opacity: 0.75;
    transform: translateY(8px) scale(0.97);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}
@media (prefers-reduced-motion: reduce) {
  .feedback-word .learning-card,
  .feedback-phrase .learning-card,
  .feedback-idiom .learning-card {
    animation: none;
  }
}
@media (max-width: 374px) {
  .play-tools {
    grid-template-columns: 1fr;
  }
  .play-tool-buttons button {
    flex: 1;
  }
}

/* Product shell: the game owns the viewport; the document must not scroll. */
html,
body {
  height: 100%;
  overflow: hidden;
}
body {
  background: #161b1b;
}
#app {
  width: min(100vw, 480px);
  /* Percentage height keeps the shell usable on pre-dvh mobile browsers. */
  height: 100%;
  height: 100dvh;
  min-height: 0;
  padding-bottom: 0;
  overflow: hidden;
  display: block;
  background: #f3ecdc;
  color: #20322d;
  box-shadow: 0 20px 100px #0005;
}
#game-screen {
  height: 100%;
  min-height: 0;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  overflow: hidden;
}
#game-container {
  width: 100%;
  height: 100%;
  min-height: 0;
  aspect-ratio: auto;
  /* Phaser FIT/CENTER_BOTH owns the canvas margins and input bounds. */
  display: block;
}
#game-container canvas {
  max-width: 100%;
  max-height: 100%;
}
.level-controls {
  min-height: 0;
  padding: max(4px, env(safe-area-inset-top)) 10px 4px;
  overflow: hidden;
  background: #e9dfcd;
  border-bottom: 1px solid #c7b79e;
}
.level-actions {
  overflow: hidden;
}
.level-actions button,
.level-actions select {
  border-color: #9e8b71;
  background: #f8f2e8;
  color: #24332f;
}
.level-info,
.play-tools {
  min-height: 0;
}
.game-instruction {
  border-inline-start-color: #b5482e;
  background: #f8f2e8;
  color: #31433b;
}
.play-tool-buttons button {
  border-color: #aa9679;
  background: #e1d3bc;
  color: #24332f;
}
.play-area {
  min-height: 0;
  overflow: hidden;
}
.game-companion {
  position: absolute;
  top: 8px;
  right: 12px;
  z-index: 4;
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border: 2px solid #24332f;
  border-radius: 50% 50% 46% 46%;
  background: #24332f;
  color: #f3ecdc;
  font:
    500 20px/1 'GameCJK',
    sans-serif;
  box-shadow: 0 3px 0 #b5482e;
  animation: companion-breathe 2800ms ease-in-out infinite;
  pointer-events: none;
}
.game-companion::after {
  content: '';
  position: absolute;
  right: -5px;
  bottom: 1px;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #b5482e;
}
html[data-theme='jade'] .game-companion {
  border-radius: 10px 10px 15px 15px;
  background: #315e53;
  box-shadow: 0 3px 0 #8cae9d;
}
html[data-theme='night'] .game-companion {
  background: #202b2d;
  color: #f0e6d2;
  border-color: #d9a441;
  box-shadow: 0 3px 0 #d9a441;
}
.candidate-rail {
  overflow-y: hidden;
}
.help-controls {
  min-height: 0;
  padding: 6px 10px max(8px, env(safe-area-inset-bottom));
  background: #e9dfcd;
  border-top: 1px solid #c7b79e;
}
.help-controls button,
.level-info button,
.hint-panel button,
.tool-dialog button,
.learning-card button {
  color: #24332f;
  background: #f8f2e8;
  border-color: #8f9b83;
}
.prop-bar button {
  background: #e1d3bc;
  border-color: #9e8b71;
}
.prop-bar button:hover,
.level-actions button:hover,
.play-tool-buttons button:hover {
  background: #d7c3a6;
}
.learning-feedback {
  background: #18211dcc;
  padding-top: clamp(56px, 12%, 120px);
}
.learning-card {
  max-height: min(72dvh, 520px);
  background: #fbf6eb;
  border-color: #b5482e;
  color: #24332f;
  box-shadow: 0 18px 56px #18211d55;
}
.learning-card button {
  background: #e8dcc7;
}
.pronunciation-button {
  display: inline-grid;
  width: 44px;
  min-height: 44px;
  place-items: center;
  margin: 4px auto 0;
  border-radius: 50% !important;
  font-weight: 800;
  color: #9b3d29 !important;
}
.learning-card::after {
  content: '';
  display: block;
  height: 1px;
  margin-top: 12px;
  background: #d8c9b2;
}
.feedback-character .learning-card {
  animation: ink-settle 650ms cubic-bezier(0.2, 0.8, 0.2, 1) both;
}
.feedback-word .learning-card,
.feedback-phrase .learning-card,
.feedback-idiom .learning-card {
  animation: word-arrives 560ms cubic-bezier(0.2, 0.8, 0.2, 1) both;
}
.feedback-word::before,
.feedback-phrase::before,
.feedback-idiom::before {
  content: '';
  position: absolute;
  width: min(92%, 360px);
  height: 120px;
  top: 38%;
  left: 50%;
  transform: translate(-50%, -50%);
  border: 1px solid #e2c7a166;
  background: #d9c39d22;
  filter: blur(18px);
  animation: ink-mist 700ms ease-out both;
  pointer-events: none;
}

/* Home screen */
.home-screen {
  position: absolute;
  inset: 0;
  z-index: 60;
  overflow: auto;
  padding: max(28px, env(safe-area-inset-top)) 20px max(28px, env(safe-area-inset-bottom));
  background:
    repeating-linear-gradient(
      0deg,
      #9c85631a 0,
      #9c85631a 1px,
      transparent 1px,
      transparent 4px
    ),
    #f3ecdc;
  color: #24332f;
}
.home-content {
  width: min(100%, 380px);
  min-height: 100%;
  margin: auto;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 14px;
}
.home-hero {
  text-align: center;
  padding: 12px 0 8px;
}
.home-mark {
  display: grid;
  width: 76px;
  aspect-ratio: 1;
  place-items: center;
  margin: 0 auto 14px;
  border: 2px solid #b5482e;
  border-radius: 18px 4px 18px 4px;
  background: #f8f2e8;
  color: #253d35;
  font:
    500 42px/1 'GameCJK',
    sans-serif;
  box-shadow: 6px 6px 0 #b5482e33;
}
.home-hero h1 {
  margin: 0;
  font:
    700 clamp(28px, 8vw, 40px)/1.1 Georgia,
    'Times New Roman',
    serif;
  letter-spacing: 0;
}
.home-hero p,
.home-progress,
.home-stats {
  margin: 6px 0 0;
  color: #5d6b5f;
  font-size: 13px;
}
.home-action,
.theme-choice,
.icon-action {
  min-height: 48px;
  border: 1px solid #9e8b71;
  border-radius: 10px;
  background: #e1d3bc;
  color: #24332f;
  padding: 8px 14px;
  font-weight: 700;
}
.home-action-primary {
  min-height: 58px;
  border-color: #9d3b28;
  background: #b5482e;
  color: #fff9ed;
  box-shadow: 0 8px 0 #7c2e22;
}
.home-action-primary:active {
  transform: translateY(3px);
  box-shadow: 0 5px 0 #7c2e22;
}
.home-nav {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}
.home-setting,
.home-theme {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  color: #5d6b5f;
  font-size: 12px;
}
.home-setting select {
  min-height: 42px;
  border: 1px solid #9e8b71;
  border-radius: 8px;
  background: #f8f2e8;
  color: #24332f;
}
.home-theme {
  flex-wrap: wrap;
  justify-content: flex-start;
}
.home-theme > span {
  width: 100%;
}
.theme-choice {
  flex: 1;
  min-width: 0;
  font-size: 12px;
}
.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 1px solid #c7b79e;
  padding-bottom: 12px;
}
.panel-header h2 {
  margin: 0;
  font:
    700 24px/1.2 Georgia,
    'Times New Roman',
    serif;
}
.collection-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(76px, 1fr));
  gap: 8px;
}
.collection-tabs {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}
.collection-tab {
  min-height: 44px;
  border: 1px solid #c7b79e;
  border-radius: 8px;
  background: #efe5d3;
  color: #4d5b50;
  font-size: 12px;
  font-weight: 700;
}
.collection-tab[aria-pressed='true'] {
  border-color: #9d3b28;
  background: #b5482e;
  color: #fff9ed;
}
.collection-card {
  min-height: 82px;
  border: 1px solid #c7b79e;
  border-radius: 8px;
  background: #f8f2e8;
  color: #24332f;
  display: grid;
  place-items: center;
  gap: 2px;
}
.collection-card strong {
  font:
    500 32px/1 'GameCJK',
    sans-serif;
}
.collection-card span {
  font-size: 11px;
  color: #8e4c38;
}
.collection-detail {
  display: grid;
  gap: 8px;
  padding: 18px;
  border: 1px solid #c7b79e;
  border-radius: 12px;
  background: #fbf6eb;
  text-align: center;
}
.collection-detail p {
  margin: 0;
  line-height: 1.5;
}
.collection-detail-glyph {
  font:
    500 72px/1 'GameCJK',
    sans-serif;
}
.leaderboard-list {
  display: grid;
  gap: 6px;
}
.leaderboard-row {
  display: grid;
  grid-template-columns: 36px 1fr auto;
  gap: 10px;
  align-items: center;
  padding: 12px;
  border: 1px solid #c7b79e;
  border-radius: 8px;
  background: #f8f2e8;
}
.empty-panel {
  color: #68766a;
  line-height: 1.6;
}

/* Themes change texture, geometry, and interaction accents in addition to color. */
html[data-theme='jade'] #app,
html[data-theme='jade'] .home-screen {
  background: #dfe8df;
}
html[data-theme='jade'] .home-screen {
  background:
    repeating-linear-gradient(
      90deg,
      #50726812 0,
      #50726812 1px,
      transparent 1px,
      transparent 5px
    ),
    #dfe8df;
}
html[data-theme='jade'] .home-mark {
  border-radius: 50%;
  border-color: #507268;
  box-shadow: 0 6px 0 #50726833;
}
html[data-theme='jade'] .home-action-primary {
  border-color: #315e53;
  background: #507268;
  box-shadow: 0 8px 0 #315e53;
}
html[data-theme='jade'] .level-controls,
html[data-theme='jade'] .help-controls {
  background: #d1e0d4;
  border-color: #9bb8a5;
}
html[data-theme='jade'] .candidate-card {
  border-radius: 18px 6px 18px 6px;
  background: #eaf2e9;
  border-color: #7ca08e;
}
html[data-theme='night'] #app,
html[data-theme='night'] .home-screen {
  background: #1d2528;
  color: #f0e6d2;
}
html[data-theme='night'] .home-screen {
  background:
    repeating-linear-gradient(
      0deg,
      #f0e6d20a 0,
      #f0e6d20a 1px,
      transparent 1px,
      transparent 5px
    ),
    #1d2528;
}
html[data-theme='night'] .home-hero p,
html[data-theme='night'] .home-progress,
html[data-theme='night'] .home-stats,
html[data-theme='night'] .home-setting,
html[data-theme='night'] .home-theme,
html[data-theme='night'] .empty-panel {
  color: #c4bba9;
}
html[data-theme='night'] .home-mark {
  background: #2c383b;
  border-color: #d9a441;
  color: #f0e6d2;
  box-shadow: 6px 6px 0 #d9a44133;
}
html[data-theme='night'] .home-action,
html[data-theme='night'] .theme-choice,
html[data-theme='night'] .icon-action,
html[data-theme='night'] .collection-card,
html[data-theme='night'] .leaderboard-row {
  background: #2c383b;
  border-color: #566668;
  color: #f0e6d2;
}
html[data-theme='night'] .home-action-primary {
  background: #b86b32;
  border-color: #d9a441;
  box-shadow: 0 8px 0 #824721;
}

@keyframes ink-mist {
  from {
    opacity: 0;
    transform: translate(-50%, -50%) scale(0.72);
  }
  45% {
    opacity: 0.9;
  }
  to {
    opacity: 0;
    transform: translate(-50%, -50%) scale(1.18);
  }
}
@keyframes ink-settle {
  from {
    opacity: 0;
    transform: translateY(14px) scale(0.96);
    filter: blur(5px);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
    filter: blur(0);
  }
}
@keyframes companion-breathe {
  0%,
  100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-2px);
  }
}
@media (max-height: 650px) {
  .level-controls {
    padding-block: 2px;
  }
  .play-tools {
    padding-top: 2px;
  }
  .game-instruction {
    padding-block: 4px;
  }
  .help-controls {
    padding-block: 3px;
  }
  .prop-bar button {
    min-height: 44px;
  }
}
@media (min-width: 600px) {
  #app {
    height: min(100dvh, 900px);
    margin: auto;
  }
  body {
    display: grid;
    place-items: center;
  }
}
