:root {
  --bg: #121315;
  --panel: #1c1e21;
  --panel-2: #25272b;
  --line: #34383e;
  --text: #f2f3f4;
  --muted: #9aa0a6;
  --accent: #e8e8e8;
  --sign-red: #C4161C;
  --cap: #8d9094;
  --cap-dark: #6e7176;
  --cap-light: #b4b6b9;
  --ok: #8fd18f;
  --hidden: #8a8380;
  --font: "Inter Tight", Inter, "Helvetica Neue", Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }
html, body {
  margin: 0;
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  -webkit-font-smoothing: antialiased;
}
body { min-height: 100vh; }

.app {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 20px 8px;
  flex-shrink: 0;
}
.brand {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 8px;
  min-width: 0;
}
.brand-name { font-weight: 650; letter-spacing: 0.01em; }
.brand-sep { color: var(--muted); }
.brand-title { color: var(--muted); font-size: 14px; }
.badge {
  font-size: 11px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 4px 10px;
  white-space: nowrap;
}

.main {
  flex: 1;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 300px;
  gap: 16px;
  padding: 4px 20px 20px;
  min-height: 0;
}

.stage-wrap {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
}
.stage {
  width: 100%;
  aspect-ratio: 16 / 9;
  max-height: calc(100vh - 150px);
  margin: 0 auto;
  background: #0a0a0b;
  border-radius: 6px;
  overflow: hidden;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.45);
  position: relative;
}
.sign {
  position: absolute;
  inset: 0;
  display: block;
}
.sign-bg {
  position: absolute;
  inset: 0 6.875% 0 0; /* 132/1920, scales with the sign */
  background-color: var(--sign-red);
  --bg-color: var(--sign-red);
}
.sign-bg[data-pattern="solid"] {
  background-image: none;
}
.sign-bg[data-pattern="stripes"] {
  background-image: repeating-linear-gradient(
    -45deg,
    rgba(255, 255, 255, 0.07) 0 14px,
    transparent 14px 28px
  );
}
.sign-bg[data-pattern="dots"] {
  background-image: radial-gradient(rgba(255, 255, 255, 0.16) 1.15px, transparent 1.25px);
  background-size: 18px 18px;
}
.sign-bg[data-pattern="grid"] {
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.08) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.08) 1px, transparent 1px);
  background-size: 32px 32px;
}

.layer {
  position: absolute;
  inset: 0;
  pointer-events: none;
}
.layer svg { display: block; width: 100%; height: 100%; }
.layer.is-hidden { visibility: hidden; }

.endcap {
  position: absolute;
  top: 0;
  right: 0;
  width: 6.875%; /* 132/1920 */
  height: 100%;
  background: linear-gradient(90deg, var(--cap-dark) 0 8px, var(--cap) 8px 100%);
  box-shadow: inset 3px 0 0 rgba(255, 255, 255, 0.18), inset -2px 0 0 rgba(0, 0, 0, 0.2);
  display: flex;
  align-items: center;
  justify-content: center;
}
.endcap-face {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(180deg, rgba(255,255,255,0.14), rgba(255,255,255,0) 28%, rgba(0,0,0,0.08) 100%);
}
.endcap-g {
  font-weight: 700;
  font-size: clamp(48px, 8vw, 92px);
  color: #f4f4f5;
  letter-spacing: -0.04em;
  text-shadow: 0 1px 0 rgba(255,255,255,0.25), 0 -1px 0 rgba(0,0,0,0.25);
  line-height: 1;
}

.disclaimer {
  margin: 10px 2px 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.board {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px 14px 16px;
  overflow: auto;
  min-height: 0;
  max-height: calc(100vh - 96px);
}
.board-head h1 {
  margin: 0 0 4px;
  font-size: 16px;
  font-weight: 650;
}
.board-head p,
.hint {
  margin: 0 0 12px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
}

.global-actions {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
}
.btn {
  appearance: none;
  border: 1px solid var(--line);
  background: var(--panel-2);
  color: var(--text);
  font: inherit;
  font-size: 12px;
  padding: 6px 10px;
  border-radius: 5px;
  cursor: pointer;
}
.btn:hover { border-color: #5a5f66; }
.btn:active { transform: translateY(1px); }
.btn.is-on {
  border-color: #6a9a6a;
  color: var(--ok);
}
.btn.is-warn {
  color: #e0c48a;
}

.layer-list { display: flex; flex-direction: column; gap: 10px; }
.layer-card {
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 10px;
}
.layer-card.is-hidden-layer { opacity: 0.62; }
.layer-card .row-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
}
.layer-name { font-size: 13px; font-weight: 650; }
.status {
  font-size: 10px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}
.status.playing { color: var(--ok); }
.status.paused { color: #e0c48a; }
.status.hidden { color: var(--hidden); }
.controls {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.bg-controls {
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}
.bg-controls h2 {
  margin: 0 0 6px;
  font-size: 13px;
  font-weight: 650;
}
.field {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
  font-size: 12px;
}
.field input[type="color"] {
  width: 48px;
  height: 28px;
  border: 1px solid var(--line);
  background: transparent;
  padding: 0;
  cursor: pointer;
}
.field select {
  font: inherit;
  font-size: 12px;
  color: var(--text);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 4px 6px;
}

@media (max-width: 1100px) {
  .main {
    grid-template-columns: 1fr;
    grid-template-rows: auto auto;
  }
  .stage { max-height: none; width: 100%; }
  .board { max-height: none; }
}
