/* Oslo Laptop Orchestra — browser instruments (laptop / desktop) */
:root {
  --bg: #080a0e;
  --surface: #141a24;
  --accent: #7dd3fc;
  --accent-warm: #fb923c;
  --text: #f1f5f9;
  --muted: #94a3b8;
  --header-h: 44px;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
}

body.app-shell {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  max-height: 100vh;
  overflow: hidden;
}

a { color: var(--accent); }

.app-header, .hub-header {
  flex-shrink: 0;
  min-height: var(--header-h);
  padding: 0 0.75rem;
  background: var(--surface);
  border-bottom: 1px solid #2d3548;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.app-header h1, .hub-header h1 {
  font-size: 1rem;
  font-weight: 600;
  margin: 0;
  flex: 1;
}

.back-link {
  text-decoration: none;
  font-size: 1.2rem;
  padding: 0.25rem 0.5rem;
  color: var(--muted);
}

.back-link:hover { color: var(--accent); }

.header-controls {
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.learn-toggle, .audio-toggle {
  font: 600 0.72rem/1 system-ui, sans-serif;
  padding: 0.35rem 0.55rem;
  border-radius: 6px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: #252b38;
  color: var(--text);
  cursor: pointer;
}

.audio-toggle.is-on {
  background: var(--accent);
  color: #0a0e14;
  border-color: var(--accent);
}

.app-volume-bar {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.25rem 0.75rem;
  font-size: 0.75rem;
  background: #111827;
  border-bottom: 1px solid #2d3548;
}

.app-volume-bar input[type="range"] { flex: 1; max-width: 12rem; }

.learn-panel {
  display: none;
  flex-shrink: 0;
  max-height: 40vh;
  overflow-y: auto;
  padding: 0.75rem 1rem;
  margin: 0;
  background: #111827;
  border-bottom: 1px solid #2d3548;
  font-size: 0.85rem;
  line-height: 1.45;
}

.learn-panel.open { display: block; }
.learn-panel h2 { margin: 0 0 0.35rem; font-size: 0.95rem; }
.learn-panel p { margin: 0.35rem 0; color: var(--muted); }

.main-stage {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.hidden { display: none !important; }

.status-bar {
  flex-shrink: 0;
  padding: 0.25rem 0.75rem;
  font-size: 0.75rem;
  color: var(--muted);
  text-align: center;
  background: #111827;
}

.status-bar.ok { color: var(--accent); }

.app-toolbar {
  flex-shrink: 0;
  display: flex;
  gap: 0.5rem;
  padding: 0.5rem 0.75rem;
  justify-content: center;
  flex-wrap: wrap;
}

.btn, .btn-secondary {
  font: 600 0.8rem/1 system-ui, sans-serif;
  padding: 0.45rem 0.85rem;
  border-radius: 6px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  cursor: pointer;
}

.btn {
  background: var(--accent);
  color: #0a0e14;
  border-color: var(--accent);
}

.btn-secondary {
  background: #252b38;
  color: var(--text);
}

.role-tabs {
  display: flex;
  gap: 0.35rem;
  padding: 0.35rem 0.75rem;
  flex-shrink: 0;
}

.role-tabs button {
  flex: 1;
  padding: 0.4rem;
  border-radius: 6px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: #252b38;
  color: var(--text);
  cursor: pointer;
}

.role-tabs button.active {
  background: var(--accent-warm);
  color: #0a0e14;
  border-color: var(--accent-warm);
}

.link-box {
  font-size: 0.7rem;
  word-break: break-all;
  padding: 0.5rem;
  background: #0d1117;
  border-radius: 6px;
  border: 1px solid #2d3548;
  margin: 0.35rem 0;
}

.scroll-panel { margin: 0.5rem 0; }

/* Hub */
body.hub {
  min-height: 100vh;
}

.hub-header p {
  margin: 0;
  font-size: 0.8rem;
  color: var(--muted);
  flex: 1 1 100%;
}

.hub-intro {
  padding: 1rem 1.25rem;
  max-width: 52rem;
  font-size: 0.9rem;
  line-height: 1.5;
  color: var(--muted);
}

.hub-intro strong { color: var(--text); }

.app-list {
  list-style: none;
  margin: 0;
  padding: 0 1rem 2rem;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(16rem, 1fr));
  gap: 0.75rem;
  max-width: 72rem;
}

.app-list a {
  display: block;
  padding: 1rem;
  border-radius: 8px;
  background: var(--surface);
  border: 1px solid #2d3548;
  text-decoration: none;
  color: inherit;
  transition: border-color 0.15s;
}

.app-list a:hover {
  border-color: var(--accent);
}

.app-list .tag {
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--accent);
  margin-bottom: 0.25rem;
}

.app-list h2 {
  margin: 0 0 0.35rem;
  font-size: 1rem;
}

.app-list p {
  margin: 0;
  font-size: 0.78rem;
  color: var(--muted);
  line-height: 1.35;
}

.app-list .origin {
  font-size: 0.68rem;
  color: #64748b;
  margin-top: 0.5rem;
}

.tap-bloom-stage {
  flex: 1;
  min-height: 0;
  display: flex;
  padding: 0.5rem;
}

.tap-bloom-canvas {
  flex: 1;
  width: 100%;
  border-radius: 10px;
  border: 1px solid #2d3548;
  background: #050608;
  cursor: crosshair;
}

.green-button-stage {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(circle at center, #1e293b 0%, #080a0e 70%);
}

.green-button-stage #swellBtn {
  width: min(40vw, 220px);
  height: min(40vw, 220px);
  border-radius: 50%;
  border: 2px solid #86efac;
  background: radial-gradient(circle at 35% 30%, #4ade80 0%, #16a34a 55%, #14532d 100%);
  pointer-events: none;
}

.green-button-stage.holding #swellBtn {
  filter: brightness(1.1);
  box-shadow: 0 0 40px rgba(74, 222, 128, 0.45);
}

/* Full-screen performance stage (laptop-native apps) */
.stage-full {
  flex: 1;
  min-height: 0;
  position: relative;
  margin: 0;
  border: none;
  border-top: 1px solid #2d3548;
  background: radial-gradient(ellipse at 50% 40%, #1a2438 0%, #080a0e 72%);
  touch-action: none;
  cursor: crosshair;
  overflow: hidden;
}

.stage-reticle {
  position: absolute;
  width: 14px;
  height: 14px;
  margin: -7px 0 0 -7px;
  border-radius: 50%;
  border: 2px solid var(--accent-warm);
  box-shadow: 0 0 16px rgba(251, 146, 60, 0.55);
  pointer-events: none;
  left: 50%;
  top: 50%;
}

.stage-horizon {
  background: linear-gradient(180deg, #0f172a 0%, #1e3a5f 45%, #0f172a 100%);
  --lift: 50%;
}

.stage-horizon::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: var(--lift);
  height: 2px;
  background: var(--accent);
  box-shadow: 0 0 24px var(--accent);
  opacity: 0.7;
  pointer-events: none;
}

.stage-slices canvas {
  width: 100%;
  height: 100%;
  display: block;
}

.stage-vision video,
.stage-vision canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.stage-vision canvas {
  opacity: 0.55;
  mix-blend-mode: screen;
}

.hud-bar {
  font-variant-numeric: tabular-nums;
}

/* Sequencers */
.seq-toolbar {
  flex-shrink: 0;
  padding: 0.4rem 0.75rem;
  background: #111827;
  border-bottom: 1px solid #2d3548;
  font-size: 0.8rem;
}

.seq-toolbar .control-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem;
  margin-bottom: 0.35rem;
}

.seq-toolbar .control-row:last-child {
  margin-bottom: 0;
}

.seq-toolbar label {
  color: var(--muted);
}

.seq-toolbar input[type="range"] {
  width: 6rem;
}

.seq-meta {
  margin: 0 0 0.35rem;
  font-size: 0.72rem;
  color: var(--muted);
}

.seq-toolbar .btn.active,
.btn-play.active {
  background: var(--accent-warm);
  color: #0a0e14;
  border-color: var(--accent-warm);
}

.stage-seq .canvas-fill {
  width: 100%;
  height: 100%;
  display: block;
}

#ringPick {
  gap: 0.25rem;
}

#ringPick .active {
  border-color: var(--accent);
  color: var(--accent);
}

/* Beat matrix */
.stage-matrix {
  display: grid;
  grid-template-columns: 5.5rem repeat(16, 1fr);
  grid-auto-rows: minmax(2rem, 1fr);
  gap: 3px;
  padding: 0.5rem;
  align-content: stretch;
  background: #0a0e14;
}

.matrix-label {
  display: flex;
  align-items: center;
  font-size: 0.72rem;
  color: var(--muted);
  padding-right: 0.35rem;
}

.matrix-cell {
  border: 1px solid #2d3548;
  border-radius: 4px;
  background: #1a1f2a;
  cursor: pointer;
  min-height: 1.5rem;
}

.matrix-cell.on {
  background: var(--accent-warm);
  border-color: #fdba74;
}

.matrix-cell.play {
  box-shadow: inset 0 0 0 2px var(--accent);
}

/* Shadow seq */
.stage-shadow {
  display: flex;
  flex-direction: column;
  padding: 0.35rem;
  gap: 0.35rem;
}

.stage-shadow canvas {
  width: 100%;
  border-radius: 8px;
  border: 1px solid #2d3548;
}

.shadow-steps {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  gap: 4px;
  flex: 1;
  min-height: 3rem;
}

.shadow-step {
  border-radius: 6px;
  background: #1a1f2a;
  border: 1px solid #334155;
}

.shadow-step.on {
  background: #4c1d95;
}

.shadow-step.play {
  background: var(--accent);
}

.wash-meter,
.theremin-meter {
  width: min(28rem, 80%);
  height: 0.55rem;
  background: #1a1f2a;
  border-radius: 4px;
  margin: auto;
}

.wash-meter span,
.theremin-meter span {
  display: block;
  height: 100%;
  width: 0%;
  background: var(--accent);
  border-radius: 4px;
}

.theremin-freq {
  text-align: center;
  font-size: 1.5rem;
  color: var(--accent);
  margin-top: 1rem;
}
