/* =============================================================
   style.css — the frame around the diorama.
   Warm paper-and-ink palette so the UI reads as a museum label
   rather than a game HUD.
   ============================================================= */
:root {
  --ink: #2a2622;
  --paper: rgba(252, 249, 242, 0.90);
  --paper-solid: #fcf9f2;
  --line: rgba(42, 38, 34, 0.14);
  --accent: #b8623c;
  --accent-soft: rgba(184, 98, 60, 0.13);
  --shadow: 0 6px 26px rgba(30, 24, 18, 0.16), 0 1px 3px rgba(30, 24, 18, 0.12);
}

* { box-sizing: border-box; }

html, body {
  margin: 0; padding: 0; height: 100%; overflow: hidden;
  background: #0e1620;
  font-family: "Hiragino Sans GB", "PingFang SC", "Microsoft YaHei",
               ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
}

#scene {
  position: fixed; inset: 0;
  width: 100vw; height: 100vh;
  display: block;
  touch-action: none;
}

/* a subtle vignette sells the "object under glass" feeling */
body::after {
  content: ""; position: fixed; inset: 0; pointer-events: none; z-index: 3;
  background: radial-gradient(ellipse at 50% 46%,
    rgba(0,0,0,0) 52%, rgba(10,8,6,0.16) 82%, rgba(8,6,4,0.34) 100%);
}

/* ---------------- loading ---------------- */
#loading {
  position: fixed; inset: 0; z-index: 40;
  display: grid; place-items: center;
  background: linear-gradient(170deg, #12212e 0%, #1d2b33 45%, #2b3129 100%);
  transition: opacity .6s ease;
}
#loading.done { opacity: 0; }
.load-inner { text-align: center; color: #f2ece0; }
.load-title { font-size: 34px; letter-spacing: .32em; font-weight: 500; }
.load-sub {
  font-size: 11px; letter-spacing: .42em; text-transform: uppercase;
  opacity: .55; margin: 8px 0 26px;
}
.load-track {
  width: 240px; height: 2px; margin: 0 auto 14px;
  background: rgba(242, 236, 224, 0.18); border-radius: 2px; overflow: hidden;
}
#loadbar {
  height: 100%; width: 0%;
  background: linear-gradient(90deg, #e8b06a, #d9825a);
  transition: width .3s ease;
}
#loadtext { font-size: 11.5px; letter-spacing: .18em; opacity: .62; }

/* ---------------- title card ---------------- */
#titlecard {
  position: fixed; top: 22px; left: 24px; z-index: 6;
  color: var(--paper-solid);
  text-shadow: 0 2px 12px rgba(0,0,0,.55), 0 1px 2px rgba(0,0,0,.5);
  pointer-events: none;
}
#titlecard h1 {
  margin: 0; font-size: 25px; font-weight: 500; letter-spacing: .2em;
}
#titlecard p {
  margin: 5px 0 0; font-size: 11.5px; letter-spacing: .2em; opacity: .8;
}
#fps {
  margin-top: 9px; font-size: 10.5px; letter-spacing: .1em; opacity: .58;
  font-variant-numeric: tabular-nums;
}

/* ---------------- panel ---------------- */
#panel {
  position: fixed; top: 18px; right: 18px; z-index: 8;
  width: 254px; max-height: calc(100vh - 36px);
  overflow-y: auto; overscroll-behavior: contain;
  padding: 15px 16px 17px;
  background: var(--paper);
  -webkit-backdrop-filter: blur(14px) saturate(1.2);
  backdrop-filter: blur(14px) saturate(1.2);
  border: 1px solid rgba(255,255,255,.5);
  border-radius: 13px;
  box-shadow: var(--shadow);
  transition: transform .38s cubic-bezier(.4,0,.2,1), opacity .3s ease;
}
body.panel-hidden #panel { transform: translateX(calc(100% + 26px)); opacity: 0; }

#panel::-webkit-scrollbar { width: 6px; }
#panel::-webkit-scrollbar-thumb { background: rgba(42,38,34,.2); border-radius: 3px; }

#panel section { margin-bottom: 15px; }
#panel section:last-child { margin-bottom: 2px; }
#panel h2 {
  margin: 0 0 8px; font-size: 10px; font-weight: 600;
  letter-spacing: .26em; text-transform: uppercase;
  color: rgba(42,38,34,.5);
  border-bottom: 1px solid var(--line); padding-bottom: 6px;
}

#timelabel {
  font-size: 17px; letter-spacing: .06em; margin-bottom: 9px;
  font-variant-numeric: tabular-nums;
}
.slab {
  display: block; font-size: 10.5px; letter-spacing: .14em;
  color: rgba(42,38,34,.55); margin: 11px 0 5px;
}
.slab span { color: var(--accent); font-variant-numeric: tabular-nums; }

/* sliders */
input[type=range] {
  -webkit-appearance: none; appearance: none;
  width: 100%; height: 20px; background: transparent; cursor: pointer; margin: 0;
}
input[type=range]::-webkit-slider-runnable-track {
  height: 3px; border-radius: 3px;
  background: linear-gradient(90deg, #2e3d55 0%, #6c86a8 22%, #f0c98a 40%,
              #9fc6e4 52%, #f0b276 70%, #b8663f 80%, #2c3550 100%);
}
input[type=range]::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none;
  width: 15px; height: 15px; margin-top: -6px; border-radius: 50%;
  background: var(--paper-solid); border: 2px solid var(--accent);
  box-shadow: 0 1px 5px rgba(0,0,0,.28);
}
input[type=range]::-moz-range-track {
  height: 3px; border-radius: 3px; background: #b9b2a4;
}
input[type=range]::-moz-range-thumb {
  width: 13px; height: 13px; border-radius: 50%;
  background: var(--paper-solid); border: 2px solid var(--accent);
}
#speed::-webkit-slider-runnable-track { background: #c3bcae; }

/* buttons */
.row { display: flex; gap: 6px; margin-top: 7px; }
.row.wrap { flex-wrap: wrap; }
#panel button, #btn-collapse {
  font-family: inherit; font-size: 11.5px; letter-spacing: .06em;
  color: var(--ink); cursor: pointer;
  padding: 6px 9px;
  background: rgba(255,255,255,.62);
  border: 1px solid var(--line); border-radius: 7px;
  transition: background .16s ease, border-color .16s ease, color .16s ease;
  flex: 1 1 auto; min-width: 52px;
}
#panel button:hover { background: #fff; border-color: rgba(42,38,34,.28); }
#panel button.on {
  background: var(--accent-soft); border-color: rgba(184,98,60,.5);
  color: var(--accent); font-weight: 600;
}
#panel button.wide { flex: 1 1 100%; }

#btn-collapse {
  position: fixed; top: 18px; right: 284px; z-index: 9;
  width: 26px; height: 26px; min-width: 0; padding: 0;
  display: grid; place-items: center;
  background: var(--paper); border-radius: 50%;
  box-shadow: var(--shadow); font-size: 15px; line-height: 1;
  transition: right .38s cubic-bezier(.4,0,.2,1);
}
body.panel-hidden #btn-collapse { right: 18px; }

.hint p {
  margin: 4px 0 0; font-size: 10.5px; line-height: 1.65;
  color: rgba(42,38,34,.55); letter-spacing: .03em;
}

/* ---------------- small screens ---------------- */
@media (max-width: 760px) {
  #panel { width: calc(100vw - 28px); right: 14px; top: auto; bottom: 14px; max-height: 46vh; }
  #btn-collapse { right: 14px; top: 14px; }
  body.panel-hidden #panel { transform: translateY(calc(100% + 26px)); }
  #titlecard h1 { font-size: 20px; }
  #titlecard p { font-size: 10px; }
}
