/* Static Quickie web client */
:root {
  color-scheme: light dark;
  --page: #d6dbe3;
  --window: #f4f5f7;
  --panel: #ffffff;
  --panel-soft: #eef1f5;
  --line: #a9b0ba;
  --line-strong: #7a8492;
  --text: #111820;
  --muted: #5f6975;
  --accent: #1665c1;
  --accent-strong: #0c4e9d;
  --accent-soft: #dcecff;
  --title-start: #0d5cae;
  --title-end: #3187d8;
  --title-text: #ffffff;
  --join: #087b3d;
  --part: #a13d26;
  --private: #7a3da0;
  --shadow: rgba(19, 35, 53, .25);
  --focus: #ffb000;
}

@media (prefers-color-scheme: dark) {
  :root {
    --page: #11161c;
    --window: #1d232b;
    --panel: #131920;
    --panel-soft: #242c36;
    --line: #46515f;
    --line-strong: #657182;
    --text: #edf2f7;
    --muted: #9ba8b6;
    --accent: #65aaf6;
    --accent-strong: #8fc2fb;
    --accent-soft: #17395c;
    --title-start: #103f72;
    --title-end: #1766a8;
    --title-text: #ffffff;
    --join: #61d18b;
    --part: #ff917b;
    --private: #d39cf0;
    --shadow: rgba(0, 0, 0, .48);
    --focus: #ffd166;
  }
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  height: 100%;
  margin: 0;
  overflow: hidden;
}

body {
  padding: 0;
  background:
    linear-gradient(135deg, color-mix(in srgb, var(--page), white 6%), var(--page));
  color: var(--text);
  font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
  font-size: 14px;
}

button,
input,
select {
  color: inherit;
  font: inherit;
}

button {
  border: 1px solid var(--line);
  border-radius: 3px;
  background: var(--panel-soft);
  cursor: pointer;
}

button:hover {
  border-color: var(--line-strong);
  filter: brightness(1.04);
}

button:focus-visible,
input:focus-visible,
select:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 1px;
}

.window {
  display: grid;
  grid-template-rows: 39px 35px 34px minmax(0, 1fr) 43px 25px;
  width: 100%;
  height: 100%;
  margin: 0;
  overflow: hidden;
  border: 0;
  border-radius: 0;
  background: var(--window);
  box-shadow: none;
}

.titlebar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-width: 0;
  padding: 0 8px;
  color: var(--title-text);
  background: linear-gradient(90deg, var(--title-start), var(--title-end));
  border-bottom: 1px solid color-mix(in srgb, var(--title-start), black 25%);
}

.brand,
.identity-controls,
.dialog-heading {
  display: flex;
  align-items: center;
}

.brand {
  gap: 8px;
  letter-spacing: .2px;
}

.brand-mark {
  display: inline-grid;
  place-items: center;
  width: 23px;
  height: 23px;
  flex: 0 0 auto;
  border: 1px solid rgba(255,255,255,.72);
  border-radius: 4px 4px 4px 0;
  color: white;
  background: #ef6c25;
  box-shadow: inset 0 0 0 1px rgba(0,0,0,.12);
  font-weight: 800;
}

.identity-controls {
  gap: 6px;
  min-width: 0;
  font-size: 12px;
}

.identity-controls select {
  max-width: 250px;
  height: 26px;
  border: 1px solid rgba(255,255,255,.6);
  border-radius: 3px;
  color: var(--text);
  background: var(--panel);
}

.identity-controls button {
  height: 26px;
  color: var(--title-text);
  border-color: rgba(255,255,255,.55);
  background: rgba(255,255,255,.12);
}

.menubar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 4px 7px;
  border-bottom: 1px solid var(--line);
  background: var(--panel-soft);
}

.menubar button,
.menubar a {
  display: inline-flex;
  align-items: center;
  height: 26px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 3px;
  color: var(--text);
  background: var(--panel);
  text-decoration: none;
}

.menu-hint {
  overflow: hidden;
  color: var(--muted);
  font-family: ui-monospace, "SFMono-Regular", Consolas, monospace;
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tabs {
  display: flex;
  align-items: end;
  gap: 3px;
  min-width: 0;
  padding: 4px 6px 0;
  overflow-x: auto;
  border-bottom: 1px solid var(--line-strong);
  background: var(--window);
}

.tab {
  height: 29px;
  min-width: 105px;
  padding: 0 12px;
  border-bottom: 0;
  border-radius: 4px 4px 0 0;
  color: var(--muted);
  background: var(--panel-soft);
  white-space: nowrap;
}

.tab-shell {
  display: flex;
  align-items: stretch;
  height: 29px;
}

.tab-shell .tab {
  min-width: 88px;
  border-right: 0;
  border-radius: 4px 0 0 0;
}

.tab-close {
  width: 25px;
  padding: 0;
  border-left: 0;
  border-bottom: 0;
  border-radius: 0 4px 0 0;
  color: var(--muted);
  background: var(--panel-soft);
  font-size: 16px;
  line-height: 1;
}

.tab-close:hover {
  color: var(--part);
}

.tab-shell:has(.tab[aria-selected="true"]) .tab-close {
  position: relative;
  top: 1px;
  color: var(--text);
  border-color: var(--line-strong);
  background: var(--panel);
}

.tab[aria-selected="true"] {
  position: relative;
  top: 1px;
  color: var(--text);
  border-color: var(--line-strong);
  background: var(--panel);
  font-weight: 650;
}

.tab.dm-tab {
  color: var(--private);
}

.tab.dm-tab[aria-selected="true"] {
  color: var(--private);
}

.tab.unread,
.tab.dm-tab.unread {
  color: var(--part);
  font-weight: 700;
}

.workspace {
  display: grid;
  grid-template-columns: minmax(0, 1fr) clamp(170px, 20vw, 280px);
  min-height: 0;
  background: var(--panel);
}

.transcript {
  min-width: 0;
  overflow: auto;
  padding: 8px 10px 18px;
  border-right: 1px solid var(--line-strong);
  background: var(--panel);
  font-family: ui-monospace, "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-size: 13px;
  line-height: 1.48;
  scrollbar-color: var(--line-strong) var(--panel-soft);
}

.empty {
  display: flex;
  flex-direction: column;
  gap: 24px;
  height: 100%;
  justify-content: center;
  max-width: 900px;
  margin: 0 auto;
  padding: 28px;
  color: var(--muted);
}

.empty strong {
  display: block;
  margin-bottom: 6px;
  color: var(--text);
  font-size: 17px;
}

.empty-intro {
  text-align: center;
}

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

.empty-guides section {
  min-width: 0;
  padding: 16px;
  border: 1px solid var(--line);
  background: var(--panel-soft);
}

.empty-guides h2 {
  margin: 0 0 8px;
  color: var(--text);
  font-size: 15px;
}

.empty-guides p {
  margin: 8px 0;
}

.empty-guides pre {
  overflow-x: auto;
  padding: 10px;
  border: 1px solid var(--line);
  color: var(--text);
  background: var(--panel);
}

.empty-guides dl {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 6px 12px;
}

.empty-guides dt {
  color: var(--accent);
}

.empty-guides dd {
  margin: 0;
}

.line {
  display: grid;
  grid-template-columns: 82px minmax(0, 1fr);
  gap: 6px;
  padding: 1px 2px;
  border-radius: 2px;
}

.line:hover {
  background: var(--panel-soft);
}

.time {
  color: var(--muted);
  user-select: none;
}

.nick {
  color: var(--accent);
  cursor: default;
  font-weight: 700;
}

.line.self .nick {
  color: var(--accent-strong);
}

.line.join .content {
  color: var(--join);
}

.line.part .content {
  color: var(--part);
}

.line.private .content,
.private-label {
  color: var(--private);
}

.body {
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}

.participants {
  min-width: 0;
  overflow: auto;
  background: var(--panel-soft);
}

.participants ul {
  margin: 0;
  padding: 0;
  list-style: none;
}

.participants li {
  position: relative;
  overflow: hidden;
  padding: 5px 9px 5px 27px;
  border-top: 1px solid color-mix(in srgb, var(--line), transparent 45%);
  text-overflow: ellipsis;
  white-space: nowrap;
  cursor: default;
  user-select: none;
}

.participants li::before {
  position: absolute;
  top: 10px;
  left: 12px;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--join);
  content: "";
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--join), transparent 76%);
}

.participants li.self {
  color: var(--accent-strong);
  font-weight: 700;
}

.participants li.self::before {
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--join), transparent 60%);
}

.composer {
  display: grid;
  grid-template-columns: 25px minmax(0, 1fr) auto;
  gap: 0;
  padding: 6px;
  border-top: 1px solid var(--line-strong);
  background: var(--window);
}

.prompt {
  display: grid;
  place-items: center;
  border: 1px solid var(--line-strong);
  border-right: 0;
  border-radius: 3px 0 0 3px;
  color: var(--accent-strong);
  background: var(--panel-soft);
  font-family: ui-monospace, "SFMono-Regular", Consolas, monospace;
  font-weight: 800;
}

.composer input {
  min-width: 0;
  padding: 0 9px;
  border: 1px solid var(--line-strong);
  border-radius: 0;
  background: var(--panel);
}

.composer input:focus-visible {
  outline: none;
}

.composer button {
  min-width: 70px;
  border-left: 0;
  border-radius: 0 3px 3px 0;
  color: white;
  border-color: var(--accent-strong);
  background: var(--accent);
  font-weight: 650;
}

.statusbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 8px;
  color: var(--muted);
  border-top: 1px solid var(--line);
  background: var(--panel-soft);
  font-size: 11px;
}

.status-dot {
  display: inline-block;
  width: 7px;
  height: 7px;
  margin-right: 5px;
  border-radius: 50%;
  background: var(--part);
}

.status-dot.online {
  background: var(--join);
}

dialog {
  width: min(440px, calc(100% - 28px));
  padding: 0;
  color: var(--text);
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  background: var(--window);
  box-shadow: 0 18px 60px var(--shadow);
}

dialog::backdrop {
  background: rgba(8, 14, 22, .56);
  backdrop-filter: blur(2px);
}

dialog form {
  display: grid;
  gap: 8px;
  padding: 20px;
}

dialog h1 {
  margin: 0 0 4px;
  font-size: 19px;
}

dialog p {
  margin: 0;
  color: var(--muted);
}

.dialog-heading {
  gap: 11px;
  margin-bottom: 10px;
}

dialog label {
  margin-top: 8px;
  font-size: 12px;
  font-weight: 700;
}

dialog input {
  width: 100%;
  height: 35px;
  padding: 0 9px;
  border: 1px solid var(--line-strong);
  border-radius: 3px;
  background: var(--panel);
}

.username-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
}

.username-row span {
  display: grid;
  place-items: center;
  padding: 0 8px;
  border: 1px solid var(--line-strong);
  border-right: 0;
  border-radius: 3px 0 0 3px;
  color: var(--muted);
  background: var(--panel-soft);
  font-family: ui-monospace, "SFMono-Regular", Consolas, monospace;
}

.username-row input {
  border-radius: 0 3px 3px 0;
}

dialog small {
  color: var(--muted);
}

.dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 12px;
}

.dialog-actions button {
  min-width: 84px;
  height: 34px;
}

.dialog-actions .primary {
  color: white;
  border-color: var(--accent-strong);
  background: var(--accent);
}

.form-error {
  min-height: 18px;
  color: var(--part);
  font-size: 12px;
}

.toast {
  position: fixed;
  right: 22px;
  bottom: 22px;
  max-width: min(480px, calc(100% - 44px));
  padding: 9px 12px;
  border: 1px solid var(--line-strong);
  border-radius: 4px;
  color: var(--text);
  background: var(--panel);
  box-shadow: 0 8px 26px var(--shadow);
  opacity: 0;
  pointer-events: none;
  transform: translateY(8px);
  transition: opacity .15s ease, transform .15s ease;
}

.toast.visible {
  opacity: 1;
  transform: translateY(0);
}

@media (max-width: 700px) {
  .workspace {
    grid-template-columns: minmax(0, 1fr) 150px;
  }

  .identity-controls label,
  .menu-hint {
    display: none;
  }

  .identity-controls select {
    max-width: 145px;
  }

  .empty {
    justify-content: flex-start;
    padding: 18px 10px;
  }

  .empty-guides {
    grid-template-columns: minmax(0, 1fr);
  }
}

@media (max-width: 500px) {
  .workspace {
    grid-template-columns: minmax(0, 1fr);
  }

  .participants {
    display: none;
  }

  .identity-controls button {
    width: 30px;
    overflow: hidden;
    padding: 0;
    font-size: 0;
  }

  .identity-controls button::after {
    font-size: 18px;
    content: "+";
  }
}
