/* playtest.css — the site's design language, copied per the v2 rule that the
 * site imports from us and we don't reach back: tokens + .frame/.corners/
 * .plate/.btn/.battlement mirror ../hoardlingsWebsite/assets/css/site.css,
 * then the playtest's own layout on top. */

/* the site's vendored faces (latin subsets of ../hoardlingsWebsite/assets/
 * fonts, OFL), served from here so the CSP stays font-src 'self' */
@font-face {
  font-family: 'Pixelify Sans'; font-style: normal; font-weight: 400 700; font-display: swap;
  src: url(fonts/pixelifysans-400-700-latin.woff2) format('woff2');
}
@font-face {
  font-family: 'Jacquard 24'; font-style: normal; font-weight: 400; font-display: swap;
  src: url(fonts/jacquard24-400-latin.woff2) format('woff2');
}
@font-face {
  font-family: 'IBM Plex Mono'; font-style: normal; font-weight: 400; font-display: swap;
  src: url(fonts/ibmplexmono-400-latin.woff2) format('woff2');
}

:root {
  --parchment: #f3e8cd;
  --parchment-2: #eadbb6;
  --panel: #f8f1de;
  --ink: #2b2118;
  --ink-2: #57462f;
  --faint: #8a7a5f;
  --gold: #c9962e;
  --gold-2: #e9c46a;
  --crimson: #96302c;
  --moss: #4c7a5c;
  --navy: #26364f;
  --night: #1c2333;
  --shell-onyx: #1b1b1b;
  --font-display: "Jacquard 24", "Pixelify Sans", serif;
  --font-ui: "Pixelify Sans", "IBM Plex Mono", system-ui, sans-serif;
  --font-body: "IBM Plex Mono", ui-monospace, "Pixelify Sans", monospace;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--parchment);
  color: var(--ink);
  font-family: var(--font-body);
  min-height: 100vh;
}

/* ---------- from site.css ---------- */

.frame {
  background: var(--panel);
  border: 3px solid var(--ink);
  outline: 3px solid var(--ink);
  outline-offset: 3px;
  margin: 6px;
  padding: 22px 26px;
}
.corners { position: relative; }
.corners::before {
  content: "";
  position: absolute;
  inset: -6px;
  pointer-events: none;
  background:
    linear-gradient(var(--gold) 0 0) top left / 7px 7px,
    linear-gradient(var(--gold) 0 0) top right / 7px 7px,
    linear-gradient(var(--gold) 0 0) bottom left / 7px 7px,
    linear-gradient(var(--gold) 0 0) bottom right / 7px 7px;
  background-repeat: no-repeat;
}
.plate {
  font-family: var(--font-ui);
  font-weight: 700;
  font-size: clamp(20px, 3.5vw, 28px);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  text-align: center;
  background: var(--night);
  color: var(--parchment);
  border: 3px solid var(--ink);
  box-shadow: 4px 4px 0 var(--ink);
  padding: 12px 16px;
  margin: 0 0 14px;
}
.plate small {
  display: block;
  font-family: var(--font-body);
  font-weight: 400;
  font-size: 13px;
  letter-spacing: 0.14em;
  color: var(--gold-2);
  margin-top: 4px;
}
.btn {
  display: inline-block;
  font-family: var(--font-ui); font-weight: 700; font-size: 16px;
  letter-spacing: 0.1em; text-transform: uppercase;
  text-decoration: none; cursor: pointer;
  padding: 12px 22px;
  border: 3px solid var(--ink);
  box-shadow: 4px 4px 0 var(--ink);
  background: var(--panel); color: var(--ink);
}
.btn:hover { background: var(--gold-2); color: var(--ink); }
.btn:active { transform: translate(4px, 4px); box-shadow: 0 0 0 var(--ink); }
.btn-primary { background: var(--crimson); color: var(--parchment); }
.btn-primary:hover { background: var(--gold); color: var(--ink); }
.battlement {
  height: 21px;
  background:
    repeating-linear-gradient(90deg,
      var(--ink) 0 14px, transparent 14px 28px) 0 0 / 28px 7px no-repeat,
    repeating-linear-gradient(90deg,
      var(--ink) 0 28px, transparent 28px 56px) 0 14px / 56px 7px no-repeat;
  opacity: 0.25;
  margin: 10px 4px;
}

/* ---------- the playtest's own ---------- */

.topbar {
  display: flex; align-items: baseline; gap: 14px;
  padding: 14px 22px 0;
  font-family: var(--font-display);
  font-size: 26px;
}
.topbar a { color: var(--crimson); text-decoration: none; }
.topbar .tag {
  font-family: var(--font-ui); font-size: 13px; letter-spacing: 0.2em;
  text-transform: uppercase; color: var(--faint);
}

.pt-login {
  max-width: 420px; margin: 12vh auto 0;
  display: flex; flex-direction: column; gap: 14px;
}
.pt-login form { display: flex; flex-direction: column; gap: 14px; }
.pt-login label {
  display: flex; flex-direction: column; gap: 6px;
  font-family: var(--font-ui); font-weight: 700; font-size: 14px;
  letter-spacing: 0.1em; text-transform: uppercase; color: var(--ink-2);
}
.pt-login input {
  font: 16px var(--font-body); padding: 10px 12px;
  border: 3px solid var(--ink); background: var(--parchment-2); color: var(--ink);
}
.pt-err { color: var(--crimson); min-height: 1.2em; font-size: 14px; text-align: center; }
/* the other door under a form (sign in <-> create your den): a divider in
 * the labels' small caps, then a full-width gold .btn */
.pt-alt { display: flex; flex-direction: column; gap: 12px; margin-top: 18px; }
.pt-alt .btn { display: block; text-align: center; background: var(--gold); color: var(--ink); }
.pt-alt .btn:hover { background: var(--crimson); color: var(--parchment); }
.pt-or {
  display: flex; align-items: center; gap: 10px; margin: 0;
  font-family: var(--font-ui); font-weight: 700; font-size: 13px;
  letter-spacing: 0.14em; text-transform: uppercase; color: var(--ink-2);
}
.pt-or::before, .pt-or::after { content: ''; flex: 1; border-top: 3px solid var(--ink); opacity: 0.25; }

/* the split: status + steps on the left, the device on the right */
.pt-view {
  display: flex; flex-wrap: wrap; gap: 26px;
  align-items: flex-start; justify-content: center;
  padding: 18px 10px 40px;
}
.pt-side { width: 340px; max-width: 100%; display: flex; flex-direction: column; align-items: center; gap: 14px; }
.pt-note { font-size: 13px; color: var(--ink-2); text-align: center; margin: 0; }
.pt-note strong { color: var(--crimson); }

/* the controls card: a line drawing of the device (keys 1 and 2, the dial
 * on its right edge) with leaders to what each does, then the keyboard */
.pt-howto { width: 100%; margin: 0; border-top: 3px solid var(--ink); padding-top: 12px; }
.pt-howto-h {
  margin: 0 0 6px; text-align: center;
  font-family: var(--font-ui); font-weight: 700; font-size: 13px;
  letter-spacing: 0.14em; text-transform: uppercase; color: var(--ink-2);
}
.pt-howto-svg { width: 100%; height: auto; display: block; }
.pt-howto-svg .h-body { fill: var(--navy); stroke: var(--ink); stroke-width: 3; }
.pt-howto-svg .h-screen { fill: var(--night); stroke: var(--ink); stroke-width: 2; }
.pt-howto-svg .h-cap { fill: var(--panel); stroke: var(--ink); stroke-width: 2.5; }
.pt-howto-svg .h-cap-t { font: 700 15px var(--font-ui); fill: var(--ink); text-anchor: middle; }
.pt-howto-svg .h-crown { fill: var(--gold); stroke: var(--ink); stroke-width: 2.5; }
.pt-howto-svg .h-arrow { fill: var(--crimson); }
.pt-howto-svg .h-lab { font: 11px var(--font-body); fill: var(--ink-2); }
.pt-howto-svg .h-mid { text-anchor: middle; }
.pt-howto-svg .h-key { font: 700 12px var(--font-ui); fill: var(--crimson); letter-spacing: 0.08em; }
.pt-howto-keys {
  display: flex; flex-wrap: wrap; justify-content: center; gap: 4px 12px;
  margin-top: 8px; font-size: 12px; color: var(--ink-2);
}
.pt-howto-keys kbd {
  display: inline-block; min-width: 1.4em; padding: 0 4px; margin-right: 2px;
  font: 700 11px var(--font-ui); text-align: center; color: var(--ink);
  background: var(--panel); border: 2px solid var(--ink); box-shadow: 2px 2px 0 var(--ink);
}

.pt-status {
  width: 100%; display: flex; justify-content: center; gap: 18px;
  font-family: var(--font-ui); font-size: 13px; letter-spacing: 0.08em;
  text-transform: uppercase; color: var(--ink-2);
  border-bottom: 3px solid var(--parchment-2); padding-bottom: 12px;
}
/* the pedometer, played by hand */
.pt-steps { display: flex; flex-direction: column; align-items: center; gap: 2px; }
.pt-steps-n {
  font: 700 34px var(--font-ui); letter-spacing: 0.02em; line-height: 1;
  color: var(--ink); font-variant-numeric: tabular-nums;
}
.pt-steps-k {
  font: 700 11px var(--font-ui); letter-spacing: 0.14em;
  text-transform: uppercase; color: var(--faint);
}
.pt-step-btns { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; width: 100%; }
.pt-side .btn { width: 100%; padding: 12px 8px; font-size: 14px; }
#autowalk[aria-pressed="true"] { background: var(--moss); color: var(--parchment); }
.dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%;
  background: var(--faint); margin-right: 6px; vertical-align: baseline; }
.dot.up { background: var(--moss); }
.dot.down { background: var(--crimson); }

/* the device itself: Rev B's 58×62 shell (keyring loop up top, the 2.0"
 * landscape window, two MX caps and the crown on the right edge — positions
 * are the 3D model's, in % of the shell). Colourways below set the vars. */
.pt-shell {
  position: relative;
  width: min(500px, 92vw);
  aspect-ratio: 58 / 62;
  border-radius: 9% / 8.4%;
  background:
    linear-gradient(160deg, rgba(255, 255, 255, 0.10), rgba(0, 0, 0, 0.20)),
    var(--shell);
  box-shadow:
    inset 0 0 0 3px rgba(0, 0, 0, 0.5),
    inset 0 3px 10px rgba(255, 255, 255, 0.12),
    inset 0 -8px 14px rgba(0, 0, 0, 0.35),
    10px 12px 0 rgba(43, 33, 24, 0.35);
}
.pt-ring {
  position: absolute; left: 50%; top: 0;
  transform: translate(-50%, -58%);
  width: 13%; aspect-ratio: 1;
  border: 9px solid var(--shell);
  border-radius: 50%;
  box-shadow: inset 0 0 0 2px rgba(0, 0, 0, 0.45), 0 0 0 2px rgba(0, 0, 0, 0.25);
  pointer-events: none;
}
.pt-screen-wrap {
  position: absolute; left: 50%; top: 32.3%;
  transform: translate(-50%, -50%);
  width: 75.9%; aspect-ratio: 44 / 34;
  border-radius: 4% / 5%;
  background: #000;
  box-shadow: inset 0 0 0 3px #000, 0 0 0 2px rgba(0, 0, 0, 0.4),
    inset 0 0 24px rgba(0, 0, 0, 0.8);
  overflow: hidden;
}
.pt-screen {
  display: block; width: 100%; height: 100%;
  image-rendering: pixelated;
}
.pt-paused {
  position: absolute; inset: 0; border-radius: 4% / 5%;
  display: flex; align-items: center; justify-content: center;
  background: rgba(0, 0, 0, 0.74);
  color: var(--gold-2);
  font: 700 13px/1.6 var(--font-ui); letter-spacing: 0.08em;
  text-align: center; text-transform: uppercase;
}
.pt-paused[hidden] { display: none; }

/* the two MX caps: DSA-profile squares at the model's KXS/KY. The page's
 * whole face is flat print + hard offset shadows (the .btn idiom, the
 * shell's own 10px 12px 0) — so the caps speak it too: one flat cap
 * colour, a single gentle wall shading toward the foot, and a soft seam
 * where the dished top meets the wall (a shadow, never an outline ring).
 * The span is that top: ~88% of the footprint, same colour as the walls.
 * Pressing drops the cap onto its offset shadow, .btn:active's move. */
.pt-cap {
  position: absolute; top: 80.6%;
  width: 24.5%; aspect-ratio: 1;
  transform: translate(-50%, -50%);
  border: 0; cursor: pointer;
  border-radius: 18%;
  /* semi-transparent ink anchors caps on mid and light shells; the near-black
   * ones (vault, forge) override to solid #000 below or the keys float */
  --cap-shade: rgba(0, 0, 0, 0.35);
  background-color: var(--cap);
  background-image: linear-gradient(180deg,
    rgba(255, 255, 255, 0.10), rgba(0, 0, 0, 0.16) 85%);
  box-shadow:
    inset 0 0 0 2px rgba(0, 0, 0, 0.4),   /* the moulded edge, the bezel's ring */
    4px 5px 0 var(--cap-shade);           /* the hard offset shadow, the page's */
  color: var(--cap-ink);
  font: 700 22px var(--font-ui); letter-spacing: 0.08em;
  transition: transform 80ms ease-out, box-shadow 80ms ease-out;
  -webkit-tap-highlight-color: transparent;
}
.pt-cap span {
  position: absolute; left: 5%; right: 5%; top: 6%; bottom: 9%;
  display: flex; align-items: center; justify-content: center;
  border-radius: 12%;
  background-color: var(--cap);
  /* the dish: one faint scoop of shading, nothing that bands */
  background-image: radial-gradient(120% 90% at 50% 110%,
    rgba(0, 0, 0, 0.12), rgba(0, 0, 0, 0) 60%);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.14),   /* light catches the rim */
    inset 0 -2px 3px rgba(0, 0, 0, 0.14);      /* the soft seam at the front */
  line-height: 1;
  transition: top 80ms ease-out, box-shadow 80ms ease-out;
}
#capA { left: 27.6%; --cap: var(--cap-a); --cap-ink: var(--cap-a-ink); }
#capC { left: 60.3%; --cap: var(--cap-c); --cap-ink: var(--cap-c-ink); }
.pt-cap.down {
  transform: translate(calc(-50% + 4px), calc(-50% + 5px));
  box-shadow:
    inset 0 0 0 2px rgba(0, 0, 0, 0.4),
    0 1px 0 var(--cap-shade);
}
.pt-cap.down span {
  top: 8%;
  box-shadow:
    inset 0 2px 4px rgba(0, 0, 0, 0.18);
}

/* the crown: a watch-style side dial on the right edge at the caps' height.
 * The knurl is a ridged strip that walks one tooth per detent (device.js's
 * turn) — NEXT rolls down, PREV up; .down is the push. */
.pt-crown {
  position: absolute; right: -2.6%; top: 80.6%;
  transform: translateY(-50%);
  width: 9%; height: 14.5%;
  border: 0; padding: 0; cursor: pointer;
  border-radius: 30% / 16%;
  background-color: var(--crown);
  background-image: linear-gradient(180deg, rgba(255, 255, 255, 0.22), rgba(0, 0, 0, 0.28));
  box-shadow: inset 0 0 0 2px rgba(0, 0, 0, 0.45), -3px 2px 5px rgba(0, 0, 0, 0.45);
  overflow: hidden;
  transition: transform 90ms ease-out;
  -webkit-tap-highlight-color: transparent;
}
.pt-crown.down { transform: translateY(-50%) translateX(-9%); }
.pt-crown { touch-action: none; }                  /* a tap on the crown never scrolls the page */

/* the dial's arrows, above and below the crown: see-through until pressed,
 * then lit black -- the way a phone turns the dial */
.pt-turn {
  position: absolute; right: -2.6%;
  width: 9%; aspect-ratio: 1;
  border: 2px solid rgba(0, 0, 0, 0.45); border-radius: 22%;
  padding: 0; cursor: pointer;
  background: rgba(255, 255, 255, 0.28);
  opacity: 0.55;
  touch-action: none; -webkit-tap-highlight-color: transparent;
  transition: opacity 80ms, background-color 80ms;
}
.pt-turn-up { top: 63.2%; }
.pt-turn-down { top: 89%; }
.pt-turn::before {                                 /* the arrow */
  content: ''; position: absolute; left: 50%; top: 50%;
  border-left: 0.42em solid transparent; border-right: 0.42em solid transparent;
  transform: translate(-50%, -50%);
}
.pt-turn-up::before { border-bottom: 0.55em solid rgba(0, 0, 0, 0.75); }
.pt-turn-down::before { border-top: 0.55em solid rgba(0, 0, 0, 0.75); }
.pt-turn:hover { opacity: 0.8; }
.pt-turn.down { opacity: 1; background: #000; border-color: #000; }
.pt-turn-up.down::before { border-bottom-color: #fff; }
.pt-turn-down.down::before { border-top-color: #fff; }
.pt-crown-ridge {
  position: absolute; inset: -1000px 0;
  background: repeating-linear-gradient(180deg,
    rgba(0, 0, 0, 0.5) 0 2px, transparent 2px 8px);
  transition: transform 90ms ease-out;
  pointer-events: none;
}

/* colourways — the 3D model's five, one per cave */
.pt-shell[data-way="0"], .pt-way[data-way="0"] {
  --shell: #55514a; --cap-a: #c9b89a; --cap-c: #7fb0cf; --crown: #b0b4b8;
  --cap-a-ink: #2b2823; --cap-c-ink: #1e2c33;
}
.pt-shell[data-way="1"], .pt-way[data-way="1"] {
  --shell: #2e4530; --cap-a: #f3e8cd; --cap-c: #8fd44a; --crown: #c9962e;
  --cap-a-ink: #2b2118; --cap-c-ink: #22331a;
}
.pt-shell[data-way="2"], .pt-way[data-way="2"] {
  --shell: #1f2140; --cap-a: #9fd3ff; --cap-c: #d6ecff; --crown: #d8dce4;
  --cap-a-ink: #14213c; --cap-c-ink: #16233a;
}
.pt-shell[data-way="3"], .pt-way[data-way="3"] {
  --shell: #f0e6c8; --cap-a: #2b2118; --cap-c: #96302c; --crown: #c9962e;
  --cap-a-ink: #f0e6c8; --cap-c-ink: #f6e9d2;
}
.pt-shell[data-way="4"], .pt-way[data-way="4"] {
  --shell: #110d1c; --cap-a: #ff7a3a; --cap-c: #3d4b61; --crown: #b87333;
  --cap-a-ink: #1c0e06; --cap-c-ink: #dfe7f2;
}
/* the dark shells: translucent ink is invisible on them, so their caps sit
 * on solid black — the .btn idiom (4px 4px 0 var(--ink)) doing the anchoring */
.pt-shell[data-way="2"] .pt-cap,
.pt-shell[data-way="4"] .pt-cap { --cap-shade: #000; }

/* under the shell: the colourway swatches + full screen */
.pt-ctl {
  display: flex; align-items: center; justify-content: center;
  gap: 18px; margin-top: 22px; flex-wrap: wrap;
}
.pt-ways { display: flex; gap: 8px; }
.pt-way {
  border: 2px solid var(--ink); box-shadow: 2px 2px 0 var(--ink);
  background: var(--panel); cursor: pointer;
  padding: 4px 4px 3px;
  display: flex; flex-direction: column; align-items: center; gap: 3px;
}
.pt-way[aria-pressed="true"] { background: var(--gold-2); }
.pt-way i {
  display: block; width: 28px; height: 14px; border-radius: 3px;
  background: linear-gradient(90deg,
    var(--shell) 0 42%, var(--cap-a) 42% 72%, var(--cap-c) 72% 86%, var(--crown) 86%);
}
.pt-way small {
  font: 700 9px var(--font-ui); text-transform: uppercase;
  letter-spacing: 0.06em; color: var(--ink-2);
}
/* testing: the creature buttons (one row per bloodline) */
.pt-pen { margin: 18px auto 0; max-width: min(500px, 92vw); text-align: center; }
.pt-pen-h {
  font: 700 15px var(--font-ui); text-transform: uppercase; letter-spacing: 0.06em;
  margin: 0 0 8px; color: var(--ink);
}
.pt-pen-h small { color: var(--crimson); font-size: 11px; margin-left: 6px; }
.pt-pen-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; }
.pt-creature {
  border: 2px solid var(--ink); box-shadow: 2px 2px 0 var(--ink);
  background: var(--panel); cursor: pointer; padding: 4px 2px 3px;
  display: flex; flex-direction: column; align-items: center; gap: 2px;
}
.pt-creature:hover { background: var(--gold-2); }
.pt-creature:active { transform: translate(2px, 2px); box-shadow: 0 0 0 var(--ink); }
.pt-creature canvas { width: 48px; height: 48px; image-rendering: pixelated; }
.pt-creature small {
  font: 700 9px var(--font-ui); text-transform: uppercase;
  letter-spacing: 0.04em; color: var(--ink-2); line-height: 1.1;
}
.pt-pen-note { font-size: 12px; color: var(--faint); margin: 8px 0 0; }
.pt-keys-note {
  text-align: center; color: var(--faint); font-size: 12px;
  margin: 12px auto 0; max-width: min(500px, 92vw);   /* the shell's width: a long note must not widen the column past the side panel's row */
}
.pt-keys-note b { color: var(--ink-2); }

@media (max-width: 760px) {
  .pt-view { flex-direction: column; align-items: center; }
}

/* ---------- device-only fullscreen: the shell alone, centered on black
 * (the button or F; the real Fullscreen API when granted, the class
 * either way) ---------- */
body.pt-full {
  background: #000;
  overflow: hidden;
}
body.pt-full .topbar,
body.pt-full .pt-side,
body.pt-full .pt-pen,
body.pt-full .pt-keys-note { display: none; }
/* the device fills the window it is in (not the browser's fullscreen): a
 * fixed layer over the page, the shell sized to the window below, so it
 * re-fits whenever the window is resized */
body.pt-full .pt-view {
  position: fixed; inset: 0; z-index: 5;
  background: #000;
  min-height: 0;
  align-items: center; justify-content: center;
  padding: 0;
}
/* the controls go away except the exit pill, parked top-right and dimmed
 * until hovered so it isn't part of the picture */
body.pt-full .pt-ctl {
  position: fixed; top: 14px; right: 16px;
  margin: 0; z-index: 10;
}
body.pt-full .pt-ways { display: none; }
body.pt-full #fullscreen, body.pt-full #rush {
  opacity: 0.4;
  border-color: #777; box-shadow: 3px 3px 0 #000;
  color: #ccc; background: #222;
}
body.pt-full #fullscreen:hover, body.pt-full #fullscreen:focus-visible,
body.pt-full #rush:hover, body.pt-full #rush:focus-visible { opacity: 1; }
body.pt-full .pt-shell {
  /* 80, not 88: the keychain loop (.pt-ring) pokes above the shell by
   * ~7.5% of its width — at 88dvh the loop's arc clips at the viewport
   * top; at 80 the whole silhouette (shell + loop) fits with margin */
  width: min(94vw, 80vh);
  width: min(94vw, 80dvh);            /* the panel's own 58:62 aspect */
  box-shadow:
    inset 0 0 0 3px rgba(0, 0, 0, 0.5),
    inset 0 3px 10px rgba(255, 255, 255, 0.12),
    inset 0 -8px 14px rgba(0, 0, 0, 0.35),
    0 24px 60px rgba(0, 0, 0, 0.8);   /* soft depth, not the parchment offset */
}
