:root {
  color-scheme: dark;
  --bg: #080f20;
  --surface: #101b31;
  --raised: #16233d;
  --line: #2b3b58;
  --text: #f2f5fc;
  --muted: #a6b4cc;
  --accent: #e0fc58;
  --accent-hover: #efff99;
  --on-accent: #171d08;
  --success: #74e5b5;
  --radius: 16px;
  --shadow: 0 18px 46px rgb(0 0 0 / 24%);
  font-family: Inter, "Segoe UI", system-ui, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
body {
  min-width: 0;
  min-height: 100vh;
  margin: 0;
  background: radial-gradient(ellipse at 74% 0%, #17284a 0%, transparent 55%) var(--bg);
  color: var(--text);
  line-height: 1.5;
}
h1, h2, h3, p { margin: 0; }
h2, h3 { line-height: 1.2; }
a { color: var(--accent); }
button, input, textarea, select { font: inherit; }
button { cursor: pointer; }
:disabled { cursor: not-allowed; opacity: .55; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
svg { display: inline-block; vertical-align: middle; }
:is(.btn, .connection, .tabs, .cue-meta, .hero-meta) svg {
  width: 1.125em;
  height: 1.125em;
  flex: none;
}
.muted { color: var(--muted); }
.auth { width: min(100%, 34rem); margin-inline: auto; }
.auth .fields { grid-template-columns: 1fr; }
.panel > p, .panel > .toolbar { margin-bottom: 1rem; }
.cue-notes { white-space: pre-line; }
.event-row { justify-content: flex-start; }
.connection.offline { color: #ffbe87; }
.btn[aria-pressed="true"] { border-color: var(--accent); }
#unread { background: var(--accent); color: var(--on-accent); padding-inline: .45em; border-radius: 1em; }
.view-hidden, [hidden] { display: none !important; }

body > header, .shell > header, header:has(.brand) {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: .75rem 1.25rem;
  padding: .85rem max(clamp(1rem, 4vw, 3rem), calc((100% - 90rem) / 2));
  border-bottom: 1px solid var(--line);
  background: rgb(8 15 32 / 82%);
}
.brand, .header-actions, .connection, .hero-meta, .cue-meta, .cue-actions {
  display: flex;
  align-items: center;
  gap: .65rem;
  min-width: 0;
}
.brand {
  color: var(--text);
  font-weight: 800;
  letter-spacing: -.035em;
  text-decoration: none;
}
.logo {
  display: inline-grid;
  width: 2.5rem;
  height: 2.5rem;
  flex: none;
  place-items: center;
  border-radius: 11px;
  background: var(--accent);
  color: var(--on-accent);
  font-weight: 900;
}
.logo svg { width: 1.45rem; height: 1.45rem; }
.header-actions, .hero-meta, .cue-meta, .cue-actions { flex-wrap: wrap; }
.connection {
  padding: .35rem .7rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  font-size: .8rem;
}
.connection::before {
  width: .45rem;
  height: .45rem;
  flex: none;
  border-radius: 50%;
  background: currentColor;
  content: "";
}
.connection:is(.online, [data-state="online"]) { color: var(--success); }

.shell {
  width: min(100%, 96rem);
  margin-inline: auto;
  padding: clamp(1rem, 3vw, 2.5rem) clamp(1rem, 4vw, 3rem) 3rem;
}
.hero {
  display: grid;
  gap: .8rem;
  margin-bottom: 1.25rem;
  padding: clamp(1.25rem, 4vw, 3rem);
  border: 1px solid #354868;
  border-radius: 22px;
  background:
    linear-gradient(115deg, #142039 12%, rgb(20 32 57 / 24%) 75%),
    repeating-linear-gradient(120deg, transparent 0 26px, rgb(178 200 255 / 8%) 26px 27px),
    #203454;
  box-shadow: inset 0 2px var(--accent), var(--shadow);
  overflow-wrap: anywhere;
}
.hero h1 {
  max-width: 22ch;
  font-size: clamp(2rem, 5vw, 4.1rem);
  font-weight: 820;
  line-height: 1.02;
  letter-spacing: -.055em;
  text-wrap: balance;
}
.hero-meta, .cue-meta {
  color: var(--muted);
  font-size: .84rem;
  font-variant-numeric: tabular-nums;
}
.hero-meta svg { color: var(--accent); }
.layout {
  display: grid;
  grid-template-columns: minmax(0, 1.9fr) minmax(17rem, 1fr);
  align-items: start;
  gap: 1.25rem;
}
.main-panel, .side-panel { display: grid; min-width: 0; gap: 1.25rem; }
.card {
  min-width: 0;
  padding: clamp(1rem, 2vw, 1.5rem);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}
.toolbar, .cue-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: .65rem 1rem;
}
.toolbar { margin-bottom: 1rem; }
.timeline, .chat-list, .material-list {
  display: grid;
  gap: .65rem;
  min-width: 0;
  margin: 0;
  padding: 0;
  list-style: none;
}
.cue {
  display: grid;
  min-width: 0;
  gap: .6rem;
  padding: .9rem 1rem;
  border: 1px solid var(--line);
  border-inline-start: 3px solid #53698d;
  border-radius: 12px;
  background: var(--raised);
  overflow-wrap: anywhere;
}
.cue-top { font-weight: 700; }
.cue-actions { justify-content: flex-end; }
.cue.done { border-inline-start-color: var(--success); background: #111c30; }
.cue.current {
  border-color: #747f42;
  border-inline-start-color: var(--accent);
  background: linear-gradient(100deg, #2b3529, var(--raised) 75%);
}
.cue.current .cue-top, .cue.current .cue-meta svg { color: var(--accent); }
.empty {
  padding: 1.4rem 1rem;
  border: 1px dashed #435472;
  border-radius: 12px;
  color: var(--muted);
  text-align: center;
  overflow-wrap: anywhere;
}

.chat-list {
  max-height: min(28rem, 56vh);
  overflow-y: auto;
  overscroll-behavior-y: contain;
  padding: .25rem;
}
.message {
  justify-self: start;
  max-width: min(90%, 34rem);
  padding: .65rem .85rem;
  border: 1px solid var(--line);
  border-radius: 12px 12px 12px 4px;
  background: var(--raised);
  overflow-wrap: anywhere;
}
.message.mine {
  justify-self: end;
  border-color: #657744;
  border-radius: 12px 12px 4px 12px;
  background: #27352c;
}
.composer {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  gap: .65rem;
  margin-top: .85rem;
}
.material-list > * {
  min-width: 0;
  padding: .7rem .8rem;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--raised);
  overflow-wrap: anywhere;
}

.tabs {
  display: flex;
  flex-wrap: wrap;
  gap: .35rem;
  margin-bottom: 1rem;
  padding: .3rem;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--bg);
}
.tabs :is(button, a, [role="tab"]) {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .45rem;
  min-height: 2.5rem;
  padding: .4rem .75rem;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  text-align: center;
  text-decoration: none;
}
.tabs :is(button, a, [role="tab"]):hover { color: var(--text); }
.tabs :is(.active, .current, [aria-selected="true"], [aria-current="page"]) {
  border-color: var(--line);
  background: var(--raised);
  color: var(--accent);
}
.stat-strip {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 9rem), 1fr));
  gap: .65rem;
  margin-block: 1rem;
}
.stat {
  display: grid;
  gap: .3rem;
  padding: .8rem;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--bg);
  overflow-wrap: anywhere;
}
.stat strong {
  font-size: clamp(1.3rem, 2.6vw, 1.85rem);
  font-variant-numeric: tabular-nums;
  letter-spacing: -.04em;
}
.progress, progress {
  display: block;
  width: 100%;
  height: .5rem;
  overflow: hidden;
  appearance: none;
  border: 0;
  border-radius: 999px;
  background: var(--line);
  accent-color: var(--accent);
}
.progress > :is(span, div) {
  display: block;
  width: var(--progress, 0%);
  max-width: 100%;
  height: 100%;
  border-radius: inherit;
  background: var(--accent);
}
progress::-webkit-progress-bar { background: var(--line); }
progress::-webkit-progress-value { border-radius: 999px; background: var(--accent); }
progress::-moz-progress-bar { border-radius: 999px; background: var(--accent); }

dialog, .modal {
  width: min(34rem, calc(100% - 2rem));
  max-height: calc(100dvh - 2rem);
  margin: auto;
  padding: clamp(1rem, 3vw, 1.75rem);
  overflow: auto;
  border: 1px solid #435777;
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow);
}
dialog::backdrop { background: rgb(3 7 17 / 76%); backdrop-filter: blur(4px); }
.modal:not(dialog) { position: fixed; z-index: 10; inset: 0; height: fit-content; }
.fields {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 13rem), 1fr));
  gap: .85rem;
  margin-block: 1rem;
}
.field { display: grid; min-width: 0; align-content: start; gap: .4rem; }
.field label, label.field { font-size: .875rem; font-weight: 600; }
fieldset { min-inline-size: 0; border: 1px solid var(--line); border-radius: 10px; }
legend { padding-inline: .35rem; color: var(--muted); }
input:not([type="checkbox"], [type="radio"], [type="range"], [type="color"], [type="hidden"], [type="submit"], [type="reset"], [type="button"], [type="image"]), textarea, select {
  display: block;
  width: 100%;
  min-width: 0;
  min-height: 2.75rem;
  padding: .55rem .75rem;
  border: 1px solid #435777;
  border-radius: 9px;
  background: var(--bg);
  color: var(--text);
}
input, textarea { accent-color: var(--accent); }
textarea { resize: vertical; }
::placeholder { color: var(--muted); opacity: 1; }
[aria-invalid="true"]:is(input, textarea, select) { border-color: #ff9da6; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .45rem;
  min-height: 2.75rem;
  padding: .5rem .85rem;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--raised);
  color: var(--text);
  font-weight: 700;
  text-align: center;
  text-decoration: none;
  overflow-wrap: anywhere;
  transition: background-color 150ms ease, border-color 150ms ease;
}
.btn:is(.ghost, [data-variant="ghost"]) { background: transparent; }
.btn:is(.primary, [data-variant="primary"]) {
  border-color: var(--accent);
  background: var(--accent);
  color: var(--on-accent);
}
.btn:not(:disabled, [aria-disabled="true"]):hover { border-color: #7286a9; background: #253652; }
.btn.primary:not(:disabled, [aria-disabled="true"]):hover,
.btn[data-variant="primary"]:not(:disabled, [aria-disabled="true"]):hover {
  border-color: var(--accent-hover);
  background: var(--accent-hover);
}
.btn[aria-disabled="true"] { cursor: not-allowed; opacity: .55; }
.toast {
  position: fixed;
  z-index: 20;
  inset-inline-end: 1rem;
  inset-block-end: max(1rem, env(safe-area-inset-bottom));
  width: max-content;
  max-width: min(26rem, calc(100% - 2rem));
  padding: .8rem 1rem;
  border: 1px solid var(--line);
  border-inline-start: 3px solid var(--accent);
  border-radius: 10px;
  background: var(--raised);
  color: var(--text);
  box-shadow: var(--shadow);
  overflow-wrap: anywhere;
}

@media (max-width: 52rem) {
  .layout { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 32rem) {
  .shell { padding-inline: .75rem; }
  .layout, .main-panel, .side-panel { gap: .85rem; }
  .hero { border-radius: var(--radius); }
  .cue { padding-inline: .75rem; }
  .cue-actions { justify-content: flex-start; }
  .tabs > * { flex: 1 1 auto; }
  .composer :is(input, textarea, select) { font-size: 1rem; }
}
@media (prefers-reduced-motion: reduce) {
  .btn { transition: none; }
}
