/* Theme layer for the talktok-site designs.
   LIGHT values are the talktok-site hex values, unchanged (see docs/mockups/DIFF-from-site.md).
   DARK values are new. Brand colors (#6A4CFF accent, #FF4F8B, #FFC83D, #22C7A9, #12896B, #D81B60) never change. */
:root {
  --bg: #FFFFFF; --surface: #FFFFFF; --faint: #FBFAFF; --soft: #F6F3FF; --grey: #F3F1F8; --grey2: #F7F5FC;
  --line-soft: #EFECF7; --line-soft2: #F1EEF8; --line: #E2DDF2; --line2: #D3CCEA;
  --ring-a: #E7E1FA; --ring-b: #D9D0FA; --ring-c: #CFC4FA;
  --ink: #1B1530; --panel: #1B1530;
  --muted: #5B5670; --muted2: #4A4560; --faintx: #6F6A85;
  --accent-text: #6A4CFF; --link: #4B2FE0; --pink-ink: #A3134A; --yellow-ink: #7A5200;
  --green-ink: #0E6B56; --green-ink2: #0E4F40; --green-ink3: #0E7A62;
  --p-violet: #F1EDFF; --p-pink: #FFE7EF; --p-pink-s: #FFE1EC; --p-pink-f: #FFF6F9; --p-pink2: #FFF0F5;
  --p-yellow: #FFF3CC; --p-yellow2: #FFF8E1; --p-mint: #D9F7EF; --p-mint2: #E9FBF6; --p-mint3: #EFFBF7; --p-blue: #E3F2FF;
  --b-pink: #FFC2D6; --b-pink2: #F3C3D4; --b-yellow: #FFE08A; --b-mint: #9FE5D4; --b-mint2: #CDEFE5; --gauge: #EDE9FA;
  --blob-pink: #FFD6E5; --blob-violet: #DCD3FF; --blob-yellow: #FFEDB8;
  --hdr-bg: rgba(255,255,255,.88); --track: rgba(27,21,48,.12);
  --amii-navy: #1E3A55; --g-grey: #5F6368; --ink-fixed: #1B1530;
  color-scheme: light;
}
html[data-theme="dark"] {
  --bg: #0F0C1D; --surface: #171329; --faint: #120F24; --soft: #151129; --grey: #231D3D; --grey2: #1D1834;
  --line-soft: #241E40; --line-soft2: #241E40; --line: #2E2750; --line2: #3A3166;
  --ring-a: #2D2655; --ring-b: #3A3170; --ring-c: #4A3F8A;
  --ink: #F1EEFF; --panel: #241C47;
  --muted: #A9A3C4; --muted2: #BDB7D6; --faintx: #8F89AA;
  --accent-text: #A99BFF; --link: #B5A6FF; --pink-ink: #FF9DBF; --yellow-ink: #FFD98A;
  --green-ink: #6FE3C2; --green-ink2: #A6F0DA; --green-ink3: #5ED6B7;
  --p-violet: #2A2358; --p-pink: #3A1F33; --p-pink-s: #3D2036; --p-pink-f: #2A1830; --p-pink2: #2E1B2E;
  --p-yellow: #38321A; --p-yellow2: #2F2A18; --p-mint: #123A33; --p-mint2: #10302B; --p-mint3: #10302B; --p-blue: #182C48;
  --b-pink: #7A2F55; --b-pink2: #6A2D4B; --b-yellow: #6B5A1E; --b-mint: #1F6B5B; --b-mint2: #1F5148; --gauge: #2A2450;
  --blob-pink: #7A2A52; --blob-violet: #4A3DB5; --blob-yellow: #6B5A1A;
  --hdr-bg: rgba(15,12,29,.88); --track: rgba(255,255,255,.16);
  --amii-navy: #9FB9D6; --g-grey: #BDC1C6;
  color-scheme: dark;
}
html { transition: background .25s; }
body { transition: background .25s, color .25s; }
/* CJK line breaking: Korean breaks at spaces only; Japanese/Chinese use strict rules */
html[lang="ko"] body { word-break: keep-all; overflow-wrap: break-word; }
html[lang="ja"] body, html[lang="zh"] body { line-break: strict; overflow-wrap: anywhere; }
html.embed [data-embed-hide] { display: none !important; }
.tt-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
:focus-visible { outline: 3px solid #6A4CFF; outline-offset: 2px; }

/* settings panel (globe + language code in header, panel with appearance + language) */
.pnl-wrap { position: relative; }
.setbtn { display: flex; align-items: center; gap: 8px; height: 44px; padding: 0 14px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); font-family: inherit; font-size: 14px; font-weight: 700; color: var(--ink); cursor: pointer; }
.setbtn:hover { border-color: #6A4CFF; }
.setbtn svg { width: 17px; height: 17px; stroke: var(--ink); }
.pnl { position: absolute; right: 0; top: 54px; width: 320px; background: var(--surface); border: 1px solid var(--line-soft); border-radius: 22px; box-shadow: 0 24px 50px -20px rgba(27,21,48,.4); padding: 18px; display: none; z-index: 60; color: var(--ink); }
.pnl.open { display: block; animation: drop .18s ease-out; }
@keyframes drop { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: none; } }
.pnl h4 { margin: 0 0 14px; font-size: 15px; display: flex; justify-content: space-between; align-items: center; }
.pnl h4 button { border: 0; background: transparent; font-size: 22px; line-height: 1; padding: 4px 8px; border-radius: 8px; color: var(--muted); cursor: pointer; }
.pnl .lbl { font-size: 12px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); margin: 14px 0 8px; }
.seg { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; padding: 4px; background: var(--soft); border-radius: 14px; }
.seg button { border: 0; background: transparent; padding: 9px 4px; border-radius: 10px; font-family: inherit; font-weight: 700; font-size: 13px; display: flex; flex-direction: column; align-items: center; gap: 2px; color: var(--muted); cursor: pointer; }
.seg button[aria-pressed="true"] { background: var(--surface); color: var(--ink); box-shadow: 0 2px 8px rgba(0,0,0,.14); }
.langs { display: grid; gap: 4px; }
.langs button { display: flex; align-items: center; justify-content: space-between; padding: 11px 12px; border-radius: 12px; border: 1px solid transparent; background: transparent; text-align: left; font-family: inherit; font-size: 15px; font-weight: 700; color: var(--ink); cursor: pointer; }
.langs button:hover { background: var(--soft); }
.langs button[aria-checked="true"] { border-color: #6A4CFF; background: var(--p-violet); color: var(--link); }
.langs small { color: var(--faintx); font-weight: 700; }
.pnl .url { margin-top: 12px; font-size: 12px; color: var(--muted); line-height: 1.6; }
.pnl .url code { background: var(--soft); padding: 2px 6px; border-radius: 6px; }
@media (max-width: 640px) {
  header { backdrop-filter: none !important; background: var(--bg) !important; } /* backdrop-filter would make the fixed bottom sheet relative to the header */
  .pnl-wrap.open::before { content: ""; position: fixed; inset: 0; background: rgba(8,6,20,.55); z-index: 59; }
  .pnl { position: fixed; left: 0; right: 0; bottom: 0; top: auto; width: auto; border-radius: 24px 24px 0 0; padding: 20px 20px 28px; max-height: 86vh; overflow: auto; z-index: 60; }
  .pnl.open { animation: sheet .22s ease-out; }
  @keyframes sheet { from { transform: translateY(40px); opacity: 0; } to { transform: none; opacity: 1; } }
  .tt-hide-m { display: none !important; }
}

/* review-only controls */
.mctl { position: fixed; left: 12px; bottom: 12px; z-index: 80; font-size: 12px; }
.mctl summary { padding: 8px 12px; background: #1B1530; color: #fff; border-radius: 999px; list-style: none; font-weight: 800; cursor: pointer; }
.mctl summary::-webkit-details-marker { display: none; }
.mctl .box { margin-top: 8px; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 10px; display: grid; gap: 6px; box-shadow: 0 18px 40px -22px rgba(27,21,48,.5); }
.mctl .box button { border: 1px solid var(--line); background: var(--soft); border-radius: 10px; padding: 8px 10px; font-family: inherit; font-weight: 700; color: var(--ink); cursor: pointer; }
.tt-toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%) translateY(20px); background: var(--ink); color: var(--bg); padding: 12px 20px; border-radius: 14px; font-weight: 700; opacity: 0; transition: .25s; z-index: 99; max-width: calc(100vw - 32px); pointer-events: none; }
.tt-toast.on { opacity: 1; transform: translateX(-50%); }
.mask { position: fixed; inset: 0; background: rgba(8,6,20,.6); display: grid; place-items: center; z-index: 90; padding: 16px; }
.modal { background: var(--surface); border-radius: 24px; padding: 22px; width: min(460px, 100%); max-height: 90vh; overflow-y: auto; box-shadow: 0 24px 60px -20px rgba(0,0,0,.6); border: 1px solid var(--line-soft); color: var(--ink); }
.cap { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; margin: 12px 0 16px; }
.cap button { aspect-ratio: 1; border-radius: 10px; border: 2px solid var(--line); background: var(--soft); font-size: 28px; cursor: pointer; }
.cap button[aria-pressed="true"] { border-color: #6A4CFF; box-shadow: inset 0 0 0 3px var(--p-violet); }

/* landing page (English only) */
.ld a { color: inherit; }
.ld-card { background: var(--surface); border: 1px solid var(--line-soft); border-radius: 28px; padding: 28px; }
.ld-step { border-radius: 28px; padding: 24px; display: flex; flex-direction: column; gap: 14px; }
details.ld-faq { border-radius: 22px; background: var(--surface); border: 1px solid var(--line-soft); margin-bottom: 12px; overflow: hidden; }
details.ld-faq summary { cursor: pointer; padding: 22px 24px; font-size: 18px; font-weight: 700; list-style: none; display: flex; justify-content: space-between; gap: 16px; }
details.ld-faq summary::-webkit-details-marker { display: none; }
details.ld-faq summary::after { content: "+"; font-size: 24px; line-height: 1; color: var(--link); }
details.ld-faq[open] summary::after { content: "–"; }
details.ld-faq p { margin: 0; padding: 0 24px 24px; font-size: 16px; line-height: 1.75; color: var(--muted); }
.ld-pill { padding: 12px 20px; border-radius: 999px; border: 1.5px solid var(--line); background: var(--surface); text-decoration: none; font-weight: 700; font-size: 15px; }
.ld-pill:hover { border-color: #6A4CFF; color: var(--link); }

@media (prefers-reduced-motion: reduce) { *, *::after { animation: none !important; transition: none !important; } }

/* Phone chat: the demo chat takes the whole visible screen (header and input fixed, only the messages scroll); see static/js/chat-phone.js */
@media (max-width: 640px) {
  html.tt-chat-open, html.tt-chat-open body { overflow: hidden !important; overscroll-behavior: none; }
  [data-chatcard] { position: fixed !important; top: 0; left: 0; right: 0; bottom: 0; width: 100% !important; max-width: none !important; height: 100% !important;
    border-radius: 0 !important; border: 0 !important; box-shadow: none !important; z-index: 70; flex: none !important; }
  /* an ancestor with a transform (reveal animations) would turn "fixed" into "relative to that ancestor" and push the card off screen */
  html.tt-chat-open :has([data-chatcard]) { transform: none !important; filter: none !important; perspective: none !important; contain: none !important; will-change: auto !important; backdrop-filter: none !important; animation: none !important; }
  [data-chatcard] input { font-size: 16px !important; }
  [data-chatcard] form { padding-bottom: calc(8px + env(safe-area-inset-bottom)) !important; }
}
