:root {
  color-scheme: light;
  --ink: #202528;
  --paper: #f5f3ed;
  --line: #dbd8cd;
  --muted: #565b57;
  --red: #c0172c;
  font-family: "Instrument Sans", "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  color: var(--ink);
  background: var(--paper);
}
* { box-sizing: border-box; }
body { margin: 0; }
button { font: inherit; color: inherit; cursor: pointer; }
button:disabled { cursor: default; opacity: .42; }
button:focus-visible, canvas:focus-visible { outline: 2px solid var(--red); outline-offset: -2px; }
[hidden] { display: none !important; }

.experience {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  height: 100vh;
  height: 100dvh;
  min-height: 360px;
  overflow: hidden;
  width: 100%;
}
.masthead {
  display: grid;
  grid-template-columns: minmax(145px, 1fr) auto minmax(145px, 1fr);
  gap: clamp(12px, 2.4vw, 38px);
  align-items: center;
  min-height: 76px;
  padding: max(10px, env(safe-area-inset-top)) max(29px, env(safe-area-inset-right)) 10px max(29px, env(safe-area-inset-left));
  border-bottom: 1px solid var(--line);
}
.brand {
  display: inline-flex;
  align-items: center;
  justify-self: start;
  gap: 11px;
  font-size: 15px;
  font-weight: 750;
  line-height: 1.08;
  white-space: nowrap;
}
.brand small {
  display: block;
  margin-top: 5px;
  font-size: 8px;
  line-height: 1;
  letter-spacing: .13em;
  font-weight: 750;
}
.brand-mark {
  display: grid;
  grid-template-columns: 9px 5px;
  gap: 3px;
  align-items: end;
  width: 26px;
  height: 26px;
  padding: 5px 4px;
  background: var(--ink);
  color: var(--paper);
  transform: skewX(-10deg);
}
.brand-mark i { height: 16px; background: var(--red); }
.brand-mark i + i { height: 10px; background: currentColor; }
h1 { font-size: clamp(19px, 2.05vw, 29px); line-height: 1.2; letter-spacing: -.045em; margin: 0; }
.window-tools { display: flex; justify-self: end; gap: 8px; }
.window-tools button, .scroll-arrow {
  border: 1px solid var(--line);
  border-radius: 3px;
  min-height: 41px;
  min-width: 41px;
  padding: 0 11px;
  background: transparent;
  display: inline-flex;
  justify-content: center;
  align-items: center;
  gap: 6px;
}
.window-tools button:hover:enabled, .scroll-arrow:hover:enabled { border-color: #a7aba4; background: #ecebe4; }
.window-tools [aria-hidden] { font-size: 21px; line-height: 1; }
.tool-label { font-size: 12px; font-weight: 650; white-space: nowrap; }

#viewport {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  background: #bdc9cd;
}
#viewport canvas {
  display: block;
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  touch-action: none;
  cursor: grab;
}
#viewport canvas:active { cursor: grabbing; }
.cover {
  position: absolute;
  inset: 0;
  z-index: 2;
  background: #bdc9cd url("./assets/cover.jpg") center / cover no-repeat;
  pointer-events: none;
}
#viewport[data-ready="true"] .cover { visibility: hidden; }
.status {
  position: absolute;
  z-index: 3;
  left: 50%;
  bottom: clamp(24px, 6.5%, 68px);
  transform: translateX(-50%);
  width: min(310px, calc(100% - 32px));
  padding: 16px 18px;
  color: #fff;
  background: #202628;
  border: 1px solid #3b4243;
  border-top: 3px solid var(--red);
  box-shadow: 0 8px 24px #16212629;
}
.status p { margin: 0; font-size: 14px; line-height: 1.55; }
.status .progress { height: 3px; margin-top: 11px; overflow: hidden; background: #525b5d; }
.progress span { display: block; height: 100%; width: 26%; background: #ed3147; animation: load-sweep 1.4s ease-in-out infinite alternate; }
.progress span[data-progress] { animation: none; }
@keyframes load-sweep { to { transform: translateX(284%); } }
.error button { background: var(--paper); border: 0; padding: 9px 13px; margin-top: 10px; border-radius: 3px; font-weight: 700; font-size: 13px; }
.gesture-hint {
  position: absolute;
  z-index: 1;
  left: 18px;
  bottom: 15px;
  margin: 0;
  background: #1c2224db;
  color: #fff;
  font-size: 11px;
  letter-spacing: .02em;
  padding: 6px 10px;
  border-radius: 2px;
  pointer-events: none;
}
.touch-hint { display: none; }
.scene-bar {
  display: grid;
  grid-template-columns: minmax(210px, .74fr) minmax(0, 2.2fr);
  align-items: center;
  gap: clamp(15px, 3vw, 50px);
  min-height: 85px;
  padding: 12px max(29px, env(safe-area-inset-right)) max(13px, env(safe-area-inset-bottom)) max(29px, env(safe-area-inset-left));
  border-top: 1px solid var(--line);
}
.scene-bar:has(.scene-groups:not([hidden])) {
  grid-template-columns: minmax(190px, .74fr) max-content minmax(0, 2.2fr);
  gap: clamp(13px, 2.2vw, 35px);
}
.scene-groups {
  display: inline-flex;
  gap: 3px;
  align-items: center;
  align-self: center;
  padding: 3px;
  background: #e8e6dd;
  border: 1px solid #d5d3c8;
  border-radius: 4px;
}
.scene-groups button {
  min-width: 51px;
  min-height: 35px;
  padding: 0 8px;
  border: 1px solid transparent;
  background: transparent;
  border-radius: 3px;
  font-size: 13px;
  font-weight: 700;
}
.scene-groups button:hover { border-color: #a7aba4; }
.scene-groups button[aria-pressed="true"] { background: #fff; box-shadow: 0 1px 2px #20252821; }
.scene-summary { padding-left: 13px; border-left: 3px solid var(--red); min-width: 0; }
.scene-summary h2 { margin: 0; font-size: 16px; line-height: 1.25; }
.scene-summary p {
  margin: 6px 0 0;
  font-size: 12px;
  line-height: 1.4;
  color: var(--muted);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.scene-nav { display: flex; align-items: center; min-width: 0; gap: 8px; }
.scene-list {
  flex: 1 1 auto;
  display: flex;
  min-width: 0;
  gap: 6px;
  padding: 2px 1px;
  overflow: auto hidden;
  scrollbar-width: none;
  scroll-padding-inline: 14px;
}
.scene-list::-webkit-scrollbar { display: none; }
.scene-list button {
  flex: 0 0 auto;
  min-height: 43px;
  padding: 0 13px;
  background: #faf9f5;
  border: 1px solid var(--line);
  border-radius: 3px;
  font-size: 13px;
  line-height: 1.2;
  font-weight: 650;
  white-space: nowrap;
}
.scene-list button:hover { border-color: #6f7775; }
.scene-list button[aria-pressed="true"] {
  background: var(--ink);
  border-color: var(--ink);
  color: #fff;
  box-shadow: inset 0 -3px var(--red);
}
.scene-list button[aria-pressed="true"]:focus-visible { outline-color: #f88894; }
.scroll-arrow { min-width: 30px; padding: 0 6px; font-size: 23px; }
.scroll-arrow:disabled { opacity: .35; }
@media (max-width: 760px) {
  .cover { background-size: contain; }
  .masthead {
    grid-template-columns: auto 1fr auto;
    gap: 13px;
    min-height: 62px;
    padding-left: max(13px, env(safe-area-inset-left));
    padding-right: max(13px, env(safe-area-inset-right));
  }
  .brand { gap: 7px; font-size: 13px; }
  .brand small { font-size: 6.5px; letter-spacing: .08em; }
  .brand-mark { width: 20px; height: 23px; grid-template-columns: 7px 4px; gap: 2px; padding: 4px 3px; }
  .brand-mark i { height: 15px; }
  .brand-mark i + i { height: 9px; }
  h1 { justify-self: center; }
  .window-tools { gap: 5px; }
  .window-tools button { min-height: 41px; min-width: 40px; padding: 0 5px; }
  .tool-label { display: none; }
  .scene-bar {
    grid-template-columns: minmax(0, 1fr);
    gap: 7px;
    padding: 10px max(13px, env(safe-area-inset-right)) max(12px, env(safe-area-inset-bottom)) max(13px, env(safe-area-inset-left));
  }
  .scene-bar:has(.scene-groups:not([hidden])) {
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 7px 10px;
  }
  .scene-groups button { min-height: 39px; }
  .scene-nav { grid-column: 1 / -1; }
  .scene-summary { padding-left: 10px; }
  .scene-summary h2 { font-size: 15px; }
  .scene-summary p { margin-top: 3px; font-size: 11px; -webkit-line-clamp: 1; }
  .scene-list button { min-height: 44px; padding-inline: 12px; }
  .scroll-arrow { display: none; }
  .gesture-hint { left: 10px; bottom: 10px; padding: 5px 8px; }
}
@media (max-width: 375px) {
  .masthead { gap: 8px; }
  .brand small { display: none; }
  .window-tools button { min-width: 36px; }
}
@media (pointer: coarse) {
  .mouse-hint { display: none; }
  .touch-hint { display: inline; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
