/* Twohere in a browser, in the house style (Ricordo House Style, StudioKit): Night by default, Paper when the
   device is light; the person's look as the accent; Bricolage Grotesque and IBM Plex Mono. */

@font-face { font-family: Bricolage; src: url(/app/fonts/BricolageGrotesque-Regular.ttf); font-weight: 400; font-display: swap; }
@font-face { font-family: Bricolage; src: url(/app/fonts/BricolageGrotesque-SemiBold.ttf); font-weight: 600; font-display: swap; }
@font-face { font-family: Bricolage; src: url(/app/fonts/BricolageGrotesque-ExtraBold.ttf); font-weight: 800; font-display: swap; }
@font-face { font-family: Plex; src: url(/app/fonts/IBMPlexMono-Medium.ttf); font-weight: 500; font-display: swap; }

:root {
  --bg: #121314; --surface: #1c1e20; --surface2: #24272a; --line: #2a2d30; --line-strong: #3a3e42;
  --text: #eeebe5; --soft: #d8d4cc; --muted: #a6a29a; --danger: #e5665b;
  --accent: #3b82c4; --accent-light: #6aa1d4; --accent-deep: #2a5c8a; --accent-fill: #377ab8; --on-accent: #ffffff;
  --accent-text: var(--accent-light);
  color-scheme: dark;
}
@media (prefers-color-scheme: light) {
  :root {
    --bg: #f5f1e8; --surface: #fbf9f4; --surface2: #efe9dd; --line: #dcd3c2; --line-strong: #c2b69f;
    --text: #1b1915; --soft: #4a443b; --muted: #6e665a; --danger: #b8382d;
    --accent-text: var(--accent-deep);
    color-scheme: light;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font: 400 16px/1.45 Bricolage, system-ui, -apple-system, sans-serif; min-height: 100vh; }
body.locked { overflow: hidden; }
button { font: inherit; color: inherit; cursor: pointer; }
button:disabled { opacity: .45; cursor: default; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.hidden { display: none; }

.page { max-width: 560px; margin: 0 auto; padding: 16px 16px calc(40px + env(safe-area-inset-bottom)); display: flex; flex-direction: column; gap: 22px; }
.page.narrow { max-width: 460px; padding-top: 32px; }
.page > * { margin: 0; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.row { display: flex; align-items: center; gap: 12px; }
.row.between { justify-content: space-between; }
.row.wrap { flex-wrap: wrap; }
.center { text-align: center; }
.right { text-align: right; }

.eyebrow { font: 500 12px/1.3 Plex, ui-monospace, Menlo, monospace; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
.eyebrow.accent { color: var(--accent-text); }
.eyebrow.small { font-size: 10px; }
.eyebrow.section { margin-bottom: 10px; }
.display { font-family: Bricolage, system-ui, sans-serif; font-weight: 800; font-size: 34px; line-height: 1.08; letter-spacing: -.01em; margin: 0; overflow-wrap: anywhere; }
.display.xl { font-size: 40px; }
.display.s { font-size: 22px; line-height: 1.15; }
h2.display { font-size: 26px; }
p { margin: 0; }
.soft { color: var(--soft); }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.error { color: var(--danger); min-height: 1em; }

.topbar { display: flex; align-items: center; justify-content: space-between; min-height: 48px; }
.round { width: 44px; height: 44px; border-radius: 50%; border: 1px solid var(--line); background: var(--surface); font-size: 18px; display: inline-flex; align-items: center; justify-content: center; flex: none; }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: 22px; padding: 18px; display: flex; flex-direction: column; gap: 14px; }
.soft-card { background: color-mix(in srgb, var(--accent) 14%, var(--surface)); border-color: color-mix(in srgb, var(--accent) 30%, var(--line)); }

.btn { display: flex; align-items: center; justify-content: center; gap: 10px; min-height: 52px; padding: 12px 20px; border-radius: 999px; border: 1px solid transparent; font-weight: 600; font-size: 17px; text-decoration: none; text-align: center; transition: transform .12s ease; }
.btn:active:not(:disabled) { transform: scale(.98); }
.btn.primary { background: var(--accent-fill); color: var(--on-accent); }
.btn.secondary { background: var(--surface); color: var(--text); border-color: var(--line); }
.btn.danger { background: var(--surface); color: var(--danger); border-color: var(--line); }
.btn.small { min-height: 40px; font-size: 15px; padding: 8px 16px; }
.btn.tap { min-height: 64px; font-size: 19px; }
.btn.tap .heart { font-size: 22px; }
.btn.primary .heart { color: var(--on-accent); }
.btn.sent { animation: pop .5s ease; }
@keyframes pop { 40% { transform: scale(1.04); } }

.field { width: 100%; min-height: 52px; padding: 13px 16px; border-radius: 16px; border: 1.5px solid var(--line-strong); background: var(--surface); color: var(--text); font: inherit; font-size: 17px; }
.field:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 22%, transparent); }
textarea.field { resize: none; line-height: 1.4; }
.field.code { font: 500 24px/1.2 Plex, ui-monospace, monospace; letter-spacing: .14em; text-align: center; text-transform: uppercase; }

.critter { border-radius: 50%; overflow: hidden; display: flex; align-items: flex-end; justify-content: center; flex: none; border: 4px solid var(--bg); }
.critter img { width: 100%; height: 100%; object-fit: cover; }
.critter.s { width: 48px; height: 48px; border-width: 2px; }
.critter.m { width: 72px; height: 72px; }
.critter.l { width: 112px; height: 112px; }
.critter.xl { width: 128px; height: 128px; }
.critter.empty { border: 3px dashed var(--line-strong); align-items: center; color: var(--muted); font: 800 40px Bricolage, sans-serif; }

.hero-block { display: flex; flex-direction: column; gap: 8px; }
.hero { display: flex; align-items: flex-end; justify-content: center; position: relative; padding: 18px 0 6px; }
.hero .critter + .heart + .critter { margin-left: -18px; }
.hero > .critter:first-child { transform: rotate(-4deg); z-index: 1; }
.hero > .critter:last-child, .hero > div:last-child .critter { transform: rotate(4deg); }
.heart { color: var(--accent); }
.hero .heart { position: absolute; top: 0; left: 50%; transform: translateX(-50%); width: 40px; height: 40px; border-radius: 50%; background: var(--bg); display: flex; align-items: center; justify-content: center; font-size: 22px; z-index: 2; }
.heart.big { font-size: 64px; line-height: 1; }

.mood-pill, .pill { align-self: flex-start; display: inline-flex; gap: 6px; align-items: center; padding: 4px 12px; border-radius: 15px; font-weight: 600; font-size: 14px; background: color-mix(in srgb, var(--accent) 18%, transparent); border: 1px solid color-mix(in srgb, var(--accent) 45%, transparent); }

.chips { display: flex; gap: 8px; }
.chips.scroll { overflow-x: auto; margin: 0 -18px; padding: 2px 18px; scrollbar-width: none; }
.chips.scroll::-webkit-scrollbar { display: none; }
.chip { display: inline-flex; align-items: center; gap: 6px; min-height: 40px; padding: 0 14px; border-radius: 999px; border: 1px solid var(--line); background: color-mix(in srgb, var(--accent) 12%, transparent); font-weight: 600; font-size: 15px; white-space: nowrap; flex: none; }
.chip.on { background: var(--accent-fill); color: var(--on-accent); border-color: var(--accent-fill); }

.looks { display: grid; grid-template-columns: repeat(6, 1fr); gap: 6px; }
.look { background: none; border: 0; padding: 4px 0; display: flex; flex-direction: column; align-items: center; gap: 4px; font-size: 11px; font-weight: 600; color: var(--muted); }
.look .critter { border-color: transparent; outline: 2px solid transparent; outline-offset: 2px; }
.look.on { color: var(--text); }
.look.on .critter { outline-color: var(--text); }

.picture-box { display: flex; justify-content: center; }
.video-box { flex-direction: column; align-items: center; gap: 8px; }
.video-still { position: relative; display: block; width: 100%; max-width: 520px; min-height: 120px; padding: 0; border: 0; border-radius: 18px; background: var(--surface2, #24272a); color: inherit; }
.video-still .picture { width: 100%; }
.video-play { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); width: 56px; height: 56px; background: rgba(0, 0, 0, 0.55); color: #eeebe5; }
video.picture { background: #000; object-fit: cover; }
.picture { width: 100%; max-width: 520px; height: auto; aspect-ratio: 1; border-radius: 18px; display: block; }
.note-text { font-size: 22px; line-height: 1.35; font-weight: 600; white-space: pre-wrap; overflow-wrap: anywhere; }
.caption { margin-top: 10px; font-weight: 600; }
.tap-big { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 12px 0; }
.bubble { background: color-mix(in srgb, var(--accent) 16%, var(--surface)); border-radius: 22px 22px 22px 6px; padding: 16px 18px; display: flex; flex-direction: column; gap: 8px; font-size: 19px; line-height: 1.4; white-space: pre-wrap; overflow-wrap: anywhere; }
.letter { display: flex; gap: 14px; align-items: center; }
.envelope { width: 64px; height: 64px; border-radius: 16px; background: color-mix(in srgb, var(--accent) 18%, var(--surface)); display: flex; align-items: center; justify-content: center; font-size: 30px; flex: none; }
.letter-text { font-size: 19px; line-height: 1.5; white-space: pre-wrap; overflow-wrap: anywhere; }

/* Good news (a burst of the accent at two corners), a thank-you, warm replies and reactions. */
.tag { align-self: flex-start; display: inline-flex; align-items: center; gap: 6px; padding: 5px 12px; border-radius: 999px; font: 500 12px/1.3 Plex, ui-monospace, Menlo, monospace; letter-spacing: .1em; text-transform: uppercase; background: color-mix(in srgb, var(--accent) 16%, transparent); color: var(--accent-text); }
.tag.good { background: var(--accent-fill); color: var(--on-accent); }
.tag-icon { font-size: 15px; letter-spacing: 0; }
.card.good-news {
  border-color: color-mix(in srgb, var(--accent) 50%, var(--line));
  background:
    radial-gradient(circle at calc(100% - 10px) 10px, var(--accent) 0 3.5px, transparent 4px),
    radial-gradient(circle at calc(100% - 28px) 6px, var(--accent-light) 0 2px, transparent 2.5px),
    radial-gradient(circle at calc(100% - 7px) 56px, var(--accent-light) 0 2.5px, transparent 3px),
    radial-gradient(circle at 9px calc(100% - 10px), var(--accent) 0 3px, transparent 3.5px),
    radial-gradient(circle at 26px calc(100% - 6px), var(--accent-light) 0 2px, transparent 2.5px),
    radial-gradient(circle at 6px calc(100% - 28px), var(--accent-light) 0 2px, transparent 2.5px),
    color-mix(in srgb, var(--accent) 14%, var(--surface));
}
.cheers { display: flex; flex-wrap: wrap; gap: 8px; }
.said { font-weight: 600; color: var(--accent-text); }
.reactions { display: flex; gap: 8px; }
.reaction { min-width: 56px; min-height: 44px; padding: 0 14px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface2); font-size: 22px; line-height: 1; display: inline-flex; align-items: center; justify-content: center; transition: transform .12s ease; }
.reaction:active { transform: scale(.92); }
.reaction.on { background: color-mix(in srgb, var(--accent) 26%, var(--surface)); border-color: var(--accent); box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent) 35%, transparent); }
.line-badge { margin-left: auto; font-size: 18px; flex: none; }

/* A voice note: play, its waveform lighting up as it plays, and its length. */
.voice { display: flex; align-items: center; gap: 12px; }
.play { width: 48px; height: 48px; border-radius: 50%; border: 0; background: var(--accent-fill); color: var(--on-accent); display: inline-flex; align-items: center; justify-content: center; flex: none; }
.play-icon { width: 0; height: 0; border-style: solid; border-width: 9px 0 9px 15px; border-color: transparent transparent transparent currentColor; margin-left: 4px; }
.voice.playing .play-icon { width: 14px; height: 18px; border-width: 0 5px; border-color: currentColor; margin-left: 0; }
.wave { flex: 1; min-width: 0; height: 40px; display: flex; align-items: center; gap: 2px; cursor: pointer; }
.wave span { flex: 1; min-width: 1px; border-radius: 2px; background: var(--line-strong); }
.wave span.on { background: var(--accent); }
.voice-time { font: 500 13px/1 Plex, ui-monospace, Menlo, monospace; color: var(--muted); min-width: 3em; text-align: right; font-variant-numeric: tabular-nums; }
@media (max-width: 380px) { .wave { gap: 1px; } }

.tiles { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.tile { background: var(--surface); border: 1px solid var(--line); border-radius: 20px; padding: 14px; display: flex; flex-direction: column; align-items: flex-start; gap: 4px; text-align: left; min-height: 116px; }
.tile-icon { font-size: 22px; width: 40px; height: 40px; border-radius: 12px; background: color-mix(in srgb, var(--accent) 16%, transparent); display: flex; align-items: center; justify-content: center; margin-bottom: 6px; }
.tile-title { font-weight: 600; font-size: 17px; }
.infos { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; }
.info { background: var(--surface); border: 1px solid var(--line); border-radius: 20px; padding: 14px; display: flex; flex-direction: column; gap: 2px; }

.list { padding: 6px 0; gap: 0; }
.line { background: none; border: 0; border-bottom: 1px solid var(--line); display: flex; align-items: center; gap: 12px; padding: 10px 18px; text-align: left; width: 100%; }
.line:last-child { border-bottom: 0; }
.line-icon { width: 36px; height: 36px; border-radius: 50%; display: flex; align-items: center; justify-content: center; background: var(--surface2); color: var(--accent-text); flex: none; }
.line-icon.mine { background: color-mix(in srgb, var(--accent) 22%, transparent); }
.line-text { display: flex; flex-direction: column; min-width: 0; }
.line-title { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.scene { width: 220px; max-width: 70%; align-self: center; }
.photo-preview:empty { display: none; }
.pad { width: 100%; aspect-ratio: 1; border-radius: 18px; touch-action: none; display: block; }
.pens { display: flex; gap: 10px; flex-wrap: wrap; }
.pen { width: 40px; height: 40px; border-radius: 50%; border: 3px solid var(--surface); outline: 2px solid transparent; }
.pen.on { outline-color: var(--text); }

.backdrop { position: fixed; inset: 0; background: rgba(0, 0, 0, .55); z-index: 10; animation: fade .18s ease; }
.sheet { position: fixed; z-index: 11; left: 0; right: 0; bottom: 0; max-height: 94vh; overflow-y: auto; background: var(--bg); border-radius: 26px 26px 0 0; padding: 18px 16px calc(24px + env(safe-area-inset-bottom)); display: flex; flex-direction: column; gap: 16px; animation: up .22s ease; max-width: 560px; margin: 0 auto; border: 1px solid var(--line); }
.sheet.out, .backdrop:has(+ .sheet.out) { opacity: 0; transition: opacity .18s; }
.sheet-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
@keyframes up { from { transform: translateY(40px); opacity: 0; } }
@keyframes fade { from { opacity: 0; } }
@media (min-width: 640px) { .sheet { bottom: 4vh; border-radius: 26px; } }

.toast { position: fixed; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom)); transform: translateX(-50%); background: var(--text); color: var(--bg); padding: 12px 18px; border-radius: 999px; font-weight: 600; z-index: 20; max-width: calc(100% - 32px); text-align: center; animation: up .2s ease; transition: opacity .4s; }
.toast.out { opacity: 0; }
.spinner { width: 34px; height: 34px; border-radius: 50%; border: 3px solid var(--line); border-top-color: var(--accent); animation: spin .8s linear infinite; margin: 30vh auto 0; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }
.voice-words { margin: 12px 0 0; color: var(--soft); font-size: 15px; line-height: 1.45; overflow-wrap: anywhere; }
