:root {
  color-scheme: light;
  --bg: #f4f6f8;
  --panel: #ffffff;
  --panel-strong: #111827;
  --line: #d8dee6;
  --muted: #6b7280;
  --text: #111827;
  --accent: #8bd8cf;
  --accent-strong: #6fc9c0;
  --accent-soft: rgba(139, 216, 207, 0.18);
  --danger: #f0a6a6;
  --danger-strong: #e58d8d;
  --danger-soft: rgba(240, 166, 166, 0.16);
  --shadow: 0 18px 50px rgba(15, 23, 42, 0.12);
  --chat-control-bg: rgba(255, 255, 255, 0.14);
  --chat-field-border: rgba(248, 211, 108, 0.72);
  --chat-field-border-focus: rgba(248, 211, 108, 0.72);
  --chat-field-focus-shadow: 0 0 0 1px rgba(248, 211, 108, 0.18), 0 0 14px rgba(248, 211, 108, 0.18);
  --chat-bg-solid: #050a18;
  --chat-bg: linear-gradient(155deg, rgba(6, 11, 27, 0.98) 0%, rgba(20, 17, 58, 0.97) 46%, rgba(10, 56, 72, 0.98) 100%);
  --sunset-bg-solid: #071126;
  --sunset-bg: linear-gradient(155deg, #071126 0%, #10284d 42%, #54365e 70%, #b76a3c 100%);
  --sunset-surface: rgba(7, 17, 38, 0.66);
  --sunset-surface-strong: rgba(7, 17, 38, 0.84);
  --sunset-line: rgba(255, 196, 116, 0.24);
  --sunset-line-strong: rgba(255, 196, 116, 0.42);
  --sunset-text: #fff3de;
  --sunset-muted: rgba(255, 243, 222, 0.66);
  --sunset-ember: #ffc474;
  --sunset-rose: #f0a086;
  --sunset-focus: rgba(255, 196, 116, 0.2);
  --lobby-bg-solid: #050817;
  --lobby-bg: linear-gradient(155deg, #050817 0%, #071a43 48%, #8b6b22 100%);
  --lobby-surface: rgba(8, 18, 45, 0.68);
  --lobby-line: rgba(248, 211, 108, 0.26);
  --lobby-gold: #f8d36c;
  --lobby-cyan: #78f7e6;
  --chrome-button-border: rgba(248, 211, 108, 0.32);
  --chrome-button-border-hover: rgba(248, 211, 108, 0.5);
  --tab-bar-height: 36px;
  --app-height-js: 100vh;
  --app-height: var(--app-height-js);
  --bottom-lift-js: 0px;
  --bottom-lift: var(--bottom-lift-js);
  --composer-drop-js: 0px;
  --composer-drop: var(--composer-drop-js);
  --message-bottom-guard: -6px;
  --message-bottom-fade: var(--chat-title-fade);
  --message-scroll-bottom: calc(var(--composer-height) + var(--tab-bar-height) + var(--bottom-lift) - var(--composer-drop) + var(--message-bottom-guard));
  --composer-fade-overlap: 7px;
  --composer-fade-bg-x-js: 0px;
  --composer-fade-bg-y-js: 0px;
  --composer-fade-bg-x: var(--composer-fade-bg-x-js);
  --composer-fade-bg-y: var(--composer-fade-bg-y-js);
  --chat-head-lift-js: 0px;
  --chat-head-lift: var(--chat-head-lift-js);
  --chat-head-height: 58px;
  --chat-title-fade: 36px;
  --message-side-pad: 12px;
  --message-gap: 6px;
  --composer-button-size: 40px;
  --composer-stack-gap: 8px;
  --composer-pad-y: 8px;
  --composer-note-button-size: 28px;
  --composer-note-pad-y: 6px;
  --composer-note-gap: 4px;
  --composer-note-border: 1px;
  --composer-input-height: calc(var(--composer-button-size) + var(--composer-stack-gap) + var(--composer-button-size));
  --composer-height: calc(var(--composer-pad-y) + var(--composer-input-height) + var(--composer-pad-y));
  --composer-note-height: calc(var(--composer-note-button-size) + var(--composer-note-pad-y) + var(--composer-note-pad-y) + var(--composer-note-border) + var(--composer-note-border));
  --viewer-toolbar-pad: 8px;
  --viewer-toolbar-button-size: 40px;
  --viewer-toolbar-gap: 8px;
  --lobby-side-pad: 16px;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  height: var(--app-height);
  min-height: var(--app-height);
  overflow: hidden;
  overscroll-behavior: none;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  user-select: none;
}

html.dark-chrome,
body.dark-chrome {
  background: var(--chat-bg-solid);
}

html.chat-chrome,
body.chat-chrome {
  background: var(--chat-bg);
  background-color: var(--chat-bg-solid);
}

html.lobby-chrome,
body.lobby-chrome {
  background: var(--lobby-bg);
  background-color: var(--lobby-bg-solid);
}

html.auth-chrome,
body.auth-chrome,
html.settings-chrome,
body.settings-chrome {
  background: var(--sunset-bg);
  background-color: var(--sunset-bg-solid);
}

body.dark-chrome .app-shell {
  background: var(--chat-bg-solid);
}

body.auth-chrome .app-shell,
body.settings-chrome .app-shell {
  background: var(--sunset-bg);
}

body.chat-chrome .app-shell {
  background: var(--chat-bg);
}

body.lobby-chrome .app-shell,
body.lobby-chrome .team-view {
  background: var(--lobby-bg);
}

body.chat-chrome .team-view {
  background: var(--chat-bg);
}

html.chat-chrome,
body.chat-chrome,
html.lobby-chrome,
body.lobby-chrome,
html.auth-chrome,
body.auth-chrome,
html.settings-chrome,
body.settings-chrome,
body.chat-chrome .app-shell,
body.lobby-chrome .app-shell,
body.auth-chrome .app-shell,
body.settings-chrome .app-shell,
body.chat-chrome .team-view,
body.lobby-chrome .team-view,
.auth-view,
.team-view.view-lobby,
.team-view.view-settings {
  background-repeat: no-repeat;
  background-position: left top;
  background-size: 100vw var(--app-height);
}

button,
input,
textarea {
  font: inherit;
}

input,
textarea,
select,
[contenteditable="true"],
[contenteditable="true"] * {
  -webkit-touch-callout: default;
  -webkit-user-select: text;
  user-select: text;
}

button {
  cursor: pointer;
}

button:disabled {
  cursor: default;
  opacity: 0.45;
}

.hidden {
  display: none !important;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
}

.icon-defs {
  display: none;
}

.icon {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
}

.app-shell {
  height: var(--app-height);
  overflow: hidden;
  overscroll-behavior: none;
}

.auth-view {
  display: flex;
  height: var(--app-height);
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 22px;
  overflow: auto;
  overscroll-behavior: contain;
  background: var(--sunset-bg);
  color: var(--sunset-text);
  padding: calc(28px + env(safe-area-inset-top, 0px)) 16px 28px;
  -webkit-overflow-scrolling: touch;
}

.auth-brand,
.auth-panel {
  width: min(420px, calc(100vw - 32px));
}

.auth-brand {
  display: grid;
  justify-items: center;
  gap: 16px;
  text-align: center;
}

.brand-logo {
  display: block;
  width: clamp(196px, 52vw, 220px);
  height: auto;
}

.panel-logo {
  display: block;
  width: min(172px, 58%);
  height: auto;
  margin: 0 auto 18px;
}

.app-icon {
  display: block;
  width: clamp(76px, 20vw, 88px);
  height: auto;
  filter: drop-shadow(0 12px 20px rgba(0, 0, 0, 0.24));
}

.auth-brand .brand-logo {
  filter: brightness(0) invert(1) drop-shadow(0 0 18px rgba(255, 196, 116, 0.2));
  opacity: 0.86;
}

.chat-head p,
.user-card span {
  margin: 6px 0 0;
  color: var(--muted);
}

.auth-panel {
  border: 1px solid var(--sunset-line);
  border-radius: 8px;
  background: var(--sunset-surface);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.28);
  padding: 20px;
  backdrop-filter: blur(18px);
}

.auth-tabs,
.app-tabs {
  display: grid;
  gap: 6px;
  border-radius: 8px;
  background: #edf1f5;
  padding: 4px;
}

.auth-tabs {
  grid-template-columns: 1fr 1fr;
  background: rgba(4, 10, 26, 0.42);
  margin-bottom: 18px;
}

.app-tabs {
  position: absolute;
  z-index: 4;
  right: 0;
  bottom: calc(var(--bottom-lift) + 5px);
  left: 0;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0;
  width: auto;
  border-top: 0;
  border-radius: 0;
  background: #eef2f5;
  color: rgba(17, 24, 39, 0.72);
  padding: 3px 8px;
  box-shadow: none;
  backdrop-filter: blur(14px);
}

.auth-tab {
  display: flex;
  min-width: 0;
  height: 40px;
  align-items: center;
  justify-content: center;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: var(--sunset-muted);
  font-weight: 700;
  line-height: 1;
  padding: 0 12px;
}

.app-tab {
  display: flex;
  gap: 6px;
  min-width: 0;
  height: 30px;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: inherit;
  font-weight: 700;
}

.app-tab .icon {
  width: 17px;
  height: 17px;
}

.tab-label {
  font-size: 11px;
  line-height: 1;
  letter-spacing: 0;
}

.auth-tab.active {
  background: rgba(255, 196, 116, 0.14);
  color: var(--sunset-ember);
  box-shadow: inset 0 0 0 1px rgba(255, 196, 116, 0.18), 0 0 20px rgba(255, 196, 116, 0.1);
}

.app-tab.active {
  background: transparent;
  color: var(--accent);
  box-shadow: none;
}

.team-view.view-chat .app-tabs {
  background: transparent;
  color: rgba(255, 255, 255, 0.78);
  backdrop-filter: none;
}

.team-view.view-lobby .app-tabs {
  border-top: 0;
  background: transparent;
  color: rgba(248, 238, 201, 0.74);
  backdrop-filter: none;
}

.team-view.view-settings .app-tabs {
  border-top: 0;
  background: transparent;
  color: rgba(255, 243, 222, 0.72);
  backdrop-filter: none;
}

.team-view.view-chat .app-tab.active {
  color: #ffffff;
}

.team-view.view-lobby .app-tab.active {
  color: var(--lobby-gold);
  text-shadow: 0 0 12px rgba(248, 211, 108, 0.48);
}

.team-view.view-settings .app-tab.active {
  color: var(--sunset-ember);
  text-shadow: 0 0 12px rgba(255, 196, 116, 0.42);
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.form-grid label,
.form-grid input,
.form-grid textarea,
.compact-form input,
.message-form textarea {
  min-width: 0;
  max-width: 100%;
}

.form-grid label {
  display: grid;
  gap: 6px;
  color: #374151;
  font-size: 13px;
  font-weight: 700;
}

.wide {
  grid-column: 1 / -1;
}

input,
textarea,
select {
  width: 100%;
  border: 1px solid var(--chat-field-border);
  border-radius: 6px;
  background: #ffffff;
  color: var(--text);
  font-size: 16px;
  outline: none;
  padding: 11px 12px;
}

input[type="date"] {
  appearance: none;
  -webkit-appearance: none;
  min-width: 0;
  max-width: 100%;
  line-height: 1.2;
}

input[type="date"]::-webkit-date-and-time-value {
  min-height: 1.2em;
  text-align: left;
}

input:focus,
textarea:focus,
select:focus {
  border-color: var(--chat-field-border-focus);
  box-shadow: var(--chat-field-focus-shadow);
}

.primary-action,
.send-button,
.icon-button {
  display: grid;
  place-items: center;
  border-radius: 6px;
}

.primary-action,
.send-button {
  height: 44px;
  border: 0;
  background: var(--accent);
  color: #062321;
  font-weight: 800;
  line-height: 1;
  padding: 0 14px;
}

.primary-action:hover,
.send-button:hover {
  background: var(--accent-strong);
}

.text-link {
  border: 0;
  background: transparent;
  color: var(--muted);
  padding: 0;
  font-size: 13px;
  font-weight: 700;
  text-align: center;
}

.text-link:hover {
  color: var(--accent);
}

.auth-view .form-grid label,
.team-view.view-settings .form-grid label {
  color: var(--sunset-muted);
}

.auth-view input,
.auth-view textarea,
.team-view.view-settings input,
.team-view.view-settings textarea {
  border-color: var(--chat-field-border);
  background: rgba(4, 10, 26, 0.42);
  color: var(--sunset-text);
  caret-color: var(--sunset-ember);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.03);
}

.auth-view input::placeholder,
.auth-view textarea::placeholder,
.team-view.view-settings input::placeholder,
.team-view.view-settings textarea::placeholder {
  color: rgba(255, 243, 222, 0.42);
}

.auth-view input:focus,
.auth-view textarea:focus,
.team-view.view-settings input:focus,
.team-view.view-settings textarea:focus {
  border-color: var(--chat-field-border-focus);
  box-shadow: var(--chat-field-focus-shadow), inset 0 0 0 1px rgba(255, 255, 255, 0.04);
}

.auth-view input:-webkit-autofill,
.team-view.view-settings input:-webkit-autofill {
  -webkit-text-fill-color: var(--sunset-text);
  box-shadow: inset 0 0 0 1000px #071126;
  caret-color: var(--sunset-ember);
}

.auth-view input[type="date"]::-webkit-calendar-picker-indicator,
.team-view.view-settings input[type="date"]::-webkit-calendar-picker-indicator {
  opacity: 0.72;
  filter: invert(1) sepia(1) saturate(1.5) hue-rotate(330deg);
}

.auth-view .primary-action,
.team-view.view-settings .primary-action {
  border: 1px solid var(--chrome-button-border);
  background: linear-gradient(135deg, var(--sunset-ember), var(--sunset-rose));
  color: #141827;
  box-shadow: 0 12px 28px rgba(183, 106, 60, 0.24);
}

.auth-view .primary-action:hover,
.team-view.view-settings .primary-action:hover {
  border-color: var(--chrome-button-border-hover);
  background: linear-gradient(135deg, #ffd28e, #f4ad96);
}

.auth-view .auth-tab {
  border-color: var(--chrome-button-border);
}

.auth-view .auth-tab:hover {
  border-color: var(--chrome-button-border-hover);
}

.auth-view .text-link,
.team-view.view-settings .text-link {
  border: 1px solid var(--chrome-button-border);
  border-radius: 6px;
  color: var(--sunset-muted);
}

.auth-view #forgot-password-btn {
  display: grid;
  min-height: 44px;
  grid-template-columns: 17px max-content;
  align-items: center;
  justify-items: center;
  justify-content: center;
  column-gap: 8px;
  white-space: nowrap;
}

.auth-view #forgot-password-btn .icon {
  display: block;
  width: 17px;
  height: 17px;
}

.auth-view #forgot-password-btn span {
  display: block;
  line-height: 1;
  white-space: nowrap;
}

.auth-view .text-link:hover,
.team-view.view-settings .text-link:hover {
  border-color: var(--chrome-button-border-hover);
  color: var(--sunset-ember);
}

.auth-view .form-error,
.team-view.view-settings .form-error {
  color: var(--sunset-rose);
}

.icon-button {
  width: 40px;
  height: 40px;
  border: 1px solid var(--line);
  background: #ffffff;
  color: var(--text);
}

.icon-button:hover {
  border-color: #9ca3af;
}

.primary-action.icon-action {
  display: grid;
  grid-template-columns: 22px max-content;
  align-items: center;
  justify-items: center;
  justify-content: center;
  column-gap: 8px;
}

.primary-action.icon-action .icon {
  display: block;
  width: 22px;
  height: 22px;
}

.primary-action.icon-action span {
  display: block;
  line-height: 1;
  min-width: 0;
  white-space: nowrap;
}

.form-error {
  min-height: 20px;
  margin: 14px 0 0;
  color: var(--danger);
  font-size: 13px;
}

.form-error:empty {
  min-height: 0;
  margin-top: 0;
}

.team-view {
  position: relative;
  display: grid;
  height: var(--app-height);
  grid-template-rows: auto minmax(0, 1fr);
  overflow: hidden;
  overscroll-behavior: none;
  background: #eef2f5;
  padding-top: env(safe-area-inset-top, 0px);
  padding-bottom: var(--tab-bar-height);
}

.team-view.view-lobby {
  background: var(--lobby-bg);
  color: #fff8df;
}

.team-view.view-settings {
  background: var(--sunset-bg);
  color: var(--sunset-text);
}

.app-head {
  position: relative;
  z-index: 1;
  justify-self: center;
  display: grid;
  width: min(760px, 100%);
  grid-template-columns: minmax(0, 1fr) 40px;
  align-items: center;
  gap: 12px;
  border-bottom: 0;
  background: transparent;
  color: #fff8df;
  padding: 12px var(--lobby-side-pad);
  backdrop-filter: none;
}

.team-view:not(.view-lobby) .app-head {
  display: none;
}

.team-view.view-chat,
.team-view.view-settings {
  grid-template-rows: minmax(0, 1fr);
}

.user-card {
  display: grid;
  min-width: 0;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 22px;
}

.lobby-logo {
  display: block;
  width: 40px;
  height: 40px;
}

.user-card-text {
  min-width: 0;
}

.user-card strong,
.user-card span {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.user-card strong,
.invite-user strong {
  display: flex;
  min-width: 0;
  align-items: baseline;
  gap: 6px;
}

.user-name-text {
  min-width: 0;
  overflow: hidden;
  color: inherit;
  font: inherit;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.user-rank {
  flex: 0 1 auto;
  min-width: 0;
  overflow: hidden;
  color: rgba(255, 248, 223, 0.58);
  font-size: 11px;
  font-weight: 600;
  line-height: 1;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.invite-user .user-rank {
  color: rgba(238, 246, 255, 0.56);
}

.user-card span {
  max-width: 320px;
  color: rgba(255, 248, 223, 0.66);
  font-size: 12px;
}

.team-view.view-lobby .app-head .icon-button {
  border-color: var(--chrome-button-border);
  background: rgba(248, 211, 108, 0.12);
  color: var(--lobby-gold);
  box-shadow: 0 0 18px rgba(248, 211, 108, 0.12);
}

.team-view.view-lobby .app-head .icon-button:hover {
  border-color: var(--chrome-button-border-hover);
  background: rgba(248, 211, 108, 0.18);
}

.tab-view {
  grid-row: 2;
  height: 100%;
  min-height: 0;
  min-width: 0;
  width: 100%;
  max-width: 100vw;
}

.team-view.view-chat .tab-view,
.team-view.view-settings .tab-view {
  grid-row: 1;
}

.lobby-view {
  position: relative;
  z-index: 1;
  display: grid;
  width: min(760px, 100%);
  min-height: 0;
  grid-template-rows: auto minmax(0, 1fr);
  gap: 12px;
  margin: 0 auto;
  overflow: hidden;
  padding: 16px var(--lobby-side-pad);
}

.team-view.view-lobby .lobby-view {
  background: transparent;
}

.settings-view {
  display: grid;
  width: min(760px, 100%);
  height: 100%;
  align-content: start;
  gap: 26px;
  margin: 0 auto;
  overflow: auto;
  overscroll-behavior: contain;
  padding: clamp(44px, 10vh, 88px) 16px 16px;
  -webkit-overflow-scrolling: touch;
}

.settings-brand {
  display: grid;
  justify-items: center;
}

.settings-brand img {
  display: block;
  width: clamp(156px, 42vw, 180px);
  height: auto;
  filter: brightness(0) invert(1) drop-shadow(0 0 16px rgba(255, 196, 116, 0.18));
  opacity: 0.82;
}

.settings-form {
  border: 1px solid var(--sunset-line);
  border-radius: 8px;
  background: var(--sunset-surface);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.26);
  padding: 16px;
  backdrop-filter: blur(18px);
}

.room-actions {
  display: grid;
  gap: 8px;
}

.compact-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 40px;
  gap: 8px;
}

.team-view.view-lobby .compact-form input {
  border-color: var(--chat-field-border);
  background: rgba(5, 8, 23, 0.46);
  color: #fff8df;
  box-shadow: inset 0 0 0 1px rgba(120, 247, 230, 0.05), 0 0 22px rgba(248, 211, 108, 0.06);
}

.team-view.view-lobby .compact-form input::placeholder {
  color: rgba(255, 248, 223, 0.46);
}

.team-view.view-lobby .compact-form .icon-button {
  border-color: rgba(248, 211, 108, 0.36);
  background: rgba(248, 211, 108, 0.14);
  color: var(--lobby-gold);
  box-shadow: 0 0 18px rgba(248, 211, 108, 0.14);
}

.team-view.view-lobby .compact-form .icon-button:hover {
  border-color: rgba(248, 211, 108, 0.54);
  background: rgba(248, 211, 108, 0.2);
}

.room-list {
  display: grid;
  min-height: 0;
  align-content: start;
  gap: 8px;
  overflow: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}

.room-item {
  position: relative;
  display: grid;
  width: 100%;
  min-height: 58px;
  grid-template-columns: minmax(0, 1fr) 34px 34px;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  color: var(--text);
  padding: 10px 12px;
  text-align: left;
}

.room-item.admin-room {
  grid-template-columns: minmax(0, 1fr) 34px 34px 34px;
}

.team-view.view-lobby .room-item {
  border-color: transparent;
  background: transparent;
  color: #fff8df;
  backdrop-filter: none;
  box-shadow: none;
}

.room-open {
  display: grid;
  min-width: 0;
  grid-template-columns: 32px minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  border: 0;
  background: transparent;
  color: inherit;
  padding: 0;
  text-align: left;
}

.team-view.view-lobby .room-open > .icon {
  color: rgba(255, 248, 223, 0.38);
  opacity: 0.52;
}

.team-view.view-lobby .room-item.unread .room-open > .icon {
  color: var(--lobby-cyan);
  opacity: 1;
  filter: drop-shadow(0 0 7px rgba(120, 247, 230, 0.72)) drop-shadow(0 0 16px rgba(120, 247, 230, 0.34));
}

.room-notify,
.room-leave,
.room-delete {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  justify-self: end;
  border: 1px solid rgba(139, 216, 207, 0.28);
  border-radius: 6px;
  background: rgba(139, 216, 207, 0.12);
  color: var(--accent);
  padding: 0;
}

.team-view.view-lobby .room-notify {
  border-color: rgba(120, 247, 230, 0.34);
  background: rgba(120, 247, 230, 0.12);
  color: var(--lobby-cyan);
  box-shadow: 0 0 16px rgba(120, 247, 230, 0.12);
}

.room-leave {
  border-color: rgba(240, 166, 166, 0.3);
  background: var(--danger-soft);
  color: var(--danger-strong);
}

.room-delete {
  border-color: rgba(240, 166, 166, 0.34);
  background: rgba(240, 166, 166, 0.14);
  color: var(--danger-strong);
}

.team-view.view-lobby .room-leave {
  border-color: rgba(248, 211, 108, 0.3);
  background: rgba(248, 211, 108, 0.1);
  color: #ffe7a3;
  box-shadow: 0 0 14px rgba(248, 211, 108, 0.08);
}

.team-view.view-lobby .room-delete {
  border-color: rgba(240, 166, 166, 0.38);
  background: rgba(240, 166, 166, 0.12);
  color: #ffc7c7;
  box-shadow: 0 0 14px rgba(240, 166, 166, 0.08);
}

.room-notify[aria-pressed="false"] {
  border-color: rgba(107, 114, 128, 0.18);
  background: rgba(107, 114, 128, 0.07);
  color: var(--muted);
}

.team-view.view-lobby .room-notify[aria-pressed="false"] {
  border-color: rgba(255, 248, 223, 0.14);
  background: rgba(5, 8, 23, 0.26);
  color: rgba(255, 248, 223, 0.42);
}

.room-notify:hover {
  border-color: rgba(139, 216, 207, 0.42);
  background: rgba(139, 216, 207, 0.18);
}

.room-leave:hover {
  border-color: rgba(240, 166, 166, 0.44);
  background: rgba(240, 166, 166, 0.2);
}

.room-delete:hover {
  border-color: rgba(240, 166, 166, 0.5);
  background: rgba(240, 166, 166, 0.22);
}

.team-view.view-lobby .room-notify:hover {
  border-color: rgba(120, 247, 230, 0.5);
  background: rgba(120, 247, 230, 0.18);
}

.team-view.view-lobby .room-leave:hover {
  border-color: rgba(248, 211, 108, 0.5);
  background: rgba(248, 211, 108, 0.18);
}

.team-view.view-lobby .room-delete:hover {
  border-color: rgba(240, 166, 166, 0.54);
  background: rgba(240, 166, 166, 0.18);
}

.room-copy,
.room-preview-line,
.room-item strong,
.room-item small,
.room-item time {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.room-copy {
  display: grid;
  gap: 2px;
}

.room-name {
  cursor: text;
}

.room-name-input {
  width: 100%;
  height: 24px;
  border: 1px solid var(--chat-field-border);
  border-radius: 6px;
  background: #ffffff;
  color: var(--text);
  font-weight: 800;
  line-height: 1;
  padding: 0 7px;
}

.team-view.view-lobby .room-name-input {
  border-color: var(--chat-field-border);
  background: rgba(5, 8, 23, 0.42);
  color: #fff8df;
  box-shadow: 0 0 18px rgba(248, 211, 108, 0.12);
}

.room-preview-line {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: baseline;
  gap: 10px;
}

.room-item small {
  color: var(--muted);
  font-size: 12px;
}

.team-view.view-lobby .room-item small,
.team-view.view-lobby .room-item time {
  color: rgba(255, 248, 223, 0.62);
}

.room-item time {
  justify-self: end;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.2;
  text-align: right;
}

.room-item.active {
  border-color: var(--chat-field-border);
  background: #eefbf9;
}

.team-view.view-lobby .room-item.active {
  border-color: var(--chat-field-border);
  background: rgba(248, 211, 108, 0.13);
  box-shadow: var(--chat-field-focus-shadow);
}

.chat-panel {
  position: relative;
  display: grid;
  width: 100%;
  height: 100%;
  max-width: 100vw;
  min-width: 0;
  min-height: 0;
  grid-template-rows: auto auto minmax(0, 1fr);
  overflow: visible;
  background: transparent;
  color: #eef6ff;
}

.chat-panel.preparing {
  opacity: 0;
  pointer-events: none;
}

.chat-head,
.message-search-panel,
.invite-panel,
.messages,
.empty-chat,
.composer {
  position: relative;
  z-index: 1;
}

.chat-head {
  display: grid;
  grid-column: 1;
  grid-row: 1;
  min-width: 0;
  min-height: var(--chat-head-height);
  grid-template-columns: minmax(88px, 1fr) minmax(0, 2fr) minmax(88px, 1fr);
  align-items: center;
  gap: 12px;
  border-bottom: 0;
  background: transparent;
  padding: 10px 12px;
  backdrop-filter: none;
  z-index: 3;
}

.invite-panel {
  grid-column: 1;
  grid-row: 2;
  z-index: 2;
}

.chat-title {
  display: contents;
  min-width: 0;
}

.chat-head > div {
  min-width: 0;
}

.chat-head h2 {
  display: block;
  grid-column: 2;
  justify-self: center;
  max-width: 100%;
  margin: 0;
  overflow: hidden;
  color: #ffffff;
  font-size: 18px;
  text-align: center;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chat-head p {
  margin: 0;
  color: rgba(238, 246, 255, 0.7);
  font-size: 12px;
}

.chat-search-actions,
.chat-actions,
.chat-head h2 {
  transform: translateY(calc(-1 * var(--chat-head-lift)));
}

.chat-search-actions,
.chat-actions {
  display: flex;
  flex: 0 0 auto;
  gap: 8px;
}

.chat-search-actions {
  grid-column: 1;
  justify-self: start;
}

.chat-actions {
  grid-column: 3;
  justify-self: end;
}

.chat-search-actions .icon-button,
.chat-actions .icon-button,
.drop-zone .icon-button {
  border-color: var(--chrome-button-border);
  background: rgba(255, 255, 255, 0.13);
  color: #ffffff;
}

.chat-search-actions .icon-button:hover,
.chat-actions .icon-button:hover,
.drop-zone .icon-button:hover {
  border-color: var(--chrome-button-border-hover);
}

.message-search-panel {
  position: absolute;
  top: calc(var(--chat-head-height) + 2px);
  right: -8px;
  left: -8px;
  z-index: 4;
  display: grid;
  width: auto;
  max-height: min(58vh, 520px);
  grid-template-rows: auto auto minmax(0, 1fr);
  gap: 8px;
  border: 1px solid rgba(255, 238, 196, 0.16);
  border-top-color: rgba(248, 211, 108, 0.3);
  border-bottom-color: rgba(255, 238, 196, 0.22);
  border-radius: 8px;
  background: rgba(18, 17, 46, 0.78);
  padding: 10px 8px;
  overflow: hidden;
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.34);
  backdrop-filter: blur(16px);
}

.message-search-form,
.invite-search-form {
  display: grid;
  min-width: 0;
  grid-template-columns: minmax(0, 1fr) 40px;
  align-items: center;
  gap: 8px;
}

.message-search-field {
  display: grid;
  min-width: 0;
  grid-template-columns: 24px minmax(0, 1fr);
  align-items: center;
  gap: 8px;
  color: rgba(238, 246, 255, 0.78);
}

.message-search-field > .icon,
.invite-search > .icon {
  transform: translateX(6px);
}

.message-search-field:focus-within,
.invite-search:focus-within {
  color: rgba(248, 211, 108, 0.88);
}

.message-search-field input,
.invite-search input,
.composer textarea {
  width: 100%;
  min-width: 0;
  border-color: var(--chat-field-border);
  background: var(--chat-control-bg);
  color: #ffffff;
}

.message-search-field input:focus,
.invite-search input:focus,
.composer textarea:focus {
  border-color: var(--chat-field-border-focus);
  box-shadow: var(--chat-field-focus-shadow);
}

.message-search-field input::placeholder,
.invite-search input::placeholder,
.composer textarea::placeholder {
  color: rgba(238, 246, 255, 0.58);
}

.message-search-form .icon-button,
.invite-search-form .icon-button {
  border-color: var(--chrome-button-border);
  background: rgba(255, 255, 255, 0.13);
  color: #ffffff;
}

.message-search-form .icon-button:hover,
.invite-search-form .icon-button:hover {
  border-color: var(--chrome-button-border-hover);
}

.message-search-status {
  min-height: 18px;
  color: rgba(238, 246, 255, 0.62);
  font-size: 12px;
  line-height: 1.35;
}

.message-search-results {
  display: grid;
  min-height: 0;
  gap: 6px;
  align-content: start;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding-right: 4px;
  scrollbar-gutter: auto;
  -webkit-overflow-scrolling: touch;
}

.message-search-result {
  display: grid;
  min-width: 0;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 3px 8px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.1);
  color: #ffffff;
  padding: 8px 10px;
  text-align: left;
}

.message-search-result:hover {
  background: rgba(255, 255, 255, 0.16);
}

.message-search-result strong,
.message-search-result span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.message-search-result strong {
  font-size: 13px;
}

.message-search-result time {
  color: rgba(238, 246, 255, 0.6);
  font-size: 11px;
  white-space: nowrap;
}

.message-search-result span {
  grid-column: 1 / -1;
  color: rgba(238, 246, 255, 0.76);
  font-size: 12px;
}

.invite-panel {
  grid-row: 2;
  display: grid;
  width: calc(100% + 16px);
  max-height: min(calc(58vh + 31px), 551px);
  grid-template-rows: auto minmax(0, 1fr);
  gap: 8px;
  border-top: 1px solid rgba(248, 211, 108, 0.3);
  border-bottom: 1px solid rgba(255, 238, 196, 0.22);
  background: rgba(18, 17, 46, 0.78);
  margin: 0 -8px;
  padding: 10px 8px;
  overflow: hidden;
  backdrop-filter: blur(14px);
}

.invite-columns {
  display: grid;
  min-height: 0;
  max-height: min(calc(44vh + 31px), 421px);
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 8px;
}

.invite-column {
  display: grid;
  min-width: 0;
  min-height: 0;
  grid-template-rows: auto minmax(0, 1fr);
  gap: 6px;
}

.invite-column + .invite-column {
  border-left: 1px solid rgba(255, 255, 255, 0.12);
  padding-left: 8px;
}

.invite-column h3 {
  margin: 0;
  color: rgba(238, 246, 255, 0.72);
  font-size: 12px;
  font-weight: 800;
}

.invite-search {
  display: grid;
  grid-template-columns: 24px minmax(0, 1fr);
  align-items: center;
  gap: 8px;
  color: rgba(238, 246, 255, 0.78);
}

.composer textarea {
  border: 1px solid var(--chat-field-border);
  background: transparent;
}

.invite-list {
  display: grid;
  min-height: 0;
  max-height: min(calc(40vh + 31px), 391px);
  gap: 6px;
  align-content: start;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding-right: 4px;
  scrollbar-gutter: stable;
  -webkit-overflow-scrolling: touch;
  scrollbar-gutter: auto;
}

.invite-member-list .invite-user {
  cursor: default;
}

.invite-user {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  align-items: center;
  gap: 6px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.1);
  color: #ffffff;
  padding: 8px 10px;
  text-align: left;
}

.invite-user.with-actions {
  grid-template-columns: minmax(0, 1fr) 30px;
}

.invite-user.with-two-actions {
  grid-template-columns: minmax(0, 1fr) 30px 30px;
}

.invite-user-copy {
  display: grid;
  min-width: 0;
  gap: 2px;
}

.invite-user-copy strong,
.invite-user-copy span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.invite-user span {
  color: rgba(238, 246, 255, 0.7);
  font-size: 12px;
}

.invite-user-action,
.invite-user-delete {
  display: grid;
  width: 30px;
  height: 30px;
  place-items: center;
  border: 1px solid rgba(139, 216, 207, 0.28);
  border-radius: 6px;
  background: rgba(139, 216, 207, 0.12);
  color: #d9fffb;
  padding: 0;
}

.invite-user-delete {
  border-color: rgba(240, 166, 166, 0.36);
  background: rgba(240, 166, 166, 0.14);
  color: #ffd6d6;
}

.invite-empty {
  color: rgba(238, 246, 255, 0.5);
  font-size: 12px;
  justify-items: center;
}

.messages,
.empty-chat {
  position: absolute;
  inset: 0 0 var(--message-scroll-bottom);
  grid-column: 1;
  grid-row: 1 / 4;
  z-index: 0;
}

.messages {
  display: flex;
  min-height: 0;
  flex-direction: column;
  gap: 0;
  overflow: auto;
  overflow-anchor: none;
  overscroll-behavior: contain;
  padding: calc(var(--chat-head-height) + 10px) var(--message-side-pad) 26px;
  -webkit-overflow-scrolling: touch;
  -webkit-mask-image: linear-gradient(to bottom, transparent 0, rgba(0, 0, 0, 0.7) var(--chat-head-height), #000000 calc(var(--chat-head-height) + var(--chat-title-fade)), #000000 100%);
  mask-image: linear-gradient(to bottom, transparent 0, rgba(0, 0, 0, 0.7) var(--chat-head-height), #000000 calc(var(--chat-head-height) + var(--chat-title-fade)), #000000 100%);
}

.message {
  display: grid;
  max-width: min(680px, 86%);
  grid-template-columns: minmax(0, auto) auto;
  align-items: end;
  gap: 6px;
  align-self: flex-start;
  margin-bottom: var(--message-gap);
}

.message-measure-root {
  position: fixed !important;
  top: 0 !important;
  left: -100000px !important;
  z-index: -1 !important;
  width: 1px;
  height: auto !important;
  max-height: none !important;
  overflow: visible !important;
  visibility: hidden !important;
  pointer-events: none !important;
  contain: layout style paint;
}

.message-spacer {
  flex: 0 0 auto;
  width: 1px;
  min-height: 0;
  pointer-events: none;
}

.message-date-divider {
  display: grid;
  width: 100%;
  justify-items: center;
  gap: 6px;
  margin: 10px 0 8px;
  color: rgba(238, 246, 255, 0.68);
  font-size: 12px;
  line-height: 1.2;
  pointer-events: none;
}

.message-date-divider::before {
  display: block;
  width: 100%;
  height: 1px;
  background: rgba(238, 246, 255, 0.18);
  content: "";
}

.message-date-divider time {
  text-align: center;
}

.message.search-highlight .bubble {
  background: rgba(248, 211, 108, 0.24);
  box-shadow: 0 0 0 2px rgba(248, 211, 108, 0.68), 0 0 22px rgba(248, 211, 108, 0.18);
}

.message.system-message {
  width: 100%;
  max-width: 100%;
  grid-template-columns: minmax(0, 1fr);
  justify-items: center;
  align-self: center;
  margin: 8px auto 12px;
}

.message.system-message .bubble {
  width: min(680px, 98%);
  max-width: min(680px, 98%);
  justify-self: center;
  border: 1px solid rgba(238, 246, 255, 0.14);
  border-radius: 999px;
  background: rgba(238, 246, 255, 0.1);
  color: rgba(238, 246, 255, 0.74);
  padding: 5px 10px;
  font-size: 12px;
  line-height: 1.35;
  text-align: center;
  white-space: nowrap;
  backdrop-filter: none;
}

.message.mine {
  grid-template-columns: auto minmax(0, auto);
  align-self: flex-end;
}

.message.mine .message-meta {
  grid-column: 1;
  grid-row: 1;
  text-align: right;
}

.message.mine .bubble {
  grid-column: 2;
  grid-row: 1;
  justify-self: end;
}

.message.meta-suppressed {
  grid-template-columns: minmax(0, auto);
}

.message.meta-suppressed .bubble {
  grid-column: 1;
}

.message-meta {
  display: grid;
  min-width: 52px;
  max-width: 140px;
  gap: 2px;
  color: rgba(238, 246, 255, 0.62);
  font-size: 11px;
  line-height: 1.2;
}

.message-name,
.message-time {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.message-name {
  color: rgba(255, 255, 255, 0.82);
  font-weight: 700;
}

.bubble {
  min-width: 0;
  width: fit-content;
  max-width: 100%;
  border: 0;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.13);
  padding: 6px 9px;
  overflow-wrap: anywhere;
  color: #ffffff;
  line-height: 1.38;
  backdrop-filter: blur(10px);
}

.message.media-message {
  max-width: min(680px, 92%);
  grid-template-columns: minmax(0, auto);
  align-self: flex-start;
  align-items: start;
  gap: 4px;
}

.message.media-message.mine {
  align-self: flex-end;
}

.message.media-message .message-meta {
  display: flex;
  min-width: 0;
  max-width: 100%;
  grid-column: 1;
  grid-row: 1;
  align-items: center;
  gap: 6px;
  justify-self: start;
  padding: 0 2px;
  text-align: left;
}

.message.media-message.mine .message-meta {
  justify-self: end;
  text-align: right;
}

.message.media-message .bubble {
  grid-column: 1;
  grid-row: 2;
  width: fit-content;
  justify-self: start;
}

.message.media-message.mine .bubble {
  justify-self: end;
}

.message.media-message.meta-suppressed .bubble {
  grid-row: 1;
}

.media-bubble {
  border: 0;
  border-radius: 0;
  background: transparent;
  padding: 0;
  backdrop-filter: none;
}

.media-bubble > img,
.media-bubble > video,
.media-placeholder {
  display: block;
  max-width: 100%;
  aspect-ratio: var(--media-aspect, 1.3333);
  border-radius: 6px;
}

.media-bubble > img {
  height: auto;
  background: transparent;
  cursor: zoom-in;
}

.media-bubble > video {
  height: auto;
  max-height: 72vh;
  background: #000000;
  object-fit: contain;
}

.media-placeholder {
  background: #000000;
}

.message.audio-message {
  max-width: min(430px, 92%);
}

.message.audio-message .bubble {
  width: min(430px, calc(100vw - 48px));
}

.media-bubble.audio-bubble {
  display: grid;
  gap: 7px;
  border: 0;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.1);
  padding: 8px;
  backdrop-filter: blur(10px);
}

.audio-file-name {
  min-width: 0;
  overflow: hidden;
  color: rgba(238, 246, 255, 0.86);
  font-size: 12px;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.media-bubble > audio,
.audio-player-placeholder {
  display: block;
  width: 100%;
  height: 40px;
}

.audio-player-placeholder {
  border-radius: 20px;
  background: rgba(0, 0, 0, 0.28);
}

.message.file-message {
  max-width: min(430px, 92%);
}

.message.file-message .bubble {
  width: min(430px, calc(100vw - 48px));
}

.media-bubble.file-bubble {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  border: 0;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.1);
  padding: 8px;
  backdrop-filter: blur(10px);
}

.file-attachment-icon {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.14);
  color: #ffffff;
}

.file-attachment-copy {
  display: grid;
  min-width: 0;
  gap: 2px;
}

.file-attachment-copy strong,
.file-attachment-copy span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.file-attachment-copy strong {
  color: rgba(255, 255, 255, 0.95);
  font-size: 13px;
}

.file-attachment-copy span {
  color: rgba(238, 246, 255, 0.68);
  font-size: 12px;
}

.file-download-button,
.file-download-placeholder {
  display: inline-grid;
  min-width: 36px;
  height: 34px;
  align-items: center;
  justify-content: center;
  border-radius: 7px;
}

.file-download-button {
  grid-auto-flow: column;
  gap: 6px;
  border: 1px solid var(--chrome-button-border);
  background: rgba(139, 216, 207, 0.12);
  color: #d9fffb;
  padding: 0 9px;
}

.file-download-button:hover {
  border-color: var(--chrome-button-border-hover);
}

.file-download-button span {
  font-size: 12px;
  font-weight: 800;
}

.file-download-placeholder {
  background: rgba(0, 0, 0, 0.22);
}

.message.document-message,
.message.code-message {
  max-width: min(500px, 92%);
}

.message.document-message .bubble,
.message.code-message .bubble {
  width: min(500px, calc(100vw - 48px));
}

.media-bubble.document-bubble,
.media-bubble.code-bubble {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  border: 0;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.1);
  padding: 8px;
  backdrop-filter: blur(10px);
  cursor: pointer;
}

.document-card-actions {
  display: grid;
  grid-auto-flow: column;
  gap: 6px;
}

.document-view-button {
  border: 1px solid var(--chrome-button-border);
  background: rgba(255, 255, 255, 0.13);
  color: #ffffff;
}

.document-view-button:hover {
  border-color: var(--chrome-button-border-hover);
}

.rendered-markdown {
  display: grid;
  gap: 5px;
}

.rendered-markdown > :first-child {
  margin-top: 0;
}

.rendered-markdown > :last-child {
  margin-bottom: 0;
}

.rendered-markdown p {
  margin: 0;
}

.rendered-markdown h1,
.rendered-markdown h2,
.rendered-markdown h3 {
  margin: 2px 0;
  line-height: 1.2;
}

.rendered-markdown h1 {
  font-size: 20px;
}

.rendered-markdown h2 {
  font-size: 17px;
}

.rendered-markdown h3 {
  font-size: 15px;
}

.rendered-markdown ul,
.rendered-markdown ol {
  margin: 0;
  padding-left: 18px;
}

.rendered-markdown blockquote {
  margin: 0;
  border-left: 3px solid rgba(255, 255, 255, 0.35);
  padding-left: 8px;
  color: rgba(238, 246, 255, 0.82);
}

.rendered-markdown code {
  border-radius: 4px;
  background: rgba(0, 0, 0, 0.28);
  padding: 1px 4px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 0.92em;
}

.rendered-markdown pre {
  margin: 0;
  overflow: auto;
  overscroll-behavior: contain;
}

.rendered-markdown pre code {
  display: block;
  padding: 8px;
}

.markdown-table-wrap {
  max-width: 100%;
  overflow-x: auto;
  overscroll-behavior-x: contain;
}

.rendered-markdown table {
  min-width: 100%;
  border-collapse: collapse;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 6px;
  font-size: 0.94em;
}

.rendered-markdown th,
.rendered-markdown td {
  border: 1px solid rgba(255, 255, 255, 0.14);
  padding: 5px 7px;
  text-align: left;
  vertical-align: top;
}

.rendered-markdown th {
  background: rgba(255, 255, 255, 0.12);
  font-weight: 800;
}

.rendered-markdown td {
  background: rgba(0, 0, 0, 0.1);
}

.rendered-markdown [data-align="center"] {
  text-align: center;
}

.rendered-markdown [data-align="right"] {
  text-align: right;
}

.rendered-markdown a {
  color: #d8fffb;
  text-underline-offset: 3px;
}

.youtube-player {
  max-width: 100%;
  aspect-ratio: var(--media-aspect, 1.7778);
  overflow: hidden;
  border-radius: 6px;
  background: #000000;
}

.youtube-player iframe {
  display: block;
  width: 100%;
  height: 100%;
  border: 0;
}

.empty-chat {
  display: grid;
  place-items: center;
  color: rgba(238, 246, 255, 0.72);
}

.composer {
  position: absolute;
  z-index: 3;
  right: 0;
  bottom: calc(var(--tab-bar-height) + var(--bottom-lift) - var(--composer-drop));
  left: 0;
  display: grid;
  min-width: 0;
  min-height: var(--composer-height);
  width: 100%;
  grid-template-columns: var(--composer-button-size) minmax(0, 1fr);
  align-items: end;
  gap: 8px;
  border-top: 0;
  background: transparent;
  padding: var(--composer-pad-y) 10px;
  backdrop-filter: none;
}

.composer::before {
  content: "";
  position: absolute;
  right: 0;
  bottom: calc(100% - var(--composer-fade-overlap));
  left: 0;
  height: var(--message-bottom-fade);
  background: var(--chat-bg);
  background-repeat: no-repeat;
  background-position: var(--composer-fade-bg-x) var(--composer-fade-bg-y);
  background-size: 100vw var(--app-height);
  -webkit-mask-image: linear-gradient(to bottom, transparent 0, rgba(0, 0, 0, 0.72) 100%);
  mask-image: linear-gradient(to bottom, transparent 0, rgba(0, 0, 0, 0.72) 100%);
  pointer-events: none;
}

.composer .icon-button,
.composer .send-button {
  width: var(--composer-button-size);
  height: var(--composer-button-size);
  border: 1px solid var(--chrome-button-border);
  background: rgba(255, 255, 255, 0.13);
  color: #ffffff;
  padding: 0;
}

.composer .icon-button:hover,
.composer .send-button:hover {
  border-color: var(--chrome-button-border-hover);
  background: rgba(255, 255, 255, 0.2);
}

.composer-left-actions,
.composer-right-actions {
  display: grid;
  width: var(--composer-button-size);
  height: var(--composer-input-height);
  grid-template-rows: var(--composer-button-size) var(--composer-button-size);
  gap: var(--composer-stack-gap);
  align-self: end;
}

.composer-note {
  position: absolute;
  right: 10px;
  bottom: calc(100% + var(--composer-note-gap));
  left: 10px;
  display: flex;
  min-width: 0;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 7px;
  background: rgba(5, 10, 24, 0.72);
  color: rgba(238, 246, 255, 0.88);
  padding: var(--composer-note-pad-y) 8px;
  backdrop-filter: blur(12px);
}

.composer-note[data-mode="reply"] {
  border-color: rgba(139, 216, 207, 0.34);
}

.composer-note span {
  min-width: 0;
  overflow: hidden;
  font-size: 12px;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.composer-note .icon-button {
  width: var(--composer-note-button-size);
  height: var(--composer-note-button-size);
  flex: 0 0 auto;
  border-color: var(--chrome-button-border);
  background: transparent;
  color: #ffffff;
}

.composer-note .icon-button:hover {
  border-color: var(--chrome-button-border-hover);
}

.emoji-dialog {
  position: absolute;
  bottom: calc(100% + var(--composer-note-gap));
  left: 10px;
  display: grid;
  width: min(360px, calc(100vw - 20px));
  grid-template-columns: repeat(8, minmax(0, 1fr));
  gap: 4px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 8px;
  background: rgba(5, 10, 24, 0.9);
  padding: 8px;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.24);
  backdrop-filter: blur(16px);
}

.composer.has-note .emoji-dialog {
  bottom: calc(100% + var(--composer-note-gap) + var(--composer-note-height) + var(--composer-note-gap));
}

.emoji-dialog button {
  display: grid;
  width: 100%;
  aspect-ratio: 1;
  place-items: center;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: #ffffff;
  font-size: 21px;
  line-height: 1;
  padding: 0;
}

.emoji-dialog button:hover,
.emoji-dialog button:focus-visible {
  background: rgba(255, 255, 255, 0.14);
  outline: none;
}

.drop-zone {
  position: relative;
  display: grid;
  width: var(--composer-button-size);
  height: var(--composer-button-size);
  place-items: center;
}

.drop-zone.dragging .icon-button {
  border-color: rgba(139, 216, 207, 0.72);
  background: rgba(139, 216, 207, 0.24);
}

#file-input {
  position: absolute;
  inset: 0;
  opacity: 0;
  pointer-events: none;
}

.message-form {
  display: grid;
  min-width: 0;
  grid-template-columns: minmax(0, 1fr) var(--composer-button-size);
  grid-column: 2;
  align-items: end;
  gap: 8px;
}

.message-input-wrap {
  position: relative;
  min-width: 0;
}

.message-form textarea {
  display: block;
  height: var(--composer-input-height);
  min-height: var(--composer-input-height);
  max-height: var(--composer-input-height);
  padding: 9px 10px;
  line-height: 1.35;
  resize: none;
}

.message-form.has-clipboard-preview textarea {
  padding-top: 42px;
}

.clipboard-preview {
  position: absolute;
  top: 8px;
  right: 10px;
  left: 10px;
  display: flex;
  min-width: 0;
  max-width: calc(100% - 20px);
  height: 27px;
  align-items: center;
  border: 1px solid rgba(248, 211, 108, 0.44);
  border-radius: 6px;
  background: linear-gradient(135deg, rgba(248, 211, 108, 0.18), rgba(255, 255, 255, 0.08));
  box-shadow: 0 0 16px rgba(248, 211, 108, 0.14);
  color: rgba(255, 248, 223, 0.94);
  font-size: 13px;
  font-weight: 700;
  line-height: 1;
  overflow: hidden;
  padding: 0 9px;
  pointer-events: none;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.clipboard-preview::before {
  flex: 0 0 auto;
  width: 8px;
  height: 8px;
  margin-right: 7px;
  border-radius: 50%;
  background: var(--lobby-gold);
  box-shadow: 0 0 10px rgba(248, 211, 108, 0.72);
  content: "";
}

.message-form .send-button,
.message-form .latest-button {
  min-width: 0;
}

.moai-answer-row {
  display: flex;
  margin-top: 6px;
}

.moai-answer-trigger {
  display: inline-grid;
  height: 1.15em;
  min-width: 0;
  place-items: center;
  border: 0;
  background: transparent;
  color: currentColor;
  padding: 0;
  line-height: 1;
}

button.moai-answer-trigger {
  cursor: pointer;
}

.moai-answer-trigger.ready:hover {
  opacity: 1;
}

.moai-answer-logo {
  display: block;
  width: 2.85em;
  height: 1em;
  object-fit: contain;
}

.moai-answer-trigger.ready .moai-answer-logo {
  opacity: 1;
}

.moai-answer-trigger.pending .moai-answer-logo {
  opacity: 0.34;
  filter: brightness(0) invert(1);
}

.message-menu {
  position: fixed;
  z-index: 10;
  display: grid;
  min-width: 180px;
  max-width: min(300px, calc(100vw - 16px));
  gap: 2px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 8px;
  background: rgba(5, 10, 24, 0.88);
  padding: 4px;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.28);
  backdrop-filter: blur(16px);
}

.message-menu button {
  display: flex;
  align-items: center;
  gap: 8px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: #ffffff;
  padding: 9px 10px;
  text-align: left;
}

.message-menu button:hover {
  background: rgba(255, 255, 255, 0.12);
}

.message-menu button[data-action="delete"] {
  color: #ffd3d3;
}

.message-menu .icon {
  width: 17px;
  height: 17px;
}

.message-readers {
  display: grid;
  gap: 6px;
  margin-top: 4px;
  border-top: 1px solid rgba(255, 255, 255, 0.12);
  padding: 8px 6px 4px;
}

.message-readers h3 {
  margin: 0;
  color: rgba(238, 246, 255, 0.68);
  font-size: 11px;
  font-weight: 800;
}

.message-readers-body {
  min-width: 0;
  color: rgba(238, 246, 255, 0.72);
  font-size: 12px;
}

.message-readers-list {
  display: grid;
  max-height: 132px;
  gap: 4px;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.message-reader {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
}

.message-reader strong {
  min-width: 0;
  overflow: hidden;
  color: rgba(255, 255, 255, 0.92);
  font-size: 12px;
  font-weight: 800;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.message-reader time,
.message-readers-more {
  color: rgba(238, 246, 255, 0.56);
  font-size: 11px;
}

.message-readers-more {
  padding-top: 2px;
  font-weight: 800;
}

.image-viewer {
  position: fixed;
  z-index: 20;
  inset: 0;
  display: grid;
  place-items: center;
  background: rgba(1, 5, 16, 0.92);
  padding: calc(18px + env(safe-area-inset-top, 0px)) 18px 18px;
  backdrop-filter: blur(16px);
}

.image-viewer img {
  display: block;
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  border-radius: 6px;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.45);
}

.image-viewer .icon-button {
  position: absolute;
  top: calc(10px + env(safe-area-inset-top, 0px));
  right: 10px;
  border-color: var(--chrome-button-border);
  background: rgba(255, 255, 255, 0.14);
  color: #ffffff;
}

.image-viewer .icon-button:hover {
  border-color: var(--chrome-button-border-hover);
}

.document-viewer {
  position: fixed;
  z-index: 20;
  inset: 0;
  display: grid;
  background: rgba(1, 5, 16, 0.92);
  padding: calc(12px + env(safe-area-inset-top, 0px)) 12px 12px;
  backdrop-filter: blur(16px);
}

.document-viewer-shell {
  display: grid;
  min-width: 0;
  min-height: 0;
  grid-template-rows: auto minmax(0, 1fr);
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 8px;
  background: rgba(9, 15, 31, 0.96);
  overflow: hidden;
}

.document-viewer-head {
  display: grid;
  min-width: 0;
  grid-template-columns: minmax(0, 1fr) 40px 40px;
  align-items: center;
  gap: 8px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
  padding: 8px;
}

.document-viewer-head h2 {
  min-width: 0;
  margin: 0;
  overflow: hidden;
  color: #ffffff;
  font-size: 14px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.document-viewer-head .icon-button {
  border-color: var(--chrome-button-border);
  background: rgba(255, 255, 255, 0.14);
  color: #ffffff;
}

.document-viewer-head .icon-button:hover {
  border-color: var(--chrome-button-border-hover);
}

.moai-answer-shell {
  position: relative;
  grid-template-rows: minmax(0, 1fr);
  background: rgba(9, 15, 31, 0.96);
}

.moai-answer-toolbar {
  position: absolute;
  top: var(--viewer-toolbar-pad);
  right: var(--viewer-toolbar-pad);
  left: var(--viewer-toolbar-pad);
  z-index: 1;
  display: grid;
  grid-template-columns: minmax(0, 1fr) var(--viewer-toolbar-button-size) var(--viewer-toolbar-button-size);
  align-items: center;
  gap: var(--viewer-toolbar-gap);
  pointer-events: none;
}

.moai-answer-viewer-logo {
  display: block;
  width: 4.1em;
  height: 1.45em;
  object-fit: contain;
  pointer-events: auto;
}

.moai-answer-toolbar .icon-button {
  width: var(--viewer-toolbar-button-size);
  height: var(--viewer-toolbar-button-size);
  border-color: var(--chrome-button-border);
  background: rgba(255, 255, 255, 0.14);
  color: #ffffff;
  pointer-events: auto;
}

.moai-answer-toolbar .icon-button:hover {
  border-color: var(--chrome-button-border-hover);
}

.moai-answer-viewer .document-viewer-body {
  background: transparent;
  padding-top: calc(var(--viewer-toolbar-pad) + var(--viewer-toolbar-button-size));
}

.document-viewer-body {
  min-width: 0;
  min-height: 0;
  overflow: auto;
  overscroll-behavior: contain;
  background: rgba(255, 255, 255, 0.06);
}

.document-frame {
  display: block;
  width: 100%;
  height: 100%;
  border: 0;
  background: #ffffff;
}

.document-markdown {
  max-width: 860px;
  margin: 0 auto;
  color: #ffffff;
  padding: 18px;
}

.code-view {
  min-width: max-content;
  min-height: 100%;
  padding: 14px 0;
  background: #07101f;
  color: #d8e6f3;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
  font-size: 13px;
  line-height: 1.58;
  tab-size: 2;
}

.code-view::before {
  content: attr(data-language);
  display: block;
  position: sticky;
  left: 0;
  width: fit-content;
  margin: 0 16px 10px;
  border: 1px solid rgba(128, 165, 210, 0.26);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.06);
  color: rgba(225, 239, 255, 0.78);
  padding: 3px 8px;
  font-family: inherit;
  font-size: 11px;
  font-weight: 800;
}

.code-lines {
  display: grid;
  gap: 0;
  min-width: max-content;
  margin: 0;
  padding: 0 18px 0 54px;
}

.code-lines li {
  padding-left: 14px;
  white-space: pre;
}

.code-lines li::marker {
  color: rgba(153, 178, 211, 0.48);
  font-size: 11px;
}

.code-lines code {
  font-family: inherit;
  white-space: pre;
}

.code-comment {
  color: #7f93a8;
  font-style: italic;
}

.code-keyword {
  color: #8fb7ff;
  font-weight: 800;
}

.code-string {
  color: #9ed9b6;
}

.code-number {
  color: #f0c879;
}

.code-attr {
  color: #c7a8ff;
}

.messages .message img,
.messages .message video,
.messages .message a {
  -webkit-user-drag: none;
  user-drag: none;
}

.toast {
  position: fixed;
  z-index: 5;
  left: 50%;
  bottom: 18px;
  transform: translateX(-50%);
  max-width: min(520px, calc(100vw - 24px));
  border-radius: 8px;
  background: var(--panel-strong);
  color: #ffffff;
  padding: 10px 14px;
  box-shadow: var(--shadow);
}

@media (max-width: 720px) {
  :root {
    --lobby-side-pad: 12px;
  }

  .app-head {
    gap: 8px;
    padding: 10px var(--lobby-side-pad);
  }

  .lobby-view {
    padding: 12px var(--lobby-side-pad);
  }

  .user-card {
    gap: 16px;
  }

  .message {
    max-width: 86%;
  }
}

@media (max-width: 520px) {
  .auth-view {
    justify-content: flex-start;
    gap: 20px;
    padding: calc(clamp(44px, 10vh, 88px) + env(safe-area-inset-top, 0px)) 16px 24px;
  }

  .auth-panel {
    padding: 18px;
  }

  .form-grid {
    gap: 10px;
  }

  input,
  textarea {
    padding: 10px 9px;
  }

  .chat-head {
    min-height: var(--chat-head-height);
  }

  .messages {
    --message-side-pad: 8px;
    padding: calc(var(--chat-head-height) + 8px) var(--message-side-pad) 24px;
  }

  .message {
    max-width: 92%;
  }
}
