*, *::before, *::after { box-sizing: border-box; }

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

body {
  font-family: var(--font-sans);
  background: var(--bg-0);
  color: var(--text-1);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow: hidden;
}

/* Ambient background — two slow drifting radial gradients */
body::before {
  content: "";
  position: fixed;
  inset: -20%;
  z-index: 0;
  pointer-events: none;
  background:
    radial-gradient(40% 40% at 20% 20%, rgba(110,168,255,.06), transparent 70%),
    radial-gradient(45% 45% at 82% 75%, rgba(124,243,209,.06), transparent 70%);
  animation: ambient-drift 40s ease-in-out infinite alternate;
}

#app {
  position: relative;
  z-index: 1;
  height: 100%;
  display: flex;
  flex-direction: column;
}

h1, h2, h3, h4 { margin: 0; color: var(--text-0); font-weight: 600; line-height: 1.25; }
p { margin: 0; }

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

button {
  font-family: inherit;
  font-size: inherit;
  cursor: pointer;
  border: none;
  background: none;
  color: inherit;
}

input, select, textarea {
  font-family: inherit;
  font-size: inherit;
  color: var(--text-0);
}

.tnum { font-variant-numeric: tabular-nums; }
.mono { font-family: var(--font-mono); }

/* Focus */
:focus { outline: none; }
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: var(--r-1);
}

/* Scrollbars */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: var(--stroke);
  border-radius: var(--r-full);
  border: 2px solid transparent;
  background-clip: padding-box;
}
::-webkit-scrollbar-thumb:hover { background: #33405a; }

/* Screen reader only */
.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0,0,0,0);
  white-space: nowrap;
  border: 0;
}

.icon {
  width: 1em; height: 1em;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.75;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex: none;
}

/* Layout skeleton */
.cockpit {
  flex: 1;
  display: grid;
  grid-template-columns: 340px 1fr 380px;
  gap: var(--s-4);
  padding: var(--s-4);
  min-height: 0;
  overflow: hidden;
}
.rail { min-height: 0; overflow-y: auto; overflow-x: hidden; padding-right: 2px; }
.stage { min-height: 0; overflow-y: auto; overflow-x: hidden; padding-right: 2px; }

/* Mobile tab bar hidden on desktop */
.tabbar { display: none; }

@media (max-width: 1180px) {
  .cockpit { grid-template-columns: 1fr; grid-template-rows: 1fr; position: relative; }
  .rail-left, .rail-right { display: none; }
  .cockpit[data-tab="composer"] .rail-left { display: block; }
  .cockpit[data-tab="results"] .stage { display: block; }
  .cockpit[data-tab="activity"] .rail-right { display: block; }
  .cockpit[data-tab="composer"] .stage,
  .cockpit[data-tab="activity"] .stage { display: none; }
  .cockpit[data-tab="results"] .rail-left,
  .cockpit[data-tab="results"] .rail-right { display: none; }
  .cockpit[data-tab="composer"] .rail-right,
  .cockpit[data-tab="activity"] .rail-left { display: none; }
  .rail-left, .rail-right { display: block; }
  .tabbar { display: flex; }
}

@media (min-width: 1181px) {
  .cockpit .rail-left, .cockpit .rail-right, .cockpit .stage { display: block !important; }
}
