:root {
  color-scheme: dark;
  --ink: #fff0d8;
  --muted: #d5b7a0;
  --edge: #774c3d;
  --amber: #f3ad5c;
  --paper: #f3e2c4;
  --dark: #2a1715;
  --serif: "Songti SC", "Noto Serif CJK SC", "Noto Serif SC", SimSun, serif;
  --sans: system-ui, "PingFang SC", "Microsoft YaHei", sans-serif;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  font: 1rem/1.5 var(--sans);
  background: radial-gradient(ellipse at 42% -15%, #714333 0%, #3b211d 44%, #241413 90%);
}
button, input { font: inherit; }
button { cursor: pointer; }
button:focus-visible, input:focus-visible { outline: 3px solid #ffc27c; outline-offset: 4px; }
button:disabled { cursor: default; opacity: .58; }
.shop { width: min(1120px, calc(100% - 64px)); margin: auto; padding: 34px 0 48px; }
.mast { display:flex; align-items:center; justify-content:space-between; gap: 14px; margin-bottom: 28px; }
.brand { display:flex; align-items:center; gap: 15px; }
.site-mark {
  display: block;
  flex: 0 0 auto;
  width: 80px;
  height: 80px;
  object-fit: contain;
  filter: drop-shadow(0 3px 4px #17090599);
}
.eyebrow { color: #f5b878; font-size: .875rem; letter-spacing: .18em; }
h1,h2,p { margin:0; }
h1,h2 { font-family: var(--serif); }
h1 { font-size: clamp(2.1rem, 5vw, 3.3rem); line-height:1.06; font-weight:900; letter-spacing:.065em; }
.home-subtitle {
  display:block; margin-top:.45em; color:var(--muted);
  font:600 .95rem/1.4 var(--sans); letter-spacing:normal;
}
.home-intro { margin:-6px 0 16px; color:var(--muted); }
.home-guide { max-width:72ch; margin-top:28px; padding-top:20px; border-top:1px solid var(--edge); }
.home-guide h2 { font-size:1.4rem; }
.home-guide h3 { margin:1em 0 .45em; font-size:1.05rem; }
.home-guide p { margin-top:.45em; color:var(--muted); }
.home-guide a { color:var(--amber); text-underline-offset:3px; }
.mast-right { display:flex; gap:8px; }
.quiet,.secondary {
  border:1px solid var(--edge); border-radius:6px; padding:8px 13px; min-height:42px;
  color:var(--ink); background:#321e1b;
  font-size:.875rem;
}
.quiet:hover,.secondary:hover { background:#573329; }
.quiet span { color:var(--amber); }
.workbench {
  display:grid; grid-template-columns:minmax(0, 2.15fr) minmax(250px, 1fr);
  border:1px solid #986543; border-radius:14px; padding:9px; gap:0;
  background:#2d1a17; box-shadow:0 16px 42px #1c0a07a0, inset 0 0 0 3px #5c3a2c;
}
.slab {
  min-width:0; position:relative; isolation:isolate; overflow:hidden;
  display:grid; place-items:center;
  border-radius:8px; border:1px solid #e1bd8d;
  background:
    radial-gradient(ellipse at 50% 37%, #fff8e5 0%, transparent 63%),
    repeating-linear-gradient(117deg, transparent 0 27px, #a36c4114 38px, transparent 82px),
    linear-gradient(145deg,#e8ccb0,#f4e4cc 55%,#d9b994);
  box-shadow:inset 0 0 30px #67402b4a;
  color:#774932;
}
.slab::before {
  content:""; position:absolute; inset:10px; border:1px solid #92664447; border-radius:4px; pointer-events:none;
}
#board { display:block; width:100%; height:auto; aspect-ratio:600/420; touch-action:none; -webkit-user-select:none; user-select:none; }
.slab.drawing #board { cursor:crosshair; }
.slab-label { position:absolute; top:24px; left:24px; pointer-events:none; z-index:1; }
.slab-label span { display:inline-block; color:#963c2b; font:800 .875rem/1 var(--serif); border:1px solid #a3543e; padding:4px 6px; border-radius:2px; }
.slab-label small { display:block; margin-top:6px; font-size:.8rem; }
.slab-note { position:absolute; bottom:22px; right:25px; font-size:.875rem; pointer-events:none; z-index:1; }
.counter { display:flex; flex-direction:column; justify-content:center; min-width:0; padding:clamp(15px,3vw,35px); }
.order h2 { font-size:clamp(1.9rem,4.4vw,3.25rem); letter-spacing:.045em; line-height:1.1; margin:.36rem 0 .45rem; }
.order p,.hint { color:var(--muted); }
.meters { display:grid; grid-template-columns:1fr 1fr; margin-top:24px; padding-top:16px; border-top:1px solid var(--edge); }
.meters span { display:block; color:var(--muted); font-size:.875rem; }
.meters strong { display:block; font:700 2.35rem/1.16 var(--serif); font-variant-numeric:tabular-nums; }
.meters small { font:400 .85rem var(--sans); color:var(--muted); margin-left:5px; }
progress { width:100%; height:6px; border:0; margin:9px 0 22px; border-radius:8px; background:#563328; appearance:none; color:#eca657; }
progress::-webkit-progress-bar { background:#563328; border-radius:8px; }
progress::-webkit-progress-value { background:#eca657; border-radius:8px; }
progress::-moz-progress-bar { background:#eca657; border-radius:8px; }
.actions,.result-actions { display:flex; gap:8px; }
.primary {
  background:linear-gradient(#fac481,#eda553);
  border:1px solid #ffd29d; border-radius:6px; padding:10px 14px;
  min-height:46px; color:#3b1c12; font-weight:800; box-shadow:0 3px #a85b37;
}
.primary:hover:not(:disabled) { background:#ffcf93; }
.actions .primary,.result-actions .primary { flex:1; }
.practice { display:flex; gap:8px; align-items:center; margin-top:15px; font-size:.875rem; color:var(--muted); width:fit-content; cursor:pointer; }
.practice input { accent-color:#efa85d; width:17px; height:17px; margin:0; }
.hint { margin-top:9px; font-size:.875rem; min-height:2.8em; }
.catalog { margin-top:28px; }
.catalog-head { display:flex; align-items:baseline; justify-content:space-between; gap:12px; margin-bottom:10px; }
.catalog-head h2 { font-size:1.4rem; letter-spacing:.06em; }
.catalog-head > span { color:var(--muted); font-size:.875rem; }
.motifs { display:grid; grid-template-columns:repeat(6,minmax(0,1fr)); gap:10px; }
.motif {
  display:grid; grid-template-columns:61px minmax(0,1fr); align-items:center; gap:10px;
  text-align:left; min-height:76px; padding:7px 12px 7px 8px;
  background:#38201b; border:1px solid #76503d; border-radius:7px; color:var(--ink);
}
.motif canvas { display:block; width:61px; height:52px; }
.motif b,.motif small { display:block; }
.motif b { font:700 1.1rem var(--serif); }
.motif small { color:var(--muted); font-size:.82rem; }
dialog { width:min(440px, calc(100% - 24px)); max-height:calc(100% - 24px); padding:0; border:1px solid #b87548; border-radius:12px; color:var(--ink); background:#37201b; box-shadow:0 20px 70px #160503b0; }
dialog::backdrop { background:#1d100dd9; }
.dialog-inner { padding:22px; }
.dialog-inner h2 { font-size:2rem; margin:4px 0 10px; }
.dialog-inner ol { padding-left:1.5em; margin:12px 0 22px; }
.dialog-inner li + li { margin-top:8px; }
#souvenir { width:100%; max-height:25vh; object-fit:contain; display:block; margin:6px 0; border-radius:6px; background:radial-gradient(#fff4d8,#e0bf97); }
.scoreline { display:flex; align-items:baseline; gap:12px; }
.scoreline strong { font-size:2rem; color:#ffc479; }
#stars { color:#ffc479; letter-spacing:.15em; }
#details { margin:0 0 15px; color:var(--muted); }
@media (max-width:780px) {
  .shop { width:calc(100% - 26px); padding:20px 0 26px; }
  .mast { margin-bottom:16px; }
  .workbench { grid-template-columns:1fr; padding:6px; }
  .counter { padding:14px; }
  .order { display:grid; grid-template-columns:1fr; }
  .order h2 { margin:0 0 .2rem; }
  .order p { font-size:.9rem; }
  .meters { margin-top:10px; padding-top:8px; }
  .meters strong { font-size:1.65rem; }
  progress { margin:6px 0 12px; }
  .hint { min-height:0; }
  .slab-label { top:15px; left:15px; }
  .slab-label small { display:none; }
  .slab-note { bottom:12px; right:15px; font-size:.75rem; }
  .site-mark { width:57px; height:57px; }
  .brand { gap:10px; }
  .catalog { margin-top:19px; }
  .motifs { grid-template-columns:repeat(3,minmax(0,1fr)); gap:7px; }
  .motif { grid-template-columns:38px minmax(0,1fr); gap:5px; min-height:63px; padding:6px; }
  .motif canvas { width:38px; height:auto; }
  .motif b { font-size:.97rem; }
  .motif small { font-size:.76rem; }
}
@media (max-width:385px) {
  .shop { width:calc(100% - 18px); }
  .brand .eyebrow { font-size:.75rem; }
  .brand h1 { font-size:clamp(1.5rem, 7.5vw, 1.9rem); }
  .site-mark { width:49px; height:49px; }
  .mast-right { gap:4px; }
  .quiet { padding:6px 8px; }
  .motif { grid-template-columns:32px minmax(0,1fr); }
  .motif canvas { width:32px; }
}

.pour-cue {
  position:absolute;
  top:18px;
  right:18px;
  z-index:2;
  pointer-events:none;
  display:grid;
  justify-items:start;
  gap:2px;
  padding:7px 11px;
  border:1px solid #ab6745;
  border-left:3px solid #9b3a28;
  border-radius:5px;
  background:#fff2d9;
  box-shadow:0 3px 11px #5e281d26;
  color:#612c1f;
  line-height:1.28;
}
.pour-cue[data-level="notice"] { border-left-color:#ad712a; color:#573814; }
.pour-cue strong { font-size:.94rem; }
.pour-cue span { font-size:.81rem; }
#roundFeedback { color:#f6c388; margin:-7px 0 16px; font-size:.875rem; }
@media (max-width:780px) {
  .pour-cue { top:10px; right:10px; padding:5px 8px; }
  .pour-cue strong { font-size:.875rem; }
  .pour-cue span { font-size:.75rem; }
}

.wheel-deck {
  padding: 23px 38px 32px;
  min-height: 460px;
  background:
    radial-gradient(ellipse at 48% 40%, #f6e8c9 22%, transparent 72%),
    repeating-linear-gradient(113deg, transparent 0 23px, #9b663416 26px, transparent 40px),
    linear-gradient(135deg, #b89065, #e0c298 60%, #c29970);
}
.wheel {
  position: relative;
  display: block;
  width: min(100%, 465px);
  aspect-ratio: 1;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 50%;
  color: #fff0ca;
  background:
    repeating-linear-gradient(4deg, #a8532a00 0 4px, #31140738 5px, #fff4bc16 7px, #a8532a00 12px),
    linear-gradient(140deg,#a66a39 5%, #613318 48%, #905022);
  box-shadow: 0 16px 24px #48250b55, 0 3px 0 2px #633720, inset 0 0 0 2px #d19550, inset 0 0 0 5px #5d2c1a;
  touch-action: pan-y;
  -webkit-tap-highlight-color: transparent;
  -webkit-user-select: none;
  user-select: none;
}
.wheel:hover:not(:disabled) { box-shadow: 0 17px 27px #48250b73, 0 3px 0 2px #633720, inset 0 0 0 2px #e0a863, inset 0 0 0 5px #5d2c1a; }
.wheel:disabled { opacity: 1; }
.wheel-face {
  pointer-events: none;
  position: absolute;
  inset: 5%;
  border: 2px solid #b57942;
  border-radius: 50%;
  background: #8b4f32;
  box-shadow: inset 0 0 0 5px #4c271946, inset 0 0 0 7px #f3be7c64, inset 0 0 25px #2d130c85;
}
.wheel-face::before {
  content: "";
  position: absolute;
  inset: 29%;
  border: 1px solid #d5a76b;
  border-radius: 50%;
  z-index: 1;
  background:
    repeating-radial-gradient(circle, transparent 0 12px,#edc18118 13px 14px,transparent 15px 19px),
    radial-gradient(circle at 35% 25%,#a36a39,#704125 70%);
  box-shadow: inset 0 0 0 5px #4525155c, 0 2px 6px #29130668;
}
.wheel-sectors {
  position:absolute;
  inset:0;
  border-radius:50%;
  background:
    repeating-linear-gradient(4deg,#200c0624 0 1px,transparent 2px 6px,#f2c68e18 8px,transparent 10px 18px),
    radial-gradient(ellipse at 35% 24%, #ffdf9d35, transparent 58%),
    var(--wheel-paint);
  box-shadow: inset 0 0 0 5px #4c271946, inset 0 0 0 7px #f3be7c64, inset 0 0 25px #2d130c85;
}
.wheel-sector {
  position: absolute;
  width: 17%;
  display: grid;
  justify-items: center;
  gap: 0;
  transform: translate(-50%, -50%);
  color: #fff1cc;
  font: 800 clamp(.87rem, 1.5vw, 1.06rem)/1 var(--serif);
  text-shadow: 0 2px #321a1180;
  letter-spacing: .035em;
}
.wheel-sector canvas { width: 100%; height: auto; filter: drop-shadow(0 2px 0 #30190a89); }
.wheel-sector.picked {
  color: #fff9dd;
  filter: drop-shadow(0 0 11px #ffcb72) drop-shadow(0 0 4px #ffcb7290);
}
.wheel-arrow {
  position:absolute;
  inset:0;
  transform:rotate(-15deg);
  z-index:2;
  filter:drop-shadow(2px 4px 2px #231307a6);
}
.wheel-arrow::before {
  content:"";
  position:absolute;
  left:46.6%;
  top:9%;
  width:6.8%;
  height:61%;
  background:
    repeating-linear-gradient(92deg,#482c1729 0 1px,transparent 2px 4px),
    linear-gradient(90deg,#926230,#fbe1a0 36%,#e4ba73 57%,#845022);
  clip-path:polygon(50% 0%, 98% 21%, 65% 20%, 62% 79%, 78% 100%, 22% 100%, 38% 79%, 35% 20%, 2% 21%);
}
.wheel-pin {
  position:absolute;
  inset:47.3%;
  z-index:3;
  border-radius:50%;
  background: radial-gradient(circle at 35% 35%, #fff3a9, #d09b4a 48%, #82501f 80%);
  border: 1px solid #653817;
  box-shadow:0 2px 3px #311b13b8;
}
.wheel-counter { min-height: 100%; }
.wheel-actions { display:flex; align-items:stretch; gap:8px; margin-top:24px; }
.wheel-actions .primary { flex: 1; }
.wheel-source { align-self: flex-start; color:var(--muted); margin-top:18px; font-size:.875rem; text-underline-offset:3px; }
.wheel-source:hover { color:var(--ink); }
.wheel-announcement { position:absolute; width:1px; height:1px; overflow:hidden; clip-path:inset(50%); }
.drawn-preview {
  margin-top:15px;
  width:100%;
  display:grid;
  place-items:center;
  border:1px solid #b48455;
  border-radius:6px;
  background: radial-gradient(ellipse at 50% 40%, #fff2d2, #e6c49b);
}
.drawn-preview canvas { display:block; width:min(100%,250px); height:auto; }
.motif[data-selected="true"] { background:#5a3125; border-color:#f8ae64; box-shadow:inset 0 0 0 1px #f8ae6440; }
@media (max-width:780px) {
  .wheel-deck { min-height:0; padding: 24px 24px 32px; }
  .wheel { width:min(100%,375px); }
  .wheel-actions { margin-top:14px; }
  .wheel-source { margin-top:13px; }
  .drawn-preview canvas { width:min(100%,180px); }
  .wheel-sector { font-size:clamp(.72rem, 2.9vw, .93rem); }
}
.back-wheel { align-self:flex-start; margin-top:8px; }

@media (min-width:781px) and (max-width:1030px) {
  .motifs { grid-template-columns:repeat(4,minmax(0,1fr)); }
}

.locale-menu { position:relative; z-index:5; }
.locale-menu summary { display:flex; align-items:center; gap:.4rem; cursor:pointer; list-style:none; white-space:nowrap; }
.locale-menu summary::-webkit-details-marker { display:none; }
.locale-menu summary::after { content:""; width:.37em; height:.37em; border:solid currentColor; border-width:0 1px 1px 0; transform:rotate(45deg); margin-top:-.25em; }
.locale-options {
  position:absolute; right:0; top:calc(100% + 7px);
  display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:4px;
  width:min(265px,88vw); padding:7px; background:#39221c; border:1px solid #956448;
  border-radius:7px; box-shadow:0 7px 20px #2410099c;
}
.locale-options a { display:block; border-radius:4px; color:var(--ink); font-size:.875rem; text-align:center; text-decoration:none; padding:7px 3px; }
.locale-options a:hover,.locale-options a:focus-visible { background:#623b2c; }
.locale-options a[aria-current] { background:#f1af64; color:#402018; }
html:not([lang^="zh"]):not([lang="ja"]):not([lang="ko"]) h1 { font-size:clamp(1.5rem, 3.5vw, 2.7rem); letter-spacing:.005em; }
html:not([lang^="zh"]) .order h2 { font-size:clamp(1.72rem, 3vw, 2.35rem); overflow-wrap:anywhere; }
html:not([lang^="zh"]) .wheel-sector { letter-spacing:0; }
.wheel-sector > span { text-align:center; white-space:nowrap; }
.wheel-sector .long-label { font-size:.78em; }
.motif b { overflow-wrap:anywhere; }
@media (max-width:650px) {
  .mast { flex-wrap:wrap; row-gap:10px; }
  .mast-right { margin-left:auto; }
  .quiet { padding-inline:9px; }
  html:not([lang^="zh"]):not([lang="ja"]):not([lang="ko"]) .motifs { grid-template-columns:repeat(2,minmax(0,1fr)); }
}
