:root {
  color-scheme: dark;
  --night: #07171d;
  --night-soft: #102a32;
  --ink: #e9e0c8;
  --ink-soft: #b8b098;
  --paper: #d9caa7;
  --cinnabar: #d7583d;
  --cinnabar-dark: #8e2f2a;
  --gold: #c8a55a;
  --jade: #86a99a;
  --line: rgba(233, 224, 200, 0.2);
  font-family: "Noto Serif SC", "Songti SC", SimSun, serif;
  background: var(--night);
  color: var(--ink);
  font-synthesis: none;
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  min-width: 320px;
  height: 100%;
  min-height: 580px;
  margin: 0;
  overflow: hidden;
  background:
    radial-gradient(circle at 72% 20%, rgba(66, 91, 100, 0.25), transparent 28%),
    radial-gradient(circle at 50% 95%, rgba(103, 63, 55, 0.25), transparent 34%),
    linear-gradient(145deg, #07151b 0%, #0b2028 48%, #101925 100%);
}

body {
  position: relative;
  display: grid;
  grid-template-rows: auto 1fr auto;
  isolation: isolate;
  user-select: none;
  -webkit-user-select: none;
}

button,
a {
  font: inherit;
}

button {
  color: inherit;
}

.paper-grain {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  opacity: 0.18;
  background-image:
    repeating-radial-gradient(circle at 20% 30%, transparent 0 2px, rgba(255,255,255,.12) 2.5px 3px, transparent 3.5px 8px),
    repeating-linear-gradient(84deg, transparent 0 21px, rgba(255,255,255,.025) 22px, transparent 24px 47px);
  background-size: 90px 90px, 140px 140px;
  mix-blend-mode: soft-light;
}

.paper-grain::after {
  content: "";
  position: absolute;
  inset: 0;
  box-shadow: inset 0 0 140px 35px rgba(0, 0, 0, 0.52);
}

.masthead {
  position: relative;
  z-index: 5;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  padding: max(22px, env(safe-area-inset-top)) max(28px, env(safe-area-inset-right)) 0 max(28px, env(safe-area-inset-left));
}

.eyebrow {
  margin: 0 0 7px 2px;
  color: var(--jade);
  font: 500 10px/1.2 ui-monospace, "SFMono-Regular", Consolas, monospace;
  letter-spacing: 0.35em;
}

.title-row {
  display: flex;
  align-items: flex-start;
  gap: 12px;
}

h1 {
  display: flex;
  gap: 3px;
  margin: 0;
  font-size: clamp(38px, 5vw, 70px);
  font-weight: 700;
  line-height: 0.92;
  letter-spacing: -0.08em;
  text-shadow: 0 4px 24px rgba(0, 0, 0, 0.5);
}

h1 span:nth-child(2) {
  transform: translateY(4px);
}

.side-copy {
  margin: 1px 0 0;
  padding-left: 10px;
  border-left: 1px solid var(--line);
  color: var(--ink-soft);
  font-size: 12px;
  line-height: 1.55;
  letter-spacing: 0.25em;
}

.seal {
  display: grid;
  place-items: center;
  width: 34px;
  height: 43px;
  margin-top: -3px;
  border: 1px solid rgba(215, 88, 61, 0.85);
  color: #f0c0a8;
  background: rgba(142, 47, 42, 0.38);
  font-size: 9px;
  line-height: 1.25;
  letter-spacing: 0.12em;
  transform: rotate(2deg);
}

.subtitle {
  margin: 9px 0 0 2px;
  color: rgba(233, 224, 200, 0.62);
  font-size: 12px;
  letter-spacing: 0.35em;
}

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

.ink-button {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 36px;
  padding: 0 15px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(7, 23, 29, 0.45);
  color: var(--ink-soft);
  font-size: 11px;
  letter-spacing: 0.16em;
  backdrop-filter: blur(10px);
  cursor: pointer;
  transition: border-color .2s, color .2s, transform .2s;
}

.ink-button:hover,
.ink-button:focus-visible {
  border-color: rgba(215, 88, 61, .7);
  color: var(--ink);
  outline: none;
}

.ink-button:active {
  transform: scale(.96);
}

.sound-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--cinnabar);
  box-shadow: 0 0 10px var(--cinnabar);
}

.ink-button[aria-pressed="false"] .sound-dot {
  background: #66747a;
  box-shadow: none;
}

.achievement-button b {
  color: var(--cinnabar);
  font: 500 10px/1 ui-monospace, Consolas, monospace;
}

.stage {
  position: relative;
  min-height: 0;
  overflow: hidden;
  touch-action: none;
}

#toy-canvas {
  position: absolute;
  inset: 0;
  z-index: 2;
  width: 100%;
  height: 100%;
  cursor: grab;
  touch-action: none;
}

#toy-canvas:active {
  cursor: grabbing;
}

.moon {
  position: absolute;
  top: 8%;
  right: 21%;
  width: clamp(54px, 6vw, 90px);
  aspect-ratio: 1;
  border-radius: 50%;
  background: #e9dcae;
  box-shadow: 0 0 60px rgba(233, 220, 174, .14);
  opacity: .88;
}

.moon i,
.moon::before {
  content: "";
  position: absolute;
  border-radius: 50%;
  background: rgba(124, 115, 91, .18);
}

.moon i {
  width: 17%;
  height: 17%;
  left: 23%;
  top: 45%;
}

.moon::before {
  width: 9%;
  height: 9%;
  right: 26%;
  top: 25%;
}

.cloud {
  position: absolute;
  z-index: 1;
  width: 220px;
  height: 70px;
  opacity: .11;
  border-top: 1px solid var(--paper);
  border-radius: 50%;
  transform: skewX(-20deg);
}

.cloud::before,
.cloud::after {
  content: "";
  position: absolute;
  border-top: 1px solid var(--paper);
  border-radius: 50%;
}

.cloud::before { inset: 17px 30px -5px -45px; }
.cloud::after { inset: 34px -35px -10px 70px; }
.cloud-a { top: 26%; left: 12%; }
.cloud-b { right: 8%; bottom: 24%; transform: scale(.7) skewX(-20deg); }

.instruction {
  position: absolute;
  z-index: 4;
  left: 50%;
  bottom: 10%;
  display: flex;
  align-items: center;
  gap: 12px;
  transform: translateX(-50%);
  padding: 11px 18px 11px 12px;
  border: 1px solid rgba(233, 224, 200, .14);
  border-radius: 999px;
  background: rgba(4, 18, 23, .6);
  box-shadow: 0 10px 40px rgba(0, 0, 0, .25);
  backdrop-filter: blur(12px);
  pointer-events: none;
  white-space: nowrap;
  transition: opacity .3s, transform .3s;
}

.instruction.active {
  opacity: .5;
  transform: translateX(-50%) translateY(8px);
}

.gesture-mark {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border: 1px solid rgba(215, 88, 61, .55);
  border-radius: 50%;
  color: #f3a182;
  font: 20px/1 sans-serif;
}

.instruction strong {
  display: block;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: .18em;
}

.instruction small {
  display: block;
  margin-top: 3px;
  color: rgba(233, 224, 200, .5);
  font-size: 9px;
  letter-spacing: .13em;
}

.meter {
  position: absolute;
  z-index: 4;
  right: max(28px, env(safe-area-inset-right));
  bottom: 8%;
  display: flex;
  width: 112px;
  flex-direction: column;
  align-items: flex-end;
  pointer-events: none;
}

.meter-label,
.meter-unit {
  color: rgba(233, 224, 200, .48);
  font-size: 9px;
  letter-spacing: .25em;
}

.meter strong {
  margin: -2px 0 -5px;
  color: var(--paper);
  font: 300 clamp(42px, 5vw, 72px)/1 "Times New Roman", serif;
  letter-spacing: -.08em;
}

.meter-line {
  width: 100%;
  height: 1px;
  margin-top: 10px;
  overflow: hidden;
  background: rgba(233, 224, 200, .16);
}

.meter-line i {
  display: block;
  width: 0;
  height: 100%;
  background: var(--cinnabar);
  box-shadow: 0 0 8px var(--cinnabar);
  transition: width .12s linear;
}

.stage-actions {
  position: absolute;
  z-index: 4;
  right: max(28px, env(safe-area-inset-right));
  top: 44%;
}

.primary-action {
  display: grid;
  grid-template-columns: 34px 1fr;
  grid-template-rows: auto auto;
  column-gap: 10px;
  min-width: 132px;
  padding: 10px 15px 10px 10px;
  border: 1px solid rgba(215, 88, 61, .5);
  border-radius: 4px;
  background: rgba(7, 23, 29, .68);
  box-shadow: 5px 5px 0 rgba(142, 47, 42, .17);
  text-align: left;
  cursor: pointer;
  backdrop-filter: blur(10px);
  transition: background .2s, transform .2s, box-shadow .2s;
}

.primary-action > span {
  grid-row: 1 / 3;
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--cinnabar-dark);
  color: #f8d0bc;
  font-size: 15px;
}

.primary-action b {
  align-self: end;
  font-size: 12px;
  letter-spacing: .2em;
}

.primary-action small {
  margin-top: 2px;
  color: rgba(233, 224, 200, .45);
  font-size: 8px;
  letter-spacing: .08em;
}

.primary-action:hover,
.primary-action:focus-visible,
.primary-action[aria-pressed="true"] {
  outline: none;
  background: rgba(142, 47, 42, .5);
  transform: translate(-2px, -2px);
  box-shadow: 8px 8px 0 rgba(142, 47, 42, .14);
}

.wah-flash {
  position: absolute;
  z-index: 3;
  left: 50%;
  top: 48%;
  color: rgba(215, 88, 61, 0);
  font-size: clamp(70px, 12vw, 170px);
  font-weight: 700;
  pointer-events: none;
  transform: translate(-50%, -50%) scale(.7) rotate(-8deg);
}

.wah-flash.pop {
  animation: wah-pop .65s ease-out;
}

@keyframes wah-pop {
  0% { color: rgba(215, 88, 61, 0); transform: translate(-50%, -50%) scale(.55) rotate(-8deg); }
  20% { color: rgba(215, 88, 61, .38); }
  100% { color: rgba(215, 88, 61, 0); transform: translate(-50%, -55%) scale(1.3) rotate(3deg); }
}

.status-bar {
  position: relative;
  z-index: 6;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 22px;
  min-height: 58px;
  padding: 9px max(28px, env(safe-area-inset-right)) max(9px, env(safe-area-inset-bottom)) max(28px, env(safe-area-inset-left));
  border-top: 1px solid rgba(233, 224, 200, .08);
  background: rgba(4, 17, 22, .62);
  backdrop-filter: blur(14px);
}

.craft-note {
  display: flex;
  gap: 8px;
  color: rgba(233, 224, 200, .42);
  font-size: 9px;
  letter-spacing: .14em;
}

.craft-note i {
  color: var(--cinnabar);
  font-style: normal;
}

.live-stats {
  display: flex;
  gap: 22px;
  margin: 0;
}

.live-stats div {
  display: grid;
  grid-template-columns: auto auto auto;
  align-items: baseline;
  gap: 4px;
  white-space: nowrap;
}

.live-stats dt,
.live-stats span {
  color: rgba(233, 224, 200, .43);
  font-size: 9px;
  letter-spacing: .12em;
}

.live-stats dd {
  margin: 0;
  color: var(--paper);
  font: 400 14px/1 ui-monospace, Consolas, monospace;
}

.live-stats .personal dd {
  color: #ef8b6c;
}

.footer-links {
  justify-self: end;
  color: rgba(233, 224, 200, .35);
  font-size: 9px;
  letter-spacing: .2em;
}

.footer-links a {
  color: inherit;
  text-decoration: none;
}

.footer-links a:hover,
.footer-links a:focus-visible {
  color: var(--ink);
}

.bamboo {
  position: fixed;
  z-index: 0;
  top: -5%;
  bottom: 2%;
  width: 80px;
  opacity: .2;
  pointer-events: none;
  background:
    linear-gradient(78deg, transparent 42%, #071014 43% 49%, transparent 50%) 20px 0 / 54px 132px repeat-y,
    radial-gradient(ellipse at 80% 50%, #071014 0 24%, transparent 26%) 25px 50px / 65px 90px repeat-y;
  filter: blur(.2px);
}

.bamboo-left { left: -22px; transform: rotate(-3deg); }
.bamboo-right { right: -20px; transform: scaleX(-1) rotate(-4deg); }

.about-dialog {
  width: min(520px, calc(100vw - 40px));
  border: 1px solid rgba(200, 165, 90, .35);
  border-radius: 2px;
  color: var(--ink);
  background:
    linear-gradient(rgba(12, 35, 41, .97), rgba(7, 23, 29, .98)),
    var(--night);
  box-shadow: 0 25px 90px rgba(0, 0, 0, .55);
  user-select: text;
}

.about-dialog::backdrop {
  background: rgba(1, 8, 11, .72);
  backdrop-filter: blur(5px);
}

.about-dialog form {
  position: relative;
  padding: 30px;
}

.dialog-close {
  position: absolute;
  top: 5px;
  right: 7px;
  border: 0;
  background: transparent;
  color: var(--ink-soft);
  font: 300 26px/1 sans-serif;
  cursor: pointer;
}

.dialog-kicker {
  margin: 0;
  color: var(--cinnabar);
  font-size: 10px;
  letter-spacing: .3em;
}

.about-dialog h2 {
  margin: 8px 0 18px;
  font-size: 28px;
  letter-spacing: .18em;
}

.about-dialog p {
  color: rgba(233, 224, 200, .72);
  font-size: 14px;
  line-height: 2;
}

.principle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 22px 0;
  padding: 13px;
  border-block: 1px solid var(--line);
  color: var(--paper);
  font-size: 11px;
  letter-spacing: .12em;
}

.principle b {
  color: var(--cinnabar);
  font-family: sans-serif;
}

.about-dialog blockquote {
  margin: 20px 0;
  color: var(--gold);
  font-size: 17px;
  text-align: center;
  letter-spacing: .25em;
}

.about-dialog .fine-print {
  margin-bottom: 0;
  color: rgba(233, 224, 200, .38);
  font-size: 10px;
  line-height: 1.7;
}

.panel-dialog {
  width: min(680px, calc(100vw - 32px));
  max-height: min(82vh, 760px);
  overflow: auto;
  border: 1px solid rgba(200, 165, 90, .35);
  border-radius: 2px;
  color: var(--ink);
  background: linear-gradient(rgba(12, 35, 41, .98), rgba(7, 23, 29, .99));
  box-shadow: 0 25px 90px rgba(0, 0, 0, .62);
}

.panel-dialog::backdrop {
  background: rgba(1, 8, 11, .78);
  backdrop-filter: blur(6px);
}

.panel-dialog form { position: relative; padding: 28px; }
.panel-dialog h2 { margin: 8px 0 22px; font-size: 27px; letter-spacing: .16em; }

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

.achievement-card {
  position: relative;
  min-height: 104px;
  padding: 16px 16px 14px 68px;
  border: 1px solid rgba(233, 224, 200, .11);
  background: rgba(255, 255, 255, .018);
  overflow: hidden;
}

.achievement-card::before {
  content: attr(data-seal);
  position: absolute;
  left: 16px;
  top: 20px;
  display: grid;
  place-items: center;
  width: 38px;
  height: 48px;
  border: 1px solid rgba(129, 139, 134, .35);
  color: rgba(184, 176, 152, .36);
  font-size: 11px;
  line-height: 1.1;
  text-align: center;
  white-space: pre-line;
}

.achievement-card.earned {
  border-color: rgba(215, 88, 61, .42);
  background: linear-gradient(120deg, rgba(142, 47, 42, .18), rgba(255, 255, 255, .025));
}

.achievement-card.earned::before {
  border-color: var(--cinnabar);
  color: #efb09a;
  background: rgba(142, 47, 42, .28);
  transform: rotate(-3deg);
}

.achievement-card b { display: block; margin: 2px 0 7px; color: rgba(233, 224, 200, .42); font-size: 14px; letter-spacing: .12em; }
.achievement-card.earned b { color: var(--paper); }
.achievement-card p { margin: 0; color: rgba(233, 224, 200, .35); font-size: 10px; line-height: 1.6; }
.achievement-card.earned p { color: rgba(233, 224, 200, .62); }
.achievement-card small { position: absolute; right: 10px; top: 8px; color: rgba(134, 169, 154, .5); font: 8px/1 ui-monospace, Consolas, monospace; }

.share-dialog { width: min(560px, calc(100vw - 24px)); max-height: 92vh; }

#share-canvas {
  display: block;
  width: min(100%, 360px);
  height: auto;
  margin: 0 auto;
  border: 1px solid rgba(200, 165, 90, .3);
  background: #07171d;
  box-shadow: 0 16px 50px rgba(0, 0, 0, .35);
}

.share-actions { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 16px; }
.share-actions button { min-height: 40px; border: 1px solid rgba(215, 88, 61, .45); border-radius: 2px; background: rgba(142, 47, 42, .22); color: var(--ink); font-size: 11px; letter-spacing: .1em; cursor: pointer; }
.share-actions button:hover,
.share-actions button:focus-visible { background: rgba(142, 47, 42, .5); outline: none; }
.share-hint { margin: 12px 0 0; color: rgba(233, 224, 200, .36); font-size: 9px; line-height: 1.6; text-align: center; }

.leaderboard-dialog { width: min(590px, calc(100vw - 24px)); }

.profile-row {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 10px;
  margin-bottom: 18px;
  padding: 10px;
  border: 1px solid rgba(233, 224, 200, .11);
  background: rgba(255, 255, 255, .02);
}

.profile-row label { color: var(--ink-soft); font-size: 10px; letter-spacing: .14em; }
.profile-row input { min-width: 0; height: 34px; border: 0; border-bottom: 1px solid rgba(200,165,90,.35); outline: 0; background: transparent; color: var(--ink); font: 14px/1 "Songti SC", SimSun, serif; }
.profile-row input:focus { border-color: var(--cinnabar); }
.profile-row button { height: 32px; padding: 0 13px; border: 1px solid rgba(215,88,61,.45); background: rgba(142,47,42,.25); color: var(--ink); cursor: pointer; }

.board-tabs { display: grid; grid-template-columns: repeat(3, 1fr); border-bottom: 1px solid rgba(233,224,200,.12); }
.board-tabs button { padding: 11px 6px; border: 0; border-bottom: 2px solid transparent; background: transparent; color: rgba(233,224,200,.45); font-size: 11px; letter-spacing: .14em; cursor: pointer; }
.board-tabs button[aria-selected="true"] { border-bottom-color: var(--cinnabar); color: var(--paper); background: linear-gradient(transparent, rgba(142,47,42,.12)); }

.board-list { min-height: 316px; margin: 0; padding: 10px 0 0; list-style: none; counter-reset: rank; }
.board-list li { counter-increment: rank; display: grid; grid-template-columns: 48px 1fr auto; align-items: center; min-height: 48px; padding: 0 12px; border-bottom: 1px solid rgba(233,224,200,.07); }
.board-list li::before { content: counter(rank, decimal-leading-zero); color: rgba(134,169,154,.48); font: 12px/1 ui-monospace,Consolas,monospace; }
.board-list li:nth-child(-n+3)::before { color: var(--cinnabar); font-size: 14px; }
.board-name { overflow: hidden; color: var(--ink-soft); font-size: 13px; letter-spacing: .1em; text-overflow: ellipsis; white-space: nowrap; }
.board-score { color: var(--paper); font: 500 16px/1 ui-monospace,Consolas,monospace; }
.board-score small { margin-left: 5px; color: rgba(233,224,200,.38); font: 8px/1 "Songti SC",SimSun,serif; }
.board-list .board-loading,
.board-list .board-empty { display: grid; place-items: center; min-height: 280px; color: rgba(233,224,200,.35); font-size: 12px; letter-spacing: .18em; }
.board-list .board-loading::before,
.board-list .board-empty::before { display: none; }
.board-note { margin: 10px 0 0; color: rgba(233,224,200,.32); font-size: 9px; text-align: center; }

.skin-dialog { width: min(760px, calc(100vw - 24px)); }
.skin-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.skin-card { display: grid; grid-template-rows: 125px auto auto; gap: 7px; padding: 0 0 16px; overflow: hidden; border: 1px solid rgba(233,224,200,.12); background: rgba(255,255,255,.02); color: var(--ink); text-align: left; cursor: pointer; }
.skin-card[aria-pressed="true"] { border-color: var(--cinnabar); box-shadow: inset 0 -3px 0 rgba(215,88,61,.45); }
.skin-card b,.skin-card small { padding-inline: 14px; }
.skin-card b { font-size: 14px; letter-spacing: .12em; }
.skin-card small { color: rgba(233,224,200,.4); font-size: 9px; line-height: 1.5; }
.skin-swatch { position: relative; display: block; overflow: hidden; }
.skin-swatch::before { content: "竹"; position: absolute; left: 18px; top: 14px; font: 700 46px/1 "Songti SC",SimSun,serif; }
.skin-swatch::after { content: ""; position: absolute; right: 24px; top: 24px; width: 44px; height: 44px; border-radius: 50%; }
.traditional-swatch { background: linear-gradient(145deg,#07171d,#173943); color:#e9e0c8; }
.traditional-swatch::after { background:#e9dcae; }
.realistic-swatch { background: linear-gradient(145deg,#e0d1ad,#b6c497); color:#31473b; }
.realistic-swatch::after { background:#d98551; box-shadow:0 0 30px #e3aa68; }
.meme-swatch { background: linear-gradient(145deg,#211330,#7b263e); color:#ffe5c8; }
.meme-swatch::after { width:56px; height:30px; top:55px; border-radius:50%; background:#ff805f; box-shadow:inset 0 0 0 7px #5e172f; }

.challenge-banner {
  position: absolute;
  z-index: 5;
  top: 5%;
  left: 50%;
  width: min(340px, calc(100vw - 36px));
  padding: 12px 16px;
  border: 1px solid rgba(215,88,61,.42);
  background: rgba(7,23,29,.78);
  box-shadow: 0 10px 45px rgba(0,0,0,.28);
  transform: translateX(-50%);
  backdrop-filter: blur(12px);
  pointer-events: none;
}
.challenge-banner > span { color: var(--cinnabar); font-size: 8px; letter-spacing: .28em; }
.challenge-banner > strong { display: block; margin-top: 4px; font-size: 12px; letter-spacing: .12em; }
.challenge-banner p { position: absolute; right: 15px; top: 8px; margin: 0; color: var(--paper); font: 500 16px/1 ui-monospace,Consolas,monospace; }
.challenge-banner p i { margin:0 3px; color:rgba(233,224,200,.35); font-style:normal; }
.challenge-banner p small { margin-left:3px; color:rgba(233,224,200,.42); font:8px/1 "Songti SC",SimSun,serif; }
.challenge-banner > div { height: 2px; margin-top: 10px; overflow: hidden; background: rgba(233,224,200,.12); }
.challenge-banner > div i { display:block; width:0; height:100%; background:var(--cinnabar); box-shadow:0 0 8px var(--cinnabar); transition:width .25s; }
.challenge-banner.complete { border-color: rgba(200,165,90,.6); }
.challenge-banner.complete > span { color:var(--gold); }

.challenge-complete { position:fixed; z-index:32; left:50%; top:50%; display:grid; justify-items:center; width:min(370px,calc(100vw - 36px)); padding:28px 22px 22px; border:1px solid rgba(200,165,90,.6); background:rgba(7,23,29,.96); box-shadow:0 25px 90px rgba(0,0,0,.6); opacity:0; pointer-events:none; transform:translate(-50%,-45%) scale(.92); transition:opacity .3s,transform .4s; }
.challenge-complete.show { opacity:1; pointer-events:auto; transform:translate(-50%,-50%) scale(1); }
.challenge-complete > span { color:var(--cinnabar); font-size:9px; letter-spacing:.35em; }
.challenge-complete strong { margin:12px 0 7px; color:var(--paper); font-size:20px; letter-spacing:.12em; }
.challenge-complete small { color:rgba(233,224,200,.46); font-size:10px; }
.challenge-complete button { margin-top:18px; padding:10px 25px; border:1px solid var(--cinnabar); background:rgba(142,47,42,.35); color:var(--ink); cursor:pointer; }
.challenge-complete .quiet-dismiss { margin-top:8px; padding:5px 12px; border:0; background:transparent; color:rgba(233,224,200,.4); font-size:9px; }

body[data-skin="realistic"] {
  --night:#d7c9a7;
  --night-soft:#c2b189;
  --ink:#20362d;
  --ink-soft:#4f665b;
  --paper:#2d4a3d;
  --line:rgba(33,54,45,.2);
  --jade:#486c5a;
  background:radial-gradient(circle at 72% 12%,rgba(255,239,188,.9),transparent 28%),linear-gradient(145deg,#e2d5b6,#bac7a7 55%,#d6c49c);
}
body[data-skin="realistic"] .paper-grain { opacity:.28; mix-blend-mode:multiply; }
body[data-skin="realistic"] .paper-grain::after { box-shadow:inset 0 0 120px 20px rgba(67,58,38,.18); }
body[data-skin="realistic"] .moon { background:#d8794f; box-shadow:0 0 60px rgba(216,121,79,.35); }
body[data-skin="realistic"] .ink-button,
body[data-skin="realistic"] .primary-action,
body[data-skin="realistic"] .instruction,
body[data-skin="realistic"] .challenge-banner { background:rgba(226,213,181,.68); }
body[data-skin="realistic"] .status-bar { background:rgba(214,199,161,.72); }
body[data-skin="realistic"] .bamboo { opacity:.28; filter:none; }

body[data-skin="meme"] {
  --night:#160d22;
  --night-soft:#32142c;
  --ink:#ffe8ce;
  --ink-soft:#d6b4bd;
  --paper:#ffc777;
  --cinnabar:#ff7658;
  --cinnabar-dark:#7d2441;
  --gold:#ffd06e;
  --jade:#8fd4d2;
  background:radial-gradient(circle at 72% 18%,rgba(103,43,92,.55),transparent 32%),linear-gradient(145deg,#130c20,#34152d 55%,#5f2139);
}
body[data-skin="meme"] h1 { text-shadow:4px 4px 0 #6c2540,0 0 30px rgba(255,118,88,.28); }
body[data-skin="meme"] .stage::after { content:"哇啊——"; position:absolute; z-index:1; left:18%; top:34%; color:rgba(255,199,119,0); font:700 clamp(45px,8vw,110px)/1 "Songti SC",SimSun,serif; transform:rotate(-10deg) scale(.8); pointer-events:none; }
body[data-skin="meme"].is-loud .stage::after { animation:meme-wah .7s ease-out infinite; }
@keyframes meme-wah { 0%{color:rgba(255,199,119,0);transform:rotate(-10deg) scale(.7)} 35%{color:rgba(255,199,119,.3)} 100%{color:rgba(255,199,119,0);transform:rotate(-2deg) scale(1.15)} }

.achievement-toast {
  position: fixed;
  z-index: 30;
  top: 22%;
  left: 50%;
  display: grid;
  grid-template-columns: auto 1fr;
  grid-template-rows: auto auto;
  min-width: 280px;
  padding: 13px 18px 13px 68px;
  border: 1px solid rgba(215, 88, 61, .6);
  background: rgba(7, 23, 29, .94);
  box-shadow: 0 16px 60px rgba(0, 0, 0, .5);
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, -20px);
  transition: opacity .25s, transform .35s;
}

.achievement-toast::before { content: "得印"; position: absolute; left: 17px; top: 13px; display: grid; place-items: center; width: 36px; height: 45px; border: 1px solid var(--cinnabar); color: #efb09a; background: rgba(142, 47, 42, .3); font-size: 10px; }
.achievement-toast.show { opacity: 1; transform: translate(-50%, 0); }
.achievement-toast > span { grid-column: 1 / 3; color: var(--cinnabar); font-size: 8px; letter-spacing: .28em; }
.achievement-toast strong { align-self: end; margin-top: 3px; font-size: 14px; letter-spacing: .14em; }
.achievement-toast small { align-self: end; margin-left: 12px; color: rgba(233, 224, 200, .45); font-size: 9px; }

.noscript {
  position: fixed;
  z-index: 20;
  inset: 20%;
  padding: 30px;
  background: var(--night);
}

@media (max-width: 860px) {
  html,
  body { min-height: 540px; }
  .masthead { padding-top: max(16px, env(safe-area-inset-top)); }
  .eyebrow { display: none; }
  h1 { font-size: 40px; }
  .subtitle { font-size: 9px; }
  .top-actions { display: grid; grid-template-columns: repeat(2, auto); justify-items: end; }
  .ink-button { min-height: 31px; padding: 0 12px; font-size: 9px; }
  .moon { right: 18%; }
  .stage-actions { top: auto; bottom: 8%; right: max(18px, env(safe-area-inset-right)); }
  .meter { top: 12%; right: max(20px, env(safe-area-inset-right)); bottom: auto; }
  .meter strong { font-size: 40px; }
  .instruction { bottom: 6%; left: max(18px, env(safe-area-inset-left)); transform: none; }
  .instruction.active { transform: translateY(8px); }
  .status-bar { grid-template-columns: 1fr auto; padding-inline: max(18px, env(safe-area-inset-left)); }
  .craft-note { display: none; }
  .live-stats { gap: 11px; overflow-x: auto; }
  .live-stats dt { display: none; }
  .footer-links { font-size: 8px; }
}

@media (max-width: 600px) {
  .masthead { padding-inline: max(16px, env(safe-area-inset-left)); }
  .side-copy { font-size: 9px; }
  .seal { width: 30px; height: 38px; }
  .subtitle { letter-spacing: .2em; }
  .moon { top: 18%; width: 54px; }
  .instruction { right: 16px; bottom: 17%; padding: 9px 13px 9px 9px; }
  .instruction strong { font-size: 11px; }
  .instruction small { display: none; }
  .gesture-mark { width: 28px; height: 28px; }
  .stage-actions { bottom: 6%; }
  .primary-action { min-width: 112px; grid-template-columns: 30px 1fr; padding: 7px 10px 7px 7px; }
  .primary-action > span { width: 30px; height: 30px; }
  .primary-action small { display: none; }
  .meter { top: 18%; width: 82px; }
  .meter-label { display: none; }
  .meter strong { font-size: 35px; }
  .status-bar { min-height: 54px; padding-block: 7px max(7px, env(safe-area-inset-bottom)); }
  .live-stats { width: calc(100vw - 92px); justify-content: space-between; gap: 8px; }
  .live-stats div { display: block; text-align: center; }
  .live-stats div:nth-child(3) { display: none; }
  .live-stats span { display: block; margin-top: 3px; font-size: 7px; }
  .live-stats dd { font-size: 12px; }
  .footer-links { white-space: nowrap; }
  .achievement-grid { grid-template-columns: 1fr; }
  .skin-grid { grid-template-columns: 1fr; }
  .skin-card { grid-template-columns: 95px 1fr; grid-template-rows: auto auto; min-height:95px; padding:0; }
  .skin-card .skin-swatch { grid-row:1 / 3; min-height:95px; }
  .skin-card b { align-self:end; padding-top:12px; }
  .skin-card small { align-self:start; padding-bottom:12px; }
  .challenge-banner { top:2%; }
  .panel-dialog form { padding: 22px 14px 16px; }
  .panel-dialog h2 { font-size: 22px; }
  .share-actions { gap: 5px; }
  .share-actions button { padding-inline: 5px; font-size: 9px; }
  .achievement-toast { top: 18%; min-width: min(290px, calc(100vw - 30px)); }
}

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