/* HTML chrome only — the table itself is rendered on the PixiJS canvas behind
   everything. Theme tokens mirror the sim-viewer for a consistent look. */
:root {
  --bg: #0f1115;
  --panel: #1c2029;
  --panel-2: #232834;
  --line: #2c3340;
  --text: #e7ebf0;
  --muted: #97a1b0;
  --accent: #6ee7a8;
  --accent-2: #ffd479;
  --shadow: 0 6px 20px rgba(0, 0, 0, 0.4);
  --round: 14px;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  background: var(--bg);
  color: var(--text);
  font:
    14px/1.45 ui-rounded,
    'Segoe UI Rounded',
    system-ui,
    -apple-system,
    Segoe UI,
    Roboto,
    sans-serif;
}

#stage {
  position: fixed;
  inset: 0;
  z-index: 0;
}

#stage canvas {
  display: block;
}

/* --- top bar --- */
.topbar {
  position: fixed;
  z-index: 3;
  top: 0;
  left: 0;
  right: 0;
  height: 52px;
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 0 16px;
  background: linear-gradient(180deg, rgba(15, 17, 21, 0.92), rgba(15, 17, 21, 0.55));
  backdrop-filter: blur(6px);
}

.brand {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: 0.3px;
}

.brand .tag {
  font-size: 11px;
  font-weight: 600;
  color: var(--accent-2);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 1px 8px;
  vertical-align: middle;
  margin-left: 4px;
}

.controls {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--muted);
}

.controls select,
.controls button,
.actionbar button {
  font: inherit;
  color: var(--text);
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 6px 12px;
  cursor: pointer;
}

.controls button:hover,
.actionbar button:hover {
  border-color: var(--accent);
}

.status {
  margin-left: auto;
  color: var(--muted);
  font-weight: 600;
}

.status.you {
  color: var(--accent);
}

/* --- table log --- */
.log {
  position: fixed;
  z-index: 2;
  top: 64px;
  right: 12px;
  width: 216px;
  max-height: 196px;
  /* A fixed-footprint box whose history scrolls inside (#logList). No seat is
     ever drawn under it — drawOpponent reserves this panel's rect — so it never
     covers or blocks a player/card target. */
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: color-mix(in srgb, var(--panel) 80%, transparent);
  border: 1px solid var(--line);
  border-radius: var(--round);
  padding: 10px 12px;
  box-shadow: var(--shadow);
}

.log-title {
  font-weight: 700;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--muted);
  margin-bottom: 6px;
}

/* The full game record, newest at the bottom, scrolls within the fixed box. */
.log-list {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.log-turn {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

/* A turn divider: small uppercase header with a hairline above it. */
.log-turn-head {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--muted);
  padding-top: 5px;
  border-top: 1px solid var(--line);
}
.log-turn:first-child .log-turn-head {
  border-top: none;
  padding-top: 0;
}
.log-turn-head.you {
  color: var(--accent);
}

.log-entries {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding-left: 2px;
}

/* One logged line. A coloured left rail keys the kind at a glance. */
.log-entry {
  color: var(--text);
  font-size: 12px;
  line-height: 1.3;
  padding-left: 7px;
  border-left: 2px solid transparent;
}
.log-entry.you {
  color: var(--accent-2);
}
.log-entry.letter {
  border-left-color: #ffd479;
}
.log-entry.lure,
.log-entry.steal,
.log-entry.kill {
  border-left-color: #e0594f;
}
.log-entry.trap,
.log-entry.destroy {
  border-left-color: #9a6ad1;
}
.log-entry.protect,
.log-entry.plague {
  border-left-color: #43c06d;
}
.log-entry.cancel,
.log-entry.interrupt {
  border-left-color: #6ea8ff;
}

/* The "jump to latest" pill, shown only when scrolled up from the newest line. */
.log-jump {
  align-self: center;
  margin-top: 6px;
  padding: 2px 10px;
  font-size: 11px;
  color: var(--text);
  background: color-mix(in srgb, var(--accent) 24%, transparent);
  border: 1px solid var(--line);
  border-radius: 999px;
  cursor: pointer;
}
.log-jump:hover {
  background: color-mix(in srgb, var(--accent) 36%, transparent);
}

/* --- center banner (thinking / game over) --- */
.banner {
  position: fixed;
  z-index: 4;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  padding: 14px 26px;
  border-radius: 16px;
  background: color-mix(in srgb, var(--panel) 92%, transparent);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  font-size: 18px;
  font-weight: 700;
  text-align: center;
  pointer-events: none;
}

.banner.win {
  font-size: 24px;
  border-color: var(--accent-2);
  color: var(--accent-2);
}

/* --- action bar (your turn) --- */
.actionbar {
  position: fixed;
  z-index: 3;
  right: 14px;
  bottom: 14px;
  width: min(320px, 42vw);
  background: color-mix(in srgb, var(--panel) 94%, transparent);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 8px 12px;
  box-shadow: var(--shadow);
}

.action-header {
  font-weight: 700;
  margin-bottom: 3px;
}

.action-desc {
  min-height: 18px;
  margin-bottom: 4px;
  line-height: 1.25;
}

.action-desc .ci-name {
  font-weight: 700;
}

.action-desc .ci-type {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  color: var(--accent-2);
  margin-left: 6px;
}

.action-desc .ci-text {
  color: var(--muted);
  font-size: 13px;
  margin-top: 2px;
}

.action-desc .ci-hint {
  color: var(--muted);
  font-style: italic;
}

.action-options .opt.cancel {
  color: var(--muted);
}

.action-options {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.action-options .opt {
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 5px 11px;
  cursor: pointer;
  transition:
    transform 0.08s,
    border-color 0.12s,
    background 0.12s;
}

.action-options .opt:hover {
  transform: translateY(-2px);
  border-color: var(--accent);
}

.action-options .opt.selected {
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 22%, var(--panel-2));
}

.action-options .opt .ord {
  display: inline-block;
  min-width: 18px;
  margin-right: 4px;
  color: var(--accent);
  font-weight: 700;
}

.action-foot {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 6px;
}

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

.confirm {
  margin-left: auto;
  background: color-mix(in srgb, var(--accent) 26%, var(--panel-2)) !important;
  border-color: var(--accent) !important;
  font-weight: 700;
}

.confirm[disabled] {
  opacity: 0.4;
  cursor: not-allowed;
}

.hidden {
  display: none !important;
}

/* Build-identity badge (bottom-right). Rendered by version-badge.js from
   /api/version — unobtrusive at rest, brightens on hover. */
.version-badge {
  position: fixed;
  right: 8px;
  bottom: 6px;
  z-index: 1000;
  font:
    11px/1.4 ui-monospace,
    SFMono-Regular,
    Menlo,
    monospace;
  color: var(--muted);
  background: rgba(28, 32, 41, 0.55);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 2px 7px;
  opacity: 0.45;
  transition: opacity 0.15s ease;
  pointer-events: auto;
}
.version-badge:hover {
  opacity: 1;
}
.version-badge a {
  color: var(--accent);
  text-decoration: none;
}
.version-badge a:hover {
  text-decoration: underline;
}
/* --- report-issue modal (ADR 0005) --- */
.report-modal {
  position: fixed;
  inset: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(8, 10, 14, 0.72);
  backdrop-filter: blur(3px);
}

.report-card {
  width: min(440px, 92vw);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 20px 22px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  box-shadow: 0 18px 60px rgba(0, 0, 0, 0.5);
}

.report-title {
  font-size: 18px;
  font-weight: 700;
  color: var(--text);
}

.report-blurb {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.4;
}

.report-desc {
  font: inherit;
  color: var(--text);
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 8px 10px;
  resize: vertical;
}

.report-priority {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
}

.report-priority select {
  font: inherit;
  color: var(--text);
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 6px 10px;
}

.report-result {
  font-size: 13px;
  min-height: 1.2em;
  color: var(--muted);
  word-break: break-word;
}

.report-result a {
  color: var(--accent);
}

.report-result.error {
  color: #ff9a9a;
}

.report-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

.report-actions button {
  font: inherit;
  border-radius: 10px;
  padding: 6px 14px;
  cursor: pointer;
  border: 1px solid var(--line);
}

.report-secondary {
  color: var(--text);
  background: var(--panel-2);
}

.report-primary {
  color: #0f1115;
  background: var(--accent);
  border-color: var(--accent);
  font-weight: 600;
}

.report-primary[disabled] {
  opacity: 0.5;
  cursor: not-allowed;
}
