:root {
  color-scheme: light;
  --navy: #0b4a35; /* deep green: the guide's main colour */
  --navy-2: #0f5e44;
  --gold: #e0a91e;
  --gold-soft: #fbeab4;
  --cream: #f7f3ea;
  --ink: #1b2533;
  --muted: #6a7585;
  --line: #e6e9ef;
  --bubble: #f2f4f8;
  --card: #ffffff;
  --online: #2fb86b;
  --danger-bg: #fdecec;
  --danger: #b42318;
  --serif: Georgia, "Times New Roman", "Noto Serif", serif;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans", "Noto Sans Ethiopic", "Nyala", sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  font: 16px/1.5 var(--sans);
  color: var(--ink);
  background:
    radial-gradient(1200px 700px at 30% 100%, #fcdd0933, transparent 60%),
    radial-gradient(900px 600px at 0% 0%, #ffffff, transparent 70%),
    linear-gradient(160deg, #fbf8f0 0%, #eef3e6 55%, #dfeacd 100%);
  background-attachment: fixed;
}
.sprite { position: absolute; }
svg { width: 22px; height: 22px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }

.page {
  display: grid;
  grid-template-columns: 280px minmax(260px, 1fr) minmax(420px, 640px);
  height: 100dvh;
  max-width: 1440px;
  margin: 0 auto;
}

/* ---- left column ---- */
.side { display: flex; flex-direction: column; padding: 32px 22px 36px 28px; min-height: 0; }
.brand { display: flex; align-items: center; gap: 12px; margin-bottom: 36px; }
.flag { width: 58px; height: 44px; stroke: none; flex: none; filter: drop-shadow(0 2px 4px #0002); }
.brand-name { font: 700 1.75rem/1 var(--serif); color: var(--navy); letter-spacing: 0.3px; white-space: nowrap; }
.brand-sub { font: 600 0.92rem/1.3 var(--serif); color: var(--navy); white-space: nowrap; }
.brand-city { font: 0.62rem/1.4 var(--serif); letter-spacing: 1.6px; color: var(--navy); white-space: nowrap; }

.menu { display: flex; flex-direction: column; gap: 6px; }
.menu button {
  display: flex; align-items: center; gap: 16px;
  border: 0; background: transparent; color: var(--navy);
  font: 1.05rem var(--serif); text-align: left;
  padding: 13px 18px; border-radius: 16px; cursor: pointer;
}
.menu button:hover { background: #ffffff80; }
.menu button.active { background: var(--gold-soft); font-weight: 700; box-shadow: inset 0 0 0 1px #edd27a; }
.menu button.danger { color: var(--danger); }

.tagline { margin-top: auto; font: 1.2rem/1.45 var(--serif); color: var(--navy); }
.tagline b { font-weight: 700; }
.tagline::after { content: ""; display: block; width: 80px; height: 2px; margin-top: 14px; background: var(--gold); }

/* ---- receptionist figure: the white photo background melts into the page ---- */
.figure { position: relative; display: flex; align-items: flex-end; justify-content: center; overflow: hidden; min-height: 0; }
.figure img { height: 96%; width: auto; max-width: 125%; object-fit: contain; mix-blend-mode: multiply; margin-right: -60px; }

/* ---- chat card ---- */
.card {
  display: flex; flex-direction: column; min-height: 0; min-width: 0;
  margin: 20px 20px 20px 0;
  background: var(--card);
  border-radius: 30px;
  box-shadow: 0 20px 60px #2f4a2a26, 0 2px 8px #2f4a2a14;
  overflow: hidden;
}
.card-head { display: flex; align-items: center; gap: 14px; padding: 18px 22px; border-bottom: 1px solid var(--line); }
.avatar { border-radius: 50%; object-fit: cover; flex: none; background: #fff; }
.avatar.lg { width: 56px; height: 56px; box-shadow: 0 0 0 3px #fff, 0 2px 10px #0002; }
.avatar.sm { width: 46px; height: 46px; box-shadow: 0 0 0 2px #fff, 0 2px 8px #0002; }
.who { flex: 1; min-width: 0; }
.who h1 { margin: 0; font-size: 1.15rem; color: var(--navy); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.status { margin: 0; font-size: 0.9rem; color: var(--muted); display: flex; align-items: center; gap: 6px; }
.dot { width: 9px; height: 9px; border-radius: 50%; background: var(--online); }
.status.offline .dot { background: #c2c8d0; }

.round {
  display: inline-flex; align-items: center; justify-content: center; gap: 4px;
  height: 46px; min-width: 46px; padding: 0 12px;
  border: 0; border-radius: 999px; background: #f1f3f7; color: var(--navy); cursor: pointer;
  font: 600 0.8rem var(--sans);
}
.round:hover { background: #e7eaf0; }
.lang-wrap { position: relative; }
.lang-menu {
  position: absolute; right: 0; top: 54px; z-index: 5;
  display: flex; flex-direction: column; min-width: 170px; padding: 6px;
  background: #fff; border: 1px solid var(--line); border-radius: 16px; box-shadow: 0 12px 30px #0002;
}
.lang-menu[hidden] { display: none; }
.lang-menu button { border: 0; background: transparent; text-align: left; padding: 10px 12px; border-radius: 10px; font: 0.95rem var(--sans); color: var(--ink); cursor: pointer; }
.lang-menu button:hover, .lang-menu button[aria-pressed="true"] { background: #f1f3f7; font-weight: 600; }

/* ---- conversation ---- */
.log { flex: 1; overflow-y: auto; padding: 22px 22px 8px; display: flex; flex-direction: column; gap: 18px; }
.row { display: flex; gap: 12px; align-items: flex-start; }
.row.user { flex-direction: column; align-items: flex-end; }
.msg { display: flex; flex-direction: column; gap: 4px; max-width: 82%; }
.row.user .msg { align-items: flex-end; }
.bubble { padding: 13px 18px; border-radius: 20px; white-space: pre-wrap; overflow-wrap: anywhere; }
.row.assistant .bubble { background: var(--bubble); border-top-left-radius: 6px; }
.row.user .bubble { background: var(--navy); color: #fff; border-bottom-right-radius: 6px; }
.time { font-size: 0.78rem; color: var(--muted); padding: 0 4px; }
.bubble.pending::after { content: "● ● ●"; letter-spacing: 2px; color: var(--muted); animation: pulse 1.2s ease-in-out infinite; }
.bubble.emergency { background: var(--danger-bg) !important; color: var(--danger); font-weight: 600; box-shadow: inset 0 0 0 1px var(--danger); }
.bubble.error { color: var(--danger); }
@keyframes pulse { 50% { opacity: 0.3; } }

.quick { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; padding-left: 58px; }
.quick button {
  display: flex; align-items: center; gap: 12px;
  padding: 15px 16px; border: 1px solid var(--line); border-radius: 16px;
  background: #fff; color: var(--ink); font: 0.98rem var(--sans); text-align: left; cursor: pointer;
  box-shadow: 0 1px 2px #0000000a;
}
.quick button:hover { border-color: #c9d2e0; box-shadow: 0 4px 14px #0b4a3514; }
.quick button svg { color: var(--navy); width: 24px; height: 24px; }
.quick button span { flex: 1; }
.quick button .chev { width: 18px; height: 18px; color: #8792a2; }

/* ---- input ---- */
.composer {
  display: flex; align-items: flex-end; gap: 10px;
  margin: 10px 18px 6px; padding: 8px 8px 8px 22px;
  border: 1px solid var(--line); border-radius: 999px; background: #fff;
  box-shadow: 0 4px 18px #0b4a3510;
}
.composer textarea {
  flex: 1; resize: none; border: 0; outline: 0; background: transparent;
  font: 1rem/1.5 var(--sans); color: var(--ink); padding: 11px 0; max-height: 140px;
}
.composer textarea::placeholder { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.send { width: 52px; height: 52px; border: 0; border-radius: 50%; background: var(--navy); color: #fff; cursor: pointer; display: grid; place-items: center; }
.send:hover { background: var(--navy-2); }
.send:disabled, .composer textarea:disabled { opacity: 0.55; cursor: wait; }
.footnote { margin: 0; padding: 4px 22px calc(12px + env(safe-area-inset-bottom)); font-size: 0.74rem; color: var(--muted); text-align: center; }

/* ---- smaller screens ---- */
@media (max-width: 1180px) {
  .page { grid-template-columns: minmax(220px, 1fr) minmax(420px, 620px); }
  .side { display: none; }
}
@media (max-width: 820px) {
  body.cam-on .figure { display: block; position: fixed; top: 74px; right: 12px; width: 168px; height: 126px; padding: 0; z-index: 6; overflow: visible; }
  body.cam-on .figure img { display: none; }
  body.cam-on .selfview { width: 100%; height: 100%; border-radius: 16px; box-shadow: 0 0 0 3px #fff, 0 8px 20px #0004; }
  body.cam-on .selfview.seen { box-shadow: 0 0 0 3px var(--online), 0 8px 20px #0004; }
  body.cam-on .selfview-label, body.cam-on .selfview-state { font-size: 0.65rem; padding: 1px 7px; }
  body.cam-on .selfview-label { left: 6px; top: 5px; }
  body.cam-on .selfview-state { left: 6px; bottom: 5px; }
  body.cam-on .sound-hint { font-size: 0.7rem; padding: 4px 8px; }
  .mic { width: 46px; height: 46px; }
  .page { grid-template-columns: minmax(0, 1fr); }
  .figure { display: none; }
  .card { margin: 0; border-radius: 0; }
  .card-head { padding: 12px 14px; gap: 10px; }
  .avatar.lg { width: 46px; height: 46px; }
  .round { height: 40px; min-width: 40px; padding: 0 10px; }
  .log { padding: 16px 14px 6px; }
  .avatar.sm { width: 36px; height: 36px; }
  .quick { grid-template-columns: 1fr; padding-left: 0; gap: 8px; }
  .quick button { padding: 11px 14px; }
  .status { font-size: 0.82rem; }
  .who h1 { font-size: 1.02rem; }
  .msg { max-width: 88%; }
  .composer { margin: 8px 12px 4px; }
  .send { width: 46px; height: 46px; }
}

/* ---- camera greeting ---- */
.avatar-wrap { position: relative; flex: none; }
.avatar-wrap.watching .avatar { box-shadow: 0 0 0 3px #fff, 0 0 0 5px #9aa6b8; }
.avatar-wrap.seen .avatar { box-shadow: 0 0 0 3px #fff, 0 0 0 5px var(--online); animation: seen 1.6s ease-in-out infinite; }
@keyframes seen { 50% { box-shadow: 0 0 0 3px #fff, 0 0 0 9px #2fb86b55; } }

/* The visitor beside the receptionist, like a video call. */
/* Camera on: the visitor's live view, large at the top of the middle column; the receptionist below. */
@media (min-width: 821px) {
  body.cam-on .figure { flex-direction: column; align-items: center; justify-content: flex-start; gap: 8px; padding-top: 20px; }
  body.cam-on .figure img { flex: 1 1 0; height: auto; min-height: 0; width: auto; max-width: 100%; margin-right: 0; }
  body.cam-on .selfview { order: -1; width: 96%; }
}
.selfview {
  position: relative; flex: none; width: min(94%, 640px); aspect-ratio: 4 / 3; z-index: 2;
  border-radius: 22px; overflow: hidden; background: #0d1a2b;
  box-shadow: 0 0 0 4px #fff, 0 18px 40px #0b4a3540;
}
.selfview .cam-preview { width: 100%; height: 100%; object-fit: cover; transform: scaleX(-1); display: block; }
.selfview-label {
  position: absolute; left: 12px; top: 10px; padding: 3px 10px; border-radius: 999px;
  background: #0b4a35cc; color: #fff; font-size: 0.78rem; font-weight: 600;
}
.selfview.seen { box-shadow: 0 0 0 4px var(--online), 0 18px 40px #0b4a3540; }
.selfview-state {
  position: absolute; left: 12px; bottom: 10px; padding: 3px 10px 3px 8px; border-radius: 999px;
  background: #0b4a35cc; color: #fff; font-size: 0.78rem; font-weight: 600; display: flex; align-items: center; gap: 6px;
}
.selfview-state::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: #9aa6b8; }
.selfview.seen .selfview-state::before { background: var(--online); }
.sound-hint {
  position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); padding: 8px 14px; border-radius: 999px;
  background: #fff; color: var(--navy); font-weight: 600; font-size: 0.9rem; box-shadow: 0 6px 20px #0005; white-space: nowrap;
}
/* The gesture she just saw (public/gestures.js), shown for a moment. */
.gesture-chip {
  position: absolute; right: 12px; top: 10px; width: 56px; height: 56px; border-radius: 50%;
  background: #fff; display: grid; place-items: center; font-size: 2rem; box-shadow: 0 6px 20px #0005;
  animation: pop 0.25s ease-out;
}
@keyframes pop { from { transform: scale(0.6); opacity: 0; } }
.sound-hint[hidden], .selfview[hidden], .gesture-chip[hidden] { display: none; }

/* While she answers, the receptionist moves as if talking. */
body.speaking .figure img { animation: talking 0.5s ease-in-out infinite alternate; transform-origin: 50% 90%; }
@keyframes talking { to { transform: translateY(-4px) rotate(-0.4deg); } }

/* ---- voice messages ---- */
.mic { width: 52px; height: 52px; border: 0; border-radius: 50%; background: #f1f3f7; color: var(--navy); cursor: pointer; display: grid; place-items: center; flex: none; }
.mic:hover { background: #e7eaf0; }
/* hands-free on: navy; the visitor is talking: red pulse; she is working on it: dimmed */
.mic[aria-pressed="true"] { background: var(--navy); color: #fff; }
.mic[data-state="hearing"] { background: #d92d20; color: #fff; animation: recording 1.2s ease-in-out infinite; }
.mic[data-state="transcribing"], .mic[data-state="thinking"] { opacity: 0.6; }
@keyframes recording { 50% { box-shadow: 0 0 0 8px #d92d2033; } }
.mic:disabled { opacity: 0.55; cursor: wait; }
.bubble .voice-tag { display: inline-block; margin-right: 6px; opacity: 0.8; }

.cam-btn[aria-pressed="true"] { background: var(--navy); color: #fff; }
.cam-btn[aria-pressed="true"]:hover { background: var(--navy-2); }
.cam-note { font-size: 0.78rem; color: var(--muted); }
