:root {
  color-scheme: light;
  --paper: #ffffff;
  --ink: #242828;
  --muted: #747c7b;
  --line: #e7ebea;
  --accent: #9c3d4a;
  --focus: #397565;
  --control: #f2f5f4;
  --ease-out: cubic-bezier(0.23, 1, 0.32, 1);
  font-family: "Inter", "Segoe UI", "Microsoft YaHei", sans-serif;
  font-synthesis: none;
  color: var(--ink);
  background: var(--paper);
  letter-spacing: 0;
}
* { box-sizing: border-box; letter-spacing: 0; }
html { -webkit-tap-highlight-color: transparent; -webkit-text-size-adjust: 100%; }
body { margin: 0; min-width: 320px; }
button, input, a { font: inherit; color: inherit; touch-action: manipulation; }
button { border: 0; background: none; cursor: pointer; user-select: none; -webkit-user-select: none; }
button:disabled { opacity: 0.4; cursor: not-allowed; }
a { text-decoration: none; }
svg { width: 18px; height: 18px; display: block; stroke-width: 1.6; flex-shrink: 0; }
button svg { pointer-events: none; }
[hidden] { display: none !important; }
::selection { color: var(--ink); background: #e0eee8; }
button, a { transition: transform 140ms var(--ease-out), background-color 160ms ease, color 160ms ease; }
button:active:not(:disabled) { transform: scale(0.97); }
button:focus-visible, a:focus-visible, input:focus-visible, [tabindex]:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 4px;
}
[data-input="keyboard"] button { transition: none; }
.masthead {
  min-height: calc(72px + env(safe-area-inset-top, 0px));
  padding: env(safe-area-inset-top, 0px) max(32px, env(safe-area-inset-right, 0px)) 0 max(32px, env(safe-area-inset-left, 0px));
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
  border-bottom: 1px solid var(--line);
}
.wordmark { display: flex; align-items: center; gap: 16px; min-width: 0; }
.wordmark-cn { display: flex; align-items: center; font-size: 23px; font-weight: 650; white-space: nowrap; }
.brand-dot { width: 5px; height: 5px; border-radius: 50%; background: var(--accent); margin-left: 5px; align-self: flex-end; margin-bottom: 7px; }
.wordmark-en { font-size: 10px; font-weight: 500; color: var(--muted); line-height: 1.4; max-width: 90px; }
.header-actions { display: flex; align-items: center; gap: 14px; flex-shrink: 0; }
.icon-button { width: 40px; height: 40px; display: grid; place-items: center; border-radius: 6px; }
.save-button { display: flex; align-items: center; justify-content: center; gap: 8px; min-height: 38px; padding: 0 15px; border-radius: 6px; background: var(--ink); color: white; font-size: 12px; font-weight: 500; }
.icon-button[aria-pressed="true"] { background: #eaf1ee; color: #397565; }
.studio { display: grid; grid-template-columns: minmax(0, 1fr) 320px; min-width: 0; }
.gallery { position: relative; min-width: 0; height: calc(100svh - 114px); min-height: 610px; }
.stage { position: absolute; inset: 38px 20px 86px; cursor: grab; outline-offset: -5px !important; }
.stage canvas { width: 100%; height: 100%; display: block; touch-action: none; }
.stage.dragging { cursor: grabbing; }
.stage.pointer-focused:focus-visible { outline: none; }
.stage-note { position: absolute; inset: 22px 32px auto; display: flex; justify-content: space-between; align-items: center; gap: 12px; font-size: 10px; line-height: 14px; color: var(--muted); pointer-events: none; }
.stage-note > span:first-child { position: absolute; top: calc(100svh - 160px); }
.view-tools { position: absolute; bottom: 22px; left: 50%; transform: translateX(-50%); display: flex; gap: 6px; align-items: center; height: 44px; }
.tool-divider { width: 1px; height: 18px; background: var(--line); margin: 0 6px; }
.face-picker { display: grid; grid-template-columns: repeat(2, 64px); padding: 3px; border-radius: 6px; background: var(--control); }
.face-picker button { min-width: 0; height: 34px; border-radius: 4px; font-size: 12px; color: var(--muted); }
.face-picker button[aria-pressed="true"] { background: #ffffff; color: var(--ink); box-shadow: 0 1px 3px #24282812; }
.artwork-bar { min-width: 0; border-left: 1px solid var(--line); padding: 36px 28px 30px; background: #fafcfa; }
.artwork-title { padding-bottom: 28px; border-bottom: 1px solid var(--line); }
.collection-label { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; font-size: 11px; color: var(--muted); line-height: 18px; }
.collection-dot { width: 5px; height: 5px; border-radius: 50%; background: #4e8a71; flex: 0 0 auto; }
#edition { margin-left: auto; font-variant-numeric: tabular-nums; font-size: 10px; }
#card-title { font-family: "Noto Serif SC", "Songti SC", "SimSun", Georgia, serif; font-size: 30px; font-weight: 500; line-height: 1.35; margin: 22px 0 8px; overflow-wrap: anywhere; }
#subtitle { font-size: 14px; color: #565f5d; line-height: 1.6; margin: 0; overflow-wrap: anywhere; }
.description { color: var(--muted); font-size: 11px; line-height: 1.8; margin: 16px 0 0; overflow-wrap: anywhere; }
.finish-control { padding: 26px 0; border-bottom: 1px solid var(--line); }
.section-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.section-heading h2 { font-size: 12px; font-weight: 600; margin: 0; }
#finish-name { color: var(--muted); font-size: 11px; }
.swatches { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 4px; }
.swatch { width: 100%; min-width: 0; padding: 10px 4px 8px; display: flex; flex-direction: column; gap: 8px; align-items: center; justify-content: center; border-radius: 6px; font-size: 11px; color: var(--muted); }
.swatch[aria-pressed="true"] { background: #eef2ef; color: var(--ink); }
.finish-disc { width: 26px; height: 26px; border-radius: 50%; box-shadow: inset 0 0 0 1px #24282818; flex: 0 0 auto; }
.swatch[aria-pressed="true"] .finish-disc { outline: 1px solid #70867c; outline-offset: 3px; }
.finish-disc.pearl { background: conic-gradient(from 30deg, #e2ebeb, #efe6db, #ecdce6, #dce9eb, #e2ebeb); }
.finish-disc.silver { background: linear-gradient(135deg, #bfc8c5, #ffffff 46%, #bdc7c3); }
.finish-disc.gold { background: linear-gradient(135deg, #a27422, #f0d17b 48%, #ad853b); }
.finish-disc.original { background: #ffffff; }
.range-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 8px; font-size: 12px; margin-top: 20px; min-width: 0; }
.range-row > span { overflow-wrap: anywhere; }
.range-row output { color: var(--muted); font-family: "SFMono-Regular", Consolas, monospace; font-size: 11px; font-variant-numeric: tabular-nums; }
.range-row input { grid-column: 1 / -1; width: 100%; margin: 0; min-width: 0; }
.foil-row { margin-top: 22px; }
input[type="range"] { appearance: none; -webkit-appearance: none; height: 22px; background: transparent; border: 0; cursor: pointer; accent-color: #416f60; }
input[type="range"]::-webkit-slider-runnable-track { height: 3px; border-radius: 2px; background: #dce4df; }
input[type="range"]::-moz-range-track { height: 3px; border-radius: 2px; background: #dce4df; }
input[type="range"]::-webkit-slider-thumb { appearance: none; width: 12px; height: 12px; margin-top: -4.5px; border-radius: 50%; background: white; border: 3px solid #416f60; box-shadow: 0 1px 3px #24403422; }
input[type="range"]::-moz-range-thumb { width: 7px; height: 7px; border-radius: 50%; background: white; border: 3px solid #416f60; }
input[type="range"]:disabled { opacity: 0.45; cursor: not-allowed; }
.depth-section { padding-top: 16px; }
.depth-toggle { display: flex; align-items: center; width: 100%; min-height: 38px; gap: 9px; font-size: 12px; font-weight: 600; border-radius: 4px; text-align: left; padding: 0; }
.depth-toggle svg { width: 16px; height: 16px; color: #6b7770; }
.disclosure-mark { width: 6px; height: 6px; border-right: 1.5px solid #7a847f; border-bottom: 1.5px solid #7a847f; transform: rotate(45deg); margin: 0 4px 4px auto; }
.depth-toggle[aria-expanded="false"] .disclosure-mark { transform: rotate(-45deg); margin-bottom: 0; }
.parameter-panel { padding: 0 0 8px; }
.parameter-panel .range-row:first-child { margin-top: 14px; }
.footer { display: flex; align-items: center; justify-content: flex-end; padding: 0 32px env(safe-area-inset-bottom, 0px); min-height: 42px; font-size: 9px; color: #8b9390; border-top: 1px solid var(--line); }
.loading { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 18px; padding: 24px; color: var(--muted); font-size: 12px; text-align: center; white-space: pre-line; }
.loading-line { width: 40px; height: 2px; background: #416f60; animation: loading 1s linear infinite; }
.loading.error { color: var(--accent); }
.loading.error button { color: var(--ink); border-bottom: 1px solid var(--line); padding: 8px; }
@keyframes loading { 50% { opacity: 0.35; transform: scaleX(0.6); } }
.notice { position: fixed; left: 50%; bottom: max(22px, env(safe-area-inset-bottom, 0px)); transform: translateX(-50%); z-index: 30; max-width: calc(100% - 32px); border-radius: 6px; padding: 12px 18px; background: var(--ink); color: white; font-size: 12px; line-height: 1.5; text-align: center; }
.tooltip { position: fixed; z-index: 40; pointer-events: none; padding: 7px 10px; border-radius: 4px; background: var(--ink); color: white; font-size: 11px; line-height: 16px; max-width: calc(100vw - 16px); }
dialog { margin: auto; width: 400px; max-width: calc(100% - 32px); max-height: calc(100svh - 32px); overflow: auto; border: 1px solid var(--line); border-radius: 8px; padding: 32px; color: var(--ink); background: white; box-shadow: 0 12px 40px #24282818; }
dialog::backdrop { background: #24282836; }
.modal-close { position: absolute; top: 12px; right: 12px; }
.dialog-mark { font-size: 16px; font-weight: 600; margin: 0 0 28px; }
dialog h2 { font-size: 24px; line-height: 1.4; font-weight: 500; overflow-wrap: anywhere; margin: 0 0 16px; }
dialog > p:not(.dialog-mark) { font-size: 13px; color: var(--muted); line-height: 1.8; }
dialog dl { padding-top: 16px; margin: 24px 0 0; border-top: 1px solid var(--line); }
dialog dl > div { display: grid; grid-template-columns: 40px minmax(0, 1fr); gap: 20px; margin-top: 14px; font-size: 12px; }
dialog dt { color: var(--muted); }
dialog dd { margin: 0; text-align: right; overflow-wrap: anywhere; }
.fallback3d { position: absolute; inset: 20px 0; display: flex; align-items: center; justify-content: center; perspective: 1100px; }
.flipper3d { width: min(64%, 400px); aspect-ratio: 2 / 3; transform-style: preserve-3d; }
.card3d { width: 100%; height: 100%; position: relative; transform-style: preserve-3d; }
.face3d { position: absolute; inset: 0; backface-visibility: hidden; transform-style: preserve-3d; border-radius: 8px; }
.front3d { background: white; }
.back3d { transform: rotateY(180deg); display: grid; place-items: center; background: #e5ece8; color: #416052; }
.back-mark { font-size: 32px; font-weight: 500; }
.layer3d { position: absolute; inset: 0; pointer-events: none; }
.layer3d img { width: 100%; height: 100%; object-fit: contain; display: block; }
.foil3d { position: absolute; inset: 0; border-radius: 8px; pointer-events: none; mix-blend-mode: screen; opacity: calc(var(--foil-amount, 0.6) * 0.26); background: linear-gradient(110deg, transparent 25%, #b0d4d2 42%, #e3c69a 54%, transparent 68%); background-position: var(--mx, 50%) var(--my, 50%); }
.finish-original .foil3d { opacity: 0; }
.finish-silver .foil3d { filter: grayscale(1); }
.finish-gold .foil3d { filter: sepia(0.8); }
@media (hover: hover) and (pointer: fine) {
  .icon-button:hover:not(:disabled), .face-picker button:hover:not(:disabled), .swatch:hover:not(:disabled) { background-color: #edf2ef; }
  .save-button:hover:not(:disabled) { background-color: #3b4540; }
  .depth-toggle:hover { color: #397565; }
}
@media (max-width: 1000px) and (min-width: 761px) {
  .studio { grid-template-columns: minmax(0, 1fr) 292px; }
  .artwork-bar { padding-left: 24px; padding-right: 24px; }
  .stage { inset-inline: 8px; }
  .stage-note > span:first-child { top: auto; bottom: -30px; }
}
@media (max-width: 760px) {
  .masthead { min-height: calc(68px + env(safe-area-inset-top, 0px)); padding-left: max(20px, env(safe-area-inset-left, 0px)); padding-right: max(20px, env(safe-area-inset-right, 0px)); gap: 12px; }
  .wordmark { gap: 10px; }
  .wordmark-cn { font-size: 20px; }
  .wordmark-en { font-size: 9px; max-width: 76px; }
  .header-actions { gap: 6px; }
  .save-button { width: 40px; height: 40px; padding: 0; }
  .save-button > span { display: none; }
  .studio { display: block; }
  .gallery { height: min(620px, calc(100svh - 228px)); min-height: 440px; }
  .stage { inset: 14px 16px 84px; }
  .stage-note { inset: auto 24px 72px; font-size: 9px; }
  .stage-note > span:first-child { position: static; }
  .view-tools { bottom: 14px; }
  .artwork-bar { padding: 26px 24px 28px; border-left: 0; border-top: 1px solid var(--line); }
  .artwork-title { padding-bottom: 24px; }
  #card-title { font-size: 28px; margin-top: 16px; }
  .description { margin-top: 10px; }
  .finish-control { padding-top: 24px; }
  .swatches { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
  .swatch { padding: 12px 4px; }
  .finish-disc { width: 30px; height: 30px; }
  .range-row { font-size: 13px; }
  .parameter-panel { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 0 24px; }
  .parameter-panel .range-row { margin-top: 20px; }
  .footer { padding-right: 24px; padding-left: 24px; min-height: 50px; }
}
@media (max-width: 360px) {
  .masthead { padding-right: 16px; padding-left: 16px; }
  .wordmark-en { font-size: 8px; max-width: 67px; }
  .header-actions { gap: 2px; }
  .parameter-panel { column-gap: 18px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}
