:root {
  --bg: #f3f5f8;
  --panel: #ffffff;
  --panel-soft: #f5f6f8;
  --line: #e4e7ec;
  --line-strong: #d8dde6;
  --text: #101828;
  --muted: #667085;
  --muted-2: #98a2b3;
  --blue: #2475f5;
  --blue-2: #1265e8;
  --blue-soft: #edf4ff;
  --shadow: 0 14px 40px rgba(16, 24, 40, 0.055);
  --sidebar-width: 326px;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; background: var(--bg); color: var(--text); font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif; }
body { min-width: 320px; }
button, input { font: inherit; }
button { -webkit-tap-highlight-color: transparent; }
svg { display: block; }

.app-shell { min-height: 100vh; display: grid; grid-template-columns: var(--sidebar-width) minmax(0, 1fr); }
.sidebar { position: sticky; top: 0; height: 100vh; padding: 27px 22px 22px; background: rgba(255,255,255,.97); border-right: 1px solid var(--line); display: flex; flex-direction: column; z-index: 20; }
.brand-row { display: flex; align-items: center; gap: 12px; padding: 3px 6px 23px; }
.brand-mark { width: 38px; height: 38px; color: #172033; flex: 0 0 auto; }
.brand-mark svg { width: 100%; height: 100%; }
.brand-name { font-size: 12px; line-height: 1.2; color: var(--blue); font-weight: 800; text-transform: uppercase; letter-spacing: .14em; margin-bottom: 3px; }
.brand-title { font-size: 18px; font-weight: 760; letter-spacing: -.025em; white-space: nowrap; }

.search-box { height: 46px; display: flex; align-items: center; gap: 10px; padding: 0 14px; background: #fff; border: 1px solid var(--line-strong); border-radius: 11px; transition: border-color .2s, box-shadow .2s; }
.search-box:focus-within { border-color: #a8c7ff; box-shadow: 0 0 0 4px rgba(36,117,245,.08); }
.search-box svg { width: 20px; height: 20px; fill: none; stroke: var(--muted); stroke-width: 1.8; stroke-linecap: round; }
.search-box input { width: 100%; border: 0; outline: 0; color: var(--text); background: transparent; font-size: 14px; }
.search-box input::placeholder { color: var(--muted-2); }
.sidebar-section-title { margin: 26px 8px 10px; color: var(--muted); font-size: 11px; font-weight: 800; letter-spacing: .12em; }
.model-list { display: flex; flex-direction: column; gap: 6px; overflow: auto; padding: 0 1px 10px; scrollbar-width: thin; scrollbar-color: #dce2ea transparent; }
.model-item { width: 100%; min-height: 80px; position: relative; display: grid; grid-template-columns: 56px minmax(0,1fr); align-items: center; gap: 12px; border: 0; border-radius: 14px; background: transparent; color: var(--text); text-align: left; padding: 10px 12px; cursor: pointer; transition: background .18s ease, transform .18s ease, box-shadow .18s ease; }
.model-item:hover { background: #f5f7fa; }
.model-item:active { transform: scale(.995); }
.model-item.active { background: linear-gradient(90deg, #edf4ff 0%, #f3f7ff 100%); box-shadow: inset 0 0 0 1px #d8e7ff; }
.model-item.active::before { content: ""; position: absolute; left: 0; top: 10px; bottom: 10px; width: 3px; border-radius: 999px; background: var(--blue); }
.model-thumb { width: 52px; height: 52px; border: 1px solid #d7dee8; border-radius: 12px; background: #202832; display: grid; place-items: center; color: #667085; overflow: hidden; box-shadow: inset 0 0 0 1px rgba(255,255,255,.08); }
.model-thumb svg { width: 23px; height: 23px; fill: none; stroke: currentColor; stroke-width: 1.5; }
.model-thumb img { display: block; width: 100%; height: 100%; object-fit: cover; border-radius: 11px; }
.model-thumb.is-fallback { background: linear-gradient(145deg,#fafbfc,#eef1f5); }
.model-item.active .model-thumb { background: #fff; color: var(--blue); border-color: #d5e4ff; box-shadow: 0 8px 18px rgba(36,117,245,.09); }
.model-name { font-size: 14px; font-weight: 720; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.model-item.active .model-name { color: var(--blue-2); }
.model-subtitle { margin-top: 4px; font-size: 12px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.empty-list { padding: 26px 14px; color: var(--muted); font-size: 13px; text-align: center; }
.sidebar-footer { margin-top: auto; min-height: 66px; border: 1px solid var(--line); border-radius: 12px; display: flex; align-items: center; gap: 11px; padding: 12px; background: #fff; }
.footer-icon { width: 36px; height: 36px; display: grid; place-items: center; border-radius: 50%; background: var(--blue-soft); color: var(--blue); }
.footer-icon svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.footer-title { font-size: 12px; font-weight: 700; }
.footer-sub { font-size: 11px; color: var(--muted); margin-top: 2px; }

.main-content { min-width: 0; padding: 34px clamp(26px, 4vw, 64px) 30px; }
.mobile-topbar { display: none; }
.page-header { max-width: 1320px; margin: 0 auto 22px; display: flex; align-items: flex-end; justify-content: space-between; gap: 18px; }
.eyebrow { color: var(--blue); font-size: 10px; font-weight: 800; letter-spacing: .14em; margin-bottom: 7px; }
.page-header h1 { margin: 0; font-size: clamp(30px, 3vw, 40px); line-height: 1.05; letter-spacing: -.045em; }
.page-header p { margin: 8px 0 0; font-size: 14px; color: var(--muted); }
.header-actions { display: flex; align-items: center; justify-content: flex-end; gap: 20px; }
.language-switcher { display: inline-flex; align-items: center; gap: 3px; padding: 3px; border: 1px solid var(--line); border-radius: 999px; background: rgba(255,255,255,.85); box-shadow: 0 3px 10px rgba(16,24,40,.04); }
.language-button { min-width: 48px; height: 30px; padding: 0 10px; border: 0; border-radius: 999px; background: transparent; color: var(--muted); font-size: 12px; font-weight: 700; cursor: pointer; transition: background .18s ease, color .18s ease, box-shadow .18s ease; }
.language-button:hover { color: var(--blue-2); }
.language-button[aria-pressed="true"] { background: var(--blue); color: #fff; box-shadow: 0 3px 8px rgba(36,117,245,.22); }
.language-divider { color: var(--line-strong); font-size: 12px; user-select: none; }
.theme-switcher { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.theme-switcher-label { font-size: 12px; font-weight: 700; color: var(--muted); }
.theme-switcher-buttons { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.theme-chip { height: 38px; border-radius: 999px; border: 1px solid var(--line); background: rgba(255,255,255,.85); padding: 0 12px; display: inline-flex; align-items: center; gap: 8px; color: #344054; cursor: pointer; transition: border-color .18s ease, box-shadow .18s ease, transform .18s ease; }
.theme-chip:hover { border-color: #c7d7f6; }
.theme-chip[aria-pressed="true"] { border-color: #bfd5ff; box-shadow: 0 0 0 4px rgba(36,117,245,.08); color: var(--blue-2); }
.theme-swatch { width: 16px; height: 16px; border-radius: 50%; border: 1px solid rgba(255,255,255,.65); box-shadow: inset 0 0 0 1px rgba(16,24,40,.06); }
.theme-swatch.is-graphite { background: linear-gradient(135deg,#1d2430,#4d5563); }
.theme-swatch.is-stone { background: linear-gradient(135deg,#eef2f6,#ced5de); }
.theme-swatch.is-sky { background: linear-gradient(135deg,#dcecff,#8fb8ff); }

.viewer-card { position: relative; max-width: 1320px; height: clamp(510px, 62vh, 720px); min-height: 470px; margin: 0 auto; overflow: hidden; border: 1px solid var(--line-strong); border-radius: 19px; box-shadow: var(--shadow); transition: background .2s ease; }
.viewer-card.bg-graphite { background: radial-gradient(circle at 50% 38%, #495363 0%, #2a303a 34%, #1f242c 64%, #171b21 100%); }
.viewer-card.bg-stone { background: radial-gradient(circle at 50% 39%, #ffffff 0%, #f2f4f7 56%, #e6eaef 100%); }
.viewer-card.bg-sky { background: radial-gradient(circle at 50% 35%, #f8fbff 0%, #dfeefe 50%, #bfd9fb 75%, #accffc 100%); }
model-viewer { width: 100%; height: 100%; --poster-color: transparent; --progress-bar-color: var(--blue); outline: none; }
.progress-wrap { position: absolute; left: 0; right: 0; top: 0; height: 3px; background: transparent; }
.progress-bar { height: 100%; width: 0%; background: var(--blue); transition: width .12s linear; }
.viewer-status { position: absolute; left: 50%; top: 50%; transform: translate(-50%,-50%); border: 1px solid rgba(228,231,236,.9); background: rgba(255,255,255,.84); backdrop-filter: blur(9px); box-shadow: 0 10px 30px rgba(16,24,40,.08); color: var(--muted); border-radius: 999px; padding: 10px 16px; font-size: 12px; pointer-events: none; transition: opacity .25s; }
.viewer-status.hidden { opacity: 0; }
.viewer-status.error { color: #b42318; background: #fff7f6; border-color: #ffd2cc; opacity: 1; }
.viewer-controls { position: absolute; left: 18px; right: 18px; bottom: 16px; display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; pointer-events: none; }
.control-pill, .control-group, .fullscreen-button { pointer-events: auto; background: rgba(255,255,255,.9); backdrop-filter: blur(10px); border: 1px solid rgba(216,221,230,.95); box-shadow: 0 6px 18px rgba(16,24,40,.07); }
.control-pill { justify-self: start; min-height: 44px; border-radius: 999px; display: flex; align-items: center; gap: 8px; padding: 0 13px; color: #475467; cursor: pointer; }
.control-pill svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.control-pill > span:nth-of-type(1) { font-size: 12px; font-weight: 620; }
.switch { width: 34px; height: 20px; border-radius: 999px; background: #d0d5dd; padding: 2px; display: inline-flex; justify-content: flex-start; transition: background .2s; }
.switch span { width: 16px; height: 16px; border-radius: 50%; background: white; box-shadow: 0 1px 3px rgba(0,0,0,.18); transition: transform .2s; }
.switch.is-on { background: var(--blue); }
.switch.is-on span { transform: translateX(14px); }
.control-group { justify-self: center; display: flex; align-items: center; height: 46px; border-radius: 13px; padding: 0 6px; }
.control-button { height: 36px; border: 0; background: transparent; color: #475467; display: flex; align-items: center; gap: 7px; padding: 0 14px; cursor: pointer; border-radius: 9px; }
.control-button:hover { background: #f3f5f7; color: #1d2939; }
.control-button svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.control-button span { font-size: 12px; font-weight: 620; white-space: nowrap; }
.control-divider { width: 1px; height: 20px; background: var(--line); }
.fullscreen-button { justify-self: end; width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; color: #344054; cursor: pointer; }
.fullscreen-button:hover { color: var(--blue); }
.fullscreen-button svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

.metadata-card { max-width: 1320px; margin: 20px auto 0; min-height: 88px; display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); align-items: stretch; background: #fff; border: 1px solid var(--line); border-radius: 15px; overflow: hidden; }
.meta-item { min-width: 0; display: flex; align-items: center; gap: 13px; padding: 17px 24px; position: relative; }
.meta-item + .meta-item::before { content: ""; position: absolute; left: 0; top: 22px; bottom: 22px; width: 1px; background: var(--line); }
.meta-icon { width: 34px; height: 34px; flex: 0 0 auto; display: grid; place-items: center; color: #667085; }
.meta-icon svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.meta-label { font-size: 11px; color: var(--muted); margin-bottom: 4px; }
.meta-value { max-width: 190px; font-size: 13px; font-weight: 650; color: #344054; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tip-card { max-width: 1320px; min-height: 48px; margin: 17px auto 0; padding: 11px 16px; border-radius: 12px; background: var(--blue-soft); color: #175cd3; display: flex; align-items: center; gap: 10px; font-size: 12px; }
.tip-card svg { width: 19px; height: 19px; flex: 0 0 auto; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.mobile-backdrop { display: none; }

@media (max-width: 1120px) {
  .page-header { align-items: flex-start; flex-direction: column; }
  .header-actions { width: 100%; justify-content: space-between; }
}

@media (max-width: 980px) {
  :root { --sidebar-width: 294px; }
  .main-content { padding-left: 22px; padding-right: 22px; }
  .viewer-card { height: 58vh; }
  .metadata-card { grid-template-columns: repeat(2,1fr); }
  .meta-item:nth-child(3)::before { display: none; }
  .meta-item:nth-child(n+3) { border-top: 1px solid var(--line); }
}

@media (max-width: 760px) {
  .app-shell { display: block; }
  .sidebar { position: fixed; left: 0; top: 0; bottom: 0; width: min(86vw, 330px); height: 100dvh; transform: translateX(-102%); transition: transform .25s ease; box-shadow: 20px 0 50px rgba(16,24,40,.13); }
  .sidebar.open { transform: translateX(0); }
  .mobile-backdrop { position: fixed; inset: 0; z-index: 15; background: rgba(16,24,40,.35); backdrop-filter: blur(2px); }
  .mobile-backdrop.show { display: block; }
  .main-content { padding: 0 15px 22px; }
  .mobile-topbar { height: 64px; display: flex; align-items: center; gap: 12px; border-bottom: 1px solid var(--line); margin: 0 -15px 22px; padding: 0 15px; background: rgba(255,255,255,.88); backdrop-filter: blur(10px); position: sticky; top: 0; z-index: 10; }
  .icon-button { width: 40px; height: 40px; border-radius: 10px; border: 1px solid var(--line); background: #fff; display: grid; place-items: center; color: #344054; }
  .icon-button svg { width: 21px; height: 21px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; }
  .mobile-brand { font-size: 15px; font-weight: 760; }
  .mobile-brand span { color: var(--muted); font-weight: 600; }
  .page-header { margin-bottom: 16px; }
  .eyebrow { font-size: 9px; }
  .page-header h1 { font-size: 29px; }
  .theme-switcher { width: 100%; align-items: flex-start; flex-direction: column; gap: 8px; }
  .header-actions { align-items: flex-start; flex-direction: column; gap: 14px; }
  .theme-switcher-buttons { gap: 7px; }
  .theme-chip { height: 36px; padding: 0 11px; }
  .viewer-card { height: 57vh; min-height: 430px; border-radius: 15px; }
  .viewer-controls { grid-template-columns: 1fr auto; gap: 8px; left: 10px; right: 10px; bottom: 10px; }
  .control-pill { grid-column: 1; grid-row: 1; }
  .control-group { position: absolute; left: 50%; bottom: 52px; transform: translateX(-50%); }
  .control-button span { display: none; }
  .control-button { padding: 0 12px; }
  .fullscreen-button { grid-column: 2; grid-row: 1; }
  .metadata-card { grid-template-columns: repeat(2,minmax(0,1fr)); margin-top: 14px; }
  .meta-item { padding: 14px 12px; gap: 8px; }
  .meta-icon { width: 28px; }
  .tip-card { line-height: 1.5; }
}

@media (max-width: 430px) {
  .viewer-card { min-height: 390px; height: 54vh; }
  .control-group { bottom: 54px; }
  .metadata-card { display: grid; }
  .meta-value { font-size: 12px; }
  .meta-icon { display: none; }
}
