/* Ignis. Colours are tokens: light by default, dark when the device prefers it, and either one when the member
   picks it with the toggle (html[data-theme], kept on the device). */

:root {
  --bg: #f6f2ea;
  --surface: #fffdf8;
  --surface-2: #efe9de;
  --line: #e2d9ca;
  --ink: #1f1c18;
  --ink-2: #5d564c;
  --ink-3: #8c8476;
  --accent: #9a5b22;
  --accent-ink: #fffaf2;
  --accent-soft: #f3e4cf;
  --silver: #7d889c;
  --danger: #b3261e;
  --me: #ece3d3;
  --shadow: 0 1px 2px rgb(60 40 10 / 6%), 0 8px 24px rgb(60 40 10 / 8%);
  --serif: 'Cormorant Garamond', 'Iowan Old Style', 'Palatino Linotype', Georgia, serif;
  --sans: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --mono: ui-monospace, 'SF Mono', Menlo, Consolas, monospace;
  --radius: 14px;
  /* The phone's bars over the page: 0 in a browser; inside the Android app the page runs under them, and the app
     sets --safe-area-inset-* (right on every Android version, where env() is not). */
  --inset-top: var(--safe-area-inset-top, env(safe-area-inset-top, 0px));
  --inset-bottom: var(--safe-area-inset-bottom, env(safe-area-inset-bottom, 0px));
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme='light']) {
    --bg: #12110f;
    --surface: #1b1916;
    --surface-2: #24211d;
    --line: #2f2b26;
    --ink: #ede6da;
    --ink-2: #b4ab9c;
    --ink-3: #807868;
    --accent: #d9a35b;
    --accent-ink: #1a140b;
    --accent-soft: #352816;
    --silver: #c3cad8;
    --danger: #f2867e;
    --me: #2a2620;
    --shadow: 0 1px 2px rgb(0 0 0 / 30%), 0 8px 24px rgb(0 0 0 / 35%);
    color-scheme: dark;
  }
}

:root[data-theme='dark'] {
  --bg: #12110f;
  --surface: #1b1916;
  --surface-2: #24211d;
  --line: #2f2b26;
  --ink: #ede6da;
  --ink-2: #b4ab9c;
  --ink-3: #807868;
  --accent: #d9a35b;
  --accent-ink: #1a140b;
  --accent-soft: #352816;
  --silver: #c3cad8;
  --danger: #f2867e;
  --me: #2a2620;
  --shadow: 0 1px 2px rgb(0 0 0 / 30%), 0 8px 24px rgb(0 0 0 / 35%);
  color-scheme: dark;
}

/* Wine: the colour of the app icon, deep enough to read on for long, with its gold for the accent. */
:root[data-theme='wine'] {
  --bg: #210c14;
  --surface: #2c111b;
  --surface-2: #371622;
  --line: #48202f;
  --ink: #f5e9df;
  --ink-2: #d4bab0;
  --ink-3: #a3857c;
  --accent: #e3b46a;
  --accent-ink: #2a0f17;
  --accent-soft: #4a2a1c;
  --silver: #d9cdd6;
  --danger: #ff9a90;
  --me: #3d1826;
  --shadow: 0 1px 2px rgb(0 0 0 / 35%), 0 8px 24px rgb(0 0 0 / 40%);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.55 var(--sans);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}
[hidden] { display: none !important; }
button, input, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--accent); }

/* ---------- shared pieces ---------- */

.brand {
  font-family: var(--serif);
  font-weight: 600;
  letter-spacing: 0.02em;
  font-size: 2.6rem;
  line-height: 1;
  margin: 0;
}
.brand .mark { color: var(--accent); }
.tagline { color: var(--ink-3); margin: 0.6rem 0 0; font-size: 0.95rem; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.5rem;
  border: 1px solid transparent; border-radius: 999px;
  padding: 0.7rem 1.3rem; font-weight: 600; font-size: 0.95rem;
  background: var(--accent); color: var(--accent-ink);
  transition: filter 0.15s, background 0.15s;
}
.btn:hover { filter: brightness(1.06); }
.btn:disabled { opacity: 0.55; cursor: default; filter: none; }
.btn.ghost { background: transparent; color: var(--ink-2); border-color: var(--line); }
.btn.ghost:hover { background: var(--surface-2); filter: none; }
.btn.block { width: 100%; }

.icon-btn {
  display: inline-grid; place-items: center;
  width: 40px; height: 40px; border-radius: 999px;
  border: 1px solid var(--line); background: var(--surface); color: var(--ink-2);
}
.icon-btn:hover { background: var(--surface-2); color: var(--ink); }
.icon-btn svg { width: 18px; height: 18px; }

.field { display: block; margin-bottom: 0.9rem; }
.field span { display: block; font-size: 0.82rem; font-weight: 600; color: var(--ink-2); margin-bottom: 0.35rem; }
.field input {
  width: 100%; padding: 0.75rem 0.95rem; border-radius: 10px;
  border: 1px solid var(--line); background: var(--bg); outline: none;
}
.field input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.pair { display: grid; grid-template-columns: 1fr 1fr; gap: 0 0.7rem; }
.field small { display: block; color: var(--ink-3); font-size: 0.78rem; margin-top: 0.3rem; }
.error { color: var(--danger); font-size: 0.88rem; min-height: 1.3em; margin: 0.2rem 0 0.8rem; }

/* the admin page's theme button goes light → dark → wine → light, and shows the next one: a moon in light, a drop
   in dark, a sun in wine (the app's button has one icon and opens its theme screen) */
.theme-toggle .sun, .theme-toggle .drop { display: none; }
:root[data-theme='dark'] .theme-toggle .moon { display: none; }
:root[data-theme='dark'] .theme-toggle .drop { display: block; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) .theme-toggle .moon { display: none; }
  :root:not([data-theme]) .theme-toggle .drop { display: block; }
}
:root[data-theme='wine'] .theme-toggle .moon { display: none; }
:root[data-theme='wine'] .theme-toggle .sun { display: block; }

/* ---------- sign in, register, pending ---------- */

.gate {
  min-height: 100%;
  display: grid; place-items: center;
  /* room at the top for the corner buttons (globe, light/dark), so a tall card never runs under them */
  padding: calc(72px + var(--inset-top)) 16px calc(2rem + var(--inset-bottom));
  background:
    radial-gradient(60rem 30rem at 50% -10%, var(--accent-soft), transparent 70%),
    var(--bg);
}
.gate .corner { position: fixed; top: calc(16px + var(--inset-top)); right: 16px; }
.gate .corner-left { position: fixed; top: calc(16px + var(--inset-top)); left: 16px; }

/* the language pill (globe + EN or BM): opens the first screen again */
.region {
  display: inline-flex; align-items: center; gap: 0.35rem; height: 40px; padding: 0 0.8rem 0 0.7rem;
  border-radius: 999px; border: 1px solid var(--line); background: var(--surface); color: var(--ink-2);
  font-weight: 600; font-size: 0.8rem; letter-spacing: 0.04em;
}
.region:hover { background: var(--surface-2); color: var(--ink); }
.region svg { width: 17px; height: 17px; }
.card {
  width: 100%; max-width: 400px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 20px;
  padding: 2rem 1.6rem 1.6rem; box-shadow: var(--shadow);
}
.card header { text-align: center; margin-bottom: 1.6rem; }
.tabs { display: grid; grid-template-columns: 1fr 1fr; background: var(--surface-2); border-radius: 999px; padding: 4px; margin-bottom: 1.4rem; }
.tabs button { border: 0; background: transparent; border-radius: 999px; padding: 0.5rem; font-weight: 600; color: var(--ink-3); }
.tabs button[aria-selected='true'], .tabs button[aria-checked='true'] { background: var(--surface); color: var(--ink); box-shadow: 0 1px 3px rgb(0 0 0 / 10%); }

/* the first screen: language, then country */
.pick-label { font-size: 0.82rem; font-weight: 600; color: var(--ink-2); margin: 0 0 0.45rem; }
#welcome.lang-only #country-label, #welcome.lang-only #country-pick { display: none; }
.choices { display: grid; gap: 0.4rem; margin-bottom: 1.4rem; }
.choice {
  display: flex; align-items: center; justify-content: space-between; gap: 0.6rem; width: 100%;
  padding: 0.7rem 0.95rem; border-radius: 10px; border: 1px solid var(--line); background: var(--bg);
  text-align: left; color: var(--ink);
}
.choice:hover { border-color: var(--ink-3); }
.choice[aria-checked='true'] { border-color: var(--accent); background: var(--accent-soft); font-weight: 600; }
.choice svg { width: 18px; height: 18px; flex: none; color: var(--accent); visibility: hidden; }
.choice[aria-checked='true'] svg { visibility: visible; }

/* the second screen: light or dark. Each preview keeps its own colours, whatever the page shows. */
.look-title, .card-title { font-family: var(--serif); font-weight: 600; font-size: 1.75rem; line-height: 1.15; text-align: center; margin: 0.2rem 0 1.4rem; }
.looks { display: grid; grid-template-columns: 1fr 1fr; gap: 0.8rem; margin-bottom: 1.4rem; }
.look-pick, .menu-pick { display: grid; gap: 0.6rem; padding: 0; border: 0; background: none; color: var(--ink); text-align: center; }
.preview {
  --pv-bg: #f6f2ea; --pv-surface: #fffdf8; --pv-line: #e2d9ca; --pv-ink: #8c8476; --pv-me: #ece3d3; --pv-accent: #9a5b22; --pv-soft: #f3e4cf;
  display: flex; flex-direction: column; gap: 9px; height: 168px; padding: 12px 10px 10px;
  border-radius: 14px; border: 1px solid var(--pv-line); background: var(--pv-bg);
  transition: box-shadow 0.15s;
}
.looks.three { grid-template-columns: repeat(3, 1fr); gap: 0.55rem; }
.preview.wine { --pv-bg: #210c14; --pv-surface: #2c111b; --pv-line: #48202f; --pv-ink: #a3857c; --pv-me: #3d1826; --pv-accent: #e3b46a; --pv-soft: #4a2a1c; }
.preview.dark { --pv-bg: #12110f; --pv-surface: #1b1916; --pv-line: #2f2b26; --pv-ink: #807868; --pv-me: #2a2620; --pv-accent: #d9a35b; --pv-soft: #352816; }
.preview i { display: block; }
.pv-title { width: 46%; height: 7px; border-radius: 4px; background: var(--pv-ink); opacity: 0.7; }
.pv-me { width: 58%; height: 20px; margin-left: auto; border-radius: 10px 10px 3px 10px; background: var(--pv-me); }
.pv-ai { display: flex; gap: 6px; }
.pv-who { width: 14px; height: 14px; flex: none; border-radius: 99px; background: var(--pv-soft); }
.pv-lines { flex: 1; display: grid; gap: 5px; padding-top: 2px; }
.pv-lines i { height: 5px; border-radius: 3px; background: var(--pv-ink); opacity: 0.55; }
.pv-lines i:nth-child(2) { width: 85%; }
.pv-lines i:nth-child(3) { width: 60%; }
.pv-input { margin-top: auto; height: 22px; border-radius: 99px; border: 1px solid var(--pv-line); background: var(--pv-surface); position: relative; }
.pv-input i { position: absolute; right: 3px; top: 3px; width: 14px; height: 14px; border-radius: 99px; background: var(--pv-accent); }
.look-pick[aria-checked='true'] .preview, .menu-pick[aria-checked='true'] .preview { box-shadow: 0 0 0 2px var(--bg), 0 0 0 4px var(--accent); }
.look-name { display: inline-flex; align-items: center; justify-content: center; gap: 0.45rem; font-weight: 600; font-size: 0.95rem; color: var(--ink-2); }
.look-pick[aria-checked='true'] .look-name, .menu-pick[aria-checked='true'] .look-name { color: var(--ink); }
.look-name .dot { width: 16px; height: 16px; border-radius: 99px; border: 2px solid var(--ink-3); }
.look-pick[aria-checked='true'] .dot, .menu-pick[aria-checked='true'] .dot { border: 5px solid var(--accent); }

/* the third screen: the Home style, each preview a small Home. Minimal follows the page's theme; Vivid is the night sky. */
.menu-pick { align-content: start; }
.menu-sub { font-size: 0.8rem; line-height: 1.35; color: var(--ink-3); margin-top: -0.3rem; }
.home-pv { position: relative; overflow: hidden; align-items: center; gap: 6px; padding-top: 30px; }
.home-pv.minimal { --pv-bg: var(--bg); --pv-surface: var(--surface); --pv-line: var(--line); --pv-ink: var(--ink-3); --pv-accent: var(--accent); }
.home-pv.vivid { --pv-line: #2a3158; --pv-ink: #d9d3c6; --pv-surface: rgb(255 253 248 / 12%); --pv-accent: #e8b56c;
  background: radial-gradient(1px 1px at 20% 18%, #fff 50%, transparent), radial-gradient(1px 1px at 70% 30%, #fff 50%, transparent),
    radial-gradient(1.5px 1.5px at 40% 12%, #fff 50%, transparent), radial-gradient(1px 1px at 85% 52%, #fff 50%, transparent),
    radial-gradient(1px 1px at 12% 46%, #fff 50%, transparent), linear-gradient(180deg, #0b1027 0%, #1d1b3d 55%, #3a2742 100%); }
.hp-ic { width: 12px; height: 12px; border-radius: 99px; background: var(--pv-accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--pv-accent) 25%, transparent); }
.hp-moon { position: absolute; right: 18px; top: 12px; width: 16px; height: 16px; border-radius: 99px; box-shadow: -4px 2px 0 0 #f1dfb8; }
.hp-when { width: 34%; height: 4px; border-radius: 2px; background: var(--pv-ink); opacity: 0.45; }
.hp-title { width: 62%; height: 8px; border-radius: 4px; background: var(--pv-ink); opacity: 0.8; }
.hp-hills { position: absolute; left: -10%; right: -10%; bottom: 0; height: 42%;
  background: radial-gradient(60% 70% at 25% 100%, #2c2752 98%, transparent), radial-gradient(70% 60% at 80% 100%, #231e42 98%, transparent); }
.home-pv .hp-dock { position: absolute; left: 8px; right: 8px; bottom: 8px; height: 24px; display: flex; align-items: center; justify-content: space-around;
  border-radius: 9px; border: 1px solid var(--pv-line); background: var(--pv-surface); }
.home-pv .hp-dock i { width: 9px; height: 9px; border-radius: 3px; background: var(--pv-ink); opacity: 0.75; }
.home-pv .hp-dock i:last-child { background: var(--pv-accent); opacity: 1; }
.fineprint { text-align: center; color: var(--ink-3); font-size: 0.8rem; margin: 1rem 0 0; }

.pending { text-align: center; }
.pending .seal {
  width: 72px; height: 72px; margin: 0.4rem auto 1.2rem; border-radius: 999px;
  display: grid; place-items: center; background: var(--accent-soft); color: var(--accent);
}
.pending .seal svg { width: 32px; height: 32px; }
.pending h2 { font-family: var(--serif); font-size: 2rem; font-weight: 600; margin: 0 0 0.4rem; }
.pending p { color: var(--ink-2); margin: 0 0 1.4rem; }
.pending .row { display: flex; gap: 0.6rem; justify-content: center; flex-wrap: wrap; }

/* ---------- chat ---------- */

.chat { display: grid; grid-template-columns: 280px 1fr; height: 100dvh; }
.side {
  display: flex; flex-direction: column; min-height: 0;
  background: var(--surface); border-right: 1px solid var(--line);
  padding: calc(1rem + var(--inset-top)) 0.75rem calc(0.75rem + var(--inset-bottom));
}
.side .top { display: flex; align-items: center; justify-content: space-between; gap: 0.5rem; padding: 0 0.4rem 1rem; }
.side .tools { display: flex; gap: 0.4rem; }
.side .region { height: 34px; padding: 0 0.65rem 0 0.55rem; }
.side .theme-toggle { width: 34px; height: 34px; }
.side .brand { font-size: 1.7rem; }
.side .new { margin: 0 0.25rem 0.9rem; }
.side nav { flex: 1; overflow-y: auto; min-height: 0; }
.side .label { font-size: 0.72rem; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-3); padding: 0.4rem 0.6rem; }
.chat-link {
  display: flex; align-items: center; gap: 0.3rem; width: 100%;
  border: 0; background: transparent; text-align: left;
  padding: 0.55rem 0.6rem; border-radius: 10px; color: var(--ink-2);
}
.chat-link:hover { background: var(--surface-2); color: var(--ink); }
.chat-link.on { background: var(--accent-soft); color: var(--ink); }
.chat-link .t { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 0.92rem; }
.chat-link .del { opacity: 0; border: 0; background: none; color: var(--ink-3); padding: 0.1rem 0.3rem; border-radius: 6px; }
.chat-link:hover .del, .chat-link.on .del { opacity: 1; }
.chat-link .del:hover { color: var(--danger); }
.side .me {
  display: flex; align-items: center; gap: 0.6rem;
  border-top: 1px solid var(--line); padding: 0.8rem 0.4rem 0; margin-top: 0.6rem;
}
.avatar {
  width: 34px; height: 34px; border-radius: 999px; flex: none;
  display: grid; place-items: center; font-weight: 700; font-size: 0.9rem;
  background: var(--accent); color: var(--accent-ink);
}
.side .me .name { flex: 1; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.side .me .icon-btn { width: 34px; height: 34px; }

.main { display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.bar {
  display: flex; align-items: center; gap: 0.6rem;
  padding: calc(0.7rem + var(--inset-top)) 16px 0.7rem; border-bottom: 1px solid var(--line); background: var(--bg);
}
.bar .title { flex: 1; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar .menu { display: none; }

.thread { flex: 1; overflow-y: auto; min-height: 0; padding: 1.5rem 16px 1rem; }
.thread .inner { max-width: 760px; margin: 0 auto; }
.empty { text-align: center; padding: 12vh 0 2rem; animation: rise 0.6s ease both; }
.empty .sky { width: 44px; height: 44px; margin: 0 auto 0.9rem; color: var(--accent); }
.empty .sky svg { width: 100%; height: 100%; }
.empty h2 { font-family: var(--serif); font-weight: 600; font-size: 2.3rem; line-height: 1.15; margin: 0; overflow-wrap: anywhere; }
@keyframes rise { from { opacity: 0; transform: translateY(6px); } }
@media (prefers-reduced-motion: reduce) { .empty { animation: none; } }

.msg { display: flex; gap: 0.8rem; margin: 0 0 1.4rem; }
.msg.me { justify-content: flex-end; }
.msg.me .body {
  background: var(--me); border-radius: 18px 18px 4px 18px; padding: 0.65rem 1rem;
  max-width: min(80%, 560px); white-space: pre-wrap; overflow-wrap: anywhere;
}
.msg.ai .who {
  width: 30px; height: 30px; border-radius: 999px; flex: none; margin-top: 2px;
  display: grid; place-items: center; background: var(--accent-soft); color: var(--accent);
  font-family: var(--serif); font-weight: 700;
}
.msg.ai .body { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.msg.ai .body > :first-child { margin-top: 0; }
.msg.ai .body > :last-child { margin-bottom: 0; }
.msg.ai .body p, .msg.ai .body ul, .msg.ai .body ol, .msg.ai .body pre, .msg.ai .body blockquote, .msg.ai .body table { margin: 0 0 0.8rem; }
.msg.ai .body h1, .msg.ai .body h2, .msg.ai .body h3 { font-size: 1.1rem; margin: 1.1rem 0 0.5rem; }
.msg.ai .body ul, .msg.ai .body ol { padding-left: 1.4rem; }
.msg.ai .body code { font-family: var(--mono); font-size: 0.88em; background: var(--surface-2); padding: 0.1em 0.35em; border-radius: 5px; }
.msg.ai .body pre { background: var(--surface-2); border: 1px solid var(--line); border-radius: 10px; padding: 0.8rem 1rem; overflow-x: auto; }
.msg.ai .body pre code { background: none; padding: 0; font-size: 0.85rem; }
.msg.ai .body blockquote { border-left: 3px solid var(--accent); padding-left: 0.9rem; color: var(--ink-2); }
.msg.ai .body table { border-collapse: collapse; display: block; overflow-x: auto; }
.msg.ai .body th, .msg.ai .body td { border: 1px solid var(--line); padding: 0.35rem 0.6rem; text-align: left; }
.msg.ai .body hr { border: 0; border-top: 1px solid var(--line); margin: 1rem 0; }
.msg .fail { color: var(--danger); font-size: 0.88rem; margin: 0.4rem 0 0.5rem; }
.msg.ai .body .note { color: var(--ink-3); font-size: 0.82rem; margin: 0.4rem 0 0; }

/* under an answer: Copy, and Retry on the last one; light until touched */
.acts { display: flex; gap: 2px; margin: 0.3rem 0 0 -7px; }
.acts .act {
  width: 30px; height: 30px; display: grid; place-items: center; padding: 0;
  border: 0; border-radius: 8px; background: none; color: var(--ink-3); opacity: 0.8;
}
.acts .act:hover { background: var(--surface-2); color: var(--ink-2); opacity: 1; }
.acts .act svg { width: 16px; height: 16px; }

/* a long press on the member's own message: Copy */
.msg.me { position: relative; }
.msg.me.held .body { filter: brightness(0.94); }
.hold-menu { position: absolute; right: 0; bottom: calc(100% + 6px); z-index: 5; }
.hold-menu.below { bottom: auto; top: calc(100% + 6px); }
.hold-menu button {
  display: inline-flex; align-items: center; gap: 0.45rem; padding: 0.5rem 0.9rem;
  border: 1px solid var(--line); border-radius: 12px; background: var(--surface); color: var(--ink);
  font-size: 0.9rem; font-weight: 500; box-shadow: var(--shadow);
}
.hold-menu svg { width: 16px; height: 16px; color: var(--ink-2); }
@media (pointer: coarse) {
  .msg.me .body { -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
}
.msg .retry { padding: 0.4rem 1rem; font-size: 0.85rem; }
.typing { display: inline-flex; gap: 4px; padding: 0.6rem 0; }
.typing i { width: 7px; height: 7px; border-radius: 99px; background: var(--ink-3); animation: blink 1.2s infinite ease-in-out; }
.typing i:nth-child(2) { animation-delay: 0.15s; }
.typing i:nth-child(3) { animation-delay: 0.3s; }
@keyframes blink { 0%, 80%, 100% { opacity: 0.25; } 40% { opacity: 1; } }

.composer { padding: 0.6rem 16px calc(0.9rem + var(--inset-bottom)); }
.composer form {
  max-width: 760px; margin: 0 auto; display: flex; align-items: flex-end; gap: 0.5rem;
  background: var(--surface); border: 1px solid var(--line); border-radius: 22px;
  padding: 0.45rem 0.45rem 0.45rem 1rem; box-shadow: var(--shadow);
}
.composer form:focus-within { border-color: var(--accent); }
.composer textarea {
  flex: 1; border: 0; outline: none; background: transparent; resize: none;
  max-height: 40vh; padding: 0.5rem 0; line-height: 1.45;
}
.composer .send { width: 40px; height: 40px; padding: 0; flex: none; }
.composer .send svg { width: 18px; height: 18px; }
.composer .send .square { display: none; }
.composer .send.stop .arrow { display: none; }
.composer .send.stop .square { display: block; }
.composer .hint { max-width: 760px; margin: 0.4rem auto 0; text-align: center; color: var(--ink-3); font-size: 0.75rem; }

.scrim { display: none; }

/* ---------- home: the sky of the hour, the greeting, the tools in a dock ---------- */

.home {
  --sky-ink: #f3e9d8; --sky-ink-2: rgb(243 233 216 / 70%); --sky-acc: #e8b56c;
  --glass: rgb(255 253 248 / 10%); --glass-line: rgb(255 255 255 / 16%);
  position: relative; min-height: 100dvh; overflow: hidden; display: flex; flex-direction: column;
  color: var(--sky-ink); isolation: isolate;
}
.home[data-sky='light'] {
  --sky-ink: #2a2116; --sky-ink-2: rgb(42 33 22 / 70%); --sky-acc: #a8662a;
  --glass: rgb(255 253 248 / 42%); --glass-line: rgb(255 255 255 / 60%);
}
.sky-scene { position: absolute; inset: 0; z-index: -1; background: #0b1027; transition: background 0.6s; }
.home[data-part='late'] .sky-scene { background: linear-gradient(180deg, #070b1f 0%, #10142f 45%, #1d1a38 75%, #2a1f3d 100%); }
.home[data-part='night'] .sky-scene { background: linear-gradient(180deg, #0b1027 0%, #1d1b3d 45%, #3a2742 72%, #6e4630 100%); }
/* dawn and dusk: the night, lit silver from behind the hills (never orange) */
.home[data-part='dawn'] .sky-scene { background: linear-gradient(180deg, #0d1330 0%, #18234a 30%, #34507e 52%, #8eaacb 66%, #dce7f2 72%, #8eaacb 80%, #34507e 100%); }
.home[data-part='evening'] .sky-scene { background: linear-gradient(180deg, #0b1027 0%, #141c3a 34%, #283a62 56%, #5f7aa3 67%, #8ea6c6 72%, #3a4f78 82%, #1b2442 100%); }
/* day: warm parchment, a soft sun */
.home[data-sky='light'] .sky-scene { background: linear-gradient(180deg, #efe2cb 0%, #f2dfc0 35%, #f5e9d5 65%, #f8f1e4 100%); }
.home[data-sky='light'] .sky-scene::after { content: ''; position: absolute; inset: 0; pointer-events: none; opacity: 0.45; mix-blend-mode: multiply;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='180' height='180'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 0.2  0 0 0 0 0.15  0 0 0 0 0.1  0 0 0 0.2 0'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>"); }

.stars i { position: absolute; width: 2px; height: 2px; border-radius: 99px; background: #fff; animation: twinkle 4s ease-in-out infinite; }
.stars i.big { width: 3px; height: 3px; box-shadow: 0 0 6px rgb(255 255 255 / 70%); }
@keyframes twinkle { 50% { opacity: 0.2; } }
.orb { position: absolute; transform: translate(-50%, -50%); border-radius: 99px; }
.orb.moon { width: 52px; height: 52px; box-shadow: -13px 6px 0 0 #f1dfb8; filter: drop-shadow(0 0 18px rgb(241 223 184 / 25%)); }
/* the day's sun: a wide soft glow with a fine ring, no disc */
.orb.sun { width: 300px; height: 300px;
  background: radial-gradient(circle, rgb(255 250 236 / 95%) 0%, rgb(255 244 218 / 70%) 22%, rgb(255 238 204 / 30%) 45%, transparent 70%); }
.orb.sun::after { content: ''; position: absolute; left: 50%; top: 50%; width: 66px; height: 66px; transform: translate(-50%, -50%);
  border-radius: 99px; border: 1.5px solid rgb(176 128 64 / 50%); }
.glow { position: absolute; left: 0; right: 0; top: 58%; height: 26%; pointer-events: none; display: none;
  background: radial-gradient(60% 55% at 50% 60%, rgb(220 232 245 / 55%) 0%, rgb(170 195 225 / 18%) 55%, transparent 80%); }
.home[data-part='dawn'] .glow { display: block; }
.home[data-part='evening'] .glow { display: block; opacity: 0.55; }

/* the hills: four ridges, far to near, with mist between; colours per sky */
.hills { position: absolute; left: 0; right: 0; bottom: 0; width: 100%; height: 40%; }
.home { --h1a: #2c2752; --h1b: #241f44; --h2a: #231e42; --h2b: #1a1633; --h3a: #19152f; --h3b: #120f24; --h4a: #100d1f; --h4b: #0a0814; --mist: rgb(150 150 205 / 12%); }
.home[data-part='dawn'], .home[data-part='evening'] { --h1a: #4f6690; --h1b: #3b5078; --h2a: #364b70; --h2b: #283a5a; --h3a: #233250; --h3b: #1a2640; --h4a: #141c31; --h4b: #0d1324; --mist: rgb(215 228 244 / 26%); }
.home[data-sky='light'] { --h1a: #e3d5bb; --h1b: #d8c7a8; --h2a: #d0bc99; --h2b: #c2ab85; --h3a: #b49c78; --h3b: #a38a66; --h4a: #8f785a; --h4b: #7a6449; --mist: rgb(255 251 242 / 60%); }
.hills .h1a { stop-color: var(--h1a); } .hills .h1b { stop-color: var(--h1b); }
.hills .h2a { stop-color: var(--h2a); } .hills .h2b { stop-color: var(--h2b); }
.hills .h3a { stop-color: var(--h3a); } .hills .h3b { stop-color: var(--h3b); }
.hills .h4a { stop-color: var(--h4a); } .hills .h4b { stop-color: var(--h4b); }
.hills .mist0 { stop-color: var(--mist); stop-opacity: 0; } .hills .mist1 { stop-color: var(--mist); }

.home-top {
  display: flex; align-items: center; justify-content: space-between; gap: 0.5rem; width: 100%; max-width: 760px; margin: 0 auto;
  padding: calc(0.8rem + var(--inset-top)) 16px 0;
}
.home-top .brand { font-size: 1.7rem; color: var(--sky-ink); }
.home[data-sky='dark'] .home-top .brand .mark { color: #e8b56c; }
.home[data-sky='light'] .home-top .brand .mark { color: #9a5b22; }
.home-top .tools { display: flex; gap: 0.4rem; }
.home-top .region, .home-top .icon-btn { height: 36px; background: var(--glass); border-color: var(--glass-line); color: var(--sky-ink); backdrop-filter: blur(10px); }
.home-top .icon-btn { width: 36px; }

.hello { flex: 1; display: flex; flex-direction: column; justify-content: center; align-items: center; text-align: center; padding: 2rem 24px 40vh; animation: rise 0.6s ease both; }
.hello .when { font-size: 0.75rem; font-weight: 600; letter-spacing: 0.2em; text-transform: uppercase; color: var(--sky-ink-2); }
.hello h1 { font-family: var(--serif); font-weight: 600; font-size: clamp(2.3rem, 9vw, 3.4rem); line-height: 1.08; margin: 0.6rem 0 0; max-width: 14em; overflow-wrap: anywhere;
  text-shadow: 0 2px 24px rgb(0 0 0 / 18%); }

/* Voice: a light ring with no fill, in the middle just above the hills; the same place in every style and theme */
.voice { position: absolute; left: 50%; top: 58%; transform: translate(-50%, -50%); display: flex; flex-direction: column; align-items: center; gap: 6px; animation: rise 0.6s ease both; }
.voice-btn { position: relative; width: 74px; height: 74px; border-radius: 99px; display: grid; place-items: center; background: none; color: var(--sky-ink);
  border: 1.5px solid color-mix(in srgb, var(--sky-ink) 70%, transparent); transition: transform 0.12s, border-color 0.2s; }
.voice-btn svg { width: 34px; height: 34px; overflow: visible; }
.voice-btn .accs { fill: none; stroke: var(--sky-acc); }
.voice-btn .acc { fill: var(--sky-acc); }
.voice-btn:active { transform: scale(0.94); }
.voice-name { font: 600 0.95rem/1 var(--serif); color: var(--sky-ink-2); letter-spacing: 0.02em; }
.voice-name { transition: transform 0.3s; }
.voice-name .live { display: none; }
/* In a call the call stays right here: the ring turns amber, its bars move with whoever talks (--b1 to --b5, 0 to 1,
   from voice.js), a soft halo grows with the voice (--level), and the rest of Home steps back. Amber bars: the AI
   talks. */
.voice-btn::before { content: ''; position: absolute; inset: -1.5px; border-radius: 99px; pointer-events: none; opacity: 0;
  border: 1.5px solid color-mix(in srgb, var(--sky-acc) 60%, transparent); transition: opacity 0.3s; }
.voice-btn path { transform-box: fill-box; transform-origin: center; transition: transform 0.25s ease, stroke 0.3s; }
.voice:not([data-state='off']) .voice-btn { border-color: color-mix(in srgb, var(--sky-acc) 85%, transparent); }
.voice:not([data-state='off']) .voice-btn::before { opacity: calc(0.15 + var(--level, 0) * 0.6); transform: scale(calc(1.08 + var(--level, 0) * 0.22)); transition: none; }
.voice[data-state='listening'] .voice-btn::before { animation: halo 4s ease-in-out infinite; }
@keyframes halo { 50% { opacity: 0.4; } }
.voice:not([data-state='off']) .voice-btn path { transition: transform 0.06s linear, stroke 0.3s; }
.voice:not([data-state='off']) .b1 { transform: scaleY(calc(0.6 + var(--b1, 0) * 1.6)); }
.voice:not([data-state='off']) .b5 { transform: scaleY(calc(0.6 + var(--b5, 0) * 1.6)); }
.voice:not([data-state='off']) .b2 { transform: scaleY(calc(0.3 + var(--b2, 0) * 0.95)); }
.voice:not([data-state='off']) .b4 { transform: scaleY(calc(0.3 + var(--b4, 0) * 0.95)); }
.voice:not([data-state='off']) .b3 { transform: scaleY(calc(0.22 + var(--b3, 0) * 0.98)); }
.voice:not([data-state='off']) path:not(.accs) { stroke: var(--sky-ink); }
.voice[data-state='speaking'] .voice-btn path { stroke: var(--sky-acc); }
.voice[data-state='thinking'] .voice-btn path:not(.accs) { stroke: var(--sky-ink-2); }
.voice:not([data-state='off']) .voice-name { transform: translateY(10px); } /* clear of the halo; the ring stays put */
.voice:not([data-state='off']) .voice-name .idle { display: none; }
.voice:not([data-state='off']) .voice-name .live { display: inline; }
.home:has(.voice:not([data-state='off'])) :is(.home-top, .dock-wrap) { opacity: 0.25; pointer-events: none; transition: opacity 0.4s; }
.dock-wrap { position: absolute; left: 0; right: 0; bottom: 0; padding: 0 12px calc(14px + var(--inset-bottom)); display: grid; justify-items: center; }
.dock {
  width: 100%; max-width: 520px; display: grid; grid-template-columns: repeat(4, 1fr); padding: 14px 6px;
  border-radius: 28px; background: var(--glass); border: 1px solid var(--glass-line); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
}
.dock .tool { display: flex; flex-direction: column; align-items: center; gap: 4px; border: 0; background: none; padding: 2px 0; color: var(--sky-ink); font: 600 1.05rem/1.1 var(--serif); }
.dock .ic { width: 58px; height: 54px; display: grid; place-items: center; transition: transform 0.12s; }
.dock .ic svg { width: 50px; height: 50px; overflow: visible; }
.dock .ic .acc { fill: var(--sky-acc); }
.dock .tool:active .ic { transform: scale(0.92); }
.dock .tool.soon { opacity: 0.8; }
.soon-toast {
  margin-bottom: 10px; padding: 0.45rem 0.9rem; border-radius: 99px; font-size: 0.82rem; font-weight: 600;
  background: var(--glass); border: 1px solid var(--glass-line); color: var(--sky-ink); backdrop-filter: blur(10px);
}

/* Minimal: the theme's own plain page, the same greeting and dock; the part of the day is only the icon before the
   greeting, in the app's amber (and silver in the early morning). */
.part-ic { display: none; }
.home[data-style='minimal'] {
  --sky-ink: var(--ink); --sky-ink-2: var(--ink-3); --sky-acc: var(--accent);
  --glass: var(--surface); --glass-line: var(--line);
  background: var(--bg);
}
.home[data-style='minimal'] .sky-scene { display: none; }
.home[data-style='minimal'] .hello h1 { text-shadow: none; }
.home[data-style='minimal'] .dock { box-shadow: var(--shadow); backdrop-filter: none; -webkit-backdrop-filter: none; }
.home[data-style='minimal'] .part-ic { display: inline-block; width: 0.82em; height: 0.82em; margin-right: 0.26em; vertical-align: -0.06em; }
.part-ic svg { width: 100%; height: 100%; overflow: visible; }
.part-ic .acc { fill: var(--sky-acc); }
.part-ic .accs { fill: none; stroke: var(--sky-acc); stroke-width: 2.6; stroke-linecap: round; }
.part-ic .ink { fill: var(--sky-ink); }
.part-ic .silver { fill: var(--silver); }
@media (prefers-reduced-motion: reduce) { .stars i, .hello, .voice-btn::before { animation: none; } }


@media (max-width: 800px) {
  .chat { grid-template-columns: 1fr; }
  .side {
    position: fixed; inset: 0 auto 0 0; width: min(84vw, 300px); z-index: 20;
    transform: translateX(-102%); transition: transform 0.22s ease; box-shadow: var(--shadow);
  }
  .chat.open .side { transform: none; }
  .chat.open .scrim { display: block; position: fixed; inset: 0; z-index: 10; background: rgb(0 0 0 / 35%); }
  .bar .menu { display: inline-grid; }
  .chat-link .del { opacity: 1; }
}
