:root {
  --bg: #0d0c0b;
  --panel: #171513;
  --line: #2c2823;
  --text: #ebe5da;
  --dim: #8d867a;
  --bar: #ebe5da;       /* redaction bars and primary buttons */
  --mine: #231f1b;
  --theirs: #1a1a1f;
  --danger: #d46a5e;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --serif: Georgia, "Iowan Old Style", "Palatino Linotype", serif;
}
* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  background: var(--bg); color: var(--text); font-family: var(--sans);
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
}
#app { height: 100%; max-width: 640px; margin: 0 auto; }
.hidden { display: none !important; }
.screen { min-height: 100%; padding: 28px 20px; display: flex; flex-direction: column; gap: 18px; justify-content: center; }
#screen-chat { padding: 0; justify-content: flex-start; height: 100%; gap: 0; }

h1 { font-family: var(--serif); font-weight: 400; font-size: clamp(44px, 12vw, 72px); letter-spacing: -0.02em; margin: 0; line-height: 1; }
.lede { font-family: var(--serif); font-size: 19px; line-height: 1.5; color: var(--dim); margin: 0 0 8px; max-width: 34ch; }
fieldset { border: 0; padding: 0; margin: 0; }
legend { color: var(--dim); font-size: 14px; padding: 0; margin-bottom: 8px; }
.choices { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.choices button {
  background: transparent; color: var(--text); border: 1px solid var(--line); border-radius: 4px;
  padding: 14px 8px; font: inherit; cursor: pointer;
}
.choices button[aria-pressed="true"] { background: var(--bar); color: var(--bg); border-color: var(--bar); }
.age { display: flex; gap: 10px; align-items: center; color: var(--dim); font-size: 15px; }
.age input { width: 18px; height: 18px; accent-color: var(--bar); }

button { font-family: inherit; }
button:focus-visible, input:focus-visible { outline: 2px solid var(--text); outline-offset: 2px; }
.primary { background: var(--bar); color: var(--bg); border: 0; border-radius: 4px; padding: 15px 18px; font-size: 16px; font-weight: 600; cursor: pointer; }
.primary:disabled { opacity: .35; cursor: not-allowed; }
.primary.small { padding: 12px 16px; }
.ghost { background: transparent; color: var(--dim); border: 1px solid var(--line); border-radius: 4px; padding: 10px 14px; font-size: 14px; cursor: pointer; }
.ghost.strong { color: var(--text); border-color: var(--dim); }
.error { color: var(--danger); min-height: 1.2em; margin: 0; font-size: 14px; }
.fine { color: var(--dim); font-size: 13px; line-height: 1.5; margin: 0; }
.wait-text { font-family: var(--serif); font-size: 24px; line-height: 1.4; margin: 0; max-width: 24ch; }

.bar { display: flex; align-items: center; justify-content: space-between; padding: 12px 16px; border-bottom: 1px solid var(--line); background: var(--panel); }
.status { font-size: 14px; color: var(--dim); }
.bar-actions { display: flex; gap: 8px; }

.log { flex: 1; overflow-y: auto; padding: 18px 16px; display: flex; flex-direction: column; gap: 10px; }
.msg { max-width: 82%; padding: 10px 14px; border-radius: 4px; font-family: var(--serif); font-size: 17px; line-height: 1.45; overflow-wrap: anywhere; white-space: pre-wrap; }
.msg.mine { align-self: flex-end; background: var(--mine); border: 1px solid var(--line); }
.msg.theirs { align-self: flex-start; background: var(--theirs); border: 1px solid #2a2a33; }
.msg.system { align-self: center; max-width: 100%; background: none; color: var(--dim); font-family: var(--sans); font-size: 13px; text-align: center; }
/* the signature element: redactions render as solid bars */
.redacted { display: inline-block; background: var(--bar); color: transparent; border-radius: 1px; user-select: none; letter-spacing: 0; line-height: .9; vertical-align: -1px; }

.photo { align-self: flex-start; }
.photo.mine { align-self: flex-end; }
.photo-btn { background: var(--theirs); color: var(--text); border: 1px dashed var(--dim); border-radius: 4px; padding: 18px 20px; cursor: pointer; font-size: 15px; }
.photo-img { display: block; max-width: min(300px, 70vw); border-radius: 4px; border: 1px solid var(--line); pointer-events: none; user-select: none; -webkit-user-drag: none; }
.photo-note { color: var(--dim); font-size: 13px; margin-top: 4px; }

.typing { color: var(--dim); font-size: 13px; padding: 0 16px 6px; }
.composer { display: flex; gap: 8px; padding: 12px 16px; border-top: 1px solid var(--line); background: var(--panel); }
.composer input { flex: 1; min-width: 0; background: var(--bg); color: var(--text); border: 1px solid var(--line); border-radius: 4px; padding: 12px; font-size: 16px; font-family: var(--serif); }
.icon { background: transparent; color: var(--text); border: 1px solid var(--line); border-radius: 4px; padding: 0 12px; cursor: pointer; font-size: 14px; }

.modal { position: fixed; inset: 0; background: rgba(0,0,0,.85); display: flex; align-items: center; justify-content: center; padding: 16px; z-index: 10; }
.modal-box { background: var(--panel); border: 1px solid var(--line); border-radius: 6px; padding: 14px; width: min(440px, 100%); display: flex; flex-direction: column; gap: 12px; }
.modal video { width: 100%; border-radius: 4px; background: #000; transform: scaleX(-1); }
.modal-actions { display: flex; justify-content: space-between; gap: 8px; }

@media (prefers-reduced-motion: no-preference) {
  .msg { animation: arrive .18s ease-out; }
  @keyframes arrive { from { opacity: 0; } to { opacity: 1; } }
}
.blurred { filter: blur(26px); }

.homelink { color: var(--dim); font-size: 14px; text-decoration: none; align-self: flex-start; }
.homelink:hover, .fine a:hover { color: var(--text); }
.fine a { color: var(--text); }
.linkbtn { text-decoration: none; display: inline-flex; align-items: center; }

.notelink { color: var(--text); }

.hint { margin-top: 8px; }
