/* Drug Wars Online — flat industrial skin.
   No gradients. Hard edges. Grain. The palette comes from the theme row. */

:root {
  --bg: #080808;
  --panel: #101010;
  --panel2: #151515;
  --line: #2b2b2b;
  --line-hot: #4d4d4d;
  --ink: #e8e8e8;
  --muted: #8c8c8c;
  --dim: #5c5c5c;
  --accent: #ffb000;
  --accent2: #ff7a00;
  --green: #7dff9b;
  --red: #ff4d4d;
  --blue: #6cc7ff;
  --violet: #b58cff;
  --font: "IBM Plex Sans", "Segoe UI", system-ui, sans-serif;
  --mono: "IBM Plex Mono", "Cascadia Code", Consolas, monospace;
  --radius: 0px;
  --shadow: 4px 4px 0 #000;
  --grain: 0.07;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.5;
  overflow-x: hidden;
}

#bg-canvas {
  position: fixed;
  inset: 0;
  z-index: -2;
  pointer-events: none;
  opacity: .55;
}
.grain {
  position: fixed;
  inset: 0;
  z-index: 9998;
  pointer-events: none;
  opacity: var(--grain);
  mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.55'/%3E%3C/svg%3E");
}
.scanlines {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 9997;
  pointer-events: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='4' height='4'%3E%3Crect width='4' height='1' fill='%23ffffff' opacity='0.035'/%3E%3C/svg%3E");
}
body[data-scanlines="1"] .scanlines { display: block; }

a { color: var(--accent); text-decoration: none; }
a:hover, a:focus { color: var(--accent2); text-decoration: underline; text-underline-offset: 3px; }
h1, h2, h3, h4 {
  font-family: var(--mono);
  line-height: 1.15;
  margin: 0 0 .6rem;
  text-shadow: 1px 1px 0 #000;
}
h1 { font-size: clamp(1.7rem, 3.4vw, 2.8rem); letter-spacing: -.03em; text-transform: uppercase; }
h2 { font-size: 1.2rem; text-transform: uppercase; letter-spacing: .04em; }
h3 { font-size: .9rem; text-transform: uppercase; letter-spacing: .14em; color: var(--muted); }
p { margin: 0 0 .8rem; }
small { font-size: .8rem; }
code, .mono { font-family: var(--mono); }
.muted { color: var(--muted); }
.dim { color: var(--dim); }
.right { text-align: right; }
.center { text-align: center; }
.nowrap { white-space: nowrap; }
.inline { display: inline; margin: 0; }

/* -- top bar ------------------------------------------------------------ */
.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
  padding: .65rem clamp(1rem, 3vw, 2.2rem);
  background: var(--panel);
  border-bottom: 2px solid var(--line);
}
.brand { display: flex; align-items: center; gap: .7rem; color: var(--ink); }
.brand:hover { text-decoration: none; color: var(--ink); }
.brand-mark {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border: 2px solid var(--accent);
  color: var(--accent);
  font-family: var(--mono);
  font-weight: 700;
  letter-spacing: .08em;
  background: var(--bg);
  box-shadow: 3px 3px 0 #000;
}
.brand-text { display: flex; flex-direction: column; line-height: 1.1; }
.brand-text strong { font-family: var(--mono); letter-spacing: .16em; font-size: .95rem; }
.brand-text small { color: var(--muted); font-size: .68rem; letter-spacing: .04em; }
.nav {
  display: flex;
  align-items: center;
  gap: .1rem;
  flex-wrap: wrap;
  margin-left: auto;
}
.nav a, .nav button {
  padding: .32rem .55rem;
  border: 1px solid transparent;
  color: var(--muted);
  font-size: .76rem;
  font-family: var(--mono);
  text-transform: uppercase;
  letter-spacing: .06em;
}
.nav a:hover, .nav a:focus {
  color: var(--ink);
  border-color: var(--line-hot);
  background: var(--panel2);
  text-decoration: none;
}

/* -- layout ------------------------------------------------------------- */
.shell {
  width: min(1180px, calc(100% - 2rem));
  margin: 1.4rem auto 3rem;
}
.footer {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  width: min(1180px, calc(100% - 2rem));
  margin: 0 auto 2rem;
  padding-top: 1rem;
  border-top: 2px solid var(--line);
  color: var(--dim);
  font-family: var(--mono);
  font-size: .7rem;
  letter-spacing: .06em;
  text-transform: uppercase;
}
.flash {
  width: min(1180px, calc(100% - 2rem));
  margin: 1rem auto 0;
  padding: .7rem 1rem;
  border: 1px solid var(--line);
  border-left: 4px solid var(--accent);
  background: var(--panel);
  font-family: var(--mono);
  font-size: .85rem;
}
.flash-ok { border-left-color: var(--green); color: var(--green); }
.flash-err { border-left-color: var(--red); color: var(--red); }

/* -- cards and grids ---------------------------------------------------- */
.card {
  background: var(--panel);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  padding: 1.1rem 1.2rem;
}
.card + .card { margin-top: 1rem; }
.card-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: .8rem;
  padding-bottom: .55rem;
  border-bottom: 1px solid var(--line);
}
.card-head h2, .card-head h3 { margin: 0; }
.grid { display: grid; gap: 1rem; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.split { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(280px, 1fr); gap: 1rem; }
.stack { display: flex; flex-direction: column; gap: .6rem; }
.row { display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; }
.spread { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }

/* -- hero --------------------------------------------------------------- */
.hero {
  position: relative;
  overflow: hidden;
  padding: clamp(1.6rem, 4vw, 3.2rem);
  border: 1px solid var(--line);
  border-left: 6px solid var(--accent);
  background: var(--panel);
  box-shadow: var(--shadow);
}
.hero h1 { max-width: 20ch; }
.hero .lede { max-width: 62ch; color: var(--muted); font-size: 1.02rem; }
.hero-actions { display: flex; gap: .7rem; flex-wrap: wrap; margin-top: 1.2rem; }
.kicker {
  display: inline-block;
  margin-bottom: .8rem;
  color: var(--accent);
  font-family: var(--mono);
  font-size: .7rem;
  letter-spacing: .2em;
  text-transform: uppercase;
}

/* -- stats -------------------------------------------------------------- */
.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: .7rem; }
.stat {
  padding: .8rem .9rem;
  border: 1px solid var(--line);
  background: var(--panel);
  box-shadow: 3px 3px 0 #000;
}
.stat .label { color: var(--muted); font-family: var(--mono); font-size: .66rem; letter-spacing: .12em; text-transform: uppercase; }
.stat .value { font-family: var(--mono); font-size: 1.35rem; color: var(--ink); }
.stat .value.amber { color: var(--accent); }
.stat .value.green { color: var(--green); }
.stat .value.red { color: var(--red); }

/* -- buttons ------------------------------------------------------------ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .4rem;
  padding: .5rem .9rem;
  border: 1px solid var(--line-hot);
  background: var(--panel2);
  color: var(--ink);
  font-family: var(--mono);
  font-size: .78rem;
  letter-spacing: .05em;
  text-transform: uppercase;
  cursor: pointer;
  box-shadow: 3px 3px 0 #000;
  transition: none;
}
.btn:hover { background: var(--line); border-color: var(--accent); color: var(--ink); text-decoration: none; }
.btn:active { transform: translate(2px, 2px); box-shadow: 1px 1px 0 #000; }
.btn-primary { border-color: var(--accent); background: var(--accent); color: #000; }
.btn-primary:hover { background: var(--accent2); color: #000; }
.btn-danger { border-color: var(--red); color: var(--red); background: var(--panel); }
.btn-danger:hover { background: var(--red); color: #000; }
.btn-ghost { background: transparent; border-color: var(--line); color: var(--muted); box-shadow: none; }
.btn-sm { padding: .26rem .5rem; font-size: .68rem; box-shadow: 2px 2px 0 #000; }
.btn:disabled { opacity: .45; cursor: not-allowed; }

/* -- forms -------------------------------------------------------------- */
form { margin: 0; }
label { display: block; margin-bottom: .25rem; color: var(--muted); font-family: var(--mono); font-size: .7rem; letter-spacing: .08em; text-transform: uppercase; }
input, select, textarea {
  width: 100%;
  padding: .5rem .6rem;
  border: 1px solid var(--line);
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: .92rem;
  border-radius: 0;
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 2px 2px 0 #000;
}
textarea { min-height: 6rem; resize: vertical; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .8rem; }
.form-grid .full { grid-column: 1 / -1; }
.field { margin-bottom: .8rem; }
.hint { color: var(--dim); font-size: .74rem; margin-top: .2rem; }
.check { display: flex; align-items: center; gap: .45rem; color: var(--ink); font-family: var(--sans); font-size: .85rem; text-transform: none; letter-spacing: 0; }
.check input { width: auto; }

/* -- tables ------------------------------------------------------------- */
.table-wrap { overflow-x: auto; }
table.data { width: 100%; border-collapse: collapse; font-size: .86rem; }
table.data th, table.data td { padding: .5rem .55rem; border-bottom: 1px solid var(--line); text-align: left; vertical-align: middle; }
table.data th {
  color: var(--muted);
  font-family: var(--mono);
  font-size: .66rem;
  letter-spacing: .1em;
  text-transform: uppercase;
  white-space: nowrap;
  border-bottom: 2px solid var(--line-hot);
}
table.data tr:hover td { background: var(--panel2); }
table.data td.num, table.data th.num { text-align: right; font-family: var(--mono); }
table.data .item-name { font-weight: 600; }
table.data .sub { display: block; color: var(--dim); font-size: .72rem; }

/* -- badges and bars ---------------------------------------------------- */
.badge {
  display: inline-block;
  padding: .08rem .38rem;
  border: 1px solid var(--line-hot);
  color: var(--muted);
  font-family: var(--mono);
  font-size: .64rem;
  letter-spacing: .08em;
  text-transform: uppercase;
}
.badge-amber { border-color: var(--accent); color: var(--accent); }
.badge-green { border-color: var(--green); color: var(--green); }
.badge-red { border-color: var(--red); color: var(--red); }
.badge-blue { border-color: var(--blue); color: var(--blue); }
.badge-violet { border-color: var(--violet); color: var(--violet); }
.bar { height: 6px; background: var(--bg); border: 1px solid var(--line); overflow: hidden; min-width: 70px; }
.bar > span { display: block; height: 100%; background: var(--accent); }
.bar.green > span { background: var(--green); }
.bar.red > span { background: var(--red); }
.bar.blue > span { background: var(--blue); }

/* -- region cards ------------------------------------------------------- */
.region-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1rem; }
.region-card {
  position: relative;
  display: flex;
  flex-direction: column;
  min-height: 190px;
  padding: 1rem;
  border: 1px solid var(--line);
  background: var(--panel);
  box-shadow: 3px 3px 0 #000;
  overflow: hidden;
}
.region-card:hover { border-color: var(--accent); }
.region-card .region-art {
  position: absolute;
  inset: 0;
  background-size: cover;
  background-position: center;
  opacity: .18;
  filter: grayscale(.4) contrast(1.1);
}
.region-card .region-body { position: relative; z-index: 1; display: flex; flex-direction: column; height: 100%; }
.region-card h3 { color: var(--ink); text-transform: none; letter-spacing: 0; font-size: 1.05rem; margin-bottom: .2rem; }
.region-card .tagline { color: var(--muted); font-size: .82rem; margin-bottom: .8rem; }
.region-card .meta { margin-top: auto; display: flex; gap: .4rem; flex-wrap: wrap; }
.danger-1 { color: var(--green); }
.danger-2 { color: #b7e36a; }
.danger-3 { color: var(--accent); }
.danger-4 { color: var(--accent2); }
.danger-5 { color: var(--red); }

/* -- map ---------------------------------------------------------------- */
.map {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  border: 1px solid var(--line);
  background: var(--bg);
  overflow: hidden;
}
.map svg { position: absolute; inset: 0; width: 100%; height: 100%; }
.map .node {
  position: absolute;
  transform: translate(-50%, -50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: .2rem;
  color: var(--ink);
  font-family: var(--mono);
  font-size: .66rem;
  text-align: center;
  z-index: 2;
}
.map .node .dot {
  width: 12px;
  height: 12px;
  border: 2px solid var(--accent);
  background: var(--bg);
  box-shadow: 2px 2px 0 #000;
  border-radius: 50%;
}
.map .node:hover .dot { background: var(--accent); }
.map .node span { background: var(--bg); padding: 0 .25rem; }

/* -- market ------------------------------------------------------------- */
.price-up { color: var(--green); }
.price-down { color: var(--red); }
.market-actions { display: flex; gap: .3rem; align-items: center; }
.market-actions input[type=number] { width: 4.2rem; padding: .25rem .35rem; font-family: var(--mono); }
.demand-cell { min-width: 90px; }

/* -- chat / phone ------------------------------------------------------- */
.phone {
  display: grid;
  grid-template-columns: 240px minmax(0, 1fr);
  min-height: 560px;
  border: 1px solid var(--line);
  background: var(--panel);
  box-shadow: var(--shadow);
}
.phone-side { border-right: 1px solid var(--line); background: var(--bg); padding: .8rem; }
.phone-side h3 { margin: .6rem 0 .4rem; }
.phone-side a {
  display: flex;
  justify-content: space-between;
  gap: .5rem;
  padding: .4rem .5rem;
  border: 1px solid transparent;
  color: var(--muted);
  font-size: .85rem;
}
.phone-side a:hover { background: var(--panel2); border-color: var(--line); text-decoration: none; color: var(--ink); }
.phone-side a.active { border-color: var(--accent); color: var(--accent); background: var(--panel2); }
.phone-main { display: flex; flex-direction: column; min-width: 0; }
.phone-head { padding: .7rem 1rem; border-bottom: 1px solid var(--line); display: flex; justify-content: space-between; gap: 1rem; align-items: center; }
.chat-log { flex: 1; overflow-y: auto; padding: 1rem; display: flex; flex-direction: column; gap: .55rem; max-height: 460px; }
.bubble { max-width: 78%; padding: .45rem .65rem; border: 1px solid var(--line); background: var(--bg); }
.bubble .who { display: block; color: var(--accent); font-family: var(--mono); font-size: .66rem; letter-spacing: .06em; margin-bottom: .1rem; }
.bubble .when { display: block; color: var(--dim); font-family: var(--mono); font-size: .6rem; margin-top: .15rem; }
.bubble.mine { align-self: flex-end; border-color: var(--green); background: var(--panel2); }
.bubble.mine .who { color: var(--green); }
.chat-form { display: flex; gap: .5rem; padding: .7rem 1rem; border-top: 1px solid var(--line); }
.chat-form input { flex: 1; }
.mention { color: var(--blue); }

/* -- mail --------------------------------------------------------------- */
.mail-list { display: flex; flex-direction: column; }
.mail-item {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: .3rem 1rem;
  padding: .7rem .8rem;
  border-bottom: 1px solid var(--line);
  color: var(--ink);
}
.mail-item:hover { background: var(--panel2); text-decoration: none; }
.mail-item.unread { border-left: 3px solid var(--accent); background: var(--panel2); }
.mail-item .subject { font-weight: 600; }
.mail-item .preview { color: var(--muted); font-size: .82rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mail-item .when { color: var(--dim); font-family: var(--mono); font-size: .7rem; white-space: nowrap; }
.mail-message { border: 1px solid var(--line); background: var(--bg); padding: .9rem 1rem; margin-bottom: .8rem; }
.mail-message .head { display: flex; justify-content: space-between; gap: 1rem; flex-wrap: wrap; border-bottom: 1px solid var(--line); padding-bottom: .4rem; margin-bottom: .6rem; }
.mail-message .body { white-space: pre-wrap; }

/* -- misc --------------------------------------------------------------- */
.empty { padding: 1.4rem; border: 1px dashed var(--line); color: var(--muted); text-align: center; font-family: var(--mono); font-size: .8rem; }
.divider { height: 1px; background: var(--line); margin: 1rem 0; }
.tag-list { display: flex; gap: .35rem; flex-wrap: wrap; }
.prof-tree { display: grid; gap: .8rem; }
.prof-node { border: 1px solid var(--line); background: var(--bg); padding: .8rem .9rem; }
.prof-node.locked { opacity: .55; }
.prof-node .bonuses { color: var(--muted); font-family: var(--mono); font-size: .7rem; }
.timer { font-family: var(--mono); color: var(--accent); }
.admin-head { display: flex; justify-content: space-between; align-items: baseline; gap: 1rem; flex-wrap: wrap; margin-bottom: 1rem; }
.admin-head h1 { margin: 0; }
.admin-actions { display: flex; gap: .5rem; flex-wrap: wrap; }
.kv { display: grid; grid-template-columns: 140px 1fr; gap: .3rem .8rem; font-size: .88rem; }
.kv dt { color: var(--muted); font-family: var(--mono); font-size: .7rem; text-transform: uppercase; letter-spacing: .06em; }
.kv dd { margin: 0; }
.hero-strip { display: flex; gap: .5rem; flex-wrap: wrap; margin-bottom: 1rem; }

/* -- corporate chrome --------------------------------------------------- */
.carrier {
  display: flex;
  align-items: center;
  gap: .7rem;
  flex-wrap: wrap;
  padding: .45rem .8rem;
  border: 1px solid var(--line);
  border-bottom: 0;
  background: var(--panel2);
  font-family: var(--mono);
  font-size: .68rem;
  letter-spacing: .06em;
  text-transform: uppercase;
}
.carrier-name { color: var(--accent); font-weight: 700; }
.carrier-signal { color: var(--green); letter-spacing: .1em; }
.carrier-note { color: var(--dim); text-transform: none; letter-spacing: 0; }
.mail-brand {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  padding: .5rem .8rem;
  border: 1px solid var(--line);
  border-bottom: 0;
  background: var(--panel2);
  font-family: var(--mono);
  font-size: .7rem;
  letter-spacing: .08em;
  text-transform: uppercase;
}
.mail-brand strong { color: var(--blue); letter-spacing: .16em; }
.mail-brand span { color: var(--dim); text-transform: none; letter-spacing: 0; }
.fineprint {
  margin-top: 1.2rem;
  padding-top: .8rem;
  border-top: 1px solid var(--line);
  color: var(--dim);
  font-family: var(--mono);
  font-size: .66rem;
  line-height: 1.5;
}

/* -- agent console ------------------------------------------------------ */
.agent {
  display: grid;
  grid-template-columns: 250px minmax(0, 1fr) 280px;
  gap: 1rem;
  align-items: start;
}
.agent-side, .agent-rail {
  border: 1px solid var(--line);
  background: var(--panel);
  box-shadow: var(--shadow);
  padding: .8rem;
}
.agent-side h3, .agent-rail h3 { margin: .4rem 0 .5rem; }
.agent-side a {
  display: block;
  padding: .35rem .45rem;
  border: 1px solid transparent;
  color: var(--muted);
  font-size: .82rem;
}
.agent-side a:hover { background: var(--panel2); border-color: var(--line); text-decoration: none; color: var(--ink); }
.agent-side a.active { border-color: var(--accent); color: var(--accent); background: var(--panel2); }
.agent-main {
  border: 1px solid var(--line);
  background: var(--panel);
  box-shadow: var(--shadow);
  min-height: 620px;
  display: flex;
  flex-direction: column;
}
.agent-head { padding: .7rem .9rem; border-bottom: 1px solid var(--line); display: flex; justify-content: space-between; gap: 1rem; flex-wrap: wrap; align-items: center; }
.agent-log { flex: 1; overflow-y: auto; padding: .9rem; display: flex; flex-direction: column; gap: .7rem; max-height: 560px; }
.agent-msg { border: 1px solid var(--line); background: var(--bg); padding: .6rem .7rem; }
.agent-msg.user { border-left: 3px solid var(--blue); }
.agent-msg.assistant { border-left: 3px solid var(--accent); }
.agent-msg.tool { border-left: 3px solid var(--dim); background: var(--panel2); }
.agent-role { display: block; color: var(--muted); font-family: var(--mono); font-size: .62rem; letter-spacing: .1em; text-transform: uppercase; margin-bottom: .25rem; }
.agent-msg .body { white-space: pre-wrap; font-size: .88rem; }
.agent-msg details { margin-top: .35rem; }
.agent-msg summary { cursor: pointer; color: var(--muted); font-family: var(--mono); font-size: .7rem; }
.agent-msg pre { margin: .35rem 0 0; padding: .5rem; background: var(--bg); border: 1px solid var(--line); overflow-x: auto; font-size: .7rem; }
.agent-form { display: flex; gap: .5rem; padding: .7rem .9rem; border-top: 1px solid var(--line); }
.agent-form textarea { min-height: 3.2rem; }
.agent-pending { border: 1px solid var(--red); background: var(--panel2); padding: .6rem .7rem; margin-bottom: .6rem; }
.agent-pending .tool { color: var(--red); font-family: var(--mono); font-size: .72rem; }
.agent-pending pre { margin: .35rem 0; padding: .4rem; background: var(--bg); border: 1px solid var(--line); overflow-x: auto; font-size: .68rem; }
.agent-meta { color: var(--dim); font-family: var(--mono); font-size: .66rem; }
.agent-badge { display: inline-block; padding: .05rem .35rem; border: 1px solid var(--line-hot); color: var(--muted); font-family: var(--mono); font-size: .6rem; text-transform: uppercase; }

/* live turn: the assistant bubble is rewritten in place as deltas arrive */
.agent-msg.live { border-left-color: var(--accent2); background: var(--panel2); }
.agent-msg.live .body:empty::after {
  content: "▍";
  color: var(--accent);
  animation: agent-blink 1s steps(2) infinite;
}
.agent-typing { color: var(--dim); font-family: var(--mono); font-size: .66rem; margin-top: .3rem; }
.agent-thinking {
  color: var(--dim);
  font-family: var(--mono);
  font-size: .64rem;
  white-space: pre-wrap;
  max-height: 5.5rem;
  overflow: hidden;
  border-left: 2px solid var(--line);
  padding-left: .4rem;
  margin-top: .3rem;
  opacity: .75;
}
.agent-busy {
  padding: .35rem .9rem;
  border-top: 1px solid var(--line);
  color: var(--accent);
  font-family: var(--mono);
  font-size: .7rem;
}
.agent-reason { flex: 1; min-width: 6rem; font-size: .7rem; padding: .2rem .35rem; }
.agent-flash {
  position: fixed;
  right: 1rem;
  bottom: 1rem;
  z-index: 50;
  background: var(--panel);
  border: 1px solid var(--red);
  color: var(--ink);
  padding: .5rem .7rem;
  font-family: var(--mono);
  font-size: .74rem;
  max-width: 22rem;
}
[hidden] { display: none !important; }
@keyframes agent-blink { 50% { opacity: 0; } }

/* -- theme editor ------------------------------------------------------- */
.theme-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: .7rem; }
.theme-field { border: 1px solid var(--line); background: var(--bg); padding: .5rem; }
.theme-field label { margin-bottom: .3rem; }
.theme-field input[type=color] { width: 100%; height: 2.2rem; padding: 0; border: 1px solid var(--line); background: var(--bg); }
.theme-preview { border: 1px solid var(--line); background: var(--panel); padding: 1rem; box-shadow: var(--shadow); }
.theme-preview .swatch { display: inline-block; width: 1.2rem; height: 1.2rem; border: 1px solid var(--line-hot); vertical-align: middle; }

/* -- features and lore -------------------------------------------------- */
.feature-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1rem; }
.feature-card { border: 1px solid var(--line); background: var(--panel); padding: .9rem; box-shadow: 3px 3px 0 #000; }
.feature-card h3 { color: var(--ink); text-transform: none; letter-spacing: 0; }
.lore-list { display: grid; gap: 1rem; }
.lore-entry { border: 1px solid var(--line); border-left: 4px solid var(--accent); background: var(--panel); padding: 1rem 1.1rem; box-shadow: var(--shadow); }
.lore-entry h2 { margin-bottom: .3rem; }
.lore-entry .body { white-space: pre-wrap; color: var(--muted); }

@media (max-width: 1000px) {
  .agent { grid-template-columns: 1fr; }
  .agent-side, .agent-rail { display: none; }
  .theme-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 900px) {
  .grid-3, .grid-4, .region-grid, .feature-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .split { grid-template-columns: 1fr; }
  .phone { grid-template-columns: 1fr; }
  .phone-side { border-right: 0; border-bottom: 1px solid var(--line); }
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 620px) {
  .grid-2, .grid-3, .grid-4, .region-grid, .form-grid, .feature-grid, .theme-grid { grid-template-columns: 1fr; }
  .nav { width: 100%; }
  .nav a, .nav button { padding: .28rem .38rem; font-size: .68rem; }
  .brand-text small { display: none; }
  .kv { grid-template-columns: 1fr; }
}
