:root {
  --bg: #0b0d12;
  --bg-soft: #0f121a;
  --panel: #131824;
  --panel-2: #1a2130;
  --line: #263043;
  --text: #e8edf7;
  --muted: #8b97ad;
  --accent: #ffb454;
  --accent-2: #4ecdc4;
  --danger: #ff6b6b;
  --ok: #69db7c;
  --shadow: 0 8px 30px rgba(0, 0, 0, 0.35);
}

* {
  box-sizing: border-box;
}

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

body {
  background: var(--bg);
  color: var(--text);
  font: 13px/1.45 ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto,
    sans-serif;
  overflow: hidden;
}

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

#app {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  height: 100vh;
  height: 100dvh;
}

header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(180deg, #151b28, #10141d);
}

.brand {
  display: flex;
  align-items: baseline;
  gap: 10px;
  min-width: 0;
}

.brand strong {
  font-size: 15px;
  letter-spacing: 0.02em;
  white-space: nowrap;
}

.brand span {
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.btn {
  appearance: none;
  border: 1px solid var(--line);
  background: var(--panel-2);
  color: var(--text);
  padding: 6px 11px;
  border-radius: 7px;
  cursor: pointer;
  white-space: nowrap;
  transition: background 120ms ease, border-color 120ms ease;
}

.btn:hover {
  background: #222b3d;
  border-color: #35425a;
}

.btn.primary {
  background: #2a2113;
  border-color: #5b4421;
  color: var(--accent);
}

.btn.primary:hover {
  background: #362a18;
}

.btn input[type="file"] {
  display: none;
}

main {
  display: grid;
  grid-template-columns: 310px minmax(0, 1fr);
  min-height: 0;
}

aside {
  min-height: 0;
  overflow: auto;
  padding: 14px;
  border-right: 1px solid var(--line);
  background: var(--panel);
}

aside section + section {
  margin-top: 20px;
}

aside h2 {
  margin: 0 0 8px;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--muted);
  font-weight: 600;
}

#meta {
  display: grid;
  gap: 6px;
}

.meta-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 1px dashed rgba(255, 255, 255, 0.06);
  padding-bottom: 5px;
}

.meta-row dt {
  color: var(--muted);
  white-space: nowrap;
}

.meta-row dd {
  margin: 0;
  text-align: right;
  overflow-wrap: anywhere;
}

#roster,
#events {
  display: grid;
  gap: 6px;
}

.roster-item,
.event-item {
  display: flex;
  align-items: center;
  gap: 9px;
  width: 100%;
  text-align: left;
  border: 1px solid transparent;
  background: var(--panel-2);
  border-radius: 8px;
  padding: 7px 9px;
  cursor: pointer;
}

.roster-item:hover,
.event-item:hover {
  border-color: #35425a;
}

.roster-item.active {
  border-color: var(--accent);
  background: #241d12;
}

.dot {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  flex: 0 0 auto;
  box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.06);
}

.roster-name {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.roster-slot {
  margin-left: auto;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  font-size: 11px;
}

.badge {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--accent-2);
  border: 1px solid rgba(78, 205, 196, 0.25);
  border-radius: 999px;
  padding: 1px 6px;
}

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

.event-time {
  color: var(--accent);
  font-variant-numeric: tabular-nums;
  flex: 0 0 auto;
}

#stage {
  position: relative;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  background:
    radial-gradient(ellipse at 30% 20%, rgba(78, 205, 196, 0.05), transparent 55%),
    radial-gradient(ellipse at 75% 80%, rgba(255, 180, 84, 0.05), transparent 50%),
    var(--bg-soft);
}

canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  cursor: crosshair;
}

#glcanvas {
  visibility: hidden;
  cursor: grab;
}

#glcanvas.dragging {
  cursor: grabbing;
}

#hud {
  position: absolute;
  inset: 0;
  pointer-events: none;
  padding: 14px;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 14px;
}

.hud-card {
  background: rgba(10, 13, 19, 0.76);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 9px;
  padding: 9px 11px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(6px);
}

.hud-card h3 {
  margin: 0 0 6px;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--muted);
  font-weight: 600;
}

.hud-line {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  font-variant-numeric: tabular-nums;
}

.hud-line .path {
  max-width: 230px;
  overflow-wrap: anywhere;
  text-align: right;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.3;
}

.hud-line + .hud-line {
  margin-top: 3px;
}

.hud-stats {
  display: grid;
  grid-template-columns: repeat(2, minmax(70px, 1fr));
  gap: 4px 16px;
  font-variant-numeric: tabular-nums;
}

.hud-stats .label {
  color: var(--muted);
}

.hud-stats .value {
  text-align: right;
}

#empty {
  position: absolute;
  inset: 0;
  display: grid;
  place-content: center;
  gap: 10px;
  text-align: center;
  padding: 24px;
  color: var(--muted);
}

#empty strong {
  color: var(--text);
  font-size: 17px;
  font-weight: 600;
}

#empty kbd {
  border: 1px solid var(--line);
  background: var(--panel-2);
  border-radius: 5px;
  padding: 1px 5px;
  color: var(--text);
  font-size: 11px;
}

#toast {
  position: absolute;
  left: 50%;
  bottom: 18px;
  transform: translateX(-50%);
  max-width: min(560px, calc(100% - 40px));
  background: #2a1518;
  border: 1px solid #6b2d34;
  color: #ffd3d8;
  border-radius: 8px;
  padding: 8px 12px;
  box-shadow: var(--shadow);
  opacity: 0;
  pointer-events: none;
  transition: opacity 160ms ease;
}

#toast.show {
  opacity: 1;
}

footer {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 14px;
  border-top: 1px solid var(--line);
  background: linear-gradient(0deg, #151b28, #10141d);
  flex-wrap: wrap;
}

footer .grow {
  flex: 1 1 220px;
  min-width: 120px;
}

#timeline {
  width: 100%;
  accent-color: var(--accent);
}

#clock {
  min-width: 86px;
  text-align: right;
  font-variant-numeric: tabular-nums;
  color: var(--muted);
}

select {
  appearance: none;
  border: 1px solid var(--line);
  background: var(--panel-2);
  border-radius: 7px;
  padding: 6px 9px;
}

label.check {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  white-space: nowrap;
  cursor: pointer;
}

input[type="checkbox"] {
  accent-color: var(--accent);
}

@media (max-width: 860px) {
  body {
    overflow: auto;
  }

  #app {
    height: auto;
    min-height: 100dvh;
  }

  main {
    grid-template-columns: 1fr;
    grid-template-rows: auto minmax(360px, 62vh);
  }

  aside {
    border-right: 0;
    border-bottom: 1px solid var(--line);
    max-height: 42vh;
  }

  #stage {
    min-height: 360px;
  }
}
