:root {
  color-scheme: dark;
  --bg: #0b0b0c;
  --panel: #141416;
  --card: #17171a;
  --line: #2a2a2a;
  --line-soft: #1f1f22;
  --ink: #f2f2f0;
  --ink-dim: #9a9a95;
  --ink-faint: #66665f;
  --accent: #eee;
  --ok: #8f8;
  --urgent: #f66;
  --gold: #b9975b;
}

* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
  margin: 0;
}

body {
  background: var(--bg);
  color: var(--ink);
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  overscroll-behavior: none;
  -webkit-font-smoothing: antialiased;
}

button,
input {
  font-family: inherit;
  color: inherit;
}

.btn {
  background: var(--accent);
  color: #000;
  font-weight: 700;
  padding: 12px;
  border-radius: 10px;
  border: none;
  cursor: pointer;
}

.btn:disabled {
  opacity: 0.5;
  cursor: default;
}

.btn-ghost {
  background: transparent;
  color: #ccc;
  font-weight: 700;
  padding: 12px;
  border-radius: 10px;
  border: 1px solid #444;
  cursor: pointer;
}

.btn-ghost:disabled {
  opacity: 0.5;
  cursor: default;
}

/* Only inside a .row (two buttons side by side) do buttons split the
   width evenly -- a standalone .btn must size to its content, not
   stretch to fill its flex-column parent's leftover main-axis space. */
.row > .btn,
.row > .btn-ghost {
  flex: 1;
}

.card {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 14px;
  background: var(--card);
}

.row {
  display: flex;
  gap: 8px;
}

.dim {
  color: var(--ink-faint);
}

.err {
  color: var(--urgent);
}

.ok {
  color: var(--ok);
}

.mono {
  font-family: monospace;
  font-size: 13px;
  color: #bbb;
}

.code-box {
  background: #101012;
  border-radius: 12px;
  padding: 14px;
  border: 1px solid #222;
  color: #bbb;
  font-family: monospace;
  font-size: 12px;
  line-height: 1.5;
  white-space: pre-wrap;
  word-break: break-all;
  max-height: 40vh;
  overflow-y: auto;
}

.input {
  width: 100%;
  background: transparent;
  border: 1px solid #333;
  border-radius: 10px;
  padding: 12px;
  font-size: 14px;
}

/* The whitepaper is prose, not code: proportional font, generous line
   height, and a monospace-free body so it reads as writing rather than
   as data entry. `resize: vertical` only -- horizontal resize on a
   full-width element is user-hostile, and none is the reason anyone
   would want to drag it. */
.whitepaper-editor {
  width: 100%;
  min-height: 320px;
  background: var(--card);
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 14px;
  font-family: inherit;
  font-size: 14px;
  line-height: 1.6;
  resize: vertical;
  outline: none;
}

.whitepaper-editor:focus {
  border-color: #444;
}

.whitepaper-editor::placeholder {
  color: var(--ink-faint);
}

/* Small uppercase badge for a sketchpad note's `kind` (intent,
   pattern, note). Visually distinct from `.chip` -- a `.chip` is a
   clickable control, a `.kind-badge` is read-only text. Using the same
   class for both would make a machine's note look tappable. */
.kind-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 4px;
  background: var(--line);
  color: var(--ink);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

.turnstile-wrap {
  min-height: 90px;
  border-radius: 10px;
  overflow: hidden;
  background: var(--bg);
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
}

.turnstile-error {
  color: var(--urgent);
  text-align: center;
  margin-top: 8px;
  font-size: 13px;
}

/* --- sheet (bottom modal) --- */

.sheet-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  z-index: 100;
}

.sheet-card {
  background: var(--panel);
  border-radius: 18px 18px 0 0;
  padding: 24px;
  width: 100%;
  max-width: 480px;
  animation: sheet-in 200ms ease-out;
}

@keyframes sheet-in {
  from {
    transform: translateY(40px);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

/* --- overview grid --- */

.overview-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 14px;
}

.plate-tile {
  text-align: left;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--card);
  padding: 18px;
  min-height: 132px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  transition: transform 120ms ease, border-color 120ms ease;
}

.plate-tile:active {
  transform: scale(0.97);
}

.plate-count {
  font-size: 32px;
  font-weight: 800;
  line-height: 1;
}

/* Native browser shared-element morph between the overview grid and the
   fullscreen plate panel -- no hand-rolled FLIP animation math. Each tile
   and its corresponding panel get the same view-transition-name assigned
   in Rust when a plate is opened/closed. */
.vt-plate-knocks {
  view-transition-name: plate-knocks;
}
.vt-plate-keys {
  view-transition-name: plate-keys;
}
.vt-plate-valhalla {
  view-transition-name: plate-valhalla;
}
.vt-plate-billboard {
  view-transition-name: plate-billboard;
}
.vt-plate-activity {
  view-transition-name: plate-activity;
}
.vt-plate-account {
  view-transition-name: plate-account;
}
.vt-plate-compute {
  view-transition-name: plate-compute;
}
.vt-plate-data {
  view-transition-name: plate-data;
}
.vt-plate-whitepaper {
  view-transition-name: plate-whitepaper;
}
.vt-plate-sketchpads {
  view-transition-name: plate-sketchpads;
}

/* --- plate panel (fullscreen) --- */

.plate-panel {
  position: absolute;
  inset: 0;
  background: var(--bg);
  display: flex;
  flex-direction: column;
  touch-action: pan-y;
}

.plate-panel-drag {
  transition: transform 220ms cubic-bezier(0.2, 0.8, 0.2, 1);
}

.plate-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 16px 24px 0;
  flex-shrink: 0;
}

.back-btn {
  background: transparent;
  border: 1px solid #333;
  color: #ccc;
  border-radius: 8px;
  width: 32px;
  height: 32px;
  cursor: pointer;
  font-size: 16px;
}

.plate-body {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 24px;
}

/* --- knock swipe cards --- */

.knock-stack {
  position: relative;
  flex: 1;
  min-height: 320px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.knock-card {
  position: absolute;
  width: min(360px, 88vw);
  user-select: none;
  touch-action: none;
}

.knock-card-inner {
  background: var(--card);
  border-radius: 18px;
  padding: 20px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.45);
  position: relative;
  overflow: hidden;
}

.knock-card.dragging {
  transition: none;
}

.knock-card.settling {
  transition: transform 220ms cubic-bezier(0.2, 0.8, 0.2, 1);
}

.knock-card.leaving {
  transition: transform 220ms ease-in, opacity 220ms ease-in;
  opacity: 0;
}

.badge-tag {
  position: absolute;
  top: 16px;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 1px;
  padding: 4px 10px;
  border-radius: 6px;
  border: 2px solid;
  pointer-events: none;
}

.badge-approve {
  right: 16px;
  color: var(--ok);
  border-color: var(--ok);
  transform: rotate(-8deg);
}

.badge-refuse {
  left: 16px;
  color: var(--urgent);
  border-color: var(--urgent);
  transform: rotate(8deg);
}

/* --- chips --- */

.chip {
  padding: 6px 12px;
  border-radius: 6px;
  border: 1px solid #333;
  background: transparent;
  color: var(--ink-faint);
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}

.chip.on {
  background: var(--accent);
  color: #000;
  border-color: var(--accent);
}

.frozen-banner {
  background: #a44;
  padding: 10px 16px;
  flex-shrink: 0;
}

::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}
::-webkit-scrollbar-thumb {
  background: var(--line);
  border-radius: 8px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
