:root{color-scheme:light;--paper:#f6f3ec;--ink:#252420;--muted:#6b685e;--rule:#d5d0c5;--serif:"Songti SC","STSong","Noto Serif CJK SC",serif;--sans:"PingFang SC","Hiragino Sans GB","Microsoft YaHei",sans-serif}
*{box-sizing:border-box}
body{margin:0;background:var(--paper);color:var(--ink);font-family:var(--sans);-webkit-font-smoothing:antialiased}
html{-webkit-text-size-adjust:100%;text-size-adjust:100%}
body{padding:env(safe-area-inset-top,0px) env(safe-area-inset-right,0px) env(safe-area-inset-bottom,0px) env(safe-area-inset-left,0px)}
button,input{font:inherit}button{cursor:pointer;color:inherit;background:transparent;border:0}button:disabled{cursor:default;opacity:.37}
button:focus-visible,input:focus-visible,canvas:focus-visible{outline:2px solid #97713e;outline-offset:4px}
[hidden]{display:none!important}
.mast,main{width:min(1256px,calc(100% - clamp(40px,10vw,164px)));margin:auto}
.mast{display:flex;justify-content:space-between;align-items:center;border-bottom:1px solid var(--rule);height:clamp(74px,10vh,94px)}
.brand{display:flex;align-items:center;gap:13px;font:italic 600 37px/.95 "Baskerville","Iowan Old Style",Georgia,serif;letter-spacing:-2.4px}
.brand-mark{position:relative;width:32px;height:35px;transform:rotate(25deg);display:block}
.brand-mark i{position:absolute;border-radius:50%;width:19px;height:22px;border:1.4px solid currentColor;top:0;left:3px}
.brand-mark i:nth-child(2){left:12px;top:6px}.brand-mark i:last-child{left:3px;top:12px}
.sound{display:flex;align-items:center;gap:9px;padding:10px 0 10px 10px;font-size:13px}
.sound #sound-state{color:var(--muted);font-size:11px;border:1px solid var(--rule);border-radius:20px;min-width:28px;padding:1px 6px}
.sound[aria-pressed=true] #sound-state{color:var(--paper);background:var(--ink);border-color:var(--ink)}
svg{width:17px;height:17px;fill:none;stroke:currentColor;stroke-width:1.5;stroke-linecap:round;stroke-linejoin:round}
main{display:grid;grid-template-columns:minmax(0,1fr) minmax(260px,.43fr);grid-template-rows:1fr auto auto 1fr;column-gap:clamp(42px,5.7vw,94px);padding:clamp(30px,6vh,76px) 0 40px}
figure{margin:0;grid-column:1;grid-row:1 / -1;min-width:0}
.stage{position:relative;width:100%;height:clamp(430px,min(68svh,54vw),716px);overflow:hidden;border-radius:3px;background:#252421;isolation:isolate}
#cloth{width:100%;height:100%;display:block;touch-action:none;outline-offset:-5px;user-select:none;-webkit-user-select:none}
.mast-tools{display:flex;align-items:center;gap:14px}
#language{min-height:44px;min-width:44px;padding:0 5px;font-size:13px}
.stage[data-pending]{background:#252421 url("assets/sequins.webp") center / contain no-repeat}
.stage[data-pending] #cloth{visibility:hidden}
.stage[data-pending] #touch-cloth,.stage[data-mode=macro] #touch-cloth{display:none}
#touch-cloth{position:absolute;touch-action:none;user-select:none;-webkit-user-select:none;-webkit-touch-callout:none}
.stage[data-mode=portrait] #cloth{touch-action:pan-y pinch-zoom}
#cloth:focus-visible{outline-color:#f2dea8}
.view-switch{position:absolute;top:18px;left:18px;display:flex;padding:3px;border:1px solid #ffffff42;border-radius:100px;background:#25231fdf;box-shadow:0 2px 12px #0002}
.view-switch button{color:#fff9ecba;font-size:12px;letter-spacing:.06em;border-radius:30px;min-width:53px;height:32px;padding:0 12px}
.view-switch button[aria-pressed=true]{background:var(--paper);color:var(--ink)}
#navigator{position:absolute;right:18px;bottom:18px;width:clamp(74px,7.2vw,112px);aspect-ratio:2 / 3;border:2px solid #f6f3ec;border-radius:2px;overflow:hidden;padding:0;background:#453e34;box-shadow:0 4px 20px #0007;touch-action:none;cursor:crosshair}
#overview{display:block;width:100%;height:100%}
#viewbox{position:absolute;pointer-events:none;border:1.5px solid #fff9ea;box-shadow:0 0 0 150px #100c0626,0 0 0 1px #2e2119a6 inset}
#cursor{position:absolute;pointer-events:none;border:1px solid #fff9debb;border-radius:50%;transform:translate(-50%,-50%);box-shadow:0 0 1px 1px #28231588}
#loading{position:absolute;bottom:14px;left:50%;transform:translateX(-50%);padding:6px 12px;border-radius:18px;background:#252421db;color:#f7f2e5;margin:0;font-size:12px;max-width:85%;width:max-content;text-align:center}
figcaption{display:flex;justify-content:space-between;align-items:center;color:var(--muted);font-size:11px;letter-spacing:.07em;margin-top:13px}
figcaption i{font:italic 13px Georgia,serif;margin:0 4px;color:#999282}
.progress{display:inline-flex;gap:7px;align-items:center;font-variant-numeric:tabular-nums}.progress b{font:normal 12px/1.1 ui-monospace,monospace;color:var(--ink);letter-spacing:0}
.meter{height:2px;width:43px;background:var(--rule);display:inline-flex}.meter i{height:100%;background:#927344;margin:0}
.intro{grid-column:2;grid-row:2;padding-bottom:29px}
h1{font-family:var(--serif);font-weight:600;margin:0 0 16px;font-size:clamp(44px,4.6vw,70px);line-height:1.14;letter-spacing:.015em}
.intro p{font-size:14px;color:#605c54;line-height:1.85;margin:0}
.controls{grid-column:2;grid-row:3;min-width:0}
fieldset{min-width:0;margin:0;padding:0;border:0}
legend,.brush label{font-weight:600;font-size:13px;letter-spacing:.08em}
.finishes{border-top:1px solid var(--rule);position:relative;padding:23px 0 17px}
.finishes legend{float:left;width:100%;padding:0;margin-bottom:15px}
.palette{display:flex;clear:both;gap:8px}
.palette button{display:flex;flex-direction:column;align-items:center;justify-content:center;gap:9px;flex:1;min-width:0;min-height:81px;padding:8px 3px;border:1px solid var(--rule);border-radius:3px;font-size:12px;letter-spacing:.03em}
.palette button:hover:not([aria-pressed=true]),.actions button:hover:enabled{background:#eae5d9}
.palette button[aria-pressed=true]{border-color:#69604e;background:#ebe4d6}
.palette i{width:25px;height:25px;border-radius:50%;box-shadow:inset 0 0 0 1px #44382b46,0 1px 2px #342b231a;position:relative}
.palette i:after{content:"";position:absolute;left:5px;top:9px;width:3px;height:3px;background:#514b44;border-radius:50%;box-shadow:0 1px 1px #fff}
[data-metal=silver] i{background:conic-gradient(from 45deg,#f2f3f2,#90999e,#e7eaea,#6c7379,#f2f3f2)}
[data-metal=gold] i{background:conic-gradient(from 45deg,#ffedcb,#be924b,#e9cc91,#946e3e,#ffedcb)}
[data-metal=copper] i{background:conic-gradient(from 45deg,#ffe3d7,#ad7367,#e4ad9d,#9b6864,#ffe3d7)}
.brush{padding:10px 0 16px;border-bottom:1px solid var(--rule)}
.brush div{display:flex;justify-content:space-between;align-items:baseline}
.brush output{font-size:12px;color:var(--muted)}
.brush input{width:100%;height:32px;-webkit-appearance:none;appearance:none;background:transparent;margin:4px 0 0;cursor:pointer;--fill:45%}
.brush input::-webkit-slider-runnable-track{height:3px;background:linear-gradient(to right,#65594b var(--fill),var(--rule) var(--fill));border-radius:2px}
.brush input::-webkit-slider-thumb{-webkit-appearance:none;width:15px;height:15px;margin-top:-6px;background:var(--ink);border-radius:50%;box-shadow:0 0 0 3px var(--paper)}
.brush input::-moz-range-track{height:3px;background:var(--rule)}
.brush input::-moz-range-progress{height:3px;background:#65594b}
.brush input::-moz-range-thumb{border:2px solid var(--paper);background:var(--ink);border-radius:50%;width:15px;height:15px}
.actions{display:flex;gap:8px;margin-top:20px}
.actions button{display:flex;align-items:center;justify-content:center;gap:8px;flex:1;min-height:42px;font-size:13px;border:1px solid var(--rule);border-radius:3px}
.key-help{font-size:11px;color:var(--muted);margin:14px 0 0;display:none}
body:has(#cloth:focus-visible) .key-help{display:block}
.sr{position:absolute;width:1px;height:1px;overflow:hidden;clip-path:inset(50%)}
@media(max-width:830px){
  .mast,main{width:calc(100% - 40px)}
  main{grid-template-columns:minmax(0,1fr) 235px;gap:0 26px}
  .stage{height:clamp(430px,67svh,580px)}
  .intro{padding-bottom:20px}
}
@media(max-width:680px){
  .mast,main{width:calc(100% - 32px)}
  .mast{height:61px}.brand{font-size:29px;gap:8px}.brand-mark{transform:scale(.8) rotate(25deg);margin-left:-3px;width:28px}
  main{display:flex;flex-direction:column;padding:19px 0 27px;gap:0}
  .intro{display:flex;align-items:center;gap:17px;padding:0 2px 15px;justify-content:space-between}
  h1{font-size:clamp(32px,8vw,43px);margin:0;white-space:nowrap}
  .intro p{font-size:11px;line-height:1.65}
  .stage{height:clamp(285px,min(100vw,48svh),470px)}
  .view-switch{top:12px;left:12px}.view-switch button{min-width:46px;height:29px}
  #navigator{width:62px;right:12px;bottom:12px}
  figcaption{margin:9px 1px 0;font-size:10px}
  .controls{margin-top:20px}.finishes{padding:14px 0 12px}
  .finishes legend{margin-bottom:10px}.palette button{flex-direction:row;min-height:45px;gap:7px}.palette i{width:21px;height:21px}
  .brush{padding:5px 0 5px}.actions{margin-top:13px}
}
@media(pointer:coarse){#cursor{display:none}}

html[lang=en] h1{font-family:"Baskerville","Iowan Old Style",Georgia,serif;letter-spacing:-.045em}
#nav-help{line-height:1.4}
.progress{flex-shrink:0;white-space:nowrap}
@media(max-width:680px){
  .mast-tools{gap:5px}.sound{min-height:44px;gap:5px}
  .view-switch{top:8px;left:8px;padding:2px}
  .view-switch button{min-height:44px;min-width:44px;padding:0 10px}
  figcaption{gap:10px;min-height:18px}
  .actions button,.brush input{min-height:44px}
  html[lang=en] .intro{display:block}
  html[lang=en] h1{font-size:clamp(33px,8vw,43px)}
  html[lang=en] .intro p{margin-top:5px;font-size:13px;line-height:1.4}
  html[lang=en] .intro p br{display:none}
  html[lang=en] .intro p span+br+span:before{content:" "}
  html[lang=en] .palette button{font-size:12px;letter-spacing:0;line-height:1.15;text-align:left}
  html[lang=en] .palette i{flex:none}
}
@media(max-width:360px){.brand{font-size:26px}.mast-tools{gap:0}.sound{font-size:12px;padding-left:4px}
  .palette button{gap:5px}html[lang=en] .palette i{width:16px;height:16px}}
@media(orientation:landscape) and (max-height:500px) and (min-width:681px){
  .mast{height:46px}.brand{font-size:27px}main{padding-top:14px;column-gap:26px;grid-template-columns:minmax(0,1fr) 240px}
  .stage{height:clamp(225px,74svh,350px)}.intro{padding-bottom:8px}
  h1{font-size:32px;margin-bottom:4px}.intro p{line-height:1.4}
  .finishes{padding:8px 0}.finishes legend{margin-bottom:4px}.palette button{min-height:44px;gap:4px}
  .brush{padding:4px 0}.actions{margin-top:7px}
}
figure{position:relative}
button{-webkit-tap-highlight-color:rgba(150,115,72,.15)}
@media(max-width:680px){
  figcaption{display:grid;grid-template-columns:auto minmax(0,1fr);grid-template-rows:auto auto;gap:2px 10px;align-items:center}
  .view-switch{position:static;grid-column:1;grid-row:1/3;align-self:center;background:#e7e2d8;border-color:var(--rule);box-shadow:none}
  .view-switch button{color:#635e52}.view-switch button[aria-pressed=true]{color:var(--paper);background:var(--ink)}
  figcaption .progress{grid-column:2;grid-row:1;justify-self:end;align-self:end}
  #credit,#nav-help{grid-column:2;grid-row:2;align-self:start;justify-self:end;text-align:right;letter-spacing:0}
  .controls{margin-top:13px}
}
