@font-face { font-family: "Inter"; src: url("/a/f-inter.woff2") format("woff2"); font-weight: 100 900; font-display: swap; }
@font-face { font-family: "Caveat"; src: url("/a/f-caveat.woff2") format("woff2"); font-weight: 400 700; font-display: swap; }
@font-face { font-family: "Anton"; src: url("/a/f-anton.woff2") format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Courier Prime"; src: url("/a/f-courier.woff2") format("woff2"); font-weight: 400; font-display: swap; }

:root {
  --f-sans: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --f-hand: "Caveat", "Segoe Print", "Bradley Hand", cursive;
  --f-mono: "Courier Prime", "Courier New", monospace;
  --f-cond: "Anton", "Arial Narrow", Impact, sans-serif;
  --f-serif: Georgia, "Times New Roman", serif;
  --bg: #0e0e10;
  --accent: #2c8ee8;
  color-scheme: dark;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { height: 100%; margin: 0; overflow: hidden; background: var(--bg); overscroll-behavior: none; }
body { font: 16px/1.45 var(--f-sans); color: #fff; -webkit-text-size-adjust: 100%; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
button, input, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: inherit; }
:focus-visible { outline: 3px solid #fff; outline-offset: 3px; box-shadow: 0 0 0 6px rgba(0, 0, 0, .65); }

/* ---------- scene ---------- */
#backdrop { position: fixed; inset: -60px; background: var(--bg) center / cover no-repeat; filter: blur(30px) brightness(.72) saturate(1.1); transition: opacity .25s; }
#scene { position: fixed; inset: 0; overflow: hidden; transition: opacity .25s; }
body.swapping #scene, body.swapping #backdrop, body.swapping #title { opacity: 0; }
#stage { position: absolute; left: 0; top: 0; width: 1440px; height: 900px; transform-origin: 0 0; will-change: transform; }
#stage.glide { transition: transform .7s cubic-bezier(.2, .7, .2, 1); }
#art { position: absolute; inset: 0; width: 1440px; height: 900px; display: block; user-select: none; -webkit-user-drag: none; }
#stage > *, #note > * { position: absolute; }

#note { left: 0; top: 0; transform-origin: 0 0; transition: opacity .35s; }
#note.gone { visibility: hidden; }
#note.closed { opacity: 0; pointer-events: none; }
#note.arrive { animation: arrive .5s cubic-bezier(.2, .8, .2, 1); }
#note.nudge { animation: nudge .4s; }
@keyframes arrive { from { opacity: 0; translate: 0 -26px; } }
@keyframes nudge { 20% { translate: -9px 0; } 40% { translate: 8px 0; } 60% { translate: -5px 0; } 80% { translate: 3px 0; } }
#paper {
  inset: 0;
  background: linear-gradient(160deg, rgba(255, 255, 255, .16), rgba(255, 255, 255, 0) 40%, rgba(0, 0, 0, .07)), var(--note, #f2e27a);
  box-shadow: 0 10px 28px rgba(0, 0, 0, .28), 0 2px 5px rgba(0, 0, 0, .2);
}
#note.bare #paper { background: none; box-shadow: none; }
#note.flat #paper { background: var(--note); box-shadow: none; }
#note.curl-tr #paper { clip-path: polygon(0 0, 82% 0, 100% 13%, 100% 100%, 0 100%); }
#note.curl-br #paper { clip-path: polygon(0 0, 100% 0, 100% 80%, 86% 100%, 0 100%); }
#note.curl-bl #paper { clip-path: polygon(0 0, 100% 0, 100% 100%, 16% 100%, 0 82%); }
#note[class*="curl"] #paper { box-shadow: none; }
#write { display: flex; align-items: center; }
#write.top { align-items: flex-start; }
#problem {
  width: 100%; max-height: 100%; margin: 0; padding: 0; border: 0; background: none; resize: none; outline: none; overflow: hidden;
  color: var(--ink, #222); caret-color: var(--ink, #222); line-height: 1.16; display: block;
}
#problem::placeholder { color: var(--ink, #222); opacity: .85; }
#problem:focus::placeholder { opacity: .4; }
#note.carved #problem { text-shadow: 1px 2px 0 rgba(255, 240, 200, .55), -1px -1px 1px rgba(60, 40, 10, .35); }
#problem:focus-visible { outline: none; box-shadow: none; }
#note:focus-within #paper { outline: 2px solid rgba(255, 255, 255, .8); outline-offset: 5px; }

#go { left: 0; top: 0; transform-origin: 0 0; border: 0; padding: 0; margin: 0; display: flex; align-items: center; justify-content: center; white-space: nowrap; line-height: 1; transition: filter .15s, opacity .3s; }
#go:hover { filter: brightness(1.08); }
#go:active { filter: brightness(.92); }
#go.hit { background: none !important; color: transparent !important; box-shadow: none !important; border-radius: 16px; }
#go.hit:hover { background: rgba(255, 255, 255, .08) !important; }
#go[disabled] { opacity: .55; cursor: default; filter: none; }
#reply { border: 0; background: none; padding: 6px 10px; margin: 0; white-space: nowrap; line-height: 1.1; translate: -50% -50%; text-decoration: none; transition: opacity .3s; }
#reply:hover { text-decoration: underline; text-underline-offset: 4px; }
#reply.has { text-decoration: underline; text-underline-offset: 4px; }

#plane { border: 0; padding: 0; background: none; transition: opacity .3s; }
#plane img { width: 100%; height: 100%; display: block; filter: drop-shadow(0 14px 18px rgba(0, 0, 0, .28)); }
#plane:hover img { filter: drop-shadow(0 18px 24px rgba(0, 0, 0, .34)) brightness(1.03); }
#plane.away { opacity: 0; pointer-events: none; }

#fx { position: fixed; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 5; }

/* ---------- site name ---------- */
#title { position: fixed; margin: 0; z-index: 3; pointer-events: none; line-height: 1; white-space: nowrap; font-family: var(--f-sans); letter-spacing: -.02em; transition: opacity .25s; }
#title.center { left: 50%; translate: -50% -50%; }
#title.left { translate: 0 -50%; }
#title.baked { left: 50%; top: 26px; translate: -50% -50%; text-shadow: 0 2px 12px rgba(0, 0, 0, .7); }
#title.baked.insight { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
#title.shadow { text-shadow: 0 2px 18px rgba(0, 0, 0, .45), 0 1px 3px rgba(0, 0, 0, .35); }

/* ---------- bottom bar ---------- */
#hud { position: fixed; left: 0; right: 0; bottom: 0; z-index: 4; padding: 0 10px calc(10px + env(safe-area-inset-bottom)); display: grid; gap: 8px; justify-items: center; pointer-events: none; transition: opacity .3s, translate .3s; }
#hud > * { pointer-events: auto; }
body.typing #hud { opacity: 0; translate: 0 20px; pointer-events: none; }
body.typing #hud > * { pointer-events: none; }
#tools { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; font-size: 13px; position: relative; }
#tools > button, #tools > a, #crisis > summary {
  background: rgba(10, 10, 12, .55); color: #fff; border: 1px solid rgba(255, 255, 255, .22); border-radius: 999px; padding: 6px 12px; min-height: 32px;
  text-decoration: none; backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); display: inline-flex; align-items: center; list-style: none; cursor: pointer;
}
#tools > button:hover, #tools > a:hover, #crisis > summary:hover { background: rgba(10, 10, 12, .8); border-color: rgba(255, 255, 255, .5); }
#crisis > summary::-webkit-details-marker { display: none; }
#crisis > p { position: absolute; left: 50%; bottom: 42px; translate: -50% 0; width: min(92vw, 380px); margin: 0; padding: 14px 16px; border-radius: 14px; background: rgba(12, 12, 14, .94); border: 1px solid rgba(255, 255, 255, .25); font-size: 14px; }
#attachCount:not(:empty) { margin-left: 6px; padding: 1px 7px; border-radius: 999px; background: #fff; color: #111; font-weight: 700; font-size: 12px; }
#themes { display: flex; gap: 5px; max-width: 100%; overflow-x: auto; padding: 4px 4px 6px; scrollbar-width: none; scroll-snap-type: x proximity; }
#themes::-webkit-scrollbar { display: none; }
#themes button {
  flex: none; width: 26px; height: 26px; border-radius: 50%; padding: 0; font-size: 11px; font-weight: 600; font-variant-numeric: tabular-nums; scroll-snap-align: center;
  background: rgba(10, 10, 12, .5); color: #fff; border: 1px solid rgba(255, 255, 255, .4); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); transition: transform .15s, background .15s;
}
#themes button:hover { background: rgba(10, 10, 12, .85); transform: scale(1.12); }
#themes button[aria-pressed="true"] { background: #fff; color: #111; border-color: #fff; transform: scale(1.12); }
@media (pointer: coarse) { #themes button { width: 32px; height: 32px; font-size: 12px; } #themes { gap: 7px; } }
/* Wide screens: circles stack bottom-left and tools sit bottom-right, so the bottom centre of the art stays clear. */
@media (min-width: 900px) and (min-height: 560px) {
  #hud { display: block; padding: 0; }
  #themes { position: fixed; left: 10px; bottom: 10px; display: grid; grid-template-columns: repeat(8, 22px); gap: 4px; padding: 0; overflow: visible; max-width: none; }
  #themes button { width: 22px; height: 22px; font-size: 10px; }
  #tools { position: fixed; right: 10px; bottom: 10px; font-size: 12px; flex-direction: column; align-items: flex-end; gap: 5px; }
  #tools > button, #tools > a, #crisis > summary { min-height: 26px; padding: 3px 10px; }
  #crisis { display: flex; flex-direction: column; align-items: flex-end; }
  #crisis > p { left: auto; right: 0; translate: 0 0; bottom: auto; top: auto; position: fixed; right: 10px; bottom: 112px; }
}

#toast { position: fixed; left: 50%; top: 14px; translate: -50% 0; z-index: 9; margin: 0; max-width: min(92vw, 520px); padding: 10px 16px; border-radius: 12px; background: rgba(12, 12, 14, .93); border: 1px solid rgba(255, 255, 255, .25); font-size: 15px; font-weight: 600; text-align: center; opacity: 0; transition: opacity .25s; pointer-events: none; }
#toast.show { opacity: 1; }
#toast.err { border-color: #ff8f6b; }
#turnstile { position: fixed; left: 10px; bottom: 96px; z-index: 6; }

/* ---------- cards and the side sheet ---------- */
.card, #sheet { background: rgba(14, 14, 17, .93); color: #f3f1ec; border: 1px solid rgba(255, 255, 255, .18); backdrop-filter: blur(18px); -webkit-backdrop-filter: blur(18px); }
.card { position: fixed; left: 50%; top: 50%; translate: -50% -50%; z-index: 6; width: min(92vw, 470px); max-height: calc(100dvh - 130px); overflow: auto; padding: 24px; border-radius: 20px; box-shadow: 0 30px 80px rgba(0, 0, 0, .5); animation: rise .5s cubic-bezier(.2, .8, .2, 1); outline: none; }
@keyframes rise { from { opacity: 0; translate: -50% calc(-50% + 18px); } }
.card h2 { margin: 0 0 6px; font-size: 34px; letter-spacing: -.02em; }
.card p { margin: 0 0 12px; }
.small { font-size: 14px; color: #c9c6bf; }
.tiny { font-size: 12.5px; color: #a5a29b; margin: 12px 0 0 !important; }
.warn { color: #ffb38f; }
.row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.btn { background: transparent; color: #fff; border: 1.5px solid rgba(255, 255, 255, .35); border-radius: 999px; padding: 8px 16px; min-height: 42px; font-weight: 600; text-decoration: none; display: inline-flex; align-items: center; gap: 8px; }
.btn:hover { border-color: #fff; }
.btn.solid { background: #fff; color: #111; border-color: #fff; }
.btn.small { min-height: 34px; padding: 4px 12px; font-size: 13px; }
.btn.rec { border-color: #ff6b57; color: #ff8f7e; }
.dot { width: 10px; height: 10px; border-radius: 50%; background: #ff5a44; }
.rec .dot { animation: pulse 1s infinite; }
@keyframes pulse { 50% { opacity: .25; } }
.linkbox { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 0 0 12px; padding: 8px 10px; border: 1.5px dashed rgba(255, 255, 255, .3); border-radius: 12px; }
.linkbox code { flex: 1; min-width: 11em; overflow-wrap: anywhere; font: 14px ui-monospace, Menlo, Consolas, monospace; }

#scrim { position: fixed; inset: 0; z-index: 7; background: rgba(0, 0, 0, .45); }
#sheet { position: fixed; z-index: 8; top: 0; right: 0; bottom: 0; width: min(100vw, 430px); overflow-y: auto; padding: 18px 20px calc(24px + env(safe-area-inset-bottom)); border-width: 0 0 0 1px; animation: slide .35s cubic-bezier(.2, .8, .2, 1); }
@keyframes slide { from { translate: 40px 0; opacity: 0; } }
@media (max-width: 560px) {
  #sheet { top: auto; left: 0; width: 100%; max-height: 88dvh; border-width: 1px 0 0; border-radius: 20px 20px 0 0; animation-name: slideup; }
  @keyframes slideup { from { translate: 0 40px; opacity: 0; } }
}
.sheet-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; position: sticky; top: -18px; margin: -18px -20px 6px; padding: 14px 20px; background: rgba(14, 14, 17, .96); z-index: 1; }
#sheet h2 { margin: 0; font-size: 20px; }
#sheet h3 { margin: 18px 0 4px; font-size: 16px; }
#sheet section { padding-bottom: 14px; border-bottom: 1px solid rgba(255, 255, 255, .13); }
#sheet p { margin: 0 0 10px; }
.grid { display: grid; gap: 10px; margin: 10px 0; }
.field { display: block; border: 0; padding: 0; margin: 0 0 10px; min-width: 0; }
.field > span, .field > legend { display: block; font-size: 13px; font-weight: 600; margin: 0 0 4px; padding: 0; }
.field em { font-style: normal; font-weight: 400; color: #a5a29b; }
.field input[type="text"], .field input[type="email"], .field input[type="tel"] { width: 100%; background: rgba(255, 255, 255, .07); border: 1.5px solid rgba(255, 255, 255, .22); border-radius: 10px; padding: 10px 12px; font-size: 16px; }
.field input:focus { border-color: #fff; outline: none; }
.choices { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 15px; }
.choices label, .check { display: flex; gap: 8px; align-items: flex-start; }
.check { margin: 0 0 10px; font-size: 15px; }
.check input, .choices input { width: 19px; height: 19px; margin: 2px 0 0; flex: none; accent-color: #fff; }
.trap { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
#files { list-style: none; margin: 12px 0 0; padding: 0; display: grid; gap: 8px; }
#files li { background: rgba(255, 255, 255, .06); border: 1px solid rgba(255, 255, 255, .16); border-radius: 12px; padding: 8px 10px; display: grid; gap: 6px; }
#files .line { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
#files .name { overflow-wrap: anywhere; min-width: 0; font-size: 14px; }
#files .meta { font-size: 12.5px; color: #a5a29b; white-space: nowrap; }
#files audio { width: 100%; height: 36px; }
body.drop::after { content: "Drop to attach"; position: fixed; inset: 12px; z-index: 20; display: grid; place-items: center; font-size: 28px; font-weight: 700; border: 4px dashed #fff; border-radius: 22px; background: rgba(0, 0, 0, .55); }

@media (prefers-reduced-motion: reduce) {
  #stage.glide { transition: none; }
  .card, #sheet, #note.arrive, #note.nudge { animation: none; }
  .rec .dot { animation: none; }
}
