:root {
  color-scheme: dark;
  --background: #0b1020;
  --panel: #111827;
  --panel-raised: #182237;
  --panel-soft: #202b41;
  --border: #2a3650;
  --text: #f8fafc;
  --muted: #96a3b8;
  --brand: #7c5cff;
  --brand-bright: #9178ff;
  --success: #35d39a;
  --danger: #fb7185;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  background: var(--background);
  color: var(--text);
}

button, input, textarea { font: inherit; }
button { cursor: pointer; }

[hidden] { display: none !important; }

.auth-view {
  min-height: 100%;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    radial-gradient(circle at 18% 15%, rgba(124, 92, 255, 0.25), transparent 31%),
    radial-gradient(circle at 82% 85%, rgba(53, 211, 154, 0.12), transparent 28%),
    var(--background);
}

.auth-card {
  width: min(100%, 440px);
  padding: 38px;
  border: 1px solid var(--border);
  border-radius: 22px;
  background: rgba(17, 24, 39, 0.94);
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.35);
}

.brand-mark {
  width: 54px;
  height: 54px;
  display: grid;
  place-items: center;
  border-radius: 16px;
  background: linear-gradient(135deg, var(--brand-bright), #5b3ee8);
  color: white;
  font-weight: 900;
  letter-spacing: -0.05em;
  box-shadow: 0 12px 30px rgba(124, 92, 255, 0.3);
}

.brand-mark.small { width: 40px; height: 40px; border-radius: 12px; font-size: 14px; }
.eyebrow { margin: 24px 0 7px; color: var(--brand-bright); font-size: 12px; font-weight: 800; letter-spacing: 0.12em; text-transform: uppercase; }
.auth-card h1 { margin: 0; font-size: clamp(26px, 7vw, 36px); letter-spacing: -0.04em; }
.subtle { margin: 10px 0 27px; color: var(--muted); line-height: 1.55; }

.auth-tabs { display: grid; grid-template-columns: 1fr 1fr; gap: 5px; margin-bottom: 22px; padding: 4px; border-radius: 12px; background: var(--background); }
.tab { padding: 10px; border: 0; border-radius: 9px; background: transparent; color: var(--muted); font-weight: 700; }
.tab.active { background: var(--panel-soft); color: var(--text); }

label { display: block; margin: 15px 0 7px; color: #cbd5e1; font-size: 13px; font-weight: 700; }
input, textarea {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 11px;
  outline: none;
  background: #0c1324;
  color: var(--text);
  transition: border-color 120ms, box-shadow 120ms;
}
input { height: 46px; padding: 0 13px; }
textarea { min-height: 50px; max-height: 150px; padding: 14px 16px; resize: none; line-height: 1.45; }
input:focus, textarea:focus { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(124, 92, 255, 0.16); }

.primary-button, .secondary-button, .danger-button, .send-button {
  border: 0;
  border-radius: 10px;
  padding: 10px 15px;
  color: white;
  font-weight: 800;
}
.primary-button, .send-button { background: var(--brand); }
.primary-button:hover, .send-button:hover { background: var(--brand-bright); }
.secondary-button { border: 1px solid var(--border); background: var(--panel-soft); }
.secondary-button.connected { border-color: rgba(53, 211, 154, 0.45); background: rgba(53, 211, 154, 0.14); color: #7aebc3; }
.compact-button { padding-inline: 12px; }
.people-button { display: none; }
.panel-button { display: none; }
.danger-button { background: rgba(251, 113, 133, 0.15); color: #fda4af; }
.full-width { width: 100%; margin-top: 6px; }
.form-error { min-height: 18px; margin: 9px 0 4px; color: #fda4af; font-size: 13px; }

.app-view { height: 100dvh; display: grid; grid-template-columns: 250px minmax(320px, 1fr) 220px; overflow: hidden; }
.sidebar, .members-panel { min-height: 0; background: var(--panel); }
.sidebar { display: flex; flex-direction: column; border-right: 1px solid var(--border); }
.brand-row { height: 72px; display: flex; align-items: center; gap: 12px; padding: 13px 16px; border-bottom: 1px solid var(--border); }
.brand-row strong, .brand-row span { display: block; }
.brand-row span { margin-top: 2px; color: var(--muted); font-size: 12px; }
.section-heading { display: flex; align-items: center; justify-content: space-between; padding: 22px 14px 8px; color: var(--muted); font-size: 11px; font-weight: 800; letter-spacing: 0.09em; text-transform: uppercase; }
.compact-heading { padding-top: 12px; }
.icon-button { width: 30px; height: 30px; border: 0; border-radius: 8px; background: transparent; color: var(--muted); font-size: 20px; }
.icon-button:hover { background: var(--panel-soft); color: var(--text); }
.channel-list { max-height: 34%; overflow-y: auto; padding: 0 8px; }
.direct-heading { padding-top: 14px; }
.direct-list { flex: 1; overflow-y: auto; padding: 0 8px 8px; }
.channel-button { width: 100%; display: flex; gap: 9px; align-items: center; padding: 10px 11px; border: 0; border-radius: 9px; background: transparent; color: var(--muted); text-align: left; font-weight: 650; }
.channel-button:hover { background: rgba(255, 255, 255, 0.04); color: #dbe3ef; }
.channel-button.active { background: var(--panel-soft); color: white; }
.direct-button { width: 100%; display: flex; align-items: center; gap: 9px; padding: 8px; border: 0; border-radius: 9px; background: transparent; color: var(--muted); text-align: left; }
.direct-button:hover, .direct-button.active { background: var(--panel-soft); color: white; }
.direct-button .avatar { width: 29px; height: 29px; font-size: 10px; }
.direct-button span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12px; font-weight: 700; }
.channel-hash { color: #75839a; font-size: 20px; font-weight: 400; }
.account-row { display: flex; align-items: center; gap: 9px; padding: 12px; border-top: 1px solid var(--border); background: #0e1628; }
.avatar { position: relative; flex: 0 0 auto; width: 36px; height: 36px; display: grid; place-items: center; border-radius: 50%; background: linear-gradient(135deg, #4f8cff, var(--brand)); color: white; font-size: 13px; font-weight: 900; text-transform: uppercase; }
.avatar img { width: 100%; height: 100%; display: block; border-radius: 50%; object-fit: cover; }
.account-copy { min-width: 0; flex: 1; }
.account-copy strong, .account-copy span { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.account-copy span { margin-top: 2px; color: var(--muted); font-size: 11px; }
.status-dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--success); }
.text-button { border: 0; background: transparent; color: var(--muted); font-size: 11px; }
.text-button:hover { color: white; }
.account-actions { display: grid; gap: 4px; justify-items: end; }

.chat-panel { min-width: 0; min-height: 0; display: grid; grid-template-rows: 72px auto auto 1fr auto; background: #131b2c; }
.chat-header { grid-row: 1; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 0 20px; border-bottom: 1px solid var(--border); background: rgba(19, 27, 44, 0.94); }
.chat-header > div { display: flex; align-items: center; gap: 9px; }
.chat-header > div:first-child { min-width: 0; }
.chat-header, .message-list, .message-form, .header-actions { min-width: 0; }
.header-actions { justify-content: flex-end; flex-wrap: wrap; }
.voice-count { color: var(--muted); font-size: 12px; }
.connection-banner { grid-row: 2; padding: 8px; background: #8b5e18; color: white; text-align: center; font-size: 13px; }
.music-player { grid-row: 3; display: grid; grid-template-columns: 1fr auto auto; align-items: center; gap: 10px; margin: 10px 18px 0; padding: 10px 12px; border: 1px solid rgba(124, 92, 255, 0.35); border-radius: 11px; background: rgba(124, 92, 255, 0.1); }
.music-copy { min-width: 0; }
.music-copy strong, .music-copy span { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.music-copy strong { font-size: 13px; }
.music-copy span { margin-top: 2px; color: var(--muted); font-size: 11px; }
.music-player button { padding: 7px 10px; font-size: 11px; }
.music-open-link { padding: 7px 10px; font-size: 11px; text-decoration: none; }
.music-youtube { grid-column: 1 / -1; width: min(100%, 720px); aspect-ratio: 16 / 9; overflow: hidden; border-radius: 10px; background: #070b13; }
.music-youtube iframe { width: 100%; height: 100%; border: 0; }
.message-list { grid-row: 4; min-height: 0; overflow-y: auto; padding: 23px 22px; }
.empty-state { height: 100%; display: grid; place-items: center; color: var(--muted); text-align: center; }
.empty-state strong { display: block; margin-bottom: 5px; color: white; font-size: 20px; }
.message { display: grid; grid-template-columns: 42px 1fr; gap: 12px; padding: 7px 8px; border-radius: 8px; }
.message:hover { background: rgba(255, 255, 255, 0.015); }
.message.mentioned { background: rgba(124, 92, 255, 0.11); box-shadow: inset 3px 0 var(--brand); }
.message .avatar { width: 42px; height: 42px; }
.avatar.clickable { cursor: pointer; }
.message-body { min-width: 0; }
.message.own { grid-template-columns: minmax(0, 1fr) 42px; }
.message.own > .avatar { grid-column: 2; grid-row: 1; }
.message.own > .message-body { grid-column: 1; grid-row: 1; justify-self: end; width: min(78%, 720px); }
.message.own .message-meta { justify-content: flex-end; }
.message.own .message-delete { order: -1; margin: 0 auto 0 0; }
.message.own .message-content { width: fit-content; max-width: 100%; margin-left: auto; padding: 7px 10px; border-radius: 12px 12px 3px 12px; background: rgba(124, 92, 255, 0.24); }
.message.own .reaction-row { justify-content: flex-end; }
.message-meta { display: flex; align-items: baseline; gap: 8px; }
.message-meta strong { font-size: 14px; }
.message-time { color: #718096; font-size: 11px; }
.message-delete { margin-left: auto; padding: 3px 7px; border: 0; border-radius: 6px; background: transparent; color: #748198; font-size: 11px; opacity: 0; }
.message:hover .message-delete, .message-delete:focus { opacity: 1; }
.message-delete:hover { background: rgba(251, 113, 133, 0.12); color: #fda4af; }
@media (hover: none) { .message-delete { opacity: 1; } }
.message-content { margin-top: 4px; color: #d8e0ec; line-height: 1.45; overflow-wrap: anywhere; white-space: pre-wrap; }
.mention { display: inline-block; padding: 0 3px; border-radius: 4px; background: rgba(124, 92, 255, 0.18); color: #b9abff; font-weight: 750; }
.mention.self-mention { background: var(--brand); color: white; }
.reaction-row { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 6px; }
.reaction-row:empty { display: none; }
.reaction-chip { min-width: 29px; padding: 3px 7px; border: 1px solid var(--border); border-radius: 999px; background: #182237; color: #cbd5e1; font-size: 12px; }
.reaction-chip.mine { border-color: var(--brand); background: rgba(124, 92, 255, 0.16); }
.reaction-picker { display: flex; gap: 3px; width: fit-content; margin-top: 5px; padding: 5px; border: 1px solid var(--border); border-radius: 9px; background: #172136; box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3); }
.reaction-picker button { width: 29px; height: 29px; border: 0; border-radius: 6px; background: transparent; }
.reaction-picker button:hover { background: var(--panel-soft); }
.message-form { grid-row: 5; display: grid; grid-template-columns: 1fr auto; gap: 10px; padding: 12px 20px 20px; }
.composer-field { position: relative; min-width: 0; }
.composer-field textarea { padding-right: 54px; }
.send-button { align-self: end; height: 50px; padding-inline: 20px; }
.emoji-button { position: absolute; right: 8px; bottom: 8px; width: 35px; height: 35px; border: 0; border-radius: 9px; background: transparent; font-size: 19px; filter: grayscale(0.35); }
.emoji-button:hover, .emoji-button[aria-expanded="true"] { background: var(--panel-soft); filter: none; }
.emoji-picker, .mention-suggestions { position: absolute; z-index: 8; bottom: calc(100% + 9px); border: 1px solid var(--border); border-radius: 12px; background: #172136; box-shadow: 0 18px 45px rgba(0, 0, 0, 0.4); }
.emoji-picker { right: 0; width: 286px; grid-template-columns: repeat(6, 1fr); gap: 3px; padding: 9px; }
.emoji-picker:not([hidden]) { display: grid; }
.emoji-option { display: grid; place-items: center; height: 40px; border: 0; border-radius: 8px; background: transparent; font-size: 23px; }
.emoji-option:hover { background: var(--panel-soft); }
.mention-suggestions { left: 0; width: min(360px, 100%); padding: 6px; }
.mention-option { width: 100%; display: flex; align-items: center; gap: 9px; padding: 8px 10px; border: 0; border-radius: 8px; background: transparent; color: var(--text); text-align: left; }
.mention-option:hover, .mention-option.active { background: var(--panel-soft); }
.mention-option .avatar { width: 29px; height: 29px; font-size: 10px; }
.mention-option span:last-child { color: #d7deea; font-size: 13px; font-weight: 700; }

.panel-backdrop { position: fixed; z-index: 25; inset: 0; background: rgba(3, 7, 18, 0.55); backdrop-filter: blur(2px); }
.members-panel { display: flex; flex-direction: column; border-left: 1px solid var(--border); }
.panel-heading-actions { display: flex; align-items: center; gap: 6px; }
.panel-close-button { display: none; }
.member-summary { display: grid; grid-template-columns: repeat(3, 1fr); gap: 7px; margin: 0 10px 8px; }
.member-summary div { min-width: 0; padding: 9px 7px; border: 1px solid var(--border); border-radius: 10px; background: rgba(255, 255, 255, 0.025); text-align: center; }
.member-summary span, .member-summary strong { display: block; }
.member-summary span { color: var(--muted); font-size: 9px; font-weight: 800; letter-spacing: 0.06em; text-transform: uppercase; }
.member-summary strong { margin-top: 3px; color: white; font-size: 16px; }
.member-list { flex: 1; overflow-y: auto; padding: 3px 10px; }
.member { width: 100%; display: flex; align-items: center; gap: 9px; padding: 8px; border: 0; border-radius: 9px; background: transparent; color: #c7d0df; font-size: 13px; text-align: left; }
.member:hover { background: var(--panel-soft); }
.member.offline { color: #9aa6b8; }
.member .avatar { width: 31px; height: 31px; font-size: 11px; }
.member .avatar::after { content: ""; position: absolute; right: -1px; bottom: -1px; width: 9px; height: 9px; border: 2px solid var(--panel); border-radius: 50%; background: var(--success); box-shadow: 0 0 0 3px rgba(53, 211, 154, 0.08); }
.member.offline .avatar { filter: saturate(0.6); opacity: 0.82; }
.member.offline .avatar::after { background: #64748b; box-shadow: none; }
.member-copy { min-width: 0; }
.member-copy strong, .member-copy span { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.member-copy strong { font-size: 13px; }
.member-copy span { max-width: 135px; margin-top: 2px; color: var(--muted); font-size: 10px; }
.presence-badge { margin-left: auto; padding: 3px 7px; border-radius: 999px; font-size: 9px; font-weight: 900; letter-spacing: 0.06em; text-transform: uppercase; }
.presence-badge.online { background: rgba(53, 211, 154, 0.12); color: #75e8be; }
.presence-badge.offline { background: rgba(148, 163, 184, 0.1); color: #aeb8c8; }
.role-badge { display: inline-flex; width: fit-content; align-items: center; padding: 3px 7px; border: 1px solid var(--border); border-radius: 999px; background: rgba(255, 255, 255, 0.04); color: #aeb9ca; font-size: 9px; font-weight: 850; letter-spacing: 0.06em; text-transform: uppercase; }
.role-badge.owner { border-color: rgba(247, 201, 72, 0.42); background: rgba(247, 201, 72, 0.1); color: #f7d774; }
.role-badge.moderator { border-color: rgba(124, 92, 255, 0.48); background: rgba(124, 92, 255, 0.13); color: #b9abff; }
.member .role-badge { margin-left: auto; }
.member .presence-badge + .role-badge { margin-left: 0; }
.voice-roster { flex: 0 0 auto; margin: 0 10px 10px; padding: 11px; border: 1px solid var(--border); border-radius: 12px; background: rgba(255, 255, 255, 0.025); }
.voice-roster-heading { display: flex; align-items: center; justify-content: space-between; margin-bottom: 7px; }
.voice-roster-heading strong { color: #d7e0ec; font-size: 12px; }
.voice-roster-heading span { color: var(--muted); font-size: 9px; text-transform: uppercase; }
.voice-participant-list { display: grid; gap: 3px; max-height: 150px; overflow-y: auto; }
.voice-participant { width: 100%; display: flex; align-items: center; gap: 8px; padding: 7px; border: 0; border-radius: 8px; background: transparent; color: var(--text); text-align: left; }
.voice-participant:hover { background: var(--panel-soft); }
.voice-participant .avatar { width: 28px; height: 28px; font-size: 9px; }
.voice-participant-name { min-width: 0; flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 11px; font-weight: 750; }
.voice-live { width: 7px; height: 7px; border-radius: 50%; background: var(--success); box-shadow: 0 0 0 3px rgba(53, 211, 154, 0.12); }
.voice-empty { margin: 5px 2px 2px; color: var(--muted); font-size: 10px; }
.voice-status { margin: 10px; padding: 14px; border: 1px solid rgba(53, 211, 154, 0.24); border-radius: 12px; background: rgba(53, 211, 154, 0.08); }
.voice-status strong, .voice-status span { display: block; }
.voice-status strong { color: #75e8be; font-size: 13px; }
.voice-status span { margin: 4px 0 12px; color: var(--muted); font-size: 12px; }
.voice-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; }
.voice-actions button { width: 100%; display: inline-flex; align-items: center; justify-content: center; gap: 7px; padding-inline: 7px; }
.voice-actions button::before { font-size: 14px; line-height: 1; }
#mute-button::before { content: "\1F399"; }
#mute-button.muted::before { content: "\1F507"; }
#leave-voice-button::before { content: "\23CF"; }
.voice-actions .muted { border-color: rgba(251, 113, 133, 0.45); background: rgba(251, 113, 133, 0.12); color: #fda4af; }

dialog { width: min(92vw, 410px); padding: 0; border: 1px solid var(--border); border-radius: 17px; background: var(--panel); color: var(--text); box-shadow: 0 25px 80px rgba(0, 0, 0, 0.55); }
dialog::backdrop { background: rgba(3, 7, 18, 0.72); backdrop-filter: blur(4px); }
dialog form { padding: 24px; }
.dialog-heading { display: flex; justify-content: space-between; gap: 10px; }
.dialog-heading .eyebrow { margin: 0 0 5px; }
.dialog-heading h2 { margin: 0; }
.prefixed-input { display: grid; grid-template-columns: auto 1fr; align-items: center; border: 1px solid var(--border); border-radius: 11px; background: #0c1324; }
.prefixed-input span { padding-left: 13px; color: var(--muted); }
.prefixed-input input { border: 0; background: transparent; box-shadow: none; }
.settings-dialog { width: min(92vw, 520px); max-height: min(88vh, 760px); overflow-y: auto; }
.settings-shell { padding: 24px; }
.settings-section { margin-top: 24px; padding-top: 22px; border-top: 1px solid var(--border); }
.settings-section h3 { margin: 0; font-size: 17px; }
.settings-section > p { margin: 6px 0 15px; color: var(--muted); font-size: 13px; line-height: 1.45; }
.settings-section form { padding: 0; }
.settings-section .primary-button { margin-top: 4px; }
.avatar-form { display: grid; grid-template-columns: auto 1fr; gap: 14px; align-items: start; margin-bottom: 20px; padding-bottom: 20px !important; border-bottom: 1px solid var(--border); }
.profile-avatar { width: 68px; height: 68px; font-size: 20px; }
.avatar-fields { min-width: 0; }
.avatar-fields label { margin-top: 0; }
.avatar-fields > span { display: block; margin-top: 6px; color: var(--muted); font-size: 11px; }
.avatar-fields input[type="file"] { height: auto; padding: 8px; color: var(--muted); font-size: 12px; }
.avatar-actions { display: flex; gap: 8px; align-items: center; margin-top: 10px; }
.avatar-actions .secondary-button { padding: 8px 10px; font-size: 12px; }
.voice-settings-dialog { width: min(92vw, 500px); max-height: min(88vh, 760px); overflow-y: auto; }
.audio-section { margin-top: 24px; padding-top: 22px; border-top: 1px solid var(--border); }
.audio-section h3 { margin: 0 0 14px; font-size: 17px; }
.audio-section select { width: 100%; height: 44px; padding: 0 38px 0 12px; border: 1px solid var(--border); border-radius: 10px; outline: none; background: #0c1324; color: var(--text); }
.audio-section select:focus { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(124, 92, 255, 0.16); }
.audio-section select:disabled { opacity: 0.55; }
.range-heading { display: flex; align-items: center; justify-content: space-between; margin-top: 17px; }
.range-heading label { margin: 0; }
.range-heading output { color: var(--muted); font-size: 12px; font-weight: 750; }
.audio-range { width: 100%; height: 28px; padding: 0; border: 0; accent-color: var(--brand); box-shadow: none; }
.audio-range:focus { box-shadow: none; }
.input-meter { width: 100%; height: 9px; overflow: hidden; border: 0; border-radius: 5px; background: #0c1324; }
.input-meter::-webkit-progress-bar { background: #0c1324; }
.input-meter::-webkit-progress-value { background: linear-gradient(90deg, var(--success), #facc15); border-radius: 5px; }
.input-meter::-moz-progress-bar { background: linear-gradient(90deg, var(--success), #facc15); border-radius: 5px; }
.audio-help { min-height: 17px; margin: 6px 0 0; color: var(--muted); font-size: 12px; line-height: 1.4; }
.user-profile-dialog { width: min(94vw, 440px); max-height: min(90vh, 780px); overflow-y: auto; }
.profile-card { position: relative; padding: 34px 28px 28px; text-align: center; }
.profile-close { position: absolute; top: 12px; right: 12px; }
.viewed-avatar { width: 92px; height: 92px; margin: 0 auto; font-size: 27px; }
.profile-card h2 { margin: 15px 0 5px; }
.profile-card p { min-height: 20px; margin: 0 0 20px; color: var(--muted); }
.profile-card > .role-badge { margin: -10px auto 4px; }
.profile-card .primary-button { width: 100%; }
.profile-details { margin: 18px 0; text-align: left; }
.profile-details dt { margin-top: 12px; color: var(--muted); font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: 0.06em; }
.profile-details dd { margin: 4px 0 0; color: #d9e1ed; font-size: 13px; line-height: 1.5; white-space: pre-wrap; }
.profile-card > button:not(.profile-close) { width: 100%; margin-top: 8px; }
.role-form { margin: 18px 0 10px; padding: 14px; border: 1px solid var(--border); border-radius: 11px; background: rgba(255, 255, 255, 0.025); text-align: left; }
.role-form label { margin-top: 0; }
.role-form-row { display: grid; grid-template-columns: 1fr auto; gap: 8px; }
.role-form select { min-width: 0; height: 40px; padding: 0 10px; border: 1px solid var(--border); border-radius: 9px; background: #0c1324; color: var(--text); }
.role-form button { padding-inline: 11px; }
.role-form .form-error { margin: 8px 0 0; }
.owner-management { margin: 14px 0 10px; padding: 14px; border: 1px solid rgba(247, 201, 72, 0.28); border-radius: 13px; background: rgba(247, 201, 72, 0.06); text-align: left; }
.owner-management > strong { display: block; color: #f7d774; font-size: 12px; letter-spacing: 0.05em; text-transform: uppercase; }
.owner-management > p { min-height: 0; margin: 6px 0 12px; font-size: 12px; line-height: 1.45; }
.owner-management form { display: grid; gap: 8px; margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--border); }
.owner-management label { margin: 0; }
.owner-management input, .owner-management textarea { min-height: 38px; padding: 9px 10px; border-radius: 9px; font-size: 13px; }
.owner-management textarea { resize: vertical; }
.owner-management button { width: 100%; }
.owner-action-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 12px; }
.user-controls-dialog form { padding: 24px; }
.dialog-copy { margin: 16px 0 8px; color: var(--muted); font-size: 13px; line-height: 1.45; }
.people-dialog { width: min(94vw, 640px); max-height: min(90vh, 780px); overflow-y: auto; }
.dashboard-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-top: 22px; }
.dashboard-stat { padding: 14px; border: 1px solid var(--border); border-radius: 13px; background: rgba(255, 255, 255, 0.03); }
.dashboard-stat span, .dashboard-stat strong { display: block; }
.dashboard-stat span { color: var(--muted); font-size: 11px; font-weight: 800; letter-spacing: 0.06em; text-transform: uppercase; }
.dashboard-stat strong { margin-top: 6px; color: white; font-size: 24px; }
.dashboard-stat.online { border-color: rgba(53, 211, 154, 0.28); background: rgba(53, 211, 154, 0.07); }
.dashboard-stat.offline { border-color: rgba(148, 163, 184, 0.22); }
.dashboard-section { margin-top: 20px; }
.dashboard-section h3 { margin: 0 0 10px; color: #d8e0ec; font-size: 13px; letter-spacing: 0.06em; text-transform: uppercase; }
.dashboard-empty { margin: 0; padding: 11px; border: 1px dashed var(--border); border-radius: 10px; color: var(--muted); font-size: 12px; text-align: center; }
.people-list { display: grid; gap: 5px; margin-top: 20px; }
.dashboard-section .people-list { margin-top: 0; }
.people-list .member-copy span { max-width: 280px; }

.games-dialog { width: min(94vw, 760px); max-height: 90vh; overflow-y: auto; }
.game-tabs { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 22px; }
.game-tabs button.active { border-color: var(--brand); background: rgba(124, 92, 255, 0.18); color: white; }
.game-panel { margin-top: 16px; padding: 18px; border: 1px solid var(--border); border-radius: 14px; background: #111a2b; }
.game-status, .game-balance { margin: 12px 0; padding: 10px 12px; border-radius: 9px; background: rgba(255, 255, 255, 0.04); color: #cbd5e1; font-size: 13px; }
.game-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 15px; }
.uno-table { min-height: 112px; display: flex; align-items: center; justify-content: center; gap: 14px; margin: 14px 0; }
.uno-card { width: 72px; min-height: 102px; display: grid; place-items: center; padding: 8px; border: 3px solid rgba(255, 255, 255, 0.72); border-radius: 12px; color: white; font-size: 13px; font-weight: 900; text-align: center; box-shadow: 0 7px 18px rgba(0, 0, 0, 0.28); }
button.uno-card { cursor: pointer; }
button.uno-card:disabled { cursor: not-allowed; opacity: 0.5; }
.uno-card.red { background: #d84545; }
.uno-card.yellow { background: #d6a717; color: #17120b; }
.uno-card.green { background: #258b61; }
.uno-card.blue { background: #3478c8; }
.uno-card.wild { background: conic-gradient(#d84545 0 25%, #3478c8 0 50%, #258b61 0 75%, #d6a717 0); }
.uno-hand { display: flex; gap: 8px; min-height: 112px; padding: 8px 2px 14px; overflow-x: auto; }
.game-players { display: grid; grid-template-columns: repeat(auto-fit, minmax(135px, 1fr)); gap: 8px; margin: 12px 0; }
.game-player { display: grid; gap: 4px; min-width: 0; padding: 10px 12px; border: 1px solid var(--border); border-radius: 11px; background: #151f33; color: var(--muted); font-size: 11px; }
.game-player strong { overflow: hidden; color: white; font-size: 13px; text-overflow: ellipsis; white-space: nowrap; }
.game-player.active { border-color: var(--brand); box-shadow: 0 0 0 1px rgba(124, 92, 255, 0.25); }
.game-player.winner { border-color: #3ddc97; background: rgba(61, 220, 151, 0.1); }
.game-player.me strong::after { content: " (you)"; color: var(--brand-soft); font-size: 10px; }
.ttt-board { display: grid; grid-template-columns: repeat(3, minmax(72px, 96px)); justify-content: center; gap: 8px; margin: 18px auto; }
.ttt-cell { aspect-ratio: 1; display: grid; place-items: center; border: 1px solid var(--border); border-radius: 12px; background: #182237; color: white; font-size: 34px; font-weight: 900; }
.ttt-cell:not(:disabled):hover { border-color: var(--brand); background: #202c45; }
.ttt-cell:disabled { cursor: default; opacity: 1; }
.ttt-cell.winning { border-color: #3ddc97; background: rgba(61, 220, 151, 0.18); color: #8ff0c5; }
.ttt-cell.mark-x { color: #9c8cff; }
.ttt-cell.mark-o { color: #55d6be; }
.tienlen-zone { display: grid; gap: 7px; margin: 15px 0; color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: 0.05em; }
.tienlen-cards { display: flex; flex-wrap: wrap; justify-content: center; gap: 7px; min-height: 82px; }
.tienlen-card { width: 54px; height: 76px; display: grid; place-items: center; border: 2px solid #d8dee9; border-radius: 9px; background: #f8fafc; color: #172033; font-size: 17px; font-weight: 900; box-shadow: 0 7px 18px rgba(0, 0, 0, 0.22); transition: transform 140ms ease, border-color 140ms ease; }
.tienlen-card.red { color: #c43745; }
button.tienlen-card { cursor: pointer; }
button.tienlen-card.selected { border-color: #7c5cff; transform: translateY(-9px); box-shadow: 0 10px 24px rgba(124, 92, 255, 0.34); }
button.tienlen-card.required { border-color: #f7c948; }
button.tienlen-card:disabled { cursor: default; opacity: 0.72; }
.draw-word { margin: 10px 0; color: #f7d774; font-size: 20px; font-weight: 900; text-align: center; letter-spacing: 0.08em; }
.draw-canvas { display: block; width: 100%; height: auto; aspect-ratio: 16 / 9; border: 2px solid var(--border); border-radius: 12px; background: white; cursor: crosshair; touch-action: none; }
.draw-canvas.locked { cursor: default; touch-action: pan-y; }
.draw-tools { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; margin-top: 10px; }
.draw-tools label { display: flex; align-items: center; gap: 7px; color: var(--muted); font-size: 11px; }
.draw-tools input[type="color"] { width: 38px; height: 32px; padding: 2px; border: 1px solid var(--border); border-radius: 7px; background: transparent; }
.draw-guesses { display: grid; gap: 5px; max-height: 130px; margin-top: 12px; overflow-y: auto; }
.draw-guess-line { padding: 7px 9px; border-radius: 8px; background: rgba(255, 255, 255, 0.04); color: var(--muted); font-size: 12px; }
.draw-guess-line.correct { background: rgba(61, 220, 151, 0.12); color: #8ff0c5; font-weight: 800; }
.draw-guess-form { display: grid; grid-template-columns: 1fr auto; gap: 8px; margin-top: 10px; }
.draw-guess-form input { min-width: 0; }
.game-celebration { position: fixed; z-index: 50; inset: 0; display: grid; place-items: center; overflow: hidden; background: rgba(3, 7, 18, 0.58); pointer-events: none; }
.game-celebration[hidden] { display: none; }
.celebration-card { position: relative; z-index: 2; display: grid; gap: 7px; min-width: min(82vw, 340px); padding: 28px; border: 1px solid rgba(255, 255, 255, 0.35); border-radius: 18px; background: linear-gradient(145deg, #6d56e8, #253047); color: white; text-align: center; box-shadow: 0 24px 80px rgba(0, 0, 0, 0.5); animation: winner-pop 500ms ease-out; }
.celebration-card span { color: #f7d774; font-size: 12px; font-weight: 900; letter-spacing: 0.22em; }
.celebration-card strong { font-size: 24px; }
.celebration-confetti span { position: absolute; top: -12%; width: 9px; height: 18px; border-radius: 2px; background: hsl(var(--hue), 85%, 62%); animation: confetti-fall var(--duration) linear var(--delay) forwards; }
@keyframes winner-pop { from { opacity: 0; transform: scale(0.72); } to { opacity: 1; transform: scale(1); } }
@keyframes confetti-fall { to { transform: translate3d(var(--drift), 115vh, 0) rotate(720deg); } }
.khla-dice { display: flex; justify-content: center; gap: 12px; margin: 16px 0; }
.khla-dice span { width: 72px; height: 72px; display: grid; place-items: center; border: 2px solid var(--border); border-radius: 13px; background: #f8fafc; color: #111827; font-size: 36px; box-shadow: 0 8px 22px rgba(0, 0, 0, 0.28); }
.khla-symbols { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 12px; }
.khla-symbol { display: grid; place-items: center; gap: 4px; min-height: 82px; padding: 9px; border: 1px solid var(--border); border-radius: 11px; background: #182237; color: white; }
.khla-symbol span { font-size: 28px; }
.khla-symbol strong { font-size: 11px; }
.game-panel select { width: 100%; height: 42px; padding: 0 10px; border: 1px solid var(--border); border-radius: 9px; background: #0c1324; color: white; }
.toast { position: fixed; z-index: 20; right: 20px; bottom: 20px; max-width: 360px; padding: 12px 16px; border: 1px solid var(--border); border-radius: 10px; background: #253047; box-shadow: 0 16px 44px rgba(0, 0, 0, 0.35); font-size: 13px; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }

@media (max-width: 900px) {
  .app-view { grid-template-columns: 210px 1fr; }
  .members-panel { position: fixed; z-index: 30; inset: 0 0 0 auto; width: min(86vw, 330px); max-width: 100vw; display: flex; box-shadow: -18px 0 55px rgba(0, 0, 0, 0.36); transform: translateX(105%); transition: transform 180ms ease; }
  .app-view.members-panel-open .members-panel { transform: translateX(0); }
  .panel-close-button { display: grid; }
  .people-button { display: inline-block; }
  .panel-button { display: inline-block; }
}

@media (max-width: 620px) {
  .app-view { grid-template-columns: 1fr; grid-template-rows: auto 1fr; }
  .sidebar { display: grid; grid-template-columns: auto 1fr auto; align-items: center; border-right: 0; border-bottom: 1px solid var(--border); }
  .brand-row { height: 58px; border: 0; padding: 8px 10px; }
  .brand-row > div:last-child, .sidebar .section-heading, .account-copy, .direct-list { display: none; }
  .channel-list { display: flex; gap: 4px; padding: 7px 4px; overflow-x: auto; }
  .channel-button { width: auto; white-space: nowrap; padding: 8px 10px; }
  .channel-button .channel-hash { font-size: 15px; }
  .account-row { border: 0; background: transparent; padding: 7px 8px; }
  .account-row .avatar { display: none; }
  .account-actions { display: flex; }
  .chat-panel { grid-row: 2; grid-template-rows: auto auto auto 1fr auto; min-height: 0; }
  .chat-header { min-height: 0; align-items: flex-start; flex-wrap: wrap; padding: 10px 12px; }
  .chat-header > div:first-child { width: 100%; }
  .header-actions { width: 100%; justify-content: flex-start; flex-wrap: nowrap; gap: 7px; overflow-x: auto; padding-bottom: 3px; scrollbar-width: thin; }
  .header-actions button { flex: 0 0 auto; white-space: nowrap; padding: 9px 11px; }
  .voice-count { display: none; }
  .message-list { padding: 16px 12px; }
  .message-form { grid-template-columns: 1fr; padding: 10px; }
  .send-button { width: 100%; height: 44px; }
  .music-player { grid-template-columns: 1fr; margin: 8px 10px 0; }
  .music-player button, .music-open-link { width: 100%; text-align: center; }
  .message { grid-template-columns: 34px 1fr; gap: 9px; }
  .message .avatar { width: 34px; height: 34px; font-size: 11px; }
  .message.own { grid-template-columns: minmax(0, 1fr) 34px; }
  .message.own > .message-body { width: 90%; }
  .khla-symbols { grid-template-columns: repeat(2, 1fr); }
  .dashboard-stats { grid-template-columns: 1fr; }
  .people-dialog, .settings-dialog, .voice-settings-dialog, .games-dialog { width: min(96vw, 760px); max-height: 88dvh; }
  .owner-action-grid, .voice-actions { grid-template-columns: 1fr; }
  .auth-card { padding: 27px 22px; }
}
