/* ============================================================= THE BUTCHER
   Ritualistic horror — aged crime-scene evidence aesthetic.
   ========================================================================= */

:root {
  --bg:        #0a0603;  /* near-black, dried blood        */
  --surface:   #1a1008;  /* card / panel                   */
  --surface-2: #221610;  /* raised panel                   */
  --red:       #8b1a1a;  /* arterial red (primary accent)  */
  --red-bright:#c0392b;
  --gold:      #c9a84c;  /* candlelight gold (secondary)   */
  --parch:     #d4c5a9;  /* parchment body text            */
  --muted:     #6b5a3e;  /* worn leather, borders          */
  --paper:     #d9cdb4;  /* evidence-folder inner paper    */
  --ink:       #1d160e;  /* ink on paper                   */

  /* Per-sin accent (overridden inline on /play) */
  --accent:      var(--red);
  --accent-soft: var(--red-bright);

  --font-display: 'Cinzel', Georgia, serif;
  --font-body:    'Courier Prime', 'Courier New', monospace;
  --font-ui:      'Oswald', 'Arial Narrow', sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  min-height: 100%;
}

body {
  background:
    radial-gradient(ellipse at 50% -10%, rgba(139, 26, 26, 0.16), transparent 55%),
    radial-gradient(ellipse at 80% 110%, rgba(201, 168, 76, 0.06), transparent 50%),
    var(--bg);
  color: var(--parch);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* Subtle film-grain / dust overlay on everything. */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 9999;
  opacity: 0.05;
  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'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

a { color: var(--gold); }

h1, h2, h3, .display { font-family: var(--font-display); font-weight: 700; letter-spacing: 0.02em; }
.ui-label { font-family: var(--font-ui); text-transform: uppercase; letter-spacing: 0.22em; }

.wrap { max-width: 1240px; margin: 0 auto; padding: 0 20px; }
.center-screen {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 32px 18px;
}

/* ----------------------------------------------------------- buttons --- */

.btn {
  font-family: var(--font-ui);
  text-transform: uppercase;
  letter-spacing: 0.18em;
  font-size: 14px;
  padding: 13px 26px;
  border: 1px solid var(--accent);
  background: transparent;
  color: var(--accent-soft);
  cursor: pointer;
  transition: all 0.18s ease;
  position: relative;
}
.btn:hover { background: var(--accent); color: #0a0603; box-shadow: 0 0 18px -4px var(--accent); }
.btn:disabled { opacity: 0.4; cursor: not-allowed; }
.btn-block { display: block; width: 100%; }
.btn-ghost { border-color: var(--muted); color: var(--muted); }
.btn-ghost:hover { background: var(--muted); color: var(--bg); box-shadow: none; }
.btn-danger { border-color: var(--red); color: var(--red-bright); }
.btn-danger:hover { background: var(--red); color: #fff; box-shadow: 0 0 22px -4px var(--red); }

input, textarea, select {
  font-family: var(--font-body);
  background: #0d0805;
  border: 1px solid var(--muted);
  color: var(--parch);
  padding: 12px 14px;
  width: 100%;
  outline: none;
}
input:focus, textarea:focus, select:focus { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
label.field { display: block; }
.field-label { font-family: var(--font-ui); text-transform: uppercase; letter-spacing: 0.16em; font-size: 11px; color: var(--muted); margin-bottom: 6px; }

/* wax seal ------------------------------------------------------------- */
.seal {
  width: 86px; height: 86px; border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, var(--red-bright), var(--red) 55%, #4a0d0d 100%);
  display: flex; align-items: center; justify-content: center;
  color: #ffdede; font-family: var(--font-display); font-size: 30px; font-weight: 700;
  box-shadow: inset 0 -6px 14px rgba(0,0,0,0.55), 0 6px 20px rgba(0,0,0,0.6);
  position: relative;
}
.seal::after {
  content: ""; position: absolute; inset: 7px; border-radius: 50%;
  border: 1px dashed rgba(255, 220, 220, 0.35);
}

/* classification stamp ------------------------------------------------- */
.stamp {
  font-family: var(--font-ui);
  text-transform: uppercase;
  letter-spacing: 0.2em;
  color: var(--red-bright);
  border: 3px solid var(--red-bright);
  padding: 4px 12px;
  display: inline-block;
  transform: rotate(-7deg);
  opacity: 0.85;
  font-weight: 700;
}

/* ================================================== LANDING (seizure) === */

.seizure {
  max-width: 760px; width: 100%;
  background: var(--surface);
  border: 1px solid var(--muted);
  box-shadow: 0 30px 80px -30px #000;
  padding: 0;
  position: relative;
}
.seizure-head {
  background: #0c0a14;
  border-bottom: 2px solid var(--red);
  padding: 26px 34px;
  text-align: center;
}
.seizure-head .scales { font-size: 40px; color: var(--gold); }
.seizure-head h1 { font-size: clamp(20px, 4vw, 30px); margin: 8px 0 4px; color: #e8e2d4; }
.seizure-head .case { font-family: var(--font-ui); letter-spacing: 0.18em; color: var(--muted); font-size: 12px; text-transform: uppercase; }
.seizure-body { padding: 28px 34px 34px; }
.seizure-body p { color: #9c937f; font-size: 14px; }
.official { color: #7f7766; }

.deface {
  margin-top: 26px;
  padding-top: 22px;
  border-top: 1px dashed var(--muted);
}
.struck { color: #6e6657; }
.bleed {
  font-family: var(--font-display);
  color: var(--red-bright);
  font-size: clamp(18px, 3.5vw, 26px);
  line-height: 1.35;
  text-shadow: 0 0 16px rgba(192, 57, 43, 0.45);
  margin: 14px 0;
}
.bleed-sub { color: var(--gold); font-family: var(--font-body); letter-spacing: 0.04em; }

.glitch { position: relative; display: inline-block; animation: flicker 6s infinite; }
@keyframes flicker {
  0%,19%,21%,23%,80%,100% { opacity: 1; }
  20%,22% { opacity: 0.35; }
  82% { opacity: 0.7; }
}
.glitch::before, .glitch::after {
  content: attr(data-text);
  position: absolute; left: 0; top: 0; width: 100%;
  overflow: hidden; opacity: 0.8;
}
.glitch::before { color: #00e5ff; transform: translate(-2px,0); clip-path: inset(0 0 55% 0); animation: gsh 3s infinite linear alternate; }
.glitch::after  { color: var(--red-bright); transform: translate(2px,0); clip-path: inset(55% 0 0 0); animation: gsh 2.4s infinite linear alternate-reverse; }
@keyframes gsh { 0%{transform:translate(-2px,0)} 50%{transform:translate(2px,1px)} 100%{transform:translate(-1px,-1px)} }

/* ===================================================== ENTER (gate) ===== */

.gate {
  max-width: 460px; width: 100%;
  background: var(--surface);
  border: 1px solid var(--muted);
  padding: 40px 34px;
  text-align: center;
  box-shadow: 0 30px 80px -30px #000;
}
.gate h1 { font-size: clamp(22px, 5vw, 32px); color: var(--parch); margin: 18px 0 6px; }
.gate .ui-label { color: var(--gold); font-size: 12px; }
.gate-sub { color: var(--muted); font-size: 13px; margin-bottom: 26px; }
.gate input {
  text-align: center; letter-spacing: 0.4em; text-transform: uppercase; font-size: 18px;
  margin-bottom: 18px;
}
.reject {
  color: var(--red-bright);
  font-family: var(--font-ui);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  margin-top: 18px;
  min-height: 20px;
}
.shake { animation: shake 0.4s; }
@keyframes shake {
  0%,100%{transform:translateX(0)} 20%{transform:translateX(-9px)} 40%{transform:translateX(8px)}
  60%{transform:translateX(-6px)} 80%{transform:translateX(5px)}
}
.flash-out { animation: flashout 0.6s forwards; }
@keyframes flashout { 0%{opacity:1} 40%{opacity:1; background:var(--red)} 100%{opacity:0} }

/* ===================================================== PLAY page ======== */

.play-shell { display: flex; flex-direction: column; min-height: 100vh; }

.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 18px; border-bottom: 1px solid var(--muted);
  background: linear-gradient(180deg, #140c06, #0a0603);
  position: sticky; top: 0; z-index: 40;
}
.agent-tag { font-family: var(--font-ui); letter-spacing: 0.16em; text-transform: uppercase; font-size: 13px; }
.agent-tag b { color: var(--gold); }
.sin-badge {
  display: inline-flex; align-items: center; gap: 8px;
  border: 1px solid var(--accent); color: var(--accent-soft);
  padding: 5px 12px; font-family: var(--font-ui); text-transform: uppercase; letter-spacing: 0.16em; font-size: 12px;
}
.sin-badge .glyph { font-family: var(--font-display); color: var(--accent-soft); }

.play-main { flex: 1; display: flex; min-height: 0; }

.intel-rail {
  width: 150px; flex-shrink: 0; border-right: 1px solid var(--muted);
  padding: 20px 12px; text-align: center; background: #0c0805;
}
.folder-btn { background: none; border: none; cursor: pointer; color: inherit; width: 100%; }
.folder-icon {
  width: 84px; height: 64px; margin: 0 auto; position: relative;
  background: linear-gradient(180deg, #b9892f, #8c6322);
  border-radius: 4px 8px 6px 6px;
  box-shadow: inset 0 2px 0 rgba(255,255,255,0.18), 0 6px 14px rgba(0,0,0,0.5);
}
.folder-icon::before {
  content: ""; position: absolute; top: -8px; left: 6px; width: 34px; height: 12px;
  background: #b9892f; border-radius: 4px 4px 0 0;
}
.folder-badge {
  position: absolute; top: -10px; right: -10px; min-width: 22px; height: 22px;
  background: var(--red); color: #fff; border-radius: 50%;
  font-family: var(--font-ui); font-size: 12px; display: flex; align-items: center; justify-content: center;
  border: 2px solid var(--bg); padding: 0 5px;
}
.intel-rail .label { font-family: var(--font-ui); text-transform: uppercase; letter-spacing: 0.16em; font-size: 11px; color: var(--muted); margin-top: 12px; }

.feed {
  flex: 1; overflow-y: auto; padding: 26px clamp(16px, 5vw, 60px); min-height: 0;
}
.feed-inner { max-width: 720px; margin: 0 auto; }

.awaiting {
  text-align: center; color: var(--muted); font-style: italic;
  letter-spacing: 0.08em; margin: 18px 0;
}
.awaiting.pulse { animation: pulse 1.4s infinite; color: var(--accent-soft); }
@keyframes pulse { 0%,100%{opacity:0.35} 50%{opacity:1} }

/* message cards -------------------------------------------------------- */
.msg {
  position: relative; margin: 22px 0; padding: 0;
  background: var(--paper);
  color: var(--ink);
  box-shadow: 0 14px 30px -16px #000;
  /* torn-edge effect top & bottom */
  clip-path: polygon(
    0% 6px, 3% 0, 8% 6px, 14% 1px, 20% 6px, 27% 1px, 34% 6px, 42% 1px, 50% 6px, 58% 1px,
    66% 6px, 74% 1px, 82% 6px, 90% 1px, 96% 6px, 100% 1px, 100% 100%, 0 100%
  );
  animation: drop 0.4s ease;
}
@keyframes drop { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

.msg-head {
  font-family: var(--font-ui); text-transform: uppercase; letter-spacing: 0.2em; font-size: 13px;
  padding: 14px 18px 10px; display: flex; align-items: center; gap: 10px;
  border-bottom: 1px solid rgba(29,22,14,0.18);
}
.msg-body { padding: 14px 18px 18px; white-space: pre-wrap; font-size: 15px; line-height: 1.6; }
.msg-meta { font-family: var(--font-ui); font-size: 10px; letter-spacing: 0.14em; color: #7a6f55; padding: 0 18px 12px; text-transform: uppercase; }

.msg-alert  { border-left: 6px solid var(--red); }
.msg-alert .msg-head  { color: var(--red); }
.msg-radio  { border-left: 6px solid #a07d1e; }
.msg-radio .msg-head  { color: #8a6512; }
.msg-system { border-left: 6px solid #4a4a4a; }
.msg-system .msg-head { color: #4a4a4a; }

/* evidence file -------------------------------------------------------- */
.msg-evidence { border-left: 6px solid var(--red); overflow: hidden; }
.msg-evidence .msg-head { color: var(--red); }
.msg-evidence .msg-body { position: relative; }
.msg-evidence .watermark {
  position: absolute; top: 50%; left: 50%; transform: translate(-50%,-50%) rotate(-22deg);
  font-family: var(--font-ui); font-weight: 700; font-size: clamp(34px, 8vw, 60px);
  color: rgba(139, 26, 26, 0.16); letter-spacing: 0.1em; pointer-events: none; white-space: nowrap;
}

/* player echoed comms in feed ----------------------------------------- */
.msg-response {
  background: #120c07; color: var(--parch); border-left: 6px solid var(--accent);
  clip-path: none; margin-left: auto; max-width: 80%;
}
.msg-response .msg-head { color: var(--accent-soft); border-bottom-color: rgba(255,255,255,0.08); }

.caret::after { content: "▋"; animation: blink 1s steps(1) infinite; color: var(--red); }
@keyframes blink { 50% { opacity: 0; } }

/* decision card -------------------------------------------------------- */
.decision {
  margin: 26px auto; max-width: 560px; text-align: center;
  background: var(--surface-2); border: 1px solid var(--gold);
  padding: 24px; box-shadow: 0 0 40px -18px var(--gold);
}
.decision .ui-label { color: var(--gold); font-size: 12px; }
.decision .prompt { font-family: var(--font-display); font-size: 19px; color: var(--parch); margin: 12px 0 20px; }
.decision-options { display: flex; flex-direction: column; gap: 10px; }
.decision .resolved { color: var(--gold); font-family: var(--font-ui); letter-spacing: 0.16em; text-transform: uppercase; font-size: 13px; margin-top: 6px; }

/* ===================================================== GEO MAP / PIN ==== */
.geo-map {
  position: relative;
  margin-top: 12px;
  border: 1px solid var(--muted);
  background: #0b0a08;
  overflow: hidden;
  box-shadow: inset 0 0 60px rgba(0,0,0,0.6);
}
.geo-map img {
  display: block;
  width: 100%;
  height: auto;
  /* Age the bright atlas map into the blood/candlelight palette. */
  filter: sepia(0.55) saturate(0.85) hue-rotate(-12deg) brightness(0.7) contrast(1.08);
}
/* Red vignette + grain so the map reads as a recovered document, not a game asset. */
.geo-map::after {
  content: "";
  position: absolute; inset: 0; pointer-events: none;
  background:
    radial-gradient(ellipse at center, transparent 55%, rgba(10,6,3,0.72) 100%),
    linear-gradient(180deg, rgba(139,26,26,0.10), rgba(139,26,26,0.04));
}
.geo-pick { cursor: crosshair; }
.geo-mini { max-width: 260px; margin-top: 8px; }

/* Leaflet (zoomable) variant */
.geo-leaflet {
  height: 380px;
  width: 100%;
  margin-top: 12px;
  border: 1px solid var(--muted);
  background: #0b0a08;
}
.leaflet-container { background: #0b0a08 !important; font-family: var(--font-body); outline: none; }
.leaflet-image-layer {
  filter: sepia(0.55) saturate(0.85) hue-rotate(-12deg) brightness(0.72) contrast(1.08);
}
.leaflet-control-zoom a {
  background: #1a1008 !important;
  color: var(--gold) !important;
  border-color: var(--muted) !important;
  font-family: var(--font-display);
}
.leaflet-control-zoom a:hover { background: var(--red) !important; color: #fff !important; }

.geo-leaflet-pin .dot {
  position: absolute; left: 50%; top: 50%; width: 13px; height: 13px;
  border-radius: 50%; background: var(--red-bright); transform: translate(-50%, -50%);
  box-shadow: 0 0 0 3px rgba(192,57,43,0.4), 0 0 16px var(--red-bright);
}
.geo-leaflet-pin .ring {
  position: absolute; left: 50%; top: 50%; width: 13px; height: 13px;
  border: 2px solid var(--red-bright); border-radius: 50%;
  transform: translate(-50%, -50%); animation: geoping 1.7s ease-out infinite;
}

.geo-pin { position: absolute; transform: translate(-50%, -50%); z-index: 3; }
.geo-pin .dot {
  display: block; width: 13px; height: 13px; border-radius: 50%;
  background: var(--red-bright);
  box-shadow: 0 0 0 3px rgba(192,57,43,0.4), 0 0 16px var(--red-bright);
}
.geo-pin .ring {
  position: absolute; left: 50%; top: 50%; width: 13px; height: 13px;
  border: 2px solid var(--red-bright); border-radius: 50%;
  transform: translate(-50%, -50%);
  animation: geoping 1.7s ease-out infinite;
}
@keyframes geoping {
  0%   { width: 13px; height: 13px; opacity: 0.85; }
  100% { width: 54px; height: 54px; opacity: 0; }
}

/* ===================================================== INTEL OVERLAY ==== */
.overlay {
  position: fixed; inset: 0; z-index: 200; background: rgba(4,2,1,0.96);
  display: flex; flex-direction: column; padding: 0;
}
.overlay-bar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 24px; border-bottom: 1px solid var(--muted);
}
.breadcrumb { font-family: var(--font-ui); letter-spacing: 0.18em; text-transform: uppercase; color: var(--gold); font-size: 13px; }
.breadcrumb span { color: var(--muted); }
.overlay-body { flex: 1; display: flex; min-height: 0; }
.file-list { width: 280px; border-right: 1px solid var(--muted); overflow-y: auto; padding: 12px 0; }
.file-row {
  display: flex; align-items: center; gap: 12px; padding: 12px 22px; cursor: pointer;
  border-bottom: 1px solid rgba(107,90,62,0.18); font-family: var(--font-ui); letter-spacing: 0.08em;
}
.file-row:hover, .file-row.active { background: rgba(201,168,76,0.08); }
.file-row .fi { color: var(--gold); font-size: 18px; }
.file-row .fname { color: var(--parch); }
.file-row .ftype { color: var(--muted); font-size: 10px; text-transform: uppercase; letter-spacing: 0.16em; }
.file-view { flex: 1; overflow-y: auto; padding: 34px clamp(20px, 6vw, 70px); }
.file-empty { color: var(--muted); text-align: center; margin-top: 60px; font-style: italic; }

/* ===================================================== COMMS WIDGET ===== */
.comms-toggle {
  position: fixed; right: 22px; bottom: 20px; z-index: 60;
}
.comms-panel {
  position: fixed; right: 22px; bottom: 20px; z-index: 80;
  width: min(380px, calc(100vw - 28px)); height: 460px; max-height: calc(100vh - 40px);
  background: var(--surface); border: 1px solid var(--accent);
  display: flex; flex-direction: column; box-shadow: 0 30px 70px -20px #000;
}
.comms-head {
  cursor: move; padding: 12px 16px; border-bottom: 1px solid var(--muted);
  display: flex; align-items: center; justify-content: space-between;
  font-family: var(--font-ui); text-transform: uppercase; letter-spacing: 0.18em; font-size: 13px; color: var(--accent-soft);
  background: #140c06;
}
.comms-head button { background: none; border: none; color: var(--muted); cursor: pointer; font-size: 18px; }
.comms-log { flex: 1; overflow-y: auto; padding: 14px; display: flex; flex-direction: column; gap: 10px; }
.bubble { max-width: 82%; padding: 9px 12px; font-size: 14px; line-height: 1.45; }
.bubble.them { align-self: flex-start; background: var(--paper); color: var(--ink); border-left: 3px solid var(--red); }
.bubble.me   { align-self: flex-end; background: #120c07; color: var(--parch); border-right: 3px solid var(--accent); }
.bubble .who { font-family: var(--font-ui); font-size: 9px; letter-spacing: 0.14em; text-transform: uppercase; opacity: 0.7; display: block; margin-bottom: 3px; }
.comms-compose { display: flex; gap: 8px; padding: 10px; border-top: 1px solid var(--muted); }
.comms-compose input { flex: 1; }
.comms-compose .btn { padding: 10px 14px; }

/* ===================================================== HANDLER ========== */
.handler-shell { display: flex; flex-direction: column; height: 100vh; }
.handler-top {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 22px; border-bottom: 2px solid var(--red); background: #120c06;
}
.handler-top h1 { font-size: 20px; color: var(--parch); margin: 0; }
.handler-top .tools { display: flex; gap: 10px; align-items: center; }
.handler-body { flex: 1; display: flex; min-height: 0; }

.session-list { width: 260px; flex-shrink: 0; border-right: 1px solid var(--muted); overflow-y: auto; background: #0c0805; }
.session-list h2 { font-family: var(--font-ui); letter-spacing: 0.18em; font-size: 12px; color: var(--muted); padding: 16px 18px 8px; margin: 0; text-transform: uppercase; }
.s-item { padding: 12px 18px; border-bottom: 1px solid rgba(107,90,62,0.18); cursor: pointer; position: relative; }
.s-item:hover, .s-item.active { background: rgba(139,26,26,0.12); }
.s-item .cs { font-family: var(--font-ui); letter-spacing: 0.1em; color: var(--parch); }
.s-item .meta { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.12em; }
.s-item .badge {
  position: absolute; right: 14px; top: 14px; background: var(--red); color: #fff;
  border-radius: 50%; min-width: 20px; height: 20px; font-family: var(--font-ui); font-size: 11px;
  display: flex; align-items: center; justify-content: center; padding: 0 5px;
}

.handler-main { flex: 1; display: flex; flex-direction: column; min-height: 0; }
.handler-empty { flex: 1; display: flex; align-items: center; justify-content: center; color: var(--muted); font-style: italic; }
.session-head { padding: 14px 22px; border-bottom: 1px solid var(--muted); display: flex; align-items: center; gap: 18px; flex-wrap: wrap; }
.session-head .cs { font-family: var(--font-display); font-size: 22px; color: var(--parch); }
.session-head .chip { font-family: var(--font-ui); letter-spacing: 0.14em; font-size: 12px; text-transform: uppercase; border: 1px solid var(--muted); padding: 4px 10px; color: var(--gold); }

.handler-cols { flex: 1; display: flex; min-height: 0; }
.history { flex: 1; overflow-y: auto; padding: 20px; min-height: 0; border-right: 1px solid var(--muted); }
.composer { width: 380px; flex-shrink: 0; overflow-y: auto; padding: 18px; background: #0c0805; }
.composer h3 { font-family: var(--font-ui); letter-spacing: 0.16em; font-size: 13px; color: var(--gold); text-transform: uppercase; margin: 4px 0 12px; border-bottom: 1px solid var(--muted); padding-bottom: 8px; }
.composer .row { display: flex; gap: 10px; margin-bottom: 12px; }
.composer .row > * { flex: 1; }
.composer textarea { min-height: 90px; resize: vertical; }
.field-gap { margin-bottom: 12px; }
.divider { border: none; border-top: 1px dashed var(--muted); margin: 22px 0; }

.h-msg { margin: 12px 0; padding: 10px 14px; background: var(--surface-2); border-left: 3px solid var(--muted); }
.h-msg.handler { border-left-color: var(--gold); }
.h-msg.player  { border-left-color: var(--accent); background: #14100a; }
.h-msg.system  { border-left-color: #555; }
.h-msg .who { font-family: var(--font-ui); font-size: 10px; letter-spacing: 0.16em; text-transform: uppercase; color: var(--muted); margin-bottom: 4px; }
.h-msg .who b.handler-c { color: var(--gold); }
.h-msg .who b.player-c { color: var(--accent-soft); }
.h-msg .txt { white-space: pre-wrap; font-size: 14px; }

.toast {
  position: fixed; left: 50%; top: 22px; transform: translateX(-50%);
  background: var(--red); color: #fff; padding: 12px 22px; z-index: 500;
  font-family: var(--font-ui); letter-spacing: 0.14em; text-transform: uppercase; font-size: 13px;
  box-shadow: 0 10px 30px -8px #000;
}

/* ===================================================== TIP CONTROL ====== */
.tip-control { flex: 1; display: flex; min-height: 0; overflow: hidden; }
.tip-compose {
  width: 420px; flex-shrink: 0; overflow-y: auto; padding: 22px;
  border-right: 1px solid var(--muted); background: #0c0805;
}
.tip-outbox { flex: 1; overflow-y: auto; padding: 22px; min-height: 0; }
.tip-h { font-family: var(--font-display); font-size: 20px; color: var(--parch); margin: 0 0 4px; }
.tip-internal {
  margin-top: 18px; padding: 14px; border: 1px dashed var(--muted);
  background: rgba(139,26,26,0.05);
}
.tip-internal-label {
  font-family: var(--font-ui); text-transform: uppercase; letter-spacing: 0.16em;
  font-size: 11px; color: var(--red-bright); margin-bottom: 10px;
}
.composer-row { display: flex; gap: 10px; }
.composer-row > * { flex: 1; }
.btn-sm { padding: 7px 14px; font-size: 12px; }
.badge-inline {
  display: inline-block; background: var(--red); color: #fff; border-radius: 999px;
  font-family: var(--font-ui); font-size: 11px; padding: 0 7px; margin-left: 4px;
}

.tip-group-label {
  font-family: var(--font-ui); text-transform: uppercase; letter-spacing: 0.18em;
  font-size: 12px; color: var(--gold); margin: 8px 0 10px; border-bottom: 1px solid var(--muted);
  padding-bottom: 6px;
}
.tip-row {
  background: var(--surface-2); border-left: 3px solid var(--muted);
  padding: 12px 14px; margin-bottom: 12px;
}
.tip-row.draft { border-left-color: var(--gold); opacity: 0.92; }
.tip-row-top { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.tip-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--muted); flex-shrink: 0; }
.tip-dot.unread { background: var(--red-bright); box-shadow: 0 0 8px var(--red-bright); }
.tip-dot.read { background: var(--gold); }
.tip-dot.draft { background: var(--gold); }
.tip-receipt {
  font-family: var(--font-ui); text-transform: uppercase; letter-spacing: 0.12em;
  font-size: 11px; color: var(--muted);
}
.tip-receipt.unread { color: var(--red-bright); }
.tip-receipt.read { color: var(--gold); }
.tip-tags { display: flex; gap: 6px; flex-wrap: wrap; margin-left: auto; }
.tip-tag {
  font-family: var(--font-ui); font-size: 10px; letter-spacing: 0.1em; text-transform: uppercase;
  border: 1px solid var(--muted); color: var(--parch); padding: 2px 7px; border-radius: 3px;
}
.tip-tag.src { color: var(--gold); border-color: var(--gold); }
.tip-x { background: none; border: none; color: var(--muted); cursor: pointer; font-size: 18px; line-height: 1; }
.tip-x:hover { color: var(--red-bright); }
.tip-row-body { white-space: pre-wrap; font-size: 14px; color: var(--parch); }
.tip-notes {
  margin-top: 8px; font-size: 12px; color: var(--gold); font-style: italic;
  border-top: 1px dotted var(--muted); padding-top: 6px;
}

@media (max-width: 760px) {
  .tip-control { flex-direction: column; }
  .tip-compose { width: 100%; border-right: none; border-bottom: 1px solid var(--muted); }
}

/* ================================================== TERMINATION ========= */
.terminate-overlay {
  position: fixed; inset: 0; z-index: 9999;
  background: #050201;
  display: flex; align-items: center; justify-content: center;
  overflow: hidden;
  animation: term-in 0.25s ease both;
}
@keyframes term-in { from { opacity: 0; } to { opacity: 1; } }
.terminate-box {
  text-align: center; padding: 24px; max-width: 680px;
  animation: term-flicker 3.6s infinite steps(1);
}
@keyframes term-flicker {
  0%,100% { opacity: 1; } 92% { opacity: 1; } 93% { opacity: 0.35; }
  94% { opacity: 1; } 96% { opacity: 0.6; } 97% { opacity: 1; }
}
.term-line {
  font-family: var(--font-ui); text-transform: uppercase; letter-spacing: 0.28em;
  color: var(--red-bright); font-size: 14px;
}
.term-head { animation: term-pulse 1.1s infinite ease-in-out; }
@keyframes term-pulse { 0%,100% { opacity: 0.5; } 50% { opacity: 1; } }
.term-msg {
  font-family: var(--font-body);
  color: var(--parch); font-size: clamp(18px, 3.5vw, 26px); line-height: 1.6;
  margin: 26px 0; white-space: pre-wrap;
  text-shadow: 0 0 18px rgba(192,57,43,0.35);
}
.term-cut { margin-top: 18px; color: var(--red-bright); font-size: 13px; }
.term-dots { animation: term-pulse 0.9s infinite ease-in-out; }
.term-scan {
  position: absolute; inset: 0; pointer-events: none;
  background: repeating-linear-gradient(0deg, rgba(0,0,0,0) 0 2px, rgba(0,0,0,0.28) 2px 4px);
  mix-blend-mode: multiply;
  animation: term-roll 7s linear infinite;
}
@keyframes term-roll { from { background-position: 0 0; } to { background-position: 0 80px; } }

.muted { color: var(--muted); }
.tiny { font-size: 12px; }
.mt { margin-top: 16px; }
[x-cloak] { display: none !important; }

/* responsive ----------------------------------------------------------- */
@media (max-width: 760px) {
  .intel-rail { width: 64px; padding: 14px 6px; }
  .folder-icon { width: 48px; height: 38px; }
  .intel-rail .label { display: none; }
  .handler-cols { flex-direction: column; }
  .composer { width: 100%; border-top: 1px solid var(--muted); }
  .history { border-right: none; }
  .session-list { width: 120px; }
  .file-list { width: 150px; }
}
