:root {
  color-scheme: dark;
  --bg: #090c0f;
  --panel: #11171c;
  --panel-raised: #171e24;
  --line: #2a343c;
  --muted: #8e9aa4;
  --text: #f4f7f8;
  --green: #9aff62;
  --green-dark: #183719;
  --amber: #ffca56;
  --red: #ff666b;
  --blue: #62b5ff;
  --radius: 18px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-synthesis: none;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: var(--bg);
}

body {
  min-width: 320px;
  min-height: 100vh;
  min-height: 100dvh;
  margin: 0;
  color: var(--text);
  background:
    radial-gradient(circle at 85% -10%, rgba(98, 181, 255, 0.1), transparent 32rem),
    var(--bg);
  -webkit-tap-highlight-color: transparent;
}

button,
input {
  font: inherit;
}

button {
  touch-action: manipulation;
}

button:focus-visible,
input:focus-visible,
label:has(input:focus-visible) {
  outline: 3px solid var(--blue);
  outline-offset: 3px;
}

.app-shell {
  width: min(1500px, 100%);
  margin: 0 auto;
  padding: max(22px, env(safe-area-inset-top)) max(22px, env(safe-area-inset-right)) max(28px, env(safe-area-inset-bottom)) max(22px, env(safe-area-inset-left));
}

.topbar {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 18px;
}

.eyebrow,
.section-number {
  margin: 0 0 7px;
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  font-size: clamp(1.65rem, 4vw, 2.7rem);
  letter-spacing: -0.045em;
  line-height: 0.95;
}

h1 span {
  color: var(--green);
  font-size: 0.46em;
  letter-spacing: 0;
  vertical-align: top;
}

h2 {
  margin-bottom: 0;
  font-size: 1.05rem;
  letter-spacing: -0.02em;
}

.status-strip {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 7px;
}

.status-chip {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 0 9px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  background: rgba(17, 23, 28, 0.84);
  font-size: 0.64rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  white-space: nowrap;
}

.status-chip::before {
  width: 6px;
  height: 6px;
  margin-right: 6px;
  border-radius: 50%;
  background: currentColor;
  content: "";
}

.status-chip.is-positive {
  color: var(--green);
  border-color: rgba(154, 255, 98, 0.28);
}

.status-chip.is-negative {
  color: var(--amber);
  border-color: rgba(255, 202, 86, 0.28);
}

.notice {
  min-height: 42px;
  margin-bottom: 18px;
  padding: 11px 14px;
  border: 1px solid var(--line);
  border-left: 3px solid var(--blue);
  border-radius: 10px;
  color: #c7d0d6;
  background: rgba(17, 23, 28, 0.76);
  font-size: 0.82rem;
  line-height: 1.45;
}

.notice[data-tone="success"] {
  border-left-color: var(--green);
}

.notice[data-tone="warning"],
.notice[data-tone="working"] {
  border-left-color: var(--amber);
}

.notice[data-tone="error"] {
  border-left-color: var(--red);
}

.workspace {
  display: grid;
  grid-template-columns: minmax(280px, 0.95fr) minmax(360px, 1.2fr);
  gap: 18px;
}

.panel,
.cue-card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(17, 23, 28, 0.92);
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.22);
}

.panel {
  padding: 20px;
}

.panel-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.file-picker,
.secondary-button,
.text-button {
  border: 1px solid var(--line);
  color: var(--text);
  background: var(--panel-raised);
  cursor: pointer;
}

.file-picker {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  padding: 0 15px;
  border-radius: 10px;
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0.02em;
  white-space: nowrap;
}

.file-picker:hover,
.secondary-button:hover,
.text-button:hover {
  border-color: #4a5964;
}

.file-picker input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.cue-list {
  display: grid;
  gap: 9px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.cue-row {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr) auto 64px;
  align-items: center;
  width: 100%;
  min-height: 66px;
  padding: 0 13px;
  border: 1px solid var(--line);
  border-radius: 12px;
  color: var(--text);
  background: #0d1216;
  text-align: left;
  cursor: pointer;
}

.cue-row:hover:not(:disabled) {
  background: #141b20;
}

.cue-row.armed {
  border-color: var(--green);
  box-shadow: inset 3px 0 0 var(--green);
}

.cue-row.current:not(.armed) {
  border-color: rgba(98, 181, 255, 0.7);
}

.cue-row.empty-cue {
  color: #66727b;
  cursor: default;
}

.cue-number,
.cue-duration,
.cue-marker {
  color: var(--muted);
  font-family: ui-monospace, "SFMono-Regular", Consolas, monospace;
  font-size: 0.72rem;
}

.cue-row strong {
  overflow: hidden;
  padding-right: 10px;
  font-size: 0.88rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.cue-marker {
  color: var(--green);
  font-size: 0.59rem;
  font-weight: 800;
  text-align: right;
}

.audio-tools {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 15px;
  margin-top: 16px;
}

.secondary-button,
.text-button {
  border-radius: 9px;
}

.secondary-button {
  min-height: 38px;
  padding: 0 13px;
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.audio-tools p {
  margin-bottom: 0;
  color: var(--muted);
  font-size: 0.68rem;
  text-align: right;
}

.control-stack {
  display: grid;
  gap: 13px;
}

.now-next-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 13px;
}

.cue-card {
  min-width: 0;
  padding: 17px 18px;
}

.cue-card p {
  margin-bottom: 13px;
  color: var(--muted);
  font-size: 0.66rem;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.cue-card strong {
  display: block;
  overflow: hidden;
  margin-bottom: 7px;
  font-size: 1.05rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.cue-card span {
  color: var(--blue);
  font-family: ui-monospace, "SFMono-Regular", Consolas, monospace;
  font-size: 0.62rem;
  font-weight: 800;
  letter-spacing: 0.08em;
}

.next-card span {
  color: var(--green);
}

.go-button,
.transport-button {
  border: 0;
  border-radius: var(--radius);
  color: #071006;
  cursor: pointer;
  transition: filter 120ms ease, transform 80ms ease;
}

.go-button:hover:not(:disabled),
.transport-button:hover:not(:disabled) {
  filter: brightness(1.05);
}

.go-button:active:not(:disabled),
.transport-button:active:not(:disabled) {
  transform: scale(0.992);
}

.go-button:disabled,
.transport-button:disabled,
.secondary-button:disabled {
  cursor: not-allowed;
  filter: grayscale(0.8);
  opacity: 0.42;
}

.go-button {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 240px;
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.18), transparent 38%),
    var(--green);
  box-shadow: 0 22px 60px rgba(95, 255, 90, 0.13);
}

.go-button span {
  font-size: clamp(4.5rem, 11vw, 8.5rem);
  font-weight: 950;
  letter-spacing: -0.08em;
  line-height: 0.85;
}

.go-button small,
.transport-button small {
  margin-top: 18px;
  font-size: 0.64rem;
  font-weight: 900;
  letter-spacing: 0.16em;
}

.transport-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 13px;
}

.transport-button {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100px;
}

.transport-button span {
  font-size: 1.35rem;
  font-weight: 950;
  letter-spacing: -0.03em;
}

.transport-button small {
  margin-top: 8px;
  opacity: 0.72;
}

.fade-button {
  background: var(--amber);
}

.stop-button {
  background: var(--red);
}

.telemetry-panel {
  grid-column: 1 / -1;
  min-width: 0;
}

.telemetry-heading {
  align-items: flex-end;
}

.metric-pair {
  display: flex;
  gap: 28px;
}

.metric-pair div {
  display: grid;
  gap: 3px;
}

.metric-pair span {
  color: var(--muted);
  font-size: 0.62rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.metric-pair strong {
  max-width: 220px;
  overflow: hidden;
  font-family: ui-monospace, "SFMono-Regular", Consolas, monospace;
  font-size: 1.1rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.log-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 12px;
}

.log-actions p {
  margin-bottom: 0;
  color: var(--muted);
  font-size: 0.7rem;
}

.log-actions > div {
  display: flex;
  gap: 7px;
}

.text-button {
  min-height: 34px;
  padding: 0 11px;
  font-size: 0.67rem;
  font-weight: 800;
}

.danger-text {
  color: var(--red);
}

.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 11px;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-family: ui-monospace, "SFMono-Regular", Consolas, monospace;
  font-size: 0.68rem;
  white-space: nowrap;
}

th,
td {
  padding: 10px 12px;
  border-bottom: 1px solid #222b32;
  text-align: left;
}

th {
  color: var(--muted);
  background: #0d1216;
  font-size: 0.58rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

tbody tr:last-child td {
  border-bottom: 0;
}

.log-warning td:last-child {
  color: var(--amber);
}

.empty-log td {
  height: 70px;
  color: var(--muted);
  text-align: center;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
}

@media (max-width: 820px) {
  .app-shell {
    padding-inline: max(14px, env(safe-area-inset-left));
  }

  .topbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .status-strip {
    justify-content: flex-start;
  }

  .workspace {
    grid-template-columns: 1fr;
  }

  .library-panel {
    order: 2;
  }

  .control-stack {
    order: 1;
  }

  .telemetry-panel {
    order: 3;
  }

  .go-button {
    min-height: 210px;
  }
}

@media (max-width: 560px) {
  .panel {
    padding: 16px;
  }

  .panel-heading,
  .telemetry-heading,
  .log-actions,
  .audio-tools {
    align-items: stretch;
    flex-direction: column;
  }

  .file-picker,
  .secondary-button {
    width: 100%;
  }

  .audio-tools p {
    text-align: left;
  }

  .cue-row {
    grid-template-columns: 36px minmax(0, 1fr) auto;
  }

  .cue-marker {
    display: none;
  }

  .metric-pair {
    justify-content: space-between;
  }

  .log-actions > div {
    justify-content: flex-end;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition: none !important;
  }
}

