/* MOTH / Lantern. Tokens from GDD 2.7. Every surface is flat: no gradients on
   text or bars, no blur, no glows except the one focal glow of the monitor's
   light on the room (Room). Labels are sentence case, never letter-spaced. */

:root {
  --room: #120e0c;
  --bezel: #d8cfbe;
  --bezel-edge: #b5ab98;
  --wall: #1e2533;
  --paper: #f1eadc;
  --paper-2: #e3dac8;
  --ink: #1b1814;
  --ink-2: #5c5449;
  --term: #1f1c19;
  --term-2: #2a2622;
  --bone: #ece3d1;
  --bone-dim: #9b9180;
  --brass: #e6ab2e;
  --vermilion: #d5452a;
  --vermilion-ink: #a93620;
  --admin: #5d6bc4;
  --sage: #4e876a;
  --glow: #ffe2b0;
  --shadow: rgba(18, 14, 12, 0.35);
  --ui: "Instrument Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "JetBrains Mono", ui-monospace, "Cascadia Mono", Consolas, monospace;
  --serif: "Instrument Serif", Georgia, "Times New Roman", serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  height: 100%;
  background: var(--room);
  color: var(--ink);
  font-family: var(--ui);
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}

body.scroll {
  overflow: auto;
}

button {
  font: inherit;
  color: inherit;
  cursor: pointer;
}

button:disabled {
  cursor: default;
}

a {
  color: inherit;
}

/* The focus ring is ink on paper surfaces (brass on paper is about 1.7:1) and brass on the dark ones (D-324). */
:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 1px;
}

.term :focus-visible,
.taskbar :focus-visible,
.p-taskbar :focus-visible,
.lockscreen :focus-visible,
.desk-icon:focus-visible,
.p-status :focus-visible {
  outline-color: var(--brass);
}

.num {
  font-family: var(--mono);
  font-variant-numeric: tabular-nums;
}

/* ------------------------------------------------------------------ the room and the monitor (bezel mode) */

.viewport {
  position: fixed;
  inset: 0;
  overflow: hidden;
  background: var(--room);
}

.room-paint {
  position: absolute;
  inset: 0;
  background-color: var(--room);
  background-size: cover;
  background-position: center;
}

/* The one focal glow: the monitor's light on the wall, behind the monitor only. */
.room-glow {
  position: absolute;
  pointer-events: none;
  background: radial-gradient(closest-side, rgba(255, 226, 176, 0.18), rgba(255, 226, 176, 0.1) 45%, rgba(255, 226, 176, 0) 100%);
}

.monitor {
  position: absolute;
  background: var(--bezel);
  border: 1px solid var(--bezel-edge);
  border-radius: 10px;
}

.monitor-label {
  position: absolute;
  left: 0;
  right: 0;
  text-align: center;
  font-family: var(--serif);
  color: var(--bezel-edge);
  text-shadow: 0 1px 0 rgba(241, 234, 220, 0.45);
  pointer-events: none;
  user-select: none;
}

.monitor-neck {
  position: absolute;
  background: var(--bezel-edge);
  border: 1px solid #a39985;
  border-top: 0;
}

.monitor-foot {
  position: absolute;
  background: var(--bezel);
  border: 1px solid var(--bezel-edge);
  border-radius: 6px 6px 0 0;
}

/* The moth on the top bezel (cosmetic, between jobs only): it crawls a little, in steps. */
.bezel-moth {
  position: absolute;
  pointer-events: none;
  animation: moth-crawl 14s steps(7, end) infinite alternate;
}

.bezel-moth img {
  width: 100%;
  height: 100%;
  transform: rotate(90deg);
  display: block;
}

.bezel-moth.flown {
  animation: moth-flee 900ms steps(6, end) forwards;
}

/* After a clean log off the moth comes back down onto the bezel (the light), then rests. */
.bezel-moth.landed {
  animation: moth-land 800ms steps(6, end) both;
}

@keyframes moth-land {
  0% {
    transform: translate(-90px, -120px);
    opacity: 0;
  }
  30% {
    opacity: 1;
  }
  100% {
    transform: translate(0, 0);
    opacity: 1;
  }
}

@keyframes moth-crawl {
  0%,
  40% {
    transform: translateX(0);
  }
  100% {
    transform: translateX(-28px);
  }
}

@keyframes moth-flee {
  0% {
    transform: translate(0, 0);
    opacity: 1;
  }
  100% {
    transform: translate(120px, -140px);
    opacity: 0;
  }
}

.screen-holder {
  position: absolute;
  overflow: hidden;
  background: var(--ink);
}

.screen-only {
  position: absolute;
  overflow: hidden;
  background: var(--ink);
}

/* ------------------------------------------------------------------ the virtual screen (1280 x 720) */

.screen {
  position: absolute;
  left: 0;
  top: 0;
  width: 1280px;
  height: 720px;
  transform-origin: 0 0;
  overflow: hidden;
  background: var(--wall);
  font-size: 14px;
  user-select: none;
}

.wallpaper {
  position: absolute;
  inset: 0 0 34px 0;
  background-color: var(--wall);
  background-size: cover;
  background-position: center;
}

.desktop {
  position: absolute;
  inset: 0;
}

.desktop.shake {
  animation: shake calc(180ms * var(--k, 1)) step-end 1;
}

@keyframes shake {
  0% {
    transform: translateX(8px);
  }
  33% {
    transform: translateX(-8px);
  }
  66% {
    transform: translateX(8px);
  }
  100% {
    transform: translateX(0);
  }
}

.fx-layer {
  position: absolute;
  left: 0;
  top: 0;
  pointer-events: none;
  z-index: 40;
}

/* A pulled file flying into Pulled (P1): moved by transform only. */
.flight {
  position: absolute;
  left: 0;
  top: 0;
  z-index: 39;
  pointer-events: none;
  transform-origin: 0 0;
}

/* ------------------------------------------------------------------ boot */

.bootscreen {
  position: absolute;
  inset: 0;
  background: var(--room);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  color: var(--bone);
  z-index: 60;
}

.bootscreen .wordmark {
  font-family: var(--serif);
  font-size: 44px;
  color: var(--bone);
  line-height: 1;
}

.bootscreen .bootline {
  font-family: var(--mono);
  font-size: 15px;
  color: var(--bone-dim);
}

/* ------------------------------------------------------------------ windows */

.win {
  position: absolute;
  display: flex;
  flex-direction: column;
  background: var(--paper);
  border: 1px solid var(--ink);
  border-radius: 4px;
  box-shadow: 3px 3px 0 var(--shadow);
  overflow: hidden;
  isolation: isolate;
}

.win.ov {
  z-index: 25;
}

/* Relay makes room for Netmap when a job starts (never during a job). */
.win.relay-win {
  transition:
    top calc(240ms * var(--k, 1)) steps(4, end),
    height calc(240ms * var(--k, 1)) steps(4, end);
}

.win.summary {
  z-index: 22;
}

a.btn {
  text-decoration: none;
}

.win.opening {
  animation: win-open calc(200ms * var(--k, 1)) steps(4, end) both;
}

.win.closing {
  animation: win-close calc(160ms * var(--k, 1)) steps(3, end) both;
}

.win.closed {
  visibility: hidden;
}

@keyframes win-open {
  from {
    transform: scale(0.94);
    opacity: 0;
  }
  to {
    transform: none;
    opacity: 1;
  }
}

@keyframes win-close {
  from {
    transform: none;
    opacity: 1;
  }
  to {
    transform: scaleY(0.04);
    opacity: 0;
  }
}

.win-title {
  flex: 0 0 28px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 6px 0 10px;
  background: var(--paper-2);
  color: var(--ink);
  border-bottom: 1px solid var(--ink);
  font-weight: 600;
  font-size: 14px;
  white-space: nowrap;
}

.win.focused .win-title {
  background: var(--ink);
  color: var(--paper);
}

.win-title .sub {
  font-weight: 400;
  color: var(--ink-2);
}

.win.focused .win-title .sub {
  color: var(--bone-dim);
}

.win-title .right {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 6px;
  font-weight: 400;
}

.win-close {
  width: 22px;
  height: 22px;
  display: grid;
  place-items: center;
  border: 1px solid transparent;
  border-radius: 3px;
  background: transparent;
  padding: 0;
}
@media (hover: hover) {
  .win-close:hover {
    border-color: currentColor;
  }
}

.win-body {
  position: relative;
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.win.dark {
  background: var(--term);
}

/* ------------------------------------------------------------------ taskbar */

.taskbar {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 34px;
  display: flex;
  align-items: stretch;
  background: var(--ink);
  color: var(--bone);
  border-top: 1px solid #000;
  z-index: 30;
}

.tb-btn {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 0 12px;
  border: 0;
  border-right: 1px solid #3a342d;
  background: transparent;
  color: var(--bone);
  font-size: 14px;
  white-space: nowrap;
}

.tb-btn.on {
  background: #2c2723;
}
@media (hover: hover) {
  .tb-btn:hover {
    background: #2c2723;
  }
}

.tb-btn.on {
  box-shadow: inset 0 -2px 0 var(--brass);
}

.tb-btn.lantern {
  font-weight: 600;
}

.tb-apps {
  display: flex;
}

.tb-wallet {
  width: 168px;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  padding: 0 12px;
  border-right: 1px solid #3a342d;
  border-left: 1px solid #3a342d;
  font-family: var(--mono);
  font-variant-numeric: tabular-nums;
  color: var(--brass);
  font-size: 14px;
}

.tb-spacer {
  flex: 1;
}

.tb-clock {
  display: flex;
  align-items: center;
  padding: 0 12px;
  color: var(--bone-dim);
  font-family: var(--mono);
  font-size: 14px;
  white-space: nowrap;
}

.tb-sound {
  width: 44px;
  justify-content: center;
  padding: 0;
  border-right: 0;
  border-left: 1px solid #3a342d;
}

.lantern-menu {
  position: absolute;
  left: 0;
  bottom: 34px;
  width: 230px;
  background: var(--paper);
  border: 1px solid var(--ink);
  box-shadow: 3px 3px 0 var(--shadow);
  z-index: 35;
  padding: 4px 0;
}

.lantern-menu button {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 8px 14px;
  border: 0;
  background: transparent;
  text-align: left;
  font-size: 14px;
  color: var(--ink);
}
@media (hover: hover) {
  .lantern-menu button:hover {
    background: var(--ink);
    color: var(--paper);
  }
}

.lantern-menu hr {
  border: 0;
  border-top: 1px solid var(--paper-2);
  margin: 4px 0;
}

/* ------------------------------------------------------------------ desktop icons (the desk) */

.desk-icons {
  position: absolute;
  left: 22px;
  top: 22px;
  display: flex;
  flex-direction: column;
  flex-wrap: wrap;
  max-height: 360px;
  gap: 14px 10px;
}

.desk-icon {
  width: 88px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  border: 0;
  background: transparent;
  color: var(--paper);
  padding: 6px 0;
}

.desk-icon .ic {
  width: 52px;
  height: 52px;
  display: grid;
  place-items: center;
  background: var(--paper);
  color: var(--ink);
  border: 1px solid var(--ink);
  border-radius: 4px;
  box-shadow: 3px 3px 0 var(--shadow);
}

.desk-icon .lbl {
  background: var(--ink);
  color: var(--paper);
  padding: 1px 6px;
  border-radius: 3px;
  font-size: 14px;
}
@media (hover: hover) {
  .desk-icon:hover .ic {
    background: var(--brass);
  }
}

/* ------------------------------------------------------------------ chips and buttons */

.chip {
  height: 32px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 0 12px;
  border: 1px solid var(--bone-dim);
  border-radius: 4px;
  background: transparent;
  color: var(--bone);
  font-family: var(--mono);
  font-size: 15px;
  white-space: nowrap;
}
@media (hover: hover) {
  .chip:not(.on):hover:not(:disabled) {
    border-color: var(--bone);
    background: var(--term-2);
  }
}

.chip:disabled {
  opacity: 0.4;
}

.chip.on {
  background: var(--brass);
  color: var(--ink);
  border-color: var(--brass);
}

.chip.run {
  background: var(--bone);
  color: var(--ink);
  border-color: var(--bone);
  font-weight: 600;
}
@media (hover: hover) {
  .chip.run:hover:not(:disabled) {
    background: #fff6e4;
  }
}

.chip.logoff {
  margin-left: auto;
  min-width: 236px;
  justify-content: flex-start;
  border-color: var(--brass);
  color: var(--brass);
}
@media (hover: hover) {
  .chip.logoff:hover:not(:disabled) {
    background: var(--brass);
    color: var(--ink);
  }
}

.btn {
  height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0 16px;
  border: 1px solid var(--ink);
  border-radius: 4px;
  background: var(--paper);
  color: var(--ink);
  font-size: 15px;
  font-weight: 600;
  box-shadow: 2px 2px 0 var(--shadow);
}
@media (hover: hover) {
  .btn:hover:not(:disabled) {
    background: var(--paper-2);
  }
}

.btn:active:not(:disabled) {
  transform: translate(1px, 1px);
  box-shadow: 1px 1px 0 var(--shadow);
}

.btn.primary {
  background: var(--brass);
}
@media (hover: hover) {
  .btn.primary:hover:not(:disabled) {
    background: #f0bb47;
  }
}

.btn.dark {
  background: var(--ink);
  color: var(--paper);
}

.btn:disabled {
  opacity: 0.45;
}

/* ------------------------------------------------------------------ the terminal */

.term {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  background: var(--term);
  color: var(--bone);
  font-family: var(--mono);
  font-size: 15px;
  line-height: 20px;
}

.term-head {
  flex: 0 0 auto;
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 5px 12px 4px;
  color: var(--bone-dim);
  font-size: 14px;
  border-bottom: 1px solid #332e29;
}

.term-head .lock {
  color: var(--bone);
}

/* Lines lay out top down and the box scrolls to the newest (useStickBottom): no layout shift per line.
   A wheel or a finger can scroll back; the scrollbar is hidden so the text never changes width. */
.term-scroll {
  flex: 1 1 auto;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: none;
  padding: 4px 12px 0;
}

.term-scroll::-webkit-scrollbar,
.stream::-webkit-scrollbar {
  display: none;
}

.tl {
  white-space: pre-wrap;
  word-break: break-word;
}

.tl.out {
  padding-left: 2ch;
  color: var(--bone);
}

.tl.dim,
.tl.read {
  padding-left: 2ch;
  color: var(--bone-dim);
}

.tl.good {
  padding-left: 2ch;
  color: var(--bone);
}

.tl.bad {
  padding-left: 2ch;
  color: #ef7a5f;
}

.tl.you {
  padding-left: 2ch;
  color: var(--brass);
}

.tl.cmd .ps {
  color: var(--bone-dim);
}

.tl.cmd .c {
  color: var(--brass);
}

.tl.latch {
  padding-left: 2ch;
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--bone-dim);
}

.latch .latch-bolt {
  transition: transform calc(240ms * var(--k, 1)) steps(3, end);
}

.latch.open .latch-bolt {
  transform: translateX(-4px);
}

.term-prompt {
  position: relative;
  flex: 0 0 auto;
  padding: 2px 12px 4px;
  display: flex;
  gap: 1ch;
  min-height: 26px;
  align-items: center;
  cursor: text;
}

.term-prompt .ps {
  color: var(--bone-dim);
  white-space: nowrap;
}

.term-prompt .typed {
  color: var(--brass);
  white-space: pre;
}

.caret {
  display: inline-block;
  width: 9px;
  height: 18px;
  margin-left: 1px;
  background: transparent;
  vertical-align: -3px;
}

.caret.on {
  background: var(--bone);
  animation: blink 1060ms steps(1, end) infinite;
}

@keyframes blink {
  0% {
    opacity: 1;
  }
  50% {
    opacity: 0;
  }
}

.term-input {
  position: absolute;
  inset: 0;
  opacity: 0;
  border: 0;
  padding: 0;
  font: inherit;
  caret-color: transparent;
  color: transparent;
  background: transparent;
  cursor: text;
}

.term-chips {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px 10px;
}

/* The action card: the selected move's exact chance and pay, both outcomes when the spare is armed. */
.card {
  flex: 0 0 auto;
  margin: 2px 12px 0;
  padding: 6px 10px;
  min-height: 70px;
  background: var(--term-2);
  border: 1px solid #3a342d;
  border-radius: 4px;
  font-family: var(--ui);
  font-size: 14px;
  line-height: 19px;
  position: relative;
}

.card .num {
  font-size: 14px;
}

.card .row:last-of-type {
  padding-right: 64px;
}

.card .row {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.card .row.dim {
  color: var(--bone-dim);
}

.card .bad {
  color: #ef7a5f;
}

.card .good {
  color: var(--bone);
}

.card .b {
  color: var(--brass);
}

.card .exact {
  position: absolute;
  right: 6px;
  bottom: 5px;
  height: 22px;
  padding: 0 8px;
  border: 1px solid #4a433b;
  border-radius: 3px;
  background: transparent;
  color: var(--bone-dim);
  font-family: var(--ui);
  font-size: 14px;
}

.card .exact.on {
  color: var(--ink);
  background: var(--bone-dim);
}

.card .hint {
  color: var(--bone-dim);
  font-family: var(--ui);
}

/* the desk inside the terminal */
.desk-panel {
  flex: 0 0 auto;
  padding: 4px 12px 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.desk-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.desk-row .lbl {
  width: 52px;
  color: var(--bone-dim);
  font-family: var(--ui);
  font-size: 14px;
}

.desk-note {
  color: #ef7a5f;
  font-family: var(--ui);
  font-size: 14px;
}

.start-btn {
  height: 38px;
  padding: 0 22px;
  border: 1px solid var(--brass);
  border-radius: 4px;
  background: var(--brass);
  color: var(--ink);
  font-family: var(--ui);
  font-size: 16px;
  font-weight: 600;
  box-shadow: 2px 2px 0 rgba(0, 0, 0, 0.4);
}
@media (hover: hover) {
  .start-btn:hover:not(:disabled) {
    background: #f0bb47;
  }
}

.start-btn:active:not(:disabled) {
  transform: translate(1px, 1px);
  box-shadow: 1px 1px 0 rgba(0, 0, 0, 0.4);
}

.start-btn:disabled {
  opacity: 0.5;
}

/* ------------------------------------------------------------------ Remote */

.remote {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.remote-head {
  flex: 0 0 40px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 12px;
  border-bottom: 1px solid var(--paper-2);
}

.remote-head .srv {
  font-weight: 600;
  font-size: 15px;
}

.remote-head .note {
  color: var(--ink-2);
}

.ev {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2px 8px;
  border-radius: 3px;
  border: 1px solid var(--ink-2);
  color: var(--ink);
  font-size: 14px;
  white-space: nowrap;
}

.ev.lunch {
  border-color: var(--sage);
  color: #2f5a44;
}

.ev.audit {
  border-color: var(--admin);
  color: #3d4893;
}

.take {
  margin-left: auto;
  min-width: 232px;
  display: flex;
  align-items: baseline;
  gap: 8px;
  padding: 3px 10px;
  background: var(--ink);
  color: var(--brass);
  border-radius: 3px;
  font-family: var(--mono);
  font-variant-numeric: tabular-nums;
  font-size: 15px;
}

.take .lbl {
  color: var(--bone-dim);
  font-family: var(--ui);
  font-size: 14px;
}

.tiles {
  flex: 0 0 auto;
  display: flex;
  gap: 10px;
  padding: 12px 12px 0;
}

.tile {
  flex: 1 1 0;
  min-width: 0;
  height: 152px;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 10px 4px 6px;
  border: 1px solid var(--ink-2);
  border-radius: 4px;
  background: var(--paper-2);
  color: var(--ink);
  position: relative;
  transition: transform 80ms steps(2, end);
}
@media (hover: hover) {
  .tile:hover:not(.closed):not(:disabled) {
    border-color: var(--ink);
    transform: translateY(-2px);
  }
}

.tile.sel {
  border: 2px solid var(--ink);
  background: var(--paper);
  padding: 9px 3px 5px;
  box-shadow: 3px 3px 0 var(--shadow);
}

.tile.closed {
  background: transparent;
  border-style: dashed;
  color: var(--ink-2);
}

.tile.closed .art,
.tile.closed .glyph {
  opacity: 0.35;
  filter: grayscale(1);
}

.tile.moving {
  border: 2px solid var(--brass);
  background: var(--paper);
  padding: 9px 3px 5px;
}

.tile .lines {
  margin-top: 6px;
  font-family: var(--mono);
  font-size: 14px;
  color: var(--ink);
}

.tile .why {
  margin-top: 2px;
  font-size: 14px;
  line-height: 16px;
  text-align: center;
  color: var(--vermilion-ink);
}

.tile .why.note {
  color: var(--ink-2);
}

.tile .crown-mark {
  position: absolute;
  top: 4px;
  left: 6px;
  font-size: 14px;
  color: var(--ink-2);
}

/* A pulled file's slot: the painting, faint, and "pulled" (no border, so it never reads as a closed tile). */
.tile.gone,
.ptile.gone {
  background: transparent;
  border-color: transparent;
  color: var(--ink-2);
}

.tile.gone .art,
.tile.gone .glyph,
.ptile.gone .art,
.ptile.gone .glyph {
  opacity: 0.2;
}

.tile.gone .lines,
.ptile.gone .lines {
  font-family: var(--ui);
  color: var(--ink-2);
}

.tile.leaving {
  animation: tile-leave calc(300ms * var(--k, 1)) steps(3, end) both;
}

@keyframes tile-leave {
  to {
    transform: translateY(14px) scale(0.6);
    opacity: 0;
  }
}

.transfer {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 6px;
  padding: 0 12px;
  min-height: 0;
}

.transfer .what {
  font-size: 14px;
  color: var(--ink-2);
  display: flex;
  justify-content: space-between;
}

.transfer .what b {
  color: var(--ink);
  font-weight: 600;
}

.bar {
  height: 12px;
  background: var(--term);
  border-radius: 2px;
  overflow: hidden;
}

/* No transfer running: the track keeps its box but is not drawn (it read as a leftover placeholder). */
.bar.idle {
  visibility: hidden;
}

/* A solid brass fill on a charcoal track (no gradient). */
.bar .fill {
  height: 100%;
  background: var(--brass);
}

.remote-foot {
  flex: 0 0 52px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 12px;
  border-top: 1px solid var(--paper-2);
}

.remote-foot .lbl {
  color: var(--ink-2);
}

.pulled-strip {
  display: flex;
  gap: 4px;
  align-items: center;
  min-width: 0;
  overflow: hidden;
}

.pulled-strip .mini {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  background: var(--paper-2);
  border-radius: 3px;
}

.pulled-strip .mini.new {
  animation: mini-in calc(260ms * var(--k, 1)) steps(3, end) both;
  animation-delay: calc(400ms * var(--k, 1));
}

@keyframes mini-in {
  from {
    transform: translateY(-16px);
    opacity: 0;
  }
}

/* your kit, painted: the spare and the wipe charges */
.kit {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 8px;
}

.kit-item {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-size: 14px;
  color: var(--ink);
}

.kit-item.used .art,
.kit-item.used .glyph {
  opacity: 0.3;
  filter: grayscale(1);
}

.kit-item.used {
  color: var(--ink-2);
}

.kit.big {
  margin: 0 0 6px;
  gap: 22px;
}

.kit.big .kit-item {
  gap: 8px;
  font-size: 15px;
}

.remote-foot .no-hop {
  margin-left: 10px;
}

.hop-btn {
  margin-left: 10px;
  height: 34px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 0 12px;
  border: 1px solid var(--ink);
  border-radius: 4px;
  background: var(--paper);
  font-size: 14px;
  font-weight: 600;
}

.hop-btn.sel {
  background: var(--ink);
  color: var(--paper);
}

.hop-btn.closed {
  border-style: dashed;
  color: var(--ink-2);
  font-weight: 400;
}
@media (hover: hover) {
  .hop-btn:hover:not(:disabled):not(.sel) {
    background: var(--paper-2);
  }
}

/* ------------------------------------------------------------------ Logbook */

.logbook {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
  background: var(--paper);
}

.log-cols {
  flex: 0 0 auto;
  display: flex;
  padding: 6px 10px 0;
  font-family: var(--mono);
  font-size: 14px;
  color: var(--ink-2);
}

.log-cols span {
  flex: 1;
}

.log-canvas-wrap {
  flex: 1 1 auto;
  min-height: 0;
  position: relative;
  margin: 2px 10px 0;
}

.log-canvas-wrap canvas {
  position: absolute;
  left: 0;
  top: 0;
}

.log-foot {
  flex: 0 0 auto;
  padding: 6px 10px 8px;
  border-top: 1px solid var(--paper-2);
  font-size: 14px;
  line-height: 17px;
  color: var(--ink-2);
}

.log-foot .yours {
  font-size: 15px;
  color: var(--ink);
  font-weight: 600;
  margin-bottom: 3px;
}

.log-foot .yours .n,
.p-log-foot .yours .n {
  display: inline-block;
  min-width: 2ch;
  text-align: right;
  color: var(--vermilion-ink);
  font-family: var(--mono);
}

/* ------------------------------------------------------------------ Netmap */

.netmap {
  flex: 1;
  position: relative;
  display: flex;
  align-items: flex-start;
  padding: 10px 8px 0;
}

/* Flat 2 px ink lines between the nodes: dashed ahead, solid once travelled. */
.net-link {
  flex: 1 1 0;
  min-width: 8px;
  height: 0;
  margin-top: 32px;
  border-top: 2px dashed rgba(92, 84, 73, 0.7);
  position: relative;
}

.net-link.done {
  border-top: 2px solid var(--ink);
}

.net-draw {
  position: absolute;
  left: 0;
  top: -2px;
  height: 2px;
  background: var(--ink);
}

.node {
  position: relative;
  flex: 0 0 auto;
  width: 82px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  text-align: center;
}

.node .pic {
  width: 64px;
  height: 64px;
  display: grid;
  place-items: center;
  background: var(--paper);
  border-radius: 4px;
}

.node.here .pic {
  outline: 2px solid var(--ink);
  outline-offset: 1px;
  background: var(--paper-2);
}

.node.ahead .pic .art {
  opacity: 0.45;
}

.node .name {
  font-weight: 600;
  font-size: 14px;
  line-height: 17px;
}

.node .sub {
  font-size: 14px;
  line-height: 17px;
  color: var(--ink-2);
  white-space: nowrap;
}

.node .here-mark {
  position: absolute;
  top: -8px;
  right: 2px;
  color: var(--ink);
}

/* ------------------------------------------------------------------ Relay */

.relay {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

/* The header is a slim strip, never a chat message: a small avatar and who it is on one line (D-325). */
.relay-head {
  flex: 0 0 40px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 12px;
  background: var(--paper-2);
  border-bottom: 1px solid var(--ink);
}

.relay-head .avatar {
  width: 28px;
  height: 28px;
  font-size: 19px;
}

.relay-head .who {
  min-width: 0;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  font-size: 14px;
}

.relay-head .who b {
  font-size: 14px;
}

.relay-head .status {
  font-size: 14px;
  color: var(--ink-2);
  white-space: nowrap;
}

.relay-head .status.reading {
  color: #3d4893;
}

.avatar {
  flex: 0 0 auto;
  width: 40px;
  height: 40px;
  border-radius: 4px;
  overflow: hidden;
  display: grid;
  place-items: center;
  background: var(--paper-2);
  color: var(--ink);
}

.avatar img {
  width: 100%;
  height: 100%;
  display: block;
}

.avatar.pell {
  background: var(--brass);
  color: var(--ink);
  font-family: var(--serif);
  font-size: 26px;
  line-height: 1;
}

.stream {
  flex: 1 1 auto;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: none;
  padding: 6px 12px 8px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.stream > .msg {
  flex: 0 0 auto;
}

.msg {
  display: flex;
  gap: 10px;
  align-items: flex-start;
}

.msg .body {
  min-width: 0;
  font-size: 14px;
  line-height: 19px;
}

.msg .body b {
  display: block;
  font-size: 14px;
}

.msg.admin .body b {
  color: #3d4893;
}

.msg.new {
  animation: msg-in calc(180ms * var(--k, 1)) steps(3, end) both;
}

@keyframes msg-in {
  from {
    transform: translateY(8px);
    opacity: 0;
  }
}

.typing {
  flex: 0 0 22px;
  padding: 0 12px;
  color: var(--ink-2);
  font-size: 14px;
}

.contracts {
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 8px 12px 12px;
  border-top: 1px solid var(--paper-2);
}

.contract {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  text-align: left;
  padding: 8px 10px 8px 8px;
  border: 1px solid var(--ink-2);
  border-radius: 4px;
  background: var(--paper-2);
  color: var(--ink);
}
@media (hover: hover) {
  .contract:hover {
    border-color: var(--ink);
  }
}

.contract.sel {
  border: 2px solid var(--ink);
  background: var(--paper);
  padding: 7px 9px 7px 7px;
  box-shadow: 3px 3px 0 var(--shadow);
}

/* The admin's portrait at 72 px (R10), the text, and the crown the job brings back (R6 to R8). */
.contract .face {
  flex: 0 0 72px;
  height: 72px;
  border: 1px solid var(--ink);
  border-radius: 3px;
  overflow: hidden;
  background: var(--admin);
}

.contract .face img {
  width: 100%;
  height: 100%;
  display: block;
}

.contract .crown {
  flex: 0 0 52px;
  height: 52px;
  align-self: center;
}

.contract .txt {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.contract .name {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  column-gap: 8px;
  font-size: 15px;
  font-weight: 600;
}

.contract .prof {
  font-size: 14px;
  font-weight: 400;
  color: var(--ink-2);
}

.contract .why {
  font-size: 14px;
  line-height: 18px;
  color: var(--ink);
}

/* ------------------------------------------------------------------ overlays */

.overlay-shade {
  position: absolute;
  inset: 0 0 34px 0;
  z-index: 20;
}

.ov-body {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 16px 20px 18px;
  user-select: text;
  font-size: 14px;
  line-height: 20px;
}

.ov-body h2 {
  font-size: 16px;
  margin: 18px 0 6px;
}

.ov-body h2:first-child {
  margin-top: 0;
}

.ov-body p {
  margin: 0 0 10px;
}

.ov-body ol {
  margin: 0;
  padding-left: 22px;
}

.ov-body ol li {
  margin-bottom: 8px;
}

.ov-body .mono {
  font-family: var(--mono);
  font-size: 14px;
  word-break: break-all;
}

.kv {
  display: grid;
  grid-template-columns: 130px 1fr;
  gap: 4px 12px;
  margin-bottom: 10px;
}

.kv dt {
  color: var(--ink-2);
}

.kv dd {
  margin: 0;
  font-family: var(--mono);
  font-size: 14px;
  word-break: break-all;
}

.ok {
  color: #2f5a44;
}

.no {
  color: var(--vermilion-ink);
}

table.odds {
  border-collapse: collapse;
  width: 100%;
  font-family: var(--mono);
  font-size: 14px;
  font-variant-numeric: tabular-nums;
}

table.odds th {
  font-family: var(--ui);
  font-weight: 600;
  text-align: right;
  padding: 4px 6px;
  border-bottom: 1px solid var(--ink);
  position: sticky;
  top: -16px;
  background: var(--paper);
}

table.odds td {
  text-align: right;
  padding: 2px 6px;
  border-bottom: 1px solid var(--paper-2);
}

table.odds th:first-child,
table.odds td:first-child {
  text-align: left;
}

.pulled-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 12px;
}

.pulled-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 8px 4px;
  background: var(--paper-2);
  border-radius: 4px;
  text-align: center;
  font-size: 14px;
  word-break: break-all;
  position: relative;
}

.pulled-item .seal {
  position: absolute;
  top: 4px;
  right: 4px;
  color: #8a6512;
}

.past {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

.past td {
  padding: 4px 6px;
  border-bottom: 1px solid var(--paper-2);
}

.past td.num {
  text-align: right;
}

details.strings summary {
  cursor: pointer;
  font-weight: 600;
  margin: 6px 0;
}

.check-form {
  display: flex;
  gap: 8px;
  margin: 6px 0 12px;
}

.check-form input {
  flex: 1;
  height: 34px;
  padding: 0 10px;
  border: 1px solid var(--ink);
  border-radius: 4px;
  background: var(--paper);
  font-family: var(--mono);
  font-size: 14px;
  color: var(--ink);
}

/* the summary dialog */
.summary .ov-body {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
  padding: 22px 26px 22px;
}

.end-title {
  font-family: var(--serif);
  font-size: 46px;
  line-height: 1;
  margin: 0 0 6px;
  font-weight: 400;
}

.end-title.caught {
  color: var(--vermilion-ink);
}

.end-sentence {
  font-size: 16px;
  line-height: 22px;
  max-width: 460px;
}

.end-number {
  font-family: var(--mono);
  font-variant-numeric: tabular-nums;
  font-size: 34px;
  line-height: 1.2;
  margin: 8px 0 14px;
}

.end-buttons {
  display: flex;
  gap: 10px;
}

.end-buttons .link {
  margin-left: 6px;
  align-self: center;
  font-size: 14px;
}

/* the break lock screen and the notice */
.lockscreen {
  position: absolute;
  inset: 0;
  background: var(--room);
  color: var(--bone);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  z-index: 50;
}

.lockscreen .until {
  font-family: var(--serif);
  font-size: 44px;
}

.lockscreen .lock-now {
  font-family: var(--mono);
  font-size: 15px;
  color: var(--bone);
}

.lockscreen p {
  color: var(--bone-dim);
  font-size: 15px;
  max-width: 520px;
  text-align: center;
  margin: 0;
}

.break-opts {
  display: flex;
  gap: 10px;
  margin: 8px 0 12px;
}

/* ------------------------------------------------------------------ /verify */

.verify .ov-body {
  padding: 18px 24px 24px;
}

.vmove {
  display: grid;
  grid-template-columns: 58px 1fr;
  gap: 2px 12px;
  padding: 8px 0;
  border-bottom: 1px solid var(--paper-2);
}

.vmove .a {
  font-family: var(--mono);
  color: var(--ink-2);
}

.vmove .label {
  font-family: var(--mono);
  font-size: 14px;
  color: var(--ink-2);
  word-break: break-all;
}

.vserver {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding: 8px 0;
  border-bottom: 1px solid var(--paper-2);
}

.vfiles {
  font-family: var(--mono);
  font-size: 14px;
  color: var(--ink-2);
}

.problems {
  color: var(--vermilion-ink);
  margin: 0 0 10px;
  padding-left: 18px;
}

/* the summary's layout: one sentence and one number, the admin (caught), the crown or the moth beside it */
.sum-main {
  display: flex;
  align-items: flex-start;
  gap: 18px;
  width: 100%;
}

.sum-text {
  flex: 1;
  min-width: 0;
}

.sum-pic {
  flex: 0 0 auto;
  padding-top: 4px;
}

/* Netmap's node text (name and trail or event) */
.node .txt {
  align-self: stretch;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  text-align: center;
  gap: 2px;
}

/* the odds table on a phone: one event at a time */
.odds-pick {
  display: flex;
  gap: 6px;
  margin: 8px 0 10px;
}

.chip.light {
  color: var(--ink);
  border-color: var(--ink-2);
  font-family: var(--ui);
}

.chip.light.on {
  background: var(--brass);
  border-color: var(--ink);
}

table.odds.compact {
  width: 100%;
}

/* ------------------------------------------------------------------ handheld mode (GDD 2.6) */

/* One column of fixed rows sized to 100svh (never dvh, so the URL bar can't resize it mid-job).
   Below about 520 px tall the page scrolls vertically; it never scrolls sideways. */
.phone {
  position: fixed;
  inset: 0;
  overflow-x: hidden;
  overflow-y: auto;
  background: var(--room);
  overscroll-behavior: none;
}

.phone-col {
  position: relative;
  width: 100%;
  height: 100svh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--paper);
  font-size: 14px;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

.phone-col.shake {
  animation: shake calc(180ms * var(--k, 1)) step-end 1;
}

.phone-col .fx-layer {
  z-index: 40;
}

.p-fill {
  flex: 1 1 auto;
  padding: 16px;
}

/* the status bar: target / server and the take; the event, the money and the session time under it */
.p-status {
  flex: 0 0 44px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 0 16px;
  background: var(--ink);
  color: var(--bone);
  border-bottom: 1px solid #000;
}

.p-status .r1,
.p-status .r2 {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  white-space: nowrap;
  min-width: 0;
}

.p-status .r1 {
  font-size: 15px;
  line-height: 19px;
  font-weight: 600;
}

.p-status .r2 {
  font-size: 14px;
  line-height: 17px;
  color: var(--bone-dim);
}

.p-status .where {
  overflow: hidden;
  text-overflow: ellipsis;
}

.p-status .take,
.p-status .wallet {
  flex: 0 0 auto;
  color: var(--brass);
  font-weight: 500;
}

/* In a job the take and the GC amount count up: fixed boxes anchored on the left, so the text never moves (CLS). */
.p-status.job .take {
  min-width: 9ch;
}

.p-status.job .r2 .num {
  flex: 0 0 auto;
  min-width: 22ch;
}

.p-status .brand {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--serif);
  font-size: 22px;
  font-weight: 400;
}

.p-status .ev {
  border: 0;
  padding: 0;
  gap: 4px;
  color: var(--bone-dim);
}

.p-status .ev.lunch {
  color: #9cc8b0;
}

.p-status .ev.audit {
  color: #b3bbef;
}

/* Remote: the one flexible row, 3 x 2 tiles, at least two 84 px rows */
.p-remote {
  flex: 1 1 auto;
  min-height: 168px;
  display: flex;
  padding: 8px 16px;
  background: var(--paper);
  border-bottom: 1px solid var(--ink);
}

.p-tiles {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  grid-template-rows: repeat(2, minmax(0, 1fr));
  gap: 6px;
}

.ptile {
  position: relative;
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1px;
  padding: 4px 3px 6px;
  border: 1px solid var(--ink-2);
  border-radius: 4px;
  background: var(--paper-2);
  color: var(--ink);
  overflow: hidden;
}

.ptile .pic {
  flex: 1 1 auto;
  min-height: 0;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.ptile .pic .art,
.ptile .pic .glyph {
  height: 100%;
  width: auto;
  max-height: 64px;
  max-width: 100%;
  aspect-ratio: 1;
  object-fit: contain;
}

.ptile .lines {
  flex: 0 0 auto;
  font-family: var(--mono);
  font-size: 14px;
  line-height: 17px;
  white-space: nowrap;
}

.ptile .why {
  flex: 0 0 auto;
  max-width: 100%;
  font-size: 14px;
  line-height: 15px;
  text-align: center;
  color: var(--vermilion-ink);
}

.ptile .why.note {
  color: var(--ink-2);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ptile.hop .lines {
  font-family: var(--ui);
  font-weight: 600;
}

.ptile.sel {
  border: 2px solid var(--ink);
  background: var(--paper);
  padding: 3px 2px 5px;
  box-shadow: 2px 2px 0 var(--shadow);
}

.ptile.closed {
  background: transparent;
  border-style: dashed;
  color: var(--ink-2);
}

.ptile.closed .art,
.ptile.closed .glyph {
  opacity: 0.35;
  filter: grayscale(1);
}

.ptile.moving {
  border: 2px solid var(--brass);
  background: var(--paper);
  padding: 3px 2px 5px;
}

.ptile.leaving {
  animation: tile-leave calc(300ms * var(--k, 1)) steps(3, end) both;
}

/* the transfer inside a tile: a solid brass fill on a charcoal track (no gradient) */
.ptile .tbar {
  position: absolute;
  left: 6px;
  right: 6px;
  bottom: 3px;
  height: 5px;
  background: var(--term);
  border-radius: 2px;
  overflow: hidden;
}

.ptile .tbar .fill {
  display: block;
  height: 100%;
  background: var(--brass);
}

/* Logbook: two strips of 50 rows */
.p-log {
  flex: 0 0 64px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  padding: 3px 16px 2px;
  background: var(--paper);
  border-bottom: 1px solid var(--ink);
}

.p-strips {
  position: relative;
  flex: 0 0 38px;
  height: 38px;
}

.p-strips canvas {
  position: absolute;
  left: 0;
  top: 0;
}

.p-log-foot {
  align-self: stretch;
  display: flex;
  justify-content: space-between;
  gap: 8px;
  font-size: 14px;
  line-height: 17px;
  white-space: nowrap;
}

.p-log-foot .yours {
  font-weight: 600;
}



.p-log-foot .rule {
  color: var(--ink-2);
  overflow: hidden;
  text-overflow: ellipsis;
}

.p-remote.opening,
.p-log.opening {
  animation: win-open calc(200ms * var(--k, 1)) steps(4, end) both;
}

.p-remote.closing,
.p-log.closing {
  animation: win-close calc(160ms * var(--k, 1)) steps(3, end) both;
}

/* Terminal: the last 4 lines (2 below 600 px tall) */
.phone-col .p-term {
  flex: 0 0 84px;
  padding-top: 2px;
  border-bottom: 1px solid #332e29;
}

.phone-col.short .p-term {
  flex-basis: 44px;
}

.p-term .term-scroll {
  padding: 0 16px;
}

.p-term .term-prompt {
  padding: 0 16px 2px;
  min-height: 22px;
  overflow: hidden;
}

/* the action card and the chips */
.phone-col .p-card {
  flex: 0 0 166px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 6px 16px 0;
}

.p-card .card {
  flex: 1 1 auto;
  min-height: 0;
  margin: 0;
  padding: 2px 8px;
  line-height: 18px;
  overflow: hidden;
}

.p-card .card .row:last-of-type {
  padding-right: 0;
}

.p-chip-row .chip.logoff {
  flex: 1 1 0;
  min-width: 0;
  justify-content: center;
}

.p-chip-row .chip.exact-chip {
  flex: 0 0 64px;
  font-family: var(--ui);
}

.p-chips {
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding-bottom: 6px;
}

.p-chip-row {
  display: flex;
  gap: 6px;
}

.p-chip-row .chip {
  flex: 1 1 0;
  min-width: 0;
  justify-content: center;
  height: 32px;
  padding: 0 6px;
  font-size: 14px;
}

.p-chip-row .chip.run {
  flex-grow: 0.7;
}

.p-chip-row .chip.spare {
  flex-grow: 1.45;
}

.p-chip-row .chip.logoff {
  margin-left: 0;
}

/* the taskbar: Relay, Pulled, Map, Keys, more */
.p-taskbar {
  flex: 0 0 calc(56px + env(safe-area-inset-bottom, 0px));
  display: flex;
  padding-bottom: env(safe-area-inset-bottom, 0px);
  background: var(--ink);
  border-top: 1px solid #000;
  z-index: 30;
}

.p-tab {
  flex: 1 1 0;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--bone);
  font-size: 14px;
  line-height: 16px;
  white-space: nowrap;
}

.p-tab.on {
  background: #2c2723;
  box-shadow: inset 0 -2px 0 var(--brass);
}

.p-tab .count {
  color: var(--brass);
}

/* the desk */
.p-desk {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  background-color: var(--wall);
  background-size: cover;
  background-position: center;
}

.p-desk-in {
  padding: 10px 16px 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.p-pell {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 10px 6px 6px;
  background: var(--paper);
  border: 1px solid var(--ink);
  border-radius: 4px;
  box-shadow: 3px 3px 0 var(--shadow);
}

.p-pell .avatar {
  width: 32px;
  height: 32px;
  font-size: 22px;
}

.p-pell .body {
  min-width: 0;
  font-size: 14px;
  line-height: 18px;
}

.p-pell .body b {
  margin-right: 6px;
}

.p-contracts {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.p-contract {
  height: 64px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 8px;
  text-align: left;
  border: 1px solid var(--ink);
  border-radius: 4px;
  background: var(--paper);
  color: var(--ink);
  box-shadow: 3px 3px 0 var(--shadow);
}

.p-contract.sel {
  border-width: 2px;
  padding: 0 7px;
  box-shadow:
    inset 6px 0 0 var(--brass),
    3px 3px 0 var(--shadow);
}

.p-contract.sel .face {
  margin-left: 6px;
}

.p-contract .face {
  flex: 0 0 48px;
  height: 48px;
  border: 1px solid var(--ink);
  border-radius: 3px;
  overflow: hidden;
  background: var(--admin);
}

.p-contract .face img {
  width: 100%;
  height: 100%;
  display: block;
}

.p-contract .txt {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.p-contract .name {
  font-size: 15px;
  font-weight: 600;
  line-height: 19px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.p-contract .prof {
  font-weight: 400;
  color: var(--ink-2);
}

.p-contract .why {
  font-size: 14px;
  line-height: 17px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.p-contract .crown {
  flex: 0 0 40px;
  height: 40px;
}

.phone-col .p-deskterm {
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 10px 12px;
  border: 1px solid #000;
  border-radius: 4px;
  box-shadow: 3px 3px 0 var(--shadow);
}

.p-stakes {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
}

.p-stakes .chip {
  justify-content: center;
  height: 34px;
}

.p-lock {
  font-size: 14px;
  line-height: 18px;
  color: var(--bone);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.p-note {
  font-family: var(--ui);
  font-size: 14px;
  line-height: 18px;
  color: #ef7a5f;
}

.p-start-row {
  display: flex;
  gap: 8px;
  align-items: center;
}

.p-start-row .start-btn {
  flex: 1;
  height: 44px;
}

.p-refill {
  justify-content: center;
  height: 38px;
  border-color: var(--brass);
  color: var(--brass);
}

/* full-screen sheets with a close button: Relay, Pulled, Map, Keys, Stash, readme, more */
.p-sheet {
  position: fixed;
  /* below the status bar, so the session time always shows (GDD 10) */
  inset: 44px 0 0 0;
  z-index: 50;
  display: flex;
  flex-direction: column;
  background: var(--room);
}

.p-sheet > .win,
.p-summary > .win,
.p-verify > .win {
  position: relative;
  flex: 1 1 auto;
  min-height: 0;
  border-radius: 0;
  border: 0;
  box-shadow: none;
}

.p-sheet .win-title,
.p-verify .win-title {
  flex-basis: 48px;
  font-size: 15px;
  padding: 0 2px 0 16px;
}

.p-sheet .win-close {
  width: 44px;
  height: 44px;
}

.p-sheet .ov-body,
.p-verify .ov-body {
  padding: 14px 16px 28px;
}



.p-sheet .pulled-grid {
  grid-template-columns: repeat(auto-fill, minmax(96px, 1fr));
  gap: 8px;
}

.p-sheet .stash-row {
  flex-wrap: wrap;
}

.p-sheet .stash-target {
  flex: 0 0 100%;
  width: 100%;
}

.p-sheet .stash-item {
  width: calc((100% - 16px) / 3);
}

.p-sheet .past td:nth-child(3),
.p-sheet .past td:nth-child(6) {
  display: none;
}

.p-sheet .break-opts {
  flex-wrap: wrap;
}

.p-sheet table.odds th,
.p-sheet table.odds td {
  padding-left: 4px;
  padding-right: 4px;
}

.p-more {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.p-more-item {
  display: flex;
  align-items: center;
  gap: 14px;
  min-height: 52px;
  padding: 0 4px;
  border: 0;
  border-bottom: 1px solid var(--paper-2);
  background: transparent;
  color: var(--ink);
  font-size: 15px;
  font-weight: 600;
  text-align: left;
}

.p-more-blank {
  display: inline-block;
  width: 20px;
}

/* Netmap as a sheet: the route top to bottom */
.netmap.vert {
  flex-direction: column;
  align-items: stretch;
  padding: 18px 16px;
}

.netmap.vert .node {
  width: auto;
  flex-direction: row;
  align-items: center;
  gap: 12px;
  text-align: left;
}

.netmap.vert .node .txt {
  align-items: flex-start;
  text-align: left;
}

.netmap.vert .node .here-mark {
  position: static;
  margin-left: auto;
}

.netmap.vert .net-link {
  flex: 0 0 26px;
  width: 0;
  min-width: 0;
  height: 26px;
  margin: 0 0 0 31px;
  border-top: 0;
  border-left: 2px dashed rgba(92, 84, 73, 0.7);
}

.netmap.vert .net-link.done {
  border-left: 2px solid var(--ink);
}

.netmap.vert .net-draw {
  left: -2px;
  top: 0;
  width: 2px;
  height: 0;
}

/* the summary over the closed windows */
.p-summary {
  position: absolute;
  left: 0;
  right: 0;
  top: 44px;
  bottom: calc(56px + env(safe-area-inset-bottom, 0px));
  z-index: 22;
  display: flex;
  padding: 12px 12px 14px;
  background: var(--wall);
}

.p-summary > .win {
  border: 1px solid var(--ink);
  border-radius: 4px;
  box-shadow: 3px 3px 0 var(--shadow);
}

.p-summary .ov-body {
  padding: 16px 16px 18px;
}

.p-summary .sum-main {
  flex-direction: column;
  gap: 10px;
}

.p-summary .sum-pic {
  order: -1;
  padding-top: 0;
}

.p-summary .end-title {
  font-size: 40px;
}

.p-summary .end-number {
  font-size: 30px;
  margin: 6px 0 10px;
}

.p-summary .end-buttons {
  flex-wrap: wrap;
  row-gap: 10px;
}

.phone .lockscreen,
.phone .p-bootscreen {
  position: fixed;
  padding: 24px 16px;
  text-align: center;
}

.phone .lockscreen {
  z-index: 70;
}

.phone .lockscreen .until {
  font-size: 34px;
  line-height: 1.1;
}

.phone .p-bootscreen {
  z-index: 80;
}

/* /verify on a phone: one scrolling column */
.phone-page {
  background: var(--wall);
}

.p-verify {
  min-height: 100%;
  display: flex;
}

.p-verify .ov-body {
  overflow: visible;
}

.p-verify .check-form {
  max-width: none !important;
}

.p-verify .vmove {
  grid-template-columns: 34px minmax(0, 1fr);
}

.p-verify .vfiles,
.p-verify .kv dd,
.p-sheet .kv dd {
  overflow-wrap: anywhere;
}

/* Short dialogs (the hourly notice, the break picker, About) sit centred on a phone instead of filling it. */
.p-sheet.sheet-notice,
.p-sheet.sheet-break,
.p-sheet.sheet-about {
  justify-content: center;
  padding: 16px;
  background: rgba(18, 14, 12, 0.78);
}

.p-sheet.sheet-notice > .win,
.p-sheet.sheet-break > .win,
.p-sheet.sheet-about > .win {
  flex: 0 0 auto;
  border: 1px solid var(--ink);
  border-radius: 4px;
  box-shadow: 3px 3px 0 var(--shadow);
}

.p-verify .past td:nth-child(3) {
  display: none;
}

@media (max-width: 359px) {
  .p-contract .crown {
    display: none;
  }
}

/* ------------------------------------------------------------------ Stash */

.stash-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 0;
  border-bottom: 1px solid var(--paper-2);
}

.stash-target {
  width: 150px;
  flex: 0 0 150px;
  font-weight: 600;
  line-height: 18px;
}

.stash-item {
  position: relative;
  width: 82px;
  height: 88px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 4px 0;
  background: var(--paper-2);
  border-radius: 4px;
  font-size: 14px;
}

.stash-item.missing .art,
.stash-item.missing .glyph {
  opacity: 0.18;
  filter: grayscale(1);
}

.stash-item .seal {
  position: absolute;
  top: 2px;
  right: 3px;
  color: #8a6512;
}

/* ------------------------------------------------------------------ review fixes (D-312 to D-325) */

/* A paper chip that is picked keeps its brass fill under the pointer; hover only lights the others. */
@media (hover: hover) {
  .chip.light:not(.on):hover:not(:disabled) {
    background: var(--paper-2);
    border-color: var(--ink);
  }
}

/* Behind a job's rows on a phone: the wallpaper, seen when Remote and the Logbook close (D-322). */
.phone-col.in-job {
  background-color: var(--wall);
  background-size: cover;
  background-position: center;
}

.p-summary {
  background: transparent;
}

/* The transcript and the Relay stream scroll by whole lines: a mask the colour of the panel covers
   a line that the top edge would cut through the middle of its letters (D-314). */
.scroll-wrap {
  position: relative;
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.scroll-wrap > .term-scroll,
.scroll-wrap > .stream {
  position: relative;
}

.top-mask {
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  height: 0;
  pointer-events: none;
  z-index: 1;
}

.term .top-mask {
  background: var(--term);
}

.relay .top-mask {
  background: var(--paper);
}

/* Pulled: long names wrap at underscores and before the extension, never inside a word (D-325). */
.pulled-item span {
  word-break: normal;
  overflow-wrap: anywhere;
}

/* The viewer asked for less motion (D-316): no shake, no crawl, no window or tile motion.
   Timeline lengths stay the same, so nothing about a result is shown any sooner. */
@media (prefers-reduced-motion: reduce) {
  .desktop.shake,
  .phone-col.shake,
  .bezel-moth,
  .bezel-moth.landed,
  .win.opening,
  .p-remote.opening,
  .p-log.opening,
  .pulled-strip .mini.new,
  .msg.new {
    animation: none;
  }

  .bezel-moth.flown {
    animation: none;
    opacity: 0;
  }

  .win.closing,
  .p-remote.closing,
  .p-log.closing,
  .tile.leaving,
  .ptile.leaving {
    animation: none;
    visibility: hidden;
  }

  .tile,
  .latch .latch-bolt {
    transition: none;
  }

  .caret.on {
    animation: none;
  }
}

/* the transcript sits at the bottom of its space, a whole number of lines tall (useWholeLines) */
.scroll-wrap.lines {
  justify-content: flex-end;
}

/* the phone Terminal: 19 px lines, so three whole lines fit its 84 px row above the prompt */
.phone-col .p-term .term-scroll {
  line-height: 19px;
}
