:root {
  --page: #e9ebe8;
  --page-ink: #1d2320;
  --page-muted: #5f6964;
  --page-line: #d3d8d4;
  --panel: #f6f7f5;

  /* phone palette: iOS light, sage accent */
  --bg: #f2f3f0;
  --card: #ffffff;
  --ink: #1b1f1d;
  --muted: #7b837f;
  --faint: #b9bfbb;
  --line: #e7e9e6;
  --accent: #2f6a57;
  --accent-soft: #e4efea;
  --flash: #fff1b8;
  --gap: #b7791f;
  --danger: #c2412d;

  --enter: cubic-bezier(0.05, 0.7, 0.1, 1);
  --exit: cubic-bezier(0.3, 0, 0.8, 0.15);
  --std: cubic-bezier(0.2, 0, 0, 1);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) { --page: #141816; --page-ink: #e6ebe8; --page-muted: #9aa49f; --page-line: #2b322e; --panel: #1b201d; color-scheme: dark; }
}
:root[data-theme="dark"] { --page: #141816; --page-ink: #e6ebe8; --page-muted: #9aa49f; --page-line: #2b322e; --panel: #1b201d; color-scheme: dark; }

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; height: 100%; }
body { background: var(--page); color: var(--page-ink); font: 15px/1.45 -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, "Helvetica Neue", sans-serif; -webkit-font-smoothing: antialiased; }
button { font: inherit; color: inherit; cursor: pointer; }
button:focus-visible, input:focus-visible, select:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.stage { min-height: 100%; display: grid; grid-template-columns: minmax(220px, 320px) auto minmax(240px, 340px); gap: 48px; align-items: center; justify-content: center; padding-block: 32px; padding-inline: 24px; }

.eyebrow { font-size: 12px; letter-spacing: .08em; text-transform: uppercase; color: var(--page-muted); margin: 0 0 10px; font-weight: 600; }
.intro h1 { font-size: 30px; line-height: 1.15; letter-spacing: -.02em; margin: 0 0 14px; text-wrap: balance; }
.lede { color: var(--page-muted); margin: 0 0 20px; }
.intro-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 22px; }
.ghost-btn { border: 1px solid var(--page-line); background: var(--panel); border-radius: 999px; padding: 8px 14px; font-size: 14px; }
.ghost-btn:hover { border-color: var(--page-muted); }
.tips { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; color: var(--page-muted); font-size: 13.5px; }
.tips li { padding-left: 12px; border-left: 2px solid var(--page-line); }

/* ---------- phone ---------- */
.phone { position: relative; width: 390px; height: 844px; border-radius: 56px; background: #0d0f0e; padding: 12px; box-shadow: 0 30px 80px -30px rgba(0,0,0,.45), inset 0 0 0 2px #2a2d2b; }
.island { position: absolute; top: 22px; left: 50%; transform: translateX(-50%); width: 120px; height: 34px; background: #000; border-radius: 20px; z-index: 5; }
.screen { position: relative; height: 100%; border-radius: 45px; overflow: hidden; background: var(--bg); color: var(--ink); display: flex; flex-direction: column; }
.statusbar { height: 50px; flex: none; display: flex; justify-content: space-between; align-items: flex-end; padding: 0 30px 6px 34px; font-weight: 600; font-size: 15px; }
.sb-icons { display: flex; gap: 5px; align-items: center; }
.sb-icons i { display: block; width: 17px; height: 11px; border-radius: 3px; background: var(--ink); opacity: .85; }
.sb-icons i:last-child { width: 25px; border-radius: 4px; }

.app-head { flex: none; display: flex; justify-content: space-between; align-items: center; padding: 10px 20px 8px; }
.app-head h2 { margin: 0; font-size: 30px; letter-spacing: -.02em; line-height: 1.1; }
.counts { margin: 2px 0 0; color: var(--muted); font-size: 13.5px; font-variant-numeric: tabular-nums; transition: color .3s; }

.orb { width: 38px; height: 38px; border-radius: 50%; background: var(--accent-soft); display: grid; place-items: center; }
.orb span { width: 14px; height: 14px; border-radius: 50%; background: var(--accent); transition: transform .3s var(--std); }
.orb.listening span { animation: breathe 1.8s ease-in-out infinite; }
.orb.thinking span { animation: think 0.9s linear infinite; border-radius: 4px; }
.orb.speaking span { animation: talk .5s ease-in-out infinite alternate; }
@keyframes breathe { 50% { transform: scale(1.35); } }
@keyframes think { to { transform: rotate(360deg); } }
@keyframes talk { from { transform: scaleY(.6); } to { transform: scaleY(1.4); } }

.scroll { flex: 1; overflow-y: auto; padding: 4px 14px 0; scroll-behavior: smooth; scrollbar-width: none; }
.scroll::-webkit-scrollbar { display: none; }
.scroll-pad { height: 230px; }

/* ---------- rooms ---------- */
.room { background: var(--card); border-radius: 18px; margin-bottom: 10px; overflow: hidden; box-shadow: 0 1px 0 rgba(0,0,0,.03); transition: box-shadow .3s; }
.room.current { box-shadow: 0 0 0 1.5px var(--accent-soft), 0 6px 18px -12px rgba(47,106,87,.5); }
.room-head { width: 100%; display: flex; align-items: center; gap: 10px; padding: 14px 16px; background: none; border: 0; text-align: left; }
.room-name { font-weight: 650; font-size: 17px; letter-spacing: -.01em; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.room-name .old { color: var(--faint); text-decoration: line-through; font-weight: 500; margin-right: 6px; }
.here { font-size: 11px; font-weight: 600; color: var(--accent); background: var(--accent-soft); border-radius: 999px; padding: 2px 8px; }
.room-meta { color: var(--muted); font-size: 13px; font-variant-numeric: tabular-nums; }
.chev { width: 14px; height: 14px; fill: none; stroke: var(--faint); stroke-width: 2.2; transition: transform .28s var(--std); }
.room.open .chev { transform: rotate(90deg); }
.room-body { display: grid; grid-template-rows: 0fr; transition: grid-template-rows .32s var(--std); }
.room.open .room-body { grid-template-rows: 1fr; }
.room-body > div { overflow: hidden; }
.room-inner { padding: 0 16px 12px; }

.details { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.detail { font-size: 12.5px; background: var(--bg); border-radius: 999px; padding: 4px 10px; color: #4a524e; }
.detail b { font-weight: 600; color: var(--ink); }

.items { list-style: none; margin: 0; padding: 0; }
.item { border-top: 1px solid var(--line); }
.item:first-child { border-top: 0; }
.item-row { width: 100%; display: flex; align-items: center; gap: 12px; padding: 10px 0; background: none; border: 0; text-align: left; }
.glyph { width: 34px; height: 34px; border-radius: 10px; background: var(--bg); display: grid; place-items: center; flex: none; color: var(--accent); font-weight: 700; font-size: 13px; overflow: hidden; }
.glyph img { width: 100%; height: 100%; object-fit: cover; }
.item-main { flex: 1; min-width: 0; }
.item-name { font-weight: 560; display: flex; gap: 6px; align-items: baseline; }
.qty { color: var(--accent); font-weight: 650; font-variant-numeric: tabular-nums; }
.item-sub { color: var(--muted); font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.item-sub .missing { color: var(--gap); border-bottom: 1px dotted var(--gap); }
.item-sub .old, .val .old { text-decoration: line-through; color: var(--faint); margin-right: 4px; }
.edits { font-size: 11px; color: var(--muted); background: var(--bg); border-radius: 999px; padding: 1px 7px; font-variant-numeric: tabular-nums; }

.item-detail { display: grid; grid-template-rows: 0fr; transition: grid-template-rows .3s var(--std); }
.item.open .item-detail { grid-template-rows: 1fr; }
.item-detail > div { overflow: hidden; }
.fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; padding: 2px 0 10px 46px; }
.field { display: flex; flex-direction: column; background: var(--bg); border-radius: 10px; padding: 6px 9px; }
.field label { font-size: 10.5px; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }
.field input { border: 0; background: none; font: inherit; font-size: 14px; padding: 1px 0; color: var(--ink); min-width: 0; width: 100%; }
.field input::placeholder { color: var(--faint); }
.item-actions { display: flex; gap: 6px; padding: 0 0 10px 46px; flex-wrap: wrap; align-items: center; }
.pill-btn { border: 0; background: var(--bg); border-radius: 999px; padding: 5px 11px; font-size: 13px; }
.pill-btn.danger { color: var(--danger); }
.pill-btn select { border: 0; background: none; font: inherit; }
.photos { display: flex; gap: 6px; padding: 0 0 8px 46px; }
.photos img { width: 52px; height: 52px; object-fit: cover; border-radius: 10px; }
.changes { list-style: none; margin: 0; padding: 0 0 12px 46px; display: grid; gap: 6px; }
.changes li { font-size: 12.5px; color: #4a524e; }
.changes .src { font-size: 10.5px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); margin-right: 6px; }
.changes q { display: block; color: var(--muted); font-style: italic; quotes: "“" "”"; }

.history h4 { margin: 12px 0 6px; font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.timeline { list-style: none; margin: 0; padding: 0 0 0 14px; border-left: 2px solid var(--accent-soft); display: grid; gap: 8px; }
.timeline li { position: relative; font-size: 13.5px; }
.timeline li::before { content: ""; position: absolute; left: -19px; top: 6px; width: 8px; height: 8px; border-radius: 50%; background: var(--accent); }
.timeline .when { font-weight: 650; font-variant-numeric: tabular-nums; margin-right: 6px; }
.timeline .by { display: block; color: var(--muted); font-size: 12.5px; }
.home-history { background: var(--card); border-radius: 18px; padding: 14px 16px; margin-bottom: 10px; }
.home-history h3 { margin: 0 0 10px; font-size: 17px; }

/* change highlighting */
.flash { animation: flash 1.8s var(--std); }
@keyframes flash { 0%, 25% { background-color: var(--flash); } 100% { background-color: transparent; } }
.detail.flash, .field.flash { animation: flash-soft 1.8s var(--std); }
@keyframes flash-soft { 0%, 25% { background-color: var(--flash); } 100% { background-color: var(--bg); } }
.enter { animation: enter .32s var(--enter) both; }
@keyframes enter { from { opacity: 0; transform: translateY(8px); } }
.leaving { animation: leave .26s var(--exit) forwards; overflow: hidden; }
@keyframes leave { to { opacity: 0; transform: translateX(16px); max-height: 0; padding-block: 0; } }
.moved-note { font-size: 11.5px; color: var(--accent); }

/* ---------- dock ---------- */
.dock { position: absolute; left: 0; right: 0; bottom: 0; padding: 10px 14px 26px; background: linear-gradient(to top, var(--bg) 78%, rgba(242,243,240,0)); display: flex; flex-direction: column; gap: 8px; }
.qcard { background: var(--card); border-radius: 18px; padding: 12px 14px; box-shadow: 0 10px 30px -14px rgba(0,0,0,.28); animation: enter .34s var(--enter) both; }
.qcard.out { animation: qout .24s var(--exit) forwards; }
@keyframes qout { to { opacity: 0; transform: translateY(10px); } }
.qcard.spoken .q-dot { animation: breathe 1s ease-in-out 3; }
.q-top { display: flex; gap: 10px; align-items: flex-start; }
.q-dot { width: 10px; height: 10px; margin-top: 6px; border-radius: 50%; background: var(--accent); flex: none; }
.q-top p { margin: 0; font-weight: 560; font-size: 15px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; padding-left: 20px; }
.chip { border: 1px solid var(--line); background: var(--bg); border-radius: 999px; padding: 6px 12px; font-size: 13.5px; }
.chip:hover { border-color: var(--accent); }
.chip.primary { background: var(--accent); color: #fff; border-color: var(--accent); }
.chip.quiet { color: var(--muted); border-color: transparent; background: none; }
.live { margin: 0; min-height: 20px; text-align: center; font-size: 14px; color: var(--muted); padding: 0 10px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; direction: rtl; }
.live span { direction: ltr; unicode-bidi: plaintext; }
.typebar { display: flex; gap: 6px; }
.typebar input { flex: 1; border: 1px solid var(--line); border-radius: 999px; padding: 9px 14px; font: inherit; background: var(--card); color: var(--ink); }
.typebar button { border: 0; background: var(--accent); color: #fff; border-radius: 999px; padding: 0 16px; }
.controls { display: flex; align-items: center; justify-content: space-between; padding: 0 22px; }
.ctl { width: 46px; height: 46px; border-radius: 50%; border: 0; background: var(--card); display: grid; place-items: center; box-shadow: 0 1px 2px rgba(0,0,0,.06); }
.ctl svg, .mic svg { width: 22px; height: 22px; fill: none; stroke: var(--ink); stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.ctl[aria-pressed="true"] { background: var(--accent-soft); }
.ctl[aria-pressed="true"] svg { stroke: var(--accent); }
.ctl .spk-on { display: none; }
.ctl[aria-pressed="true"] .spk-on { display: block; }
.ctl[aria-pressed="true"] .spk-off { display: none; }
.mic { position: relative; width: 72px; height: 72px; border-radius: 50%; border: 0; background: var(--accent); display: grid; place-items: center; box-shadow: 0 10px 24px -10px rgba(47,106,87,.7); }
.mic svg { stroke: #fff; width: 28px; height: 28px; }
.mic .ring { position: absolute; inset: -6px; border-radius: 50%; border: 2px solid var(--accent); opacity: 0; transform: scale(calc(1 + var(--lvl, 0) * .35)); transition: transform .08s linear, opacity .3s; }
.mic.on { background: #1f4d3f; }
.mic.on .ring { opacity: .55; }
.toast { position: absolute; left: 14px; right: 14px; bottom: calc(100% + 4px); display: flex; align-items: center; justify-content: space-between; gap: 10px; background: #1b1f1d; color: #fff; border-radius: 14px; padding: 8px 8px 8px 14px; font-size: 13.5px; animation: enter .3s var(--enter) both; }
.toast button { border: 0; background: rgba(255,255,255,.14); color: #fff; border-radius: 10px; padding: 5px 10px; font-weight: 600; }

/* ---------- under the hood ---------- */
.hood { align-self: stretch; max-height: 844px; display: flex; flex-direction: column; }
.pipeline { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; font-size: 12.5px; color: var(--page-muted); margin-bottom: 14px; }
.pipeline span { border: 1px solid var(--page-line); border-radius: 6px; padding: 2px 7px; background: var(--panel); }
.pipeline i { font-style: normal; }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 14px; }
.stats div { background: var(--panel); border: 1px solid var(--page-line); border-radius: 10px; padding: 8px 10px; }
.stats b { display: block; font-size: 19px; font-variant-numeric: tabular-nums; }
.stats small { color: var(--page-muted); font-size: 11.5px; line-height: 1.25; display: block; }
.events { list-style: none; margin: 0; padding: 0; overflow-y: auto; display: flex; flex-direction: column; gap: 6px; font-size: 12.5px; }
.events li { background: var(--panel); border: 1px solid var(--page-line); border-radius: 10px; padding: 7px 10px; }
.events .t { color: var(--page-muted); font-variant-numeric: tabular-nums; margin-right: 6px; }
.events .ms { float: right; font-variant-numeric: tabular-nums; font-weight: 600; }
.events .said { display: block; color: var(--page-muted); font-style: italic; }
.events .err { color: var(--danger); }

@media (max-width: 1180px) {
  .stage { grid-template-columns: auto minmax(240px, 340px); }
  .intro { display: none; }
}
@media (max-width: 760px) {
  .stage { display: block; padding: 0; }
  .hood { display: none; }
  .phone { width: 100%; height: 100dvh; border-radius: 0; padding: 0; box-shadow: none; background: var(--bg); }
  .island { display: none; }
  .screen { border-radius: 0; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 1ms !important; transition-duration: 1ms !important; }
}

/* ---------- password overlay ---------- */
.lock { position: fixed; inset: 0; z-index: 2000; display: grid; place-items: center; padding-inline: 16px; background: rgba(20, 24, 22, .55); backdrop-filter: blur(10px); }
.lock-card { width: min(320px, 100%); background: var(--card); color: var(--ink); border-radius: 20px; padding: 22px; display: grid; gap: 10px; box-shadow: 0 20px 60px -20px rgba(0,0,0,.5); }
.lock-card h2 { margin: 0 0 4px; font-size: 20px; }
.lock-card label { font-size: 13px; color: var(--muted); font-weight: 600; }
.lock-card input { border: 1px solid var(--line); border-radius: 12px; padding: 11px 13px; font: inherit; background: var(--bg); color: var(--ink); }
.lock-card button { border: 0; border-radius: 12px; padding: 11px; background: var(--accent); color: #fff; font-weight: 600; }
.lock-err { margin: 0; color: var(--danger); font-size: 13.5px; }
