/* Floor Pulse — BanterBubbles clone */

:root {
  --bg: #080808;
  --text: #e0e2e6;
  --dim: rgba(255,255,255,0.4);
  --faint: rgba(255,255,255,0.06);
  --gold: #ffd700;
  --silver: #c0c0c0;
  --bronze: #cd7f32;
  --green: #00e676;
  --red: #ff1744;
  --rail-w: 36px;
  --chrome-h: 24px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; overflow: hidden; background: var(--bg); }
body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  color: var(--text); -webkit-font-smoothing: antialiased;
}
body.is-locked { overflow: hidden; }

/* ── Password ───────────────────── */
.password-screen {
  position: fixed; inset: 0; z-index: 200;
  display: grid; place-items: center;
  background: rgba(0,0,0,0.95);
}
.password-card {
  width: min(360px, 88vw); padding: 24px;
  border: 1px solid var(--faint); border-radius: 8px;
  background: #0e0e10;
}
.password-card h2 { font-size: 1rem; font-weight: 700; }
.password-copy { margin: 6px 0 0; color: var(--dim); font-size: 0.72rem; }
.password-form { display: flex; gap: 6px; margin-top: 12px; }
.pw-field {
  flex: 1; border: 1px solid var(--faint); border-radius: 4px;
  background: rgba(255,255,255,0.03);
}
.pw-field input {
  width: 100%; padding: 5px 8px; border: 0; outline: 0;
  background: transparent; color: var(--text); font: inherit; font-size: 0.76rem;
}
.pw-btn {
  padding: 5px 14px; border: 1px solid var(--faint); border-radius: 4px;
  background: rgba(255,255,255,0.05); color: var(--text);
  font: inherit; font-size: 0.68rem; font-weight: 700; cursor: pointer;
}
.pw-btn:hover { background: rgba(255,255,255,0.1); }
.password-error { margin: 6px 0 0; color: var(--red); font-size: 0.68rem; }

/* ── Left Rail ──────────────────── */
.left-rail {
  position: fixed; top: 0; left: 0; bottom: 0;
  width: var(--rail-w); z-index: 50;
  display: flex; flex-direction: column; align-items: center;
  padding: 4px 0 8px;
  background: #060606;
  border: 0;
}
.rail-brand {
  width: 24px; height: 24px; margin-bottom: 6px;
  display: grid; place-items: center; border-radius: 6px;
  background: linear-gradient(135deg, #ff9c40, #ff6a14);
  color: #000; font-size: 0.42rem; font-weight: 800;
}
.rail-icon {
  width: 26px; height: 26px; margin: 1px 0;
  display: grid; place-items: center;
  border: 0; border-radius: 6px;
  background: transparent; color: rgba(255,255,255,0.3);
  font: inherit; font-size: 0.46rem; font-weight: 700;
  cursor: pointer; transition: all 80ms ease;
}
.rail-icon:hover { color: var(--text); }
.rail-icon.is-active {
  background: rgba(0,230,118,0.1); color: var(--green);
}
.rail-icon span { pointer-events: none; }
.rail-spacer { flex: 1; }

/* ── App Main ───────────────────── */
.app-main {
  position: absolute;
  top: 0; left: var(--rail-w); right: 0; bottom: 0;
  display: flex; flex-direction: column;
  overflow: hidden;
}

/* ── Topbar ──────────────────────── */
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  height: var(--chrome-h); min-height: var(--chrome-h);
  padding: 0 8px;
  background: #0a0a0a;
  border: 0;
  flex-shrink: 0; z-index: 10;
  gap: 4px;
}
.tb-left, .tb-center, .tb-right {
  display: flex; align-items: center; gap: 4px;
}
.tb-left { flex-shrink: 0; }
.tb-center { flex: 1; justify-content: center; overflow-x: auto; overflow-y: hidden; }
.tb-center::-webkit-scrollbar { height: 0; }
.tb-right { flex-shrink: 0; }
.tb-logo { font-size: 0.56rem; font-weight: 700; color: rgba(255,255,255,0.5); }
.tb-label { font-size: 0.46rem; font-weight: 500; color: rgba(255,255,255,0.3); white-space: nowrap; }
.tb-sep { color: rgba(255,255,255,0.06); font-size: 0.5rem; }
.tb-metric {
  font-size: 0.46rem; font-weight: 700; color: var(--green);
  padding: 1px 6px; border-radius: 3px;
  background: rgba(0,230,118,0.06);
}
.tb-chips { display: flex; gap: 0; align-items: center; flex-shrink: 0; }
.tb-chip {
  padding: 1px 6px;
  font: inherit; font-size: 0.44rem; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.02em;
  border: 0; border-radius: 3px;
  background: transparent; color: rgba(255,255,255,0.3);
  cursor: pointer; transition: all 80ms ease; white-space: nowrap;
}
.tb-chip:hover { color: var(--text); }
.tb-chip.is-active {
  background: rgba(0,230,118,0.1); color: var(--green); font-weight: 700;
}
.tb-select {
  padding: 1px 4px; border: 0; border-radius: 3px;
  background: transparent; color: rgba(255,255,255,0.3);
  font: inherit; font-size: 0.44rem; appearance: none; cursor: pointer;
}
.tb-search {
  padding: 1px 6px; width: 60px;
  border: 1px solid rgba(255,255,255,0.04); border-radius: 3px;
  background: transparent; color: var(--text);
  font: inherit; font-size: 0.44rem; outline: none;
}
.tb-search::placeholder { color: rgba(255,255,255,0.15); }
.tb-btn {
  padding: 1px 6px; border: 0; border-radius: 3px;
  background: transparent; color: rgba(255,255,255,0.25);
  font: inherit; font-size: 0.42rem; font-weight: 700; letter-spacing: 0.04em;
  cursor: pointer;
}
.tb-btn:hover { color: var(--text); }

/* ── Ticker (merged into a thin strip) ── */
.ticker {
  height: 18px; min-height: 18px;
  display: flex; align-items: center;
  background: #060606;
  border: 0;
  flex-shrink: 0; overflow: hidden;
  position: relative;
}
.ticker-badge {
  flex-shrink: 0; padding: 0 6px;
  background: var(--green);
  color: #000; font-size: 0.38rem; font-weight: 800; letter-spacing: 0.1em;
  height: 100%; display: flex; align-items: center;
  z-index: 2;
}
.ticker-track {
  display: inline-flex; gap: 14px; align-items: center;
  min-width: max-content; height: 100%;
  padding-left: 100%;
  animation: ticker-scroll 28s linear infinite;
  white-space: nowrap;
}
.ticker-item {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 0.46rem; font-weight: 600;
}
.ticker-name { font-weight: 700; font-size: 0.48rem; }
.ticker-val { color: rgba(255,255,255,0.3); font-size: 0.44rem; }
.ticker-sep { color: rgba(255,255,255,0.06); margin: 0 1px; }

.medal-0 { color: var(--gold) !important; text-shadow: 0 0 4px rgba(255,215,0,0.3); }
.medal-1 { color: var(--silver) !important; }
.medal-2 { color: var(--bronze) !important; }

/* ── Board ──────────────────────── */
.board {
  flex: 1; position: relative; overflow: hidden;
  background: var(--bg);
}
#bubble-chart { width: 100%; height: 100%; display: block; }
.board-legend {
  position: absolute; top: 6px; right: 32px;
  display: flex; gap: 10px; font-size: 0.42rem; color: rgba(255,255,255,0.25);
  z-index: 3; pointer-events: none;
}
.legend-item { display: inline-flex; align-items: center; gap: 3px; }
.ldot { width: 5px; height: 5px; border-radius: 999px; }
.ldot-low { background: var(--red); box-shadow: 0 0 4px var(--red); }
.ldot-mid { background: #777; box-shadow: 0 0 3px rgba(120,120,120,0.3); }
.ldot-high { background: var(--green); box-shadow: 0 0 4px var(--green); }

.board-info {
  position: absolute; bottom: 6px; left: 8px;
  display: flex; gap: 6px; z-index: 3; pointer-events: none;
}
.board-pill {
  padding: 1px 6px; font-size: 0.38rem; font-weight: 500;
  border: 0; border-radius: 999px;
  background: rgba(0,0,0,0.4); color: rgba(255,255,255,0.2);
}
.board-brand {
  position: absolute; bottom: 8px; right: 32px;
  font-size: 0.62rem; font-weight: 400; color: rgba(255,255,255,0.06);
  z-index: 3; pointer-events: none;
}
.board-brand strong { font-weight: 700; }

.empty-state {
  position: absolute; inset: 0;
  display: grid; place-content: center;
  background: rgba(8,8,8,0.95);
  font-size: 0.76rem; color: var(--dim);
}

/* ── Bubble SVG ─────────────────── */
.bubble-node { cursor: pointer; }
.bubble-core { transition: stroke-width 150ms ease; }
.bubble-rank-ring { fill: none; }
.bubble-aura { opacity: 0.06; }
.bubble-node.is-selected .bubble-core { stroke-width: 3.5; }
.bubble-node text {
  fill: var(--text); text-anchor: middle; dominant-baseline: middle;
  pointer-events: none;
}
.bubble-symbol {
  fill: rgba(255,255,255,0.55);
  font-family: 'Inter', sans-serif; font-weight: 700;
}
.bubble-name {
  font-family: 'Inter', sans-serif; font-weight: 700; letter-spacing: -0.01em;
}
.bubble-delta { fill: rgba(255,255,255,0.6); font-weight: 600; }
.bubble-stars {
  fill: var(--gold); font-weight: 700;
  paint-order: stroke; stroke: rgba(0,0,0,0.8); stroke-width: 2px;
}

/* ── Right Panel ────────────────── */
.right-panel {
  position: absolute; top: 0; right: 0; bottom: 0;
  width: 22px; z-index: 30;
  background: rgba(8,8,8,0.95);
  border: 0;
  overflow: hidden;
  transition: width 160ms cubic-bezier(0.4,0,0.2,1);
}
.right-panel:hover, .right-panel.is-pinned {
  width: min(260px, 22vw);
}
.panel-toggle {
  position: absolute; top: 4px; left: 4px; z-index: 3;
  width: 14px; height: 14px;
  display: grid; place-items: center;
  border: 0; border-radius: 3px;
  background: transparent; color: rgba(255,255,255,0.2);
  font: inherit; font-size: 0.5rem; cursor: pointer;
}
.right-panel:hover .panel-toggle,
.right-panel.is-pinned .panel-toggle {
  color: var(--green);
}
.panel-content {
  display: flex; flex-direction: column; gap: 5px;
  padding: 22px 7px 7px;
  height: 100%; overflow-y: auto;
  opacity: 0; transform: translateX(6px);
  transition: opacity 120ms ease, transform 120ms ease;
}
.right-panel:hover .panel-content,
.right-panel.is-pinned .panel-content {
  opacity: 1; transform: translateX(0);
}

.detail-card, .stat-card, .panel-block {
  border: 0; border-radius: 4px;
  background: rgba(255,255,255,0.015); padding: 8px;
}
.detail-kicker {
  font-size: 0.4rem; font-weight: 700; color: rgba(255,255,255,0.25);
  letter-spacing: 0.08em; text-transform: uppercase;
}
h3 { font-size: 0.8rem; font-weight: 700; margin-top: 2px; }
h4 { font-size: 0.62rem; font-weight: 700; }
.detail-subtitle { margin: 3px 0 0; color: var(--dim); font-size: 0.52rem; }
.block-sub { color: var(--dim); font-size: 0.46rem; margin: 1px 0 4px; }

.focus-strip {
  display: flex; align-items: flex-end; justify-content: space-between;
  margin-top: 6px; padding-top: 6px;
  border-top: 1px solid rgba(255,255,255,0.03);
}
.focus-label {
  font-size: 0.4rem; font-weight: 700; color: rgba(255,255,255,0.25);
  letter-spacing: 0.06em; text-transform: uppercase;
}
.focus-value { display: block; margin-top: 1px; font-size: 1.1rem; font-weight: 700; }
.focus-delta { font-size: 0.64rem; font-weight: 700; }
.delta-positive { color: var(--green); }
.delta-negative { color: var(--red); }
.delta-neutral { color: rgba(255,255,255,0.3); }

.stat-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 3px; }
.stat-card { padding: 6px; }
.stat-card strong { display: block; margin-top: 1px; font-size: 0.7rem; }
.stat-card span { color: var(--dim); font-size: 0.46rem; }

.story-list { display: grid; gap: 3px; list-style: none; }
.story-list li {
  padding: 5px 6px; border-radius: 3px;
  background: rgba(255,255,255,0.015);
  font-size: 0.52rem; line-height: 1.35; color: rgba(255,255,255,0.5);
}

.leaderboard { display: grid; gap: 2px; }
.leader-row {
  display: grid; grid-template-columns: auto 1fr auto; gap: 5px;
  align-items: center; padding: 3px 5px; border-radius: 3px;
}
.leader-rank {
  width: 16px; height: 16px;
  display: grid; place-items: center;
  border-radius: 999px; border: 1px solid rgba(255,255,255,0.05);
  font-size: 0.44rem; font-weight: 700; color: rgba(255,255,255,0.3);
}
.leader-name { font-weight: 700; font-size: 0.52rem; }
.leader-meta { display: flex; flex-direction: column; }
.leader-meta span { color: rgba(255,255,255,0.25); font-size: 0.42rem; }
.leader-row strong { font-size: 0.52rem; }
.leader-row p, .leader-row span { margin: 0; }

.source-grid { display: grid; gap: 4px; margin-top: 3px; }
.src-label {
  font-size: 0.38rem; font-weight: 700; color: rgba(255,255,255,0.2);
  letter-spacing: 0.06em; text-transform: uppercase;
}
.source-grid code {
  display: block; margin-top: 1px; color: rgba(255,255,255,0.5);
  font-size: 0.48rem; word-break: break-word;
}

.hidden { display: none !important; }

@keyframes ticker-scroll {
  from { transform: translateX(0); }
  to { transform: translateX(-50%); }
}

@media (max-width: 800px) {
  .left-rail { display: none; }
  .app-main { left: 0; }
  .topbar { height: 22px; min-height: 22px; }
  .ticker { height: 16px; min-height: 16px; }
  .right-panel {
    position: fixed; top: auto; left: 0; right: 0; bottom: 0;
    width: 100% !important; height: 20px;
    border-top: 1px solid var(--faint); transition: height 160ms ease;
  }
  .right-panel:hover, .right-panel.is-pinned {
    width: 100% !important; height: 50vh; overflow-y: auto;
  }
  .panel-toggle { top: 2px; left: 50%; transform: translateX(-50%); }
  .panel-content { padding: 20px 8px 8px; }
  .password-form { flex-direction: column; }
}
