/* The share page's chat (twinly.chat/p/<slug>): one screen, the twin's chat, in the app's look. Cherry gloss on a light
   phone, pink noir on a dark one (the app follows the phone the same way). */
:root {
  --app: #FFF4F1; --top: #FFFFFF; --line: #F0CFCA; --bubble: #FFFFFF; --bubble-line: #F0CFCA; --bubble-fg: #2A1215; --fg: #2A1215;
  --muted: #85545A; --faint: #936A70; --acc: #D7263D; --acc-text: #B3122A; --on-acc: #FFFFFF; --tint: #FFE3EA; --track: #F6DCE0;
  --green: #2FBF71; --field: #FFFFFF; --chip: #FFFFFF; --chip-line: #F0CFCA; --sheet: #FFFFFF; --scrim: rgba(42,18,21,.45);
  --sans: "DM Sans", -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --serif: "Fraunces", Georgia, serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --app: #1A0E12; --top: #221218; --line: #41242E; --bubble: #2A161D; --bubble-line: #2A161D; --bubble-fg: #FFF1F4; --fg: #FFF1F4;
    --muted: #C9A3AE; --faint: #A0808A; --acc: #FF4F9A; --acc-text: #FF8DBE; --on-acc: #2A0414; --tint: #3A1F28; --track: #41242E;
    --field: #2A161D; --chip: #2A161D; --chip-line: #41242E; --sheet: #221218; --scrim: rgba(10,4,6,.65);
    color-scheme: dark;
  }
}
/* Drawn icons (the app's own set), painted in the text color around them. */
.ic-mic::before, .ic-lock::before { content: ""; display: inline-block; width: 14px; height: 14px; margin-inline-end: 5px; vertical-align: -2px; background: currentColor;
  -webkit-mask: var(--ic) center / contain no-repeat; mask: var(--ic) center / contain no-repeat; }
.ic-mic { --ic: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2.3' stroke-linecap='round'%3E%3Cpath d='M12 3a3 3 0 0 1 3 3v5a3 3 0 0 1-6 0V6a3 3 0 0 1 3-3z'/%3E%3Cpath d='M6 11a6 6 0 0 0 12 0M12 17v3.5M9 20.5h6'/%3E%3C/svg%3E"); }
.ic-lock { --ic: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2.3' stroke-linecap='round'%3E%3Cpath d='M6 10.5h12a1.5 1.5 0 0 1 1.5 1.5v6.5a2 2 0 0 1-2 2h-11a2 2 0 0 1-2-2V12A1.5 1.5 0 0 1 6 10.5z'/%3E%3Cpath d='M8.5 10.5V8a3.5 3.5 0 0 1 7 0v2.5'/%3E%3C/svg%3E"); }
* { box-sizing: border-box; }
html, body { height: 100%; }
body { margin: 0; background: var(--app); color: var(--fg); font: 400 16px/1.4 var(--sans); -webkit-font-smoothing: antialiased; }
button, input { font: inherit; color: inherit; }
[hidden] { display: none !important; }

.wc { height: 100%; max-width: 560px; margin: 0 auto; display: flex; flex-direction: column; padding-top: env(safe-area-inset-top, 0px); }
.wc-hdr { display: flex; align-items: center; gap: 12px; padding: 12px max(16px, env(safe-area-inset-right, 0px)) 12px max(16px, env(safe-area-inset-left, 0px)); border-bottom: 1px solid var(--line); background: var(--top); }
.av { position: relative; width: 48px; height: 48px; border-radius: 50%; background: var(--tint); flex: none; box-shadow: 0 0 0 2px var(--top), 0 0 0 4px var(--acc); }
.av .in { position: absolute; inset: 0; border-radius: 50%; overflow: hidden; }
.av img, .av svg { width: 100%; height: 100%; object-fit: cover; object-position: center 15%; display: block; }
.av .f-blink { position: absolute; inset: 0; opacity: 0; }
.av .live { position: absolute; right: -2px; bottom: -2px; width: 13px; height: 13px; border-radius: 50%; background: var(--green); border: 2.5px solid var(--top); }
.who { min-width: 0; line-height: 1.25; }
.who b { display: block; font-family: var(--serif); font-weight: 600; font-size: 19px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.who span { font-size: 12.5px; font-weight: 500; color: var(--muted); }
.free { margin-left: auto; display: flex; gap: 4px; align-items: center; flex: none; }
.free i { width: 8px; height: 8px; border-radius: 50%; background: var(--acc); }
.free i.used { background: var(--track); }

.wc-msgs { flex: 1; min-height: 0; overflow-y: auto; display: flex; flex-direction: column; gap: 7px; padding: 16px max(12px, env(safe-area-inset-right, 0px)) 10px max(12px, env(safe-area-inset-left, 0px)); -webkit-overflow-scrolling: touch; }
.wc-msgs > :first-child { margin-top: auto; }
.b { max-width: 84%; padding: 9px 13px; border-radius: 19px; font-weight: 500; font-size: 15.5px; line-height: 1.38; white-space: pre-wrap; overflow-wrap: anywhere; }
.b.t { align-self: flex-start; background: var(--bubble); color: var(--bubble-fg); border: 1px solid var(--bubble-line); border-bottom-left-radius: 6px; }
.b.u { align-self: flex-end; background: var(--acc); color: var(--on-acc); border-bottom-right-radius: 6px; }
.voice { align-self: flex-start; display: flex; align-items: center; gap: 10px; background: var(--bubble); color: var(--bubble-fg); border: 1px solid var(--bubble-line); border-radius: 19px; border-bottom-left-radius: 6px; padding: 8px 14px 8px 8px; width: min(84%, 300px); cursor: pointer; text-align: left; }
.play { width: 34px; height: 34px; border-radius: 50%; background: var(--acc); display: grid; place-items: center; flex: none; }
.play::before { content: ""; border-left: 11px solid var(--on-acc); border-top: 7px solid transparent; border-bottom: 7px solid transparent; margin-left: 3px; }
.voice.on .play::before { border: 0; width: 11px; height: 12px; margin: 0; background: linear-gradient(90deg, var(--on-acc) 0 35%, transparent 35% 65%, var(--on-acc) 65%); }
.voice.wait .play::before { border: 3px solid var(--on-acc); border-right-color: transparent; width: 14px; height: 14px; border-radius: 50%; margin: 0; animation: spin .8s linear infinite; }
.wave { flex: 1; display: flex; align-items: center; gap: 2px; height: 26px; }
.wave i { flex: 1; border-radius: 2px; background: var(--track); transition: background .2s; }
.wave i.lit { background: var(--acc); }
.voice .dur { font-size: 11.5px; font-weight: 700; color: var(--muted); min-width: 28px; }
.voice.lock { cursor: pointer; opacity: .6; }
.voice.lock .play { background: var(--track); }
.voice.lock .play::before { content: ""; border: 0; margin: 0; width: 16px; height: 16px; background: var(--muted); --ic: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2.3' stroke-linecap='round'%3E%3Cpath d='M6 10.5h12a1.5 1.5 0 0 1 1.5 1.5v6.5a2 2 0 0 1-2 2h-11a2 2 0 0 1-2-2V12A1.5 1.5 0 0 1 6 10.5z'/%3E%3Cpath d='M8.5 10.5V8a3.5 3.5 0 0 1 7 0v2.5'/%3E%3C/svg%3E"); -webkit-mask: var(--ic) center / contain no-repeat; mask: var(--ic) center / contain no-repeat; }
.hint { align-self: flex-start; font-size: 12px; font-weight: 700; color: var(--acc-text); padding: 0 0 2px 8px; }
.typing { align-self: flex-start; background: var(--bubble); border: 1px solid var(--bubble-line); border-radius: 19px; border-bottom-left-radius: 6px; padding: 12px 14px; display: flex; gap: 5px; }
.typing i { width: 7px; height: 7px; border-radius: 50%; background: var(--muted); animation: dot 1.2s infinite; }
.typing i:nth-child(2) { animation-delay: .15s; } .typing i:nth-child(3) { animation-delay: .3s; }

.wc-chips { display: flex; gap: 8px; flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; -webkit-overflow-scrolling: touch; padding: 0 max(12px, env(safe-area-inset-right, 0px)) 8px max(12px, env(safe-area-inset-left, 0px)); }
.wc-chips::-webkit-scrollbar { display: none; }
/* One row that scrolls sideways, on the right when it fits, so the reply above stays in view on small phones. */
.chip:first-child { margin-left: auto; }
.chip { flex: none; white-space: nowrap; font-weight: 700; font-size: 14px; color: var(--fg); border: 1.5px solid var(--chip-line); border-radius: 99px; padding: 8px 13px; background: var(--chip); cursor: pointer; }
.chip:active { transform: scale(.97); }
.wc-say { display: flex; gap: 8px; align-items: center; padding: 8px max(12px, env(safe-area-inset-right, 0px)) 6px max(12px, env(safe-area-inset-left, 0px)); border-top: 1px solid var(--line); }
.wc-say input { flex: 1; min-width: 0; border: 1.5px solid var(--chip-line); outline: 0; border-radius: 99px; background: var(--field); padding: 10px 16px; font-size: 16px; font-weight: 500; }
.wc-say input:focus { border-color: var(--acc); }
.wc-say input::placeholder { color: var(--muted); }
.wc-say button { width: 40px; height: 40px; border: 0; border-radius: 50%; background: var(--acc); color: var(--on-acc); flex: none; cursor: pointer; display: grid; place-items: center; }
.wc-say button svg { width: 20px; height: 20px; }
.wc-say button:disabled { opacity: .45; }
.wc-made { margin: 0; text-align: center; font-size: 11.5px; font-weight: 500; color: var(--muted); padding: 2px 16px calc(10px + env(safe-area-inset-bottom, 0px)); }
.wc-made b, .wc-made a { color: var(--fg); font-weight: 700; }
:focus-visible { outline: 2px solid var(--acc); outline-offset: 2px; }

.sheet-back { position: fixed; inset: 0; background: var(--scrim); display: flex; align-items: flex-end; justify-content: center; z-index: 5; animation: fade .35s ease both; }
.sheet { width: 100%; max-width: 560px; background: var(--sheet); color: var(--fg); text-align: center; border-radius: 28px 28px 0 0; padding: 18px max(18px, env(safe-area-inset-right, 0px)) calc(22px + env(safe-area-inset-bottom, 0px)) max(18px, env(safe-area-inset-left, 0px)); display: grid; gap: 12px; text-align: center; box-shadow: 0 -14px 44px rgba(0,0,0,.5); animation: up .4s cubic-bezier(.2,.9,.3,1.1) both; }
.sheet .grab { width: 40px; height: 4px; border-radius: 4px; background: var(--line); justify-self: center; }
.sheet h2 { margin: 2px 0 0; font-family: var(--serif); font-weight: 600; font-size: 25px; line-height: 1.15; text-wrap: balance; }
.sheet p { margin: 0; font-size: 14.5px; font-weight: 500; line-height: 1.4; color: var(--muted); }
.cta { display: block; border-radius: 999px; padding: 14px 18px; font-weight: 700; font-size: 17px; color: var(--on-acc); text-decoration: none; background: var(--acc); }
.cta small { display: block; font-size: 12px; font-weight: 600; opacity: .9; margin-top: 2px; }
.ghost { font-weight: 700; font-size: 14px; color: var(--fg); text-decoration: underline; text-underline-offset: 3px; background: none; border: 0; cursor: pointer; padding: 4px; }
.sheet .x { justify-self: center; font-size: 13px; color: var(--faint); background: none; border: 0; padding: 4px 10px; cursor: pointer; }

.wc-generic { margin: auto; padding: 32px 24px; text-align: center; display: grid; gap: 14px; max-width: 420px; }
.wc-generic h1 { margin: 0; font-family: var(--serif); font-size: 28px; font-weight: 600; line-height: 1.15; }
.wc-generic p { margin: 0; color: var(--muted); }

@keyframes dot { 0%, 60%, 100% { opacity: .35; } 30% { opacity: 1; } }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes fade { from { opacity: 0; } }
@keyframes up { from { transform: translateY(40px); opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .typing i, .sheet, .sheet-back { animation: none; } }

/* Under the chat after the second message: they can have a twin too. Small, never over the chat. */
.wc-banner { display: flex; align-items: center; gap: 10px; margin: 0 12px 6px; padding: 8px 8px 8px 14px; border-radius: 18px; background: var(--tint); border: 0; animation: fade .35s ease both; }
.wc-banner[hidden] { display: none; }
.wc-banner span { flex: 1; min-width: 0; font-size: 13px; font-weight: 700; color: var(--fg); line-height: 1.3; }
.wc-banner button { flex: none; border: 0; border-radius: 99px; padding: 8px 14px; font-weight: 700; font-size: 13px; color: var(--on-acc); background: var(--acc); cursor: pointer; }
