:root {
  --desk: #12182c;
  --ink: #1a140c;
  --paper: #f3e6c8;
  --rule: #cbb892;
  --seal: #c9922a;
  --lamp: #3c8a84;
  --moon: #d7deea;
  --off: #8a7f6a;
  --display: "Iowan Old Style", Palatino, "Palatino Linotype", "Times New Roman", serif;
  --ui: "Avenir Next", "Segoe UI", system-ui, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; background: var(--desk); color: var(--moon); font-family: var(--ui); }
body { padding: env(safe-area-inset-top) 0 env(safe-area-inset-bottom); }
.desk { max-width: 720px; margin: 0 auto; min-height: 100dvh; display: flex; flex-direction: column; }
.mast { display: grid; grid-template-columns: auto 1fr auto; gap: 12px; align-items: center; padding: 18px 18px 8px; }
.eyebrow { margin: 0; letter-spacing: 0.18em; text-transform: uppercase; font-size: 10px; color: #9aa6c2; }
h1 { margin: 2px 0 0; font-family: var(--display); font-weight: 600; font-size: 28px; color: var(--paper); }
.status { margin: 0; font-size: 12px; color: var(--seal); }
.orbit {
  width: 42px; height: 42px; border: 1px solid #4a5678; border-radius: 50%;
  position: relative;
}
.orbit-dot {
  position: absolute; width: 7px; height: 7px; border-radius: 50%; background: var(--seal);
  top: -4px; left: 50%; margin-left: -3.5px;
  transform-origin: 3.5px 25px;
  animation: sweep 12s linear infinite;
}
@keyframes sweep { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .orbit-dot { animation: none; } }
.letter {
  flex: 1; margin: 8px 14px 88px; background: var(--paper); color: var(--ink);
  border-radius: 4px 18px 8px 8px; padding: 18px 16px 24px;
  box-shadow: 0 18px 40px rgba(0,0,0,.35);
  min-height: 52vh;
}
.letter h2 { font-family: var(--display); font-size: 22px; margin: 0 0 12px; }
.letter p { margin: 0 0 10px; line-height: 1.45; }
.row { display: flex; justify-content: space-between; gap: 12px; padding: 10px 0; border-top: 1px solid var(--rule); }
.card {
  border: 1px solid var(--rule); padding: 12px; margin: 0 0 10px; background: #fff8e8;
}
.card h3 { margin: 0 0 6px; font-size: 16px; font-family: var(--display); }
.muted { color: #5c5346; font-size: 13px; }
.seal, button.primary {
  background: var(--seal); color: #1a140c; border: 0; padding: 8px 12px; font: 600 13px var(--ui);
  cursor: pointer;
}
button.ghost { background: transparent; border: 1px solid var(--rule); color: var(--ink); padding: 8px 12px; cursor: pointer; }
.toggle { display: flex; align-items: center; gap: 8px; }
input, select, textarea {
  width: 100%; padding: 8px; border: 1px solid var(--rule); background: #fffaf0; font: 14px var(--ui); color: var(--ink);
}
label { display: block; font-size: 12px; margin: 10px 0 4px; color: #5c5346; }
.dock {
  position: fixed; left: 0; right: 0; bottom: 0; display: grid; grid-template-columns: repeat(5, 1fr);
  background: #0e1324; border-top: 1px solid #2a3350; padding: 8px 6px calc(8px + env(safe-area-inset-bottom));
}
.dock button {
  background: none; border: 0; color: #8b96b3; font: 600 11px var(--ui); padding: 8px 0; cursor: pointer;
}
.dock button.on { color: var(--seal); }
.err { color: #8b2e2e; }
.ok { color: var(--lamp); }
