/* Cybertantra · The Living Print — Night Desk Live-Cut Table
   Inherits --paper, --ink, --ink-soft, --rule, --vermilion, --surface, --display, --display-italic, --body
   from verify.html and /theme.css (Paper light default + Night soot dark mode). */

.nightdesk { display: none; }
[data-night-desk="live"] .legacy-sheet { display: none; }
[data-night-desk="live"] body {
  margin: 0;
  padding: 0;
  background: var(--paper) url("/paper.jpg");
  background-blend-mode: var(--grain-blend, normal);
  color: var(--ink);
  overflow-x: hidden;
}
[data-night-desk="live"] .theme-toggle {
  position: fixed;
  top: max(12px, env(safe-area-inset-top));
  right: max(16px, env(safe-area-inset-right));
  z-index: 30;
  margin: 0;
  color: var(--ink-soft);
}
[data-night-desk="live"] .theme-toggle:hover {
  color: var(--vermilion);
}
.nd-reply[hidden], .nightdesk [hidden] { display: none; }

[data-night-desk="live"] .nightdesk {
  display: grid;
  gap: 0;
  color: var(--ink);
  min-height: 100svh;
  grid-template-rows: 1fr auto;
}

/* Act 1–3: Full-width centered paper table. Gordo split opens ONLY after card flips (Act 4). */
.nd-sheet {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 0fr);
  min-height: 100svh;
  transition:
    grid-template-columns 720ms cubic-bezier(.22, 1, .36, 1),
    min-height 500ms ease;
}
.nd-sheet.is-revealed {
  grid-template-columns: minmax(0, 1.68fr) minmax(300px, 0.92fr);
  height: calc(100svh - 54px);
  min-height: calc(100svh - 54px);
  overflow: hidden;
}

.nd-table {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  align-items: center;
  min-width: 0;
  min-height: 100svh;
  padding: clamp(18px, 2.6vh, 30px) clamp(12px, 2vw, 32px) clamp(20px, 3vh, 34px);
  color: var(--ink);
}
.nd-sheet.is-revealed .nd-table {
  min-height: calc(100svh - 54px);
}

/* Living-Print 4-step rail (Shuffle · Cut · Deal · Turn) from tarot-app/src/ui/ritual.css */
.nd-steps-head {
  position: relative;
  z-index: 6;
  display: grid;
  justify-items: center;
  gap: 4px;
  text-align: center;
  margin-bottom: 4px;
  min-height: 3.1rem;
  pointer-events: none;
}
.nd-steps {
  display: flex;
  align-items: center;
  list-style: none;
  margin: 0;
  padding: 0;
  font-family: var(--display);
  font-weight: 400;
  font-size: clamp(.92rem, 1.25vw, 1.06rem);
  letter-spacing: .07em;
  line-height: 1;
}
.nd-steps li {
  position: relative;
  color: var(--rule);
  transition: color .25s ease;
}
.nd-steps li + li::before {
  content: "·";
  color: var(--rule);
  padding: 0 .52em;
}
.nd-steps li[data-state="current"],
.nd-steps li[data-state="done"] {
  color: var(--ink);
}
.nd-steps li[data-state="done"]::after {
  content: "";
  position: absolute;
  right: -.34em;
  top: .02em;
  width: .24em;
  height: .24em;
  border-radius: 50%;
  background: var(--vermilion);
}

.nd-status {
  margin: 0;
  font-family: var(--display-italic);
  font-style: italic;
  font-size: clamp(1rem, 1.4vw, 1.14rem);
  line-height: 1.3;
  color: var(--ink-soft);
  text-align: center;
  min-height: 1.35em;
}

#nd-table {
  flex: 1;
  width: 100%;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  align-items: center;
  pointer-events: none;
}

.nd-layout {
  --card-width: clamp(104px, 16vw, 200px);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  width: 100%;
  pointer-events: none;
}
.nd-felt {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 1;
  pointer-events: auto;
}
.nd-cut {
  position: relative;
  z-index: 6;
  pointer-events: auto;
  transition: opacity .34s cubic-bezier(.22, 1, .36, 1), transform .34s cubic-bezier(.22, 1, .36, 1), background .18s ease, border-color .18s ease, color .18s ease;
}

.nd-table[data-table-ready="false"] .nd-cut,
.nd-layout[data-ready="false"] .nd-cut {
  opacity: 0;
  transform: translateY(6px);
  pointer-events: none;
}

.nd-felt canvas {
  position: relative;
  z-index: 1;
  display: block;
  width: 100% !important;
  height: 100% !important;
  transition: opacity .36s cubic-bezier(.22, 1, .36, 1);
}

.nd-table[data-table-ready="false"] .nd-felt canvas,
.nd-layout[data-ready="false"] .nd-felt canvas {
  opacity: 0;
}

/* Living-Print Opening Plate (paints at 0ms in Paper & Night mode; crossfades cleanly out on first 3D WebGL frame) */
.nd-loader {
  position: absolute;
  inset: 0;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 18px;
  padding: 64px 20px 84px;
  pointer-events: none;
  opacity: 1;
  transition: opacity .32s cubic-bezier(.22, 1, .36, 1), transform .36s cubic-bezier(.22, 1, .36, 1);
}
.nd-table[data-table-ready="true"] .nd-loader {
  opacity: 0;
  transform: scale(0.985);
}
.nd-loader-plate {
  position: relative;
  width: clamp(118px, 19vw, 178px);
  aspect-ratio: 290 / 500;
  padding: 6px;
  border: 1px solid var(--rule);
  background: var(--surface, rgba(255, 252, 245, .32));
}
.nd-loader-plate img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  filter: var(--img-dim, none);
}
.nd-loader-corner {
  position: absolute;
  width: 9px;
  height: 9px;
  border-color: var(--vermilion);
  border-style: solid;
  opacity: .72;
}
.nd-loader-corner.tl { top: -1px; left: -1px; border-width: 1.5px 0 0 1.5px; }
.nd-loader-corner.tr { top: -1px; right: -1px; border-width: 1.5px 1.5px 0 0; }
.nd-loader-corner.bl { bottom: -1px; left: -1px; border-width: 0 0 1.5px 1.5px; }
.nd-loader-corner.br { bottom: -1px; right: -1px; border-width: 0 1.5px 1.5px 0; }

.nd-loader-rule {
  position: relative;
  width: clamp(118px, 19vw, 178px);
  height: 1px;
  background: var(--rule);
  overflow: hidden;
}
.nd-loader-rule span {
  position: absolute;
  inset: 0;
  width: 38%;
  background: var(--vermilion);
  animation: nd-ink-sweep 1.35s cubic-bezier(.45, 0, .55, 1) infinite;
}
@keyframes nd-ink-sweep {
  0% { transform: translateX(-110%); }
  100% { transform: translateX(300%); }
}
@media (prefers-reduced-motion: reduce) {
  .nd-loader-rule span {
    width: 100%;
    animation: none;
    opacity: .55;
  }
  .nd-loader,
  .nd-felt canvas,
  .nd-cut {
    transition: none;
  }
}

/* Projected 3D->2D Living-Print Ink Overlays:
   .nd-paper-ink sits UNDER the transparent WebGL canvas (z-index: 0) so the deal slot is ink printed on paper beneath 3D cards!
   .nd-ink-layer sits ABOVE (z-index: 3) for the near-edge cut-depth hairline. */
.nd-paper-ink,
.nd-ink-layer {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: visible;
  pointer-events: none;
}
.nd-paper-ink { z-index: 0; }
.nd-ink-layer { z-index: 3; }
.nd-viz-layer {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 4;
}
.nd-cut-line {
  stroke: var(--vermilion);
  stroke-width: 1.5;
  stroke-dasharray: 5 4;
  opacity: .72;
  transition: opacity .15s ease;
}
.nd-cut-line.is-active {
  stroke-dasharray: none;
  stroke-width: 2;
  opacity: .96;
}
.nd-cut-ticks {
  fill: none;
  stroke: var(--vermilion);
  stroke-width: 1.6;
  opacity: .88;
}
.nd-cut-depth {
  position: absolute;
  transform: translate(-100%, -50%);
  font-family: var(--display-italic);
  font-style: italic;
  font-size: .92rem;
  color: var(--vermilion);
  white-space: nowrap;
}
.nd-pile-slot {
  fill: none;
  stroke: var(--rule);
  stroke-width: 1.35;
  stroke-linejoin: round;
  opacity: .8;
  transition: stroke .18s ease, stroke-width .18s ease, opacity .18s ease;
}
.nd-pile-slot.is-hovered {
  stroke: var(--ink);
  stroke-width: 1.8;
  opacity: .95;
}
.nd-pile-slot.is-selected {
  stroke: var(--vermilion);
  stroke-width: 2.2;
  opacity: 1;
}
.nd-pile-mark {
  position: absolute;
  transform: translate(-50%, -50%);
  display: grid;
  place-items: center;
  border-radius: 50%;
  font-family: var(--display);
  line-height: 1;
  transition: transform .18s ease, background .18s ease, border-color .18s ease;
}
.nd-pile-mark.is-idle {
  width: 24px;
  height: 24px;
  border: 1px solid var(--rule);
  background: transparent;
}
.nd-pile-mark.is-hovered {
  width: 28px;
  height: 28px;
  border: 1.5px solid var(--ink);
  color: var(--ink);
  background: var(--paper);
  font-size: 1.1rem;
}
.nd-pile-mark.is-selected {
  width: 32px;
  height: 32px;
  background: var(--vermilion);
  color: var(--on-vermilion, #f7f1e3);
  font-size: 1.05rem;
}
.nd-ink-slot {
  fill: var(--surface, rgba(255, 252, 245, .32));
  stroke: var(--ink);
  stroke-width: 1.6;
  stroke-linejoin: round;
  stroke-dasharray: 1;
}
.nd-ink-slot.attending {
  stroke: var(--vermilion);
  stroke-width: 2.2;
  fill: transparent;
}
.nd-ink-slot.is-drawing {
  animation: nd-draw .78s ease-out both;
}
.nd-ink-path {
  stroke: var(--rule);
  stroke-width: 1.1;
  stroke-dasharray: 1;
  opacity: .72;
  animation: nd-draw .85s ease-out both;
}
.nd-slot-name {
  position: absolute;
  transform: translateX(-50%);
  font-family: var(--display);
  font-size: .92rem;
  letter-spacing: .07em;
  color: var(--vermilion);
  white-space: nowrap;
}
@keyframes nd-draw {
  from { stroke-dashoffset: 1; }
  to { stroke-dashoffset: 0; }
}

/* Fallback 2.5D CSS table styling (only active if WebGL fails to load) */
.nd-packets { position: absolute; inset: 0; }
.nd-packet, .nd-draw {
  position: absolute;
  width: var(--card-width);
  aspect-ratio: 1 / 1.69;
  top: 50%;
  left: 50%;
  translate: -50% -50%;
}
.nd-packet, .nd-back {
  border: 1px solid var(--rule);
  border-radius: 3px;
  background: url("/assets/nightdesk/card-back.webp") center / 100% 100% no-repeat var(--surface, #ece3d2);
}
.nd-packet {
  transition: left .5s cubic-bezier(.22, 1, .36, 1), top .4s ease, transform .4s ease;
}
.nd-packet:nth-child(1) { transform: translate(-2px, 4px) rotate(-2deg); }
.nd-packet:nth-child(2) { transform: translate(0px, 1px) rotate(1.2deg); }
.nd-packet:nth-child(3) { transform: translate(1px, -2px) rotate(-0.8deg); }
[data-phase="shuffling"] .nd-packet:nth-child(2) { animation: nd-riffle 1.35s ease-in-out infinite; }
[data-phase="shuffling"] .nd-packet:nth-child(3) { animation: nd-riffle-top 1.35s ease-in-out infinite; }
@keyframes nd-riffle {
  32% { transform: translate(-38%, 4%) rotate(-9deg); }
  66% { transform: translate(2%, 1%) rotate(2deg); }
}
@keyframes nd-riffle-top {
  30% { transform: translate(38%, -6%) rotate(9deg); }
  66% { transform: translate(2%, -1%) rotate(-1.5deg); }
}
[data-phase="cutting"] .nd-packet:nth-child(1) { animation: nd-pile-first .95s both; }
[data-phase="cutting"] .nd-packet:nth-child(2) { animation: nd-pile-middle .95s both; }
[data-phase="cutting"] .nd-packet:nth-child(3) { animation: nd-pile-last .95s both; }
@keyframes nd-pile-first {
  45% { left: 26%; top: 53%; transform: rotate(-6deg); }
  100% { left: 28%; top: 50%; transform: translate(-2px, 4px) rotate(-2deg); }
}
@keyframes nd-pile-middle {
  45% { left: 50%; top: 48%; transform: rotate(2deg); }
  72% { left: 40%; top: 38%; transform: rotate(4deg); }
  100% { left: 28%; top: 50%; transform: translate(0px, 1px) rotate(1deg); }
}
@keyframes nd-pile-last {
  48% { left: 74%; top: 52%; transform: rotate(6deg); }
  100% { left: 28%; top: 50%; transform: translate(1px, -2px) rotate(-0.8deg); }
}
:is([data-phase="dealing"], [data-phase="flipping"], [data-phase="locked"]) .nd-packet { left: 28%; }
.nd-draw { z-index: 2; perspective: 1100px; opacity: 0; pointer-events: none; }
[data-phase="dealing"] .nd-draw { opacity: 1; animation: nd-glide .68s cubic-bezier(.2, .78, .28, 1) both; }
@keyframes nd-glide {
  from { left: 28%; transform: translate(1px, -3px) rotate(-1deg); }
  to { left: 72%; transform: rotate(1.5deg); }
}
:is([data-phase="flipping"], [data-phase="locked"]) .nd-draw { opacity: 1; left: 72%; transform: rotate(1.5deg); }
.nd-turn { width: 100%; height: 100%; transform-style: preserve-3d; transition: transform .65s cubic-bezier(.22, .8, .3, 1); }
:is([data-phase="flipping"], [data-phase="locked"]) .nd-turn { transform: rotateY(180deg); }
.nd-back, .nd-front {
  position: absolute;
  inset: 0;
  border-radius: 3px;
  overflow: hidden;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
}
.nd-front { transform: rotateY(180deg); background: var(--surface, #f7f1e4); border: 1px solid var(--rule); }
.nd-front img { display: block; width: 100%; height: 100%; object-fit: cover; filter: var(--img-dim, none); }
.nd-front .nd-reversed { transform: rotate(180deg); }

/* Cybertantra House Press Primary CTA (.btn grammar — flat ink, sharp corners, vermilion hover) */
.nd-cut {
  min-height: 2.85rem;
  min-width: 11.5rem;
  padding: .62rem 1.55rem;
  border: 1px solid var(--ink);
  border-radius: 0;
  background: var(--ink);
  color: var(--paper);
  font-family: var(--display);
  font-weight: 400;
  font-size: 1.06rem;
  letter-spacing: .06em;
  line-height: 1.2;
  cursor: pointer;
  touch-action: manipulation;
  transition: background .16s ease, border-color .16s ease, color .16s ease;
}
.nd-cut:hover:enabled {
  background: var(--vermilion-fill, var(--vermilion));
  border-color: var(--vermilion-fill, var(--vermilion));
  color: var(--on-vermilion, #f7f1e3);
}
.nd-cut:focus-visible { outline: 2px solid var(--vermilion); outline-offset: 3px; }
.nd-cut:disabled { opacity: .5; cursor: wait; }

.nd-cut-hint {
  margin: 4px 0 0;
  min-height: 1.35em;
  font-family: var(--display-italic);
  font-style: italic;
  font-size: 1.02rem;
  color: var(--ink-soft);
  text-align: center;
}

/* Printed Card Caption & Cryptographic Receipt */
.nd-caption {
  position: relative;
  z-index: 6;
  text-align: center;
  margin-top: 6px;
  opacity: 0;
  transform: translateY(6px);
  transition: opacity 480ms ease 180ms, transform 480ms ease 180ms;
}
.nd-sheet.is-revealed .nd-caption:not([hidden]) {
  opacity: 1;
  transform: translateY(0);
}
#nd-card-label {
  margin: 0;
  font-family: var(--display);
  font-weight: 400;
  font-size: clamp(1.32rem, 2.2vw, 1.72rem);
  letter-spacing: .04em;
  color: var(--ink);
}
#nd-card-label em {
  margin-left: .42em;
  color: var(--vermilion);
  font-family: var(--display-italic);
  font-style: italic;
  font-size: .78em;
}
.nd-receipt {
  margin: .38rem 0 0;
  color: var(--ink-soft);
  font-family: var(--body);
  font-size: .95rem;
  letter-spacing: .03em;
  text-wrap: balance;
}
.nd-receipt strong {
  color: var(--vermilion);
  font-family: var(--display);
  font-weight: 400;
  letter-spacing: .06em;
  white-space: nowrap;
}

.nd-reset {
  position: relative;
  z-index: 6;
  display: inline-block;
  margin: 8px 0 0;
  border: 0;
  padding: .28em .45em;
  color: var(--ink-soft);
  background: transparent;
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 4px;
  font-family: var(--display-italic);
  font-style: italic;
  font-size: .96rem;
  cursor: pointer;
}
.nd-reset:hover { color: var(--vermilion); }

/* Act 4: Understated Gordo Reading Margin Sheet — opens smoothly ONLY after card flips */
.nd-desk {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-width: 0;
  gap: 24px;
  padding: 0;
  background: var(--surface, rgba(255, 252, 245, .38));
  border-left: 0 solid transparent;
  opacity: 0;
  visibility: hidden;
  overflow: hidden;
  pointer-events: none;
  transform: translateX(18px);
  transition:
    opacity 540ms ease 180ms,
    transform 620ms cubic-bezier(.22, 1, .36, 1) 140ms,
    padding 540ms cubic-bezier(.22, 1, .36, 1),
    visibility 0s linear 600ms;
}
.nd-sheet.is-revealed .nd-desk {
  padding: 0;
  min-height: 0;
  height: 100%;
  border-left: 1px solid var(--rule);
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transform: translateX(0);
  transition:
    opacity 540ms ease 200ms,
    transform 640ms cubic-bezier(.22, 1, .36, 1) 140ms,
    visibility 0s linear 0s;
}

/* Canonical UI SDK (@ui-sdk/react ScrollArea + Textarea) & AI Elements Living-Print Conversation */
.ct-gordo-conv {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  height: 100%;
  width: 100%;
}
.ct-conv-head {
  flex: none;
  display: flex;
  align-items: center;
  min-height: 44px;
  padding: 10px clamp(24px, 3vw, 44px) 8px;
  border-bottom: 1px solid var(--rule);
}
.ct-conv-kicker {
  font-family: var(--display);
  font-weight: 400;
  font-size: .88rem;
  letter-spacing: .1em;
  color: var(--ink-soft);
}
.ct-conv {
  position: relative;
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}
.ct-conv-viewport {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  padding: 20px clamp(24px, 3vw, 44px) 24px;
}
.ct-conv-content {
  width: min(100%, 30rem);
  margin-inline: auto;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}
.ct-conv-scrollbar {
  width: 8px;
  padding: 6px 2px;
  opacity: 0;
  transition: opacity 220ms ease;
}
.ct-conv-scrollbar[data-visible] {
  opacity: 1;
}
.ct-conv-thumb {
  width: 3px;
  margin-inline: auto;
  background: var(--rule);
  border-radius: 0;
  transition: background-color 140ms ease;
}
.ct-conv-thumb[data-dragging],
.ct-conv-scrollbar:hover .ct-conv-thumb {
  background: var(--ink-soft);
}
.ct-conv-scroll-btn {
  position: absolute;
  left: 50%;
  bottom: 12px;
  z-index: 8;
  transform: translate(-50%, 6px);
  opacity: 0;
  pointer-events: none;
  padding: 5px 12px;
  border: 1px solid var(--ink);
  border-radius: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--display);
  font-weight: 400;
  font-size: .86rem;
  letter-spacing: .07em;
  line-height: 1.1;
  cursor: pointer;
  transition: opacity 180ms ease, transform 180ms ease, background-color 140ms ease, color 140ms ease, border-color 140ms ease;
}
.ct-conv-scroll-btn[data-visible] {
  opacity: 1;
  pointer-events: auto;
  transform: translate(-50%, 0);
}
.ct-conv-scroll-btn:hover,
.ct-conv-scroll-btn:focus-visible {
  background: var(--ink);
  color: var(--paper);
  border-color: var(--ink);
  outline: 2px solid var(--vermilion);
  outline-offset: 2px;
}

.ct-msg {
  display: flex;
  flex-direction: column;
  gap: .32rem;
}
.ct-msg-author {
  font-family: var(--display);
  font-weight: 400;
  font-size: .82rem;
  letter-spacing: .09em;
  color: var(--ink-soft);
}
.ct-msg-content {
  font-family: var(--body);
  font-size: clamp(1.06rem, 1.3vw, 1.2rem);
  line-height: 1.56;
  color: var(--ink);
}
.ct-msg-content p {
  margin: 0 0 .82em;
}
.ct-msg-content p:last-child {
  margin-bottom: 0;
}
.ct-msg-closing em {
  color: var(--ink-soft);
}
.ct-msg-user {
  padding-left: 14px;
  border-left: 1px solid var(--vermilion);
}
.ct-msg-user .ct-msg-content {
  font-size: clamp(1rem, 1.2vw, 1.1rem);
  font-style: italic;
  color: var(--ink-soft);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.ct-gordo-dock {
  flex: none;
  padding: 8px clamp(24px, 3vw, 44px) 18px;
}
.ct-prompt-wrap {
  width: min(100%, 30rem);
  margin-inline: auto;
  display: grid;
}
.ct-prompt-form {
  display: flex;
  align-items: flex-end;
  gap: 12px;
  border-bottom: 1px solid var(--rule);
  padding: 0 0 5px;
  transition: border-color 150ms ease;
}
.ct-prompt-form:focus-within {
  border-bottom-color: var(--vermilion);
}
.ct-prompt-textarea {
  flex: 1;
  min-width: 0;
  min-height: 36px;
  max-height: 132px;
  resize: none;
  background: transparent;
  border: 0;
  padding: 6px 0 4px;
  font-family: var(--body);
  font-size: 1.06rem;
  line-height: 1.42;
  color: var(--ink);
  outline: none;
}
.ct-prompt-textarea::placeholder {
  color: var(--ink-soft);
  font-style: italic;
  opacity: .82;
}
.ct-prompt-submit {
  flex: none;
  background: transparent;
  border: 0;
  min-height: 36px;
  padding: 4px 0;
  color: var(--vermilion);
  font-family: var(--display);
  font-weight: 400;
  font-size: .98rem;
  letter-spacing: .06em;
  white-space: nowrap;
  cursor: pointer;
}
.ct-prompt-submit:disabled {
  opacity: .42;
  cursor: default;
}
.ct-prompt-submit:focus-visible {
  outline: 2px solid var(--vermilion);
  outline-offset: 3px;
}
.ct-prompt-status {
  margin: 0;
  font-family: var(--body);
  font-style: italic;
  font-size: .95rem;
  line-height: 1.42;
  color: var(--ink-soft);
}
.ct-prompt-status:not(:empty) {
  padding-top: 8px;
}
.ct-prompt-status.is-error {
  color: var(--vermilion);
}

.nd-reading, .nd-dock { width: min(100%, 30rem); margin-inline: auto; }
.nd-prose {
  font-family: var(--body);
  font-size: clamp(1.06rem, 1.3vw, 1.2rem);
  line-height: 1.56;
  color: var(--ink);
}
.nd-prose p { margin: 0 0 .82em; }
.nd-prose p:last-child { margin-bottom: 0; }
.nd-prose em { color: var(--ink-soft); }
.nd-cursor {
  display: inline-block;
  width: .14em;
  height: .84em;
  margin-left: .14em;
  background: var(--vermilion);
  vertical-align: -0.06em;
  animation: nd-blink .8s step-end infinite;
}
@keyframes nd-blink { 50% { opacity: 0; } }

/* Understated Gordo perched down right above the reply underline facing left */
.nd-dock { display: grid; }
.nd-gordo {
  display: block;
  justify-self: end;
  width: 84px;
  height: 84px;
  object-fit: contain;
  image-rendering: pixelated;
  margin: 0 -2px -10px 0;
  pointer-events: none;
  opacity: 0.96;
}
.nd-reply {
  display: flex;
  align-items: baseline;
  gap: 12px;
  border-bottom: 1px solid var(--rule);
  padding: 0 0 4px;
}
.nd-reply:focus-within { border-color: var(--vermilion); }
.nd-reply input, .nd-reply button {
  background: transparent;
  border: 0;
  font-family: var(--body);
  font-size: 1.06rem;
  min-height: 36px;
  padding: 0;
  outline: none;
}
.nd-reply input { flex: 1; min-width: 0; color: var(--ink); }
.nd-reply input::placeholder { color: var(--ink-soft); font-style: italic; opacity: .82; }
.nd-reply button {
  color: var(--vermilion);
  font-family: var(--display);
  font-size: .98rem;
  letter-spacing: .06em;
  white-space: nowrap;
  cursor: pointer;
}
.nd-reply button:disabled { opacity: .55; cursor: wait; }

.nd-echo, .nd-reply-status {
  margin: 0;
  font-family: var(--body);
  font-style: italic;
  font-size: .98rem;
  line-height: 1.44;
  color: var(--ink-soft);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.nd-echo { padding-left: 10px; border-left: 1px solid var(--vermilion); margin-bottom: 6px; }
.nd-reply-status:not(:empty) { padding-top: 8px; }

.nd-episodes, .nd-doors {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .6rem 1.5rem;
  font-family: var(--display);
  font-size: .96rem;
  letter-spacing: .05em;
}
.nd-episodes { margin-top: 14px; color: var(--ink-soft); }
.nd-episodes a, .nd-doors a {
  color: inherit;
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: .3em;
}
.nd-episodes a:hover, .nd-doors a:hover { color: var(--vermilion); }

.nd-doors {
  justify-content: center;
  min-height: 54px;
  padding: 13px 22px;
  background: var(--surface, rgba(255, 252, 245, .48));
  border-top: 1px solid var(--rule);
  color: var(--ink-soft);
  animation: nd-fade-up 460ms ease both;
}
@keyframes nd-fade-up {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

@media (max-width: 820px) {
  .nd-sheet,
  .nd-sheet.is-revealed {
    grid-template-columns: minmax(0, 1fr);
    height: auto;
    min-height: 100svh;
    overflow: visible;
  }
  .nd-sheet.is-revealed { min-height: auto; }
  .nd-table {
    padding: 46px 12px 22px;
    min-height: 100svh;
    transition: min-height 540ms cubic-bezier(.22, 1, .36, 1);
  }
  .nd-sheet.is-revealed .nd-table {
    min-height: clamp(460px, 58svh, 580px);
    padding: 42px 12px 18px;
  }
  .nd-desk {
    display: none;
    transform: translateY(14px);
  }
  .nd-sheet.is-revealed .nd-desk {
    display: flex;
    height: clamp(390px, 60svh, 540px);
    padding: 0;
    gap: 0;
    border-left: 0;
    border-top: 1px solid var(--rule);
    transform: translateY(0);
  }
  .ct-conv-head {
    min-height: 36px;
    padding: 8px 18px 6px;
  }
  .ct-conv-viewport {
    padding: 16px 18px 18px;
  }
  .ct-gordo-dock {
    padding: 6px 18px 16px;
  }
  .nd-gordo { width: 74px; height: 74px; margin-bottom: -8px; }
  .nd-doors { font-size: .88rem; padding: 12px 16px; }
  .nd-receipt { font-size: .86rem; }
}

/* Top-right live 78-card physical positioning & motion graphic (Living-Print Paper & Night tokens) */
.nd-deck-viz {
  position: absolute;
  top: calc(env(safe-area-inset-top) + 46px);
  right: max(16px, 2vw);
  z-index: 12;
  pointer-events: none;
  user-select: none;
}
.nd-sheet.is-revealed .nd-deck-viz {
  top: calc(env(safe-area-inset-top) + 14px);
}
.nd-deck-viz svg {
  display: block;
  width: clamp(134px, 11.5vw, 176px);
  height: auto;
  overflow: visible;
}
.nd-viz-label {
  font-family: var(--display);
  font-size: 9px;
  letter-spacing: .09em;
  fill: var(--ink-soft);
  font-variant-numeric: tabular-nums;
}
.nd-viz-label.is-active {
  fill: var(--vermilion);
}
.nd-viz-rule {
  stroke: var(--ink);
  stroke-opacity: .24;
  stroke-width: .75;
}
.nd-viz-bar {
  fill: var(--ink);
}
.nd-viz-bar.is-active,
.nd-viz-rev-tick,
.nd-viz-pip {
  fill: var(--vermilion);
}
@media (max-width: 820px) {
  .nd-deck-viz { top: calc(env(safe-area-inset-top) + 78px); right: 12px; }
  .nd-deck-viz svg { width: 98px; height: 80px; }
}
@media (prefers-reduced-motion: reduce) {
  .nightdesk *, .nightdesk *::before { animation-duration: 0s !important; transition-duration: 0s !important; }
}
