/* The deck's own ink, so a mark judged here is judged where it will live. */
:root {
  --field: #0b0e13;
  --rail: #0e131b;
  --panel: #11161d;
  --card: #0f141b;
  --row-hover: #202734;
  --edge: #252d38;
  --edge-strong: #303947;
  --chip: #1b2230;
  --ink: #e8edf2;
  --ink-bright: #f4f7fb;
  --faint: #9aa6b5;
  --dim: #6b7686;
  --dimmer: #56606f;

  --working: #62d6a7;
  --blocked: #f19aa7;
  --done: #7fa7ff;
  --idle: #d5a64a;
  --none: #56606f;

  --mono: "Hack", "Cascadia Mono", "Consolas", ui-monospace, monospace;
  --sans: "Inter", "Segoe UI", system-ui, -apple-system, sans-serif;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--field);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

code {
  font-family: var(--mono);
  font-size: 0.86em;
  color: var(--faint);
  background: #0f141b;
  border: 1px solid var(--edge);
  border-radius: 4px;
  padding: 0 4px;
}

/* ---------------------------------------------------------------- masthead */

.masthead {
  border-bottom: 1px solid var(--edge);
  background: linear-gradient(180deg, #10161f, var(--field));
}

.mast-inner,
.section-inner,
.console-inner,
.foot p {
  max-width: 1180px;
  margin: 0 auto;
  padding: 0 28px;
}

.mast-inner { padding-top: 44px; padding-bottom: 36px; }

.mast-brand {
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--dim);
}

.mast-dot { color: var(--edge-strong); }

h1 {
  margin: 10px 0 12px;
  font-size: 40px;
  line-height: 1.1;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.lede { margin: 0; max-width: 74ch; color: var(--faint); }

.rules {
  margin-top: 26px;
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(auto-fit, minmax(255px, 1fr));
}

.rule {
  background: var(--card);
  border: 1px solid var(--edge);
  border-radius: 8px;
  padding: 13px 15px;
  font-size: 13.5px;
  line-height: 1.5;
  color: var(--faint);
}

.rule-name {
  display: block;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--idle);
  margin-bottom: 5px;
}

/* ---------------------------------------------------------------- sections */

.section { border-bottom: 1px solid var(--edge); padding: 40px 0 44px; }

.section-head { display: flex; align-items: baseline; gap: 12px; }

.section-no {
  font-family: var(--mono);
  font-size: 13px;
  color: var(--idle);
  border: 1px solid var(--edge-strong);
  border-radius: 5px;
  padding: 1px 7px;
}

h2 { margin: 0; font-size: 25px; font-weight: 600; letter-spacing: -0.01em; }

.section-lede { margin: 10px 0 24px; max-width: 74ch; color: var(--faint); font-size: 14px; }

.options {
  display: grid;
  gap: 16px;
  grid-template-columns: repeat(auto-fit, minmax(310px, 1fr));
}

.option {
  background: var(--card);
  border: 1px solid var(--edge);
  border-radius: 10px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.option-head {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 11px 14px 9px;
  border-bottom: 1px solid var(--edge);
}

.option-key {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--field);
  background: var(--faint);
  border-radius: 4px;
  padding: 1px 6px;
}

.option-name { font-size: 14.5px; font-weight: 600; }

.option-note {
  padding: 11px 14px 13px;
  font-size: 13px;
  color: var(--faint);
  line-height: 1.5;
  border-top: 1px solid var(--edge);
}

.option[data-quiet="yes"] .option-key { background: var(--working); }

/* -------------------------------------------------------------- the rail */

.rail {
  background: var(--rail);
  padding: 8px 0;
  font-family: var(--mono);
  font-size: 12px;
  line-height: 1.35;
}

.rail-live { max-height: 560px; overflow-y: auto; }

.space {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px 3px;
  color: var(--dim);
  font-size: 11px;
  letter-spacing: 0.04em;
}

.space::before {
  content: "";
  width: 7px;
  height: 7px;
  border: 1px solid var(--edge-strong);
  border-radius: 2px;
  flex: 0 0 auto;
}

.row {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 3px 10px 3px 22px;
  color: var(--faint);
  position: relative;
}

.row + .space { margin-top: 7px; }

.row.is-selected { background: var(--row-hover); color: var(--ink); }

.row-tick {
  width: 9px;
  border-top: 1px solid #232b37;
  flex: 0 0 auto;
}

.row-agent { color: #cfd8e5; flex: 0 0 auto; }
.row.is-selected .row-agent { color: var(--ink-bright); }

.row-arrow { color: var(--dimmer); flex: 0 0 auto; }

.row-title {
  color: var(--faint);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* the mark, and every frame it can wear ---------------------------------- */

.mark {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  position: relative;
  width: var(--mark-box, 13px);
  height: var(--mark-box, 13px);
}

.frame-box .mark {
  background: var(--chip);
  border: 1px solid var(--edge-strong);
  border-radius: 3px;
}

.frame-soft .mark {
  background: rgba(154, 166, 181, 0.07);
  border: 1px solid transparent;
  border-radius: 3px;
}

.frame-round .mark {
  background: rgba(154, 166, 181, 0.07);
  border: 1px solid transparent;
  border-radius: 50%;
}

.frame-none .mark { background: none; border: 1px solid transparent; }

.glyph {
  width: var(--mark-glyph, 10px);
  height: var(--mark-glyph, 10px);
  display: block;
}

/* the art as the deck ships it */
.ink-native .glyph.is-image { background-size: contain; background-repeat: no-repeat; background-position: center; }

/* the same shape, painted by the stylesheet */
.glyph.is-mask {
  background-color: currentColor;
  -webkit-mask-size: contain;
  mask-size: contain;
  -webkit-mask-repeat: no-repeat;
  mask-repeat: no-repeat;
  -webkit-mask-position: center;
  mask-position: center;
}

.glyph svg { width: 100%; height: 100%; display: block; }

.mono-glyph {
  font-family: var(--mono);
  font-size: calc(var(--mark-glyph, 10px) * 0.98);
  line-height: 1;
  letter-spacing: 0;
  color: currentColor;
}

.mono-glyph.is-pair { font-size: calc(var(--mark-glyph, 10px) * 0.72); letter-spacing: -0.02em; }

.dot-glyph {
  width: calc(var(--mark-glyph, 10px) * 0.52);
  height: calc(var(--mark-glyph, 10px) * 0.52);
  border-radius: 50%;
  background: currentColor;
}

/* status ------------------------------------------------------------------ */

.status-ring .mark::after {
  content: "";
  position: absolute;
  inset: -2px;
  border: 1px solid var(--tone);
  border-radius: 50%;
  pointer-events: none;
}

.status-ring .row[data-status="none"] .mark::after,
.status-ring .row[data-status="unknown"] .mark::after { display: none; }

.status-dot .row-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--tone);
  flex: 0 0 auto;
}

.status-bar .row::before {
  content: "";
  position: absolute;
  left: 0;
  top: 1px;
  bottom: 1px;
  width: 2px;
  border-radius: 1px;
  background: var(--tone);
}

.status-bar .row[data-status="none"]::before { background: transparent; }

.status-underline .mark::after {
  content: "";
  position: absolute;
  left: 1px;
  right: 1px;
  bottom: -3px;
  height: 1.5px;
  border-radius: 1px;
  background: var(--tone);
}

.status-underline .row[data-status="none"] .mark::after { display: none; }

/* ---------------------------------------------------------------- console */

.console { padding: 44px 0 56px; background: linear-gradient(180deg, var(--field), #10161f); }

.console-grid {
  display: grid;
  gap: 20px;
  grid-template-columns: minmax(260px, 320px) 1fr;
  align-items: start;
}

@media (max-width: 900px) {
  .console-grid { grid-template-columns: 1fr; }
  .mast-inner, .section-inner, .console-inner, .foot p { padding: 0 18px; }
  h1 { font-size: 30px; }
}

.console-controls {
  background: var(--card);
  border: 1px solid var(--edge);
  border-radius: 10px;
  padding: 6px 14px 14px;
}

.control { padding: 10px 0 0; }

.control-name {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--dim);
  margin-bottom: 6px;
}

.choices { display: flex; flex-wrap: wrap; gap: 5px; }

.choice {
  font-family: var(--mono);
  font-size: 11.5px;
  color: var(--faint);
  background: #0f141b;
  border: 1px solid var(--edge);
  border-radius: 5px;
  padding: 3px 8px;
  cursor: pointer;
}

.choice:hover { border-color: var(--edge-strong); color: var(--ink); }

.choice[aria-pressed="true"] {
  color: var(--field);
  background: var(--faint);
  border-color: var(--faint);
}

.console-stage {
  background: var(--panel);
  border: 1px solid var(--edge);
  border-radius: 10px;
  overflow: hidden;
}

.stage-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 9px 13px;
  border-bottom: 1px solid var(--edge);
  font-family: var(--mono);
  font-size: 11px;
  color: var(--dim);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.stage-toggle { display: inline-flex; align-items: center; gap: 6px; cursor: pointer; }

.stage-note {
  padding: 11px 13px;
  border-top: 1px solid var(--edge);
  font-size: 13px;
  color: var(--faint);
}

.rail-live.is-narrow { max-width: 268px; }
.rail-live.is-narrow .row-title { display: none; }

.pick {
  margin-top: 20px;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.pick-label {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--dim);
}

#pick { font-size: 14px; color: var(--ink); padding: 4px 9px; }

#copy {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--faint);
  background: var(--chip);
  border: 1px solid var(--edge-strong);
  border-radius: 5px;
  padding: 4px 10px;
  cursor: pointer;
}

#copy:hover { color: var(--ink); border-color: var(--faint); }

/* -------------------------------------------------------------- gallery */

.gallery {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  padding: 13px 14px;
  background: var(--rail);
  border-top: 1px solid var(--edge);
}

.gallery-cell {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  min-width: 46px;
}

.gallery-name {
  font-family: var(--mono);
  font-size: 10px;
  color: var(--dim);
}

.foot {
  border-top: 1px solid var(--edge);
  padding: 26px 0 40px;
  color: var(--dim);
  font-size: 13px;
}
