/* AiFi Demo Host: base styles.
   Replaces liveHost.css, demoHost.css and diagnosticsSheet.css from the old app.
   The approved Sound Dimension UX layer stays inline in index.html. */

:root {
  --bg: #0a0a10;
  --panel: #12121b;
  --line: #23232f;
  --text: #f3eefb;
  --mut: #aba6c0;
  --cyan: #2FD3FF;
  --mag: #FF1FA0;
  --pur: #B14BFF;
  --org: #FF9F1C;
  --grn: #2EE6A6;
  --red: #ff5470;
}

* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); }
body { font-family: 'Inter', Arial, sans-serif; -webkit-font-smoothing: antialiased; }
button { font-family: inherit; }

.app { max-width: 1280px; margin: 0 auto; padding: 18px 36px 28px; }

/* top bar */
.topbar { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.topbar__brand { font-weight: 800; font-size: 20px; color: #fff; text-decoration: none; letter-spacing: -.3px; }
.status-pill { display: inline-flex; align-items: center; gap: 8px; padding: 6px 14px; border-radius: 20px;
  border: 1px solid var(--line); background: var(--panel); font-size: 13px; font-weight: 700; color: var(--mut); }
.status-pill__dot { width: 8px; height: 8px; border-radius: 50%; background: var(--mut); }
.status-pill--live { color: #c9f7e6; border-color: rgba(46,230,166,.5); }
.status-pill--live .status-pill__dot { background: var(--grn); box-shadow: 0 0 0 4px rgba(46,230,166,.18); }
.status-pill--warn { color: #ffe1b0; border-color: rgba(255,159,28,.5); }
.status-pill--warn .status-pill__dot { background: var(--org); }
.status-pill--error { color: #ffc2cc; border-color: rgba(255,84,112,.5); }
.status-pill--error .status-pill__dot { background: var(--red); }

.headline { font-size: 32px; line-height: 1.15; font-weight: 800; letter-spacing: -.6px; margin: 6px 0 0; }
.accent-blue { color: var(--cyan); }
.accent-pink { color: var(--mag); }

/* stage: video with the QR card floating bottom-right */
.stage-box { position: relative; border-radius: 16px; overflow: hidden; border: 1px solid var(--line); background: #000; }
.video-wrap { position: relative; aspect-ratio: 16 / 9; background: #000; }
.video-wrap video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; background: #000; }

.player-controls { position: absolute; left: 0; right: 0; bottom: 0; display: flex; align-items: center; gap: 10px;
  padding: 26px 16px 12px; background: linear-gradient(transparent, rgba(0,0,0,.75)); transition: opacity .2s ease; z-index: 3; }
.video-wrap.controls-hidden .player-controls { opacity: 0; pointer-events: none; }
.btn-icon { width: 38px; height: 38px; flex: none; border: 0; border-radius: 50%; background: rgba(255,255,255,.12);
  color: #fff; display: inline-flex; align-items: center; justify-content: center; cursor: pointer; }
.btn-icon:hover { background: rgba(255,255,255,.22); }
.btn-icon svg { width: 18px; height: 18px; }
.btn-icon.is-on { background: var(--pur); }
.seek-bar { flex: 1; accent-color: var(--pur); cursor: pointer; min-width: 60px; }
.seek-time { font-family: 'DM Mono', monospace; font-size: 12px; color: #ddd; min-width: 96px; text-align: right; }

.diagnostics-fab { position: absolute; top: 14px; right: 14px; z-index: 4; width: 34px; height: 34px; border-radius: 50%;
  border: 1px solid rgba(255,255,255,.25); background: rgba(10,10,16,.6); color: #fff; font-weight: 800; cursor: pointer; }

.mode-badge { position: absolute; top: 14px; left: 14px; z-index: 4; padding: 7px 14px; border-radius: 20px;
  background: rgba(10,10,16,.7); border: 1px solid var(--cyan); color: var(--cyan); font-size: 13px; font-weight: 800; }
.mode-badge:empty { display: none; }

.qr-overlay { position: absolute; right: 18px; bottom: 62px; z-index: 5; width: 220px; padding: 14px 16px;
  background: rgba(18,18,27,.94); border: 1px solid var(--line); border-radius: 14px; text-align: center;
  display: flex; flex-direction: column; align-items: center; gap: 8px; }
.qr-overlay__cta { font-size: 14px; font-weight: 800; color: #fff; }
.qr-overlay__arrow { margin-left: 4px; color: var(--cyan); }
.qr-overlay canvas { width: 180px; height: 180px; background: #fff; border-radius: 8px; image-rendering: pixelated; }
.qr-overlay__alias { display: flex; align-items: center; gap: 6px; font-family: 'DM Mono', monospace; font-size: 12px; color: var(--mut); }
.qr-overlay__alias-edit { display: none; }
.qr-overlay.is-waiting canvas { opacity: .25; }

/* audio monitor (host-only language choice) */
.audio-monitor { margin: 14px 0 0; padding: 12px 16px; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; }
.audio-monitor__label { display: block; font-size: 12px; color: var(--mut); margin-bottom: 8px; }
.audio-track-buttons { display: flex; flex-wrap: wrap; gap: 8px; }
.audio-track-buttons button { border: 1px solid var(--line); background: #1a1a26; color: var(--text); border-radius: 18px;
  padding: 6px 12px; font-size: 13px; cursor: pointer; }
.audio-track-buttons button.is-active { border-color: var(--cyan); color: var(--cyan); }

/* mode cards */
.content-section { margin-top: 18px; }
.content-section__label { font-size: 13px; font-weight: 800; letter-spacing: 1.6px; text-transform: uppercase; color: #fff; margin: 0 0 12px; }
.content-grid { display: grid; grid-template-columns: repeat(6, 1fr); gap: 12px; }
.content-card { text-align: left; background: var(--panel); border: 1px solid var(--line); border-top: 3px solid var(--card, var(--pur));
  border-radius: 12px; padding: 14px 14px 16px; color: var(--text); font: inherit; }
.content-card { position: relative; }
.content-card__title { font-size: 15px; font-weight: 800; }
.content-card__title .ai { color: var(--card, var(--pur)); }
.content-card__playing { display: none; margin-top: 3px; font-size: 10.5px; font-weight: 800; letter-spacing: .6px; color: var(--card, var(--pur)); }
.content-card__desc { font-size: 12.5px; color: var(--mut); margin-top: 5px; line-height: 1.35; }
.content-card--active { border-color: var(--card, var(--pur)); background: #1a1430; }
.content-card--active .content-card__playing { display: block; }
.content-card:focus-visible { outline: 2px solid var(--cyan); outline-offset: 2px; }

.footer { margin-top: 22px; }
.wordmark { font-weight: 800; color: #fff; }
.wordmark .by { font-weight: 400; color: var(--mut); }

/* overlays, driven by body.state-* */
.overlay { position: fixed; inset: 0; z-index: 50; display: none; align-items: center; justify-content: center;
  background: rgba(5,5,9,.88); padding: 20px; }
.overlay__inner { max-width: 420px; width: 100%; text-align: center; background: var(--panel); border: 1px solid var(--line);
  border-radius: 18px; padding: 28px 24px; }
.overlay__label { font-size: 19px; font-weight: 800; margin: 10px 0 4px; }
.overlay__sub { font-size: 14px; color: var(--mut); margin: 4px 0; }
.overlay__hint { font-size: 13px; color: var(--mut); margin: 6px 0 0; }
.overlay__icon { width: 40px; height: 40px; color: var(--red); }
body.state-starting #overlayStart,
body.state-stream-error #overlayError,
body.state-session-error #overlaySessionError { display: flex; }
.spinner { width: 34px; height: 34px; margin: 0 auto; border-radius: 50%; border: 3px solid var(--line); border-top-color: var(--cyan); animation: spin .9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.start-brand { font-size: 34px; font-weight: 800; }
.start-brand span { color: var(--mag); }
.start-steps { list-style: none; padding: 0; margin: 16px auto 0; text-align: left; display: inline-block; }
.start-step { font-size: 14px; color: var(--mut); padding: 4px 0 4px 26px; position: relative; }
.start-step::before { content: ""; position: absolute; left: 2px; top: 8px; width: 12px; height: 12px; border-radius: 50%; border: 2px solid var(--line); }
.start-step--active { color: #fff; }
.start-step--active::before { border-color: var(--cyan); border-top-color: transparent; animation: spin .9s linear infinite; }
.start-step--done { color: #fff; }
.start-step--done::before { background: var(--grn); border-color: var(--grn); }
.btn-reload, .btn-diagnostics { margin: 14px 4px 0; border: 0; border-radius: 22px; padding: 11px 20px; font-weight: 800; cursor: pointer; }
.btn-reload { background: linear-gradient(90deg, var(--cyan), var(--pur)); color: #08111f; }
.btn-diagnostics { background: #1f1f2c; color: #fff; border: 1px solid var(--line); }

/* help sheet */
.diagnostics-sheet { position: fixed; inset: 0; z-index: 70; background: rgba(5,5,9,.7); display: flex; align-items: flex-end; justify-content: center; padding: 16px; }
.diagnostics-sheet[hidden] { display: none; }
.diagnostics-sheet__card { width: 100%; max-width: 460px; background: var(--panel); border: 1px solid var(--line); border-radius: 18px; padding: 20px 22px; font-size: 14px; color: var(--mut); }
.diagnostics-sheet__header { display: flex; justify-content: space-between; align-items: center; }
.diagnostics-sheet__header h2 { color: #fff; font-size: 18px; margin: 0; }
.diagnostics-sheet__close { background: none; border: 0; color: #fff; font-size: 26px; cursor: pointer; }
.diagnostics-sheet dl { display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; margin: 12px 0; }
.diagnostics-sheet dt { color: var(--mut); }
.diagnostics-sheet dd { margin: 0; color: #fff; font-family: 'DM Mono', monospace; font-size: 12.5px; word-break: break-all; }
.diagnostics-sheet__send { width: 100%; border: 0; border-radius: 22px; padding: 12px; font-weight: 800; cursor: pointer;
  background: linear-gradient(90deg, var(--cyan), var(--pur)); color: #08111f; }

.localhost-warning { margin: 12px 0 0; padding: 10px 14px; border-radius: 10px; border: 1px solid var(--org); color: #ffe1b0; background: rgba(255,159,28,.1); font-size: 13px; }

@media (max-width: 1080px) {
  .content-grid { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 760px) {
  .app { padding: 14px 16px 24px; }
  .headline { font-size: 24px; }
  .qr-overlay { position: static; width: auto; flex-direction: row; flex-wrap: wrap; justify-content: center; border-radius: 0; border: 0; border-top: 1px solid var(--line); }
  .qr-overlay canvas { width: 140px; height: 140px; }
  .content-grid { grid-template-columns: 1fr 1fr; }
}

/* Glass hover on the mode cards, matching the sounddimension.se buttons:
   lift, frosted white fill with 10px blur, brighter border, plus the card's own colour glow. */
.content-grid .content-card {
  position: relative; overflow: hidden;
  background: linear-gradient(180deg, rgba(255,255,255,.06), rgba(255,255,255,.02)), var(--panel);
  -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
  transition: transform .18s ease, background .18s ease, border-color .18s ease, box-shadow .18s ease;
}
.content-grid .content-card::after {
  content: ""; position: absolute; top: 0; bottom: 0; left: -60%; width: 50%; pointer-events: none;
  background: linear-gradient(100deg, transparent, rgba(255,255,255,.18), transparent);
  transform: skewX(-18deg); opacity: 0;
}
.content-grid .content-card:hover,
.content-grid .content-card:focus-visible {
  transform: translateY(-4px);
  background: linear-gradient(180deg, rgba(255,255,255,.14), rgba(255,255,255,.06)), rgba(18,18,27,.6);
  border-color: rgba(255,255,255,.5);
  border-top-color: var(--card, var(--pur));
  box-shadow: 0 12px 30px rgba(0,0,0,.45), 0 0 0 1px rgba(255,255,255,.08), 0 0 28px -6px var(--card, var(--pur));
}
.content-grid .content-card:hover::after { animation: sdshine .7s ease forwards; }
@keyframes sdshine { from { left: -60%; opacity: 1; } to { left: 120%; opacity: 1; } }
.content-grid .content-card:active { transform: translateY(-1px) scale(.99); }
.content-grid .content-card.content-card--active {
  background: linear-gradient(180deg, rgba(255,255,255,.12), rgba(255,255,255,.04)), #1a1430;
  border-color: var(--card, var(--pur));
  box-shadow: 0 0 0 1px var(--card, var(--pur)), 0 0 26px -8px var(--card, var(--pur)) !important;
}
@media (prefers-reduced-motion: reduce) {
  .content-grid .content-card, .content-grid .content-card:hover { transition: none; transform: none; }
  .content-grid .content-card:hover::after { animation: none; }
}
