:root {
  color-scheme: light;
  --bg: #f4f0ea;
  --ink: #1c1916;
  --muted: #6f675f;
  --line: #e3dbd1;
  --card: #fffcf8;
  --accent: #1f4a42;
  --accent-ink: #f7f4ef;
  --soft: #e7f0ed;
  --warn: #8a4b16;
  --warn-bg: #f8efe4;
  --shadow: 0 16px 40px rgba(48, 36, 22, 0.06);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
  font-family: "Iowan Old Style", "Palatino Linotype", Palatino, "Songti SC", "Noto Serif SC", "PingFang SC", serif;
}

button, input, select { font-family: "PingFang SC", "Noto Sans SC", "Segoe UI", sans-serif; }

.studio {
  width: min(440px, calc(100% - 28px));
  margin: 0 auto;
  padding: 22px 0 72px;
}

.mark {
  margin: 0;
  font-family: "PingFang SC", "Noto Sans SC", sans-serif;
  font-size: 13px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--accent);
}

h1, h2, h3 { font-weight: 560; letter-spacing: -0.03em; }
h1 { font-size: 36px; line-height: 1.15; margin: 8px 0 0; }
h2 { font-size: 28px; line-height: 1.2; margin: 0; }
h3 { font-size: 18px; margin: 18px 0 0; }

.lede, .panel p, .hint, .note { color: var(--muted); line-height: 1.55; margin: 0; }

.progress {
  margin-top: 22px;
  display: grid;
  gap: 8px;
}

.progress p {
  margin: 0;
  font-family: "PingFang SC", "Noto Sans SC", sans-serif;
  font-size: 13px;
  color: var(--muted);
}

.bar {
  height: 3px;
  border-radius: 99px;
  background: var(--line);
  overflow: hidden;
}

.bar span {
  display: block;
  height: 100%;
  width: 25%;
  background: var(--accent);
}

.banner {
  margin: 14px 0 0;
  padding: 12px 14px;
  border-radius: 12px;
  background: var(--warn-bg);
  color: var(--warn);
  font-family: "PingFang SC", "Noto Sans SC", sans-serif;
}

.panel {
  margin-top: 16px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 22px;
  padding: 22px 18px 18px;
  display: grid;
  gap: 14px;
  box-shadow: var(--shadow);
}

.hidden { display: none !important; }

.tips {
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-family: "PingFang SC", "Noto Sans SC", sans-serif;
  font-size: 14px;
}

.tips li::before { content: "· "; color: var(--accent); }

.panel > button,
[data-face] > button,
#camera-box > button,
#rx-menu > button,
#rx-form > button,
#rx-confirm > button,
.pay > button,
.product > button,
.sheet > button {
  width: 100%;
}

button {
  border: 0;
  border-radius: 14px;
  padding: 14px 16px;
  background: var(--accent);
  color: var(--accent-ink);
  cursor: pointer;
  font-size: 16px;
  font-weight: 600;
}

button.ghost, button.text {
  background: transparent;
  color: var(--accent);
  border: 0;
  font-weight: 560;
  padding: 8px 4px;
}

button.ghost { border: 1px solid var(--line); color: var(--ink); background: transparent; }

button:disabled { opacity: 0.45; cursor: not-allowed; }

button:focus-visible, .shot:focus-visible, select:focus-visible, input:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.actions { display: grid; gap: 4px; justify-items: center; }
.actions button.text { width: 100%; }

.viewfinder {
  position: relative;
  border-radius: 18px;
  overflow: hidden;
  background: #1c1916;
  aspect-ratio: 3 / 4;
}

#live {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  background: #1c1916;
}

.viewfinder.mirror #live { transform: scaleX(-1); }

.guide {
  position: absolute;
  inset: 12% 18%;
  border: 1.5px solid rgba(255, 252, 248, 0.85);
  border-radius: 50% 50% 46% 46%;
  pointer-events: none;
}

.shots { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

.shot {
  min-height: 148px;
  padding: 12px;
  border-radius: 16px;
  border: 1px solid var(--line);
  background: #f7f3ee;
  color: var(--ink);
  display: grid;
  align-content: end;
  gap: 4px;
  text-align: left;
}

.shot small { color: var(--muted); font-size: 12px; font-weight: 500; }
.shot.filled { border-color: var(--accent); background: var(--soft); }
.shot img {
  width: 100%;
  height: 92px;
  object-fit: cover;
  border-radius: 10px;
  background: #ddd;
}

.marks { list-style: none; display: flex; gap: 8px; padding: 0; margin: 0; }
.marks[hidden] { display: none; }
.marks li {
  flex: 1;
  text-align: center;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 7px 0;
  color: var(--muted);
  font-family: "PingFang SC", "Noto Sans SC", sans-serif;
  font-size: 13px;
}
.marks li.ok { color: var(--accent); background: var(--soft); border-color: transparent; }

.stack { display: grid; gap: 8px; }
.menu { display: grid; }

.choice {
  width: 100%;
  text-align: left;
  background: transparent;
  color: var(--ink);
  border-radius: 0;
  border-bottom: 1px solid var(--line);
  padding: 14px 2px;
  font-weight: 560;
}

.choice:last-child { border-bottom: 0; color: var(--muted); }

label.plain {
  display: grid;
  gap: 6px;
  font-family: "PingFang SC", "Noto Sans SC", sans-serif;
  font-size: 14px;
  color: var(--muted);
}

textarea, input[type="text"], input[type="number"], .plain input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px;
  background: #fff;
  color: var(--ink);
  font-size: 16px;
}

.readout {
  margin: 0;
  padding: 14px;
  border-radius: 14px;
  background: var(--soft);
  color: var(--ink);
  line-height: 1.5;
}

.pref-group {
  margin: 4px 0 0;
  font-family: "PingFang SC", "Noto Sans SC", sans-serif;
  color: var(--ink);
}

.chips { display: flex; flex-wrap: wrap; gap: 8px; }

.chip {
  width: auto;
  background: #f7f3ee;
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 8px 14px;
  font-size: 14px;
  font-weight: 560;
}

.chip.on { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }

.ready-list { margin: 0; padding-left: 18px; display: grid; gap: 6px; }
.ready-list li { line-height: 1.45; }

.fit-kicker {
  margin: 0;
  font-family: "PingFang SC", "Noto Sans SC", sans-serif;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  font-size: 12px;
  color: var(--accent);
}

.fit-range { font-size: 40px; letter-spacing: -0.04em; margin: 4px 0; }

.direction { margin: 8px 0 0; padding-left: 18px; display: grid; gap: 6px; }

.shape-row { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.shape-row figure {
  margin: 0;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #f7f3ee;
}
.shape-row svg { width: 100%; height: auto; display: block; }
.shape-row figcaption {
  color: var(--ink);
  font-family: "PingFang SC", "Noto Sans SC", sans-serif;
  font-size: 12px;
}
.tone-recommend { background: var(--soft); }
.tone-avoid { background: var(--warn-bg); }

.lock-list { margin: 0; padding-left: 18px; color: var(--muted); display: grid; gap: 4px; }

.pay {
  display: grid;
  gap: 8px;
  margin-top: 8px;
  padding: 16px;
  border-radius: 18px;
  background: #f7f3ee;
  border: 1px solid var(--line);
}

.price { font-size: 36px; margin: 4px 0; letter-spacing: -0.04em; }

.stat-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.stat { padding: 12px; border-radius: 14px; background: #f7f3ee; }
.stat span {
  display: block;
  color: var(--muted);
  font-family: "PingFang SC", "Noto Sans SC", sans-serif;
  font-size: 12px;
}
.stat strong { font-size: 22px; }

.product {
  display: grid;
  gap: 4px;
  padding: 14px;
  border-radius: 16px;
  border: 1px solid var(--line);
  margin-top: 8px;
}
.product p { margin: 0; }
.fit-score { color: var(--accent); font-weight: 650; }

.sheet-back {
  position: fixed;
  inset: 0;
  background: rgba(28, 25, 22, 0.28);
  z-index: 4;
}

.sheet {
  position: fixed;
  left: 12px;
  right: 12px;
  bottom: 12px;
  z-index: 5;
  width: min(440px, calc(100% - 24px));
  margin: 0 auto;
  background: var(--card);
  color: var(--ink);
  border-radius: 20px;
  padding: 18px;
  border: 1px solid var(--line);
  display: grid;
  gap: 10px;
  box-shadow: var(--shadow);
}

.cards { display: grid; gap: 10px; }
.wear-view, .wear-stage canvas {
  width: 100%;
  border-radius: 16px;
  background: #241f1b;
  display: block;
}
.wear-stage { display: grid; gap: 8px; }
.wear-stage canvas { aspect-ratio: 3 / 4; height: auto; }
.wear-switch { display: flex; gap: 8px; }
.wear-switch button {
  flex: 1;
  width: auto;
  background: #f7f3ee;
  color: var(--ink);
  border: 1px solid var(--line);
}
.wear-switch button.on { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }

.hint.working::before,
.note.working::before {
  content: "";
  display: inline-block;
  width: 0.75em;
  height: 0.75em;
  margin-right: 8px;
  border-radius: 50%;
  border: 2px solid var(--line);
  border-top-color: var(--accent);
  vertical-align: -1px;
  animation: busy-spin 0.8s linear infinite;
}

.busy {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(244, 240, 234, 0.78);
}
.busy[hidden] { display: none !important; }
.busy-card {
  width: min(360px, 100%);
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 22px 18px 18px;
  display: grid;
  justify-items: center;
  gap: 14px;
  box-shadow: var(--shadow);
  text-align: center;
}
.busy-mark {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 2px solid var(--line);
  border-top-color: var(--accent);
  animation: busy-spin 0.8s linear infinite;
}
.busy-card p { margin: 0; font-family: "PingFang SC", "Noto Sans SC", sans-serif; }
.busy-track {
  width: 100%;
  height: 3px;
  border-radius: 99px;
  background: var(--line);
  overflow: hidden;
}
.busy-track span {
  display: block;
  height: 100%;
  width: 38%;
  background: var(--accent);
  animation: busy-slide 1.15s ease-in-out infinite;
}
@keyframes busy-spin { to { transform: rotate(360deg); } }
@keyframes busy-slide {
  0% { transform: translateX(-130%); }
  100% { transform: translateX(340%); }
}
@media (prefers-reduced-motion: reduce) {
  .busy-mark, .hint.working::before, .note.working::before { animation: busy-pulse 1.6s ease-in-out infinite; }
  .busy-track span { animation: none; width: 100%; opacity: 0.65; }
}
@keyframes busy-pulse { 50% { opacity: 0.35; } }

.rx-grid {
  display: grid;
  grid-template-columns: 3.2em 1fr 1fr;
  gap: 10px 8px;
  align-items: center;
  font-family: "PingFang SC", "Noto Sans SC", sans-serif;
  font-size: 14px;
}
.rx-eye { text-align: center; color: var(--muted); }
.rx-grid select {
  width: 100%;
  appearance: none;
  border: 1px solid var(--line);
  border-radius: 12px;
  background-color: #f7f3ee;
  background-image: linear-gradient(45deg, transparent 50%, #6f675f 50%), linear-gradient(135deg, #6f675f 50%, transparent 50%);
  background-position: calc(100% - 16px) calc(50% - 2px), calc(100% - 11px) calc(50% - 2px);
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
  color: var(--ink);
  font-size: 16px;
  padding: 12px 22px 12px 10px;
}
.rx-slide {
  display: grid;
  grid-template-columns: 4.2em 1fr 3.2em;
  gap: 8px;
  align-items: center;
  font-family: "PingFang SC", "Noto Sans SC", sans-serif;
  font-size: 14px;
}
.rx-slide input[type="range"] { width: 100%; accent-color: var(--accent); }
.rx-slide strong { text-align: right; font-variant-numeric: tabular-nums; font-size: 16px; }
.rx-slide.is-off { display: none; }
#rx-form { display: grid; gap: 12px; }
#rx-form.hidden { display: none; }

@media (max-width: 640px) {
  h1 { font-size: 32px; }
  .studio { width: min(440px, calc(100% - 20px)); padding-top: 16px; }
}
