/* tx-ivideo.css — interactive video layer (pairs with /js/tx-ivideo.js + /css/tx-player.css). */
.txiv { --txiv-accent: var(--txp-accent, #7C73FF); --txiv-fs: 15px; }
.txiv-stage { position: absolute; inset: 0; background: #0B1020; }
.txiv-v { opacity: 0; transition: opacity .2s ease; }
.txiv-v.on { opacity: 1; z-index: 1; }
.txiv-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.txiv-preview-tag { position: absolute; right: 12px; top: 12px; z-index: 9; background: #F59E0B; color: #111; font: 800 11px/1 'Inter', system-ui, sans-serif;
    letter-spacing: .08em; padding: 5px 8px; border-radius: 6px; pointer-events: none; }

/* ── hotspots ── */
.txiv-layer { position: absolute; left: 0; top: 0; width: 100%; height: 100%; z-index: 5; pointer-events: none; } /* above the control bar so timed buttons stay clickable */
.txiv-hs { position: absolute; display: grid; place-items: center; opacity: 0; visibility: hidden; transform: translateY(6px) scale(.96);
    transition: opacity .25s ease, transform .3s cubic-bezier(.2,.9,.3,1.2), visibility .25s; }
.txiv-hs.on { opacity: 1; visibility: visible; transform: none; }
.txiv-hs-btn { pointer-events: auto; width: 100%; height: 100%; min-width: 44px; min-height: 44px; border: 0; cursor: pointer;
    display: inline-flex; align-items: center; justify-content: center; gap: .45em; padding: 0 .9em; border-radius: 14px;
    font: 800 var(--txiv-fs)/1.15 'Inter', system-ui, sans-serif; color: #fff; text-align: center; letter-spacing: -.005em;
    -webkit-tap-highlight-color: transparent; transition: transform .15s ease, filter .15s ease, box-shadow .2s ease; }
.txiv-hs-btn:hover { transform: translateY(-1px) scale(1.03); }
.txiv-hs-btn:active { transform: scale(.98); }
.txiv-hs-btn:focus-visible { outline: 3px solid #fff; outline-offset: 3px; }
.txiv-hs-label { overflow: hidden; text-overflow: ellipsis; }
.txiv-hs-ico { display: inline-grid; flex: none; }
.txiv-hs-ico svg { width: 1.05em; height: 1.05em; }
.txiv-hs-button .txiv-hs-btn { background: linear-gradient(135deg, var(--txiv-accent), color-mix(in srgb, var(--txiv-accent) 70%, #fff));
    background: var(--txiv-accent); box-shadow: 0 14px 30px -12px rgba(0,0,0,.6), inset 0 0 0 1px rgba(255,255,255,.18); }
.txiv-hs-pill .txiv-hs-btn { border-radius: 999px; color: #0B1020; background: rgba(255,255,255,.94); box-shadow: 0 14px 30px -14px rgba(0,0,0,.6); }
.txiv-hs-ghost .txiv-hs-btn { background: rgba(11,16,32,.35); border: 2px solid rgba(255,255,255,.9); backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px); }
.txiv-hs-ghost .txiv-hs-btn:hover { background: rgba(255,255,255,.16); }
.txiv-hs-hotspot-pulse .txiv-hs-btn { background: transparent; padding: 0; position: relative; }
.txiv-dot { width: 22px; height: 22px; border-radius: 50%; background: #fff; box-shadow: 0 0 0 0 rgba(255,255,255,.7); animation: txiv-pulse 1.6s infinite; border: 5px solid var(--txiv-accent); }
.txiv-hs-tip { position: absolute; left: 50%; bottom: calc(50% + 20px); transform: translateX(-50%); white-space: nowrap; background: rgba(11,16,32,.92);
    color: #fff; padding: .45em .7em; border-radius: 9px; font-size: calc(var(--txiv-fs) * .85); }
@keyframes txiv-pulse { 0% { box-shadow: 0 0 0 0 rgba(255,255,255,.7); } 70% { box-shadow: 0 0 0 18px rgba(255,255,255,0); } 100% { box-shadow: 0 0 0 0 rgba(255,255,255,0); } }
.txiv-ended .txiv-layer, .txiv-form-open .txiv-layer { visibility: hidden; }

/* ── top bar (back / scene title / restart) ── */
.txiv-top { position: absolute; left: 0; right: 0; top: 0; z-index: 6; display: flex; align-items: center; gap: 8px; padding: 10px 12px 26px;
    background: linear-gradient(180deg, rgba(11,16,32,.7), rgba(11,16,32,0)); transition: opacity .25s ease; pointer-events: none; }
.txiv-top > * { pointer-events: auto; }
.txiv:not(.txiv-has-top) .txiv-top, .txp-fresh .txiv-top, .txp-idle .txiv-top { opacity: 0; }
.txp-idle .txiv-top > *, .txp-fresh .txiv-top > * { pointer-events: none; }
.txiv-crumb { flex: 1; min-width: 0; font: 700 13px/1.2 'Inter', system-ui, sans-serif; color: rgba(255,255,255,.88); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.txiv-chip { display: inline-flex; align-items: center; gap: 6px; min-height: 40px; padding: 0 14px 0 10px; border-radius: 999px; cursor: pointer;
    border: 1.5px solid rgba(255,255,255,.45); background: rgba(11,16,32,.45); color: #fff; font: 700 13px/1 'Inter', system-ui, sans-serif;
    backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); transition: background .15s ease; }
.txiv-chip svg { width: 18px; height: 18px; }
.txiv-chip:hover { background: rgba(255,255,255,.18); }
.txiv-chip:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }
.txiv-chip[hidden] { display: none; }

/* ── end-of-scene choices ── */
.txiv-end { position: absolute; inset: 0; z-index: 7; display: grid; place-items: center; padding: 18px;
    background: radial-gradient(circle at 50% 35%, color-mix(in srgb, var(--txiv-accent) 45%, transparent), rgba(11,16,32,.9) 72%);
    background-color: rgba(11,16,32,.55); opacity: 0; transition: opacity .3s ease; overflow-y: auto; }
.txiv-end.in { opacity: 1; }
.txiv-end[hidden] { display: none; }
.txiv-end-panel { width: 100%; max-width: 760px; text-align: center; }
.txiv-end-prompt { font: 800 clamp(17px, 3cqw, 28px)/1.2 'Inter', system-ui, sans-serif; color: #fff; margin-bottom: 16px; letter-spacing: -.01em; }
.txiv-choices { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.txiv-choices.many { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.txiv-choice { position: relative; display: flex; align-items: center; gap: 12px; min-height: 64px; padding: 14px 16px; text-align: left; cursor: pointer;
    border: 1px solid rgba(255,255,255,.22); border-radius: 16px; background: rgba(255,255,255,.1); color: #fff;
    font: 700 clamp(14px, 1.9cqw, 17px)/1.25 'Inter', system-ui, sans-serif; backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
    opacity: 0; transform: translateY(14px); transition: background .15s ease, border-color .15s ease, transform .2s ease; }
.txiv-end.in .txiv-choice { animation: txiv-up .45s cubic-bezier(.2,.9,.3,1.15) forwards; animation-delay: calc(var(--i, 0) * 70ms + 60ms); }
@keyframes txiv-up { to { opacity: 1; transform: none; } }
.txiv-choice:hover { background: rgba(255,255,255,.2); border-color: rgba(255,255,255,.55); }
.txiv-choice:focus-visible { outline: 3px solid #fff; outline-offset: 2px; }
.txiv-choice-n { flex: none; display: grid; place-items: center; width: 32px; height: 32px; border-radius: 10px; background: var(--txiv-accent); font-size: 14px; font-weight: 800; }
.txiv-choice-label { flex: 1; min-width: 0; }
.txiv-choice-ico { flex: none; display: grid; opacity: .7; transition: transform .15s ease; }
.txiv-choice-ico svg { width: 20px; height: 20px; }
.txiv-choice:hover .txiv-choice-ico { transform: translateX(3px); opacity: 1; }
.txiv-end-foot { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin-top: 16px; }

/* ── form ── */
.txiv-formwrap { position: absolute; inset: 0; z-index: 8; display: grid; place-items: center; padding: 14px; background: rgba(11,16,32,.72);
    opacity: 0; transition: opacity .25s ease; overflow-y: auto; }
.txiv-formwrap.in { opacity: 1; }
.txiv-formwrap[hidden] { display: none; }
.txiv-form { width: 100%; max-width: 520px; max-height: 100%; overflow-y: auto; background: #fff; color: #0F172A; border-radius: 18px; padding: 18px 18px 16px;
    box-shadow: 0 30px 70px -20px rgba(0,0,0,.6); font-family: 'Inter', system-ui, sans-serif; transform: translateY(12px) scale(.98); transition: transform .3s cubic-bezier(.2,.9,.3,1.15); }
.txiv-formwrap.in .txiv-form { transform: none; }
.txiv-form-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 10px; }
.txiv-form-title { font-weight: 800; font-size: 18px; letter-spacing: -.01em; }
.txiv-x { display: grid; place-items: center; width: 44px; height: 44px; border-radius: 12px; border: 0; background: #F1F5F9; color: #334155; cursor: pointer; flex: none; }
.txiv-x svg { width: 20px; height: 20px; }
.txiv-x:hover { background: #E2E8F0; }
.txiv-x:focus-visible, .txiv-submit:focus-visible { outline: 3px solid var(--txiv-accent); outline-offset: 2px; }
.txiv-form-note { font-size: 12px; background: #FEF3C7; color: #92400E; padding: 6px 10px; border-radius: 8px; margin-bottom: 10px; }
.txiv-form-body { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.txiv-field { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.txiv-field.wide, .txiv-narrow .txiv-field { grid-column: 1 / -1; }
.txiv-field label { font-size: 13px; font-weight: 600; color: #334155; }
.txiv-req { color: #DC2626; }
.txiv-field input, .txiv-field select, .txiv-field textarea { width: 100%; min-height: 44px; border: 1px solid #CBD5E1; border-radius: 11px; padding: 10px 12px;
    font: 500 15px/1.3 'Inter', system-ui, sans-serif; color: #0F172A; background: #fff; box-sizing: border-box; user-select: text; -webkit-user-select: text; }
.txiv-field textarea { resize: vertical; min-height: 70px; }
.txiv-field input:focus, .txiv-field select:focus, .txiv-field textarea:focus { outline: none; border-color: var(--txiv-accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--txiv-accent) 25%, transparent); }
.txiv-field [aria-invalid="true"] { border-color: #DC2626; }
.txiv-hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
.txiv-form-msg { min-height: 0; font-size: 13px; margin-top: 8px; }
.txiv-form-msg.err { color: #B91C1C; font-weight: 600; }
.txiv-submit { margin-top: 12px; width: 100%; min-height: 48px; border: 0; border-radius: 12px; cursor: pointer; color: #fff; font: 800 15px 'Inter', system-ui, sans-serif;
    background: var(--txiv-accent); box-shadow: 0 14px 30px -14px color-mix(in srgb, var(--txiv-accent) 80%, #000); }
.txiv-submit[disabled] { opacity: .65; cursor: progress; }
.txiv-form-ok { text-align: center; padding: 14px 4px 4px; }
.txiv-form-ok p { font-size: 16px; font-weight: 600; color: #0F172A; margin: 10px 0 4px; }
.txiv-okmark { display: inline-grid; place-items: center; width: 56px; height: 56px; border-radius: 50%; background: #DCFCE7; color: #15803D; font-size: 28px; font-weight: 900; }

/* ── chapters ── */
.txiv-marks { position: absolute; inset: 0; pointer-events: none; }
.txiv-mark { position: absolute; top: 50%; width: 3px; height: 8px; margin: -4px 0 0 -1.5px; border-radius: 2px; background: #fff; opacity: .85; }
.txiv-chap-btn[hidden] { display: none; }
.txiv-chapmenu { position: absolute; right: 12px; bottom: 64px; z-index: 9; min-width: 220px; max-width: calc(100% - 24px); max-height: 60%; overflow-y: auto;
    background: rgba(11,16,32,.95); border: 1px solid rgba(255,255,255,.15); border-radius: 14px; padding: 6px; }
.txiv-chapmenu[hidden] { display: none; }
.txiv-chapitem { display: flex; gap: 10px; width: 100%; min-height: 44px; align-items: center; padding: 8px 10px; border: 0; border-radius: 10px; background: transparent;
    color: #fff; font: 600 14px 'Inter', system-ui, sans-serif; text-align: left; cursor: pointer; }
.txiv-chapitem .t { font-variant-numeric: tabular-nums; opacity: .7; }
.txiv-chapitem:hover, .txiv-chapitem:focus-visible { background: rgba(255,255,255,.12); outline: none; }

/* ── states ── */
.txiv-ended .txp-btn.txp-big, .txiv-form-open .txp-btn.txp-big { opacity: 0; pointer-events: none; visibility: hidden; }
.txiv-end-open .txp-bar, .txiv-form-open .txp-bar { opacity: 0; pointer-events: none; }
.txiv-held .txp-btn.txp-big { width: 60px; height: 60px; opacity: .85; }
.txiv-pseudo-fs { position: fixed !important; inset: 0 !important; width: 100vw !important; height: 100vh !important; height: 100dvh !important;
    z-index: 2147483600 !important; border-radius: 0 !important; aspect-ratio: auto !important; }
html.txiv-lock, html.txiv-lock body { overflow: hidden !important; }
.txp.txiv.txp-is-fs { border-radius: 0; }

/* ── narrow players: choices become a bottom sheet ── */
@container txp (max-width: 480px) {
    .txiv-end { place-items: end stretch; padding: 0; }
    .txiv-end-panel { max-width: none; max-height: 100%; overflow-y: auto; background: rgba(11,16,32,.96); border-radius: 18px 18px 0 0;
        padding: 14px 12px 12px; transform: translateY(100%); transition: transform .35s cubic-bezier(.2,.9,.3,1.05); }
    .txiv-end-panel::before { content: ''; display: block; width: 38px; height: 4px; border-radius: 4px; background: rgba(255,255,255,.35); margin: 0 auto 10px; }
    .txiv-end.in .txiv-end-panel { transform: none; }
    .txiv-end-prompt { font-size: 15px; margin-bottom: 10px; }
    .txiv-choices, .txiv-choices.many { grid-template-columns: 1fr; gap: 6px; }
    .txiv-choice { min-height: 46px; padding: 8px 12px; font-size: 14px; border-radius: 12px; }
    .txiv-choice-n { width: 26px; height: 26px; font-size: 12px; border-radius: 8px; }
    .txiv-end-foot { margin-top: 8px; gap: 6px; }
    .txiv-chip { min-height: 44px; padding: 0 12px 0 8px; font-size: 12px; }
    .txiv-top { padding: 6px 8px 20px; }
    .txiv-crumb { font-size: 12px; }
    .txiv-formwrap { padding: 0; place-items: stretch; }
    .txiv-form { max-width: none; border-radius: 0; padding: 12px; }
    .txiv-form-body { grid-template-columns: 1fr; gap: 8px; }
    .txiv-form-title { font-size: 16px; }
}
@container txp (max-width: 640px) {
    .txiv-hs-ico { display: none; }
    .txiv-hs-btn { padding: 0 .5em; border-radius: 10px; }
}
@container txp (max-width: 380px) {
    .txiv-restart span, .txiv-back span { display: none; }
    .txiv-chip.txiv-back, .txiv-chip.txiv-restart { padding: 0; width: 44px; justify-content: center; }
}
@media (prefers-reduced-motion: reduce) {
    .txiv-hs, .txiv-v, .txiv-end, .txiv-formwrap, .txiv-form, .txiv-end-panel { transition: none !important; }
    .txiv-end.in .txiv-choice { animation: none; opacity: 1; transform: none; }
    .txiv-dot { animation: none; }
}

/* Narrow players (phones): the choice sheet / form can't fit inside a 16:9 box that is
   ~180 px tall, so the player grows to fit them instead of scrolling a tiny panel.
   (In an embed the iframe follows via the height postMessage.) */
.txiv.txiv-narrow.txiv-end-open, .txiv.txiv-narrow.txiv-form-open { aspect-ratio: auto; }
.txiv.txiv-narrow .txiv-end:not([hidden]), .txiv.txiv-narrow .txiv-formwrap:not([hidden]) { position: relative; min-height: 56.25cqw; overflow: visible; }
.txiv.txiv-narrow .txiv-end-panel { max-height: none; }
.txiv.txiv-narrow .txiv-form { max-height: none; }
.txiv.txiv-narrow.txiv-pseudo-fs .txiv-end:not([hidden]), .txiv.txiv-narrow.txiv-pseudo-fs .txiv-formwrap:not([hidden]) { position: absolute; overflow-y: auto; }
