:root {
  --panel: rgba(15, 20, 27, 0.74);
  --panel-solid: #141a22;
  --line: rgba(255, 255, 255, 0.10);
  --line-soft: rgba(255, 255, 255, 0.06);
  --text: #e9eef3;
  --muted: #94a2af;
  --accent: #d3ab72;
  --accent-dim: rgba(211, 171, 114, 0.16);
  --shadow: 0 10px 34px rgba(0, 0, 0, 0.38);
  --radius: 12px;
  --font: "Inter", "Noto Sans SC", system-ui, -apple-system, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  background: #10161d;
  color: var(--text);
  font: 13px/1.5 var(--font);
  -webkit-font-smoothing: antialiased;
}

canvas#scene { display: block; width: 100%; height: 100%; touch-action: none; }

#vignette {
  position: fixed; inset: 0;
  pointer-events: none;
  z-index: 5;
  background:
    radial-gradient(ellipse 120% 90% at 50% 42%, transparent 55%, rgba(8, 12, 17, 0.34) 100%),
    linear-gradient(to bottom, rgba(8, 12, 17, 0.16), transparent 18%, transparent 82%, rgba(8, 12, 17, 0.22));
}

button { font: inherit; color: inherit; cursor: pointer; }
[hidden] { display: none !important; }

.panel {
  position: fixed;
  top: 16px;
  left: 16px;
  width: min(268px, calc(100vw - 32px));
  max-height: calc(100vh - 190px);
  display: flex;
  flex-direction: column;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  backdrop-filter: blur(14px) saturate(120%);
  -webkit-backdrop-filter: blur(14px) saturate(120%);
  overflow: hidden;
  z-index: 20;
  transition: opacity 0.18s ease, transform 0.18s ease;
}
.panel.collapsed #panel-body { display: none; }
.panel.hide { opacity: 0; pointer-events: none; transform: translateY(-6px); }

.panel header {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 13px 12px 11px 15px;
  border-bottom: 1px solid var(--line-soft);
}
.panel.collapsed header { border-bottom: 0; }

.title-block { flex: 1; min-width: 0; }
h1 {
  margin: 0;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 0.02em;
  white-space: nowrap;
}
h1 .ver {
  display: inline-block;
  margin-left: 4px;
  padding: 1px 6px;
  border: 1px solid rgba(211, 171, 114, 0.42);
  border-radius: 5px;
  color: var(--accent);
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.06em;
  vertical-align: 2px;
}
.sub { margin: 4px 0 0; color: var(--muted); font-size: 10.5px; letter-spacing: 0.02em; }

#collapse {
  width: 26px; height: 26px;
  flex: 0 0 auto;
  display: grid; place-items: center;
  border: 0; border-radius: 7px;
  background: transparent; color: var(--muted);
}
#collapse:hover { background: rgba(255, 255, 255, 0.07); color: var(--text); }
#collapse svg { transition: transform 0.2s ease; }
.panel.collapsed #collapse svg { transform: rotate(180deg); }

#panel-body { overflow-y: auto; padding: 2px 14px 12px; scrollbar-width: thin; }
#panel-body section { padding: 10px 0; border-bottom: 1px solid var(--line-soft); }
#panel-body section:last-of-type { border-bottom: 0; }

h2 {
  margin: 0 0 8px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  padding: 5px 9px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.045);
  color: #cfd8e0;
  font-size: 11.5px;
  line-height: 1.3;
  transition: background 0.14s, border-color 0.14s, color 0.14s;
}
.chip:hover { background: rgba(255, 255, 255, 0.10); color: #fff; }
.chip[aria-pressed="true"] { background: var(--accent-dim); border-color: rgba(211, 171, 114, 0.5); color: #f1dcbb; }

.layers { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 10px; }
.layer {
  display: flex; align-items: center; gap: 7px;
  color: #d3dbe3; font-size: 11.5px;
  cursor: pointer; user-select: none;
}
.layer input { position: absolute; opacity: 0; pointer-events: none; }
.layer .box {
  width: 14px; height: 14px;
  flex: 0 0 auto;
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.04);
  display: grid; place-items: center;
  transition: background 0.14s, border-color 0.14s;
}
.layer .box::after {
  content: "";
  width: 7px; height: 4px;
  border-left: 1.6px solid #221a10;
  border-bottom: 1.6px solid #221a10;
  transform: rotate(-45deg) translateY(-0.5px) scale(0.2);
  opacity: 0;
  transition: opacity 0.12s, transform 0.12s;
}
.layer input:checked + .box { background: var(--accent); border-color: var(--accent); }
.layer input:checked + .box::after { opacity: 1; transform: rotate(-45deg) translateY(-0.5px) scale(1); }
.layer input:focus-visible + .box { outline: 2px solid var(--accent); outline-offset: 2px; }
.layer:hover { color: #fff; }

.switch {
  display: flex; align-items: center; gap: 9px;
  margin: 0 0 7px;
  color: #d3dbe3; font-size: 11.5px;
  cursor: pointer; user-select: none;
}
.switch:last-of-type { margin-bottom: 0; }
.switch input { position: absolute; opacity: 0; pointer-events: none; }
.switch .track {
  width: 28px; height: 16px;
  flex: 0 0 auto;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.14);
  position: relative;
  transition: background 0.16s;
}
.switch .track::after {
  content: "";
  position: absolute; top: 2px; left: 2px;
  width: 12px; height: 12px;
  border-radius: 50%;
  background: #e8edf2;
  transition: transform 0.16s ease;
}
.switch input:checked + .track { background: rgba(211, 171, 114, 0.55); }
.switch input:checked + .track::after { transform: translateX(12px); background: #fff4e2; }
.switch input:focus-visible + .track { outline: 2px solid var(--accent); outline-offset: 2px; }

.ghost {
  margin-top: 10px;
  width: 100%;
  padding: 6px 10px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: transparent;
  color: var(--muted);
  font-size: 11.5px;
  transition: color 0.14s, border-color 0.14s, background 0.14s;
}
.ghost:hover { color: var(--text); border-color: rgba(255, 255, 255, 0.24); background: rgba(255, 255, 255, 0.05); }

.hint { margin: 11px 0 0; color: rgba(148, 162, 175, 0.8); font-size: 10.5px; letter-spacing: 0.02em; }

.panel-toggle {
  position: fixed;
  top: 16px; left: 16px;
  width: 40px; height: 40px;
  display: none;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--panel);
  backdrop-filter: blur(14px);
  color: var(--text);
  z-index: 21;
}
.panel.hide + .panel-toggle { display: grid; }

/* 图集 */
#gallery {
  position: fixed;
  left: 16px; right: 16px; bottom: 14px;
  z-index: 15;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  backdrop-filter: blur(14px) saturate(120%);
  -webkit-backdrop-filter: blur(14px) saturate(120%);
  padding: 9px 12px 11px;
  transition: opacity 0.18s ease, transform 0.18s ease;
}
.gallery-head {
  display: flex; align-items: baseline; justify-content: space-between;
  margin: 0 1px 7px;
  color: var(--text); font-size: 11px; font-weight: 600; letter-spacing: 0.08em;
}
.gallery-hint { color: var(--muted); font-weight: 400; font-size: 10px; letter-spacing: 0.02em; }
.strip { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 2px; scrollbar-width: thin; }
.shot {
  flex: 0 0 auto;
  width: 138px;
  padding: 0;
  border: 0;
  border-radius: 8px;
  overflow: hidden;
  background: #0b1016;
  position: relative;
  line-height: 0;
}
.shot img { width: 100%; height: 80px; object-fit: cover; display: block; opacity: 0.88; transition: opacity 0.16s, transform 0.3s; }
.shot:hover img { opacity: 1; transform: scale(1.04); }
.shot span {
  position: absolute; left: 0; right: 0; bottom: 0;
  padding: 12px 6px 4px;
  background: linear-gradient(transparent, rgba(0, 0, 0, 0.72));
  color: #e6ebf0; font-size: 9.5px; line-height: 1.2;
  text-align: left; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}


/* 载入 */
#loading {
  position: fixed; inset: 0;
  display: grid; place-items: center;
  background: radial-gradient(circle at 50% 45%, #1a2430 0%, #0c1117 70%);
  z-index: 100;
  transition: opacity 0.5s ease;
}
#loading.done { opacity: 0; pointer-events: none; }
.loading-inner { width: min(300px, 70vw); text-align: center; }
.loading-title { font-size: 15px; font-weight: 600; letter-spacing: 0.06em; color: #e9eef3; }
.loading-bar { margin: 14px 0 9px; height: 2px; border-radius: 2px; background: rgba(255, 255, 255, 0.12); overflow: hidden; }
.loading-bar span { display: block; height: 100%; width: 0; background: linear-gradient(90deg, #b98d54, #e6c893); transition: width 0.25s ease; }
.loading-note { color: var(--muted); font-size: 10.5px; letter-spacing: 0.04em; }

/* 弹层 */
dialog {
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--panel-solid);
  color: var(--text);
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.6);
  padding: 22px 24px;
}
dialog::backdrop { background: rgba(6, 9, 13, 0.72); backdrop-filter: blur(4px); }
dialog .close {
  position: absolute; top: 10px; right: 10px;
  width: 28px; height: 28px;
  border: 0; border-radius: 7px;
  background: transparent; color: var(--muted);
  font-size: 12px;
}
dialog .close:hover { background: rgba(255, 255, 255, 0.08); color: var(--text); }

#lightbox { width: min(1180px, 94vw); max-width: 94vw; padding: 0; background: #0a0e13; overflow: hidden; }
#lightImg { display: block; width: 100%; max-height: 78vh; object-fit: contain; background: #0a0e13; }
#lightCap { margin: 0; padding: 11px 16px 13px; color: #c8d2db; font-size: 12px; }

#about { width: min(560px, 92vw); max-height: 84vh; overflow-y: auto; }
#about h2 { margin: 0 0 12px; color: var(--text); font-size: 16px; font-weight: 600; letter-spacing: 0.02em; text-transform: none; }
#about p { margin: 0 0 12px; color: #c6d0d9; font-size: 12.5px; line-height: 1.7; }
#about p.small { color: var(--muted); font-size: 11.5px; }
#about strong { color: var(--accent); font-weight: 500; }
#about dl { display: grid; grid-template-columns: 62px 1fr; gap: 6px 14px; margin: 0 0 14px; }
#about dt { color: var(--muted); font-size: 11px; letter-spacing: 0.06em; }
#about dd { margin: 0; color: #dfe6ec; font-size: 12px; }

@media (max-width: 760px) {
  .panel { max-height: calc(100vh - 176px); }
  #gallery { left: 8px; right: 8px; bottom: 8px; padding: 8px 10px 9px; }
  .shot { width: 94px; }
  .shot img { height: 56px; }
  footer#credit { display: none; }
  #panel.hide { display: none; }
  .panel:not(.hide) + .panel-toggle { display: none; }
  .panel header { padding: 12px 10px 10px 14px; }
}

@media (max-height: 700px) {
  #gallery .gallery-head { display: none; }
  .shot img { height: 50px; }
  .shot { width: 92px; }
  footer#credit { display: none; }
}
