/* mi-howto.css — "How it works" player window + spotlight walkthrough.
   Iter 25KD — the player is a window over the page (80% of the screen,
   page blurred) with the clips on the left and a section menu on the right;
   same surface / border / accent tokens as the rest of the dashboard. */

/* Pill (sits with the S&P Map / Earnings pills) */
.mi-howto-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 6px 13px 6px 7px;
  border-radius: 999px;
  border: 1px solid rgba(79, 152, 163, 0.55);
  background: rgba(79, 152, 163, 0.10);
  color: #cfe7ea;
  font: inherit;
  font-size: 12.5px;
  font-weight: 600;
  letter-spacing: 0.02em;
  white-space: nowrap;
  cursor: pointer;
  margin-right: 8px;
  transition: background 160ms ease, border-color 160ms ease, transform 160ms ease;
}
.mi-howto-pill:hover { background: rgba(79, 152, 163, 0.2); border-color: #4F98A3; transform: translateY(-1px); }
.mi-howto-pill:focus-visible { outline: 2px solid #4F98A3; outline-offset: 2px; }
.mi-howto-pill-icon {
  display: inline-flex; align-items: center; justify-content: center;
  width: 20px; height: 20px; border-radius: 50%;
  background: #4F98A3; color: #0f1416;
}
.mi-howto-pill-icon svg { width: 11px; height: 11px; margin-left: 1px; }
@media (max-width: 640px) {
  .mi-howto-pill { padding: 5px 10px 5px 6px; font-size: 12px; margin-right: 0; }
}

/* First-visit prompt */
.mi-howto-prompt {
  position: fixed; z-index: 1300;
  display: flex; align-items: center; gap: 10px;
  padding: 9px 10px 9px 14px;
  border-radius: 10px;
  background: #1f2a2c;
  border: 1px solid rgba(79, 152, 163, 0.6);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.45);
  font-size: 12.5px; color: #e6f2f3;
  animation: miHowtoIn 220ms ease;
}
.mi-howto-prompt::before {
  content: ''; position: absolute; top: -6px; right: 40px;
  width: 10px; height: 10px; transform: rotate(45deg);
  background: #1f2a2c; border-left: 1px solid rgba(79,152,163,0.6); border-top: 1px solid rgba(79,152,163,0.6);
}
.mi-howto-prompt-go {
  padding: 5px 10px; border-radius: 6px; border: 0;
  background: #4F98A3; color: #0f1416; font: inherit; font-size: 12px; font-weight: 700; cursor: pointer;
}
.mi-howto-prompt-x {
  border: 0; background: transparent; color: #9fb3b6; font-size: 18px; line-height: 1; cursor: pointer; padding: 0 4px;
}
@keyframes miHowtoIn { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }

/* Spotlight walkthrough */
.mi-tour { position: fixed; inset: 0; z-index: 100000; pointer-events: none; }   /* above every site window: S&P Map (5000), brokerage (10000) — Iter 25KI */
.mi-tour-hole {
  position: fixed;
  border-radius: 10px;
  box-shadow: 0 0 0 3px #4F98A3, 0 0 0 9999px rgba(5, 8, 12, 0.62);
  transition: left 220ms ease, top 220ms ease, width 220ms ease, height 220ms ease;
}
.mi-tour-tip {
  position: fixed;
  width: 320px;
  padding: 14px 16px 12px;
  border-radius: 10px;
  background: var(--surface, #1c1c20);
  border: 1px solid rgba(79, 152, 163, 0.6);
  box-shadow: 0 14px 40px rgba(0, 0, 0, 0.55);
  color: var(--text, #e0e0e0);
  pointer-events: auto;
  transition: left 220ms ease, top 220ms ease, opacity 150ms ease;
}
.mi-tour.is-busy .mi-tour-tip { opacity: 0.6; }
.mi-tour-step { font-size: 10.5px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: #4F98A3; margin-bottom: 6px; }
.mi-tour-text { font-size: 13px; line-height: 1.55; }
.mi-tour-title { font-size: 14px; font-weight: 700; color: #fff; margin: 0 22px 5px 0; }
.mi-tour-x {
  position: absolute; top: 6px; right: 6px;
  width: 26px; height: 26px; border-radius: 6px; border: 0;
  background: transparent; color: var(--text-muted, #ffffff80); font-size: 19px; line-height: 1; cursor: pointer;
}
.mi-tour-x:hover { background: var(--surface-hover, #222226); color: #fff; }
.mi-tour-x:focus-visible { outline: 2px solid #4F98A3; outline-offset: 1px; }
/* Iter 25KO — a control being "clicked" by the tour */
.mi-tour-press { transform: scale(0.92) !important; filter: brightness(1.45); box-shadow: 0 0 0 4px rgba(143, 208, 217, 0.55) !important; transition: transform 120ms ease, filter 120ms ease, box-shadow 120ms ease !important; }
@media (prefers-reduced-motion: reduce) { .mi-tour-press { transform: none !important; } }
/* Iter 25KL — "Watch video" switch in the tour tip (left of ×) */
.mi-tour-video {
  position: absolute; top: 7px; right: 36px;
  display: inline-flex; align-items: center; gap: 5px;
  height: 24px; padding: 0 9px 0 7px; border-radius: 999px;
  border: 1px solid rgba(79, 152, 163, 0.55); background: rgba(79, 152, 163, 0.12);
  color: #8fd0d9; font: inherit; font-size: 11px; font-weight: 600; cursor: pointer;
}
.mi-tour-video svg { width: 10px; height: 10px; flex: none; }
.mi-tour-video:hover { background: rgba(79, 152, 163, 0.24); color: #fff; }
.mi-tour-video:focus-visible { outline: 2px solid #4F98A3; outline-offset: 1px; }
.mi-tour-video ~ .mi-tour-step { padding-right: 112px; }
.mi-tour-gap { flex: 1 1 auto; }
.mi-tour-back { border: 1px solid var(--border, #2a2a30); background: transparent; color: var(--text, #e0e0e0); padding: 6px 12px; border-radius: 6px; font: inherit; font-size: 12px; font-weight: 600; cursor: pointer; }
.mi-tour-back:hover { background: var(--surface-hover, #222226); }
.mi-tour-back:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }
.mi-tour-actions { display: flex; align-items: center; gap: 8px; margin-top: 12px; }
.mi-tour-skip, .mi-tour-next {
  padding: 6px 12px; border-radius: 6px; font: inherit; font-size: 12px; font-weight: 600; cursor: pointer;
}
.mi-tour-skip { border: 1px solid var(--border, #2a2a30); background: transparent; color: var(--text-muted, #ffffff80); }
.mi-tour-next { border: 0; background: #4F98A3; color: #0f1416; }
.mi-tour-skip:focus-visible, .mi-tour-next:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }
@media (prefers-reduced-motion: reduce) { .mi-tour-hole, .mi-tour-tip { transition: none; } }

/* Player window (Iter 25KD; Iter 25KE — the clip fills the left at its own
   16:10 shape, up to 88% of the screen height; a 248px column on the right
   holds the title, close, section menu and controls) */
html.mi-hp-open, html.mi-hp-open body { overflow: hidden; }
.mi-hp {
  --hp-side: 248px;
  position: fixed; inset: 0; z-index: 4500;
  display: flex; align-items: center; justify-content: center;
}
.mi-hp[hidden] { display: none; }
.mi-hp-back {
  position: absolute; inset: 0;
  background: rgba(6, 8, 12, 0.6);
  -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
  opacity: 0; transition: opacity 160ms ease;
}
.mi-hp-box {
  position: relative;
  display: flex;
  background: var(--surface, #1c1c20);
  border: 1px solid var(--border, #2a2a30);
  border-radius: 12px;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.6);
  color: var(--text, #e0e0e0);
  overflow: hidden;
  opacity: 0; transform: translateY(8px) scale(0.99);
  transition: opacity 160ms ease, transform 160ms ease;
}
.mi-hp.is-open .mi-hp-back, .mi-hp.is-open .mi-hp-box { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) { .mi-hp-back, .mi-hp-box { transition: none; } }

/* Video: exact 16:10, as large as the screen allows beside the column */
.mi-hp-stage {
  position: relative;
  flex: 0 0 auto;
  height: min(88vh, calc((96vw - var(--hp-side)) * 0.625));
  aspect-ratio: 16 / 10;
  background: #0b0b0e;
}
.mi-hp-video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; cursor: pointer; background: #0b0b0e; }
.mi-hp-bigplay {
  position: absolute; left: 50%; top: 50%;
  width: 72px; height: 72px; margin: -36px 0 0 -36px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 50%; border: 0;
  background: rgba(79, 152, 163, 0.94); color: #0f1416;
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.55); cursor: pointer;
}
.mi-hp-bigplay svg { width: 28px; height: 28px; margin-left: 4px; }
.mi-hp-bigplay[hidden] { display: none; }
.mi-hp-end {
  position: absolute; inset: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 18px;
  background: rgba(8, 11, 14, 0.78);
  -webkit-backdrop-filter: blur(3px); backdrop-filter: blur(3px);
}
.mi-hp-end[hidden] { display: none; }
.mi-hp-end-title { font-size: 20px; font-weight: 600; color: #fff; text-align: center; padding: 0 16px; }
.mi-hp-end-actions { display: flex; gap: 10px; }

/* Right column */
.mi-hp-side {
  flex: 0 0 var(--hp-side);
  width: var(--hp-side);
  display: flex; flex-direction: column;
  min-height: 0;
  border-left: 1px solid var(--border, #2a2a30);
}
.mi-hp-head {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 10px 8px 9px 14px;
  border-bottom: 1px solid var(--border, #2a2a30);
}
.mi-hp-title { font-size: 13px; font-weight: 600; line-height: 1.3; }
.mi-hp-x {
  flex: 0 0 auto;
  display: inline-flex; align-items: center; justify-content: center;
  width: 28px; height: 28px; border-radius: 7px;
  border: 1px solid transparent; background: transparent; color: var(--text-muted, #ffffff80); cursor: pointer;
}
.mi-hp-x svg { width: 15px; height: 15px; }
.mi-hp-x:hover { background: var(--surface-hover, #222226); color: #fff; }

.mi-hp-menu { flex: 1 1 auto; min-height: 0; overflow-y: auto; padding: 10px 8px 8px; }
.mi-hp-menu-title {
  margin: 0 6px 8px; font-size: 9.5px; font-weight: 700;
  letter-spacing: 0.09em; text-transform: uppercase; color: var(--text-faint, #5A5957);
}
.mi-hp-menu ol { list-style: none; margin: 0; padding: 0; }
.mi-hp-item {
  border-radius: 8px;
  border: 1px solid transparent;
  margin-bottom: 4px;
  transition: background 160ms ease, border-color 160ms ease;
}
.mi-hp-item.is-active { background: rgba(79, 152, 163, 0.1); border-color: rgba(79, 152, 163, 0.55); }
.mi-hp-jump {
  display: flex; align-items: center; gap: 8px; width: 100%;
  padding: 8px 8px 6px; border: 0; background: transparent; color: inherit;
  font: inherit; font-size: 12px; font-weight: 600; line-height: 1.3; text-align: left; cursor: pointer; border-radius: 8px;
}
.mi-hp-jump:hover .mi-hp-name { color: #fff; }
.mi-hp-jump:focus-visible { outline: 2px solid #4F98A3; outline-offset: -2px; }
.mi-hp-num, .mi-hp-done {
  flex: 0 0 auto; width: 18px; height: 18px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 10px; font-weight: 700;
}
.mi-hp-done svg { width: 10px; height: 10px; }
.mi-hp-num { background: var(--surface-hover, #222226); color: var(--text-muted, #ffffff80); }
.mi-hp-done { display: none; background: #4F98A3; color: #0f1416; }
.mi-hp-item.is-done:not(.is-active) .mi-hp-num { display: none; }
.mi-hp-item.is-done:not(.is-active) .mi-hp-done { display: inline-flex; }
.mi-hp-item.is-active .mi-hp-num { background: #4F98A3; color: #0f1416; }
.mi-hp-name { color: #c9ccd1; }
.mi-hp-item.is-active .mi-hp-name { color: #fff; }
.mi-hp-bar { height: 2px; margin: 0 8px 6px 34px; border-radius: 2px; background: rgba(255, 255, 255, 0.07); overflow: hidden; }
.mi-hp-bar span { display: block; height: 100%; width: 0; background: #4F98A3; transition: width 250ms linear; }
.mi-hp-detail { display: none; padding: 0 9px 9px 34px; }
.mi-hp-item.is-active .mi-hp-detail { display: block; }
.mi-hp-detail p { margin: 0 0 8px; font-size: 11.5px; line-height: 1.5; color: #b0b5bc; }
.mi-hp-show {
  padding: 4px 9px; border-radius: 6px;
  border: 1px solid rgba(79, 152, 163, 0.5); background: transparent;
  color: #4F98A3; font: inherit; font-size: 11px; font-weight: 600; cursor: pointer;
}
.mi-hp-show:hover { background: rgba(79, 152, 163, 0.12); color: #7cc3cd; }

.mi-hp-foot { padding: 8px 10px 10px; border-top: 1px solid var(--border, #2a2a30); }
.mi-hp-now { font-size: 11px; color: var(--text-muted, #ffffff80); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin: 0 2px 7px; }
.mi-hp-ctrls { display: flex; align-items: center; gap: 6px; }
.mi-hp-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 30px; padding: 0 10px; border-radius: 7px;
  border: 1px solid var(--border, #2a2a30); background: transparent;
  color: var(--text, #e0e0e0); font: inherit; font-size: 12px; font-weight: 600; cursor: pointer;
}
.mi-hp-btn svg { width: 14px; height: 14px; }
.mi-hp-btn:hover { background: var(--surface-hover, #222226); }
.mi-hp-pp { width: 30px; padding: 0; flex: 0 0 auto; }
.mi-hp-ctrls .mi-hp-replay, .mi-hp-ctrls .mi-hp-close { flex: 1 1 0; }
.mi-hp-end .mi-hp-btn { height: 36px; padding: 0 16px; font-size: 13px; }
.mi-hp-btn-primary, .mi-hp-close { background: #4F98A3; border-color: #4F98A3; color: #0f1416; }
.mi-hp-btn-primary:hover, .mi-hp-close:hover { background: #5fb0bc; }
.mi-hp-btn:focus-visible, .mi-hp-x:focus-visible, .mi-hp-bigplay:focus-visible, .mi-hp-show:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }

/* Narrow / portrait screens: video on top, column underneath */
@media (max-width: 860px), (max-aspect-ratio: 5/4) {
  .mi-hp-box { flex-direction: column; width: 96vw; max-height: 94vh; }
  .mi-hp-stage { height: auto; width: 100%; }
  .mi-hp-side { flex: 1 1 auto; width: auto; border-left: 0; border-top: 1px solid var(--border, #2a2a30); }
}

/* Iter 25KF — "Take the guided tour" in the player column + prompt button */
.mi-hp-tour { padding: 10px 10px 8px; border-bottom: 1px solid var(--border, #2a2a30); }
.mi-hp-tourbtn {
  display: flex; align-items: center; justify-content: center; gap: 7px; width: 100%;
  height: 32px; border-radius: 7px; border: 1px solid rgba(124, 58, 237, 0.6);
  background: linear-gradient(135deg, rgba(124, 58, 237, 0.85), rgba(79, 70, 229, 0.85));
  color: #fff; font: inherit; font-size: 12px; font-weight: 600; cursor: pointer;
}
.mi-hp-tourbtn:hover { filter: brightness(1.1); }
.mi-hp-tourbtn:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }
.mi-hp-tour-sub { margin-top: 5px; font-size: 10.5px; color: var(--text-faint, #5A5957); text-align: center; }
.mi-howto-prompt-tour {
  padding: 5px 10px; border-radius: 6px; border: 0;
  background: #6d4ae8; color: #fff; font: inherit; font-size: 12px; font-weight: 700; cursor: pointer;
}
.mi-howto-prompt .mi-howto-prompt-go { background: transparent; border: 1px solid #4F98A3; color: #9fd3da; }

/* Iter 25KI — portfolio header: match the small header pills */
.pf-freshness-wrap .mi-howto-pill { padding: 3px 10px 3px 4px; font-size: 12px; gap: 6px; margin-right: 0; }
.pf-freshness-wrap .mi-howto-pill-icon { width: 18px; height: 18px; }
.pf-freshness-wrap .mi-howto-pill-icon svg { width: 9px; height: 9px; }

/* Iter 25KK — AI Lab header (44px tall): compact pill */
.ailab-header-right .mi-howto-pill { padding: 3px 10px 3px 4px; font-size: 12px; gap: 6px; margin-right: 0; }
.ailab-header-right .mi-howto-pill-icon { width: 18px; height: 18px; }
.ailab-header-right .mi-howto-pill-icon svg { width: 9px; height: 9px; }
