/* Plain, functional layer. The loft scene and characters will replace the room view. */
:root {
  --bg: #fbf7f1;
  --ink: #2b2420;
  --muted: #6d625a;
  --accent: #b3262e;
  --accent-ink: #fff;
  --line: #e4d9cc;
  --card: #fff;
  --ok: #2f7d4a;
  --input-line: #9a8c80;  /* 3:1 against the page and card backgrounds */
  font-family: system-ui, -apple-system, "Segoe UI", "PingFang SC", "Noto Sans SC", sans-serif;
  font-size: 16px;
  color: var(--ink);
  background: var(--bg);
}
* { box-sizing: border-box; }
body { margin: 0; }
main { max-width: 560px; margin: 0 auto; padding: 16px 16px 96px; }
h1 { font-size: 1.5rem; margin: 8px 0 12px; overflow-wrap: anywhere; }
h2 { font-size: 1.15rem; margin: 20px 0 8px; overflow-wrap: anywhere; }
p { line-height: 1.5; }
.muted { color: var(--muted); font-size: .92rem; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 14px; margin: 12px 0; }
label { display: block; font-weight: 600; margin: 12px 0 4px; }
input, select, textarea {
  width: 100%; min-height: 44px; padding: 10px; font: inherit;
  border: 1px solid var(--input-line); border-radius: 8px; background: #fff; color: inherit;
}
input[type=checkbox] { width: 24px; min-height: 24px; height: 24px; vertical-align: middle; margin-right: 8px; }
.check { display: flex; align-items: center; font-weight: 400; min-height: 44px; }
button, .button {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 44px; min-width: 44px; padding: 10px 16px; margin: 4px 4px 4px 0;
  font: inherit; font-weight: 600; border-radius: 22px; border: 1px solid var(--line);
  background: #fff; color: var(--ink); cursor: pointer; text-decoration: none;
}
button.primary, .button.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
button:disabled { opacity: .5; cursor: default; }
.wide { width: 100%; }
.row { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; }
.error { color: var(--accent); font-weight: 600; min-height: 1.2em; }
.error:empty { display: none; }
.card.danger { border: 2px solid var(--accent); }
.warning { color: var(--accent); font-weight: 700; }
.notice { background: #fff4d6; border: 1px solid #ecd28c; border-radius: 10px; padding: 10px 12px; margin: 10px 0; }
.big { font-size: 1.6rem; font-weight: 700; margin: 4px 0; overflow-wrap: anywhere; }
.code { font-family: ui-monospace, monospace; font-size: 1.4rem; letter-spacing: .2em; }
.link-box { word-break: break-all; font-family: ui-monospace, monospace; font-size: .9rem; }
.toast {
  position: fixed; left: 50%; bottom: 16px; transform: translateX(-50%);
  background: var(--ink); color: #fff; border-radius: 12px; padding: 8px 12px;
  display: flex; gap: 8px; align-items: center; max-width: calc(100% - 32px);
}
.toast button { background: transparent; color: #fff; border-color: #fff; }

/* Room: a vertical list of zones with people chips (to be replaced by the loft). */
.topbar { position: sticky; top: 0; background: var(--bg); padding: 8px 0; z-index: 2; }
.jump { display: flex; gap: 4px; overflow-x: auto; padding-bottom: 4px; }
.jump a { flex: none; }
.zone { scroll-margin-top: 110px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; min-height: 44px; }
.chip { overflow-wrap: anywhere;
  display: inline-flex; align-items: center; gap: 6px; min-height: 44px; padding: 6px 12px;
  border-radius: 22px; border: 1px solid var(--line); background: #fff; font: inherit; cursor: pointer;
}
a.chip { color: inherit; text-decoration: none; }
.chip.me { border-color: var(--accent); }
/* The activity label never wraps mid-word: it shortens with "…" instead. */
.chip { max-width: 100%; }
.chip .act { color: var(--muted); font-size: .85rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.bubble { background: #fff; border: 1px solid var(--line); border-radius: 14px; padding: 6px 10px; margin: 4px 0; }
.events { font-size: .92rem; color: var(--muted); }
.actions { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 6px; }
.actions button { margin: 0; border-radius: 12px; }
.chatbar { position: fixed; left: 0; right: 0; bottom: 0; background: var(--bg); border-top: 1px solid var(--line); padding: 8px 12px; }
.chatbar .inner { max-width: 560px; margin: 0 auto; display: flex; gap: 6px; }
.chatbar input { flex: 1; }
.chatbar button { margin: 0; }
ul.plain { list-style: none; padding: 0; margin: 0; }
ul.plain li { padding: 8px 0; border-bottom: 1px solid var(--line); }
.person-row { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 4px; }

/* Small links are still 44 px to tap. */
.text-link { display: inline-flex; align-items: center; min-height: 44px; color: var(--accent); font-weight: 600; }

/* Danger actions (remove, redraw) look different and sit apart. */
button.danger { background: #fff; color: var(--accent); border: 2px solid var(--accent); }
.danger-zone { margin-top: 16px; padding-top: 12px; border-top: 1px dashed var(--accent); }
.danger-zone h3 { margin: 0 0 4px; font-size: 1rem; color: var(--accent); }

/* Our own confirm dialog. */
.shade { position: fixed; inset: 0; background: rgba(27, 20, 36, .45); display: flex; align-items: center;
  justify-content: center; padding: 16px; z-index: 50; }
.dialog { background: var(--card); border-radius: 14px; padding: 18px; width: 100%; max-width: 420px;
  box-shadow: 0 8px 30px rgba(0, 0, 0, .25); }
.dialog h2 { margin-top: 0; }
.dialog-buttons { justify-content: flex-end; margin-top: 12px; }

/* Host page: one-line rows, actions open in place. */
.todo { border: 2px solid var(--accent); }
.person { border-bottom: 1px solid var(--line); padding: 4px 0; }
ul.plain li.person { padding: 4px 0; }
.person-row .person-name { flex: 1; min-width: 0; overflow-wrap: anywhere; }
button.more { min-width: 44px; padding: 0 12px; font-size: 1.3rem; line-height: 1; }
.person-actions { padding: 4px 0 8px; }
details summary { min-height: 44px; display: flex; align-items: center; cursor: pointer; font-weight: 600; }

/* Compact navigation on phones. */
@media (max-width: 480px) {
  .compact-nav { flex-wrap: nowrap; overflow-x: auto; gap: 4px; padding-bottom: 4px; }
  .compact-nav .button, .compact-nav select { flex: none; padding: 8px 12px; margin: 0; font-size: .92rem; }
  .compact-nav .row { flex: none; }
  .compact-nav select { width: auto; }
}
