:root {
  --brand: #6b46ff;
  --brand-soft: #8a72ff;
  --bg: #f5f4ff;
  --bg-deep: #0e0b24;
  --surface: #ffffff;
  --text: #15132b;
  --text-soft: #5d5a7b;
  --text-faint: #9b98b8;
  --border: #e6e3f5;
  --highlight: #ff5a76;
  --highlight-soft: rgba(255, 90, 118, 0.18);
  --shadow-lg: 0 28px 60px -25px rgba(20, 16, 70, 0.35);
  --radius: 14px;
  --radius-lg: 20px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Inter", "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; }

/* ------------------------------ TOC ------------------------------ */

.toc-page {
  min-height: 100vh;
  background:
    radial-gradient(1200px 600px at 20% -10%, rgba(107, 70, 255, 0.18), transparent 60%),
    radial-gradient(900px 500px at 100% 110%, rgba(255, 90, 118, 0.12), transparent 60%),
    var(--bg);
  padding: 80px 24px 120px;
}

.toc-shell {
  max-width: 980px;
  margin: 0 auto;
}

.toc-hero {
  text-align: center;
  margin-bottom: 56px;
}

.toc-eyebrow {
  display: inline-block;
  font-size: 12px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--brand);
  font-weight: 600;
  margin-bottom: 12px;
}

.toc-title {
  font-size: 44px;
  font-weight: 700;
  line-height: 1.1;
  margin: 0 0 16px;
  letter-spacing: -0.02em;
}

.toc-sub {
  font-size: 18px;
  color: var(--text-soft);
  margin: 0;
  max-width: 580px;
  margin-inline: auto;
}

.toc-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 18px;
}

.toc-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
  text-decoration: none;
  color: inherit;
  display: flex;
  flex-direction: column;
  gap: 12px;
  transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
}
.toc-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-lg);
  border-color: var(--brand-soft);
}
.toc-card[data-disabled="true"] {
  opacity: 0.45;
  pointer-events: none;
}
.toc-card-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px; height: 36px;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--brand), var(--brand-soft));
  color: #fff;
  font-weight: 700;
}
.toc-card-title { font-size: 18px; font-weight: 600; margin: 0; }
.toc-card-sub { font-size: 14px; color: var(--text-soft); margin: 0; }
.toc-card-foot {
  margin-top: auto;
  font-size: 13px;
  color: var(--brand);
  font-weight: 600;
  display: flex; align-items: center; gap: 6px;
}

/* ------------------------------ Player layout ------------------------------ */

.player-page {
  min-height: 100vh;
  background: var(--bg-deep);
  color: #fff;
  display: grid;
  grid-template-rows: auto 1fr;
}

.player-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 16px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
}
.player-brand {
  display: flex; align-items: center; gap: 12px;
  font-weight: 700; font-size: 15px;
  text-decoration: none; color: #fff;
}
.player-brand-dot {
  width: 10px; height: 10px; border-radius: 999px;
  background: linear-gradient(135deg, var(--brand), var(--brand-soft));
  box-shadow: 0 0 14px var(--brand-soft);
}
.player-back {
  color: rgba(255,255,255,0.7);
  text-decoration: none;
  font-size: 13px;
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 12px; border-radius: 10px;
  transition: background 0.15s ease;
}
.player-back:hover { background: rgba(255,255,255,0.07); }

.player-main {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 300px;
  gap: 12px;
  padding: 10px;
  align-items: stretch;
  min-height: 0;
}
@media (max-width: 1024px) {
  .player-main { grid-template-columns: 1fr; }
}

/* ------------------------------ Stage ------------------------------ */

.stage-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 0;
}
.stage {
  position: relative;
  width: 100%;
  /* aspect-ratio e max-width são definidos por JS a partir do manifest.viewport */
  background: #0a0820;
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-lg), 0 0 0 1px rgba(255,255,255,0.05);
  cursor: pointer;
}
.stage-img {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  object-fit: contain;
  /* zoom-out interno: imagem menor com respiro em volta, sem reduzir o stage */
  transform: scale(0.88);
  transform-origin: center;
  user-select: none;
  -webkit-user-drag: none;
}
.stage-overlay {
  position: absolute; inset: 0;
  pointer-events: none;
}

/* hotspot pulsante (alvo de click/type) */
.hotspot {
  position: absolute;
  border: 2px solid var(--highlight);
  border-radius: 8px;
  background: var(--highlight-soft);
  box-shadow: 0 0 0 4px rgba(255,90,118,0.18);
  animation: hotspotPulse 1.6s ease-in-out infinite;
  pointer-events: auto;
  cursor: pointer;
  display: none;
}
.hotspot::after {
  content: attr(data-hint);
  position: absolute;
  top: calc(100% + 8px); left: 50%;
  transform: translateX(-50%);
  background: var(--highlight);
  color: #fff;
  font-size: 12px;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 999px;
  white-space: nowrap;
  opacity: 0;
  transition: opacity 0.2s ease;
}
.hotspot:hover::after { opacity: 1; }
@keyframes hotspotPulse {
  0%, 100% { box-shadow: 0 0 0 4px rgba(255,90,118,0.18); }
  50%      { box-shadow: 0 0 0 12px rgba(255,90,118,0.05); }
}

/* annotation (highlight steps) */
.annotation {
  position: absolute;
  border: 3px solid var(--highlight);
  border-radius: 10px;
  background: rgba(255,90,118,0.06);
  animation: annotPulse 2.4s ease-in-out infinite;
}
.annotation-label {
  position: absolute;
  top: -14px;
  left: 14px;
  background: var(--highlight);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  padding: 4px 10px;
  border-radius: 999px;
  white-space: nowrap;
  box-shadow: 0 4px 12px rgba(255, 90, 118, 0.35);
}
/* Quando a annotation está colada no topo, joga o label pra dentro da box */
.annotation.label-inside .annotation-label {
  top: 10px;
  left: 10px;
}
/* Quando o label não cabe à esquerda (annotation estreita), centraliza no topo */
.annotation.label-bottom .annotation-label {
  top: auto;
  bottom: -14px;
  left: 14px;
}
/* Box estreita — label fica ao lado pra não cobrir o conteúdo destacado */
.annotation.label-right .annotation-label {
  top: 50%;
  left: calc(100% + 10px);
  transform: translateY(-50%);
}
.annotation.label-left .annotation-label {
  top: 50%;
  left: auto;
  right: calc(100% + 10px);
  transform: translateY(-50%);
}
@keyframes annotPulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(255,90,118,0.45); }
  50%      { box-shadow: 0 0 0 14px rgba(255,90,118,0); }
}

/* cursor SVG (estilo macOS preto+branco) */
.cursor {
  position: absolute;
  width: 22px; height: 22px;
  pointer-events: none;
  transition: left 0.85s cubic-bezier(0.22, 0.61, 0.36, 1),
              top 0.85s cubic-bezier(0.22, 0.61, 0.36, 1),
              opacity 0.25s ease;
  filter: drop-shadow(0 2px 6px rgba(0,0,0,0.45));
  opacity: 0;
  transform: translate(-2px, -2px); /* aproxima a ponta do clique */
}

/* click ripple */
.ripple {
  position: absolute;
  width: 16px; height: 16px;
  border-radius: 999px;
  border: 2px solid #fff;
  background: rgba(255,255,255,0.25);
  pointer-events: none;
  transform: translate(-50%, -50%) scale(0.4);
  opacity: 0;
}
.ripple.go {
  animation: rippleGo 0.7s ease-out forwards;
}
@keyframes rippleGo {
  0%   { transform: translate(-50%, -50%) scale(0.4); opacity: 0.9; }
  100% { transform: translate(-50%, -50%) scale(2.8); opacity: 0; }
}

/* tooltip de digitação */
.typing-tip {
  position: absolute;
  background: #15132b;
  color: #fff;
  font-size: 13px;
  font-weight: 500;
  padding: 8px 12px;
  border-radius: 10px;
  box-shadow: 0 8px 22px rgba(0,0,0,0.4);
  white-space: nowrap;
  pointer-events: none;
  transform: translate(-50%, calc(-100% - 14px));
  opacity: 0;
  transition: opacity 0.2s ease;
  border: 1px solid rgba(255,255,255,0.1);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  max-width: 360px;
  overflow: hidden;
  text-overflow: ellipsis;
}
.typing-tip::after {
  content: "";
  position: absolute;
  bottom: -6px; left: 50%;
  transform: translateX(-50%) rotate(45deg);
  width: 10px; height: 10px;
  background: #15132b;
  border-right: 1px solid rgba(255,255,255,0.1);
  border-bottom: 1px solid rgba(255,255,255,0.1);
}
.typing-tip.go { opacity: 1; }
.typing-tip.below {
  transform: translate(-50%, calc(100% + 14px));
}
.typing-tip.below::after {
  bottom: auto; top: -6px;
  border-right: none; border-bottom: none;
  border-left: 1px solid rgba(255,255,255,0.1);
  border-top: 1px solid rgba(255,255,255,0.1);
}

/* ------------------------------ Panel ------------------------------ */

.panel {
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: var(--radius-lg);
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  min-height: 0;
}
.panel-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12px;
  color: rgba(255,255,255,0.55);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.panel-step-num {
  font-weight: 700;
  color: #fff;
}
.panel-action {
  font-size: 11px;
  padding: 3px 10px;
  border-radius: 999px;
  background: rgba(107, 70, 255, 0.2);
  color: var(--brand-soft);
  font-weight: 600;
}
.panel-action[data-action="click"]   { background: rgba(255,90,118,0.18); color: #ff8a9f; }
.panel-action[data-action="type"]    { background: rgba(60,180,255,0.18); color: #6cc7ff; }
.panel-action[data-action="navigate"]{ background: rgba(120,255,170,0.16); color: #7be3ad; }
.panel-action[data-action="highlight"], .panel-action[data-action="observe"] {
  background: rgba(255,200,80,0.18); color: #ffd17a;
}

.panel-title {
  font-size: 20px;
  font-weight: 700;
  margin: 0;
  line-height: 1.25;
}
.panel-label {
  font-size: 16px;
  line-height: 1.55;
  color: rgba(255,255,255,0.85);
  margin: 0;
}

.panel-progress {
  height: 4px;
  background: rgba(255,255,255,0.08);
  border-radius: 999px;
  overflow: hidden;
}
.panel-progress-bar {
  height: 100%;
  background: linear-gradient(90deg, var(--brand), var(--brand-soft));
  width: 0%;
  transition: width 0.4s ease;
}

.panel-controls {
  display: flex;
  gap: 10px;
  margin-top: auto;
}
.btn {
  flex: 1;
  padding: 12px 16px;
  border-radius: 12px;
  border: 1px solid rgba(255,255,255,0.12);
  background: rgba(255,255,255,0.04);
  color: #fff;
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  transition: background 0.15s ease, transform 0.1s ease;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
}
.btn:hover:not(:disabled) { background: rgba(255,255,255,0.1); }
.btn:active:not(:disabled) { transform: scale(0.97); }
.btn:disabled { opacity: 0.35; cursor: not-allowed; }
.btn.primary {
  background: linear-gradient(135deg, var(--brand), var(--brand-soft));
  border-color: transparent;
  box-shadow: 0 8px 22px -10px var(--brand);
}
.btn.primary:hover:not(:disabled) {
  filter: brightness(1.08);
  background: linear-gradient(135deg, var(--brand), var(--brand-soft));
}

.panel-stepper {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(8px, 1fr));
  gap: 4px;
  margin-top: 4px;
}
.stepper-pip {
  height: 4px;
  border-radius: 4px;
  background: rgba(255,255,255,0.12);
  cursor: pointer;
  transition: background 0.15s ease;
}
.stepper-pip:hover { background: rgba(255,255,255,0.22); }
.stepper-pip.done { background: var(--brand-soft); }
.stepper-pip.current {
  background: #fff;
  box-shadow: 0 0 0 2px rgba(255,255,255,0.18);
}

.panel-shortcut-hint {
  font-size: 11px;
  color: rgba(255,255,255,0.4);
  text-align: center;
  margin-top: 4px;
}

/* ------------------------------ Cover ------------------------------ */

.cover {
  position: absolute; inset: 0;
  background: linear-gradient(135deg, rgba(107,70,255,0.85), rgba(255,90,118,0.75));
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  text-align: center; padding: 32px;
  z-index: 5;
  transition: opacity 0.4s ease, visibility 0.4s ease;
}
.cover.hide { opacity: 0; visibility: hidden; pointer-events: none; }
.cover-eyebrow {
  font-size: 11px; letter-spacing: 0.2em; text-transform: uppercase;
  color: rgba(255,255,255,0.85); font-weight: 600; margin-bottom: 14px;
}
.cover-title {
  font-size: clamp(28px, 4vw, 44px);
  font-weight: 700; color: #fff; margin: 0 0 12px;
  letter-spacing: -0.02em;
  text-shadow: 0 2px 20px rgba(0,0,0,0.25);
}
.cover-sub {
  font-size: clamp(14px, 1.8vw, 18px);
  color: rgba(255,255,255,0.9);
  max-width: 520px; margin: 0 0 28px;
}
.cover-cta {
  background: #fff; color: var(--text);
  padding: 14px 28px;
  border-radius: 999px;
  border: 0;
  font-weight: 700; font-size: 15px;
  cursor: pointer;
  display: inline-flex; align-items: center; gap: 10px;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.cover-cta:hover { transform: translateY(-2px); box-shadow: 0 12px 30px -10px rgba(0,0,0,0.4); }
.cover-meta {
  margin-top: 22px;
  font-size: 12px;
  color: rgba(255,255,255,0.7);
  letter-spacing: 0.05em;
}

/* end screen */
.end-screen {
  position: absolute; inset: 0;
  background: linear-gradient(135deg, rgba(120,255,170,0.85), rgba(107,70,255,0.85));
  display: none; flex-direction: column; align-items: center; justify-content: center;
  text-align: center; padding: 32px; gap: 20px;
}
.end-screen.show { display: flex; }
.end-icon {
  width: 64px; height: 64px; border-radius: 50%;
  background: rgba(255,255,255,0.2);
  display: flex; align-items: center; justify-content: center;
  font-size: 32px;
}
