/* Tokens are defined in critical.css (inlined in <head>) — do not redeclare :root here.
   This file is loaded non-blocking after first paint via the media="print" trick. */

/* ─── Chrome detail ──────────────────────────────────────── */
#enemy-header-stats {
  font-size: 11px;
  color: var(--system);
  letter-spacing: 0.03em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
#enemy-header-stats .hs-enemy-name { color: var(--error); font-weight: bold; }
#enemy-header-stats .hs-sep        { color: var(--system); margin: 0 0.3rem; }
#enemy-header-stats .hs-hp-ok      { color: var(--hp-ok); }
#enemy-header-stats .hs-hp-low     { color: var(--hp-low); }
#enemy-header-stats .hs-enemy-divider { color: var(--border); }

/* critical.css sets font-weight/color/letter-spacing; add flex layout here */
#title { display: flex; align-items: center; gap: 0.4rem; }

#pc-header-stats {
  font-size: 11px;
  color: var(--system);
  letter-spacing: 0.03em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
#pc-header-stats .hs-name  { color: var(--gm); font-weight: bold; }
#pc-header-stats .hs-sep   { color: var(--system); margin: 0 0.3rem; }
#pc-header-stats .hs-hp-ok { color: var(--hp-ok); }
#pc-header-stats .hs-hp-low{ color: var(--hp-low); }
#turn-counter, #cost-meter { font-size: 12px; color: var(--system); margin-left: auto; }
#cost-meter { margin-left: 0.5rem; }

/* ─── Transcript scrollbar ───────────────────────────────── */
#transcript::-webkit-scrollbar { width: 4px; }
#transcript::-webkit-scrollbar-track { background: transparent; }
#transcript::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }

/* ─── Sketch opacity variants ────────────────────────────── */
#transcript-bg.sketch-off { opacity: 0 !important; }
#transcript-bg.sketch-hi  { opacity: 0.45; }
#transcript:hover #transcript-bg:not(.sketch-off) { opacity: 0.6; }
#transcript:hover #transcript-bg.sketch-hi        { opacity: 0.8; }

/* ─── Entry variants not in critical.css ────────────────── */
.entry-option-default { color: var(--gm); }
.entry-thinking { color: var(--system); font-style: italic; }

/* ─── Sidebar ────────────────────────────────────────────── */
#sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  background: var(--bg-mid);
  border-left: 1px solid var(--border);
  padding: 0.8rem;
  overflow-y: auto;
  overflow-x: hidden;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  transition: width 0.18s ease, padding 0.18s ease;
}
#sidebar.collapsed {
  width: 0;
  padding: 0;
  border-left-color: transparent;
}

/* ─── Sidebar backdrop (mobile only) ────────────────────── */
#sidebar-backdrop {
  display: none;
}

#sidebar-close {
  display: none;
}

@media (max-width: 767px) {
  /* Sidebar becomes full-screen overlay */
  #sidebar:not(.collapsed) {
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    width: 85vw;
    max-width: 320px;
    z-index: 20;
    border-left: 1px solid var(--border);
  }

  /* Tap-outside backdrop */
  #sidebar-backdrop {
    display: block;
    position: absolute;
    inset: 0;
    z-index: 19;
    background: rgba(0, 0, 0, 0.55);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.18s ease;
  }
  #sidebar-backdrop.active {
    opacity: 1;
    pointer-events: auto;
  }

  /* Close button inside sidebar */
  #sidebar-close {
    display: flex;
    align-items: center;
    justify-content: center;
    margin-left: auto;
    background: transparent;
    border: none;
    color: var(--system);
    font-family: var(--font);
    font-size: 18px;
    cursor: pointer;
    min-width: 44px;
    min-height: 44px;
  }
  #sidebar-close:hover { color: var(--text); }

  /* Header above sidebar overlay */
  #chrome { z-index: 21; position: relative; }

  /* Sidebar toggle — larger touch target */
  #sidebar-toggle {
    min-width: 44px;
    min-height: 44px;
    font-size: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
  }

  /* Hide cost meter — too narrow in row 1 */
  #cost-meter { display: none; }

  /* Hide brand bar — not useful in-game on mobile */
  #brand-bar { display: none; }

  /* Chrome row 2 tighter padding */
  #chrome { padding: 0.15rem 0.75rem; }

  /* Action bar — clear scroll hint */
  #action-bar {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  /* Compass — larger touch targets on mobile */
  #ab-compass {
    grid-template-columns: repeat(3, 44px);
    grid-template-rows: repeat(3, 44px);
  }
  .ab-dir-btn { font-size: 16px; }

  /* Footer fixed above virtual keyboard */
  #footer {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 10;
  }
  #game {
    padding-bottom: 0; /* footer is fixed, no extra space needed */
  }
}

/* ─── Sidebar header ─────────────────────────────────────── */
#sidebar-header {
  display: flex;
  align-items: center;
  flex-shrink: 0;
  gap: 0.5rem;
}
#sidebar-title {
  font-family: var(--font);
  font-size: 11px;
  font-weight: bold;
  color: var(--gm);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  flex: 1;
}

#sidebar-toggle {
  margin-left: auto;
  background: transparent;
  border: none;
  color: var(--system);
  font-family: var(--font);
  font-size: 20px;
  cursor: pointer;
  padding: 0.15rem 0.4rem;
  border-radius: 2px;
  flex-shrink: 0;
  line-height: 1;
}
#sidebar-toggle:hover { color: var(--text); }

.muted { color: var(--system); font-size: 12px; }

/* ─── Action chips ───────────────────────────────────────── */
/* Contextual actions live in the footer, directly above the input: a wrapping
   row so a player can click their way through a turn without typing. Collapses
   to nothing between turns so the footer doesn't jump. */
#action-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
  padding: 0.4rem 0.6rem 0;
  max-height: 5.5rem;
  overflow-y: auto;
}

#action-chips:empty { display: none; }

/* ─── Character chips (weapons + class abilities) ────────── */
#character-chips {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  border-top: 1px solid var(--border);
  padding-top: 0.4rem;
}

#character-chips:empty { display: none; }

#character-chips .chip {
  font-size: 10px;
  padding: 0.15rem 0.5rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.3rem;
}

.char-spell-info {
  font-size: 9px;
  color: var(--system);
  padding: 0.1rem 0.5rem;
  font-style: italic;
}

/* ─── Skill chips ────────────────────────────────────────── */
#skill-chips {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  max-height: 200px;
  overflow-y: auto;
  border-top: 1px solid var(--border);
  padding-top: 0.4rem;
}

#skill-chips:empty { display: none; }

#skill-chips .chip {
  font-size: 10px;
  padding: 0.15rem 0.5rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.3rem;
}

#skill-chips .chip.disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

.skill-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.skill-ab   { color: var(--system); font-size: 9px; flex-shrink: 0; }

.chip {
  background: var(--chip-bg);
  border: 1px solid var(--chip-border);
  color: var(--text);
  font-family: var(--font);
  font-size: 12px;
  padding: 0.3rem 0.6rem;
  text-align: left;
  cursor: pointer;
  border-radius: 2px;
  transition: background 0.1s;
}
.chip:hover { background: var(--chip-hover); border-color: var(--system); }
.chip:active { background: var(--border); }
.chip-retry  { color: var(--gm); border-color: var(--gm); }

/* ─── Debug bar ──────────────────────────────────────────── */
#debug-bar {
  display: none;           /* hidden until first debug data */
  align-items: center;
  justify-content: space-between;
  padding: 0.2rem 1rem;
  border-bottom: 1px solid var(--border);
  color: var(--system);
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  cursor: pointer;
  user-select: none;
}
#debug-bar.visible { display: flex; }
#debug-bar:hover { background: var(--bg-edge); }
.toggle-chevron { font-size: 9px; }

#debug-panel.collapsed { display: none; }

/* ─── Footer ─────────────────────────────────────────────── */
#footer {
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  border-top: 1px solid var(--border);
  background: var(--bg-mid);
}

/* ─── Debug panel (horizontal sections row) ──────────────── */
#debug-panel {
  display: flex;
  flex-direction: row;
  gap: 2rem;
  padding: 0.35rem 1rem;
  font-size: 11px;
  border-bottom: 1px solid var(--border);
  overflow-x: auto;
}

#debug-panel:empty { display: none; }

#debug-panel::-webkit-scrollbar { height: 3px; }
#debug-panel::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }

.dbg-section  { flex-shrink: 0; }

.dbg-sep {
  --debug-sep: #4d4d4d;
  color: var(--debug-sep);
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-bottom: 0.15rem;
}

.dbg-row      { color: var(--system); line-height: 1.45; white-space: pre; }
.dbg-row.hit  { color: var(--hp-ok); }
.dbg-row.miss { color: var(--hp-low); }
.dbg-row.dim  { color: #5a5a5a; font-style: italic; white-space: normal; max-width: 180px; }
.nat-1  { font-weight: bold; color: #b44fdb; }
.nat-20 { font-weight: bold; color: #ffaa00; }

/* ─── Input row ──────────────────────────────────────────── */
#input-row {
  display: flex;
  align-items: center;
  padding: 0.5rem 1rem;
  gap: 0.5rem;
}

#prompt-indicator { color: var(--player); font-weight: bold; flex-shrink: 0; }

#cmd {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  color: var(--player);
  font-family: var(--font);
  font-size: 14px;
  caret-color: var(--player);
}

#cmd::placeholder { color: var(--system); }
#cmd:disabled     { opacity: 0.4; }

/* Key prompt (ui/input.js promptSecret): a real form so password managers save it */
#secret-form { flex: 1; display: flex; gap: 0.5rem; align-items: center; min-width: 0; }
#secret-form input[type="password"] {
  flex: 1; min-width: 0; background: transparent; border: none; outline: none;
  color: var(--player); font-family: var(--font); font-size: 14px; caret-color: var(--player);
}
#secret-form .secret-user { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
#secret-form .secret-ok {
  background: transparent; color: var(--player); border: 1px solid currentColor;
  font-family: var(--font); font-size: 12px; padding: 0.1rem 0.5rem; cursor: pointer;
}

/* Blink the prompt indicator while the field is focused */
#input-row.active #prompt-indicator {
  animation: prompt-blink 1s step-end infinite;
}
@keyframes prompt-blink {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0; }
}


/* ─── Sketch size controls (sidebar) ────────────────────── */
#sketch-controls {
  display: flex;
  align-items: center;
  gap: 0.2rem;
  padding: 0.3rem 0.5rem;
  border-bottom: 1px solid var(--border);
}
#sketch-controls-label {
  flex: 1;
  font-family: var(--font);
  font-size: 10px;
  color: var(--system);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
#sketch-controls button {
  background: transparent;
  border: 1px solid transparent;
  color: var(--system);
  font-family: var(--font);
  font-size: 14px;
  cursor: pointer;
  padding: 0 0.3rem;
  border-radius: 2px;
  line-height: 1.3;
  transition: color 0.15s, border-color 0.15s;
}
#sketch-controls button:hover { color: var(--text); border-color: var(--border); }
#sketch-controls button[aria-pressed="true"] {
  color: var(--gm);
  border-color: var(--gm);
  background: rgba(212, 184, 150, 0.08);
}

/* ─── Action bar toggle (sidebar) ───────────────────────── */
#ab-toggle-row {
  display: flex;
  align-items: center;
  gap: 0.2rem;
  padding: 0.3rem 0.5rem;
  border-bottom: 1px solid var(--border);
}
.ab-toggle-label {
  flex: 1;
  font-family: var(--font);
  font-size: 10px;
  color: var(--text);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
#action-bar-toggle,
#debug-bar-toggle {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--system);
  font-family: var(--font);
  font-size: 10px;
  cursor: pointer;
  padding: 0.1rem 0.4rem;
  border-radius: 2px;
  line-height: 1.4;
  transition: color 0.15s, border-color 0.15s;
}
#action-bar-toggle:hover,
#debug-bar-toggle:hover { color: var(--text); border-color: var(--system); }
#action-bar-toggle[aria-pressed="true"],
#debug-bar-toggle[aria-pressed="true"],
#sketch-toggle[aria-pressed="true"] {
  color: var(--gm);
  border-color: var(--gm);
  background: rgba(212, 184, 150, 0.08);
}

/* ─── Roll audit (sidebar) ─────────────────────────────── */
#verify-row {
  display: flex;
  align-items: center;
  gap: 0.2rem;
  padding: 0.3rem 0.5rem;
  border-bottom: 1px solid var(--border);
}
#verify-rolls-btn {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--system);
  font-family: var(--font);
  font-size: 10px;
  cursor: pointer;
  padding: 0.1rem 0.4rem;
  border-radius: 2px;
  line-height: 1.4;
  transition: color 0.15s, border-color 0.15s;
}
#verify-rolls-btn:hover { color: var(--text); border-color: var(--system); }

/* ─── Sketch on/off toggle (sidebar) ───────────────────── */
#sketch-toggle-row {
  display: flex;
  align-items: center;
  gap: 0.2rem;
  padding: 0.3rem 0.5rem;
  border-bottom: 1px solid var(--border);
}
#sketch-toggle {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--system);
  font-family: var(--font);
  font-size: 10px;
  cursor: pointer;
  padding: 0.1rem 0.4rem;
  border-radius: 2px;
  line-height: 1.4;
  transition: color 0.15s, border-color 0.15s;
}
#sketch-toggle:hover { color: var(--text); border-color: var(--system); }

/* ─── Locale switcher ────────────────────────────────────── */
#locale-switch {
  display: inline-flex;
  align-items: center;
  gap: 0.2rem;
}
.locale-opt {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--system);
  cursor: pointer;
  font-family: var(--font);
  font-size: 10px;
  padding: 0.1rem 0.4rem;
  border-radius: 2px;
  transition: color 0.15s, background 0.15s, border-color 0.15s;
}
.locale-opt:hover { color: var(--text); border-color: var(--system); }
.locale-opt.active {
  color: var(--gm);
  border-color: var(--gm);
  background: rgba(212, 184, 150, 0.15);
}
.locale-sep {
  color: var(--system);
  font-size: 10px;
  user-select: none;
}

/* ─── Action bar ─────────────────────────────────────────── */
#action-bar {
  display: flex;
  flex-direction: row;
  min-height: 145px;
  align-items: flex-start;
  gap: 0;
  border-bottom: 1px solid var(--border);
  background: var(--bg-mid);
  padding: 0.4rem 0.75rem;
  overflow-x: auto;
}
#action-bar::-webkit-scrollbar { height: 3px; }
#action-bar::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }

.ab-zone {
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
}
.ab-abilities-zone,
.ab-skills-zone { flex-shrink: 1; min-width: 0; }

.ab-zone-label {
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text);
  margin-bottom: 0.3rem;
  white-space: nowrap;
}

.ab-divider {
  width: 1px;
  background: var(--border);
  margin: 0 0.6rem;
  align-self: stretch;
  flex-shrink: 0;
}

/* ─── Compass ────────────────────────────────────────────── */
#ab-compass {
  display: grid;
  grid-template-columns: repeat(3, 24px);
  grid-template-rows: repeat(3, 24px);
  gap: 1px;
}

/* ─── Hover-speak button (TTS on GM entries) ─────────────── */
#speak-hover-btn {
  position: fixed;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.12s;
  background: var(--bg-mid);
  border: 1px solid var(--border);
  color: var(--system);
  border-radius: 4px;
  padding: 2px 7px;
  font-size: 13px;
  cursor: pointer;
  z-index: 100;
  line-height: 1.8;
}
#speak-hover-btn.visible   { opacity: 1; pointer-events: auto; }
#speak-hover-btn.speaking  { color: var(--gm); }
#speak-hover-btn:hover     { background: var(--bg-edge); }

/* ─── Mic button in input row ────────────────────────────── */
/* .input-icon-btn is the shared class; #mic-btn adds the pulse state */
.input-icon-btn {
  background: none;
  border: none;
  color: var(--system);
  cursor: pointer;
  padding: 0 6px;
  font-size: 16px;
  line-height: 1;
  flex-shrink: 0;
  transition: color 0.15s;
}
#mic-btn {
  background: none;
  border: none;
  color: #9090a0;
  cursor: pointer;
  padding: 0 6px;
  line-height: 1;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  transition: color 0.15s;
}
#mic-btn.recording {
  color: #f97316;
  animation: mic-pulse 1s ease-in-out infinite;
}
@keyframes mic-pulse {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.35; }
}

/* ─── Autoplay button ────────────────────────────────────── */
#autoplay-btn {
  background: none;
  border: none;
  color: #9090a0;
  cursor: pointer;
  padding: 0 6px;
  line-height: 1;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  transition: color 0.15s;
}
#autoplay-btn.active {
  color: #4ade80;
  animation: autoplay-pulse 2s ease-in-out infinite;
}
@keyframes autoplay-pulse {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.5; }
}

/* ─── Timeline panel (time-travel: spine + branches) ─────── */
#input-row { position: relative; }   /* anchor the timeline panel above the row */

#timeline-btn {
  display: inline-flex;
  align-items: center;
  color: var(--gm);
}
.branch-count {
  font-size: 10px;
  font-weight: bold;
  margin-left: 2px;
  color: var(--player);
}
#timeline-panel {
  display: none;
  position: absolute;
  bottom: calc(100% + 4px);
  right: 1rem;
  min-width: 220px;
  max-width: 360px;
  max-height: 300px;
  overflow-y: auto;
  background: var(--bg-edge);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 4px;
  z-index: 50;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.5);
}
#timeline-panel.open { display: block; }

/* Divergence cue — sits just above the input when scrubbed back. */
#branch-hint {
  padding: 0.25rem 1rem;
  font-size: 11px;
  font-style: italic;
  color: var(--gm);
  border-top: 1px solid var(--border);
}

/* Spine node (one committed turn). A leading dot marks the rail; the current
   node fills it and tints the row. */
.tl-node, .tl-branch {
  display: block;
  width: 100%;
  text-align: left;
  background: none;
  border: none;
  color: var(--text);
  font-family: var(--font);
  font-size: 13px;
  padding: 5px 8px 5px 22px;
  border-radius: 3px;
  cursor: pointer;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  position: relative;
}
.tl-node::before {
  content: '';
  position: absolute;
  left: 9px;
  top: 50%;
  width: 6px;
  height: 6px;
  margin-top: -3px;
  border-radius: 50%;
  border: 1px solid var(--system);
}
.tl-node:hover, .tl-branch:hover { background: var(--bg-mid); color: var(--player); }
.tl-current { color: var(--player); }
.tl-current::before { background: var(--player); border-color: var(--player); }

.tl-section {
  font-size: 11px;
  color: var(--system);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 8px 8px 4px;
  border-top: 1px solid var(--border);
  margin-top: 4px;
}
.tl-branch::before {
  content: '↳';
  position: absolute;
  left: 8px;
  top: 5px;
  color: var(--system);
}

/* ─── TTS toggle — sticky in top-right of transcript ────── */
#tts-toggle {
  position: sticky;
  top: 0.5rem;
  float: right;
  z-index: 10;
  background: var(--bg-mid);
  border: 1px solid var(--border);
  color: var(--system);
  cursor: pointer;
  font-size: 15px;
  padding: 1px 6px;
  border-radius: 4px;
  line-height: 1.8;
  transition: color 0.15s, border-color 0.15s;
  margin-bottom: 0.4rem;
}
#tts-toggle[aria-pressed="true"] { color: var(--gm); border-color: var(--gm); }

/* ─── Roleplay mode button ───────────────────────────────── */
#roleplay-btn {
  margin-left: 0.25rem;
  background: transparent;
  border: none;
  color: var(--system);
  font-family: var(--font);
  font-size: 16px;
  cursor: pointer;
  padding: 0.15rem 0.4rem;
  border-radius: 2px;
  flex-shrink: 0;
  line-height: 1;
}
#roleplay-btn:hover { color: var(--text); }
#roleplay-btn[aria-pressed="true"] { color: var(--gm); }

/* ─── Roleplay mode — immersive view ────────────────────── */
/* Hide all transcript children except the background image */
body.roleplay-mode #transcript > *:not(#transcript-bg) { display: none !important; }
body.roleplay-mode #transcript-bg { opacity: 0.65 !important; }
body.roleplay-mode #transcript:hover #transcript-bg { opacity: 0.75 !important; }
body.roleplay-mode #action-bar  { display: none !important; }
body.roleplay-mode #debug-bar   { display: none !important; }
body.roleplay-mode #debug-panel { display: none !important; }
body.roleplay-mode #brand-bar   { display: none !important; }

/* ─── Roleplay overlay — shown while GM thinks / TTS plays ── */
#roleplay-overlay {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: none;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  background: rgba(13, 13, 13, 0.55);
}
#roleplay-overlay.visible { display: flex; }

.sand-fall {
  position: relative;
  width: 6px;
  height: 64px;
}
.sand-grain {
  position: absolute;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--gm);
  left: 0;
  animation: grain-fall 1.5s ease-in infinite;
}
.sand-grain:nth-child(1) { animation-delay: 0.0s; }
.sand-grain:nth-child(2) { animation-delay: 0.3s; }
.sand-grain:nth-child(3) { animation-delay: 0.6s; }
.sand-grain:nth-child(4) { animation-delay: 0.9s; }
.sand-grain:nth-child(5) { animation-delay: 1.2s; }

@keyframes grain-fall {
  0%   { top: 0;    opacity: 0; }
  8%   { opacity: 1; }
  88%  { opacity: 0.8; }
  100% { top: 60px; opacity: 0; }
}

/* ─── Action bar tooltips ────────────────────────────────── */
#ab-tooltip {
  position: fixed;
  background: #1a1a1a;
  border: 1px solid var(--border);
  color: var(--text);
  font-family: var(--font);
  font-size: 10px;
  font-weight: normal;
  line-height: 1.5;
  white-space: pre-line;
  padding: 4px 8px;
  border-radius: 3px;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.15s;
  z-index: 9999;
  min-width: 120px;
  max-width: 220px;
  text-align: left;
}
#ab-tooltip.visible { opacity: 1; }

/* ─── Compass direction letters ──────────────────────────── */
.ab-dir-btn {
  background: none;
  border: none;
  font-family: var(--font);
  font-size: 11px;
  font-weight: bold;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  cursor: pointer;
  color: var(--text);
  transition: color 0.1s;
}
.ab-dir-btn:hover:not(:disabled):not(.ab-locked) { color: var(--gm); }
.ab-dir-btn:disabled:not(.ab-locked) { opacity: 0.12; cursor: default; }
.ab-dir-btn.ab-locked { color: var(--system); cursor: default; }

/* ─── Ability & skill word clouds ────────────────────────── */
#ab-abilities-list,
#ab-skills-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.15rem 0.5rem;
  align-content: flex-start;
  max-width: 400px;
}

.ab-word {
  font-family: var(--font);
  font-size: 10px;
  font-weight: bold;
  line-height: 1.5;
  cursor: default;
}
.ab-word.ab-available   { color: var(--text); }
.ab-word.ab-active      { color: var(--gm); }
/* Fixed color instead of opacity so contrast checkers can reason about it */
.ab-word.ab-unavailable { color: #4a4a4a; }

/* Middle-dot separator between skill words so they're easy to tell apart */
#ab-skills-list .ab-word + .ab-word::before {
  content: ' · ';
  color: var(--system);
  font-weight: normal;
}

/* ─── Deluxe section ────────────────────────────────────── */
#deluxe-section {
  padding: 0.3rem 0.5rem;
  border-bottom: 1px solid var(--border);
}
#deluxe-feature-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
  margin-top: 0.3rem;
}
.deluxe-feature {
  font-family: var(--font);
  font-size: 9px;
  color: var(--gm);
  border: 1px solid var(--gm);
  border-radius: 2px;
  padding: 0.05rem 0.3rem;
  opacity: 0.7;
}

/* ─── Export zone ────────────────────────────────────────── */
#character-zone {
  padding: 0.3rem 0.5rem 0.4rem;
  border-bottom: 1px solid var(--border);
}
#character-zone:has(#character-chips:empty):has(#skill-chips:empty) { display: none; }

#export-zone {
  padding: 0.3rem 0.5rem 0.4rem;
  border-bottom: 1px solid var(--border);
}
.export-zone-label {
  font-family: var(--font);
  font-size: 10px;
  color: var(--text);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  margin-bottom: 0.3rem;
}
#export-tiles {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 3px;
}
.export-tile {
  background: var(--chip-bg);
  border: 1px solid var(--chip-border);
  color: var(--text);
  font-family: var(--font);
  font-size: 10px;
  min-height: 44px;
  padding: 0.25rem 0.4rem;
  border-radius: 2px;
  cursor: pointer;
  text-align: center;
  letter-spacing: 0.03em;
  transition: color 0.15s, border-color 0.15s, background 0.1s;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.export-tile:hover { color: var(--gm); border-color: var(--gm); background: var(--chip-hover); }
.export-tile:active { background: var(--border); }

/* (scene-image-panel removed — image is now the transcript background) */

/* ─── Brand bar ──────────────────────────────────────────── */
#brand-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.25rem 1rem;
  background: var(--bg-edge);
  border-top: 1px solid var(--border);
  font-size: 11px;
  color: var(--system);
  flex-shrink: 0;
}

#brand-bar a {
  color: var(--text);
  text-decoration: none;
}

#brand-bar a:hover { color: var(--text); }

.brand-social { display: flex; gap: 0.75rem; align-items: center; }
.brand-icon { width: 16px; height: 16px; fill: currentColor; display: block; }
.brand-company { color: var(--gm); font-weight: bold; letter-spacing: 0.03em; }
.brand-company:hover { color: var(--text); }
.brand-powered em { font-style: italic; letter-spacing: 0.05em; }

/* ─── Legal / attribution (SRD 5.2 is CC-BY: the credit must reach players) ── */
#legal-zone {
  padding: 0.4rem 0.5rem;
  border-bottom: 1px solid var(--border);
}
.legal-line {
  font-size: 10px;
  line-height: 1.5;
  color: var(--system);
  display: block;
}
.legal-line a { color: var(--system); text-decoration: underline; }
.legal-line a:hover { color: var(--text); }

/* ─── Accessibility and mobile (Epic E10) ────────────────────────────────── */

/* iOS zooms the whole page when a focused input's text is under 16px. The game
   is a text field the player lives in, so that zoom fired constantly. */
@media (max-width: 767px) {
  #cmd, #secret-form input[type="password"] { font-size: 16px; }
}

/* There were no focus styles at all, so keyboard players could not see where
   they were. Only shown for keyboard focus, so mouse users see no change. */
:focus-visible {
  outline: 2px solid var(--gm);
  outline-offset: 2px;
  border-radius: 2px;
}

/* The smallest type was 9px at a 2.1:1 contrast ratio — below the 4.5:1 floor
   and below any readable size. Raise both without disturbing the layout. */
.skill-ab,
.char-spell-info {
  font-size: 11px;
  color: var(--text);
  opacity: 0.75;
}

.legal-line { font-size: 11px; }

/* Respect a player who has asked for less motion: the streaming transcript and
   the thinking indicator are the two things that animate. */
@media (prefers-reduced-motion: reduce) {
  * { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
  html { scroll-behavior: auto; }
}

/* A second tab on the same campaign never saves; the notice has to stay put
   rather than scroll away with the transcript. */
#spectator-banner {
  grid-column: 1 / -1;
  padding: 0.35rem 0.6rem;
  font-size: 0.8rem;
  line-height: 1.3;
  color: #f0d8a0;
  background: #5a2a1a;
  border-top: 1px solid #8c4a2a;
}
