:root {
  color-scheme: dark; --base:#140f21; --panel:#1c1529; --surface:#271d37; --line:#392c48;
  --ink:#fff5ef; --quiet:#baaec7; --accent:#ffbd83; --on:#24111e; --room:var(--accent);
  font-family: system-ui, sans-serif; background:var(--base); color:var(--ink);
}
:root[data-day="true"] {color-scheme:light;--ink:#231a29;--quiet:#5b4c66;--on:#fff;}
* {box-sizing:border-box}
body {margin:0; min-height:100dvh}
[hidden] {display:none!important}
a {color:var(--accent)}
button,.button,select,input,textarea {font:inherit}
button,.button,select {border:1px solid var(--line);border-radius:10px;padding:.58rem .78rem;background:var(--surface);color:var(--ink)}
button,.button {cursor:pointer}
button:hover,.button:hover,select:hover {border-color:var(--accent)}
:focus-visible {outline:2px solid var(--accent);outline-offset:2px}
button:disabled {opacity:.55;cursor:wait}
.primary {background:var(--accent);border-color:var(--accent);color:var(--on);font-weight:750}
input:not([type=range],[type=checkbox],[type=file]), textarea {border:1px solid var(--line);border-radius:10px;background:var(--base);color:var(--ink);padding:.75rem;width:100%}
input[type=range] {width:80px;accent-color:var(--accent)}
label {display:grid;gap:.4rem;color:var(--quiet);font-size:.88rem}
.top {display:flex;align-items:center;justify-content:space-between;gap:1rem;padding:14px clamp(14px,4vw,56px);background:var(--panel);border-bottom:1px solid var(--line)}
.brand {display:flex;align-items:center;gap:12px;text-decoration:none;color:#ffe1a3;font:700 1.25rem Georgia,serif;white-space:nowrap;text-shadow:0 0 14px #ff622aaa}
[data-day="true"] .brand {color:#982d1f}
.brand b,.emblem {display:grid;place-items:center;border:1px solid #f2a552;color:#ffe0a3;background:linear-gradient(145deg,#5d182b,#281221 70%);text-shadow:0 0 12px #ff794c;box-shadow:0 0 20px #f454363c,inset 0 0 15px #f75c3533}
.brand b {width:43px;height:43px;border-radius:13px}
.top-actions,.theme,.channel-actions,.composer-tools,.entry-links,.voice-bar {display:flex;align-items:center;gap:.6rem;flex-wrap:wrap}
.welcome {max-width:1200px;margin:clamp(2rem,9vh,8rem) auto;padding:0 clamp(16px,4vw,50px);display:grid;grid-template-columns:1.25fr 1fr;gap:clamp(1.3rem,5vw,5rem);align-items:center}
.intro {position:relative;isolation:isolate;padding:clamp(24px,5vw,60px);overflow:hidden;border:1px solid var(--line);border-radius:32px;background:radial-gradient(ellipse at 90% 0%,var(--surface),transparent 70%),var(--panel)}
.intro::before,.intro::after {content:"";position:absolute;z-index:-1;border:1px solid var(--line);border-radius:50%;width:350px;height:350px;right:-140px;top:-140px;box-shadow:0 0 0 24px var(--panel),0 0 0 25px var(--line),0 0 0 49px var(--panel),0 0 0 50px var(--line)}
.intro::after {right:-220px;top:auto;bottom:-230px}
.emblem {width:72px;height:72px;border-radius:20px;font:700 2rem Georgia,serif;transform:rotate(-8deg)}
.intro h1 {font:400 clamp(2.55rem,5.5vw,5rem)/.98 Georgia,serif;letter-spacing:-.045em;margin:28px 0}
.intro em {color:var(--accent);font-weight:400}
.intro p {color:var(--quiet);max-width:32ch;line-height:1.6}
.entry {border:1px solid var(--line);border-radius:24px;background:var(--panel);padding:clamp(18px,3vw,36px)}
.entry h2 {font:400 1.7rem Georgia,serif;margin:0 0 1.3rem}
form {display:grid;gap:.8rem}
.entry-links {margin-top:1rem}
.workspace {display:grid;grid-template-columns:245px minmax(0,1fr);max-width:1550px;margin:0 auto;min-height:calc(100dvh - 72px)}
.sidebar {padding:1.3rem;border-right:1px solid var(--line);background:var(--panel);display:flex;flex-direction:column;gap:1rem}
.section-head,.identity,.channel-head,.dialog-head {display:flex;align-items:center;justify-content:space-between;gap:.75rem}
.section-head h2 {font-size:1rem;margin:0}
.small {padding:.3rem .55rem}
#rooms {display:grid;gap:.4rem}
#rooms button {text-align:left;overflow-wrap:anywhere}
#rooms button[aria-current=true] {border-color:var(--accent);color:var(--accent)}
.identity {margin-top:auto;justify-content:flex-start}
.identity small {display:block;color:var(--quiet);text-transform:capitalize}
.avatar {display:grid;place-items:center;width:36px;height:36px;border-radius:12px;overflow:hidden;background:var(--surface);color:var(--accent);flex:none}
.avatar img {width:100%;height:100%;object-fit:cover}
.channel {display:flex;flex-direction:column;min-width:0;border-top:3px solid var(--room);height:calc(100dvh - 73px);min-height:430px}
.channel-head {padding:1rem clamp(16px,4vw,38px);border-bottom:1px solid var(--line);background:var(--panel)}
.channel-head small {color:var(--room);font-size:.77rem}
.channel-head h1 {margin:.15rem 0;font:400 clamp(1.45rem,3vw,2rem) Georgia,serif;overflow-wrap:anywhere}
.feed {min-height:0;flex:1;overflow:auto;padding:1.3rem clamp(14px,4vw,38px);display:flex;flex-direction:column;gap:1rem}
.empty {color:var(--quiet);margin:auto;text-align:center}
.message {display:flex;align-items:flex-start;gap:.7rem}
.bubble {min-width:0;max-width:680px;flex:1}
.stamp {font-size:.75rem;color:var(--quiet);margin-left:.4rem}
.author {border:0;background:none;padding:0;color:var(--room);font-weight:700;text-align:left}
.body {white-space:pre-wrap;overflow-wrap:anywhere;line-height:1.5;margin:.25rem 0}
.photo {display:block;max-width:min(100%,420px);max-height:390px;object-fit:contain;border-radius:10px;margin:.5rem 0}
.media {display:block;width:min(100%,460px);border:0;border-radius:12px;margin:.55rem 0;background:var(--surface)}
.translation {color:var(--quiet);border-left:2px solid var(--accent);padding-left:.6rem}
.composer,.voice-bar {padding:.7rem clamp(14px,4vw,38px);border-top:1px solid var(--line);background:var(--panel)}
.composer textarea {resize:vertical;max-height:25vh;min-height:52px}
.upload input {position:absolute;opacity:0;width:1px;height:1px}
.upload:focus-within {outline:2px solid var(--accent)}
.send {margin-left:auto}
.language {display:flex;align-items:center}
.voice-bar output {color:var(--quiet)}
dialog {width:min(660px,calc(100% - 24px));max-height:90dvh;overflow:auto;color:var(--ink);background:var(--panel);border:1px solid var(--line);border-radius:20px;padding:1.25rem}
dialog::backdrop {background:#090510ba}
.dialog-head {margin-bottom:1rem}
.dialog-head h2 {margin:0;font:400 1.65rem Georgia,serif}
.emoji-list {display:grid;grid-template-columns:repeat(auto-fit,minmax(42px,1fr));gap:.35rem}
.emoji-list button {padding:.3rem;font-size:1.25rem}
#notice {position:fixed;z-index:5;bottom:1rem;right:1rem;max-width:min(420px,calc(100% - 2rem));padding:.75rem 1rem;background:var(--surface);border:1px solid var(--accent);border-radius:12px;box-shadow:0 8px 32px #0005}
.staff-list {max-height:245px;overflow:auto;padding-left:1.25rem;overflow-wrap:anywhere}
.staff-tools {display:flex;gap:.5rem;flex-wrap:wrap}
@media(max-width:800px) {
  .theme span,.language span {display:none}
  .workspace {grid-template-columns:1fr}
  .sidebar {padding:.55rem .8rem;border-right:0;gap:.4rem}
  #rooms {display:flex;overflow:auto;padding-bottom:.25rem}
  #rooms button {white-space:nowrap}
  .identity {display:none}
  .channel {height:auto;min-height:0}
  .feed {height:clamp(220px,50dvh,670px);flex:none}
}
@media(max-width:600px) {
  .welcome {grid-template-columns:1fr;margin:1rem auto 2rem}
  .top {align-items:flex-start;flex-direction:column;gap:.55rem}
  .top-actions {gap:.35rem}
  .top-actions button,.top-actions select {padding:.42rem .5rem;font-size:.83rem}
  .intro {border-radius:20px}
  .composer-tools {gap:.35rem}
  .composer-tools button,.composer-tools select,.composer-tools .button {padding:.45rem .48rem;font-size:.82rem}
}
