/* ===========================================================================
   hiwap3 design system — shared across all pages (index, terms, privacy, admin)
   Light + dark themes via CSS custom properties. Toggle by setting
   document.documentElement[data-theme="dark"].
   =========================================================================== */

:root {
  --bg: #eef1f5;
  --bg-cream: #f2ece0;
  --surface: #ffffff;
  --surface-2: #f5f7fa;
  --text: #1f2937;
  --muted: #64748b;
  --border: #d7dde5;
  --om: #2a6ebb;
  --om-strong: #1f5695;
  --accent: #d9480f;
  --video: #0b0f17;
  --ok: #128a3a;
  --bad: #dc2626;
  --radius: 10px;
  --shadow: 0 1px 3px rgba(16, 24, 40, .08), 0 1px 2px rgba(16, 24, 40, .06);
  --shadow-lg: 0 10px 30px rgba(16, 24, 40, .14);
}

:root[data-theme="dark"] {
  --bg: #0c1118;
  --bg-cream: #0c1118;
  --surface: #151b24;
  --surface-2: #1b222d;
  --text: #e6eaf0;
  --muted: #9aa6b6;
  --border: #2a3340;
  --om: #5a9be6;
  --om-strong: #4a90d9;
  --accent: #f08a3c;
  --video: #05080d;
  --shadow: 0 1px 3px rgba(0, 0, 0, .5);
  --shadow-lg: 0 10px 30px rgba(0, 0, 0, .6);
}

* { box-sizing: border-box; }
html, body { height: 100%; }
html { scroll-behavior: smooth; }
#startBox { scroll-margin-top: 1rem; }

/* Layout: full-width bands with centered containers (mobile-first) */
.container { width: 100%; max-width: 1040px; margin-inline: auto; padding-inline: 1rem; }
@media (min-width: 640px) { .container { padding-inline: 1.25rem; } }
.site-header { background: var(--surface); border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 30; }
.header-inner { display: flex; align-items: center; justify-content: space-between; gap: .6rem; padding-block: .55rem; }
.band { padding-block: clamp(1.75rem, 6vw, 3.5rem); }
.band-cream { background: var(--bg-cream); }
.band-surface { background: var(--surface); }
body {
  margin: 0;
  font-family: Arial, Helvetica, sans-serif;
  color: var(--text);
  background: var(--bg);
  transition: background .25s ease, color .25s ease;
}

.logo {
  font-family: Fredoka, Arial, sans-serif; letter-spacing: -.01em;
  background: linear-gradient(90deg, var(--om), #7c3aed, var(--om));
  background-size: 200% auto;
  -webkit-background-clip: text; background-clip: text;
  color: transparent;
  animation: logoGrad 5s linear infinite;
}
@keyframes logoGrad { to { background-position: 200% center; } }

/* Surfaces */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.surface-2 { background: var(--surface-2); }
.muted { color: var(--muted); }
.divider { border-top: 1px solid var(--border); }

/* Inputs */
.input {
  width: 100%;
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: .55rem .75rem;
  font-size: 14px;
  outline: none;
  transition: border-color .15s ease, box-shadow .15s ease;
}
.input::placeholder { color: var(--muted); opacity: .8; }
.input:focus { border-color: var(--om); box-shadow: 0 0 0 3px color-mix(in srgb, var(--om) 22%, transparent); }
.input:disabled { opacity: .55; }

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .4rem;
  border: 1px solid transparent;
  border-radius: 8px;
  padding: .6rem 1rem;
  font-size: 15px;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
  transition: transform .05s ease, filter .15s ease, background .15s ease;
  user-select: none;
  position: relative;
  overflow: hidden;
}
.ripple { position: absolute; border-radius: 50%; background: currentColor; opacity: .28; transform: scale(0); animation: ripple .6s ease-out; pointer-events: none; }
@keyframes ripple { to { transform: scale(2.3); opacity: 0; } }
.btn:active:not(:disabled) { transform: translateY(1px); }
.btn:disabled { opacity: .5; cursor: default; }
.btn-blue { background: linear-gradient(180deg, #4a90d9, #2f74c0); color: #fff; border-color: var(--om-strong); }
.btn-blue:hover:not(:disabled) { filter: brightness(1.07); }
.btn-grey { background: var(--surface-2); color: var(--text); border-color: var(--border); }
.btn-grey:hover:not(:disabled) { filter: brightness(.97); }
.btn-red { background: linear-gradient(180deg, #ef5a52, #d23b32); color: #fff; border-color: #b5302a; }
.btn-red:hover:not(:disabled) { filter: brightness(1.06); }
.btn-ghost { background: transparent; color: var(--muted); border-color: var(--border); }
.btn-ghost:hover:not(:disabled) { color: var(--text); border-color: var(--om); }

/* Links */
.link { color: var(--om); text-decoration: none; }
.link:hover { text-decoration: underline; }

/* Icon button (theme toggle etc.) */
.icon-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 34px; height: 34px; border-radius: 8px;
  border: 1px solid var(--border); background: var(--surface);
  color: var(--text); cursor: pointer; transition: filter .15s ease, border-color .15s ease;
}
.icon-btn:hover { border-color: var(--om); }

/* Badges */
.badge {
  display: inline-flex; align-items: center; gap: .4rem;
  padding: .2rem .6rem; border-radius: 999px; font-size: 13px; font-weight: 600;
}
.dot { width: 8px; height: 8px; border-radius: 999px; display: inline-block; }

/* Video surface */
.video-box { background: var(--video); }

/* Scrollbar */
.scroll-thin::-webkit-scrollbar { width: 9px; }
.scroll-thin::-webkit-scrollbar-thumb { background: var(--border); border-radius: 999px; }
.scroll-thin::-webkit-scrollbar-track { background: transparent; }

/* Motion */
.fade-in { animation: fade .3s ease both; }
.pop-in { animation: pop .22s cubic-bezier(.2, .9, .3, 1.2) both; }
@keyframes fade { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
@keyframes pop { from { opacity: 0; transform: scale(.96); } to { opacity: 1; transform: scale(1); } }
@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}

/* Animated logo */
.logo-anim { display: inline-block; animation: logoPop .5s cubic-bezier(.2,.9,.3,1.3) both; }
.logo-anim:hover { animation: logoWiggle .5s ease; }
@keyframes logoPop { from { opacity: 0; transform: translateY(6px) scale(.9); } to { opacity: 1; transform: none; } }
@keyframes logoWiggle { 0%,100% { transform: rotate(0); } 25% { transform: rotate(-4deg); } 75% { transform: rotate(4deg); } }
.logo-bubble { animation: bubbleFloat 3.5s ease-in-out infinite; }
@keyframes bubbleFloat { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-3px); } }

/* Message avatars */
.avatar { display: inline-flex; align-items: center; justify-content: center; width: 22px; height: 22px; border-radius: 999px; color: #fff; font-size: 11px; font-weight: 700; flex: 0 0 auto; }
.msg-row { display: flex; align-items: flex-start; gap: .5rem; }

/* Connecting shimmer (skeleton feel over the dark video while matching) */
#remoteOverlay::after { content: ''; position: absolute; inset: 0; pointer-events: none; background: linear-gradient(110deg, transparent 30%, rgba(255,255,255,.06) 50%, transparent 70%); background-size: 200% 100%; animation: shimmer 1.6s linear infinite; }
@keyframes shimmer { to { background-position: -200% 0; } }

/* Branded search spinner */
.brand-spinner { position: relative; width: 56px; height: 56px; }
.brand-spinner img { position: absolute; inset: 12px; width: 32px; height: 32px; animation: bubbleFloat 2s ease-in-out infinite; }
.brand-spinner::before { content: ''; position: absolute; inset: 0; border-radius: 999px; border: 3px solid rgba(255,255,255,.18); border-top-color: #4a90d9; animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* Empty-state */
.empty-state { display: flex; flex-direction: column; align-items: center; justify-content: center; height: 100%; text-align: center; color: var(--muted); gap: .6rem; padding: 1.5rem; }
.empty-state svg { opacity: .5; }

/* Header/footer control row: consistent 34px pills */
.ctl-row { display: inline-flex; align-items: center; gap: .5rem; }
.pill {
  display: inline-flex; align-items: center; gap: .4rem; height: 34px; padding: 0 .75rem;
  border-radius: 999px; background: var(--surface-2); border: 1px solid var(--border);
  font-size: 13px; font-weight: 600; color: var(--text); white-space: nowrap;
}
.seg { display: inline-flex; height: 34px; border: 1px solid var(--border); border-radius: 999px; overflow: hidden; background: var(--surface); }
.seg button { border: 0; background: transparent; padding: 0 .7rem; font-size: 13px; font-weight: 700; color: var(--muted); cursor: pointer; transition: background .15s, color .15s; }
.seg button:hover { color: var(--text); }
.seg button[data-active="1"] { background: var(--om); color: #fff; }
.swatch-group { display: inline-flex; align-items: center; gap: .5rem; height: 34px; padding: 0 .75rem; border-radius: 999px; border: 1px solid var(--border); background: var(--surface); }

/* Accent swatches */
.swatch { width: 16px; height: 16px; border-radius: 999px; cursor: pointer; border: 2px solid transparent; box-shadow: 0 0 0 1px var(--border); transition: transform .1s; }
.swatch:hover { transform: scale(1.15); }
.swatch[data-active="1"] { box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px var(--text); }

/* Landing hero */
.hero { position: relative; overflow: hidden; color: #fff; background: linear-gradient(135deg, #1f5695 0%, #2a6ebb 45%, #7c3aed 100%); }
.hero::before { content: ''; position: absolute; inset: 0; background:
  radial-gradient(600px 300px at 15% 10%, rgba(255,255,255,.18), transparent 60%),
  radial-gradient(500px 300px at 90% 80%, rgba(124,58,237,.5), transparent 60%); pointer-events: none; }
.hero-inner { position: relative; max-width: 1040px; margin: 0 auto; padding: 3rem 1.25rem; display: grid; gap: 2rem; grid-template-columns: 1fr; align-items: center; }
@media (min-width: 880px) { .hero-inner { grid-template-columns: 1.1fr .9fr; padding: 4.5rem 1.25rem; } }
.hero-badges { display: flex; flex-wrap: wrap; gap: .5rem; margin-bottom: 1.1rem; }
.hero-badge { display: inline-flex; align-items: center; gap: .4rem; background: rgba(255,255,255,.15); border: 1px solid rgba(255,255,255,.28); padding: .28rem .75rem; border-radius: 999px; font-size: 12px; font-weight: 600; }
.hero-title { font-size: clamp(2.1rem, 5.5vw, 3.4rem); font-weight: 800; line-height: 1.07; letter-spacing: -.02em; margin: 0; text-wrap: balance; }
.hero-sub { margin: 1.1rem 0 1.6rem; font-size: 1.08rem; line-height: 1.5; opacity: .94; max-width: 38ch; }
.hero-cta { display: flex; flex-wrap: wrap; gap: .75rem; }
.btn-light { background: #fff; color: #1f5695; border-color: #fff; box-shadow: 0 10px 24px rgba(0,0,0,.18); }
.btn-light:hover:not(:disabled) { filter: brightness(.96); }
.btn-ghost-light { background: rgba(255,255,255,.08); color: #fff; border-color: rgba(255,255,255,.5); }
.btn-ghost-light:hover:not(:disabled) { background: rgba(255,255,255,.18); }
.hero-art { position: relative; height: 280px; display: none; }
@media (min-width: 880px) { .hero-art { display: block; } }
.art-tile { position: absolute; width: 160px; height: 200px; border-radius: 20px; display: flex; align-items: center; justify-content: center; font-size: 4.2rem; box-shadow: 0 24px 48px rgba(0,0,0,.32); border: 3px solid rgba(255,255,255,.3); animation: bubbleFloat 4s ease-in-out infinite; }
.art-1 { right: 130px; top: 8px; background: linear-gradient(160deg, #3b82f6, #1e3a8a); transform: rotate(-7deg); }
.art-2 { right: 6px; top: 66px; background: linear-gradient(160deg, #a855f7, #6d28d9); transform: rotate(6deg); animation-delay: .6s; }
.art-bubble { position: absolute; right: 150px; bottom: 14px; background: #fff; color: #1f2937; padding: .5rem .9rem; border-radius: 14px 14px 14px 4px; font-weight: 700; font-size: .95rem; box-shadow: 0 12px 24px rgba(0,0,0,.25); animation: bubbleFloat 3s ease-in-out infinite; }

/* Hero app mockup */
.app-mock { position: absolute; right: 0; top: 50%; transform: translateY(-50%) rotate(-3deg); width: 360px; max-width: 100%; background: #0f1626; border: 1px solid rgba(255,255,255,.18); border-radius: 18px; box-shadow: 0 30px 60px rgba(0,0,0,.42); overflow: hidden; color: #e6eaf0; animation: bubbleFloat 5s ease-in-out infinite; }
.am-bar { display: flex; align-items: center; gap: 6px; padding: 8px 10px; background: rgba(255,255,255,.06); }
.am-dot { width: 9px; height: 9px; border-radius: 50%; background: rgba(255,255,255,.3); }
.am-title { margin-left: 8px; font-family: Fredoka, sans-serif; font-weight: 700; font-size: 13px; opacity: .9; }
.am-body { display: grid; grid-template-columns: 1.25fr 1fr; gap: 6px; padding: 8px; }
.am-videos { display: flex; flex-direction: column; gap: 6px; }
.am-vid { position: relative; border-radius: 10px; height: 92px; display: flex; align-items: center; justify-content: center; font-size: 2.2rem; }
.am-remote { background: linear-gradient(160deg, #3b82f6, #1e3a8a); }
.am-local { height: 60px; background: linear-gradient(160deg, #a855f7, #6d28d9); font-size: 1.6rem; }
.am-tag { position: absolute; left: 6px; top: 6px; font-size: 9px; background: rgba(0,0,0,.45); padding: 1px 5px; border-radius: 4px; }
.am-chat { background: rgba(255,255,255,.05); border-radius: 10px; padding: 8px; display: flex; flex-direction: column; gap: 6px; justify-content: flex-end; }
.am-msg { font-size: 11px; padding: 5px 8px; border-radius: 9px; max-width: 92%; line-height: 1.25; }
.am-they { background: rgba(255,255,255,.14); align-self: flex-start; }
.am-me { background: #2f74c0; align-self: flex-end; }
.am-foot { padding: 0 8px 10px; }
.am-next { display: block; text-align: center; background: linear-gradient(180deg, #4a90d9, #2f74c0); color: #fff; font-weight: 700; font-size: 12px; padding: 7px; border-radius: 9px; }

/* Section titles */
.sec-title { text-align: center; font-size: clamp(1.5rem, 3.5vw, 2rem); font-weight: 800; letter-spacing: -.02em; margin: 0 0 1.75rem; }

/* Start card (overlaps hero) */
.start-card { max-width: 640px; margin: -3.5rem auto 0; position: relative; z-index: 2; background: var(--surface); border: 1px solid var(--border); border-radius: 22px; box-shadow: var(--shadow-lg); padding: clamp(1.25rem, 4vw, 2rem); }
.start-title { font-size: 1.4rem; font-weight: 800; letter-spacing: -.01em; margin: 0; }
.fld-label { display: block; font-size: .85rem; font-weight: 700; margin: 0 0 .45rem; }
.start-prefs { display: flex; flex-wrap: wrap; gap: .9rem; margin: 1.1rem 0; }
.start-prefs label { display: flex; align-items: center; gap: .5rem; font-size: .85rem; font-weight: 600; }
.start-cta { display: grid; grid-template-columns: 1fr 1fr; gap: .75rem; margin-top: 1rem; }
@media (max-width: 440px) { .start-cta { grid-template-columns: 1fr; } }
.mode-btn { display: flex; align-items: center; gap: .7rem; padding: .9rem 1rem; border-radius: 14px; border: 1px solid var(--border); background: var(--surface); color: var(--text); cursor: pointer; text-align: left; transition: transform .08s, box-shadow .15s, border-color .15s; }
.mode-btn:hover:not(:disabled) { transform: translateY(-2px); box-shadow: var(--shadow); border-color: var(--om); }
.mode-btn:disabled { opacity: .5; cursor: default; }
.mode-btn .mb-ico { font-size: 1.7rem; line-height: 1; }
.mode-btn .mb-txt { display: flex; flex-direction: column; line-height: 1.15; }
.mode-btn .mb-txt b { font-size: 1rem; }
.mode-btn .mb-txt small { color: var(--muted); font-size: .75rem; }
.mode-video { background: linear-gradient(180deg, #eaf3ff, var(--surface)); border-color: color-mix(in srgb, var(--om) 35%, var(--border)); }
.mode-video b { color: var(--om); }
:root[data-theme="dark"] .mode-video { background: linear-gradient(180deg, color-mix(in srgb, var(--om) 22%, var(--surface)), var(--surface)); }
.start-note { text-align: center; font-size: .75rem; margin-top: 1rem; }

/* How-it-works steps */
.steps { display: grid; gap: 1rem; grid-template-columns: 1fr; }
@media (min-width: 720px) { .steps { grid-template-columns: repeat(3, 1fr); } }
.step { text-align: center; padding: 1rem; }
.step-n { width: 46px; height: 46px; border-radius: 999px; display: flex; align-items: center; justify-content: center; margin: 0 auto .7rem; font-weight: 800; color: #fff; background: linear-gradient(180deg, #4a90d9, #2f74c0); box-shadow: 0 8px 18px rgba(31, 143, 255, .3); }
.step h3 { font-weight: 700; margin: .2rem 0 .3rem; }

/* Features */
.feature { background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 1.25rem; box-shadow: var(--shadow); transition: transform .1s, box-shadow .15s; }
.feature:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); }
.feature .ico { width: 48px; height: 48px; border-radius: 12px; display: flex; align-items: center; justify-content: center; font-size: 1.5rem; background: color-mix(in srgb, var(--om) 12%, var(--surface)); }

/* Trust strip */
.trust { display: flex; flex-wrap: wrap; justify-content: center; gap: .6rem; }
.trust span { display: inline-flex; align-items: center; gap: .4rem; background: var(--surface-2); border: 1px solid var(--border); border-radius: 999px; padding: .4rem .9rem; font-size: .85rem; font-weight: 600; }

/* Ad slots */
.ad-slot { min-height: 90px; display: flex; align-items: center; justify-content: center; border: 1px dashed var(--border); border-radius: 12px; background: var(--surface-2); color: var(--muted); position: relative; padding: 1rem; overflow: hidden; }
.ad-label { position: absolute; top: 4px; left: 8px; font-size: 10px; text-transform: uppercase; letter-spacing: .05em; opacity: .55; }

/* FAQ accordion */
.faq { border: 1px solid var(--border); border-radius: 12px; background: var(--surface); margin-bottom: .6rem; overflow: hidden; }
.faq summary { cursor: pointer; padding: .9rem 1.1rem; font-weight: 700; list-style: none; display: flex; justify-content: space-between; align-items: center; gap: 1rem; }
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: '+'; color: var(--muted); font-size: 1.3rem; line-height: 1; }
.faq[open] summary::after { content: '\2013'; }
.faq p { margin: 0; padding: 0 1.1rem 1rem; color: var(--muted); line-height: 1.6; }

/* Accessibility: focus + high contrast + font sizes */
:focus-visible { outline: 2px solid var(--om); outline-offset: 2px; }
:root[data-contrast="high"] { --muted: #334155; --border: #475569; --text: #000; }
:root[data-contrast="high"][data-theme="dark"] { --muted: #e2e8f0; --border: #cbd5e1; --text: #fff; }
#chatLog[data-fs="sm"] { font-size: 12px; }
#chatLog[data-fs="md"] { font-size: 14px; }
#chatLog[data-fs="lg"] { font-size: 17px; }
kbd { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 12px; border: 1px solid var(--border); }

/* Floating reactions */
.reaction-float { position: absolute; bottom: 10%; font-size: 2rem; animation: floatUp 2.2s ease-out forwards; }
@keyframes floatUp { 0% { opacity: 0; transform: translateY(0) scale(.6); } 15% { opacity: 1; transform: translateY(-10px) scale(1.1); } 100% { opacity: 0; transform: translateY(-180px) scale(1); } }
.react-pick { cursor: pointer; }

/* Confetti */
.confetti-piece { position: fixed; top: -12px; width: 8px; height: 12px; z-index: 55; pointer-events: none; animation: confettiFall linear forwards; }
@keyframes confettiFall { to { transform: translateY(105vh) rotate(540deg); opacity: .9; } }

/* Mirror + emoji + quality */
.mirrored { transform: scaleX(-1); }
#emojiPanel button { cursor: pointer; line-height: 1; padding: .15rem .25rem; border-radius: 6px; }
#emojiPanel button:hover { background: var(--surface-2); }
.msg-time { font-size: 11px; color: var(--muted); margin-left: .4rem; }

/* Prose (terms / privacy) */
.prose h2 { font-size: 1.15rem; font-weight: 700; margin: 1.4rem 0 .5rem; color: var(--text); }
.prose p { margin: .5rem 0; line-height: 1.65; color: var(--text); }
.prose ul { margin: .5rem 0 .5rem 1.2rem; list-style: disc; }
.prose li { margin: .3rem 0; line-height: 1.6; }
.prose a { color: var(--om); }
