/* That Guy: the web chat page. The dark palette matches the Portal; light is the default for a first visit with a light system. */
:root {
  color-scheme: light;
  --bg: #f6f1ea; --panel: #ffffff; --panel2: #f1ebe3; --line: #ddd2c6;
  --text: #2a211b; --muted: #6e6258; --accent: #d25a0c; --accent2: #9a4a0c;
  --good: #1b8f5c; --bad: #c53030; --game: #7a3fc2; --mine: #fbe7d3; --mine-line: #e8b98f;
  --glow: #fbe6cf; --game-line: #c9a6e8; --err-line: #e3a0a0;
}
html[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0e0c0a; --panel: #1a1613; --panel2: #221d19; --line: #2f2822;
  --text: #efe9e3; --muted: #9b8f84; --accent: #ff7a1a; --accent2: #ffb347;
  --good: #3ecf8e; --bad: #ff5c5c; --game: #b26bff; --mine: #3a2414; --mine-line: #5a3417;
  --glow: #2a1a0e; --game-line: #4b2d6b; --err-line: #6a2a2a;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { height: 100%; }
body { margin: 0; display: flex; flex-direction: column; min-height: 100dvh; color: var(--text);
       background: radial-gradient(1200px 600px at 10% -10%, var(--glow) 0%, var(--bg) 55%) fixed;
       font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
a { color: var(--accent2); }

.top { display: flex; align-items: center; gap: 12px; padding: 12px 16px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.logo { font-weight: 800; letter-spacing: .18em; font-size: 15px; }
.logo span { color: var(--accent); }
.title { font-weight: 700; color: var(--accent2); }
.pill { padding: 3px 11px; border-radius: 99px; font-size: 12.5px; font-weight: 600; background: var(--panel2); border: 1px solid var(--line); }
.pill.game { color: var(--game); border-color: var(--game-line); }
.spacer { flex: 1; }
#theme-toggle { font-size: 16px; line-height: 1; }
.who { display: flex; gap: 8px; align-items: center; color: var(--muted); font-size: 14px; }
button.link { background: none; border: 0; color: var(--accent2); font: inherit; font-size: 13.5px; cursor: pointer; padding: 4px 6px; }
button.link.danger { color: var(--bad); }
button.link.bell { position: relative; font-size: 16px; }
button.link.bell.unread { color: var(--accent); }
.badge { display: inline-block; min-width: 18px; padding: 0 5px; border-radius: 99px; background: var(--accent); color: #1a0f05; font-size: 11px; font-weight: 800; line-height: 18px; text-align: center; vertical-align: top; }
.card.inbox { max-width: 560px; max-height: 85vh; overflow-y: auto; }
.inbox-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.inbox-head h1 { font-size: 20px; }
.inbox-list { display: flex; flex-direction: column; gap: 10px; margin-top: 12px; }
.mail { background: var(--panel2); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; }
.mail.new { border-color: var(--accent); }
.mail h2 { margin: 0 0 2px; font-size: 16px; }
.mail-body { white-space: pre-wrap; overflow-wrap: anywhere; margin: 8px 0 4px; }
button.link:disabled { opacity: .4; cursor: default; }

.center { flex: 1; display: grid; place-items: center; padding: 24px 16px; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 22px; max-width: 460px; width: 100%; }
.card h1 { margin: 0 0 4px; font-size: 26px; }
.tag { color: var(--muted); margin: 0 0 18px; }
.providers { display: grid; gap: 10px; margin: 6px 0 18px; }
.btn { display: block; text-align: center; text-decoration: none; font-weight: 700; border-radius: 10px; padding: 11px 14px;
       background: var(--accent); color: #1a0f05; }
.btn.discord { background: #5865f2; color: #fff; }
.btn.google { background: #fff; color: #1f1f1f; }
.overlay { position: fixed; inset: 0; z-index: 10; display: grid; place-items: center; padding: 16px;
           background: rgba(0, 0, 0, .7); }
.card .row { display: flex; gap: 10px; margin-top: 16px; }
.card .row .btn { flex: 1; border: 0; font: inherit; font-weight: 700; cursor: pointer; }
.btn.plain { background: var(--panel2); color: var(--text); border: 1px solid var(--line); }
.btn.danger { background: var(--bad); color: #1a0505; }
.btn:disabled { opacity: .5; cursor: wait; }
.note { background: var(--panel2); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; color: var(--accent2); }
.fine { color: var(--muted); font-size: 12.5px; margin: 0; }
.muted { color: var(--muted); }

.chat { flex: 1; display: flex; flex-direction: column; min-height: 0; width: 100%; max-width: 900px; margin: 0 auto; }
.slots { display: flex; gap: 6px; padding: 10px 12px 0; overflow-x: auto; scrollbar-width: thin; }
.slot { flex-shrink: 0; max-width: 180px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; cursor: pointer;
        background: var(--panel); border: 1px solid var(--line); color: var(--muted); border-radius: 10px; padding: 7px 12px;
        font: inherit; font-size: 13.5px; }
.slot.active { color: var(--text); border-color: var(--accent); }
.slot.empty { font-style: italic; }
.slot.writing::after { content: " ●"; color: var(--accent); }
.slot-bar { display: flex; align-items: center; gap: 4px; padding: 8px 14px 0; color: var(--muted); font-size: 13px; }
.slot-title { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.thread { flex: 1; min-height: 0; overflow-y: auto; padding: 12px 14px; display: flex; flex-direction: column; gap: 10px; }
.empty-thread { margin: auto; color: var(--muted); text-align: center; }
.msg { max-width: 85%; padding: 10px 13px; border-radius: 14px; overflow-wrap: anywhere; }
.msg.user { align-self: flex-end; background: var(--mine); border: 1px solid var(--mine-line); white-space: pre-wrap; }
.msg.assistant { align-self: flex-start; background: var(--panel); border: 1px solid var(--line); }
.msg.assistant.pending .body:empty { display: none; }
.msg.system { align-self: center; max-width: 92%; color: var(--accent2); font-size: 13.5px; text-align: center; }
.msg.error { border-color: var(--err-line); color: var(--bad); }
.msg .status { color: var(--muted); font-style: italic; }
.msg .foot { color: var(--muted); font-size: 11.5px; margin-top: 6px; }
.msg p { margin: 0 0 8px; }
.msg p:last-child { margin-bottom: 0; }
.msg ul, .msg ol { margin: 4px 0 8px; padding-left: 22px; }
.msg code { background: var(--panel2); padding: 1px 5px; border-radius: 5px; font-size: 13px; }
.msg pre { background: var(--panel2); padding: 10px 12px; border-radius: 8px; overflow-x: auto; margin: 6px 0; }
.msg pre code { background: none; padding: 0; }

.composer { display: grid; grid-template-columns: 1fr auto; gap: 8px; border-top: 1px solid var(--line); background: var(--bg);
            padding: 10px 12px calc(10px + env(safe-area-inset-bottom)); }
.composer textarea { resize: none; max-height: 40vh; background: var(--panel); color: var(--text); border: 1px solid var(--line);
                     border-radius: 12px; padding: 10px 12px; font: inherit; }
.composer textarea:focus { outline: none; border-color: var(--accent); }
.composer button { background: var(--accent); color: #1a0f05; border: 0; border-radius: 12px; padding: 0 18px; font: inherit;
                   font-weight: 700; cursor: pointer; }
.composer button:disabled { opacity: .5; cursor: wait; }
.meta { grid-column: 1 / -1; display: flex; justify-content: space-between; gap: 10px; color: var(--muted); font-size: 12px; min-height: 16px; }
.meta .over { color: var(--bad); font-weight: 700; }

@media (max-width: 600px) {
  .top { padding: 10px 12px; gap: 8px; }
  .logo { display: none; }
  .msg { max-width: 92%; }
  #hint { display: none; }
}
