:root {
  --bg: #f6f2ec; --paper: #fffdf9; --ink: #22303c; --muted: #6f7b87; --line: #e2dbd0;
  --accent: #b9532a; --accent-ink: #fffdf9; --soft: #f8e6db; --good: #2f7d5b; --warn: #b7791f;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #14181d; --paper: #1d232a; --ink: #e9ebee; --muted: #94a0ac; --line: #303943;
    --accent: #f0895c; --accent-ink: #14181d; --soft: #3a2a21; --good: #6cc79c; --warn: #e3b25a;
  }
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { background: var(--bg); color: var(--ink); font: 16px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
h1, h2, h3 { line-height: 1.2; margin: 0; }
button, input, select, textarea { font: inherit; color: inherit; }
[hidden] { display: none !important; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }

.btn { border: 2px solid var(--line); background: var(--paper); border-radius: 12px; padding: 10px 16px; font-weight: 700; cursor: pointer; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.small { padding: 6px 12px; font-size: 14px; border-radius: 10px; }
.btn.quiet { border-color: transparent; background: transparent; color: var(--muted); }
.btn:disabled { opacity: .45; cursor: default; }
input[type=text], input[type=email], input[type=password], input[type=date], input[type=time], input[type=url], select, textarea {
  width: 100%; padding: 10px 12px; border: 1.5px solid var(--line); border-radius: 10px; background: var(--paper);
}
textarea { min-height: 90px; resize: vertical; }
label { display: block; font-size: 14px; font-weight: 600; margin: 12px 0 4px; }
.muted { color: var(--muted); }
.error { color: var(--warn); font-weight: 600; min-height: 1.4em; }
.ok { color: var(--good); font-weight: 600; }

/* ---------- guest chat ---------- */
.guest { display: flex; flex-direction: column; height: 100dvh; max-width: 760px; margin: 0 auto; }
.guest header { display: flex; align-items: center; gap: 8px; padding: 12px 16px; border-bottom: 1px solid var(--line); }
.guest header h1 { flex: 1; font-size: 18px; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.guest header small { display: block; font-weight: 400; font-size: 12.5px; color: var(--muted); }
.icon-btn { width: 44px; height: 44px; border-radius: 50%; border: 1.5px solid var(--line); background: var(--paper); cursor: pointer; display: grid; place-items: center; flex: none; }
.icon-btn svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.icon-btn.on { background: var(--soft); border-color: var(--accent); color: var(--accent); }
.icon-btn.off { color: var(--muted); }
.thread { flex: 1; overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 10px; }
.msg { max-width: 85%; padding: 10px 14px; border-radius: 18px; white-space: pre-wrap; overflow-wrap: anywhere; }
.msg.bot { align-self: flex-start; background: var(--paper); border: 1px solid var(--line); border-bottom-left-radius: 6px; }
.msg.me { align-self: flex-end; background: var(--accent); color: var(--accent-ink); border-bottom-right-radius: 6px; }
.msg.note { align-self: center; background: none; color: var(--muted); font-size: 14px; text-align: center; padding: 2px 8px; }
.msg.thinking { color: var(--muted); font-style: italic; }
.msg .unlock-link { display: inline-block; margin-top: 8px; }
.composer { display: flex; gap: 8px; align-items: center; padding: 10px 16px calc(12px + env(safe-area-inset-bottom)); border-top: 1px solid var(--line); }
.composer input { flex: 1; border-radius: 999px; padding: 12px 16px; }
.mic { width: 56px; height: 56px; border-radius: 50%; border: 0; background: var(--accent); color: var(--accent-ink); cursor: pointer; display: grid; place-items: center; flex: none; transition: transform .15s; }
.mic svg { width: 26px; height: 26px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.mic.listening { animation: pulse 1.2s infinite; }
.mic:disabled { opacity: .5; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--accent) 60%, transparent); } 100% { box-shadow: 0 0 0 26px transparent; } }
@media (prefers-reduced-motion: reduce) { .mic.listening { animation: none; outline: 4px solid var(--ink); } }

/* tablet mode: the mic is the main thing on screen */
.tablet .guest { max-width: 980px; }
.tablet .thread { font-size: 24px; padding: 24px 32px; gap: 16px; }
.tablet .msg { padding: 16px 22px; border-radius: 26px; }
.tablet .composer { flex-direction: column; gap: 14px; padding: 18px 32px 28px; }
.tablet .mic { width: 132px; height: 132px; order: -1; }
.tablet .mic svg { width: 60px; height: 60px; }
.tablet .composer .type-row { display: flex; gap: 8px; width: 100%; max-width: 620px; }
.tablet .mic-hint { font-size: 20px; color: var(--muted); order: -1; margin: 0; }
.mic-hint { display: none; }
.tablet .mic-hint { display: block; }
.composer .type-row { display: contents; }

dialog { border: 0; border-radius: 20px; padding: 22px; background: var(--paper); color: var(--ink); width: min(360px, calc(100vw - 32px)); }
dialog::backdrop { background: rgba(0, 0, 0, .45); }
dialog h2 { font-size: 20px; margin-bottom: 6px; }
.dots { display: flex; justify-content: center; gap: 14px; margin: 18px 0 6px; }
.dots i { width: 18px; height: 18px; border-radius: 50%; border: 2px solid var(--muted); }
.dots i.full { background: var(--accent); border-color: var(--accent); }
.keys { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-top: 10px; }
.keys button { padding: 14px 0; font-size: 22px; font-weight: 700; border-radius: 14px; border: 1.5px solid var(--line); background: var(--bg); cursor: pointer; }
.keys button.wide { font-size: 15px; }
.dialog-actions { display: flex; justify-content: space-between; align-items: center; margin-top: 14px; gap: 8px; }

/* ---------- host pages ---------- */
.host { max-width: 860px; margin: 0 auto; padding: 16px 16px 60px; }
.host header { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.host header h1 { font-size: 22px; flex: 1; }
.card { background: var(--paper); border: 1.5px solid var(--line); border-radius: 16px; padding: 16px; margin-bottom: 14px; }
.card h2 { font-size: 18px; margin-bottom: 4px; }
.card h3 { font-size: 15px; margin: 16px 0 6px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.narrow { max-width: 420px; margin: 8vh auto 0; }
.tabs { display: flex; gap: 6px; overflow-x: auto; margin-bottom: 14px; padding-bottom: 2px; }
.tabs button { border: 1.5px solid var(--line); background: var(--paper); border-radius: 999px; padding: 8px 14px; font-weight: 600; cursor: pointer; white-space: nowrap; }
.tabs button[aria-selected=true] { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.count { display: inline-block; min-width: 20px; padding: 0 6px; margin-left: 6px; border-radius: 999px; background: var(--warn); color: var(--paper); font-size: 12.5px; text-align: center; }
.item { border-top: 1px solid var(--line); padding: 12px 0; }
.item:first-of-type { border-top: 0; }
.item-head { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.item-head strong { flex: 1; min-width: 0; }
.item p { margin: 4px 0 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.tag { font-size: 12px; font-weight: 700; padding: 2px 8px; border-radius: 999px; border: 1px solid var(--line); color: var(--muted); white-space: nowrap; }
.tag.lock { border-color: var(--accent); color: var(--accent); background: var(--soft); }
.tag.good { border-color: var(--good); color: var(--good); }
.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end; }
.row > * { flex: 1; min-width: 140px; }
.row > .fit { flex: 0 0 auto; min-width: 0; }
.check { display: flex; align-items: center; gap: 8px; font-weight: 600; margin: 12px 0; }
.check input { width: 20px; height: 20px; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }
.qr { display: flex; gap: 20px; flex-wrap: wrap; }
.qr figure { margin: 0; text-align: center; }
.qr img { width: 180px; height: 180px; background: #fff; border-radius: 12px; padding: 6px; display: block; }
.linkbox { font-family: ui-monospace, Consolas, monospace; font-size: 14px; overflow-wrap: anywhere; background: var(--bg); border-radius: 10px; padding: 10px 12px; }

a.btn { display: inline-block; text-decoration: none; color: var(--ink); }
a.btn.primary { color: var(--accent-ink); }
.tabs { scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }

/* ---------- guest: quick buttons, photos, wi-fi card ---------- */
.chips { display: flex; gap: 8px; overflow-x: auto; padding: 8px 16px 2px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip { flex: none; border: 1.5px solid var(--line); background: var(--paper); border-radius: 999px; padding: 8px 14px; font-size: 14.5px; font-weight: 600; cursor: pointer; white-space: nowrap; }
.chip:hover { border-color: var(--accent); }
.tablet .chips { flex-wrap: wrap; justify-content: center; padding: 10px 32px 0; gap: 10px; }
.tablet .chip { font-size: 19px; padding: 12px 20px; }
.msg .photo { display: block; width: 100%; max-width: 420px; border-radius: 12px; margin-top: 10px; }
.msg-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.msg-actions a { text-decoration: none; }
.fineprint { margin: 0; padding: 0 16px calc(8px + env(safe-area-inset-bottom)); font-size: 12.5px; color: var(--muted); text-align: center; }
.fineprint a { color: inherit; }
.guest .composer { padding-bottom: 8px; }
.wifi-qr { display: block; width: 190px; height: 190px; margin: 12px auto; background: #fff; border-radius: 12px; padding: 6px; }
.wifi-details { display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; margin: 0; }
.wifi-details dt { color: var(--muted); }
.wifi-details dd { margin: 0; font-weight: 700; font-size: 18px; overflow-wrap: anywhere; user-select: all; }

/* ---------- host: gap check, photos, activity ---------- */
.meter { height: 8px; border-radius: 4px; background: var(--line); overflow: hidden; margin: 10px 0 4px; }
.meter i { display: block; height: 100%; background: var(--good); border-radius: 4px; }
.gap { border-top: 1px solid var(--line); padding: 10px 0; }
.gap summary { cursor: pointer; font-weight: 600; }
.gap textarea { margin-top: 8px; }
.covered { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.thumb { display: block; max-width: 220px; max-height: 160px; border-radius: 10px; margin-top: 8px; }
.tag.warn { border-color: var(--warn); color: var(--warn); }
.convo { border-top: 1px solid var(--line); padding: 12px 0; }
.convo:first-of-type { border-top: 0; }
.convo .q { font-weight: 600; margin: 8px 0 0; }
.convo .a { margin: 2px 0 0; color: var(--muted); white-space: pre-wrap; overflow-wrap: anywhere; }
.copybox { white-space: pre-wrap; background: var(--bg); border-radius: 10px; padding: 10px 12px; font-size: 14.5px; margin: 6px 0; user-select: all; }

/* ---------- printable welcome card ---------- */
.welcome-card { max-width: 560px; margin: 24px auto; background: #fff; color: #22303c; border: 2px solid #22303c; border-radius: 20px; padding: 28px; text-align: center; }
.welcome-card h1 { font-size: 28px; margin-bottom: 4px; }
.welcome-card .lead { font-size: 17px; margin: 0 0 18px; }
.welcome-card .codes { display: flex; gap: 24px; justify-content: center; flex-wrap: wrap; }
.welcome-card figure { margin: 0; }
.welcome-card figure img { width: 200px; height: 200px; display: block; margin: 0 auto 6px; }
.welcome-card figcaption { font-weight: 700; }
.welcome-card .plain { margin-top: 18px; padding-top: 14px; border-top: 1px dashed #9aa3ab; font-size: 17px; }
.welcome-card .small { font-size: 13px; color: #6f7b87; margin-top: 14px; }
.print-bar { max-width: 560px; margin: 16px auto 0; display: flex; gap: 10px; align-items: center; padding: 0 16px; }
.print-bar .btn { flex: none; white-space: nowrap; }
@media print {
  body { background: #fff; }
  .print-bar { display: none; }
  .welcome-card { margin: 0 auto; border-color: #000; }
}

/* ---------- arrival page ---------- */
.arrive { max-width: 620px; margin: 0 auto; padding: 16px 16px calc(40px + env(safe-area-inset-bottom)); }
.arrive header p { margin: 0; }
.arrive header h1 { font-size: 28px; margin-bottom: 14px; }
.step { background: var(--paper); border: 1.5px solid var(--line); border-radius: 16px; padding: 16px; margin-bottom: 12px; }
.step h2 { font-size: 19px; display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.step .num { flex: none; width: 30px; height: 30px; border-radius: 50%; background: var(--accent); color: var(--accent-ink); display: grid; place-items: center; font-size: 16px; }
.step.help { border-color: var(--warn); }
.step.quiet { background: none; border: 0; padding: 4px 4px 0; }
.step.quiet p { margin: 6px 0; font-size: 14px; }
.step ul { margin: 8px 0; padding-left: 20px; }
.arrive-note { border-top: 1px solid var(--line); padding: 10px 0 4px; }
.arrive-note:first-child { border-top: 0; padding-top: 0; }
.arrive-note h3 { font-size: 15px; margin-bottom: 2px; }
.arrive-note p { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.arrive-note .photo { display: block; width: 100%; border-radius: 12px; margin-top: 10px; }
.address { font-weight: 700; font-size: 17px; margin: 0; }
.arrive .keys { max-width: 320px; margin-left: auto; margin-right: auto; }
.arrive .keys button { background: var(--bg); }
.saved-note { background: var(--soft); border-radius: 12px; padding: 10px 12px; font-size: 14.5px; }
.linklike { border: 0; background: none; padding: 0; color: var(--accent); font-weight: 700; text-decoration: underline; cursor: pointer; }

/* ---------- plain pages ---------- */
.prose { max-width: 680px; margin: 0 auto; padding: 24px 16px 60px; }
.prose h1 { font-size: 26px; margin-bottom: 10px; }
.prose h2 { font-size: 18px; margin: 22px 0 6px; }

.arrive .actions { margin: 10px 0; }
