/* ==========================================================================
   cn-intelligence — signal desk
   A dark editorial console: ink, paper, vermilion, jade.
   ========================================================================== */

:root {
  --bg: #0a0c0d;
  --bg-2: #0d1113;
  --panel: #101416;
  --panel-2: #121719;
  --ink: #e9e4d8;
  --ink-2: #a7a297;
  --ink-3: #6d6961;
  --line: rgba(233, 228, 216, 0.09);
  --line-2: rgba(233, 228, 216, 0.17);
  --red: #ff4b3e;
  --jade: #3dd6a3;
  --gold: #e6b45c;
  --blue: #5b8cff;

  --serif: "Noto Serif SC", "Songti SC", "Source Han Serif SC", "STSong", Georgia, serif;
  --sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
          "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  --mono: "JetBrains Mono", "SFMono-Regular", ui-monospace, Menlo, Consolas, monospace;

  --rail: 216px;
  --radius: 4px;
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 14px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

::selection { background: rgba(255, 75, 62, 0.28); color: #fff; }

a { color: inherit; }

button, input { font: inherit; color: inherit; }

/* -- atmosphere ---------------------------------------------------------- */

.ambient {
  position: fixed;
  inset: 0;
  z-index: -2;
  background:
    radial-gradient(900px 520px at 78% -8%, rgba(255, 75, 62, 0.10), transparent 62%),
    radial-gradient(760px 480px at 4% 102%, rgba(61, 214, 163, 0.07), transparent 60%),
    radial-gradient(600px 400px at 40% 40%, rgba(91, 140, 255, 0.04), transparent 70%);
}

.grain {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  opacity: 0.035;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.8' numOctaves='3'/%3E%3C/filter%3E%3Crect width='160' height='160' filter='url(%23n)' opacity='0.6'/%3E%3C/svg%3E");
}

/* -- rail ---------------------------------------------------------------- */

.rail {
  position: fixed;
  inset: 0 auto 0 0;
  width: var(--rail);
  padding: 28px 20px 22px;
  display: flex;
  flex-direction: column;
  border-right: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.018), transparent 40%);
  z-index: 30;
}

.brand { display: flex; align-items: baseline; gap: 8px; }

.brand-mark {
  font-family: var(--serif);
  font-size: 26px;
  font-weight: 700;
  letter-spacing: -0.03em;
  color: var(--red);
  line-height: 1;
}

.brand-word {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.14em;
  color: var(--ink);
  white-space: nowrap;
}

.brand-sub {
  margin-top: 8px;
  font-size: 11px;
  letter-spacing: 0.16em;
  color: var(--ink-3);
}

.nav {
  margin-top: 34px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--line-2) transparent;
}

.nav::-webkit-scrollbar { width: 4px; }
.nav::-webkit-scrollbar-thumb { background: var(--line-2); border-radius: 2px; }

.nav-item {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  border: 0;
  border-radius: 3px;
  background: transparent;
  color: var(--ink-2);
  cursor: pointer;
  text-align: left;
  transition: background 0.15s ease, color 0.15s ease;
}

.nav-item:hover { background: rgba(255, 255, 255, 0.035); color: var(--ink); }

.nav-item.active { background: rgba(255, 255, 255, 0.055); color: var(--ink); }

.nav-item.active::before {
  content: "";
  position: absolute;
  left: -20px;
  top: 6px;
  bottom: 6px;
  width: 2px;
  background: var(--pc, var(--red));
}

.nav-dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--pc, var(--ink-3));
  flex: none;
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--pc, #888) 14%, transparent);
}

.nav-label { flex: 1; font-size: 13px; }

.nav-count {
  font-family: var(--mono);
  font-size: 10px;
  color: var(--ink-3);
}

.nav-item.nav-all .nav-dot {
  background: conic-gradient(var(--red), var(--gold), var(--jade), var(--blue), var(--red));
}

.nav-group-label {
  margin: 16px 10px 4px;
  font-size: 9px;
  letter-spacing: 0.18em;
  color: var(--ink-3);
  text-transform: uppercase;
}

.rail-foot { margin-top: auto; flex: none; padding-top: 20px; border-top: 1px solid var(--line); }

.conn { display: flex; align-items: center; gap: 8px; font-size: 11px; color: var(--ink-3); }

.led { width: 7px; height: 7px; border-radius: 50%; background: var(--ink-3); flex: none; }

.led.ok { background: var(--jade); box-shadow: 0 0 8px rgba(61, 214, 163, 0.7); }
.led.warn { background: var(--gold); }
.led.bad { background: var(--red); box-shadow: 0 0 8px rgba(255, 75, 62, 0.6); }
.led.live { animation: pulse 1.8s ease-in-out infinite; }

.nav-dot.override {
  background: var(--gold);
  box-shadow: 0 0 0 3px rgba(230, 180, 92, 0.14);
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.35; }
}

.rail-note { margin-top: 10px; font-size: 10px; color: var(--ink-3); line-height: 1.5; }

/* -- main ---------------------------------------------------------------- */

.main {
  margin-left: var(--rail);
  min-height: 100%;
  display: flex;
  flex-direction: column;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 20px 34px 18px;
  border-bottom: 1px solid var(--line);
  background: rgba(10, 12, 13, 0.82);
  backdrop-filter: blur(14px);
}

.topbar-title h1 {
  margin: 0;
  font-family: var(--serif);
  font-size: 25px;
  font-weight: 600;
  letter-spacing: 0.01em;
  line-height: 1.15;
}

.topbar-title p {
  margin: 3px 0 0;
  font-size: 11px;
  color: var(--ink-3);
  letter-spacing: 0.05em;
}

.topbar-tools { display: flex; align-items: center; gap: 10px; }

.search {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 240px;
  padding: 0 10px;
  height: 34px;
  border: 1px solid var(--line-2);
  border-radius: 3px;
  background: rgba(255, 255, 255, 0.025);
  transition: border-color 0.15s ease, background 0.15s ease;
}

.search:focus-within { border-color: rgba(255, 75, 62, 0.55); background: rgba(255, 255, 255, 0.04); }

.search svg { width: 14px; height: 14px; fill: none; stroke: var(--ink-3); stroke-width: 1.6; flex: none; }

.search input {
  flex: 1;
  min-width: 0;
  border: 0;
  outline: 0;
  background: transparent;
  font-size: 12px;
}

.search input::placeholder { color: var(--ink-3); }

kbd {
  font-family: var(--mono);
  font-size: 10px;
  color: var(--ink-3);
  border: 1px solid var(--line-2);
  border-radius: 2px;
  padding: 0 4px;
  line-height: 15px;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 34px;
  padding: 0 13px;
  border: 1px solid var(--line-2);
  border-radius: 3px;
  background: rgba(255, 255, 255, 0.025);
  color: var(--ink-2);
  font-size: 12px;
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
}

.btn:hover { color: var(--ink); border-color: var(--line-2); background: rgba(255, 255, 255, 0.06); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: 0.4; cursor: default; }

.btn svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 1.7; }

.btn.spinning svg { animation: spin 0.9s linear infinite; }

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

.btn-ghost { border-color: transparent; }

.switch {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  cursor: pointer;
  user-select: none;
  font-size: 11px;
  color: var(--ink-3);
}

.switch input { position: absolute; opacity: 0; pointer-events: none; }

.switch-track {
  width: 30px; height: 16px;
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.09);
  border: 1px solid var(--line-2);
  position: relative;
  transition: background 0.15s ease;
}

.switch-track i {
  position: absolute;
  top: 2px; left: 2px;
  width: 10px; height: 10px;
  border-radius: 50%;
  background: var(--ink-3);
  transition: transform 0.18s ease, background 0.18s ease;
}

.switch input:checked + .switch-track { background: rgba(61, 214, 163, 0.22); border-color: rgba(61, 214, 163, 0.45); }
.switch input:checked + .switch-track i { transform: translateX(14px); background: var(--jade); }

.clock {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--ink-3);
  letter-spacing: 0.08em;
  min-width: 68px;
  text-align: right;
}

/* -- ticker -------------------------------------------------------------- */

.ticker {
  overflow: hidden;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.012);
  height: 30px;
  display: flex;
  align-items: center;
}

.ticker-track {
  display: flex;
  width: max-content;
  will-change: transform;
  animation: marquee 70s linear infinite;
}

.ticker-copy {
  display: flex;
  gap: 34px;
  padding-right: 34px;
  white-space: nowrap;
}

.ticker:hover .ticker-track { animation-play-state: paused; }

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

.ticker-item {
  font-size: 11px;
  color: var(--ink-3);
  display: inline-flex;
  align-items: center;
  gap: 7px;
}

.ticker-item b {
  font-family: var(--mono);
  font-weight: 500;
  font-size: 9px;
  color: var(--pc, var(--red));
  letter-spacing: 0.08em;
}

/* -- content ------------------------------------------------------------- */

.content { padding: 26px 34px 90px; max-width: 1560px; width: 100%; }

.banner {
  margin: 14px 34px 0;
  padding: 10px 14px;
  border: 1px solid rgba(255, 75, 62, 0.35);
  background: rgba(255, 75, 62, 0.07);
  border-radius: var(--radius);
  color: #ffb3ac;
  font-size: 12px;
}

/* stats */

.stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-bottom: 22px;
}

.stat {
  position: relative;
  padding: 16px 16px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.022), transparent);
  overflow: hidden;
}

.stat::after {
  content: "";
  position: absolute;
  left: 0; right: 0; bottom: 0;
  height: 1px;
  background: linear-gradient(90deg, var(--sc, var(--red)), transparent 70%);
  opacity: 0.7;
}

.stat-num {
  font-family: var(--mono);
  font-size: 30px;
  line-height: 1;
  letter-spacing: -0.04em;
  color: var(--ink);
}

.stat-num small { font-size: 12px; color: var(--ink-3); margin-left: 4px; letter-spacing: 0; }

.stat-label {
  margin-top: 8px;
  font-size: 10px;
  letter-spacing: 0.14em;
  color: var(--ink-3);
  text-transform: uppercase;
}

.stat-sub { margin-top: 3px; font-size: 11px; color: var(--ink-2); }

/* section headings */

.section-head {
  display: flex;
  align-items: baseline;
  gap: 12px;
  margin: 30px 0 12px;
}

.section-head h2 {
  margin: 0;
  font-family: var(--serif);
  font-size: 17px;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.section-head .rule { flex: 1; height: 1px; background: var(--line); }

.section-head .hint { font-size: 11px; color: var(--ink-3); }

/* resonance */

.resonance { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }

.res-card {
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-left: 2px solid var(--gold);
  border-radius: var(--radius);
  background: linear-gradient(120deg, rgba(230, 180, 92, 0.06), transparent 55%);
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease;
}

.res-card:hover { background: rgba(230, 180, 92, 0.10); border-color: rgba(230, 180, 92, 0.35); }

.res-top { display: flex; align-items: center; gap: 6px; margin-bottom: 7px; flex-wrap: wrap; }

.res-title { font-size: 14px; font-weight: 500; line-height: 1.45; }

.res-items { margin-top: 8px; display: flex; flex-direction: column; gap: 3px; }

.res-mix {
  margin-top: 8px;
  font-family: var(--mono);
  font-size: 10px;
  color: var(--ink-3);
  letter-spacing: 0.02em;
}

.life-chip {
  display: inline-flex;
  align-items: center;
  height: 18px;
  padding: 0 6px;
  border: 1px solid var(--line-2);
  border-radius: 2px;
  font-size: 9px;
  color: var(--ink-3);
  white-space: nowrap;
}

.life-chip.new { color: var(--blue); border-color: rgba(91, 140, 255, 0.4); background: rgba(91, 140, 255, 0.08); }
.life-chip.rising { color: var(--jade); border-color: rgba(61, 214, 163, 0.4); background: rgba(61, 214, 163, 0.08); }
.life-chip.peaking { color: var(--gold); border-color: rgba(230, 180, 92, 0.4); background: rgba(230, 180, 92, 0.08); }
.life-chip.fading { color: var(--red); border-color: rgba(255, 75, 62, 0.4); background: rgba(255, 75, 62, 0.08); }

.conf {
  margin-left: auto;
  font-family: var(--mono);
  font-size: 9px;
  color: var(--ink-3);
}

.res-line {
  display: flex;
  gap: 8px;
  font-size: 11px;
  color: var(--ink-3);
}

.res-line span:first-child { flex: none; width: 30px; }

.res-line span:last-child {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* chips */

.chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 19px;
  padding: 0 7px;
  border-radius: 2px;
  font-size: 10px;
  letter-spacing: 0.04em;
  color: var(--pc, var(--ink-2));
  background: color-mix(in srgb, var(--pc, #888) 12%, transparent);
  border: 1px solid color-mix(in srgb, var(--pc, #888) 26%, transparent);
  white-space: nowrap;
}

.chip-solid {
  color: #0a0c0d;
  background: var(--pc, var(--ink-2));
  border-color: transparent;
  font-weight: 600;
}

.chip-warn {
  color: var(--gold);
  border-color: rgba(230, 180, 92, 0.45);
  background: rgba(230, 180, 92, 0.10);
}

.time-chip {
  font-family: var(--mono);
  font-size: 9.5px;
  color: var(--ink-3);
  white-space: nowrap;
  border-left: 1px solid var(--line);
  padding-left: 7px;
}

.time-chip b {
  color: var(--gold);
  font-weight: 600;
  margin-right: 4px;
}

.time-chip.old { color: var(--gold); }

.dot { width: 5px; height: 5px; border-radius: 50%; background: currentColor; }

/* signal rows */

.rows { border-top: 1px solid var(--line); }

.row {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr) 148px;
  gap: 14px;
  align-items: center;
  padding: 13px 12px;
  border-bottom: 1px solid var(--line);
  cursor: pointer;
  transition: background 0.13s ease;
  animation: rise 0.28s ease both;
}

.row:hover { background: rgba(255, 255, 255, 0.032); }

.row:hover .row-title { color: #fff; }

@keyframes rise {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: none; }
}

.rank {
  font-family: var(--mono);
  font-size: 13px;
  color: var(--ink-3);
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.rank.top { color: var(--red); }
.rank.top2 { color: var(--gold); }
.rank.top3 { color: var(--jade); }

.row-main { min-width: 0; }

.row-title {
  font-size: 14px;
  font-weight: 500;
  line-height: 1.45;
  color: var(--ink);
  transition: color 0.13s ease;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.title-en {
  margin-top: 2px;
  font-size: 11.5px;
  line-height: 1.4;
  color: var(--ink-3);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.snippet-line {
  margin-top: 2px;
  display: flex;
  align-items: baseline;
  gap: 5px;
  font-size: 11px;
  line-height: 1.45;
  color: var(--ink-3);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.snippet-badge {
  flex: none;
  font-family: var(--mono);
  font-size: 8px;
  letter-spacing: 0.06em;
  line-height: 14px;
  padding: 0 3px;
  color: var(--gold);
  border: 1px solid rgba(230, 180, 92, 0.35);
  background: rgba(230, 180, 92, 0.08);
  border-radius: 2px;
}

body.hide-snippets .snippet-line { display: none; }

.row-meta {
  margin-top: 4px;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  font-size: 11px;
  color: var(--ink-3);
}

.row-meta .sep { opacity: 0.4; }

.row-heat {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 5px;
}

.heat-num {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--ink-2);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.heat-bar {
  width: 100%;
  height: 2px;
  background: rgba(255, 255, 255, 0.07);
  border-radius: 2px;
  overflow: hidden;
}

.heat-bar i {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, color-mix(in srgb, var(--pc, var(--red)) 45%, transparent), var(--pc, var(--red)));
  border-radius: 2px;
  transition: width 0.6s cubic-bezier(0.22, 1, 0.36, 1);
}

/* platform hero */

.plat-hero {
  position: relative;
  padding: 22px 24px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background:
    radial-gradient(600px 120px at 0% 0%, color-mix(in srgb, var(--pc) 12%, transparent), transparent 70%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.02), transparent);
  overflow: hidden;
}

.plat-hero::before {
  content: "";
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 3px;
  background: var(--pc);
}

.plat-hero h1 {
  margin: 0;
  font-family: var(--serif);
  font-size: 28px;
  font-weight: 600;
}

.plat-hero .sub {
  margin-top: 6px;
  font-size: 11px;
  color: var(--ink-3);
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
}

.plat-hero .sub .sep { opacity: 0.4; }

.plat-hero .basis {
  margin-top: 7px;
  color: var(--ink-3);
  font-size: 10px;
  letter-spacing: 0.02em;
}

/* compliance audit */

.compliance { border-top: 1px solid var(--line); }

.comp-row {
  display: grid;
  grid-template-columns: 78px minmax(0, 1fr) 110px;
  gap: 12px;
  align-items: center;
  padding: 9px 2px;
  border-bottom: 1px solid var(--line);
  font-size: 11.5px;
}

.comp-basis { color: var(--ink-2); min-width: 0; }

.comp-freq {
  text-align: right;
  font-family: var(--mono);
  font-size: 10px;
  color: var(--ink-3);
  white-space: nowrap;
}

.comp-row.off { opacity: 0.5; }

.comp-row.override {
  border-left: 2px solid var(--gold);
  padding-left: 8px;
  background: rgba(230, 180, 92, 0.03);
}

.comp-note {
  padding: 10px 2px;
  font-size: 11px;
  line-height: 1.6;
  color: var(--gold);
  border-bottom: 1px solid var(--line);
}

.chip-off {
  color: var(--ink-3);
  border-color: var(--line-2);
  background: transparent;
}

/* platform grid (overview) */

.plat-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}

.plat-card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.02), transparent);
  padding: 14px 15px 10px;
  cursor: pointer;
  transition: border-color 0.15s ease, transform 0.15s ease;
  overflow: hidden;
}

.plat-card:hover { border-color: color-mix(in srgb, var(--pc) 40%, transparent); transform: translateY(-1px); }

.plat-card-head {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
}

.plat-card-head .name { font-size: 13px; font-weight: 600; }

.plat-card-head .count {
  margin-left: auto;
  font-family: var(--mono);
  font-size: 10px;
  color: var(--ink-3);
}

.plat-card-head .bar {
  width: 3px;
  height: 14px;
  background: var(--pc);
  border-radius: 2px;
  flex: none;
}

.card-group {
  font-size: 9px;
  color: var(--ink-3);
  border: 1px solid var(--line);
  padding: 1px 5px;
  border-radius: 2px;
  margin-left: 2px;
}

.card-override {
  font-size: 9px;
  color: var(--gold);
  border: 1px solid rgba(230, 180, 92, 0.35);
  padding: 1px 5px;
  border-radius: 2px;
}

.mini-row {
  display: flex;
  gap: 8px;
  align-items: baseline;
  padding: 5px 0;
  border-top: 1px solid var(--line);
  font-size: 11.5px;
  color: var(--ink-2);
}

.mini-row .n {
  font-family: var(--mono);
  font-size: 9px;
  color: var(--ink-3);
  width: 16px;
  flex: none;
}

.mini-row .t {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.plat-card.empty { opacity: 0.55; cursor: default; }

/* skeleton */

.sk-row {
  display: grid;
  grid-template-columns: 42px 1fr 148px;
  gap: 14px;
  padding: 15px 12px;
  border-bottom: 1px solid var(--line);
}

.sk {
  height: 11px;
  border-radius: 2px;
  background: linear-gradient(90deg, rgba(255, 255, 255, 0.045), rgba(255, 255, 255, 0.09), rgba(255, 255, 255, 0.045));
  background-size: 200% 100%;
  animation: shimmer 1.4s linear infinite;
}

.sk-title { width: 70%; }
.sk-heat { width: 60%; justify-self: end; }
.sk-rank { width: 18px; justify-self: end; }

@keyframes shimmer { to { background-position: -200% 0; } }

.empty-state {
  padding: 60px 20px;
  text-align: center;
  color: var(--ink-3);
  font-size: 13px;
}

.empty-state b { display: block; color: var(--ink-2); font-family: var(--serif); font-size: 18px; margin-bottom: 6px; }

/* -- drawer -------------------------------------------------------------- */

.drawer-scrim {
  position: fixed;
  inset: 0;
  z-index: 40;
  background: rgba(4, 6, 7, 0.62);
  backdrop-filter: blur(2px);
  opacity: 0;
  transition: opacity 0.22s ease;
}

.drawer-scrim.show { opacity: 1; }

.drawer {
  position: fixed;
  top: 0; right: 0; bottom: 0;
  z-index: 50;
  width: min(460px, 92vw);
  background: #0c1012;
  border-left: 1px solid var(--line-2);
  transform: translateX(102%);
  transition: transform 0.3s cubic-bezier(0.22, 1, 0.36, 1);
  display: flex;
  flex-direction: column;
  box-shadow: -30px 0 80px rgba(0, 0, 0, 0.5);
}

.drawer.open { transform: none; }

.drawer-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 20px;
  border-bottom: 1px solid var(--line);
}

.drawer-chip {
  font-size: 10px;
  letter-spacing: 0.12em;
  color: var(--pc, var(--red));
  border: 1px solid color-mix(in srgb, var(--pc, var(--red)) 35%, transparent);
  background: color-mix(in srgb, var(--pc, var(--red)) 10%, transparent);
  padding: 3px 8px;
  border-radius: 2px;
}

.icon-btn {
  width: 30px; height: 30px;
  display: grid; place-items: center;
  border: 1px solid var(--line);
  border-radius: 3px;
  background: transparent;
  color: var(--ink-3);
  cursor: pointer;
  transition: all 0.15s ease;
}

.icon-btn:hover { color: var(--ink); border-color: var(--line-2); background: rgba(255, 255, 255, 0.04); }

.icon-btn svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 1.7; }

.drawer-body { padding: 24px 22px 40px; overflow-y: auto; }

.drawer-title {
  font-family: var(--serif);
  font-size: 23px;
  line-height: 1.4;
  font-weight: 600;
  margin: 0 0 18px;
}

.drawer-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 1px;
  background: var(--line);
  border: 1px solid var(--line);
  border-radius: 3px;
  overflow: hidden;
  margin-bottom: 20px;
}

.dstat { background: var(--bg-2); padding: 12px; flex: 1 1 22%; min-width: 84px; }

.dstat .k { font-size: 9px; letter-spacing: 0.1em; color: var(--ink-3); }

.dstat .v {
  margin-top: 5px;
  font-family: var(--mono);
  font-size: 16px;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}

.kv { display: flex; justify-content: space-between; gap: 16px; padding: 8px 0; border-bottom: 1px solid var(--line); font-size: 12px; }

.kv .k { color: var(--ink-3); flex: none; }

.kv .v { color: var(--ink-2); text-align: right; word-break: break-all; }

.drawer-actions { display: flex; gap: 8px; margin: 20px 0 24px; }

.raw-label { font-size: 9px; letter-spacing: 0.14em; color: var(--ink-3); margin-bottom: 8px; }

pre.raw {
  margin: 0;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 3px;
  background: #080a0b;
  font-family: var(--mono);
  font-size: 10.5px;
  line-height: 1.65;
  color: var(--ink-3);
  overflow-x: auto;
  white-space: pre-wrap;
  word-break: break-word;
}

/* -- auth / api pages ---------------------------------------------------- */

.auth-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 48px 20px;
}

.auth-card {
  border: 1px solid var(--line-2);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.03), rgba(255, 255, 255, 0.01));
  padding: 34px 34px 38px;
  border-radius: 4px;
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.35);
}

.auth-card h1 {
  font-family: var(--serif);
  font-size: 30px;
  font-weight: 600;
  margin: 0 0 10px;
}

.auth-card h3 {
  font-family: var(--serif);
  font-size: 17px;
  margin: 22px 0 6px;
}

.auth-card p {
  color: var(--ink-2);
  font-size: 13px;
  line-height: 1.8;
  margin: 0 0 10px;
}

.auth-input {
  width: 100%;
  height: 42px;
  margin-top: 6px;
  background: var(--bg-2);
  border: 1px solid var(--line-2);
  color: var(--ink);
  padding: 0 12px;
  border-radius: 3px;
  outline: none;
  font-size: 13px;
}

.auth-input:focus { border-color: rgba(255, 75, 62, 0.55); }

.auth-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 42px;
  padding: 0 18px;
  background: var(--red);
  border: 0;
  color: #fff;
  border-radius: 3px;
  cursor: pointer;
  font-weight: 600;
  font-size: 13px;
  white-space: nowrap;
  flex-shrink: 0;
}

.auth-row .btn { white-space: nowrap; flex-shrink: 0; }

.auth-btn:hover { filter: brightness(1.08); }
.auth-btn:disabled { opacity: 0.5; cursor: default; }

.auth-row {
  display: flex;
  gap: 10px;
  margin-top: 14px;
  flex-wrap: wrap;
  align-items: center;
}

.auth-msg {
  margin-top: 16px;
  font-size: 12px;
  line-height: 1.8;
  color: var(--ink-2);
}

.dev-link { color: var(--jade); }

.token-box {
  margin-top: 10px;
  padding: 14px;
  background: #080a0b;
  border: 1px solid var(--line-2);
  border-radius: 3px;
  font-family: var(--mono);
  font-size: 11px;
  word-break: break-all;
  color: var(--gold);
}

.auth-small {
  font-size: 11px;
  color: var(--ink-3);
  line-height: 1.7;
}

pre.code {
  margin: 10px 0 16px;
  padding: 14px;
  background: #080a0b;
  border: 1px solid var(--line);
  border-radius: 3px;
  overflow: auto;
  font-family: var(--mono);
  font-size: 11px;
  line-height: 1.65;
  color: var(--ink-2);
  white-space: pre-wrap;
  word-break: break-word;
}

.auth-card code {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--gold);
}

.rail-links {
  display: flex;
  gap: 12px;
  margin-top: 12px;
  font-size: 11px;
}

.rail-links a {
  color: var(--ink-3);
  text-decoration: none;
}

.rail-links a:hover { color: var(--ink); }

@media (max-width: 600px) {
  .auth-card { padding: 24px 20px; }
  .auth-card h1 { font-size: 24px; }
}

/* -- responsive ---------------------------------------------------------- */

@media (max-width: 1280px) {
  .plat-grid { grid-template-columns: repeat(2, 1fr); }
  .stats { grid-template-columns: repeat(4, 1fr); }
}

@media (max-width: 1040px) {
  :root { --rail: 186px; }
  .resonance { grid-template-columns: 1fr; }
  .search { width: 190px; }
}

@media (max-width: 860px) {
  .rail {
    position: sticky;
    top: 0;
    inset: auto;
    width: 100%;
    flex-direction: row;
    align-items: center;
    gap: 16px;
    padding: 12px 16px;
    border-right: 0;
    border-bottom: 1px solid var(--line);
    background: rgba(10, 12, 13, 0.94);
    backdrop-filter: blur(12px);
    overflow-x: auto;
  }
  .brand-sub, .rail-note, .rail-foot { display: none; }
  .nav { margin: 0; flex-direction: row; gap: 4px; }
  .nav-item { padding: 6px 8px; }
  .nav-item.active::before { display: none; }
  .nav-count { display: none; }
  .main { margin-left: 0; }
  .topbar { flex-direction: column; align-items: stretch; gap: 12px; padding: 14px 16px; }
  .topbar-tools { flex-wrap: wrap; }
  .search { flex: 1; width: auto; }
  .clock { display: none; }
  .content { padding: 18px 16px 70px; }
  .stats { grid-template-columns: repeat(2, 1fr); }
  .plat-grid { grid-template-columns: 1fr; }
  .row { grid-template-columns: 32px minmax(0, 1fr) 90px; gap: 10px; }
}

@media (max-width: 520px) {
  .btn span { display: none; }
  .btn { padding: 0 10px; }
  .stat-num { font-size: 24px; }
  .row-heat { display: none; }
  .row { grid-template-columns: 32px minmax(0, 1fr); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.001ms !important; transition-duration: 0.001ms !important; }
}
