/* =========================================================
   金为启宸 · 360° 六面体全景记录
   ========================================================= */

:root {
  --sidebar-w: 344px;
  --bg: #07090c;
  --panel: #10141a;
  --panel-2: #151a21;
  --line: rgba(255, 255, 255, 0.075);
  --line-strong: rgba(255, 255, 255, 0.14);
  --text: #f2f0ea;
  --muted: #a1a7b0;
  --muted-2: #6f7680;
  --gold: #e3b566;
  --gold-soft: rgba(227, 181, 102, 0.14);
  --danger: #ff8b8b;
  --font-sans: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans CJK SC", "Source Han Sans SC", sans-serif;
  --font-mono: "SFMono-Regular", "Cascadia Mono", Consolas, "Liberation Mono", monospace;
}

* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
}

html {
  background: var(--bg);
}

body {
  margin: 0;
  overflow: hidden;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

button {
  margin: 0;
  padding: 0;
  border: 0;
  background: none;
  color: inherit;
  font: inherit;
  cursor: pointer;
}

a {
  color: inherit;
  text-decoration: none;
}

img {
  max-width: 100%;
}

h1,
h2,
p {
  margin: 0;
}

:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 2px;
}

.sr-only {
  position: absolute !important;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

[hidden] {
  display: none !important;
}

/* ---------------------------------------------------------
   App shell
   --------------------------------------------------------- */

.app {
  display: grid;
  grid-template-columns: var(--sidebar-w) minmax(0, 1fr);
  width: 100%;
  height: 100vh;
  height: 100dvh;
  min-height: 0;
}

/* ---------------------------------------------------------
   Sidebar
   --------------------------------------------------------- */

.sidebar {
  position: relative;
  z-index: 4;
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  padding: 0 18px;
  border-right: 1px solid var(--line);
  background:
    radial-gradient(115% 55% at 0% 0%, rgba(227, 181, 102, 0.065), transparent 62%),
    linear-gradient(180deg, #11151b 0%, #0b0e12 100%);
}

.sidebar-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 27px 4px 23px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  border-radius: 10px;
}

.brand-mark {
  display: grid;
  flex: 0 0 40px;
  width: 40px;
  height: 40px;
  place-items: center;
  border: 1px solid rgba(227, 181, 102, 0.28);
  border-radius: 11px;
  background: rgba(227, 181, 102, 0.075);
  color: var(--gold);
  box-shadow: inset 0 0 24px rgba(227, 181, 102, 0.04);
}

.brand-mark svg {
  width: 27px;
  height: 27px;
}

.brand-copy {
  display: flex;
  flex-direction: column;
  min-width: 0;
  gap: 4px;
}

.brand-copy strong {
  overflow: hidden;
  color: var(--text);
  font-size: 16px;
  font-weight: 500;
  letter-spacing: 0.09em;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.brand-copy small {
  overflow: hidden;
  color: var(--muted-2);
  font-size: 10px;
  letter-spacing: 0.06em;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.icon-btn.sidebar-close {
  display: none;
  flex: 0 0 auto;
}

/* Group tabs */

.group-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
  padding: 4px;
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: 13px;
  background: rgba(255, 255, 255, 0.032);
}

.group-tab {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 40px;
  border-radius: 9px;
  color: var(--muted);
  font-size: 12.5px;
  letter-spacing: 0.1em;
  transition: color 180ms ease, background 180ms ease, box-shadow 180ms ease;
}

.group-tab em {
  padding: 2px 6px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
  color: var(--muted-2);
  font-family: var(--font-mono);
  font-size: 9px;
  font-style: normal;
  line-height: 1.3;
  transition: color 180ms ease, background 180ms ease;
}

.group-tab:hover {
  color: var(--text);
  background: rgba(255, 255, 255, 0.04);
}

.group-tab.is-active {
  background: linear-gradient(180deg, rgba(227, 181, 102, 0.17), rgba(227, 181, 102, 0.065));
  box-shadow: inset 0 0 0 1px rgba(227, 181, 102, 0.22);
  color: var(--gold);
}

.group-tab.is-active em {
  background: var(--gold);
  color: #1a1610;
}

/* Room list */

.list-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 22px 6px 9px;
  color: var(--muted-2);
  font-size: 9.5px;
  letter-spacing: 0.16em;
}

.list-range {
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0.08em;
  opacity: 0.75;
}

.room-list {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 3px;
  min-height: 0;
  margin: 0 -6px;
  padding: 0 6px 16px;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.12) transparent;
}

.room-list::-webkit-scrollbar {
  width: 4px;
}

.room-list::-webkit-scrollbar-track {
  background: transparent;
}

.room-list::-webkit-scrollbar-thumb {
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.12);
}

.room-item {
  position: relative;
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 8px 10px;
  border-radius: 11px;
  color: var(--text);
  text-align: left;
  transition: background 180ms ease, box-shadow 180ms ease;
}

.room-item:hover {
  background: rgba(255, 255, 255, 0.038);
}

.room-item[aria-current="true"] {
  background: linear-gradient(90deg, rgba(227, 181, 102, 0.13), rgba(227, 181, 102, 0.028));
  box-shadow: inset 0 0 0 1px rgba(227, 181, 102, 0.16);
}

.room-item[aria-current="true"]::before {
  position: absolute;
  top: 12px;
  bottom: 12px;
  left: 0;
  width: 2px;
  border-radius: 2px;
  background: var(--gold);
  content: "";
  box-shadow: 0 0 12px rgba(227, 181, 102, 0.45);
}

.room-thumb {
  position: relative;
  flex: 0 0 62px;
  height: 48px;
  overflow: hidden;
  border-radius: 8px;
  background: #1a1f27;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.06);
}

.room-thumb img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0.82;
  transition: opacity 200ms ease, transform 500ms cubic-bezier(0.2, 0.7, 0.2, 1);
}

.room-item:hover .room-thumb img,
.room-item[aria-current="true"] .room-thumb img {
  opacity: 1;
}

.room-item:hover .room-thumb img {
  transform: scale(1.045);
}

.room-item[aria-current="true"] .room-thumb {
  box-shadow: inset 0 0 0 1px rgba(227, 181, 102, 0.5);
}

.room-num {
  position: absolute;
  bottom: 0;
  left: 0;
  padding: 2px 5px;
  border-top-right-radius: 5px;
  background: rgba(5, 7, 10, 0.74);
  color: #d6d9df;
  font-family: var(--font-mono);
  font-size: 8.5px;
  line-height: 1.25;
  letter-spacing: 0.04em;
  backdrop-filter: blur(4px);
}

.room-item[aria-current="true"] .room-num {
  background: var(--gold);
  color: #1a1610;
}

.room-meta {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.room-meta strong {
  overflow: hidden;
  font-size: 13.5px;
  font-weight: 500;
  letter-spacing: 0.055em;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.room-meta small {
  color: var(--muted-2);
  font-size: 9.5px;
  letter-spacing: 0.07em;
}

.room-go {
  flex: 0 0 auto;
  color: var(--gold);
  font-size: 15px;
  opacity: 0;
  transform: translateX(-4px);
  transition: opacity 180ms ease, transform 180ms ease;
}

.room-item:hover .room-go {
  opacity: 0.8;
  transform: none;
}

.sidebar-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 14px 4px 18px;
  border-top: 1px solid var(--line);
}

.desktop-hint {
  display: flex;
  align-items: center;
  gap: 7px;
  color: var(--muted-2);
  font-size: 9.5px;
  letter-spacing: 0.04em;
}

.hint-icon {
  display: inline-flex;
  color: var(--muted-2);
}

.hint-icon svg {
  width: 14px;
  height: 14px;
}

.text-btn {
  position: relative;
  color: var(--muted);
  font-size: 10px;
  letter-spacing: 0.05em;
  white-space: nowrap;
  transition: color 180ms ease;
}

.text-btn::after {
  position: absolute;
  right: 0;
  bottom: -3px;
  left: 0;
  height: 1px;
  background: currentColor;
  content: "";
  opacity: 0;
  transform: scaleX(0.4);
  transition: opacity 180ms ease, transform 180ms ease;
}

.text-btn:hover {
  color: var(--gold);
}

.text-btn:hover::after {
  opacity: 0.55;
  transform: scaleX(1);
}

/* ---------------------------------------------------------
   Stage
   --------------------------------------------------------- */

.stage {
  position: relative;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  background: #05070a;
  isolation: isolate;
}

#pano {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  cursor: grab;
  touch-action: none;
  outline: none;
}

#pano.is-dragging {
  cursor: grabbing;
}

.flat-fallback {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #05070a;
}

.flat-note {
  position: absolute;
  left: 50%;
  bottom: 112px;
  z-index: 7;
  max-width: calc(100% - 40px);
  padding: 9px 15px;
  transform: translateX(-50%);
  border: 1px solid rgba(227, 181, 102, 0.28);
  border-radius: 999px;
  background: rgba(10, 12, 15, 0.82);
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
  text-align: center;
  white-space: nowrap;
  pointer-events: none;
  backdrop-filter: blur(10px);
}

.stage-shade {
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  background:
    linear-gradient(180deg, rgba(4, 6, 9, 0.62) 0%, rgba(4, 6, 9, 0.06) 22%, transparent 38%, transparent 68%, rgba(4, 6, 9, 0.56) 100%),
    radial-gradient(125% 96% at 50% 44%, transparent 48%, rgba(0, 0, 0, 0.32) 100%);
}

/* Top bar */

.topbar {
  position: absolute;
  z-index: 6;
  top: 0;
  right: 0;
  left: 0;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  padding: 24px 28px;
  pointer-events: none;
}

.topbar-left,
.top-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  pointer-events: auto;
}

.topbar-left {
  align-items: flex-start;
  min-width: 0;
}

.icon-btn.menu-btn {
  display: none;
}

.current {
  min-width: 0;
  padding-top: 1px;
}

.current-group {
  display: block;
  margin-bottom: 7px;
  color: var(--gold);
  font-size: 8.5px;
  font-weight: 500;
  letter-spacing: 0.24em;
  text-shadow: 0 2px 12px rgba(0, 0, 0, 0.55);
}

.current-line {
  display: flex;
  align-items: baseline;
  gap: 12px;
}

.current h1 {
  overflow: hidden;
  color: #f7f5f0;
  font-size: 30px;
  font-weight: 400;
  letter-spacing: 0.06em;
  line-height: 1.1;
  text-overflow: ellipsis;
  text-shadow: 0 2px 22px rgba(0, 0, 0, 0.55);
  white-space: nowrap;
}

.current-index {
  flex: 0 0 auto;
  color: rgba(255, 255, 255, 0.48);
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0.12em;
}

/* Compass */

.compass {
  position: absolute;
  top: 27px;
  left: 50%;
  width: 300px;
  height: 42px;
  overflow: hidden;
  transform: translateX(-50%);
  opacity: 0.85;
  pointer-events: none;
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 18%, #000 82%, transparent);
  mask-image: linear-gradient(90deg, transparent, #000 18%, #000 82%, transparent);
}

.compass-track {
  position: absolute;
  top: 0;
  left: 0;
  height: 100%;
  will-change: transform;
}

.compass-tick {
  position: absolute;
  top: 0;
  width: 1px;
  height: 5px;
  background: rgba(255, 255, 255, 0.26);
  transform: translateX(-50%);
}

.compass-tick.is-major {
  height: 9px;
  background: rgba(255, 255, 255, 0.5);
}

.compass-label {
  position: absolute;
  top: 15px;
  color: rgba(255, 255, 255, 0.62);
  font-size: 9.5px;
  letter-spacing: 0.16em;
  transform: translateX(-50%);
  white-space: nowrap;
}

.compass-label.is-center {
  color: var(--gold);
}

.compass-mark {
  position: absolute;
  top: 0;
  left: 50%;
  width: 1px;
  height: 35px;
  background: linear-gradient(180deg, var(--gold), transparent);
}

.compass-mark::before {
  position: absolute;
  top: -1px;
  left: -2.5px;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--gold);
  box-shadow: 0 0 12px rgba(227, 181, 102, 0.75);
  content: "";
}

/* Glass buttons */

.icon-btn {
  display: inline-grid;
  flex: 0 0 auto;
  width: 40px;
  height: 40px;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  background: rgba(10, 13, 18, 0.52);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.18);
  color: var(--text);
  backdrop-filter: blur(16px) saturate(120%);
  -webkit-backdrop-filter: blur(16px) saturate(120%);
  transition: background 180ms ease, border-color 180ms ease, transform 180ms ease, color 180ms ease;
}

.icon-btn svg {
  width: 18px;
  height: 18px;
}

.icon-btn:hover {
  border-color: rgba(255, 255, 255, 0.2);
  background: rgba(30, 36, 45, 0.78);
}

.icon-btn:active {
  transform: scale(0.96);
}

.pill-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 40px;
  padding: 0 14px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  background: rgba(10, 13, 18, 0.52);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.18);
  color: var(--text);
  font-size: 11px;
  letter-spacing: 0.07em;
  backdrop-filter: blur(16px) saturate(120%);
  -webkit-backdrop-filter: blur(16px) saturate(120%);
  transition: background 180ms ease, border-color 180ms ease, color 180ms ease;
}

.pill-btn svg {
  width: 17px;
  height: 17px;
}

.pill-btn:hover {
  border-color: rgba(255, 255, 255, 0.2);
  background: rgba(30, 36, 45, 0.78);
}

.pill-btn[aria-pressed="true"] {
  border-color: rgba(227, 181, 102, 0.38);
  background: rgba(227, 181, 102, 0.12);
  color: var(--gold);
}

/* Mobile group switch */

.mobile-groups {
  display: none;
}

/* Prev / next */

.stage-nav {
  position: absolute;
  z-index: 5;
  inset: 0;
  pointer-events: none;
}

.nav-btn {
  position: absolute;
  top: 50%;
  display: grid;
  width: 44px;
  height: 44px;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 50%;
  background: rgba(10, 13, 18, 0.44);
  color: var(--text);
  opacity: 0.56;
  pointer-events: auto;
  transform: translateY(-50%);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  transition: opacity 180ms ease, background 180ms ease, border-color 180ms ease;
}

.nav-btn svg {
  width: 20px;
  height: 20px;
}

.nav-btn:hover {
  border-color: rgba(255, 255, 255, 0.2);
  background: rgba(10, 13, 18, 0.7);
  opacity: 1;
}

#prevBtn {
  left: 24px;
}

#nextBtn {
  right: 24px;
}

/* Stage footer */

.stage-foot {
  position: absolute;
  z-index: 6;
  right: 28px;
  bottom: 24px;
  left: 28px;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 18px;
  pointer-events: none;
}

.room-caption {
  display: flex;
  align-items: stretch;
  gap: 12px;
  pointer-events: auto;
}

.caption-rule {
  width: 2px;
  border-radius: 2px;
  background: var(--gold);
  box-shadow: 0 0 12px rgba(227, 181, 102, 0.4);
}

.caption-copy {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.caption-copy strong {
  color: #f5f3ee;
  font-size: 13.5px;
  font-weight: 400;
  letter-spacing: 0.09em;
  text-shadow: 0 2px 16px rgba(0, 0, 0, 0.62);
}

.caption-copy span {
  color: rgba(255, 255, 255, 0.42);
  font-family: var(--font-mono);
  font-size: 8.5px;
  letter-spacing: 0.14em;
}

.zoom-control {
  display: flex;
  align-items: center;
  gap: 1px;
  height: 38px;
  padding: 0 4px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 11px;
  background: rgba(10, 13, 18, 0.48);
  pointer-events: auto;
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}

.zoom-control button {
  display: grid;
  width: 29px;
  height: 29px;
  place-items: center;
  border-radius: 7px;
  color: var(--text);
  font-size: 16px;
  line-height: 1;
  transition: background 160ms ease;
}

.zoom-control button:hover {
  background: rgba(255, 255, 255, 0.08);
}

.zoom-control span {
  min-width: 38px;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0.04em;
  text-align: center;
}

/* Drag hint */

.drag-hint {
  position: absolute;
  z-index: 6;
  bottom: 92px;
  left: 50%;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 14px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 999px;
  background: rgba(10, 13, 18, 0.5);
  color: rgba(255, 255, 255, 0.68);
  font-size: 10.5px;
  letter-spacing: 0.06em;
  pointer-events: none;
  transform: translateX(-50%);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  animation: hint-in 800ms 900ms both;
  transition: opacity 500ms ease, transform 500ms ease;
}

.drag-hint.is-hidden {
  animation: none;
  opacity: 0;
  transform: translate(-50%, 8px);
}

.drag-hint-icon {
  display: inline-flex;
  color: rgba(255, 255, 255, 0.58);
}

.drag-hint-icon svg {
  display: block;
  width: 16px;
  height: 16px;
}

/* Loading */

.loading-pill {
  position: absolute;
  z-index: 7;
  top: 86px;
  left: 50%;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-radius: 999px;
  background: rgba(10, 13, 18, 0.62);
  color: var(--muted);
  font-size: 10px;
  letter-spacing: 0.08em;
  transform: translateX(-50%);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.spinner {
  width: 12px;
  height: 12px;
  border: 1.5px solid rgba(255, 255, 255, 0.18);
  border-top-color: var(--gold);
  border-radius: 50%;
  animation: spin 800ms linear infinite;
}

.loader {
  position: absolute;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  background:
    radial-gradient(58% 58% at 50% 44%, rgba(18, 23, 30, 0.82), rgba(5, 7, 10, 0.97) 72%);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  transition: opacity 600ms ease, visibility 600ms ease;
}

.loader.is-hidden {
  visibility: hidden;
  opacity: 0;
  pointer-events: none;
}

.loader-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 13px;
  padding-bottom: 4vh;
}

.loader-visual {
  position: relative;
  display: grid;
  width: 88px;
  height: 88px;
  margin-bottom: 4px;
  place-items: center;
}

.loader-ring {
  position: absolute;
  inset: 0;
  border: 1px solid rgba(227, 181, 102, 0.14);
  border-top-color: var(--gold);
  border-radius: 50%;
  animation: spin 1400ms linear infinite;
}

.loader-mark {
  display: block;
  width: 48px;
  height: 48px;
  color: var(--gold);
  opacity: 0.92;
}

.loader-mark svg {
  display: block;
  width: 100%;
  height: 100%;
}

.loader p {
  color: var(--muted);
  font-size: 11.5px;
  letter-spacing: 0.2em;
}

.loader-sub {
  color: var(--muted-2);
  font-family: var(--font-mono);
  font-size: 8.5px;
  letter-spacing: 0.17em;
  opacity: 0.75;
}

/* Error */

.error-card {
  position: absolute;
  z-index: 21;
  top: 50%;
  left: 50%;
  width: min(340px, calc(100% - 40px));
  padding: 26px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 18px;
  background: rgba(16, 20, 26, 0.94);
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.55);
  text-align: center;
  transform: translate(-50%, -50%);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
}

.error-icon {
  display: grid;
  width: 36px;
  height: 36px;
  margin: 0 auto 12px;
  place-items: center;
  border-radius: 50%;
  background: rgba(255, 139, 139, 0.12);
  color: var(--danger);
  font-family: var(--font-mono);
  font-size: 16px;
  font-weight: 700;
}

.error-card strong {
  display: block;
  font-size: 15px;
  font-weight: 500;
  letter-spacing: 0.06em;
}

.error-card p {
  margin: 8px 0 18px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.7;
}

.solid-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 38px;
  padding: 0 18px;
  border-radius: 10px;
  background: var(--gold);
  color: #1a1610;
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.06em;
  transition: filter 180ms ease, transform 180ms ease;
}

.solid-btn:hover {
  filter: brightness(1.06);
}

.solid-btn:active {
  transform: scale(0.98);
}

/* Mobile rail */

.mobile-rail-wrap {
  display: none;
  position: absolute;
  z-index: 8;
  right: 0;
  bottom: 0;
  left: 0;
  padding-top: 20px;
  background: linear-gradient(0deg, rgba(4, 6, 9, 0.95) 0%, rgba(4, 6, 9, 0.72) 54%, transparent 100%);
  pointer-events: none;
}

.mobile-rail {
  display: flex;
  gap: 9px;
  padding: 8px 16px calc(12px + env(safe-area-inset-bottom));
  overflow-x: auto;
  pointer-events: auto;
  scroll-snap-type: x proximity;
  scrollbar-width: none;
}

.mobile-rail::-webkit-scrollbar {
  display: none;
}

.rail-item {
  display: flex;
  flex: 0 0 70px;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  scroll-snap-align: center;
}

.rail-thumb {
  width: 56px;
  height: 56px;
  padding: 2px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.03);
  transition: border-color 180ms ease, transform 180ms ease, box-shadow 180ms ease;
}

.rail-thumb img {
  display: block;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
  opacity: 0.8;
}

.rail-item span {
  max-width: 70px;
  overflow: hidden;
  font-size: 9.5px;
  letter-spacing: 0.04em;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.rail-item.is-active {
  color: var(--text);
}

.rail-item.is-active .rail-thumb {
  border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(227, 181, 102, 0.11);
  transform: scale(1.04);
}

.rail-item.is-active .rail-thumb img {
  opacity: 1;
}

/* Toast */

.toast {
  position: absolute;
  z-index: 30;
  bottom: 110px;
  left: 50%;
  padding: 9px 14px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 10px;
  background: rgba(20, 24, 30, 0.94);
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.38);
  color: var(--text);
  font-size: 11px;
  letter-spacing: 0.04em;
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 8px);
  transition: opacity 220ms ease, transform 220ms ease;
}

.toast.is-visible {
  opacity: 1;
  transform: translate(-50%, 0);
}

/* ---------------------------------------------------------
   Modal
   --------------------------------------------------------- */

.modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  padding: 20px;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(3, 5, 8, 0.7);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.modal-card {
  position: relative;
  width: min(440px, 100%);
  max-height: calc(100dvh - 40px);
  padding: 26px;
  overflow-y: auto;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 20px;
  background: linear-gradient(180deg, #161b22, #0e1217);
  box-shadow: 0 30px 90px rgba(0, 0, 0, 0.62);
  animation: modal-in 300ms cubic-bezier(0.2, 0.8, 0.2, 1);
}

.modal-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
}

.eyebrow {
  display: block;
  color: var(--gold);
  font-family: var(--font-mono);
  font-size: 8.5px;
  letter-spacing: 0.26em;
}

.modal-card h2 {
  margin-top: 7px;
  font-size: 22px;
  font-weight: 400;
  letter-spacing: 0.1em;
}

.guide-grid {
  display: grid;
  gap: 7px;
  margin: 22px 0;
}

.guide-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 10px 12px;
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.032);
  color: var(--muted);
  font-size: 11.5px;
}

.guide-row kbd {
  padding: 3px 7px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 5px;
  background: rgba(255, 255, 255, 0.06);
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 9.5px;
  white-space: nowrap;
}

.modal-note {
  padding-top: 16px;
  border-top: 1px solid var(--line);
  color: var(--muted-2);
  font-size: 10.5px;
  line-height: 1.85;
}

.modal-note p + p {
  margin-top: 8px;
}

.modal-note strong {
  color: var(--muted);
  font-weight: 500;
}

.modal-done {
  width: 100%;
  margin-top: 20px;
}

/* ---------------------------------------------------------
   Scrim (mobile drawer)
   --------------------------------------------------------- */

.scrim {
  display: none;
}

/* ---------------------------------------------------------
   Utilities / animations
   --------------------------------------------------------- */

.noscript {
  position: fixed;
  inset: 0;
  z-index: 999;
  display: grid;
  place-items: center;
  padding: 24px;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  text-align: center;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

@keyframes hint-in {
  from {
    opacity: 0;
    transform: translate(-50%, 8px);
  }
  to {
    opacity: 1;
    transform: translate(-50%, 0);
  }
}

@keyframes modal-in {
  from {
    opacity: 0;
    transform: translateY(12px) scale(0.985);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

/* ---------------------------------------------------------
   Responsive
   --------------------------------------------------------- */

@media (max-width: 1180px) {
  :root {
    --sidebar-w: 310px;
  }

  .sidebar {
    padding: 0 15px;
  }

  .current h1 {
    font-size: 26px;
  }

  .compass {
    width: 250px;
  }
}

@media (max-width: 900px) {
  .app {
    display: block;
  }

  .sidebar {
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    z-index: 60;
    width: min(86vw, 360px);
    padding: 0 18px;
    padding-bottom: env(safe-area-inset-bottom);
    border-right: 1px solid var(--line-strong);
    box-shadow: 30px 0 90px rgba(0, 0, 0, 0.55);
    transform: translateX(-102%);
    transition: transform 380ms cubic-bezier(0.22, 0.8, 0.22, 1);
  }

  body.drawer-open .sidebar {
    transform: translateX(0);
  }

  .icon-btn.sidebar-close {
    display: inline-grid;
  }

  .scrim {
    position: fixed;
    inset: 0;
    z-index: 50;
    display: block;
    background: rgba(3, 5, 8, 0.58);
    opacity: 0;
    pointer-events: none;
    transition: opacity 300ms ease;
    backdrop-filter: blur(2px);
    -webkit-backdrop-filter: blur(2px);
  }

  body.drawer-open .scrim {
    opacity: 1;
    pointer-events: auto;
  }

  .stage {
    width: 100%;
    height: 100%;
  }

  .flat-note {
    bottom: 138px;
    max-width: calc(100% - 32px);
    white-space: normal;
  }

  .topbar {
    gap: 8px;
    padding: calc(12px + env(safe-area-inset-top)) 14px 0;
  }

  .topbar-left {
    align-items: center;
    gap: 8px;
    min-width: 0;
  }

  .icon-btn.menu-btn {
    display: inline-grid;
  }

  .current {
    padding-top: 0;
  }

  .current-group {
    margin-bottom: 3px;
    font-size: 7.5px;
    letter-spacing: 0.2em;
  }

  .current-line {
    gap: 7px;
  }

  .current h1 {
    font-size: 20px;
  }

  .current-index {
    font-size: 7.5px;
  }

  .top-actions {
    flex: 0 0 auto;
    gap: 6px;
  }

  .top-actions .pill-btn {
    width: 36px;
    padding: 0;
    justify-content: center;
  }

  .top-actions .pill-btn span {
    display: none;
  }

  .icon-btn {
    width: 36px;
    height: 36px;
    border-radius: 10px;
  }

  .icon-btn svg {
    width: 17px;
    height: 17px;
  }

  #fullBtn {
    display: none;
  }

  .compass,
  .stage-nav,
  .stage-foot {
    display: none;
  }

  .mobile-groups {
    position: absolute;
    z-index: 7;
    top: calc(62px + env(safe-area-inset-top));
    left: 50%;
    display: flex;
    gap: 2px;
    padding: 3px;
    border: 1px solid rgba(255, 255, 255, 0.09);
    border-radius: 999px;
    background: rgba(10, 13, 18, 0.5);
    transform: translateX(-50%);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
  }

  .mobile-group {
    height: 27px;
    padding: 0 12px;
    border-radius: 999px;
    color: var(--muted);
    font-size: 10px;
    letter-spacing: 0.06em;
    transition: background 180ms ease, color 180ms ease;
  }

  .mobile-group em {
    margin-left: 2px;
    font-style: normal;
    font-size: 8px;
    opacity: 0.6;
  }

  .mobile-group.is-active {
    background: rgba(227, 181, 102, 0.17);
    color: var(--gold);
  }

  .mobile-rail-wrap {
    display: block;
  }

  .drag-hint {
    bottom: calc(108px + env(safe-area-inset-bottom));
    font-size: 10px;
  }

  .loading-pill {
    top: calc(108px + env(safe-area-inset-top));
  }

  .toast {
    bottom: calc(118px + env(safe-area-inset-bottom));
  }
}

@media (max-width: 380px) {
  .current h1 {
    font-size: 18px;
  }

  .top-actions {
    gap: 4px;
  }

  .icon-btn {
    width: 34px;
    height: 34px;
  }

  .top-actions .pill-btn {
    width: 34px;
  }

  .rail-item {
    flex-basis: 64px;
  }

  .rail-thumb {
    width: 50px;
    height: 50px;
  }
}

@media (max-height: 520px) and (max-width: 900px) {
  .mobile-groups {
    display: none;
  }

  .topbar {
    padding-top: calc(8px + env(safe-area-inset-top));
  }

  .mobile-rail-wrap {
    padding-top: 8px;
  }

  .mobile-rail {
    padding-top: 4px;
    padding-bottom: calc(6px + env(safe-area-inset-bottom));
  }

  .rail-item {
    flex-basis: 56px;
  }

  .rail-thumb {
    width: 42px;
    height: 42px;
  }

  .rail-item span {
    font-size: 8.5px;
  }

  .drag-hint {
    display: none;
  }

  .loading-pill {
    top: calc(58px + env(safe-area-inset-top));
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
