/* Trenchdex: one printed field sheet, two inks on black grain.
   Built to his poster (art/ref/poster.jpg): the composition, the scale, the frames and the
   two-ink rule are his; the words, the coins and the mechanic are ours. */

@font-face {
  font-family: "Pixeloid";
  src: url("/app/fonts/pixeloid-bold.ttf") format("truetype");
  font-weight: 700;
  font-display: swap;
}
@font-face {
  font-family: "Technor";
  src: url("/app/fonts/technor-regular.woff2") format("woff2");
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: "Technor";
  src: url("/app/fonts/technor-bold.woff2") format("woff2");
  font-weight: 700;
  font-display: swap;
}
@font-face {
  font-family: "Krypton";
  src: url("/app/fonts/krypton-medium.woff2") format("woff2");
  font-weight: 500;
  font-display: swap;
}
@font-face {
  font-family: "HappyTimes";
  src: url("/app/fonts/happytimes-italic.woff2") format("woff2");
  font-style: italic;
  font-weight: 400;
  font-display: swap;
}

:root {
  --black: #0e0e0f;
  --cream: #efe2cb;
  --blue: #6b93b8;
  --blue-weak: rgba(107, 147, 184, 0.42);
  --cream-weak: rgba(239, 226, 203, 0.5);

  --display: "Pixeloid", "Courier New", monospace;
  --text: "Technor", "Segoe UI", sans-serif;
  --mono: "Krypton", ui-monospace, "Consolas", monospace;
  --serif: "HappyTimes", Georgia, serif;

  --frame: 4px;       /* his cream frames */
  --hair: 2px;        /* his blue hairlines */
  --pad: 30px;        /* inner padding of every framed cell */
  --gap: 34px;

  --label: 17px;
  --body: 18px;
  --value: 19px;
}

* { box-sizing: border-box; }

html {
  background: var(--black);
  scrollbar-gutter: stable;
}

body {
  margin: 0;
  background: var(--black);
  color: var(--cream);
  font-family: var(--text);
  font-size: var(--body);
  font-synthesis: none;
  -webkit-font-smoothing: antialiased;
  line-height: 1.5;
}

.grain {
  position: fixed;
  inset: 0;
  background-image: url("/app/img/grain-01.png");
  background-size: 256px 256px;
  opacity: 0.55;
  pointer-events: none;
  z-index: 60;
}

.skip {
  position: absolute;
  left: -9999px;
  top: 0;
  background: var(--cream);
  color: var(--black);
  padding: 14px 20px;
  font-family: var(--text);
  z-index: 80;
}
.skip:focus { left: 16px; top: 16px; }

:focus-visible {
  outline: 3px solid var(--blue);
  outline-offset: 3px;
}

/* ------------------------------------------------------------------ sheet */
.sheet {
  max-width: 2100px;
  margin: 0 auto;
  padding: 54px 5% 76px;
  display: grid;
  grid-template-columns: 35fr 51.5fr;
  column-gap: 3.6%;
  row-gap: var(--gap);
  align-items: stretch;
}

.col {
  display: flex;
  flex-direction: column;
  gap: 26px;
  min-width: 0;
}

/* ------------------------------------------------------------------ ident */
.ident { min-width: 0; }

.ident-name {
  margin: 0;
  font-family: var(--text);
  font-weight: 700;
  font-size: 19px;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: var(--cream);
}
.ident-sub {
  margin: 6px 0 0;
  font-family: var(--mono);
  font-size: var(--label);
  letter-spacing: 0.1em;
  color: var(--blue);
}
.ident-dot { opacity: 0.6; padding: 0 4px; }

.chips {
  margin-top: 20px;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 48px;
  padding: 0 18px;
  border: var(--hair) solid var(--blue);
  color: var(--blue);
  background: transparent;
  text-decoration: none;
  font-family: var(--text);
  font-weight: 700;
  font-size: var(--label);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  white-space: nowrap;
}
.chip-arrow { font-family: var(--mono); letter-spacing: 0; opacity: 0.85; }
.chip:hover { background: rgba(107, 147, 184, 0.16); }
.chip[aria-current="page"] {
  background: var(--blue);
  color: var(--black);
  border-color: var(--blue);
}

/* ------------------------------------------- the hairline panel (his globe) */
.panel {
  position: relative;
  border: var(--hair) solid var(--blue);
  padding: 0;
}
.panel-top-tab,
.panel-bot-tab {
  position: absolute;
  left: 50%;
  width: 46px;
  height: 10px;
  margin-left: -23px;
  background: var(--blue);
}
.panel-top-tab { top: -6px; }
.panel-bot-tab { bottom: -6px; }

.panel-body { padding: var(--pad); }

.map {
  position: relative;
  width: 100%;
  aspect-ratio: 7 / 5;
}
.map canvas {
  width: 100%;
  height: 100%;
  display: block;
  image-rendering: pixelated;
}

.panel-note {
  margin: 22px 0 0;
  background: var(--blue);
  color: var(--black);
  font-family: var(--mono);
  font-size: var(--label);
  line-height: 1.55;
  padding: 16px 18px;
  position: relative;
}
.panel-note::before {
  content: "";
  position: absolute;
  left: -10px;
  top: -10px;
  right: 10px;
  bottom: 10px;
  border: 1px solid var(--cream-weak);
  z-index: -1;
}

/* ------------------------------------------------------------- quote line */
.quote {
  margin: 0;
  color: var(--blue);
  font-family: var(--text);
  font-weight: 700;
  font-size: var(--label);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  line-height: 1.5;
  max-width: 34ch;
}

/* --------------------------------------------------------------- big word */
.bigword {
  margin: 0;
  font-family: var(--display);
  font-weight: 700;
  color: var(--blue);
  line-height: 0.92;
  letter-spacing: 0;
  font-size: 76px;
  overflow-wrap: anywhere;
}

/* ------------------------------------------------------- the day strip */
.strip {
  display: flex;
  gap: 14px;
  border: var(--frame) solid var(--cream);
  padding: 18px;
}
.strip-rail {
  flex: 0 0 10px;
  background: var(--blue);
  align-self: stretch;
}
.strip-rail.cream { background: var(--cream); }
.strip-inner { flex: 1 1 auto; min-width: 0; }

.strip-band {
  aspect-ratio: 4 / 1;
  background: #000;
  overflow: hidden;
}
.strip-band canvas {
  width: 100%;
  height: 100%;
  display: block;
  image-rendering: pixelated;
}

.rows { margin: 16px 0 0; }
.rows-wide { grid-column: 1 / -1; margin-top: 4px; }
.row {
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 4px 16px;
  padding: 7px 0;
  min-width: 0;
}
.row dt {
  font-family: var(--text);
  font-weight: 700;
  font-size: var(--label);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--cream);
}
.row dd {
  margin: 0 0 0 auto;
  font-family: var(--mono);
  font-size: var(--value);
  color: var(--blue);
  text-align: right;
  min-width: 0;
  overflow-wrap: anywhere;
}
.row.alt dt { color: var(--blue); }
.row.alt dd { color: var(--cream); }

.bar {
  position: relative;
  margin-top: 16px;
  height: 46px;
  border: 1px solid var(--cream-weak);
  background: #000;
}
.bar-fill {
  position: absolute;
  inset: 0 auto 0 0;
  width: 0;
  background: var(--blue);
  transition: width 0.4s steps(12);
}
.bar-value {
  position: absolute;
  right: 18px;
  top: 50%;
  transform: translateY(-50%);
  font-family: var(--mono);
  font-size: var(--label);
  color: var(--cream);
}

/* ------------------------------------------------------------- paragraph */
.para {
  margin: 0;
  font-family: var(--serif);
  font-style: italic;
  font-size: 20px;
  line-height: 1.5;
  text-align: justify;
  color: var(--cream);
}

/* -------------------------------------------------------------- masthead */
.masthead {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  line-height: 0.8;
  font-family: var(--display);
  font-weight: 700;
  margin-bottom: 4px;
}
.mast-1 { color: var(--blue); }
.mast-2 {
  color: transparent;
  -webkit-text-stroke: 3px var(--cream);
}
.mast-1,
.mast-2 {
  font-size: 100px;
  display: inline-block;
  width: max-content;
  max-width: none;
  white-space: nowrap;
}

/* --------------------------------------------------------------- barcode */
.barcode-block { margin-top: 4px; }
.barcode {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 2px;
  height: 52px;
  width: 100%;
  overflow: hidden;
}
.bc {
  display: block;
  flex: 0 0 auto;
  height: 100%;
  background: var(--blue);
}
.bc.caught { background: var(--cream); }
.barcode-line {
  margin: 12px 0 0;
  font-family: var(--mono);
  font-size: var(--label);
  letter-spacing: 0.06em;
  color: var(--blue);
}
.barcode-line .sep { opacity: 0.5; padding: 0 6px; }
.barcode-line span:not(.sep) { color: var(--cream); }

/* ------------------------------------------------- the big framed cell */
.cell-main {
  border: var(--frame) solid var(--cream);
  background: #000;
  min-width: 0;
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
}
.cell-strip {
  height: 38px;
  background-image: url("/app/img/data-strip-01.png");
  background-size: auto 100%;
  background-repeat: repeat-x;
  border-bottom: var(--frame) solid var(--cream);
}
.cell-field {
  position: relative;
  padding: 26px;
  min-height: 560px;
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
}

.station {
  position: relative;
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  min-height: 0;
}
.station.is-off { display: none; }

.corners {
  position: relative;
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: baseline;
  padding-bottom: 14px;
}
.corners::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 1px;
  background: rgba(107, 147, 184, 0.34);
}

.corner {
  font-family: var(--text);
  font-weight: 700;
  font-size: 22px;
  letter-spacing: 0.1em;
  color: var(--blue);
  z-index: 2;
}
.corner-r { color: var(--cream); }

/* ------------------------------------------------------------- the game */
#game {
  display: block;
  width: 100%;
  margin-top: 18px;
  flex: 1 1 auto;
  min-height: 420px;
  max-height: 72vh;
  background: #000;
  image-rendering: pixelated;
  touch-action: none;
  cursor: pointer;
}
.game-hud {
  margin-top: 16px;
  display: flex;
  justify-content: space-between;
  gap: 20px;
  align-items: baseline;
  flex-wrap: wrap;
}
.hud-line {
  margin: 0;
  font-family: var(--mono);
  font-size: var(--label);
  color: var(--blue);
}
.hud-line b { color: var(--cream); font-weight: 500; }

.gate {
  position: absolute;
  inset: 60px 0 0;
  background: rgba(0, 0, 0, 0.86);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 3;
}
.gate[hidden] { display: none; }
.gate-text {
  font-family: var(--text);
  font-weight: 700;
  font-size: 20px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--cream);
  max-width: 30ch;
  text-align: center;
}

/* ------------------------------------------------------ dex entry cells */
.entries {
  margin-top: 22px;
  align-content: start;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(206px, 100%), 1fr));
  gap: 14px;
}
.entry {
  border: var(--hair) solid var(--blue-weak);
  background: #000;
  padding: 20px;
  text-align: left;
  color: inherit;
  font: inherit;
  cursor: pointer;
  min-width: 0;
}
.entry:hover { border-color: var(--blue); }
.entry.caught { border-color: var(--cream); }
.entry-pic {
  width: 100%;
  aspect-ratio: 1 / 1;
  background: #000;
  display: block;
  image-rendering: pixelated;
}
.entry-name {
  margin: 12px 0 0;
  font-family: var(--text);
  font-weight: 700;
  font-size: var(--label);
  letter-spacing: 0.06em;
  color: var(--cream);
  overflow-wrap: anywhere;
}
.entry-meta {
  margin: 4px 0 0;
  font-family: var(--mono);
  font-size: 16px;
  color: var(--blue);
}
.entry-tag {
  margin: 8px 0 0;
  font-family: var(--mono);
  font-size: 16px;
  color: var(--blue);
}
.entry.caught .entry-tag { color: var(--cream); }

/* ----------------------------------------------------------- backpack */
.pack { margin-top: 22px; }
.pack-empty {
  font-family: var(--mono);
  font-size: var(--value);
  color: var(--blue);
}
.sack-row {
  display: grid;
  grid-template-columns: 56px minmax(0, 1fr) auto auto;
  gap: 18px;
  align-items: center;
  padding: 14px 0;
  border-bottom: 1px solid rgba(107, 147, 184, 0.25);
}
.sack-pic { width: 56px; height: 56px; image-rendering: pixelated; background: #000; }
.sack-name { font-family: var(--text); font-weight: 700; font-size: var(--body); letter-spacing: 0.05em; }
.sack-amount, .sack-value { font-family: var(--mono); font-size: var(--value); color: var(--blue); }
.sack-value { color: var(--cream); }

/* -------------------------------------------------------------- boards */
.boards {
  margin-top: 22px;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(260px, 100%), 1fr));
  gap: 18px;
}
.board { border: var(--hair) solid var(--blue-weak); padding: 20px; min-width: 0; }
.board h3 {
  margin: 0 0 14px;
  font-family: var(--display);
  font-weight: 700;
  font-size: 22px;
  color: var(--cream);
  letter-spacing: 0;
}
.board ol { margin: 0; padding: 0; list-style: none; }
.board li {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 0;
  font-family: var(--mono);
  font-size: var(--label);
  color: var(--blue);
}
.board li b { color: var(--cream); font-weight: 500; }

/* --------------------------------------------------------------- rules */
.steps {
  margin-top: 22px;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}
.step {
  border: var(--hair) solid var(--blue-weak);
  padding: 0 0 22px;
  min-width: 0;
}
.step-wide { grid-column: 1 / -1; }
.step-strip {
  height: 26px;
  background-image: url("/app/img/data-strip-01.png");
  background-size: auto 100%;
  background-repeat: repeat-x;
  filter: invert(1);
  opacity: 0.8;
}
.step-head {
  margin: 20px 22px 10px;
  font-family: var(--display);
  font-weight: 700;
  font-size: 24px;
  color: var(--blue);
  letter-spacing: 0;
}
.step p {
  margin: 0 22px;
  font-size: var(--body);
  line-height: 1.55;
  color: var(--cream);
}

/* --------------------------------------------------------- bottom row */
.row-bottom {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: 35fr 51.5fr;
  column-gap: 3.6%;
  align-items: stretch;
  margin-top: 10px;
}

.cell {
  border: var(--frame) solid var(--cream);
  padding: var(--pad);
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.cell-title {
  margin: 0 0 18px;
  font-family: var(--display);
  font-weight: 700;
  font-size: 40px;
  letter-spacing: 0;
  line-height: 1;
}
.ink-cream { color: var(--cream); }
.ink-blue { color: var(--blue); }

.code-ticker {
  margin: 0;
  font-family: var(--text);
  font-weight: 700;
  font-size: 22px;
  letter-spacing: 0.1em;
  color: var(--cream);
}
.code-chain {
  display: inline-block;
  margin-left: 10px;
  font-family: var(--mono);
  font-size: var(--label);
  letter-spacing: 0.04em;
  color: var(--blue);
}
.code-label {
  margin: 20px 0 6px;
  font-family: var(--text);
  font-weight: 700;
  font-size: var(--label);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--blue);
}
.code-mint {
  margin: 0;
  background: #000;
  border: 1px solid var(--cream-weak);
  padding: 14px 16px;
  font-family: var(--mono);
  font-size: var(--label);
  line-height: 1.5;
  color: var(--cream);
  user-select: all;
  overflow-wrap: anywhere;
  min-width: 0;
}

.key {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 54px;
  padding: 14px 1.3em;
  border: var(--hair) solid var(--cream);
  background: transparent;
  color: var(--cream);
  font-family: var(--text);
  font-weight: 700;
  font-size: var(--label);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  text-decoration: none;
  cursor: pointer;
  text-align: center;
}
.key:hover { background: rgba(239, 226, 203, 0.14); }
.key:active { transform: translateY(2px); }
.key[disabled],
.key[aria-disabled="true"] {
  border-color: var(--cream-weak);
  color: var(--cream-weak);
  cursor: not-allowed;
  pointer-events: none;
}
.key-wide { width: 100%; margin-top: 14px; }

.keys {
  margin-top: 14px;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(150px, 100%), 1fr));
  gap: 12px;
}

.mark {
  width: 20px;
  height: 20px;
  background-size: contain;
  background-repeat: no-repeat;
  background-position: center;
  flex: 0 0 20px;
}
.mark-x { background-image: url("/app/img/mark-x.png"); }
.mark-dex { background-image: url("/app/img/mark-dexscreener.png"); }

.code-note,
.grid-note {
  margin: 18px 0 0;
  font-family: var(--mono);
  font-size: 16px;
  line-height: 1.5;
  color: var(--blue);
}

.dexgrid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(62px, 100%), 1fr));
  grid-auto-rows: minmax(52px, 1fr);
  gap: 8px;
  flex: 1 1 auto;
  align-content: stretch;
}
.dexgrid .blk {
  background: rgba(107, 147, 184, 0.16);
  box-shadow: inset 0 0 0 2px rgba(107, 147, 184, 0.45);
}
.dexgrid .blk.on { background: var(--blue); }
.dexgrid .blk.rare { outline: 2px solid var(--cream); outline-offset: -2px; }

/* ------------------------------------------------------------ responsive */
@media (max-width: 1240px) {
  :root { --pad: 24px; }
  .mast-2 { -webkit-text-stroke-width: 2px; }
  .bigword { font-size: 60px; }
  .cell-title { font-size: 32px; }
  .cell-field { min-height: 460px; }
}

@media (max-width: 980px) {
  .sheet {
    grid-template-columns: minmax(0, 1fr);
    padding: 34px 5% 56px;
  }
  .row-bottom { grid-template-columns: minmax(0, 1fr); row-gap: var(--gap); }
  .col-right { order: -1; }
  .steps { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 680px) {
  :root { --pad: 26px; --frame: 3px; }
  .sheet { padding: 28px 28px 48px; row-gap: 26px; }
  .mast-2 { -webkit-text-stroke-width: 2px; }
  .bigword { font-size: 44px; }
  .cell-title { font-size: 24px; }
  .cell-field { padding: 22px; min-height: 0; }
  .corner { font-size: 18px; }
  #game { margin-top: 14px; min-height: 420px; }
  .gate { inset: 52px 0 0; }
  .entries { grid-template-columns: repeat(auto-fill, minmax(min(150px, 100%), 1fr)); }
  .strip { flex-wrap: nowrap; }
  .para { font-size: 19px; text-align: left; }
}

@media (prefers-reduced-motion: reduce) {
  .bar-fill { transition: none; }
}
