@charset "UTF-8";

:root {
  color-scheme: light;
  --paper: #f4efe7;
  --ink: #594334;
  --muted: #9a8879;
  --accent: #855739;
  --line: #c9b7a346;
  font-family: Arial, "PingFang SC", "Microsoft YaHei", sans-serif;
  color: var(--ink);
  background: var(--paper);
  font-synthesis: none;
  text-rendering: optimizeLegibility;
}

* { box-sizing: border-box; }
html, body { margin: 0; width: 100%; height: 100%; overflow: hidden; }
button, a { -webkit-tap-highlight-color: transparent; }
button { font: inherit; color: inherit; cursor: pointer; }
a { color: inherit; text-decoration: none; }
button { -webkit-appearance: none; appearance: none; }
button:disabled { opacity: .32; cursor: default; }
button:focus-visible, a:focus-visible { outline: 2px solid var(--accent); outline-offset: 4px; }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }

.model-panel {
  position: relative;
  width: 100%;
  height: 100vh;
  height: 100dvh;
  isolation: isolate;
  background: radial-gradient(ellipse at 50% 40%, #fcf8f1 0%, #f0e8dd 65%, #e9dfd1 100%);
  overflow: hidden;
}
.viewport { position: absolute; inset: 66px 0 164px; touch-action: none; cursor: grab; }
.viewport:active { cursor: grabbing; }
.viewport:focus-visible { outline: 1px solid #9f7a5b55; outline-offset: -7px; border-radius: 18px; }
.viewport canvas { display: block; width: 100%; height: 100%; }
.toolbar {
  position: absolute;
  top: max(18px, env(safe-area-inset-top));
  right: max(26px, env(safe-area-inset-right));
  left: max(28px, env(safe-area-inset-left));
  height: 40px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  z-index: 5;
  pointer-events: none;
}
.toolbar > * { pointer-events: auto; }
.brand { font-size: 20px; font-weight: 800; letter-spacing: -.9px; }
.brand span { font-weight: 400; }
.brand b { font-size: 25px; color: var(--accent); }
.toolbar-actions { display: flex; align-items: center; gap: 5px; }
.icon-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 40px;
  height: 40px;
  padding: 10px;
  border: 1px solid transparent;
  border-radius: 50%;
  background: transparent;
  color: #88705c;
  transition: background .18s ease, color .18s ease;
}
svg { width: 100%; height: 100%; fill: none; stroke: currentColor; stroke-width: 1.55; stroke-linecap: round; stroke-linejoin: round; }
.icon-button:hover:enabled, a.icon-button:not(.disabled):hover { background: #d4c2ae45; color: #684832; }
.icon-button.disabled { pointer-events: none; opacity: .32; }
.zoom-tools {
  position: absolute;
  top: 45%;
  right: max(25px, env(safe-area-inset-right));
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 2;
}
.zoom-tools .icon-button { border-color: var(--line); background: #fbf6ed85; backdrop-filter: blur(12px); }

.controls-dock {
  position: absolute;
  bottom: max(22px, env(safe-area-inset-bottom));
  left: 50%;
  transform: translateX(-50%);
  width: max-content;
  max-width: calc(100% - 36px);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  z-index: 3;
}
.expression-selector {
  display: flex;
  gap: 4px;
  align-items: center;
  padding: 7px;
  background: #fcf9f2da;
  border: 1px solid #fffaf0;
  border-radius: 24px;
  box-shadow: 0 9px 34px #7350320d, 0 1px 2px #73503205;
  backdrop-filter: blur(20px);
}
.expression-button {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  width: 74px;
  height: 68px;
  border: 1px solid transparent;
  border-radius: 18px;
  background: transparent;
  color: #856b54;
  transition: background .22s ease, color .22s ease, border-color .22s ease, transform .22s ease;
}
.expression-button svg { width: 26px; height: 26px; stroke-width: 1.35; }
.expression-button span { font-size: 11px; line-height: 1; letter-spacing: .8px; }
.expression-button:hover:enabled { color: var(--accent); background: #eadbcb64; }
.expression-button:active:enabled { transform: scale(.96); }
.expression-button[aria-pressed="true"] { background: #e9d9c7; color: #785133; border-color: #d9c1a855; }
.view-controls { display: flex; align-items: center; gap: 10px; min-height: 34px; }
.motion-button { width: 33px; height: 33px; padding: 8px; margin-right: 3px; }
.motion-button svg { stroke-width: 1.8; }
.motion-button .pause-icon { display: none; }
.motion-button[aria-pressed="true"] .pause-icon { display: block; }
.motion-button[aria-pressed="true"] .play-icon { display: none; }
.motion-button[aria-pressed="false"] { background: #e1d1be66; }
.segmented-control, .view-selector { display: flex; align-items: center; gap: 3px; }
.segmented-control { padding: 3px; background: #d6c4ae40; border-radius: 9px; }
.segmented-control button, .view-selector button {
  min-width: 49px;
  height: 29px;
  padding: 6px 12px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: #856b54;
  font-size: 10px;
  letter-spacing: .4px;
  transition: background .2s ease, color .2s ease;
}
.segmented-control button[aria-pressed="true"] { background: #fcf8ef; box-shadow: 0 1px 3px #7654370a; color: #745035; }
.view-selector button[aria-pressed="true"] { background: #d9c5ae5c; color: #745035; }
.segmented-control button:hover:enabled, .view-selector button:hover:enabled { color: #745035; }
.control-divider { width: 1px; height: 16px; background: #c1a78950; }

.loading-screen {
  position: absolute;
  inset: 64px 0 164px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  padding: 24px;
  z-index: 4;
  text-align: center;
  background: #f4eee4;
}
.loading-screen.finished { display: none; }
.loading-spinner { display: block; width: 25px; height: 25px; border: 1.5px solid #c4ad9655; border-top-color: #99795a; border-radius: 50%; animation: spin 1s linear infinite; }
.loading-screen p { margin: 17px 0 7px; font-size: 12px; font-weight: 400; letter-spacing: 1px; }
#loading-detail { max-width: 310px; color: #a18c77; font-size: 10px; line-height: 1.8; }
#loading-detail:empty { display: none; }
.progress-track { margin-top: 17px; width: 120px; height: 2px; border-radius: 2px; overflow: hidden; background: #d5c3b055; }
#loading-progress { height: 100%; width: 0; background: #a38060; transition: width .25s linear; }
.retry-button { margin-top: 17px; padding: 8px 14px; border: 1px solid #c9b399; border-radius: 8px; background: transparent; font-size: 11px; }
@keyframes spin { to { transform: rotate(360deg); } }

dialog { width: min(1080px, 94vw); max-height: 92dvh; padding: 15px 20px 20px; background: var(--paper); border: 1px solid #fdf7ed; border-radius: 18px; color: var(--ink); box-shadow: 0 25px 100px #33231733; }
dialog::backdrop { background: #44352599; backdrop-filter: blur(7px); }
.dialog-heading { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.dialog-heading h2 { margin: 0; font-size: 13px; font-weight: 400; letter-spacing: .8px; }
dialog > img { display: block; width: 100%; height: auto; border-radius: 7px; }
.model-panel:fullscreen { height: 100dvh; }

@media (min-width: 1600px) {
  .toolbar { top: 25px; left: 36px; right: 36px; }
  .viewport, .loading-screen { top: 75px; bottom: 182px; }
  .controls-dock { bottom: 30px; gap: 17px; }
  .expression-button { width: 82px; height: 73px; }
}

@media (max-width: 640px) {
  .toolbar { top: max(12px, env(safe-area-inset-top)); left: 18px; right: 12px; }
  .brand { font-size: 18px; }
  .brand b { font-size: 22px; }
  .toolbar-actions { gap: 1px; }
  .toolbar-actions .icon-button { width: 35px; height: 37px; padding: 9px; }
  .viewport, .loading-screen { inset: 64px 0 160px; }
  .zoom-tools { right: 12px; top: 42%; gap: 6px; }
  .zoom-tools .icon-button { width: 34px; height: 34px; padding: 9px; }
  .controls-dock { bottom: max(16px, env(safe-area-inset-bottom)); max-width: calc(100% - 20px); width: 430px; gap: 11px; }
  .expression-selector { width: 100%; gap: 2px; padding: 5px; border-radius: 20px; }
  .expression-button { width: auto; min-width: 0; flex: 1 1 0; height: 65px; gap: 7px; border-radius: 15px; }
  .expression-button svg { width: 24px; height: 24px; }
  .expression-button span { font-size: 10px; letter-spacing: .2px; }
  .view-controls { gap: 7px; }
  .motion-button { margin-right: 0; }
  .segmented-control button, .view-selector button { min-width: 43px; padding: 6px 9px; }
  dialog { padding: 10px 12px 12px; border-radius: 13px; }
}

@media (max-width: 360px) {
  .toolbar { left: 13px; right: 7px; }
  .toolbar-actions .icon-button { width: 32px; }
  .controls-dock { max-width: calc(100% - 14px); }
  .expression-selector { padding: 4px; gap: 0; }
  .expression-button { height: 60px; }
  .expression-button svg { width: 22px; height: 22px; }
  .view-controls { gap: 5px; }
  .segmented-control button, .view-selector button { min-width: 40px; padding: 6px 8px; }
}

@media (max-height: 560px) and (orientation: landscape) {
  .toolbar { top: 10px; }
  .viewport, .loading-screen { inset: 52px 0 109px; }
  .controls-dock { bottom: 8px; gap: 6px; }
  .expression-selector { padding: 4px; border-radius: 17px; }
  .expression-button { width: 62px; height: 51px; gap: 3px; border-radius: 12px; }
  .expression-button svg { width: 21px; height: 21px; }
  .expression-button span { font-size: 9px; }
  .view-controls { min-height: 28px; }
  .segmented-control { padding: 1px; }
  .motion-button { width: 28px; height: 28px; padding: 7px; }
  .segmented-control button, .view-selector button { height: 26px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; scroll-behavior: auto !important; }
  .loading-spinner { animation-duration: 2.5s; }
}
