:root {
  color-scheme: light;
  font-family: 'Inter', 'Microsoft YaHei UI', 'PingFang SC', system-ui, sans-serif;
  background: #f8f6f2;
  color: #27251f;
  --paper: #fffefa;
  --border: #e9e3da;
  --muted: #716960;
  --accent: #ac4a2d;
  --tint: #faeee6;
}
*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; }
button, input, select { font: inherit; }
button { cursor: pointer; }
button, select, input { color: inherit; }
button:focus-visible, input:focus-visible, select:focus-visible, a:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
h1, h2, h3, p { margin: 0; }
.shell { width: min(1280px, calc(100% - 96px)); margin-inline: auto; }
.site-header { border-bottom: 1px solid var(--border); background: #fbf9f5; }
.header-inner { height: 68px; display: flex; align-items: center; justify-content: space-between; }
.header-actions { display: flex; align-items: center; gap: 15px; }
.brand { display: inline-flex; align-items: center; gap: 10px; color: inherit; text-decoration: none; }
.brand-mark { display: grid; place-items: center; width: 32px; height: 32px; border-radius: 10px; color: #fff9f3; background: #af5438; font-size: 19px; }
.brand strong { font-size: 20px; letter-spacing: .06em; }
.brand-en { color: var(--muted); font-size: 10px; font-weight: 650; letter-spacing: .17em; }
.help-button, .text-button { background: transparent; border: 0; font-size: 13px; padding: 6px 0; color: var(--muted); }
.help-button span { margin-right: 3px; }
.help-button:hover, .text-button:hover { color: var(--accent); }
.intro { padding: 34px 0 27px; }
.eyebrow { display: flex; align-items: center; gap: 8px; color: var(--accent); font-size: 12px; letter-spacing: .13em; font-weight: 650; }
.eyebrow span, .stage-label span:first-child { display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: #bd6449; }
h1 { font-size: clamp(30px, 4.15vw, 55px); letter-spacing: -.065em; line-height: 1.23; margin: 8px 0 11px; font-weight: 760; }
h1 em { font-style: normal; color: var(--accent); }
.intro > p:last-child { color: var(--muted); font-size: 14px; line-height: 1.65; }
.workspace { display: grid; grid-template-columns: minmax(0, 1.75fr) minmax(325px, 1fr); align-items: start; gap: 20px; }
.visual-column { min-width: 0; display: grid; gap: 16px; }
.panel { background: var(--paper); border: 1px solid var(--border); border-radius: 18px; box-shadow: 0 3px 9px #39271405; }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 19px 22px 15px; }
.panel-head h2 { font-size: 19px; letter-spacing: -.025em; }
.panel-head p { font-size: 12px; color: var(--muted); margin-top: 4px; }
.segmented { display: flex; padding: 3px; gap: 3px; background: #f4f0eb; border: 1px solid #ede6dc; border-radius: 9px; }
.segmented button { white-space: nowrap; border: 1px solid transparent; background: transparent; color: var(--muted); border-radius: 6px; padding: 6px 10px; font-size: 12px; }
.segmented button[aria-pressed='true'] { background: var(--paper); border-color: var(--border); color: var(--accent); box-shadow: 0 1px 2px #3727100c; font-weight: 650; }
.stage { position: relative; overflow: hidden; margin: 0 15px; height: 385px; border: 1px solid #eaded2; border-radius: 12px; background-color: #fbf5ed; background-image: linear-gradient(#bd9d811c 1px, transparent 1px), linear-gradient(90deg, #bd9d811c 1px, transparent 1px), radial-gradient(ellipse at center, #fffaf4 10%, transparent 76%); background-size: 22px 22px, 22px 22px, 100% 100%; background-position: center; }
#figure { display: block; width: 100%; height: 100%; cursor: grab; touch-action: pan-y; }
#figure.is-rotating { cursor: grabbing; }
#figure.is-zoomed { touch-action: none; }
#figure:focus-visible { outline: 2px solid var(--accent); outline-offset: -3px; }
.stage-label { position: absolute; z-index: 1; top: 13px; left: 13px; border: 1px solid #ecded0; background: #fffaf3; color: #745a48; font-size: 11px; border-radius: 6px; padding: 5px 8px; display: flex; gap: 6px; align-items: center; pointer-events: none; }
.rotation-tools { display: flex; flex-wrap: wrap; gap: 8px 16px; align-items: center; padding: 11px 20px 0; }
.rotation-input { display: flex; flex: 1; align-items: center; gap: 8px; min-width: min(100%, 255px); color: var(--muted); font-size: 11px; white-space: nowrap; }
.rotation-input input { flex: 1; min-width: 35px; accent-color: var(--accent); cursor: pointer; }
.rotation-input output { width: 30px; text-align: right; font-variant-numeric: tabular-nums; }
.zoom-tools { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 7px; padding: 8px 20px 0; color: var(--muted); font-size: 11px; }
.zoom-buttons { align-items: center; }
.zoom-buttons button { min-width: 32px; }
.zoom-buttons button:disabled { cursor: default; opacity: .48; }
.zoom-buttons output { min-width: 39px; text-align: center; font-variant-numeric: tabular-nums; }
.detail-tools { display: flex; align-items: center; flex-wrap: wrap; gap: 7px; padding: 8px 20px 0; color: var(--muted); font-size: 11px; }
.preview-footer { padding: 13px 21px 14px; display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 8px; }
.legend { display: flex; flex-wrap: wrap; gap: 18px; }
.legend span, .model-note { color: var(--muted); font-size: 11px; }
.legend i, .edit-switch i { display: inline-block; vertical-align: middle; width: 15px; margin-right: 3px; border-top: 2px solid #b95739; }
i.legend-baseline { border-top: 2px dashed #92715d; }
.changes-icon { border-radius: 8px; display: grid; place-items: center; background: #f5eee6; color: #835743; width: 32px; height: 32px; font-size: 21px; }
.change-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; padding: 0 16px 16px; }
.change-card { min-width: 0; background: #f9f6f0; border: 1px solid #eee8de; border-radius: 9px; padding: 10px 11px; }
.change-label { font-size: 11px; color: var(--muted); }
.change-value { display: block; padding-top: 2px; color: #45372e; font-variant-numeric: tabular-nums; font-size: 19px; font-weight: 700; white-space: nowrap; }
.change-value small { color: var(--muted); font-weight: 500; font-size: 10px; }
.change-value.decreased { color: #4d6f55; }
.controls .panel-head { padding-bottom: 14px; }
.controls-body { padding: 0 21px 14px; }
.edit-switch button { flex: 1; padding-block: 8px; }
.profile { display: grid; grid-template-columns: 1.3fr 1fr; gap: 10px; margin: 15px 0; }
.profile label { display: grid; gap: 6px; font-size: 12px; color: var(--muted); }
.profile input, .profile select, .measurement input[type='number'] { min-width: 0; border: 1px solid #e6ddd1; border-radius: 7px; background: #fcfaf6; padding: 6px 8px; }
.profile label > :is(input, select) { width: 100%; height: 35px; font-size: 13px; }
input[aria-invalid='true'] { outline: 1px solid var(--accent); }
.measurements-title { border-top: 1px solid var(--border); padding: 13px 0 5px; display: flex; align-items: center; justify-content: space-between; }
.measurements-title h3 { font-size: 13px; }
.measurements-title span { font-size: 10px; color: var(--muted); }
.measurement { display: grid; grid-template-columns: minmax(54px, 1fr) 94px; align-items: center; gap: 10px; margin-top: 9px; }
.measurement-toggle { color: var(--accent); }
.measurement-toggle[aria-expanded='false'] + #measurements .range-surface { display: none; }
.measurement-toggle[aria-expanded='true'] + #measurements .measurement { grid-template-columns: 60px minmax(0, 1fr) 74px; }
.range-surface { position: relative; display: flex; }
.rotation-input .range-surface { flex: 1; min-width: 35px; }
.range-touch { display: none; }
@media (any-pointer: coarse) {
  .range-touch { display: block; position: absolute; inset: 0; touch-action: pan-y; }
  .measurement .range-surface { min-height: 32px; align-items: center; }
}
.measurement label { font-size: 12px; }
.measurement input[type='range'] { --progress: 50%; appearance: none; width: 100%; margin: 0; padding: 6px 0; background: transparent; cursor: pointer; }
.measurement input[type='range']::-webkit-slider-runnable-track { height: 4px; border-radius: 4px; background: linear-gradient(to right, #c16d51 var(--progress), #ebe1d7 var(--progress)); }
.measurement input[type='range']::-webkit-slider-thumb { appearance: none; width: 14px; height: 14px; border-radius: 50%; background: #b8593b; border: 2px solid #fff9f0; box-shadow: 0 0 0 1px #b8593b; margin-top: -5px; }
.measurement input[type='range']::-moz-range-track { height: 4px; border-radius: 4px; background: linear-gradient(to right, #c16d51 var(--progress), #ebe1d7 var(--progress)); }
.measurement input[type='range']::-moz-range-thumb { width: 10px; height: 10px; border-radius: 50%; background: #b8593b; border: 2px solid #fff9f0; box-shadow: 0 0 0 1px #b8593b; }
.measurement input[type='number'] { text-align: center; font-size: 13px; font-variant-numeric: tabular-nums; appearance: textfield; }
.measurement input::-webkit-inner-spin-button { appearance: none; }
.save-actions { border-top: 1px solid var(--border); margin-top: 15px; padding-top: 11px; }
.save-actions button { width: 100%; }
.toast-region { position: fixed; inset: calc(16px + env(safe-area-inset-top)) 16px auto; z-index: 10; display: grid; justify-items: center; gap: 7px; pointer-events: none; }
.toast { display: flex; flex-wrap: wrap; align-items: center; gap: 9px; padding: 11px 17px; max-width: min(480px, 100%); border: 1px solid #55504b; border-radius: 12px; background: #302c29; color: #fffaf6; font-size: 14px; font-weight: 650; box-shadow: 0 12px 32px #0005; animation: toast-in .18s ease-out; }
.toast-icon { display: grid; place-items: center; flex: 0 0 24px; height: 24px; border-radius: 50%; background: #b7dabd; color: #1e3825; }
.toast[data-kind='error'] .toast-icon { background: #ffc0ac; color: #55281b; }
.toast button { pointer-events: auto; border: 1px solid #85796e; border-radius: 6px; background: transparent; color: inherit; padding: 3px 8px; }
.toast button:last-child { background: #fff7ed; color: #302c29; }
@keyframes toast-in { from { opacity: 0; transform: translateY(-12px) scale(.96); } }
@media (prefers-reduced-motion: reduce) { .toast { animation: none; } }
.site-footer { display: flex; justify-content: space-between; padding: 18px 0; color: var(--muted); font-size: 11px; }
dialog { width: min(480px, calc(100% - 30px)); max-height: calc(100% - 30px); overflow: auto; border: 1px solid var(--border); border-radius: 16px; background: var(--paper); color: inherit; padding: 22px; box-shadow: 0 12px 42px #39271431; }
dialog::backdrop { background: #33201969; }
.dialog-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.dialog-head h2 { font-size: 21px; }
.close-button { line-height: 1; background: #f5eee6; border: 0; padding: 5px 8px; border-radius: 6px; font-size: 20px; }
dialog p, dialog dl { color: var(--muted); font-size: 14px; line-height: 1.65; }
dialog dt { color: #3b2f28; font-weight: 650; }
dialog dd { margin: 0 0 6px; }
.account-form { display: grid; gap: 11px; }
.history-panel { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 15px; padding: 11px 16px; margin-bottom: 16px; }
.history-picker { display: flex; align-items: center; gap: 8px; font-size: 13px; }
.history-picker input { font: inherit; padding: 6px 10px; border: 1px solid var(--border); border-radius: 7px; background: #fcfaf6; }
#account-profile details { margin-bottom: 10px; }
#account-profile summary { cursor: pointer; font-size: 14px; }
#account-profile details form { margin-top: 9px; }
.account-form label { display: grid; gap: 5px; font-size: 13px; }
[hidden] { display: none !important; }
.account-form input { width: 100%; min-width: 0; border: 1px solid var(--border); border-radius: 7px; padding: 8px; background: #fcfaf6; }
.account-primary { padding: 8px 15px; border: 1px solid var(--accent); border-radius: 7px; background: var(--accent); color: white; }
#account-owner { margin-bottom: 10px; }
@media (max-width: 1050px) { .shell { width: calc(100% - 48px); } }
@media (max-width: 760px) {
  .shell { width: calc(100% - 30px); }
  .header-inner { height: 55px; }
  .intro { padding: 25px 0 21px; }
  .workspace { grid-template-columns: minmax(0, 1fr); gap: 14px; }
  .visual-column { display: contents; }
  .controls { grid-row: 2; }
  .stage { margin-inline: 10px; height: 335px; }
  .panel-head { padding-inline: 14px; }
  .preview-footer, .controls-body { padding-inline: 13px; }
  .rotation-tools, .zoom-tools, .detail-tools { padding-inline: 13px; }
  .change-grid { padding-inline: 11px; }
}
@media (max-width: 400px) {
  .view-switch button { padding-inline: 6px; }
  .change-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
