:root {
  color: #232627;
  background: #f7f6f3;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 15px;
  --ink: #232627;
  --muted: #626665;
  --rule: #e8e5df;
  --surface: #fffefa;
  --accent: #214941;
  --accent-hover: #173a33;
  --radius: 14px;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; min-width: 300px; }
button, input, select { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: default; opacity: .48; }
:focus-visible { outline: 3px solid #3e7567; outline-offset: 3px; }
.topbar { background: var(--surface); border-bottom: 1px solid var(--rule); }
.topbar-content { max-width: 1440px; padding: 13px 34px; margin: auto; display: flex; align-items: center; justify-content: space-between; gap: 14px; min-height: 64px; }
.brand { display: inline-flex; align-items: center; gap: 7px; text-decoration: none; color: var(--ink); font-size: 17px; font-weight: 670; white-space: nowrap; }
.brand > span:last-child { color: var(--muted); font-weight: 460; }
.brand-mark { display: grid; place-items: center; height: 34px; width: 34px; margin-right: 3px; border-radius: 9px; background: #244d43; }
.brand-mark::before { content: ""; width: 18px; height: 12px; border: 1.8px solid #e7dbc4; border-radius: 50%; transform: rotate(-37deg); box-shadow: inset 0 0 0 1px #315b50; }
.page { max-width: 1440px; margin: auto; padding: 34px 34px 30px; }
.intro { margin: 0 0 25px; }
h1 { margin: 0 0 7px; color: #23352f; font-family: Georgia, "Times New Roman", serif; font-weight: 400; font-size: clamp(39px, 5vw, 62px); line-height: 1.06; letter-spacing: -.052em; }
.intro p { margin: 0; color: var(--muted); }
.workspace { display: grid; grid-template-columns: minmax(0, 1fr) minmax(315px, 360px); gap: 18px; align-items: start; }
.surface { background: var(--surface); border: 1px solid var(--rule); border-radius: var(--radius); box-shadow: 0 2px 7px #2d281207; }
.stage { overflow: hidden; }
.stage-header, .stage-footer { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 11px 15px; }
.stage-header { min-height: 57px; }
.model-name { display: flex; flex-direction: column; min-width: 0; gap: 2px; }
#model-name { font-weight: 650; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#model-source { font-size: 12px; color: var(--muted); }
.viewport { position: relative; height: clamp(350px, 62vh, 650px); isolation: isolate; background: radial-gradient(ellipse at 50% 41%, #fbf9f3 0%, #ebe7dd 68%, #e0dbce 100%); }
.viewport[data-backdrop="slate"] { background: radial-gradient(ellipse at 50% 41%, #5d686d, #303a3f 76%); }
.viewport[data-backdrop="white"] { background: #fff; }
.viewport canvas { display: block; position: absolute; inset: 0; width: 100%; height: 100%; touch-action: none; cursor: grab; }
.viewport canvas:active { cursor: grabbing; }
.viewport canvas:focus-visible { outline-offset: -4px; }
.axis { position: absolute; z-index: 1; left: 22px; bottom: 26px; width: 33px; height: 33px; pointer-events: none; opacity: .67; }
.axis i { position: absolute; top: 50%; left: 50%; width: 15px; height: 1.5px; border-radius: 4px; background: #31574a; transform-origin: left center; transform: rotate(-90deg); }
.axis i:nth-child(2) { background: #8d6758; transform: rotate(29deg); }
.axis i:nth-child(3) { background: #657888; transform: rotate(151deg); }
.viewport[data-backdrop="slate"] .axis { filter: brightness(1.8); }
.overlay { z-index: 2; position: absolute; inset: auto 20px 21px 20px; pointer-events: none; width: max-content; max-width: calc(100% - 60px); margin: auto; display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 9px 14px; border-radius: 9px; background: #fffefaef; border: 1px solid #e0ded6; text-align: center; font-size: 13px; box-shadow: 0 2px 5px #262a1512; }
.overlay[data-state="error"] { color: #922f26; border-color: #e5beb1; }
.overlay button { pointer-events: auto; }
progress { color: var(--accent); accent-color: var(--accent); width: min(190px, 100%); height: 9px; }
.stage-footer { border-top: 1px solid var(--rule); flex-wrap: wrap; }
.view-buttons { display: flex; flex-wrap: wrap; gap: 4px; }
.view-buttons button { min-height: 36px; border: 1px solid transparent; border-radius: 7px; padding: 5px 10px; background: transparent; color: #434a46; }
.view-buttons button:hover:enabled { background: #edf1ec; color: #214941; }
.sidebar { display: grid; gap: 12px; min-width: 0; }
.panel { padding: 15px 17px; min-width: 0; }
.panel h2 { font-size: 15px; margin: 0 0 11px; font-weight: 690; }
.panel-heading { display: flex; align-items: start; justify-content: space-between; gap: 7px; }
.classification { display: inline-block; color: #8c5c26; background: #f4ebda; border: 1px solid #ead8bd; border-radius: 5px; padding: 3px 6px; font-size: 10px; font-weight: 740; letter-spacing: .045em; }
.source-tabs { display: flex; border-radius: 7px; background: #f0eee8; padding: 3px; gap: 3px; margin-bottom: 12px; }
.source-tabs button { width: 50%; padding: 6px 3px; min-height: 33px; border: 1px solid transparent; background: transparent; border-radius: 5px; color: #505850; font-weight: 560; }
.source-tabs button[aria-selected="true"] { color: #25473d; background: #fffefa; border-color: #e0ddd3; box-shadow: 0 1px 2px #1e150c0d; }
.button { border: 1px solid var(--rule); border-radius: 7px; padding: 7px 12px; font-weight: 570; min-height: 35px; white-space: nowrap; }
.button.quiet { background: var(--surface); color: #34463f; }
.button.quiet:hover:enabled, .button.quiet[aria-pressed="true"] { background: #edf1ec; border-color: #cddad1; color: #1a4438; }
.button.primary { width: 100%; background: var(--accent); color: #fff; border-color: var(--accent); min-height: 40px; }
.button.primary:hover:enabled { background: var(--accent-hover); }
.hint { margin: 8px 0 0; color: var(--muted); font-size: 12px; line-height: 1.45; }
#published-form { display: grid; gap: 7px; }
#published-form button { margin-top: 4px; }
label { display: block; color: #434b45; font-size: 13px; font-weight: 550; }
input:not([type="range"]), select { border: 1px solid #dcded7; padding: 7px 8px; background-color: #fff; border-radius: 6px; width: 100%; min-height: 35px; color: var(--ink); min-width: 0; }
#version-field { display: grid; gap: 6px; margin-top: 12px; }
.metadata { margin: 0; }
.metadata > div { display: grid; grid-template-columns: minmax(0, 98px) minmax(0, 1fr); gap: 7px; font-size: 12px; align-items: baseline; line-height: 1.42; padding: 4px 0; }
.metadata dt, .stats dt { color: var(--muted); }
.metadata dd { margin: 0; text-align: right; color: var(--ink); overflow-wrap: anywhere; font-weight: 550; min-width: 0; }
#meta-product { font-size: 11px; }
.dimension-section { border-top: 1px solid var(--rule); margin-top: 10px; padding-top: 9px; }
.dimension-section h3 { font-size: 13px; margin: 0; font-weight: 680; }
.dimension-section .metadata > div { grid-template-columns: minmax(0,1fr) minmax(0, .75fr); }
.dimension-section .hint { margin-top: 3px; }
.dimension-section details { margin-top: 6px; }
.dimension-section summary { font-size: 12px; color: #285445; }
summary { font-weight: 640; cursor: pointer; }
.stats { display: flex; margin: 10px 0 0; border-top: 1px solid var(--rule); padding-top: 10px; }
.stats div { flex: 1; padding-inline: 11px; display: grid; gap: 2px; font-size: 12px; }
.stats div:first-child { padding-left: 0; border-right: 1px solid var(--rule); }
.stats dd { margin: 0; font-size: 16px; color: #2c4b40; font-weight: 640; font-variant-numeric: tabular-nums; }
.settings summary { color: #3c4e45; font-size: 13px; }
.settings-fields { display: grid; gap: 6px; padding-top: 11px; }
.settings-fields input[type="range"] { width: 100%; accent-color: var(--accent); margin: 0 0 4px; }
.shortcuts { margin: 10px 2px 0; color: var(--muted); font-size: 12px; line-height: 1.4; }
.shortcuts span { padding-inline: 5px; }
@media (max-width: 970px) {
  .workspace { grid-template-columns: minmax(0,1fr) minmax(285px,315px); gap: 12px; }
  .page { padding-inline: 22px; }
  .topbar-content { padding-inline: 22px; }
}
@media (max-width: 730px) {
  .workspace { grid-template-columns: 1fr; }
  .topbar-content { padding: 9px 14px; min-height: 56px; }
  .page { padding: 21px 13px; }
  .intro { margin-bottom: 17px; }
  .stage-header, .stage-footer { padding: 8px 9px; }
  .viewport { height: clamp(280px, 50vh, 440px); }
  .stage-footer { gap: 5px; }
  .view-buttons { gap: 0; }
  .view-buttons button { min-height: 44px; padding-inline: 8px; }
  .button { min-height: 40px; }
  .overlay { bottom: 13px; }
  .axis { left: 12px; bottom: 18px; }
}
@media (max-width: 390px) {
  .stage-footer { justify-content: flex-start; }
  .view-buttons button { padding-inline: 7px; }
  .intro p { font-size: 14px; }
}

#hand-frame { pointer-events: none; }
#viewport[data-try-on="true"] { background: #262d2b; }
#viewport[data-try-on="true"] .axis { display: none; }
#replay-seek { flex: 1; min-width: 90px; accent-color: var(--accent); }
#replay-panel input[type="file"] { font-size: 12px; }
#replay-panel input[type="checkbox"] { min-height: auto; width: auto; }
#tracking-status { min-height: 1.5em; }
.topbar-content #tryon-toggle { margin-left: auto; }
@media (max-width: 500px) {
  .topbar-content { flex-wrap: wrap; gap: 7px; }
  .topbar-content #tryon-toggle { margin-left: 0; }
}
#viewport[data-try-on="true"] canvas:not(#hand-frame) { z-index: 1; pointer-events: none; }
#replay-source { margin: 0; max-width: min(100%, 160px); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
