:root {
  --bg: #030201;
  --panel: rgba(18, 10, 2, .82);
  --panel2: rgba(34, 18, 4, .62);
  --line: #9a4f00;
  --line2: #4e2900;
  --txt: #ffb347;
  --hot: #ff8a00;
  --dim: #9a6b2a;
  --bad: #ff4f30;
  --ok: #45e477;
  --warn: #ffd166;
  --grid: rgba(255, 136, 0, .055);
}
* { box-sizing: border-box; }
body {
  margin: 0;
  min-height: 100vh;
  background: radial-gradient(circle at 55% -20%, rgba(255, 132, 0, .11), transparent 35%), var(--bg);
  color: var(--txt);
  font: 14px/1.45 ui-monospace, SFMono-Regular, Consolas, "Liberation Mono", Menlo, monospace;
  overflow: hidden;
}
body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(rgba(255,255,255,.025) 1px, transparent 1px);
  background-size: 100% 3px;
  opacity: .22;
  mix-blend-mode: screen;
}
button, input, select, textarea {
  font: inherit;
  color: var(--txt);
  background: #080501;
  border: 1px solid var(--line);
  outline: none;
}
button { cursor: pointer; padding: 8px 12px; text-transform: uppercase; }
button:hover { border-color: var(--hot); box-shadow: 0 0 18px rgba(255,138,0,.22) inset; }
button:disabled { cursor: not-allowed; opacity: .38; }
input, textarea, select { padding: 8px 10px; width: 100%; }
textarea { min-height: 90px; resize: vertical; }
#app { height: 100vh; }
.app-shell {
  display: grid;
  grid-template-columns: 170px 1fr;
  grid-template-rows: 54px 1fr;
  height: 100vh;
  gap: 8px;
  padding: 8px;
}
.topbar, .sidebar, .panel, .card, .node, .login-card {
  border: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(27,14,2,.9), rgba(7,4,1,.88));
  box-shadow: 0 0 0 1px rgba(255,128,0,.07) inset, 0 0 28px rgba(255,100,0,.06);
}
.topbar {
  grid-column: 1 / 3;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 14px;
  letter-spacing: .04em;
}
.brand { font-weight: 900; font-size: 17px; color: #ffc46b; }
.status { display: flex; gap: 14px; align-items: center; color: var(--dim); font-size: 12px; }
.sidebar { padding: 14px 10px; display: flex; flex-direction: column; gap: 10px; }
.navbtn { text-align: left; border-color: transparent; background: transparent; width: 100%; color: var(--txt); }
.navbtn.active { border-color: var(--hot); background: rgba(255, 136, 0, .13); }
.side-footer { margin-top: auto; padding-top: 14px; border-top: 1px solid var(--line2); font-size: 11px; color: var(--dim); }
.main { min-height: 0; overflow: auto; padding-right: 4px; }
.screen { min-height: 100%; display: grid; gap: 8px; }
.grid-home { grid-template-columns: 1.1fr .9fr; grid-template-rows: auto 1fr; }
.grid-network { grid-template-columns: 1fr 360px; grid-template-rows: minmax(420px, 1fr) 310px; }
.grid-flows { grid-template-columns: 330px 1fr 330px; grid-template-rows: 1fr 260px; }
.grid-darkweb { grid-template-columns: 1fr 1fr; }
.panel { padding: 14px; min-height: 0; overflow: auto; }
.panel-title { margin: 0 0 12px; font-size: 14px; color: #ffc46b; text-transform: uppercase; letter-spacing: .06em; }
.big-credits { font-size: clamp(34px, 5vw, 64px); font-weight: 900; color: var(--hot); letter-spacing: .03em; text-shadow: 0 0 18px rgba(255,138,0,.32); }
.muted { color: var(--dim); }
.ok { color: var(--ok); }
.bad { color: var(--bad); }
.warn { color: var(--warn); }
.row { display: flex; gap: 8px; align-items: center; }
.wrap { flex-wrap: wrap; }
.split { display: flex; justify-content: space-between; gap: 10px; align-items: center; }
.stack { display: grid; gap: 8px; }
.stats-grid { display: grid; grid-template-columns: repeat(4, minmax(120px, 1fr)); gap: 8px; margin-top: 12px; }
.statbox { border: 1px solid var(--line2); padding: 10px; background: rgba(0,0,0,.22); }
.terminal {
  min-height: 360px;
  background: #050301;
  border: 1px solid var(--line2);
  padding: 12px;
  overflow: auto;
}
.term-line { white-space: pre-wrap; margin: 0 0 5px; color: #e8ad5c; }
.cmd-row { display: grid; grid-template-columns: repeat(6, minmax(70px, 1fr)); gap: 8px; margin-top: 10px; }
.server-detail { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
.kv { display: flex; justify-content: space-between; gap: 8px; border-bottom: 1px dotted rgba(255,136,0,.2); padding: 4px 0; }
.progress { height: 10px; background: #120900; border: 1px solid var(--line2); overflow: hidden; }
.progress > span { display: block; height: 100%; background: linear-gradient(90deg, var(--hot), #ffd27d); }
.card { padding: 10px; margin-bottom: 8px; }
.card.selected { border-color: #ffd27d; box-shadow: 0 0 18px rgba(255,138,0,.24); }
.table { width: 100%; border-collapse: collapse; font-size: 13px; }
.table th, .table td { border-bottom: 1px solid var(--line2); padding: 8px; text-align: left; }
.table tr:hover td { background: rgba(255,136,0,.07); }
.map-panel { position: relative; overflow: hidden; background-image: linear-gradient(var(--grid) 1px, transparent 1px), linear-gradient(90deg, var(--grid) 1px, transparent 1px); background-size: 36px 36px; }
.network-svg { width: 100%; height: 100%; min-height: 400px; display: block; }
.node-label { font: 14px ui-monospace, monospace; fill: var(--txt); font-weight: 800; }
.node-small { font: 11px ui-monospace, monospace; fill: var(--dim); }
.flow-canvas {
  position: relative;
  height: 100%;
  min-height: 520px;
  overflow: hidden;
  background-image: linear-gradient(var(--grid) 1px, transparent 1px), linear-gradient(90deg, var(--grid) 1px, transparent 1px);
  background-size: 30px 30px;
}
.flow-svg { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.flow-line { stroke: var(--hot); stroke-width: 2; fill: none; }
.flow-line.dashed { stroke-dasharray: 6 6; }
.node {
  position: absolute;
  min-width: 150px;
  padding: 12px;
  text-align: center;
  user-select: none;
  touch-action: none;
}
.node.selected { border-color: #ffd27d; box-shadow: 0 0 22px rgba(255,138,0,.30); }
.node.gate { transform: rotate(45deg); width: 130px; height: 130px; display: flex; align-items: center; justify-content: center; }
.node.gate .node-inner { transform: rotate(-45deg); }
.node-title { font-weight: 900; color: #ffc46b; text-transform: uppercase; }
.node-desc { color: var(--dim); font-size: 12px; margin-top: 4px; }
.toolbar { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }
.action-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.action-grid button { min-height: 92px; }
.login-wrap { height: 100vh; display: grid; place-items: center; padding: 20px; }
.login-card { width: min(520px, 100%); padding: 24px; }
.logo-big { font-size: 26px; color: var(--hot); font-weight: 900; margin-bottom: 10px; }
.form { display: grid; gap: 10px; margin-top: 16px; }
.notice { padding: 10px; border: 1px solid var(--line2); background: rgba(255, 136, 0, .06); color: #ffc46b; }
@media (max-width: 960px) {
  body { overflow: auto; }
  #app { height: auto; min-height: 100vh; }
  .app-shell { height: auto; min-height: 100vh; grid-template-columns: 1fr; grid-template-rows: 54px auto 1fr; }
  .topbar { grid-column: 1; }
  .sidebar { flex-direction: row; overflow-x: auto; padding: 8px; position: sticky; top: 0; z-index: 10; }
  .navbtn { min-width: 110px; text-align: center; }
  .side-footer { display: none; }
  .grid-home, .grid-network, .grid-flows, .grid-darkweb { grid-template-columns: 1fr; grid-template-rows: auto; }
  .flow-canvas { min-height: 560px; }
  .cmd-row { grid-template-columns: repeat(2, 1fr); }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
}
.user-chip { border: 0; background: transparent; padding: 4px 6px; color: var(--txt); text-transform: none; }
.user-chip:hover { border: 0; box-shadow: none; color: #ffd27d; }
.cmd-action { position: relative; overflow: hidden; min-height: 46px; }
.cmd-action.running::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: var(--p, 0%);
  background: linear-gradient(90deg, rgba(255,138,0,.42), rgba(255,210,125,.28));
  pointer-events: none;
}
.cmd-action.running { opacity: 1; border-color: #ffd27d; color: #ffd27d; }
.active-action { border: 1px solid var(--line); background: rgba(255,136,0,.07); padding: 10px; margin: 10px 0; }
.profile-name { font-size: clamp(30px, 5vw, 62px); color: var(--hot); font-weight: 900; letter-spacing: .04em; }
.grid-profile { grid-template-columns: 1fr 1fr; grid-template-rows: auto 1fr; }
.profile-head { grid-column: 1 / 3; }
.leaderboard tr { cursor: pointer; }
.active-small { border-color: #ffd27d; color: #ffd27d; }
@media (max-width: 960px) {
  body { font-size: 13px; }
  .app-shell { padding: 6px; gap: 6px; grid-template-rows: auto auto 1fr; }
  .topbar { min-height: 48px; height: auto; padding: 8px 10px; align-items: flex-start; gap: 6px; flex-wrap: wrap; }
  .brand { font-size: 14px; line-height: 1.25; max-width: 100%; }
  .status { width: 100%; justify-content: space-between; gap: 6px; font-size: 11px; }
  .status span:nth-child(1), .status span:nth-child(2) { display: inline; }
  .sidebar { position: sticky; top: 0; z-index: 20; display: grid; grid-auto-flow: column; grid-auto-columns: minmax(96px, 1fr); overflow-x: auto; gap: 6px; padding: 6px; }
  .navbtn { min-width: 96px; padding: 10px 8px; font-size: 13px; white-space: nowrap; }
  .panel { padding: 12px; }
  .big-credits { font-size: 42px; line-height: 1.05; word-break: break-word; }
  .server-detail { grid-template-columns: 1fr; }
  .grid-profile { grid-template-columns: 1fr; }
  .profile-head { grid-column: auto; }
  .leaderboard { min-width: 760px; }
  .table { font-size: 12px; }
  .terminal { min-height: 220px; }
}
.clickable { cursor: pointer; color: #ffd27d; text-decoration: none; }
.clickable:hover { color: var(--hot); text-shadow: 0 0 8px rgba(255,138,0,.45); }
.trace-card { border-color: rgba(255, 207, 118, .35); background: linear-gradient(180deg, rgba(255,136,0,.08), rgba(0,0,0,.18)); }
.operator-node { cursor: pointer; }
.operator-node text { pointer-events: none; }
@media (max-width: 960px) {
  .toolbar input { min-width: 180px; }
  .grid-network { gap: 8px; }
  .network-svg { min-height: 320px; }
}
