/* 试衣镜 kiosk
   Palette: smoked-mirror pine, fitting-room filament tubes, chalk, mist
   Type: system Heiti / PingFang for wordmark and UI (no web fonts)
*/
:root {
  --pine: #1a211e;
  --smoke: #0b0d0c;
  --filament: #ffd19a;
  --filament-hot: #fff3d2;
  --chalk: #e6ece8;
  --mist: #9aa59e;
  --rose: #f0b4a8;
  --panel: rgba(11, 13, 12, 0.78);
  --touch: 72px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  height: 100dvh;
  background: var(--smoke);
  color: var(--chalk);
  font-family: "PingFang SC", "Hiragino Sans GB", "Noto Sans SC", "Heiti SC", "Microsoft YaHei", sans-serif;
  overflow: hidden;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
  -webkit-tap-highlight-color: transparent;
  cursor: default;
}

.mirror {
  position: relative;
  height: 100%;
  background: var(--smoke);
}

/* Fitting-room light bars — the physical cue of a changing room */
.tube {
  position: absolute;
  top: 6%;
  bottom: 6%;
  width: 9px;
  z-index: 15;
  pointer-events: none;
  border-radius: 999px;
  background: linear-gradient(
    to bottom,
    transparent 0%,
    var(--filament-hot) 10%,
    var(--filament) 50%,
    var(--filament-hot) 90%,
    transparent 100%
  );
  box-shadow:
    0 0 18px 5px color-mix(in srgb, var(--filament) 65%, transparent),
    0 0 48px 12px color-mix(in srgb, var(--filament) 30%, transparent);
  opacity: 1;
}
.tube-l { left: max(10px, env(safe-area-inset-left)); }
.tube-r { right: max(10px, env(safe-area-inset-right)); }

.stage {
  position: absolute;
  inset: 0;
  overflow: hidden;
  background: #070807;
}
.stage video {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}
.stage canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
}

.hint {
  position: absolute;
  left: 50%;
  bottom: 340px;
  transform: translateX(-50%);
  margin: 0;
  padding: 14px 28px;
  z-index: 5;
  color: var(--chalk);
  background: var(--panel);
  font-size: 22px;
  letter-spacing: 0.02em;
  white-space: nowrap;
  border-left: 3px solid var(--filament);
  pointer-events: none;
}

.wordmark {
  font-weight: 600;
  font-size: 28px;
  line-height: 1;
  color: var(--chalk);
}
.wordmark.lg { font-size: 56px; }

.top {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  z-index: 7;
  display: flex;
  align-items: center;
  gap: 24px;
  padding: calc(18px + env(safe-area-inset-top)) 48px 16px;
  background: linear-gradient(to bottom, rgba(11, 13, 12, 0.72), transparent);
  pointer-events: none;
}
.top > * { pointer-events: auto; }
.top .now {
  flex: 1;
  margin: 0;
  font-size: 20px;
  color: var(--mist);
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.btn {
  appearance: none;
  border: 0;
  background: color-mix(in srgb, var(--chalk) 12%, transparent);
  color: var(--chalk);
  font: inherit;
  font-size: 22px;
  font-weight: 600;
  min-height: var(--touch);
  padding: 0 28px;
  cursor: pointer;
  touch-action: manipulation;
}
.btn:focus-visible { outline: 2px solid var(--filament); outline-offset: 3px; }
.btn:disabled { opacity: 1; cursor: default; background: color-mix(in srgb, var(--chalk) 58%, var(--pine)); color: var(--pine); }
.btn.shot {
  background: var(--chalk);
  color: var(--pine);
  min-width: 148px;
}
.btn.start {
  background: var(--chalk);
  color: var(--pine);
  min-width: min(360px, 80vw);
  min-height: 84px;
  font-size: 30px;
  padding: 0 48px;
}
.btn.ghost {
  background: transparent;
  color: var(--chalk);
  box-shadow: inset 0 0 0 1.5px color-mix(in srgb, var(--chalk) 45%, transparent);
}

.dock {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 7;
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 20px 36px calc(18px + env(safe-area-inset-bottom));
  background: linear-gradient(to top, rgba(11, 13, 12, 0.92) 55%, rgba(11, 13, 12, 0.55) 82%, transparent);
}

.cats {
  display: flex;
  gap: 10px;
  justify-content: center;
  flex-wrap: wrap;
}
.cat {
  appearance: none;
  border: 0;
  background: color-mix(in srgb, var(--chalk) 10%, transparent);
  color: var(--mist);
  font: inherit;
  font-size: 20px;
  font-weight: 600;
  min-height: 56px;
  padding: 0 26px;
  cursor: pointer;
  touch-action: manipulation;
}
.cat[aria-pressed="true"] {
  background: var(--chalk);
  color: var(--pine);
}
.cat:focus-visible { outline: 2px solid var(--filament); outline-offset: 3px; }

.rail {
  display: flex;
  align-items: stretch;
  justify-content: center;
  gap: 18px;
  overflow-x: auto;
  overflow-y: hidden;
  padding: 8px 4px 4px;
  scrollbar-width: thin;
  scrollbar-color: var(--mist) transparent;
  -webkit-overflow-scrolling: touch;
}
.item {
  position: relative;
  flex: 0 0 auto;
  width: 118px;
  min-height: 132px;
  border: 0;
  padding: 10px;
  background: color-mix(in srgb, var(--chalk) 8%, transparent);
  cursor: pointer;
  color: inherit;
  touch-action: manipulation;
}
.item img {
  display: block;
  width: 100%;
  height: 108px;
  object-fit: contain;
  pointer-events: none;
}
.item .item-name {
  display: block;
  margin-top: 6px;
  font-size: 16px;
  color: var(--mist);
  text-align: center;
  line-height: 1.3;
}
.item.selected {
  background: color-mix(in srgb, var(--filament) 18%, transparent);
  box-shadow: inset 0 0 0 2px var(--filament);
}
.item.selected .item-name { color: var(--filament-hot); }
.item:focus-visible { outline: 2px solid var(--filament); outline-offset: 3px; }

.tools {
  display: flex;
  align-items: center;
  justify-content: center;
}
.size {
  display: flex;
  align-items: center;
  gap: 16px;
  color: var(--mist);
}
.size-label { font-size: 20px; font-weight: 600; color: var(--chalk); }
.size-btn {
  appearance: none;
  width: var(--touch);
  height: var(--touch);
  border: 0;
  background: color-mix(in srgb, var(--chalk) 12%, transparent);
  color: var(--chalk);
  font: inherit;
  font-size: 36px;
  line-height: 1;
  cursor: pointer;
  touch-action: manipulation;
}
.size-btn:focus-visible { outline: 2px solid var(--filament); outline-offset: 3px; }
.size-btn:active { background: color-mix(in srgb, var(--filament) 28%, transparent); }
.size input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  width: min(280px, 30vw);
  height: 8px;
  background: color-mix(in srgb, var(--filament) 55%, var(--pine));
  outline: none;
  border-radius: 0;
}
.size input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 36px;
  height: 36px;
  border: 0;
  background: var(--chalk);
  cursor: pointer;
}
.size input[type="range"]::-moz-range-thumb {
  width: 36px;
  height: 36px;
  border: 0;
  background: var(--chalk);
  cursor: pointer;
}

.gate {
  position: absolute;
  inset: 0;
  z-index: 10;
  display: flex;
  align-items: stretch;
  justify-content: center;
  background:
    radial-gradient(ellipse at 50% 42%, #1e2824 0%, var(--smoke) 68%);
  padding: 0;
}
.gate[hidden],
.top[hidden],
.dock[hidden],
.snapshot[hidden] { display: none; }

.gate-inner {
  width: min(560px, calc(100% - 72px));
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: calc(8vh + env(safe-area-inset-top)) 0 calc(8vh + env(safe-area-inset-bottom));
}
.gate-inner .wordmark.lg { margin-top: 2vh; }
.stance {
  margin: auto auto 8px;
  width: 112px;
  color: color-mix(in srgb, var(--chalk) 80%, var(--filament));
}
.stance-svg { display: block; width: 100%; height: auto; }
.lead {
  margin: 18px 0 32px;
  color: var(--chalk);
  line-height: 1.6;
  font-size: 22px;
}
.fine {
  margin: 22px 0 0;
  color: var(--mist);
  font-size: 15px;
  line-height: 1.5;
}
.note {
  margin: 16px 0 0;
  font-size: 16px;
  line-height: 1.5;
  color: var(--rose);
}
.note[hidden] { display: none; }

.snapshot {
  position: absolute;
  inset: 0;
  z-index: 20;
  background: var(--smoke);
  display: flex;
  flex-direction: column;
}
.snapshot img {
  flex: 1;
  width: 100%;
  height: 0;
  object-fit: contain;
  background: #000;
}
.snapshot-panel {
  flex: 0 0 auto;
  padding: 18px 28px calc(20px + env(safe-area-inset-bottom));
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  background: var(--pine);
}
.snapshot-panel p {
  margin: 0;
  font-size: 24px;
  font-weight: 600;
}
.snapshot-actions { display: flex; gap: 12px; flex-wrap: wrap; }
.snapshot .btn.start,
.snapshot .btn.ghost {
  min-width: 0;
  min-height: var(--touch);
  font-size: 22px;
  padding: 0 28px;
}

/* Portrait kiosk: keep dock at the bottom, generous targets */
@media (orientation: portrait) {
  .wordmark.lg { font-size: 64px; }
  .item { width: 126px; }
}

/* Landscape / wide display: closet rail on the right */
@media (orientation: landscape) and (min-width: 900px) {
  .top {
    right: calc(min(280px, 26vw) + 36px);
    padding-right: 24px;
  }
  .hint {
    left: calc((100% - min(280px, 26vw) - 22px) / 2);
    bottom: 10%;
  }
  .dock {
    left: auto;
    right: 22px;
    top: 0;
    bottom: 0;
    width: min(280px, 26vw);
    padding: calc(20px + env(safe-area-inset-top)) 8px calc(16px + env(safe-area-inset-bottom)) 16px;
    background: linear-gradient(to left, rgba(11, 13, 12, 0.94) 72%, rgba(11, 13, 12, 0.55) 90%, transparent);
    justify-content: flex-start;
  }
  .cats {
    flex-direction: column;
    align-items: stretch;
    flex-wrap: nowrap;
  }
  .cat { width: 100%; min-height: 52px; }
  .rail {
    flex-direction: column;
    align-items: center;
    overflow-x: hidden;
    overflow-y: auto;
    flex: 1;
    justify-content: flex-start;
  }
  .item { width: 140px; }
  .tools { padding-top: 8px; width: 100%; }
  .size {
    width: 100%;
    display: grid;
    grid-template-columns: var(--touch) 1fr var(--touch);
    grid-template-rows: auto auto;
    justify-items: center;
    align-items: center;
    gap: 10px 8px;
  }
  .size-label { grid-column: 1 / -1; }
  .size input[type="range"] { width: 100%; }
}

@media (max-height: 700px) and (orientation: landscape) {
  .stance { width: 72px; margin: 8px auto; }
  .wordmark.lg { font-size: 40px; }
  .lead { font-size: 18px; margin: 10px 0 18px; }
  .btn.start { min-height: 64px; font-size: 24px; }
}

@media (max-width: 800px), (orientation: portrait) {
  .snapshot-panel {
    flex-direction: column;
    align-items: stretch;
    text-align: center;
  }
  .snapshot-actions { justify-content: center; }
  .snapshot .btn.start, .snapshot .btn.ghost { flex: 1; }
}
