@font-face {
  font-family: 'Instrument Sans';
  src: url('../assets/fonts/instrument-sans.woff2') format('woff2');
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Roboto';
  src: url('../assets/fonts/roboto.woff2') format('woff2');
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

:root {
  --red: #DB1F1F;
  --red-tint: rgba(219, 31, 31, 0.08);
  --orange: #FF8000;
  --midnight: #011B23;
  --stone: #E3E0DE;
  --white: #FFFFFF;

  --font-head: 'Instrument Sans', 'Segoe UI', Arial, sans-serif;
  --font-body: 'Roboto', 'Segoe UI', Arial, sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: var(--midnight);
  font-family: var(--font-body);
  color: var(--midnight);
  -webkit-user-select: none;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

button {
  font-family: var(--font-body);
  border: none;
  background: none;
  cursor: pointer;
}

img { -webkit-user-drag: none; pointer-events: none; }

.screen {
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;
  opacity: 0;
  visibility: hidden;
  transition: opacity .45s ease;
}
.screen.active {
  opacity: 1;
  visibility: visible;
}

/* ---------- ATTRACT SCREEN ---------- */
#attract-screen {
  background: radial-gradient(circle at 50% 30%, #3a0a0a 0%, var(--midnight) 65%);
  align-items: center;
  justify-content: center;
  text-align: center;
  overflow: hidden;
}

.attract-content { position: relative; z-index: 1; padding: 0 40px; }
.attract-logo { width: 340px; margin-bottom: 48px; }
.attract-title {
  font-family: var(--font-head);
  font-weight: 700;
  font-size: 72px;
  color: var(--white);
  margin: 0;
}
.attract-accent {
  display: block;
  width: 110px;
  height: 6px;
  margin: 26px auto 30px;
  background: var(--red);
  border-radius: 4px;
}
.attract-tap {
  font-family: var(--font-body);
  font-size: 28px;
  color: var(--stone);
  margin: 0;
  animation: pulse 2s ease-in-out infinite;
}
@keyframes pulse {
  0%, 100% { opacity: .55; }
  50% { opacity: 1; }
}

/* ---------- MAIN SCREEN ---------- */
#main-screen {
  background: var(--white);
}

.main-topbar {
  display: flex;
  align-items: center;
  gap: 24px;
  padding: 22px 40px;
  background: var(--red);
  flex-shrink: 0;
}
.topbar-logo { height: 36px; }
.main-topbar h1 {
  font-family: var(--font-head);
  font-weight: 700;
  font-size: 28px;
  color: var(--white);
  margin: 0;
}

.main-body {
  flex: 1;
  display: flex;
  min-height: 0;
}

/* Sidebar column (left): scrollable topic list + pinned footer button */
.sidebar-col {
  width: 360px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  background: var(--white);
  border-right: 1px solid var(--stone);
  min-height: 0;
}

.sidebar {
  flex: 1;
  overflow-y: auto;
  min-height: 0;
}

.sidebar-footer {
  flex-shrink: 0;
  padding: 20px;
  border-top: 1px solid var(--stone);
}

.try-it-btn {
  display: flex;
  align-items: center;
  gap: 14px;
  width: 100%;
  padding: 18px 20px;
  border-radius: 14px;
  background: var(--red);
  color: var(--white);
  transition: transform .12s ease;
}
.try-it-btn:active { transform: scale(0.97); }
.try-it-btn svg { width: 26px; height: 26px; flex-shrink: 0; }
.try-it-btn span { display: flex; flex-direction: column; text-align: left; }
.try-it-btn strong {
  font-family: var(--font-head);
  font-weight: 700;
  font-size: 17px;
}
.try-it-btn small {
  font-family: var(--font-body);
  font-size: 13px;
  opacity: 0.85;
}

.sidebar-item {
  display: flex;
  align-items: center;
  gap: 16px;
  width: 100%;
  padding: 20px 24px;
  border-bottom: 1px solid var(--stone);
  border-left: 5px solid transparent;
  text-align: left;
  color: var(--midnight);
  background: var(--white);
  transition: background .12s ease, border-color .12s ease;
}
.sidebar-item:active { background: var(--red-tint); }
.sidebar-item.active {
  background: var(--red-tint);
  border-left-color: var(--red);
}
.sidebar-item .item-icon {
  width: 30px;
  height: 30px;
  flex-shrink: 0;
  color: var(--midnight);
}
.sidebar-item.active .item-icon { color: var(--red); }
.sidebar-item .item-icon svg { width: 100%; height: 100%; }
.sidebar-item h3 {
  font-family: var(--font-head);
  font-weight: 600;
  font-size: 17px;
  margin: 0;
  color: inherit;
}
.sidebar-item.active h3 { color: var(--red); }

/* Player pane (right) */
.player-pane {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  padding: 32px 40px 28px;
}

.player-info { flex-shrink: 0; margin-bottom: 18px; }
.player-info h2 {
  font-family: var(--font-head);
  font-weight: 700;
  font-size: 28px;
  color: var(--midnight);
  margin: 0 0 8px;
}
.player-info p {
  font-family: var(--font-body);
  font-size: 16px;
  color: #5b6b70;
  margin: 0;
  max-width: 720px;
}

.video-wrap {
  position: relative;
  flex: 1;
  border-radius: 20px;
  overflow: hidden;
  background: #000;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 0;
}
#player-video {
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #000;
}

.video-fallback {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: var(--stone);
  gap: 10px;
  text-align: center;
  padding: 0 60px;
}
.video-fallback svg { width: 72px; height: 72px; opacity: 0.5; margin-bottom: 10px; }
.video-fallback p { margin: 0; }
.video-fallback .fallback-title { font-family: var(--font-head); font-size: 24px; font-weight: 600; color: var(--white); }
.video-fallback .fallback-desc { font-family: var(--font-body); font-size: 15px; max-width: 440px; opacity: 0.75; }
.video-fallback .btn-primary { margin-top: 8px; }

.play-toggle {
  position: absolute;
  width: 96px;
  height: 96px;
  border-radius: 50%;
  background: rgba(219, 31, 31, 0.85);
  color: var(--white);
  display: flex;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(2px);
}
.play-toggle svg { width: 42px; height: 42px; }
.play-toggle.hidden { display: none; }

.controls-bar {
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 20px 0 0;
  flex-shrink: 0;
}
.icon-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 18px;
  border-radius: 12px;
  color: var(--midnight);
  background: var(--stone);
  font-family: var(--font-body);
  font-size: 16px;
}
.icon-btn svg { width: 22px; height: 22px; }
.icon-btn.small { width: 48px; height: 48px; padding: 0; border-radius: 50%; flex-shrink: 0; }
.icon-btn.small svg { width: 22px; height: 22px; }
.main-topbar .icon-btn { background: rgba(255,255,255,0.16); color: var(--white); }
.time { color: #5b6b70; font-size: 15px; width: 48px; text-align: center; flex-shrink: 0; }
#scrubber {
  flex: 1;
  height: 36px;
  accent-color: var(--red);
}

.btn-primary {
  font-family: var(--font-head);
  font-weight: 600;
  font-size: 16px;
  padding: 14px 30px;
  border-radius: 12px;
  background: var(--red);
  color: var(--white);
}
.btn-primary:active { transform: scale(0.97); }

/* ---------- HARNESS SCREEN ---------- */
#harness-screen { background: var(--white); }

.harness-body {
  flex: 1;
  display: flex;
  min-height: 0;
}

.instructions-panel {
  width: 360px;
  flex-shrink: 0;
  overflow-y: auto;
  background: var(--white);
  border-right: 1px solid var(--stone);
  padding: 28px 24px;
}
.instructions-panel h2 {
  font-family: var(--font-head);
  font-weight: 700;
  font-size: 22px;
  color: var(--midnight);
  margin: 0 0 20px;
}
#instructions-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 18px;
}
#instructions-list li {
  display: flex;
  gap: 14px;
  align-items: flex-start;
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.45;
  color: var(--midnight);
}
#instructions-list li::before {
  counter-increment: step;
  content: counter(step);
  flex-shrink: 0;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--red-tint);
  color: var(--red);
  font-family: var(--font-head);
  font-weight: 700;
  font-size: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
}
#instructions-list { counter-reset: step; }

.harness-frame-wrap {
  position: relative;
  flex: 1;
  margin: 24px;
  border-radius: 20px;
  overflow: hidden;
  background: #000;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 0;
}
.cayenta-frame {
  position: absolute;
  inset: 0;
  display: flex;
  width: 100%;
  height: 100%;
  border: 0;
  background: var(--white);
}
[hidden] { display: none !important; }
