body { overflow: hidden; }
.app-bg { position: fixed; inset: -20px; z-index: 0; background: url(/assets/plate-lake.jpg) center / cover; filter: blur(14px) brightness(.35) saturate(1.2); }
.glass { background: var(--glass); border: 1px solid var(--line); backdrop-filter: blur(16px) saturate(1.2); }

/* ---------- top bar ---------- */
.bar { position: fixed; top: 0; left: 0; right: 0; z-index: 30; height: 72px; display: flex; align-items: center; gap: 14px; padding: 0 20px; border-bottom: 1px solid var(--line); background: rgba(8, 5, 26, .55); backdrop-filter: blur(16px); }
.brand { display: flex; align-items: center; gap: 10px; }
.brand__mark { width: 36px; height: 36px; display: grid; place-items: center; border-radius: 10px; background: linear-gradient(135deg, #9d7bff, #4c2fd6); color: #fff; }
.brand__mark svg { width: 24px; height: 24px; }
.brand__word { font-weight: 700; letter-spacing: .06em; font-size: 14px; }
.bar__right { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.status { display: inline-flex; align-items: center; gap: 8px; height: 32px; padding: 0 12px; border: 1px solid var(--line); border-radius: 999px; font-size: 11px; color: var(--ink-2); white-space: nowrap; }
.status__dot { width: 7px; height: 7px; border-radius: 50%; background: var(--ink-3); }
.status.live .status__dot { background: var(--jade); box-shadow: 0 0 10px var(--jade); animation: pulse 2s infinite; }
.status.rehearsal .status__dot { background: var(--amber); }
@keyframes pulse { 50% { opacity: .35; } }

/* ---------- rail (Murmur-style tabs) ---------- */
.rail { position: fixed; top: 72px; bottom: 0; left: 0; z-index: 25; width: 84px; display: flex; flex-direction: column; align-items: stretch; gap: 2px; padding: 10px 8px; border-right: 1px solid var(--line); background: rgba(8, 5, 26, .45); backdrop-filter: blur(16px); overflow-y: auto; }
.rail button, .rail a { display: flex; flex-direction: column; align-items: center; gap: 5px; padding: 10px 4px; border-radius: 10px; color: var(--ink-2); font-size: 10.5px; text-align: center; transition: background .2s, color .2s; }
.rail svg { width: 20px; height: 20px; }
.rail button:hover, .rail a:hover { background: rgba(139, 108, 255, .12); color: #fff; }
.rail button.on { background: rgba(139, 108, 255, .22); color: #fff; box-shadow: inset 2px 0 0 var(--accent); }
.rail__sep { height: 1px; margin: 8px 10px; background: var(--line); }

/* ---------- stage ---------- */
.stage { position: fixed; top: 72px; left: 84px; right: 0; bottom: 0; z-index: 5; }
.swarm-canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.toolbar { position: absolute; top: 16px; left: 16px; display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 10px; border-radius: 14px; max-width: calc(100% - 32px); }
.search { width: 220px; height: 34px; padding: 0 14px; border-radius: 999px; border: 1px solid var(--line-2); background: rgba(0, 0, 0, .25); color: var(--ink); font-size: 12px; outline: none; }
.search:focus { border-color: var(--accent-2); }
.chip { height: 34px; padding: 0 16px; border-radius: 999px; border: 1px solid var(--line-2); font-family: var(--mono); font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-2); transition: all .2s; }
.chip.on { background: rgba(139, 108, 255, .28); border-color: var(--accent); color: #fff; }

.spark { position: absolute; top: 84px; left: 16px; width: 200px; padding: 10px 12px 8px; border-radius: 12px; }
.spark--r { left: auto; right: 16px; top: 16px; }
.spark canvas { width: 100%; height: 54px; display: block; }
.spark p { margin-top: 4px; font-size: 10px; color: var(--ink-3); }

.legend { position: absolute; left: 16px; bottom: 16px; width: 290px; padding: 14px 16px; border-radius: 14px; }
.legend__title { font-size: 11px; letter-spacing: .14em; color: var(--ink-2); margin-bottom: 10px; }
.legend__irises { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px 10px; font-size: 12px; }
.legend__irises span { display: flex; align-items: center; gap: 6px; }
.legend__irises i { width: 9px; height: 9px; border-radius: 50%; }
.legend__lines { display: flex; flex-wrap: wrap; gap: 6px 14px; margin: 12px 0 10px; font-size: 11px; color: var(--ink-2); }
.legend__lines span { display: inline-flex; align-items: center; gap: 6px; }
.ln { display: inline-block; width: 18px; height: 0; border-top: 2px solid; }
.ln--bond { border-color: var(--jade); }
.ln--glare { border-color: var(--crimson); border-top-style: dashed; }
.ln--kin { border-color: rgba(185, 176, 217, .5); }
.bead { width: 8px; height: 8px; border-radius: 50%; border: 1px solid var(--ink-3); }
.legend__foot { font-size: 11px; color: var(--ink-3); }

.tip { position: absolute; z-index: 10; pointer-events: none; padding: 10px 12px; border-radius: 10px; font-size: 11px; line-height: 1.55; min-width: 180px; }
.tip b { font-family: var(--display); font-size: 13px; font-weight: 600; color: #fff; }
.big3d { position: absolute; left: 50%; bottom: 18px; transform: translateX(-50%); padding: 14px 34px; border-radius: 999px; font-family: var(--mono); font-size: 13px; letter-spacing: .12em; text-transform: uppercase; color: #fff; background: linear-gradient(180deg, #9b7dff, #5a36e6); box-shadow: 0 10px 40px rgba(110, 76, 255, .45), inset 0 1px 0 rgba(255, 255, 255, .35); transition: transform .3s var(--ease-out); }
.big3d:hover { transform: translateX(-50%) translateY(-2px); }

/* ---------- drawer ---------- */
.drawer { position: fixed; top: 72px; right: 0; bottom: 0; z-index: 28; width: min(440px, 100vw); display: flex; flex-direction: column; border-radius: 0; border-width: 0 0 0 1px; background: rgba(12, 8, 34, .82); transform: translateX(102%); transition: transform .6s var(--ease); }
.drawer.on { transform: none; }
.drawer__head { position: relative; padding: 20px 22px 14px; border-bottom: 1px solid var(--line); }
.drawer__kicker { font-size: 10px; letter-spacing: .14em; color: var(--accent-2); }
.drawer__head h2 { font-size: 24px; font-weight: 500; margin-top: 4px; }
.drawer__close { position: absolute; top: 18px; right: 18px; width: 32px; height: 32px; border-radius: 50%; border: 1px solid var(--line-2); color: var(--ink-2); }
.drawer__close:hover { color: #fff; border-color: var(--accent-2); }
.drawer__body { flex: 1; overflow-y: auto; padding: 16px 22px 40px; }
.drawer__body::-webkit-scrollbar { width: 6px; } .drawer__body::-webkit-scrollbar-thumb { background: var(--line-2); border-radius: 3px; }

.books { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 14px; }
.books button { padding: 6px 10px; border-radius: 999px; border: 1px solid var(--line); font-size: 11px; font-family: var(--mono); color: var(--ink-2); }
.books button.on { border-color: var(--accent); background: rgba(139, 108, 255, .22); color: #fff; }
.entry { display: grid; grid-template-columns: 52px 1fr; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--line); font-size: 13px; line-height: 1.45; }
.entry.new { animation: in .6s var(--ease-out); }
.entry em { font-style: normal; font-family: var(--mono); font-size: 10px; color: var(--ink-3); padding-top: 2px; }
.entry[data-book="thefts"] p::before { content: '◉ '; color: var(--crimson); }
.entry[data-book="gifts"] p::before { content: '◉ '; color: var(--jade); }
.entry[data-book="annals"] p::before { content: '◉ '; color: var(--accent-2); }
.entry[data-book="oaths"] p::before { content: '◉ '; color: var(--amber); }
.entry[data-book="market"] p::before { content: '◉ '; color: var(--azure); }
@keyframes in { from { opacity: 0; transform: translateY(6px); } }

.card { padding: 14px; border: 1px solid var(--line); border-radius: 12px; margin-bottom: 10px; background: rgba(255, 255, 255, .02); }
.card h3 { font-size: 15px; font-weight: 600; display: flex; align-items: center; gap: 8px; }
.card h3 i { width: 12px; height: 12px; border-radius: 50%; }
.card p { font-size: 12.5px; color: var(--ink-2); line-height: 1.5; margin-top: 6px; }
.meter { height: 6px; border-radius: 3px; background: rgba(255, 255, 255, .06); margin-top: 10px; overflow: hidden; }
.meter i { display: block; height: 100%; border-radius: 3px; }
.kv { display: grid; grid-template-columns: 110px 1fr; gap: 8px 12px; font-size: 12px; }
.kv dt { color: var(--ink-3); font-family: var(--mono); font-size: 11px; }
.kv dd { font-family: var(--mono); word-break: break-all; }
.kv a { color: var(--accent-2); }
.hist { display: flex; align-items: flex-end; gap: 3px; height: 90px; margin: 10px 0 4px; }
.hist i { flex: 1; background: linear-gradient(180deg, var(--accent-2), var(--accent)); border-radius: 2px 2px 0 0; min-height: 2px; }
.code { font-family: var(--mono); font-size: 11.5px; padding: 12px; border-radius: 10px; background: rgba(0, 0, 0, .35); border: 1px solid var(--line); white-space: pre-wrap; word-break: break-all; color: var(--ink-2); }
.drawer__body h4 { font-size: 11px; font-family: var(--mono); letter-spacing: .12em; text-transform: uppercase; color: var(--ink-3); margin: 18px 0 8px; }
.drawer__body ol { padding-left: 18px; font-size: 13px; line-height: 1.6; color: var(--ink-2); }
.drawer__body ol li { margin-bottom: 8px; }
.drawer__body ol b { color: #fff; font-weight: 500; }
.tx { display: flex; justify-content: space-between; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--line); font-family: var(--mono); font-size: 11.5px; }
.tx a { color: var(--accent-2); }
.empty { color: var(--ink-3); font-size: 13px; line-height: 1.6; padding: 12px 0; }

/* ---------- responsive ---------- */
@media (max-width: 1150px) { .status { display: none; } }
@media (max-width: 900px) {
  .ca-pill b, .sound span:first-child { display: none; }
  .spark, .legend { display: none; }
}
@media (max-width: 640px) {
  .bar { height: 60px; padding: 0 12px; gap: 8px; }
  .brand__word, .lg-only, .sound { display: none; }
  .brand__mark { width: 34px; height: 34px; }
  .bar__right { gap: 6px; margin-left: 0; }
  .bar .btn { height: 34px; }
  .bar .btn--icon { width: 34px; }
  .bar .btn--solid { padding: 0 10px; }
  .ca-pill { flex: 1; min-width: 0; height: 34px; gap: 6px; padding: 0 4px 0 8px; font-size: 11px; }
  .ca-pill .addr { overflow: hidden; text-overflow: ellipsis; }
  .ca-pill .copy { height: 24px; padding: 0 7px; font-size: 10px; }
  .toolbar { padding: 8px; gap: 6px; top: 10px; left: 10px; right: 10px; }
  .chip { height: 30px; padding: 0 11px; font-size: 10px; }
  .search { height: 32px; }
  .rail { top: auto; bottom: 0; left: 0; right: 0; width: auto; height: 64px; flex-direction: row; padding: 6px; border-right: 0; border-top: 1px solid var(--line); overflow-x: auto; }
  .rail button, .rail a { min-width: 64px; padding: 6px 4px; }
  .rail__sep { display: none; }
  .stage { top: 60px; left: 0; bottom: 64px; }
  .drawer { top: 60px; bottom: 64px; }
  .search { width: 100%; }
  .big3d { display: none; }
}
