:root {
  color-scheme: light;
  font: 1rem/1.5 system-ui, sans-serif;
  --ink: #20213a;
  --muted: #626781;
  --line: #e2e4ee;
  --white: #fff;
  --side: #f8f8fc;
  --accent: #5139d1;
  --accent-dark: #422bbd;
  --accent-soft: #eae6ff;
  --green: #227253;
  background: #eeeff6;
  color: var(--ink);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; }
button, input { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
a { color: inherit; text-decoration: none; }
button { cursor: pointer; }
button:disabled { cursor: default; opacity: .62; }
:focus-visible { outline: 3px solid #8069ec; outline-offset: 3px; }

.shell {
  max-width: 1190px;
  margin: clamp(0px, 5vh, 56px) auto 0;
  border: 1px solid var(--line);
  border-radius: 19px;
  background: var(--white);
  box-shadow: 0 18px 56px #27235012;
  overflow: hidden;
}

.topbar {
  min-height: 66px;
  padding: 12px 26px;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.brand { display: inline-flex; align-items: center; gap: 11px; font-weight: 750; letter-spacing: -.025em; font-size: 1.2rem; }
.brand-mark {
  width: 34px; height: 34px; border-radius: 10px; background: var(--accent);
  display: inline-flex; justify-content: center; align-items: center; gap: 2px;
}
.brand-mark i { height: 8px; width: 2px; border-radius: 2px; background: white; }
.brand-mark i:nth-child(2), .brand-mark i:nth-child(4) { height: 13px; }
.brand-mark i:nth-child(3) { height: 19px; }
.connection { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: .875rem; }
.connection-state, .traffic, .traffic-item { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; background: #a97421; }
[data-state="connected"] .dot { background: #39896b; }
.traffic { padding-inline-start: 8px; border-inline-start: 1px solid var(--line); gap: 9px; font-size: .8125rem; font-variant-numeric: tabular-nums; }
.traffic-item { gap: 3px; }
.traffic-arrow { color: var(--accent-dark); font-weight: 650; }
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; overflow: hidden;
  clip-path: inset(50%); white-space: nowrap;
}

.layout { display: grid; grid-template-columns: clamp(310px, 38%, 360px) minmax(0, 1fr); min-height: 580px; height: min(760px, 78vh); }
.sidebar { background: var(--side); border-right: 1px solid var(--line); padding: 20px 17px; overflow: auto; }
.join-panel { padding-bottom: 16px; margin-bottom: 16px; border-bottom: 1px solid var(--line); }
.button {
  min-height: 40px; border: 1px solid transparent; padding: 7px 13px; border-radius: 9px;
  font-size: .875rem; font-weight: 650; line-height: 1.35; overflow-wrap: anywhere;
}
.primary { color: white; background: var(--accent); }
.primary:hover:not(:disabled) { background: var(--accent-dark); }
.secondary { color: var(--ink); border-color: var(--line); background: var(--white); }
.secondary:hover:not(:disabled) { background: #f5f3ff; border-color: #c7bdf3; }
#join, .voice-controls { width: 100%; }
#join { min-height: 46px; font-size: .9375rem; }
.voice-controls { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; }
.voice-status { margin: 8px 0 0; color: var(--muted); font-size: .875rem; }
.sound-button {
  margin-top: 9px; border: 1px solid #c7bdf3; background: var(--accent-soft);
  border-radius: 8px; padding: 6px 10px; color: var(--accent-dark); font-size: .875rem; font-weight: 650;
}
.sound-button:hover { background: #ded6ff; }
.dj { margin-top: 9px; }
.dj summary {
  padding: 4px 2px; color: var(--accent-dark); font-size: .875rem; font-weight: 650; cursor: pointer;
}
.dj-deck {
  margin-top: 5px; padding: 10px; border: 1px solid #dfdaef; border-radius: 9px; background: var(--white);
}
.dj-file-name { display: block; font-size: .875rem; overflow-wrap: anywhere; }
.dj-status { margin: 2px 0 8px; color: var(--muted); font-size: .8125rem; }
.dj-actions { display: flex; flex-wrap: wrap; gap: 6px; }
.dj-actions .button { padding-inline: 9px; }
.dj-volume { margin-top: 10px; }
.dj-volume-label {
  display: flex; justify-content: space-between; gap: 8px; color: var(--muted); font-size: .8125rem;
}
#dj-volume {
  display: block; min-height: 28px; margin: 2px 0 0; padding: 0; border: 0; accent-color: var(--accent);
}
.side-heading { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: 0 4px 6px; }
.side-heading h2 { margin: 0; font-size: .875rem; font-weight: 700; color: var(--muted); }
.channel-create { min-height: 32px; padding: 4px 9px; }
.channel-list, .member-list, .messages { list-style: none; padding: 0; margin: 0; }
.channel-list a {
  display: flex; align-items: center; justify-content: flex-start; gap: 8px;
  min-height: 40px; padding: 5px 10px; border-radius: 8px; font-size: .9375rem;
}
.channel-list a:hover { background: #efedf9; }
.channel-list a[aria-current] { background: var(--accent-soft); color: #4328b4; font-weight: 700; }
.channel-label, .member-name { min-width: 0; overflow-wrap: anywhere; }
.hash { font-size: 1.125rem; font-weight: 600; color: #645791; }
.channel-count { margin-inline-start: auto; }
.channel-count { font-size: .8125rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.member-list { margin: 3px 0 7px; margin-inline-start: 16px; padding-inline-start: 8px; border-inline-start: 1px solid var(--line); }
.member-list:empty { display: none; }
.member-list li { display: flex; align-items: center; gap: 8px; padding: 5px 4px; }
.member-name {
  font-size: .875rem; font-weight: 620; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.member-name small { color: var(--muted); font-size: .75rem; font-weight: 450; }
.member-status { margin-inline-start: auto; font-size: .75rem; color: var(--muted); text-align: end; }
.member-status > span { display: block; }
.member-status .active { color: var(--green); }
.avatar {
  flex: 0 0 29px; width: 29px; height: 29px; border-radius: 9px; color: var(--accent-dark);
  background: var(--accent-soft); display: grid; place-items: center; font-size: .8125rem; font-weight: 750;
}
.ghost { position: relative; background: #eeedf7; }
.ghost::before {
  content: ''; width: 12px; height: 13px; border-radius: 7px 7px 3px 3px;
  border: 1.5px solid #8172aa; background: white;
}
.ghost::after {
  content: ''; position: absolute; width: 2px; height: 2px; left: 11px; top: 12px;
  background: #8172aa; border-radius: 50%; box-shadow: 5px 0 #8172aa;
}

.chat { display: grid; grid-template-rows: auto minmax(0, 1fr) auto; min-width: 0; min-height: 0; }
.room-header {
  padding: 18px 24px; border-bottom: 1px solid var(--line);
  display: flex; align-items: center; gap: 12px;
}
.channel-icon {
  display: grid; place-items: center; flex: 0 0 43px; height: 43px; border-radius: 11px;
  background: var(--accent-soft); color: var(--accent-dark); font-size: 1.45rem; font-weight: 650;
}
.room-header h1 { margin: 0; font-size: 1.3rem; line-height: 1.3; letter-spacing: -.025em; overflow-wrap: anywhere; }
.room-header p { margin: 1px 0 0; color: var(--muted); font-size: .875rem; }
.invite { margin-inline-start: auto; flex-shrink: 0; }
.chat-content { overflow: auto; min-height: 180px; }
.empty-state { min-height: 100%; display: grid; place-content: center; justify-items: center; gap: 8px; padding: 20px; color: var(--muted); }
.empty-state p { margin: 0; font-size: .9375rem; }
.bubble {
  position: relative; width: 34px; height: 25px; border: 2px solid #aea0e6; border-radius: 8px;
  background: #f8f5ff;
}
.bubble::after {
  content: ''; position: absolute; bottom: -5px; inset-inline-start: 5px; width: 7px; height: 7px;
  border-inline-start: 2px solid #aea0e6; border-bottom: 2px solid #aea0e6;
  background: #f8f5ff; transform: skewY(-34deg);
}
.messages { padding: 14px 24px; }
.messages:empty { display: none; }
.messages li { display: grid; grid-template-columns: 29px minmax(0, 1fr); gap: 11px; padding: 9px 0; }
.message-meta { display: flex; align-items: baseline; flex-wrap: wrap; gap: 0 9px; }
.message-meta strong { font-size: .875rem; overflow-wrap: anywhere; }
.message-meta time { font-size: .75rem; color: var(--muted); }
.messages p { margin: 2px 0 0; overflow-wrap: anywhere; white-space: pre-wrap; }
.composer { padding: 16px 24px; border-top: 1px solid var(--line); }
.composer-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; }
.composer .button { min-width: 77px; }
input {
  min-width: 0; min-height: 43px; width: 100%; background: var(--white);
  color: var(--ink); border: 1px solid #d3d7e8; border-radius: 9px; padding: 8px 12px;
}
input::placeholder { color: var(--muted); }
.feedback { font-size: .875rem; color: #973849; margin: 0 0 8px; }
.site-footer {
  min-height: 36px; padding: 8px 16px;
  color: var(--muted); font-size: .8125rem; text-align: center;
}

dialog { width: min(420px, calc(100% - 32px)); padding: 24px; border: 1px solid var(--line); border-radius: 15px; color: var(--ink); box-shadow: 0 18px 60px #27235038; }
dialog::backdrop { background: #25213c62; }
dialog h2 { font-size: 1.25rem; margin: 0 0 17px; }
dialog label { display: block; font-size: .875rem; font-weight: 650; margin-bottom: 4px; }
dialog .channel-option { display: flex; align-items: center; gap: 7px; margin: 10px 0 0; color: var(--muted); }
.channel-option input { width: 1rem; height: 1rem; min-height: 0; margin: 0; }
dialog .feedback { margin-top: 8px; }
.dialog-actions { display: flex; justify-content: flex-end; flex-wrap: wrap; gap: 8px; margin-top: 18px; }

@media (max-width: 1250px) { .shell { margin-inline: 24px; } }
@media (max-width: 520px) {
  .connection { flex-direction: column; align-items: flex-end; gap: 2px; }
  .traffic { border: 0; padding-inline-start: 0; }
}
@media (max-width: 720px) {
  .shell { margin: 0; border: 0; border-radius: 0; }
  .topbar { padding-inline: 16px; }
  .layout { grid-template-columns: minmax(0, 1fr); height: auto; min-height: calc(100dvh - 66px); }
  .shell:has(+ .site-footer:not([hidden])) .layout { min-height: calc(100dvh - 102px); }
  .sidebar { border-right: 0; border-bottom: 1px solid var(--line); padding: 14px 16px; }
  .join-panel { margin-bottom: 8px; padding-bottom: 10px; }
  .channel-list { max-height: 264px; overflow: auto; }
  .chat { height: max(390px, calc(100dvh - 285px)); }
  .room-header { padding: 12px 16px; }
  .messages, .composer { padding-inline: 16px; }
}
