:root {
  color-scheme: light;
  --paper: #f8f7f2;
  --ink: #191b16;
  --muted: #51534b;
  --line: #d9d8cd;
  --lime: #d2eb68;
  --stage: #eef8b6;
  font-family: Inter, -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--paper); color: var(--ink); }
button, select { font: inherit; color: inherit; }
button { cursor: pointer; }
button:disabled { cursor: default; opacity: .47; }
button:focus-visible, select:focus-visible, a:focus-visible { outline: 3px solid #49620b; outline-offset: 4px; }
.shell { max-width: 1090px; padding: 24px 36px; margin: auto; }
header { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
header { min-height: 48px; margin-bottom: 30px; }
.brand { font-weight: 800; font-size: 24px; color: inherit; text-decoration: none; display: inline-flex; align-items: center; gap: 11px; }
#logo { width: 36px; display: inline-flex; }
.text-button { border: 0; background: transparent; font-weight: 700; padding: 12px 8px; }
nav { display: grid; grid-template-columns: repeat(3, 1fr); gap: 5px; margin-bottom: 44px; }
nav button { min-height: 46px; background: #eeede7; border: none; border-radius: 8px; font-weight: 700; }
nav button[aria-current] { background: var(--lime); }
nav b { margin-right: .5em; }
.columns { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.13fr); gap: 44px; align-items: start; }
.stage { background: radial-gradient(#b7ca75 1px, transparent 1px) 0 0 / 17px 17px, var(--stage); border-radius: 20px; min-height: 415px; display: grid; place-items: center; padding: 24px; }
.stage svg { width: min(92%, 290px); height: auto; filter: drop-shadow(0 15px 12px #40530a25); }
h1 { font-size: clamp(28px, 4vw, 48px); line-height: 1.15; margin: 0 0 14px; letter-spacing: -.045em; }
h2 { margin: 0 0 10px; font-size: 28px; }
p { color: var(--muted); line-height: 1.65; margin: 0 0 18px; }
.actions { display: grid; gap: 10px; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 10px; min-height: 48px; border: 1px solid #a2a49b; border-radius: 10px; background: transparent; padding: 9px 15px; font-weight: 750; text-align: center; }
.primary { background: var(--lime); border-color: transparent; }
.primary:hover:not(:disabled) { background: #c5e456; }
.shot-icon { width: 22px; height: 22px; }
.faces { display: grid; grid-template-columns: repeat(6, minmax(0,1fr)); gap: 7px; margin: 17px 0 12px; }
.face { display: grid; justify-items: center; gap: 6px; border: 1px solid transparent; border-radius: 9px; background: transparent; padding: 7px 3px; font-size: 13px; font-weight: 750; min-width: 0; }
.face[aria-pressed=true], .face.active { background: #eff5d6; border-color: #abb971; }
.mini, .tiles { display: grid; grid-template-columns: repeat(3,1fr); }
.mini { gap: 1px; padding: 2px; background: #aaa99e; border-radius: 4px; width: min(100%, 44px); }
.mini i, .tiles button { aspect-ratio: 1; background: var(--tile, #efeee7); border-radius: 2px; }
.tiles { width: min(100%, 220px); background: #262921; gap: 5px; padding: 6px; border-radius: 11px; margin: 12px 0; }
.tiles button { border: 1px solid #262921; padding: 0; border-radius: 5px; color: #151515; font-weight: 750; }
.tiles button.selected { outline: 3px solid #181a14; box-shadow: inset 0 0 0 3px white; }
.palette, .row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 12px 0; }
.palette button { border: 1px solid #0005; border-radius: 8px; padding: 0; width: 43px; height: 42px; background: var(--tile); color: #111; font-weight: 750; }
.palette button[aria-pressed=true] { outline: 2px solid #191b16; outline-offset: 2px; }
.divider { border-top: 1px solid var(--line); margin-top: 16px; }
.status { margin: 10px 0 0; font-size: 14px; min-height: 1.5em; }
.error { color: #a22a25; }
.photo-panel { min-width: 0; }
.photo { display: block; width: 100%; height: auto; border-radius: 13px; background: #262921; touch-action: manipulation; cursor: crosshair; }
.photo-panel .row .btn { min-height: 42px; }
.photo-panel select { max-width: 100%; min-height: 42px; border: 1px solid var(--line); background: white; border-radius: 8px; padding: 5px 12px; }
.rotate { font-size: 14px; }
progress { width: 100%; height: 15px; accent-color: #aaca37; }
.guide-actions { grid-template-columns: 1fr 1.35fr; margin-top: 20px; }
.moves { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 15px; }
.moves button { min-width: 44px; min-height: 44px; border: 1px solid var(--line); border-radius: 6px; background: transparent; }
.moves button[aria-current] { background: var(--lime); color: var(--ink); font-weight: 750; }
.pose { font-size: 14px; }
@media (max-width: 700px) {
  .shell { padding: 14px 18px 22px; }
  header { margin-bottom: 17px; }
  .brand { font-size: 21px; }
  nav { margin-bottom: 24px; }
  nav button { font-size: 13px; }
  .columns { grid-template-columns: 1fr; gap: 21px; }
  .stage { min-height: 220px; padding: 16px; }
  .stage svg { width: min(60%, 187px); }
  .landing .stage { order: 2; }
  h1 { font-size: 34px; }
}
.mini { grid-template-columns: repeat(var(--size, 3), 1fr); }
.capture-head { display: flex; justify-content: space-between; align-items: start; gap: 14px; flex-wrap: wrap; }
.size-options { display: flex; gap: 8px; }
.size-options [aria-pressed=true] { background: var(--lime); border-color: transparent; }
.shot-pair { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 22px; }
.shot-card { border: 1px solid var(--line); border-radius: 16px; padding: 14px; }
.shot-card h2 { font-size: 21px; margin-top: 14px; }
.shot-card p { font-size: 15px; min-height: 3em; }
.shot-visual { border-radius: 10px; background: var(--stage); height: 200px; display: grid; place-items: center; overflow: hidden; }
.shot-visual svg { width: 175px; }
.shot-visual img { width: 100%; height: 200px; object-fit: contain; background: #262921; }
.shot-visual polygon, .live-frame polygon { fill: none; stroke: currentColor; stroke-width: .85; }
.shot-visual text, .live-frame text { fill: currentColor; font-size: 8px; text-anchor: middle; dominant-baseline: middle; }
dialog { max-width: min(92vw, 480px); border: 0; border-radius: 14px; background: var(--paper); padding: 16px; }
dialog::backdrop { background: #161811aa; }
.live-frame { position: relative; aspect-ratio: 1; background: #191b16; overflow: hidden; margin-bottom: 12px; }
.live-frame video { position: absolute; width: 100%; height: 100%; object-fit: cover; }
#camera-wire { position: absolute; inset: 8%; color: #defc74; pointer-events: none; }
#camera-wire svg { width: 100%; height: 100%; }
@media (max-width: 570px) { .shot-pair { grid-template-columns: 1fr; gap: 14px; } }
.shot-switch [aria-pressed=true] { background: var(--lime); border-color: transparent; }
.flip-guide { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 7px; margin: 16px 0; }
.flip-guide > div { min-width: 0; padding: 8px 5px; border-radius: 9px; text-align: center; background: var(--stage); display: grid; justify-items: center; align-content: space-between; }
.flip-guide strong { font-size: clamp(11px, 2.8vw, 15px); }
.flip-guide svg { width: min(100%, 112px); margin-top: 5px; }
.flip-guide polygon { fill: none; stroke: currentColor; stroke-width: 1.15; }
.flip-guide text { fill: currentColor; font-size: 10px; text-anchor: middle; dominant-baseline: middle; }
.photo-tip { margin: 10px 0; }
#crop-frame { position: relative; touch-action: none; cursor: crosshair; user-select: none; width: fit-content; margin: auto; }
#crop-image { display: block; max-width: 100%; max-height: 56dvh; pointer-events: none; }
#crop-selection { position: absolute; outline: 2px solid #deff68; box-shadow: 0 0 0 200vmax #10120c88; pointer-events: none; }
#crop-frame { overflow: hidden; }
.photo-strip { display: flex; gap: 8px; overflow-x: auto; padding: 5px 3px; margin-top: 9px; }
.photo-thumb { flex: 0 0 60px; border-radius: 8px; border: 1px solid var(--line); background: var(--paper); font-size: 11px; padding: 3px; }
.photo-thumb[aria-pressed=true] { border-color: var(--ink); background: var(--lime); }
.photo-thumb img { width: 100%; height: 40px; object-fit: cover; border-radius: 5px; display: block; }
.flip-demo { margin: 12px 0 16px; }
.flip-stage {
  --face-depth: 43px;
  min-height: 192px;
  display: grid;
  grid-template-rows: 1fr auto;
  justify-items: center;
  align-items: center;
  perspective: 470px;
  overflow: hidden;
  padding: 8px 12px 10px;
  border-radius: 12px;
  background: var(--stage);
}
.flip-stage > span { font-size: 13px; color: #394321; font-weight: 700; }
.flip-camera, .flip-cube {
  position: relative;
  width: calc(2 * var(--face-depth));
  height: calc(2 * var(--face-depth));
  transform-style: preserve-3d;
}
.flip-camera { transform: rotateX(-26deg) rotateY(-37deg); }
.flip-cube { transform: rotateY(0deg) rotateX(0deg); }
.flip-face {
  position: absolute;
  inset: 0;
  display: grid;
  grid-template-columns: repeat(var(--tiles), 1fr);
  gap: 2px;
  padding: 2px;
  border: 1px solid #1b2115;
  background: #1b2115;
  backface-visibility: hidden;
}
.flip-face i { background: var(--sticker); border-radius: 2px; }
.flip-face b {
  position: absolute;
  inset: 50% auto auto 50%;
  transform: translate(-50%, -50%);
  background: white;
  color: #191b16;
  border-radius: 50%;
  width: 25px;
  height: 25px;
  display: grid;
  place-items: center;
  font-size: 15px;
}
.face-u { transform: rotateX(90deg) translateZ(var(--face-depth)); }
.face-r { transform: rotateY(90deg) translateZ(var(--face-depth)); }
.face-f { transform: translateZ(var(--face-depth)); }
.face-d { transform: rotateX(-90deg) translateZ(var(--face-depth)); }
.face-l { transform: rotateY(-90deg) translateZ(var(--face-depth)); }
.face-b { transform: rotateY(180deg) translateZ(var(--face-depth)); }
#flip-caption { margin-top: 10px; min-height: 3.3em; }
.flip-guide .flip-pose {
  display: grid;
  justify-items: center;
  align-content: space-between;
  min-width: 0;
  padding: 8px 4px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--paper);
}
.flip-pose[aria-pressed=true] { background: var(--stage); border-color: #818c57; }
.header-actions { display: flex; gap: 5px; }
.header-actions button { min-height: 44px; }
.photo-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 8px; color: var(--muted); font-size: 14px; }
.photo-toolbar .text-button { min-height: 44px; font-size: 14px; }
.shot-visual .photo-image { width: 100%; height: 100%; background: #27281e; overflow: hidden; }
.shot-visual:has(.photo-image) { height: clamp(235px, 63vw, 420px); }
.photo-thumb .photo-thumbnail { width: 100%; height: 40px; overflow: hidden; border-radius: 5px; display: block; }
.color-mark polygon { fill: none; stroke: #fafafa; stroke-width: 1.1; vector-effect: non-scaling-stroke; }
.color-mark.uncertain polygon { stroke: #ffdd48; stroke-width: 2; stroke-dasharray: 4 3; }
.color-mark rect { stroke: #171912; stroke-width: 1.1; vector-effect: non-scaling-stroke; }
.color-mark text { fill: #101308; text-anchor: middle; dominant-baseline: central; font-weight: 800; paint-order: stroke; stroke: #fff; stroke-width: .7px; }
.photo-assessment { background: #eef0e7; margin: 9px 0; padding: 11px; border-radius: 9px; font-size: 14px; }
.photo-assessment.warning { background: #fff0ce; }
.photo-assessment p { margin: 3px 0 6px; font-size: 14px; }
p.photo-assessment { min-height: auto; }
.reading-list { display: flex; flex-wrap: wrap; gap: 5px 12px; font-size: 13px; }
.flip-panel { margin: 0 0 12px; border: 1px solid var(--line); border-radius: 10px; padding: 0 10px; }
.flip-panel summary { cursor: pointer; min-height: 44px; align-content: center; font-weight: 750; }
.capture-actions { margin-bottom: 4px; }
.photo-tools { margin: 0; }
.photo-tools button { min-height: 44px; font-size: 14px; }
.shot-card .status:empty { display: none; }
.zoom-tools { display: flex; gap: 7px; align-items: center; margin: 6px 0; font-size: 14px; }
.zoom-tools .btn { width: 44px; height: 44px; min-height: 44px; padding: 0; }
.photo-image.zoomed, #align-svg { touch-action: none; }
.photo-image.zoomed { cursor: grab; }
.color-mark { cursor: pointer; }
.color-mark:focus-visible rect, .color-mark:hover rect { stroke: #fff; stroke-width: 2.5; }
.color-options { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.color-options i { width: 20px; height: 20px; border: 1px solid #555; border-radius: 4px; }
.color-options [aria-pressed=true] { background: var(--stage); }
#align-svg { display: block; width: min(100%, 400px); height: min(50vh, 360px); }
#align-svg polygon { fill: none; stroke: #ffe173; stroke-width: 2; vector-effect: non-scaling-stroke; pointer-events: none; }
#align-svg .align-dot { fill: #d4f66d; stroke: #111; stroke-width: 2; vector-effect: non-scaling-stroke; pointer-events: none; }
#align-svg .align-hit { fill: transparent; stroke: transparent; stroke-width: 22px; vector-effect: non-scaling-stroke; cursor: grab; pointer-events: all; }
#align-svg [data-align-point]:focus-visible .align-dot { fill: #fff; }
#align-svg .align-crop { fill: none; stroke: #f7f8f4; stroke-dasharray: 4px 4px; vector-effect: non-scaling-stroke; pointer-events: none; }
.workflow { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 24px; }
.workflow nav { display: flex; gap: 4px; margin: 0; }
.workflow button, .language button { min-height: 44px; white-space: nowrap; }
.workflow nav button { padding: 0 12px; }
.workflow .size-options { gap: 4px; margin: 0 0 0 auto; }
.workflow .size-options button { min-height: 44px; padding: 0 12px; }
.language { display: inline-flex; align-items: center; gap: 2px; background: #eeede7; border-radius: 9px; padding: 2px; }
.language button { border: 0; border-radius: 7px; background: transparent; padding: 0 11px; font-weight: 750; }
.language [aria-pressed=true] { background: var(--paper); box-shadow: 0 1px 3px #282a1733; }
.shot-card p, .shot-card .photo-tip { min-height: 0; }
.shot-card .flip-demo p { min-height: 0; }
.notation summary { cursor: pointer; margin: 8px 0; }
.notation p { font-size: 14px; margin: 7px 0; }
.shot-switch { margin-top: 0; }
@media (max-width: 530px) {
  .workflow { gap: 5px; margin-bottom: 18px; }
  .workflow nav button, .workflow .size-options button { padding: 0 6px; font-size: 12px; }
  .workflow nav b { display: none; }
  .workflow .size-options button { min-width: 36px; }
  .workflow nav button { min-width: 42px; }
}
@media (max-width: 365px) {
  .shell { padding-right: 12px; padding-left: 12px; }
}
.validation-row { display: flex; justify-content: flex-end; border-top: 1px solid var(--line); margin-top: 12px; padding-top: 12px; }
.capture-heading { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.capture-heading .text-button { flex: 0 0 auto; padding: 8px 0 8px 6px; font-size: 14px; }
.turn-facts { display: grid; grid-template-columns: auto 1fr 1.1fr; align-items: stretch; gap: 6px; margin: 10px 0; }
.turn-facts div { padding: 7px 9px; min-width: 0; border-radius: 8px; background: #eeede7; display: grid; align-content: start; }
.turn-facts dt { font-size: 11px; color: var(--muted); line-height: 1.3; }
.turn-facts dd { margin: 4px 0 0; font-size: 14px; font-weight: 750; }
.turn-facts .turn-token { font-size: 22px; font-family: ui-monospace, Consolas, monospace; line-height: 1.1; }
.turn-canvas { display: block; width: 100%; height: auto; max-height: min(40vh, 260px); object-fit: contain; border-radius: 10px; background: var(--stage); }
.turn-controls { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin: 10px 0; }
.turn-controls span { color: var(--muted); font-size: 13px; }
#moves-dialog { width: min(94vw, 485px); }
.move-choice { display: flex; gap: 8px; align-items: center; }
.move-choice select { min-height: 40px; padding: 4px 10px; border: 1px solid #a2a49b; background: var(--paper); border-radius: 8px; }
@media (max-width: 430px) {
  .capture-heading h1 { font-size: clamp(24px, 6.6vw, 30px); }
  .capture-heading .text-button { font-size: 13px; }
  .turn-facts { grid-template-columns: auto 1fr 1fr; }
  .turn-facts div { padding: 6px; }
}
.solve-guide { max-width: 820px; margin-inline: auto; }
.solve-guide progress { display: block; margin-bottom: 16px; }
.solve-visuals { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: clamp(8px, 2vw, 18px); }
.solve-visuals figure { min-width: 0; margin: 0; }
.solve-visuals figcaption { font-size: 14px; font-weight: 750; line-height: 1.3; margin-bottom: 6px; }
.solve-visuals .solve-state, .solve-animation { height: clamp(110px, 31vw, 260px); border-radius: 12px; }
.solve-visuals .solve-state { min-height: 0; padding: 8px; }
.solve-visuals .solve-state svg { width: auto; height: 76%; max-width: 78%; }
.solve-animation { overflow: hidden; background: var(--stage); }
.solve-animation .turn-canvas { height: 100%; max-height: none; }
.solve-complete { display: block; max-width: 400px; }
.solve-guide .faces { max-width: 425px; }
@media (max-width: 430px) {
  .solve-visuals figcaption { font-size: 13px; }
}
.solve-guide .turn-facts dd:not(.turn-token) { overflow-wrap: anywhere; }
