:root {
  color-scheme: dark;
  --bg: #0f172a;
  --card: #1e293b;
  --accent: #38bdf8;
  --text: #e2e8f0;
  --muted: #94a3b8;
  --ok: #60a5fa;
  --warn: #fbbf24;
}
* { box-sizing: border-box; }
html, body {
  margin: 0;
  height: 100%;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  background: linear-gradient(180deg, #020617, #0f172a);
  color: var(--text);
}
.shell {
  min-height: calc(var(--vh, 1vh) * 100);
  padding: max(env(safe-area-inset-top), 1rem) 1rem max(env(safe-area-inset-bottom), 1rem);
  display: grid;
  place-items: center;
}
.card, .chat {
  width: min(1100px, 100%);
  background: rgba(30, 41, 59, 0.9);
  border: 1px solid rgba(148, 163, 184, 0.2);
  border-radius: 16px;
  padding: 1rem;
}
.lead { color: var(--muted); }
.tip { color: #7dd3fc; font-size: .95rem; }
.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 1rem; }
.room-form { display: grid; gap: .6rem; }
input, textarea, select, button {
  background: #0b1220;
  color: var(--text);
  border: 1px solid #334155;
  border-radius: 10px;
  padding: .75rem;
  font: inherit;
}
button { background: #0369a1; border: none; cursor: pointer; }
button:disabled { opacity: .55; cursor: not-allowed; }
button.warn { background: #b45309; }
.error { color: #fda4af; min-height: 1.2rem; }
.hidden { display: none !important; }
.chat {
  display: grid;
  grid-template-rows: auto auto auto auto 1fr auto;
  gap: .65rem;
  height: calc(var(--vh, 1vh) * 100 - 1.5rem);
  max-height: 920px;
}
.chat-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: .5rem;
}
.header-actions { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; }
.warning { color: var(--warn); margin: 0; }
.ai-readme {
  border: 1px solid #334155;
  border-radius: 10px;
  padding: .65rem .75rem;
  background: rgba(15, 23, 42, 0.8);
  color: #cbd5e1;
}
.ai-readme ul { margin: .4rem 0 0; padding-left: 1rem; }
.messages {
  overflow-y: auto;
  border: 1px solid #334155;
  border-radius: 12px;
  padding: .75rem;
  display: flex;
  flex-direction: column;
  gap: .5rem;
  min-height: 420px;
}
.message {
  max-width: 78%;
  padding: .55rem .65rem;
  border-radius: 12px;
  background: #1f2937;
  align-self: flex-start;
}
.message.me { background: #0c4a6e; align-self: flex-end; }
.message .meta { color: #bfdbfe; font-size: .75rem; display: flex; justify-content: space-between; gap: .4rem; }
.task-badge {
  display: inline-block;
  font-size: .7rem;
  border: 1px solid #93c5fd;
  color: #bfdbfe;
  border-radius: 999px;
  padding: .1rem .45rem;
  margin-bottom: .35rem;
}
.composer {
  display: grid;
  grid-template-columns: 1fr;
  gap: .45rem;
  position: sticky;
  bottom: 0;
  background: rgba(30,41,59,.95);
  padding-bottom: max(env(safe-area-inset-bottom), .2rem);
}
.composer textarea {
  min-height: 54px;
  max-height: 90px;
}
.composer-actions {
  display: grid;
  grid-template-columns: 220px 1fr auto;
  gap: .5rem;
  align-items: center;
}
@media (max-width: 900px) {
  .chat { height: calc(var(--vh, 1vh) * 100 - 1rem); }
  .message { max-width: 92%; }
  .composer-actions { grid-template-columns: 1fr; }
  .header-actions { width: 100%; }
}


#identity-label { color: #93c5fd; display: block; margin-top: .2rem; }
.sender { font-size: .72rem; color: #93c5fd; margin-bottom: .2rem; }
.toast {
  border: 1px solid #334155;
  border-radius: 10px;
  padding: .5rem .65rem;
  background: rgba(15, 23, 42, 0.92);
  color: #e2e8f0;
  font-size: .9rem;
}
.toast[data-level="warning"] { border-color: #f59e0b; color: #fde68a; }
.toast[data-level="success"] { border-color: #22c55e; color: #bbf7d0; }
.rules {
  border-top: 1px solid rgba(148, 163, 184, 0.25);
  padding-top: .55rem;
  color: #cbd5e1;
  font-size: .86rem;
}
.rules ol { margin: .35rem 0 0; padding-left: 1.15rem; }


.setup-guide {
  margin-top: 1rem;
  border: 1px solid rgba(56, 189, 248, 0.5);
  border-radius: 12px;
  background: rgba(2, 132, 199, 0.12);
  padding: .85rem;
}
.setup-guide h2 {
  margin-top: 0;
  margin-bottom: .4rem;
}
.setup-guide ol {
  margin: .4rem 0;
  padding-left: 1.2rem;
}
.setup-guide code {
  background: rgba(15, 23, 42, 0.9);
  border: 1px solid #334155;
  border-radius: 6px;
  padding: .05rem .35rem;
}

.quickstart {
  margin: .8rem 0 1rem;
  border: 1px solid rgba(125, 211, 252, 0.45);
  border-radius: 12px;
  background: rgba(14, 116, 144, 0.15);
  padding: .7rem .85rem;
}
.quickstart h2 {
  margin: 0 0 .4rem;
  font-size: 1rem;
}
.quickstart ol {
  margin: 0;
  padding-left: 1.2rem;
}
