* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body { font: 13px Arial, Helvetica, sans-serif; color: #222; background: #fff; }
.chat { display: flex; flex-direction: column; width: 100%; height: 100%; height: 100dvh; border: 1px solid #aaa; }
header { flex: 0 0 auto; display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 7px 9px; background: #e8e8e8; background: linear-gradient(#fafafa,#e8e8e8); border-bottom: 1px solid #b9b9b9; }
header strong { font-size: 13px; }
#status { font-size: 11px; color: #777; text-align: right; }
#status.online { color: #32713c; }
#messages { flex: 1 1 auto; min-height: 0; overflow-y: auto; padding: 6px 8px; background: white; overflow-wrap: anywhere; }
.line { line-height: 18px; padding: 1px 0; white-space: pre-wrap; }
.nick { font-weight: bold; }
#composer { flex: 0 0 auto; border-top: 1px solid #bbb; padding: 6px; background: #eee; }
textarea { display: block; width: 100%; min-height: 46px; resize: none; border: 1px solid #a5a5a5; border-radius: 0; padding: 5px; font: inherit; color: #222; background: #fff; }
textarea:focus { outline: 1px solid #777; outline-offset: -1px; }
.controls { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-top: 5px; }
#nickname { color: #666; font-size: 11px; }
button { border: 1px solid #999; border-radius: 0; background: linear-gradient(#fff,#dedede); color: #222; font: bold 12px Arial, sans-serif; padding: 4px 16px; cursor: pointer; }
button:active { background: #ddd; }
button:disabled { opacity: .55; cursor: default; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
@media (max-width: 600px) { textarea { font-size: 16px; } }

/* v0.1.1: nickname control only. */
.nick-controls { display: flex; align-items: center; gap: 6px; min-width: 0; flex-wrap: wrap; }
#changeNick { font-size: 11px; font-weight: normal; padding: 2px 6px; }

/* v0.1.2: account control and login dialog only. */
#accountButton { font-size: 11px; font-weight: normal; padding: 2px 6px; }
#loginDialog { border: 1px solid #999; border-radius: 0; padding: 12px; width: 300px; max-width: calc(100% - 24px); background: #eee; color: #222; font: inherit; }
#loginDialog::backdrop { background: rgba(0,0,0,.3); }
#loginForm { display: flex; flex-direction: column; gap: 6px; }
#loginForm label { margin-top: 4px; }
#loginForm input { width: 100%; border: 1px solid #999; border-radius: 0; padding: 5px; font: inherit; }
#loginForm p { margin: 3px 0; font-size: 11px; color: #555; }
.login-actions { display: flex; justify-content: flex-end; gap: 6px; }

/* v0.1.3: optional online-user panel only. */
.header-controls { display: flex; align-items: center; gap: 8px; }
#usersButton { font-size: 11px; font-weight: normal; padding: 2px 6px; white-space: nowrap; }
#usersPanel[hidden] { display: none; }
#usersPanel { flex: 0 1 auto; min-height: 0; max-height: 30%; overflow-y: auto; border-top: 1px solid #bbb; background: #fafafa; padding: 6px 8px; }
#usersSummary { color: #666; font-size: 11px; }
#usersList { list-style: none; margin: 4px 0 0; padding: 0; }
#usersList li { line-height: 18px; overflow-wrap: anywhere; }

/* v0.1.11: compact rounded channel-role badges, before names. */
.role-badge { display: inline-flex; align-items: center; justify-content: center; height: 15px; vertical-align: middle; margin-right: 4px; padding: 0 5px; border-radius: 4px; font: bold 9px/1 Arial, sans-serif; color: #fff; white-space: nowrap; text-align: center; }
.role-staff { background: #2458bd; }
.role-admin { background: #c62828; }
.role-mod { background: #297037; }
.role-pro { background: #e67e22; }
.role-bot { background: #8039b0; }

/* v0.1.7: signup controls only; same classic dialog styling. */
#signupButton { font-size: 11px; font-weight: normal; padding: 2px 6px; }
#signupDialog { border: 1px solid #999; border-radius: 0; padding: 12px; width: 300px; max-width: calc(100% - 24px); background: #eee; color: #222; font: inherit; }
#signupDialog::backdrop { background: rgba(0,0,0,.3); }
#signupForm { display: flex; flex-direction: column; gap: 6px; }
#signupForm label { margin-top: 4px; }
#signupForm input { width: 100%; border: 1px solid #999; border-radius: 0; padding: 5px; font: inherit; }
#signupForm p { margin: 3px 0; font-size: 11px; color: #555; }
#signupError { color: #a12b28 !important; }
#signupError:empty { display: none; }


/* v0.1.9: classic upper-right icon tabs and their dropdowns only. */
header { position: relative; padding-right: 0; }
.header-controls { min-width: 0; gap: 6px; }
#status { overflow-wrap: anywhere; }
.header-tabs { display: flex; flex: 0 0 auto; align-self: stretch; margin: -7px 0; }
.header-tabs .icon-tab { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; width: 25px; min-height: 30px; padding: 3px 0; border: 0; border-left: 1px solid #c6c6c6; border-radius: 0; background: linear-gradient(#fafafa,#e6e6e6); color: #555; }
.header-tabs .icon-tab svg { width: 14px; height: 14px; fill: currentColor; }
.tab-arrow { width: 0; height: 0; border-left: 3px solid transparent; border-right: 3px solid transparent; border-top: 4px solid #999; }
.header-tabs .icon-tab:not(:disabled):hover, .header-tabs .icon-tab[aria-expanded="true"] { background: #ddd; }
#usersPanel, #settingsPanel { position: absolute; z-index: 2; top: 100%; right: 0; width: 190px; max-width: calc(100vw - 2px); max-height: min(40vh, 300px); overflow-y: auto; border: 1px solid #aaa; background: #fafafa; }
#settingsPanel { padding: 2px 0; }
#settingsPanel[hidden], #settingsPanel button[hidden] { display: none; }
#settingsPanel button { display: block; width: 100%; text-align: left; padding: 5px 9px; border: 0; background: transparent; font: 12px Arial, sans-serif; }
#settingsPanel button:not(:disabled):hover, #settingsPanel button:focus-visible { background: #e5e5e5; }

/* v0.1.15: keep long channel topics from displacing the header tabs. */
#roomTopic { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.header-controls { flex-shrink: 0; max-width: 70%; }

/* v0.1.18: green text for bot trivia questions only. */
.trivia-question { color: #297037; }

/* Hover timestamps: overlay only, no reserved space. */
.line { position: relative; }
.line[data-timestamp]:hover::after {
    content: attr(data-timestamp);
    position: absolute;
    top: 1px;
    right: 0;
    z-index: 1;
    font: 11px/18px Arial, sans-serif;
    color: #666;
    background: #fff;
    padding-left: 5px;
    white-space: nowrap;
    pointer-events: none;
}

/* Strange Company v0.1.0 — independent visual layer.
   Palette from Strange Company's supplied website and Lounge section. */
:root {
  color-scheme: dark;
  --bg: #101010; --panel: #141414; --panel2: #202020;
  --edge: #514c49; --accent: #f79599; --muted: #bcb2af;
  --text: #fff5ef; --soft: #f0e6e2; --input: #121111;
  /* Edit badge colors here; labels are at the top of chat.js. */
  --badge-staff: #bd777b; --badge-admin: #a0444d;
  --badge-mod: #806747; --badge-pro: #79546b; --badge-bot: #5b6573;
}
body { background: var(--bg); color: var(--text); font: 14px/1.45 system-ui,-apple-system,Segoe UI,sans-serif; }
.chat { border: 1px solid var(--edge); border-radius: 8px; position: relative; overflow: hidden; }
header { min-height: 43px; padding: 7px 0 7px 12px; background: linear-gradient(180deg,#252020,#171515); border-bottom: 1px solid var(--edge); }
header strong { font: 600 16px/1.25 Georgia,'Times New Roman',serif; color: var(--accent); }
#status { color: var(--muted); }
#status.online { color: #a9c5b5; }
#messages { background: var(--bg); padding: 9px 11px; scrollbar-color: #73575c var(--bg); }
.line { line-height: 20px; padding: 1px 0; }
.line[data-timestamp]:hover::after { background: var(--bg); color: var(--muted); line-height: 20px; }
.trivia-question { color: #e6c18f; }
#composer { background: #171515; border-top: 1px solid var(--edge); padding: 8px 10px; }
textarea, #loginForm input, #signupForm input { background: var(--input); color: var(--text); border: 1px solid #6a4a4e; border-radius: 6px; padding: 8px 10px; }
textarea:focus, input:focus { outline: 1px solid var(--accent); outline-offset: 0; }
textarea::placeholder { color: var(--muted); }
#nickname { color: var(--muted); }
button { background: #161313; border: 1px solid #856366; border-radius: 6px; color: var(--accent); font: 14px/1.2 Georgia,'Times New Roman',serif; padding: 6px 14px; }
button:not(:disabled):hover { background: #302326; }
#send { color: #100b0b; background: linear-gradient(145deg,#de9598,#b86d73); border-color: #c48a8a; font-weight: 600; }
#send:not(:disabled):hover { background: #f79599; }
.header-tabs { margin: -7px 0; }
.header-tabs .icon-tab { width: 36px; border-left: 1px solid #514044; background: #1c1919; color: var(--accent); }
.header-tabs .icon-tab:not(:disabled):hover, .header-tabs .icon-tab[aria-expanded="true"] { background: #302326; }
.tab-arrow { border-top-color: #bd9299; }
#usersPanel, #settingsPanel { background: #1c1919; border: 1px solid #665052; color: var(--text); }
#usersPanel { padding: 10px; }
#usersSummary { color: var(--accent); font-size: 11px; letter-spacing: .05em; }
#usersList li { line-height: 22px; }
#settingsPanel button { color: var(--soft); }
#settingsPanel button:not(:disabled):hover, #settingsPanel button:focus-visible { background: #302326; color: var(--accent); }
#loginDialog, #signupDialog { background: #171515; color: var(--text); border: 1px solid #856366; border-radius: 9px; }
#loginTitle, #signupTitle { font: 600 20px Georgia,serif; color: var(--accent); }
#loginForm p, #signupForm p { color: var(--muted); }
#signupError { color: #ff9b9b !important; }
#loginDialog::backdrop, #signupDialog::backdrop { background: #000a; }
button:focus-visible, a:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.role-badge { height: 15px; border-radius: 4px; color: #fff5ef; vertical-align: middle; }
.role-staff { background: var(--badge-staff); color: #211416; }
.role-admin { background: var(--badge-admin); }
.role-mod { background: var(--badge-mod); }
.role-pro { background: var(--badge-pro); }
.role-bot { background: var(--badge-bot); }
.wide-layout #usersPanel { top: 43px; }
@media(min-width:720px) {
  .wide-layout .chat { display: grid; grid-template-columns: minmax(0,1fr) 200px; grid-template-rows: 43px minmax(0,1fr) auto; }
  .wide-layout header { grid-column: 1/-1; grid-row: 1; z-index: 3; }
  .wide-layout #messages { grid-column: 1; grid-row: 2; }
  .wide-layout #composer { grid-column: 1; grid-row: 3; }
  .wide-layout #usersPanel { position: static; grid-column: 2; grid-row: 2/4; width: auto; max-width: none; max-height: none; border: 0; border-left: 1px solid var(--edge); background: linear-gradient(#1c1919,#141414); }
  .wide-layout #usersPanel::before { content: 'ONLINE USERS'; display: block; color: var(--accent); font-size: 11px; font-weight: 700; letter-spacing: .12em; margin-bottom: 4px; }
  .wide-layout #usersList li { border-bottom: 1px solid #383333; padding: 3px 0; }
  .wide-layout #usersButton { display: none; }
}
@media(max-width:480px) { body { font-size: 13px; } #messages { padding: 8px; } #composer { padding: 7px; } }


/* Justin.tv-inspired staff-only channel moderation. */
.mod-actions { display: inline-flex; align-items: center; gap: 3px; vertical-align: middle; margin-right: 5px; white-space: nowrap; }
.mod-actions:empty { display: none; }
button.mod-action { display: inline-flex; align-items: center; justify-content: center; width: 17px; height: 17px; padding: 0; border-radius: 3px; vertical-align: middle; background: #3a2b1f; border: 1px solid #8d6a49; color: #f0d0a6; }
button.mod-action svg { width: 12px; height: 12px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; pointer-events: none; }
button.mod-action.mod-ban { background: #4a262d; border-color: #a25964; color: #ffb8c0; }
button.mod-action.mod-kick:hover { background: #5c4531; }
button.mod-action.mod-ban:hover { background: #61323b; }

/* Web-only replacement after a confirmed channel kick. */
.message-deleted { color: var(--muted); font-style: italic; }

/* Optional remembered login — unchecked on shared devices. */
#loginForm .remember-choice { display:flex; align-items:center; gap:7px; margin:5px 0 0; cursor:pointer; }
#loginForm input#rememberLogin { width:15px; height:15px; margin:0; padding:0; accent-color:var(--accent); flex:none; }
