:root {
  color-scheme: light;
  font-family: "Avenir Next", "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  --paper: #fcfaf7;
  --white: #fffdfa;
  --ink: #2e2134;
  --muted: #665a6c;
  --accent: #684393;
  --accent-dark: #4d2a76;
  --line: #e8e0e8;
  --soft: #f0e9f8;
  --heading: Georgia, "Songti SC", "Noto Serif CJK SC", serif;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; background: var(--paper); color: var(--ink); }
button, a { -webkit-tap-highlight-color: transparent; }
a { color: inherit; text-decoration: none; }
button { color: inherit; font: inherit; cursor: pointer; }
button:disabled { cursor: default; }
:focus-visible { outline: 3px solid #714b9a; outline-offset: 4px; }
h1, h2, h3, p, figure { margin: 0; }
.shell { width: min(1192px, calc(100% - 80px)); margin-inline: auto; }
.site-header { border-bottom: 1px solid var(--line); background: var(--white); }
.masthead { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; min-height: 72px; gap: 20px; }
.brand { display: inline-flex; width: max-content; align-items: center; gap: 10px; font: 700 25px/1 var(--heading); letter-spacing: -.045em; }
.brand img { display: block; }
.site-nav { display: flex; align-items: stretch; gap: 29px; align-self: stretch; }
.site-nav a { display: flex; align-items: center; position: relative; color: var(--muted); font-size: 14px; font-weight: 650; white-space: nowrap; }
.site-nav a[aria-current] { color: var(--accent-dark); }
.site-nav a[aria-current]::after { position: absolute; height: 2px; inset: auto 0 0; content: ""; background: var(--accent); border-radius: 2px; }
.language { justify-self: end; border: 1px solid var(--line); background: var(--white); min-width: 58px; min-height: 38px; padding: 0 12px; border-radius: 8px; font-size: 13px; font-weight: 650; }
.language:hover, .button:hover { border-color: #b9a1d2; }
.hero {
  display: grid; grid-template-columns: 1.08fr .92fr; align-items: center; isolation: isolate;
  overflow: hidden; margin-top: 30px; padding: 38px clamp(26px, 5.1vw, 76px);
  min-height: 351px; border: 1px solid #e9dff0; border-radius: 24px;
  background: linear-gradient(112deg, #f5eefb 0%, #f1e8f8 56%, #f8e6e2 100%);
}
.hero-copy { position: relative; z-index: 1; }
.hero h1 { max-width: 580px; font: 500 clamp(51px, 6.1vw, 84px)/.99 var(--heading); letter-spacing: -.074em; text-wrap: balance; }
.hero p { max-width: 343px; color: #625383; font-size: 16px; line-height: 1.6; margin-top: 18px; }
html[lang="zh-Hans"] .hero h1 { font-size: clamp(40px, 4.8vw, 70px); letter-spacing: -.05em; font-weight: 700; }
.button {
  display: inline-flex; align-items: center; justify-content: center; gap: 9px; min-height: 42px;
  padding: 9px 15px; border: 1px solid var(--line); border-radius: 10px; background: var(--white);
  font-size: 14px; font-weight: 690; white-space: nowrap;
}
.primary { background: var(--accent-dark); border-color: var(--accent-dark); color: #fff; }
.primary:hover { background: #603986; border-color: #603986; }
.hero .button { margin-top: 22px; min-height: 49px; gap: 16px; padding-inline: 17px; }
.hero-art { position: relative; justify-self: center; text-align: center; margin: 0; padding-inline: 24px; }
.hero-art::before, .hero-art::after { content: ""; z-index: -1; position: absolute; width: 41px; height: 41px; background: #fef9f0; opacity: .85; clip-path: polygon(50% 0, 60% 40%, 100% 50%, 60% 60%, 50% 100%, 40% 60%, 0 50%, 40% 40%); }
.hero-art::before { left: -38px; top: 12%; }
.hero-art::after { right: -36px; top: 51%; width: 26px; height: 26px; }
.hero-print {
  width: min(275px, 27vw); aspect-ratio: 1; padding: 9px; border: 1px solid #e3d8e9;
  background: #fcf8f0; border-radius: 5px; transform: rotate(4deg);
  box-shadow: 0 0 0 1px #fff9, 0 18px 32px #654b6630, -9px 9px 0 #e2d2ed;
}
.hero-print img { display: block; width: 100%; height: 100%; object-fit: contain; }
.hero figcaption { color: #5b4965; font-size: 13px; margin: 17px 0 -6px; font-weight: 650; }
.collection { padding: 37px 0 34px; min-height: 285px; }
.collection-head { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; }
.collection h2 { font: 500 clamp(28px, 3.5vw, 39px)/1.12 var(--heading); letter-spacing: -.045em; }
html[lang="zh-Hans"] .collection h2 { font-size: clamp(25px, 3.2vw, 36px); font-weight: 650; }
.collection-count { font-size: 13px; color: var(--muted); white-space: nowrap; }
.filters { display: flex; flex-wrap: wrap; gap: 8px; margin: 16px 0 18px; }
.filters:empty { display: none; }
.filter { border: 1px solid #e5dce8; border-radius: 999px; background: var(--white); min-height: 36px; padding: 6px 14px; color: #4c3c5b; font-size: 13px; font-weight: 650; }
.filter:hover { border-color: #aa93c5; }
.filter[aria-pressed="true"] { background: #e9dcf5; color: #482663; border-color: #dcc9ef; }
.art-grid { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 14px; }
.art-card { display: flex; flex-direction: column; overflow: hidden; min-width: 0; border: 1px solid var(--line); border-radius: 16px; background: var(--white); transition: border-color .18s, transform .18s, box-shadow .18s; }
.art-card:hover { transform: translateY(-3px); border-color: #c3aed9; box-shadow: 0 9px 18px #3d214211; }
.card-image { display: block; background: #efebe7; width: 100%; aspect-ratio: 1; object-fit: cover; border: 0; height: auto; }
.card-text { display: flex; align-items: center; justify-content: space-between; gap: 9px; min-height: 70px; padding: 10px 12px; }
.card-text h3 { overflow-wrap: anywhere; font-size: 14px; line-height: 1.27; font-weight: 720; }
.card-text p { color: var(--muted); font-size: 12px; margin-top: 4px; line-height: 1.3; }
.card-arrow { display: grid; place-items: center; flex: 0 0 30px; aspect-ratio: 1; border-radius: 50%; background: var(--soft); color: var(--accent-dark); font-size: 17px; }
.status { margin: 18px 0 10px; font-size: 14px; color: var(--muted); }
.retry { margin-top: 3px; }
.site-footer { display: flex; gap: 21px; justify-content: space-between; padding: 20px 0 26px; border-top: 1px solid var(--line); color: var(--muted); font-size: 13px; }
.site-footer a:hover { text-decoration: underline; }

.painting { padding: 24px 0 29px; }
.painting-header { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 20px; align-items: center; margin-bottom: 16px; min-height: 44px; }
.painting-header h1 { font: 600 clamp(22px, 3.1vw, 36px)/1.15 var(--heading); letter-spacing: -.045em; overflow-wrap: anywhere; }
.progress-display { display: flex; align-items: center; gap: 10px; font-variant-numeric: tabular-nums; font-size: 13px; color: var(--muted); white-space: nowrap; }
progress { appearance: none; height: 8px; width: clamp(54px, 10vw, 126px); border: 0; border-radius: 999px; overflow: hidden; background: #e9deef; }
progress::-webkit-progress-bar { background: #e9deef; }
progress::-webkit-progress-value { background: #754ca1; border-radius: 999px; }
progress::-moz-progress-bar { background: #754ca1; border-radius: 999px; }
.paint-status { margin-top: 20px; }
.studio { display: grid; grid-template-columns: minmax(0, 1fr) 280px; gap: 16px; align-items: start; }
.easel {
  position: relative; height: clamp(370px, calc(100dvh - 206px), 730px); overflow: hidden;
  border: 1px solid #e4d9e9; border-radius: 19px; background: #eee7f3;
}
#board { display: block; width: 100%; height: 100%; touch-action: none; cursor: crosshair; }
#board:focus-visible { outline-offset: -4px; }
#board[data-panning="true"] { cursor: grabbing; }
.view-controls {
  position: absolute; left: 15px; bottom: 14px; display: inline-flex; overflow: hidden;
  background: var(--white); border: 1px solid #ded2e8; border-radius: 10px; box-shadow: 0 3px 12px #3b20401c;
}
.view-controls button { padding: 0 9px; min-width: 42px; height: 41px; border: 0; background: transparent; font-size: 20px; font-weight: 680; }
.view-controls button + button { border-left: 1px solid var(--line); }
.view-controls button:hover, .view-controls button:focus-visible { background: var(--soft); outline-offset: -3px; }
#zoom-reset { min-width: 64px; font-size: 12px; font-variant-numeric: tabular-nums; }
.palette-panel { padding: 16px; background: var(--white); border: 1px solid var(--line); border-radius: 16px; }
.palette-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.palette-head h2 { font: 600 27px/1.1 var(--heading); letter-spacing: -.04em; }
.hint-button { padding: 5px 10px; min-height: 35px; background: var(--soft); border-color: #e2d5ed; color: var(--accent-dark); }
.hint-button:disabled { opacity: .55; }
#game-instruction, .feedback { margin-top: 10px; color: var(--muted); font-size: 13px; line-height: 1.45; }
.feedback:empty { display: none; }
.swatches { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 9px; margin-top: 14px; max-height: 320px; overflow: auto; padding: 4px; }
.swatch {
  position: relative; display: grid; place-items: center; font-size: 19px; font-weight: 760;
  min-width: 0; height: 49px; border: 1px solid #33273c33; border-radius: 10px; background: var(--swatch); color: var(--swatch-ink);
}
.swatch[aria-pressed="true"] { outline: 2px solid #502e78; outline-offset: 2px; }
.swatch[aria-pressed="true"]:focus-visible { outline: 3px solid #321c53; }
.swatch:disabled { opacity: .57; }
.swatch small { position: absolute; bottom: 3px; right: 4px; font-size: 10px; font-weight: 760; line-height: 1; }
.painting:fullscreen { overflow: auto; background: var(--paper); padding: 20px; }
dialog { border: 1px solid #e2d5eb; border-radius: 23px; background: var(--white); color: var(--ink); text-align: center; padding: 24px; width: min(385px, calc(100vw - 32px)); }
dialog::backdrop { background: #26172d70; }
.complete-mark { display: grid; place-items: center; margin: 0 auto 14px; width: 52px; height: 52px; color: #684393; background: var(--soft); border-radius: 50%; font-size: 28px; }
dialog h2 { font: 600 29px/1.13 var(--heading); }
dialog p { margin-top: 8px; font-size: 14px; color: var(--muted); }
.complete-actions { display: flex; justify-content: center; gap: 9px; flex-wrap: wrap; margin-top: 20px; }

@media (max-width: 1060px) {
  .art-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .studio { grid-template-columns: minmax(0, 1fr) 246px; }
}
@media (max-width: 790px) {
  .shell { width: calc(100% - 40px); }
  .art-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .hero { min-height: 310px; margin-top: 23px; padding: 28px; }
  .hero h1 { font-size: clamp(43px, 8.3vw, 68px); }
  .studio { grid-template-columns: 1fr; gap: 12px; }
  .easel { height: clamp(320px, calc(100dvh - 280px), 600px); }
  .swatches { grid-template-columns: repeat(auto-fit, minmax(42px, 54px)); max-height: 152px; }
}
@media (max-width: 515px) {
  .shell { width: calc(100% - 28px); }
  .masthead { min-height: 59px; gap: 8px; grid-template-columns: auto 1fr auto; }
  .brand { gap: 6px; font-size: 19px; }
  .brand img { width: 25px; height: 25px; }
  .site-nav { gap: clamp(8px, 3vw, 16px); justify-content: center; }
  .site-nav a { font-size: 12px; }
  .language { min-width: 40px; min-height: 32px; padding-inline: 6px; font-size: 11px; }
  .hero { min-height: 240px; grid-template-columns: minmax(0, 1.18fr) minmax(0, .82fr); margin-top: 14px; padding: 17px; border-radius: 18px; }
  .hero h1 { font-size: clamp(32px, 8.5vw, 47px); }
  html[lang="zh-Hans"] .hero h1 { font-size: clamp(27px, 8vw, 37px); }
  .hero p { font-size: 13px; margin-top: 11px; }
  .hero .button { gap: 6px; min-height: 40px; padding-inline: 9px; margin-top: 15px; font-size: 12px; }
  .hero-art { padding-inline: 0; margin-left: 12px; }
  .hero-art::before, .hero-art::after { display: none; }
  .hero-print { width: min(31vw, 139px); box-shadow: 0 10px 20px #654b6630, -5px 5px 0 #e2d2ed; padding: 5px; }
  .hero figcaption { font-size: 10px; margin-top: 10px; }
  .collection { padding-top: 24px; }
  .filters { gap: 6px; margin: 12px 0 14px; }
  .filter { font-size: 12px; padding-inline: 11px; min-height: 34px; }
  .art-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .art-card { border-radius: 12px; }
  .card-text { min-height: 65px; padding: 8px; }
  .card-text h3 { font-size: 13px; }
  .card-text p { font-size: 11px; }
  .card-arrow { flex-basis: 25px; font-size: 15px; }
  .painting { padding-top: 11px; }
  .painting-header { grid-template-columns: auto minmax(0, 1fr); gap: 7px 10px; margin-bottom: 9px; }
  .painting-header h1 { font-size: clamp(18px, 5vw, 25px); }
  .back-button { padding-inline: 8px; min-height: 36px; font-size: 12px; }
  .progress-display { grid-column: 2; gap: 8px; font-size: 11px; }
  progress { width: min(24vw, 96px); height: 6px; }
  .easel { height: clamp(285px, min(calc(100dvh - 285px), calc(100vw + 25px)), 535px); border-radius: 13px; }
  .view-controls { left: 8px; bottom: 8px; }
  .view-controls button { height: 36px; min-width: 38px; }
  .palette-panel { padding: 10px; border-radius: 12px; }
  .palette-head h2 { font-size: 21px; }
  .swatches { margin-top: 8px; grid-template-columns: repeat(auto-fit, minmax(41px, 46px)); max-height: 122px; gap: 7px; }
  .swatch { height: 41px; font-size: 16px; }
  #game-instruction, .feedback { margin-top: 6px; font-size: 12px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: 0s !important; }
}
