:root {
  color-scheme: light;
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif;
  color: #28241e;
  background: #f6f3ed;
  --line: #ded8cc;
  --ink: #3b3328;
  --muted: #726a5d;
  --paper: #fdfbf7;
}

*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; }
button { font: inherit; color: inherit; -webkit-tap-highlight-color: transparent; }
button:enabled { cursor: pointer; }
button:focus-visible { outline: 2px solid #9a6339; outline-offset: 3px; }
[hidden] { display: none !important; }

.shell { width: min(1480px, calc(100% - 88px)); margin: 0 auto; }
.masthead {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 76px;
  border-bottom: 1px solid var(--line);
}
.wordmark { display: inline-flex; gap: 10px; align-items: center; font-weight: 650; letter-spacing: .18em; }
.wordmark i { width: 17px; height: 17px; border: 1px solid #846744; border-radius: 50%; position: relative; }
.wordmark i::after { content: ""; position: absolute; inset: 4px; border-radius: 50%; background: #b18b5e; }
.engine { color: var(--muted); font-size: 12px; letter-spacing: .08em; }

.layout { display: grid; grid-template-columns: minmax(0, 1.8fr) minmax(332px, 1fr); gap: 22px; padding: 22px 0 36px; }
.stage {
  position: relative;
  min-width: 0;
  height: clamp(540px, calc(100svh - 130px), 860px);
  overflow: hidden;
  border-radius: 18px;
  border: 1px solid #e4ded3;
  background: radial-gradient(ellipse at 48% 40%, #f3efe8 15%, #e9e2d7 76%, #e2dbcf);
  isolation: isolate;
}
.stage::after {
  position: absolute;
  inset: 0;
  content: "";
  pointer-events: none;
  background: radial-gradient(ellipse at 48% 38%, transparent 52%, #59411c0c 100%);
}
canvas { display: block; width: 100%; height: 100%; touch-action: none; cursor: grab; }
canvas:active { cursor: grabbing; }
.stage-toolbar {
  position: absolute;
  z-index: 1;
  inset: 18px 18px auto;
  display: flex;
  gap: 8px;
  align-items: center;
  justify-content: space-between;
  pointer-events: none;
}
.view-label, .reset, .stage-hint {
  font-size: 12px;
  background: #faf7f0ed;
  border: 1px solid #d7cfc1;
  border-radius: 100px;
}
.view-label { display: inline-flex; align-items: center; gap: 7px; padding: 9px 12px; }
.view-label i { width: 6px; height: 6px; border-radius: 50%; background: #8b6841; }
.reset { min-height: 42px; padding: 0 13px; pointer-events: auto; }
.reset span { margin-left: 4px; }
.reset:hover:enabled { background: #fffdf9; }
.stage-hint { position: absolute; z-index: 1; bottom: 17px; left: 18px; margin: 0; padding: 9px 12px; color: var(--muted); pointer-events: none; }
.stage-message { position: absolute; inset: 0; display: grid; place-content: center; padding: 24px; color: var(--muted); text-align: center; line-height: 1.6; }

.controls { background: var(--paper); border: 1px solid var(--line); border-radius: 18px; padding: clamp(24px, 3vw, 46px); align-self: start; }
.intro { margin-bottom: 32px; }
h1 {
  margin: 0 0 12px;
  font-family: "Songti SC", "Noto Serif CJK SC", STSong, serif;
  font-size: clamp(37px, 4.4vw, 65px);
  font-weight: 600;
  line-height: 1.13;
  letter-spacing: -.06em;
}
.intro p { margin: 0; font-size: 14px; color: var(--muted); line-height: 1.6; }
fieldset { margin: 0; border: 0; padding: 0; min-width: 0; }
fieldset + fieldset { margin-top: 25px; }
legend { padding: 0 0 12px; font-size: 15px; font-weight: 600; }
.choices { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; }
.choices button {
  position: relative;
  display: flex;
  align-items: center;
  gap: 9px;
  min-width: 0;
  min-height: 51px;
  padding: 8px 24px 8px 9px;
  border: 1px solid var(--line);
  background: #faf8f3;
  border-radius: 9px;
  font-size: 13px;
  text-align: left;
}
.choices button:hover:enabled { border-color: #a69680; }
.choices button[aria-pressed="true"] { border-color: #6c5237; background: #f4ede0; }
.choices button[aria-pressed="true"]::after {
  content: "";
  position: absolute;
  right: 10px;
  width: 8px;
  height: 5px;
  border: solid #6c5237;
  border-width: 0 0 1.5px 1.5px;
  transform: rotate(-45deg);
}
.swatch { width: 25px; height: 25px; flex: 0 0 25px; border-radius: 5px; background: var(--swatch); box-shadow: inset 0 0 0 1px #271b1517; }
.glass-sample { width: 28px; height: 28px; flex: 0 0 28px; border-radius: 50%; border: 1px solid #d7ccba; }
.frosted { background: radial-gradient(circle at 30% 27%, #fffdf5, #e9dcc7 56%, #b7a68e 100%); }
.glossy { background: radial-gradient(circle at 29% 28%, white 0 11%, transparent 18%), radial-gradient(circle at 36% 36%, #f5eddd, #c4ad92 65%, #f4e2c6 84%, #9d876e); }
fieldset:disabled { opacity: .6; }

@media (max-width: 840px) {
  .shell { width: calc(100% - 32px); }
  .masthead { height: 56px; }
  .layout { grid-template-columns: minmax(0, 1fr); padding-top: 14px; gap: 14px; }
  .stage { height: clamp(300px, 45svh, 460px); }
  .controls { padding: 24px; }
  .intro { margin-bottom: 24px; }
}

@media (max-width: 420px) {
  .stage-toolbar { inset: 10px 10px auto; }
  .stage-hint { bottom: 10px; left: 10px; }
  .controls { padding: 20px; }
}
