/*
  Dark CRT terminal by default, with a real light mode behind the same
  toggle the other pages use - unreadable outdoors otherwise. Keeps the
  green-phosphor identity (same hue, re-stepped for a light surface),
  scanline overlay unchanged (a black multiply-blend line works the same
  on either background).
*/
:root {
  color-scheme: dark;
  --bg:       #060a07;
  --panel:    #0d1510;
  --line:     #17301f;
  --dim:      #2f7a45;
  --fg:       #4dff77;
  --bright:   #aaffc2;
  --alert:    #ff5c5c;
  --alert-dim: #7a2e2e;
  --glow-shadow: rgba(77,255,119,0.45);
  --hover-tint:  rgba(77,255,119,0.06);
  --hover-panel: #132318;
}

:root[data-theme="light"] {
  color-scheme: light;
  --bg:       #f4f7f3;
  --panel:    #ffffff;
  --line:     #d3ddd2;
  --dim:      #3f6e50;
  --fg:       #1d6b34;
  --bright:   #0f4a22;
  --alert:    #b02a2a;
  --alert-dim: #e8b4b4;
  --glow-shadow: rgba(29,107,52,0.35);
  --hover-tint:  rgba(29,107,52,0.06);
  --hover-panel: #e8f0e6;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: "SF Mono", "Menlo", "Consolas", "Courier New", monospace;
  font-variant-numeric: tabular-nums;
  line-height: 1.4;
}

/* faint CRT scanline overlay */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 50;
  background: repeating-linear-gradient(
    to bottom,
    rgba(0,0,0,0) 0px,
    rgba(0,0,0,0) 2px,
    rgba(0,0,0,0.12) 3px
  );
  mix-blend-mode: multiply;
}

a { color: var(--bright); }

.glow { text-shadow: 0 0 6px var(--glow-shadow); }

@keyframes blink {
  0%, 49% { opacity: 1; }
  50%, 100% { opacity: 0; }
}
.cursor {
  display: inline-block;
  width: 0.55em;
  height: 1em;
  background: var(--fg);
  vertical-align: text-bottom;
  animation: blink 1s steps(1) infinite;
}
@media (prefers-reduced-motion: reduce) {
  .cursor { animation: none; }
}

/* Fixed, not a header child - reachable from the lock screen too. */
.theme-toggle {
  position: fixed;
  top: 18px;
  right: 18px;
  z-index: 101;
  width: 40px;
  height: 40px;
  border-radius: 4px;
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--fg);
  font-size: 1.1rem;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}
.theme-toggle:hover { border-color: var(--fg); }

/* ---- lock screen ---- */
#lock-screen {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
}
.lock-box {
  width: 100%;
  max-width: 480px;
  border: 1px solid var(--line);
  background: var(--panel);
  padding: 1.5rem;
}
.lock-box p { margin: 0.3rem 0; }
.lock-box .prompt-line {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-top: 0.75rem;
}
.lock-box .prompt-line span.dollar { color: var(--bright); }
.lock-box input {
  flex: 1;
  background: transparent;
  border: none;
  border-bottom: 1px solid var(--line);
  color: var(--fg);
  font-family: inherit;
  font-size: 1rem;
  padding: 0.3rem 0.2rem;
  outline: none;
}
.lock-box input:focus { border-bottom-color: var(--fg); }
.lock-error { color: var(--alert); margin-top: 0.6rem; display: none; }
.lock-error.show { display: block; }

/* ---- terminal window chrome ---- */
.term-window {
  max-width: 1080px;
  margin: 1.5rem auto;
  border: 1px solid var(--line);
  background: var(--panel);
}
.term-titlebar {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0.9rem;
  border-bottom: 1px solid var(--line);
  color: var(--dim);
  font-size: 0.78rem;
}
.term-titlebar .dots { display: flex; gap: 0.35rem; }
.term-titlebar .dots span {
  width: 9px; height: 9px; border-radius: 50%;
  background: var(--line);
}
.term-body { padding: 1.25rem 1.25rem 1.5rem; }

header.masthead { padding: 0 0 1rem; }
header.masthead .tag {
  display: inline-block;
  border: 1px solid var(--alert);
  color: var(--alert);
  font-size: 0.7rem;
  letter-spacing: 0.15em;
  padding: 0.1rem 0.5rem;
  margin-bottom: 0.6rem;
}
header.masthead h1 {
  margin: 0 0 0.3rem;
  font-size: clamp(1.2rem, 3.2vw, 1.7rem);
  text-wrap: balance;
}
header.masthead .subtitle { color: var(--dim); font-size: 0.85rem; }
nav.resources {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1rem;
  margin-top: 0.75rem;
  font-size: 0.75rem;
}
nav.resources a {
  color: var(--dim);
  text-decoration: none;
  border: 1px solid var(--line);
  padding: 0.2rem 0.55rem;
}
nav.resources a:hover { color: var(--fg); border-color: var(--fg); }
nav.resources a::before { content: "> "; }

/* ---- team selection grid ---- */
.team-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: 0.6rem;
  margin: 1rem 0 1.5rem;
}
.team-box {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  border: 1px solid var(--line);
  padding: 0.55rem 0.7rem;
  cursor: pointer;
  color: var(--dim);
  background: transparent;
  text-align: left;
  font-family: inherit;
  font-size: 0.82rem;
}
.team-box:hover { border-color: var(--fg); color: var(--fg); }
.team-box.active {
  background: var(--fg);
  border-color: var(--fg);
  color: var(--bg);
  font-weight: 700;
}
.team-box img {
  width: 28px;
  height: 28px;
  object-fit: cover;
  border: 1px solid var(--line);
  flex-shrink: 0;
}
.team-box.active img { border-color: var(--bg); }
.team-box .box-name { line-height: 1.25; }
.team-box .box-owner { display: block; font-size: 0.72rem; opacity: 0.75; }

/* ---- dossier ---- */
.dossier-header {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem 1rem;
  border-bottom: 1px solid var(--line);
  padding-bottom: 1rem;
  margin-bottom: 1rem;
}
.dossier-header img {
  width: 52px;
  height: 52px;
  object-fit: cover;
  border: 1px solid var(--line);
}
.dossier-header h2 {
  margin: 0;
  font-size: 1.15rem;
}
.dossier-header .owner-line { color: var(--dim); font-size: 0.82rem; }
.access-tag {
  margin-left: auto;
  border: 1px solid var(--alert);
  color: var(--alert);
  font-size: 0.68rem;
  letter-spacing: 0.06em;
  padding: 0.25rem 0.5rem;
  white-space: nowrap;
}

.warning-box {
  border: 1px solid var(--alert);
  color: var(--alert);
  padding: 0.5rem 0.75rem;
  margin-bottom: 0.75rem;
  font-size: 0.8rem;
}

.suggest-box {
  border: 1px solid var(--line);
  padding: 0.6rem 0.85rem;
  margin-bottom: 1rem;
  font-size: 0.8rem;
}
.suggest-box .cmd { color: var(--dim); margin: 0 0 0.4rem; }
.suggest-row { display: flex; gap: 0.6rem; padding: 0.15rem 0; flex-wrap: wrap; }
.suggest-row .tier-label {
  color: var(--dim);
  width: 8.5rem;
  flex-shrink: 0;
}
.suggest-row .none { color: var(--dim); font-style: italic; }
.star { color: var(--bright); }

.table-scroll { overflow-x: auto; }
table.dossier-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.8rem;
  min-width: 820px;
}
.dossier-table th {
  text-align: left;
  font-size: 0.68rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--dim);
  padding: 0.35rem 0.6rem;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
.dossier-table td {
  padding: 0.4rem 0.6rem;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
.dossier-table td.player-cell { white-space: normal; color: var(--bright); }
.dossier-table tbody tr:hover { background: var(--hover-tint); }

/* Player column stays pinned while the rest of the (wide) table scrolls
   horizontally - otherwise on mobile you lose track of which row is
   which by the time you scroll to Keeper Cost/Value. */
.dossier-table th.player-col,
.dossier-table td.player-cell {
  position: sticky;
  left: 0;
  background: var(--panel);
  box-shadow: 1px 0 0 var(--line);
}
.dossier-table tbody tr:hover td.player-cell { background: var(--hover-panel); }

.pos-chip {
  display: inline-block;
  font-size: 0.65rem;
  padding: 0.03rem 0.3rem;
  border: 1px solid var(--line);
  color: var(--dim);
  margin-right: 0.3rem;
}
.meta-chip {
  font-size: 0.7rem;
  color: var(--dim);
}
.kv.good { color: var(--fg); font-weight: 700; }
.kv.bad { color: var(--alert); font-weight: 700; }
.kv-tag {
  display: inline-block;
  font-size: 0.6rem;
  letter-spacing: 0.04em;
  padding: 0.03rem 0.3rem;
  margin-left: 0.4rem;
  border: 1px solid currentColor;
}
.kv-tag.good { color: var(--fg); }
.kv-tag.bad { color: var(--alert); }

details.redacted { margin-top: 1.5rem; font-size: 0.82rem; }
details.redacted summary {
  cursor: pointer;
  font-size: 0.72rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--dim);
}
.redacted-list { margin-top: 0.6rem; display: flex; flex-direction: column; gap: 0.3rem; }
.redacted-row {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.3rem 0.5rem;
  border: 1px solid var(--line);
}
.redacted-row .reason { color: var(--dim); font-size: 0.75rem; }

.rules-note {
  max-width: 1080px;
  margin: 0 auto 2rem;
  padding: 0 1.25rem;
  color: var(--dim);
  font-size: 0.72rem;
}

.empty-state { text-align: center; color: var(--dim); padding: 3rem 0; }
