/* ==========================================================================
   Playable demo shell — sits on top of the main site stylesheet.
   External file only: the site's Content-Security-Policy disallows inline CSS.
   ========================================================================== */

.lab { margin: 0; background: #06070b; overflow: hidden; }

.lab-app {
  display: grid;
  grid-template-rows: auto 1fr auto;
  height: 100svh;
  width: 100%;
  max-width: 100vw;
  overflow-x: hidden;
}

/* ── top bar ──────────────────────────────────────────────────────────── */
.lab-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 12px clamp(14px, 2.4vw, 28px);
  border-bottom: 1px solid var(--line);
  background: rgba(9, 11, 17, 0.86);
  backdrop-filter: blur(14px);
  z-index: 5;
}

.lab-brand { display: inline-flex; align-items: center; gap: 10px; font-family: var(--font-display); font-weight: 600; font-size: 1rem; letter-spacing: -0.01em; }
.lab-brand em { font-style: normal; color: var(--ink-4); font-weight: 400; }

.lab-stats { display: flex; align-items: center; gap: clamp(10px, 2vw, 26px); }
.lab-stat { display: inline-flex; align-items: center; gap: 7px; font-size: 0.92rem; }
.lab-stat b { font-family: var(--font-display); font-variant-numeric: tabular-nums; font-size: 1.05rem; }
.lab-stat small { color: var(--ink-4); font-family: var(--font-mono); font-size: 0.6rem; letter-spacing: 0.12em; text-transform: uppercase; }
.lab-stat i { width: 8px; height: 8px; border-radius: 99px; display: inline-block; }
.ic-gold { background: #ffc857; box-shadow: 0 0 10px rgba(255, 200, 87, 0.6); }
.ic-life { background: #ff6b6b; box-shadow: 0 0 10px rgba(255, 107, 107, 0.6); }
.ic-wave { background: var(--accent-2); box-shadow: 0 0 10px rgba(139, 92, 246, 0.6); }
.ic-score { background: #22d3ee; box-shadow: 0 0 10px rgba(34, 211, 238, 0.6); }
.lab-stat--score { padding-left: clamp(6px, 1.2vw, 16px); border-left: 1px solid var(--line); }

.lab-tools { display: flex; align-items: center; gap: 8px; }
.lab-btn {
  border: 1px solid var(--line); background: rgba(255, 255, 255, 0.03); color: var(--ink-2);
  padding: 8px 14px; border-radius: 99px; font-size: 0.82rem; cursor: pointer; white-space: nowrap;
  transition: color .25s var(--ease), border-color .25s var(--ease);
}
.lab-btn:hover { color: var(--ink); border-color: var(--line-2); }

/* ── stage ────────────────────────────────────────────────────────────── */
.lab-stage { position: relative; overflow: hidden; }
#gl { display: block; width: 100%; height: 100%; touch-action: none; cursor: crosshair; }

.lab-overlay {
  position: absolute; inset: 0; display: grid; place-items: center; padding: 24px;
  background: radial-gradient(ellipse 70% 60% at 50% 40%, rgba(77, 124, 254, 0.13), transparent 65%), rgba(5, 6, 10, 0.82);
  backdrop-filter: blur(7px);
  opacity: 0; visibility: hidden; transition: opacity .35s var(--ease), visibility .35s;
  z-index: 6;
}
.lab-overlay.is-open { opacity: 1; visibility: visible; }

.lab-card {
  max-width: min(620px, 100%);
  min-width: 0;
  width: 100%;
  overflow-wrap: anywhere;
  border: 1px solid var(--line); border-radius: var(--r-lg);
  background: linear-gradient(180deg, rgba(18, 22, 32, 0.96), rgba(10, 12, 18, 0.96));
  padding: clamp(24px, 4vw, 42px);
  box-shadow: 0 30px 80px -40px rgba(0, 0, 0, 0.9);
}
.lab-title { font-family: var(--font-display); font-size: clamp(1.5rem, 3.4vw, 2.3rem); font-weight: 700; letter-spacing: -0.025em; line-height: 1.08; margin: 14px 0 0; }
.lab-lead { color: var(--ink-2); margin-top: 16px; font-size: 0.98rem; line-height: 1.6; }
.lab-howto { margin: 20px 0 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 10px; }
.lab-howto li { position: relative; padding-left: 22px; color: var(--ink-3); font-size: 0.9rem; }
.lab-howto li::before { content: ''; position: absolute; left: 0; top: 0.62em; width: 9px; height: 1px; background: var(--accent); }
.lab-card-actions { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; margin-top: 28px; }
.lab-hint { color: var(--ink-4); font-size: 0.8rem; }

/* ── dock ─────────────────────────────────────────────────────────────── */
.lab-dock {
  display: flex; align-items: center; justify-content: space-between; gap: 18px;
  padding: 12px clamp(14px, 2.4vw, 28px);
  border-top: 1px solid var(--line);
  background: rgba(9, 11, 17, 0.9); backdrop-filter: blur(14px);
  z-index: 5;
}
.lab-towers { display: flex; gap: 10px; flex-wrap: wrap; }

.tower-card {
  display: flex; align-items: center; gap: 11px;
  border: 1px solid var(--line); border-radius: 12px;
  background: rgba(255, 255, 255, 0.025);
  padding: 9px 14px 9px 10px; cursor: pointer;
  transition: border-color .25s var(--ease), background .25s var(--ease), transform .25s var(--ease);
}
.tower-card:hover { border-color: var(--line-2); transform: translateY(-2px); }
.tower-card.is-active { border-color: var(--accent); background: rgba(77, 124, 254, 0.12); }
.tower-card.is-poor { opacity: 0.42; }
.tower-swatch { width: 26px; height: 26px; border-radius: 7px; flex: 0 0 auto; }
.tower-meta { display: flex; flex-direction: column; line-height: 1.25; }
.tower-name { font-size: 0.86rem; font-weight: 500; }
.tower-cost { font-family: var(--font-mono); font-size: 0.68rem; color: var(--ink-4); letter-spacing: 0.06em; }
.tower-key { position: absolute; }

.lab-wave { display: flex; align-items: center; gap: 14px; }
.lab-wave .btn[disabled] { opacity: 0.4; cursor: not-allowed; }

/* ── level banner ─────────────────────────────────────────────────────── */
.lab-banner {
  position: absolute;
  top: clamp(14px, 5vh, 54px);
  left: 50%;
  transform: translate(-50%, -14px);
  padding: 12px 26px;
  border-radius: 99px;
  border: 1px solid var(--line-2);
  background: rgba(8, 11, 18, 0.9);
  backdrop-filter: blur(10px);
  font-family: var(--font-display);
  font-size: clamp(0.92rem, 2vw, 1.22rem);
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--ink);
  opacity: 0;
  pointer-events: none;
  white-space: nowrap;
  transition: opacity .3s var(--ease), transform .3s var(--ease);
  z-index: 6;
}
.lab-banner.is-on { opacity: 1; transform: translate(-50%, 0); }

/* ── floating tip (hovered tile info) ─────────────────────────────────── */.lab-tip {
  position: absolute; pointer-events: none; z-index: 7;
  padding: 7px 11px; border-radius: 8px;
  background: rgba(6, 8, 13, 0.92); border: 1px solid var(--line-2);
  font-family: var(--font-mono); font-size: 0.68rem; letter-spacing: 0.06em; color: var(--ink-2);
  opacity: 0; transition: opacity .18s var(--ease);
  transform: translate(-50%, -140%);
  white-space: nowrap;
}
.lab-tip.is-on { opacity: 1; }

/* ── responsive ───────────────────────────────────────────────────────── */
@media (max-width: 900px) {
  .lab-stats { gap: 12px; }
  .lab-stat small { display: none; }
  .lab-stat--score { display: none; }
  .lab-brand span { display: none; }
}
@media (max-width: 700px) {
  .lab-bar { flex-wrap: wrap; row-gap: 8px; padding: 9px 12px; }
  .lab-brand { order: 1; }
  .lab-tools { order: 2; margin-left: auto; }
  .lab-tools .lab-btn { padding: 7px 11px; font-size: 0.76rem; }
  .lab-tools .lab-btn:last-child { display: none; }   /* "Back to site" lives in the footer on phones */
  .lab-stats { order: 3; width: 100%; justify-content: space-between; gap: 8px; padding-top: 4px; border-top: 1px solid var(--line); }
  .lab-stat { font-size: 0.84rem; }
  .lab-stat b { font-size: 0.98rem; }
  .lab-stat--score { display: inline-flex; padding-left: 0; border-left: 0; }
  .lab-stats .lab-stat:last-child { display: inline-flex; }

  .lab-dock { flex-direction: column; align-items: stretch; gap: 9px; padding: 10px 12px 12px; }
  .lab-towers { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
  .tower-card { flex-direction: column; justify-content: center; gap: 6px; min-height: 62px; padding: 9px 6px; }
  .tower-meta { align-items: center; }
  .tower-name { font-size: 0.78rem; }
  .tower-cost { font-size: 0.62rem; }
  .lab-wave { gap: 10px; }
  .lab-wave .btn { flex: 1; }
  .lab-hint { flex: 1; text-align: right; font-size: 0.72rem; }

  .lab-overlay { padding: 12px; overflow-y: auto; place-items: start center; }
  .lab-card { padding: 22px 18px; }
  .lab-title { font-size: 1.45rem; }
  .lab-lead { font-size: 0.9rem; }
  .lab-howto li { font-size: 0.84rem; }
  .lab-card-actions { flex-direction: column; align-items: stretch; gap: 12px; }
  .lab-card-actions .btn { width: 100%; }
  .lab-hint { text-align: center; }
}
@media (prefers-reduced-motion: reduce) {
  .tower-card, .lab-btn { transition: none; }
}
