:root {
      --bg: #0f172a;
      --panel: #111827;
      --panel-2: #1f2937;
      --text: #e5e7eb;
      --muted: #94a3b8;
      --green: #22c55e;
      --red: #ef4444;
      --yellow: #f59e0b;
      --blue: #2563eb;
      --border: #334155;
      --focus: #93c5fd;
      --panel-glass: rgba(15, 23, 42, 0.82);
      --green-glow: rgba(34, 197, 94, 0.18);
      --red-glow: rgba(239, 68, 68, 0.18);
      --yellow-glow: rgba(245, 158, 11, 0.18);
    }

    * {
      box-sizing: border-box;
    }

    html {
      min-height: 100%;
      background: #020617;
    }

    body {
      margin: 0;
      min-height: 100vh;
      padding: 24px;
      color: var(--text);
      background:
        radial-gradient(circle at 8% 4%, var(--red-glow), transparent 28rem),
        radial-gradient(circle at 50% 7%, var(--yellow-glow), transparent 29rem),
        radial-gradient(circle at 92% 10%, var(--green-glow), transparent 30rem),
        linear-gradient(180deg, #02040b 0%, #0b1120 46%, #111827 100%);
      background-attachment: fixed;
      font-family: "Inter", ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    }

    body.theater-mode {
      overflow: hidden;
      padding: 0;
      background: #000;
    }

    button,
    input,
    select,
    textarea {
      font: inherit;
    }

    button:focus-visible,
    input:focus-visible,
    select:focus-visible,
    textarea:focus-visible {
      outline: 3px solid var(--focus);
      outline-offset: 2px;
    }

    .app {
      display: grid;
      max-width: 1120px;
      margin: 0 auto;
      gap: 20px;
    }

    .card {
      padding: 18px;
      border: 1px solid rgba(100, 116, 139, 0.42);
      border-radius: 20px;
      background: linear-gradient(145deg, rgba(17, 24, 39, 0.94), var(--panel-glass));
      box-shadow: 0 18px 55px rgba(0, 0, 0, 0.3);
      backdrop-filter: blur(14px);
    }

    .hero-card {
      position: relative;
      overflow: hidden;
      padding: clamp(20px, 4vw, 32px);
      background:
        linear-gradient(120deg, rgba(239, 68, 68, 0.09), transparent 42%),
        linear-gradient(300deg, rgba(34, 197, 94, 0.09), transparent 42%),
        rgba(15, 23, 42, 0.9);
    }

    .hero-card::after {
      content: "";
      position: absolute;
      right: -74px;
      top: -92px;
      width: 220px;
      height: 220px;
      border: 34px solid rgba(255, 255, 255, 0.025);
      border-radius: 50%;
      pointer-events: none;
    }

    .brand-lockup {
      position: relative;
      z-index: 1;
      display: flex;
      align-items: center;
      gap: 16px;
      margin-bottom: 10px;
    }

    .signal-mark {
      display: grid;
      gap: 7px;
      flex: 0 0 auto;
      padding: 10px;
      border: 1px solid rgba(148, 163, 184, 0.32);
      border-radius: 16px;
      background: rgba(2, 6, 23, 0.62);
      box-shadow: inset 0 0 18px rgba(0, 0, 0, 0.38);
    }

    .signal-dot {
      width: 16px;
      height: 16px;
      border-radius: 50%;
    }

    .signal-dot.red {
      background: var(--red);
      box-shadow: 0 0 18px rgba(239, 68, 68, 0.72);
    }

    .signal-dot.green {
      background: var(--green);
      box-shadow: 0 0 18px rgba(34, 197, 94, 0.72);
    }

    .eyebrow {
      margin-bottom: 3px;
      color: #cbd5e1;
      font-size: 0.72rem;
      font-weight: 800;
      letter-spacing: 0.16em;
      text-transform: uppercase;
    }

    .hero-card p {
      position: relative;
      z-index: 1;
      max-width: 820px;
    }

    h1,
    h2 {
      margin-top: 0;
    }

    h1 {
      margin-bottom: 8px;
      font-size: clamp(1.65rem, 4vw, 2.25rem);
    }

    h2 {
      margin-bottom: 4px;
      font-size: 1.02rem;
    }

    p {
      margin: 0;
      color: var(--muted);
      line-height: 1.55;
    }

    .settings-card {
      padding: 0;
    }

    .settings-summary {
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 16px;
      min-height: 72px;
      padding: 16px 18px;
      cursor: pointer;
      list-style: none;
      user-select: none;
    }

    .settings-summary::-webkit-details-marker {
      display: none;
    }

    .settings-summary-copy {
      display: grid;
      gap: 3px;
    }

    .settings-summary-copy strong {
      font-size: 1.06rem;
    }

    .settings-summary-copy small {
      color: var(--muted);
      font-size: 0.86rem;
      font-weight: 500;
    }

    .settings-summary-action {
      display: inline-flex;
      align-items: center;
      gap: 8px;
      flex: 0 0 auto;
      padding: 8px 11px;
      border: 1px solid rgba(148, 163, 184, 0.34);
      border-radius: 999px;
      color: #dbeafe;
      background: rgba(30, 64, 175, 0.18);
      font-size: 0.84rem;
      font-weight: 800;
    }

    .settings-summary-action::before {
      content: "Open settings";
    }

    .settings-summary-action::after {
      content: "";
      display: block;
      flex: 0 0 auto;
      width: 8px;
      height: 8px;
      margin-left: 2px;
      border-right: 2px solid currentColor;
      border-bottom: 2px solid currentColor;
      transform: rotate(45deg);
      transform-origin: 50% 50%;
      transition: transform 0.2s ease;
    }

    .settings-card[open] .settings-summary-action::before {
      content: "Close settings";
    }

    .settings-card[open] .settings-summary-action::after {
      transform: rotate(225deg);
    }

    .settings-card[open] .settings-summary {
      border-bottom: 1px solid rgba(100, 116, 139, 0.3);
    }

    .settings-content {
      padding: 18px;
    }

    .premium-card {
      border-color: rgba(167, 139, 250, 0.42);
      background:
        linear-gradient(120deg, rgba(124, 58, 237, 0.08), transparent 42%),
        linear-gradient(145deg, rgba(17, 24, 39, 0.96), rgba(15, 23, 42, 0.9));
    }

    .premium-card[open] .premium-summary {
      border-bottom-color: rgba(167, 139, 250, 0.28);
    }

    .premium-summary-action {
      color: #ede9fe;
      border-color: rgba(167, 139, 250, 0.4);
      background: rgba(109, 40, 217, 0.18);
    }

    .premium-summary-action::before {
      content: "View Premium";
    }

    .premium-card[open] .premium-summary-action::before {
      content: "Close Premium";
    }

    .premium-heading-row {
      display: flex;
      align-items: center;
      gap: 9px;
      flex-wrap: wrap;
    }

    .premium-badge,
    .premium-status,
    .premium-lock {
      display: inline-flex;
      align-items: center;
      width: fit-content;
      border: 1px solid rgba(196, 181, 253, 0.38);
      border-radius: 999px;
      color: #ede9fe;
      background: rgba(109, 40, 217, 0.2);
      font-size: 0.69rem;
      font-weight: 850;
      letter-spacing: 0.08em;
      text-transform: uppercase;
    }

    .premium-badge {
      padding: 4px 8px;
    }

    .premium-status {
      flex: 0 0 auto;
      padding: 6px 9px;
    }

    .premium-intro {
      display: flex;
      align-items: flex-start;
      justify-content: space-between;
      gap: 18px;
      margin-bottom: 16px;
      padding: 15px 16px;
      border: 1px solid rgba(167, 139, 250, 0.25);
      border-radius: 14px;
      background: rgba(76, 29, 149, 0.1);
    }

    .premium-intro strong {
      display: block;
      margin-bottom: 4px;
    }

    .premium-intro p {
      font-size: 0.9rem;
    }

    .premium-grid {
      display: grid;
      grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
      gap: 14px;
    }

    .premium-feature {
      display: grid;
      align-content: start;
      gap: 11px;
      min-height: 178px;
      padding: 15px;
      border: 1px solid rgba(148, 163, 184, 0.26);
      border-radius: 15px;
      background: linear-gradient(145deg, rgba(30, 41, 59, 0.86), rgba(15, 23, 42, 0.94));
    }

    .premium-feature-heading {
      display: flex;
      align-items: flex-start;
      justify-content: space-between;
      gap: 10px;
    }

    .premium-feature-heading strong {
      line-height: 1.35;
    }

    .premium-lock {
      flex: 0 0 auto;
      padding: 4px 7px;
      font-size: 0.62rem;
    }

    .premium-feature p {
      font-size: 0.88rem;
    }

    .premium-feature-button {
      align-self: end;
      width: 100%;
      margin-top: auto;
      padding: 9px 12px;
      border: 1px solid rgba(167, 139, 250, 0.24);
      border-radius: 10px;
      color: #c4b5fd;
      background: rgba(76, 29, 149, 0.1);
      font-size: 0.8rem;
      font-weight: 750;
      cursor: not-allowed;
      opacity: 0.72;
    }

    .yellow-premium-feature {
      display: grid;
      gap: 15px;
      margin-bottom: 18px;
      padding: 16px;
      border: 1px solid rgba(245, 158, 11, 0.38);
      border-radius: 16px;
      background:
        linear-gradient(135deg, rgba(245, 158, 11, 0.09), transparent 48%),
        rgba(15, 23, 42, 0.58);
    }

    .yellow-feature-header {
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 14px;
      flex-wrap: wrap;
    }

    .yellow-feature-title {
      display: grid;
      gap: 5px;
    }

    .yellow-feature-title-row {
      display: flex;
      align-items: center;
      gap: 9px;
      flex-wrap: wrap;
    }

    .yellow-feature-title p {
      max-width: 760px;
      font-size: 0.9rem;
    }

    .yellow-enable-label {
      display: inline-flex;
      align-items: center;
      gap: 9px;
      padding: 9px 12px;
      border: 1px solid rgba(245, 158, 11, 0.4);
      border-radius: 999px;
      color: #fef3c7;
      background: rgba(120, 53, 15, 0.24);
      font-weight: 800;
    }

    .yellow-config {
      display: grid;
      gap: 14px;
    }

    .yellow-config[hidden] {
      display: none;
    }

    .yellow-controls-grid {
      display: grid;
      grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
      gap: 14px;
    }

    .yellow-controls-grid.is-disabled {
      opacity: 0.55;
      pointer-events: none;
    }

    .yellow-event-options {
      display: flex;
      flex-wrap: wrap;
      gap: 9px 14px;
      margin-top: 7px;
    }

    .yellow-event-options label {
      display: inline-flex;
      align-items: center;
      gap: 7px;
      font-weight: 650;
    }

    .yellow-event-count {
      color: #fde68a;
      font-size: 0.82rem;
      font-weight: 750;
    }

    .yellow-disabled-note {
      color: var(--muted);
      font-size: 0.86rem;
    }


    /* Trainer selection */
    .trainer-card {
      border-color: rgba(56, 189, 248, 0.38);
      background:
        linear-gradient(120deg, rgba(14, 165, 233, 0.07), transparent 44%),
        linear-gradient(145deg, rgba(17, 24, 39, 0.96), rgba(15, 23, 42, 0.9));
    }

    .trainer-card[open] .trainer-summary {
      border-bottom-color: rgba(56, 189, 248, 0.25);
    }

    .trainer-summary-action {
      color: #e0f2fe;
      border-color: rgba(56, 189, 248, 0.36);
      background: rgba(3, 105, 161, 0.18);
    }

    .trainer-summary-action::before {
      content: "Choose Trainer";
    }

    .trainer-card[open] .trainer-summary-action::before {
      content: "Close Trainers";
    }

    .trainer-selected-summary {
      color: #7dd3fc;
      font-weight: 750;
    }

    .trainer-intro {
      display: flex;
      align-items: flex-start;
      justify-content: space-between;
      gap: 18px;
      margin-bottom: 16px;
      padding: 14px 15px;
      border: 1px solid rgba(56, 189, 248, 0.22);
      border-radius: 14px;
      background: rgba(3, 105, 161, 0.08);
    }

    .trainer-intro strong {
      display: block;
      margin-bottom: 4px;
    }

    .trainer-intro p {
      font-size: 0.9rem;
    }

    .trainer-tier-heading {
      display: flex;
      align-items: center;
      gap: 9px;
      margin: 18px 0 10px;
      font-size: 0.94rem;
    }

    .trainer-tier-heading:first-of-type {
      margin-top: 0;
    }

    .trainer-grid {
      display: grid;
      grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
      gap: 14px;
    }

    .trainer-option {
      position: relative;
      display: grid;
      grid-template-rows: auto auto auto;
      align-content: start;
      gap: 9px;
      min-height: 0;
      padding: 15px;
      overflow: hidden;
      border: 1px solid rgba(148, 163, 184, 0.28);
      border-radius: 16px;
      background: linear-gradient(150deg, rgba(30, 41, 59, 0.94), rgba(15, 23, 42, 0.96));
      transition: border-color 0.18s ease, transform 0.18s ease, box-shadow 0.18s ease;
    }

    .trainer-option::before {
      content: "";
      position: absolute;
      inset: 0 0 auto;
      height: 3px;
      background: var(--trainer-accent, #38bdf8);
      opacity: 0.9;
    }

    .trainer-option.selected {
      border-color: var(--trainer-accent, #38bdf8);
      box-shadow: 0 0 0 2px color-mix(in srgb, var(--trainer-accent, #38bdf8) 22%, transparent);
    }

    .trainer-option.premium-trainer {
      border-color: rgba(167, 139, 250, 0.28);
      background:
        linear-gradient(145deg, rgba(76, 29, 149, 0.12), transparent 55%),
        linear-gradient(150deg, rgba(30, 41, 59, 0.94), rgba(15, 23, 42, 0.96));
    }

    .trainer-card-top {
      display: flex;
      align-items: center;
      gap: 15px;
    }

    .trainer-portrait {
      display: grid;
      place-items: center;
      flex: 0 0 auto;
      width: 82px;
      height: 102px;
      overflow: hidden;
      border: 1px solid color-mix(in srgb, var(--trainer-accent, #38bdf8) 52%, #334155);
      border-radius: 20px 20px 24px 24px;
      color: #fff;
      background:
        radial-gradient(circle at 50% 28%, rgba(255, 255, 255, 0.24), transparent 18%),
        linear-gradient(155deg, var(--trainer-accent, #38bdf8), #0f172a 76%);
      background-size: cover;
      background-position: center center;
      background-repeat: no-repeat;
      box-shadow: inset 0 -18px 26px rgba(2, 6, 23, 0.38);
      font-size: 1.55rem;
      font-weight: 900;
      letter-spacing: 0.04em;
    }

    .trainer-portrait.has-image {
      color: transparent;
      font-size: 0;
      text-shadow: none;
    }

    .trainer-name-block {
      min-width: 0;
    }

    .trainer-name-row {
      display: flex;
      align-items: center;
      gap: 8px;
      flex-wrap: wrap;
      margin-bottom: 5px;
    }

    .trainer-name-row strong {
      font-size: 1.28rem;
      line-height: 1.12;
    }

    .trainer-tier-badge {
      display: inline-flex;
      align-items: center;
      padding: 3px 7px;
      border: 1px solid rgba(125, 211, 252, 0.32);
      border-radius: 999px;
      color: #bae6fd;
      background: rgba(3, 105, 161, 0.16);
      font-size: 0.62rem;
      font-weight: 850;
      letter-spacing: 0.07em;
      text-transform: uppercase;
    }

    .trainer-tier-badge.premium {
      color: #ede9fe;
      border-color: rgba(196, 181, 253, 0.34);
      background: rgba(109, 40, 217, 0.19);
    }

    .trainer-archetype {
      color: var(--trainer-accent, #7dd3fc);
      font-size: 0.92rem;
      font-weight: 850;
      line-height: 1.25;
      letter-spacing: 0.035em;
      text-transform: uppercase;
    }

    .trainer-description {
      color: var(--muted);
      font-size: 0.86rem;
      line-height: 1.38;
      margin: 0;
    }

    .trainer-description span {
      display: block;
    }

    .trainer-voice-line {
      color: #cbd5e1;
      font-size: 0.82rem;
    }

    .trainer-actions {
      display: grid;
      grid-template-columns: 1fr 1fr;
      gap: 8px;
      margin-top: 2px;
    }

    .trainer-preview-btn,
    .trainer-select-btn {
      min-height: 40px;
      padding: 8px 10px;
      border: 1px solid rgba(148, 163, 184, 0.3);
      border-radius: 10px;
      font-size: 0.8rem;
    }

    .trainer-preview-btn {
      color: #e2e8f0;
      background: rgba(51, 65, 85, 0.72);
    }

    .trainer-select-btn {
      color: #f0f9ff;
      background: linear-gradient(135deg, #0284c7, #0369a1);
    }

    .trainer-option.selected .trainer-select-btn {
      color: #082f49;
      background: #7dd3fc;
    }

    .trainer-select-btn.locked {
      color: #c4b5fd;
      border-color: rgba(167, 139, 250, 0.28);
      background: rgba(76, 29, 149, 0.14);
      cursor: not-allowed;
      opacity: 0.9;
    }

    .trainer-audio-settings {
      display: grid;
      grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
      gap: 14px;
      margin-top: 18px;
    }

    @media (max-width: 560px) {
      .trainer-grid {
        grid-template-columns: 1fr;
      }

      .trainer-portrait {
        width: 76px;
        height: 94px;
      }

      .trainer-intro {
        display: grid;
      }

      .trainer-actions {
        grid-template-columns: 1fr;
      }
    }


    .uploads,
    .settings-grid {
      display: grid;
      grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
      gap: 14px;
    }

    .upload-box,
    .setting-box {
      position: relative;
      display: grid;
      align-content: start;
      gap: 10px;
      padding: 14px;
      overflow: hidden;
      border: 1px solid var(--border);
      border-radius: 15px;
      background: linear-gradient(150deg, rgba(31, 41, 55, 0.95), rgba(15, 23, 42, 0.88));
    }

    .upload-box::before {
      content: "";
      position: absolute;
      inset: 0 0 auto;
      height: 3px;
      background: #64748b;
    }

    .upload-box.green::before {
      background: linear-gradient(90deg, var(--green), transparent);
    }

    .upload-box.red::before {
      background: linear-gradient(90deg, var(--red), transparent);
    }

    .upload-box.yellow::before {
      background: linear-gradient(90deg, var(--yellow), transparent);
    }

    .upload-box.audio::before {
      background: linear-gradient(90deg, #60a5fa, transparent);
    }

    .upload-box.green {
      border-color: rgba(34, 197, 94, 0.5);
    }

    .upload-box.red {
      border-color: rgba(239, 68, 68, 0.5);
    }

    .upload-box.yellow {
      border-color: rgba(245, 158, 11, 0.58);
    }

    .upload-box.audio {
      border-color: rgba(59, 130, 246, 0.5);
    }

    .count,
    .hint,
    .help,
    .shortcut-help {
      color: var(--muted);
      font-size: 0.9rem;
      line-height: 1.5;
    }

    input[type="file"] {
      width: 100%;
      color: var(--text);
    }

    input[type="number"],
    select,
    textarea {
      width: 100%;
      padding: 9px 10px;
      border: 1px solid var(--border);
      border-radius: 10px;
      color: var(--text);
      background: rgba(2, 6, 23, 0.65);
    }

    textarea {
      min-height: 112px;
      resize: vertical;
      line-height: 1.45;
    }

    /*
      Keep all native select popups consistent with OTL's dark UI.
      Windows/Chromium otherwise renders the opened option list white,
      even when the closed select itself is dark.
    */
    select {
      color-scheme: dark;
    }

    select option,
    select optgroup {
      color: #e5e7eb;
      background-color: #0b1120;
    }

    select option:disabled {
      color: #64748b;
    }

    /* Preserve the darker soundtrack-field surface. */
    select[data-otl-online-soundtrack-select] {
      color: #e5e7eb;
      background-color: #020617;
    }

    input[type="range"] {
      width: 100%;
      accent-color: var(--blue);
    }

    .inline-setting {
      display: flex;
      align-items: center;
      gap: 9px;
      color: var(--text);
      font-weight: 650;
    }

    .inline-setting input[type="checkbox"] {
      width: 18px;
      height: 18px;
      accent-color: var(--blue);
    }

    .controls {
      display: flex;
      flex-wrap: wrap;
      align-items: center;
      gap: 10px;
    }

    button {
      min-height: 44px;
      padding: 11px 15px;
      border: 0;
      border-radius: 12px;
      color: #fff;
      font-weight: 750;
      cursor: pointer;
      transition: transform 0.08s ease, opacity 0.18s ease, filter 0.18s ease;
    }

    button:hover:not(:disabled) {
      filter: brightness(1.08);
    }

    button:active:not(:disabled) {
      transform: translateY(1px);
    }

    button:disabled {
      opacity: 0.42;
      cursor: not-allowed;
    }

    .primary-btn {
      background: linear-gradient(135deg, #2563eb, #1d4ed8);
      box-shadow: 0 8px 22px rgba(37, 99, 235, 0.22);
    }

    .play-btn {
      background: linear-gradient(135deg, #d97706, #b45309);
      box-shadow: 0 8px 22px rgba(217, 119, 6, 0.22);
    }

    .secondary-btn {
      background: linear-gradient(135deg, #475569, #334155);
    }

    .skip-btn {
      background: linear-gradient(135deg, #8b5cf6, #6d28d9);
      box-shadow: 0 8px 22px rgba(139, 92, 246, 0.22);
    }

    .danger-btn {
      background: linear-gradient(135deg, #dc2626, #b91c1c);
      box-shadow: 0 8px 22px rgba(220, 38, 38, 0.22);
    }

    .toggle-wrap {
      display: inline-flex;
      align-items: center;
      gap: 8px;
      margin-left: auto;
      padding: 9px 12px;
      border: 1px solid var(--border);
      border-radius: 999px;
      background: rgba(2, 6, 23, 0.45);
      font-weight: 700;
    }

    .toggle-wrap input {
      width: 18px;
      height: 18px;
      accent-color: var(--blue);
    }

    .status-wrap {
      display: grid;
      gap: 7px;
      margin-top: 14px;
    }

    .status {
      min-height: 1.35em;
      font-weight: 750;
    }

    .status.good {
      color: var(--green);
    }

    .status.warn {
      color: var(--yellow);
    }

    .status.bad {
      color: #f87171;
    }

    .video-card {
      position: relative;
    }

    .video-shell {
      --signal-color: #64748b;
      --signal-rgb: 100, 116, 139;
      position: relative;
      isolation: isolate;
      min-height: 240px;
      padding: 12px;
      overflow: hidden;
      border: 8px solid var(--signal-color);
      border-radius: 22px;
      background: #020617;
      box-shadow:
        0 0 12px rgba(var(--signal-rgb), 0.12),
        0 12px 32px rgba(0, 0, 0, 0.32);
      transition: border-color 0.3s ease, box-shadow 0.3s ease;
    }

    .video-shell.green {
      --signal-color: #22c55e;
      --signal-rgb: 34, 197, 94;
    }

    .video-shell.red {
      --signal-color: #ef4444;
      --signal-rgb: 239, 68, 68;
    }

    .video-shell.yellow {
      --signal-color: #f59e0b;
      --signal-rgb: 245, 158, 11;
    }

    .video-shell.green,
    .video-shell.red,
    .video-shell.yellow {
      animation: signal-frame-gentle-glow 12s ease-in-out infinite;
    }

    @keyframes signal-frame-gentle-glow {
      0%, 100% {
        box-shadow:
          0 0 10px rgba(var(--signal-rgb), 0.14),
          0 0 24px rgba(var(--signal-rgb), 0.05),
          0 12px 32px rgba(0, 0, 0, 0.34);
      }
      50% {
        box-shadow:
          0 0 18px rgba(var(--signal-rgb), 0.24),
          0 0 42px rgba(var(--signal-rgb), 0.09),
          0 12px 34px rgba(0, 0, 0, 0.36);
      }
    }

    video {
      display: block;
      width: 100%;
      max-height: 70vh;
      border-radius: 13px;
      background: #000;
    }

    .video-shell:fullscreen,
    .video-shell:-webkit-full-screen {
      width: 100vw;
      height: 100vh;
      min-height: 100vh;
      max-width: none;
      max-height: none;
      box-sizing: border-box;
      padding: 0;
      border: 6px solid var(--signal-color);
      border-radius: 0;
      background: #000;
    }

    /* Keep the visible fullscreen frame structurally identical for every light. */
    .video-shell.green:fullscreen,
    .video-shell.red:fullscreen,
    .video-shell.yellow:fullscreen,
    .video-shell.green:-webkit-full-screen,
    .video-shell.red:-webkit-full-screen,
    .video-shell.yellow:-webkit-full-screen {
      border-width: 6px;
      border-style: solid;
    }

    /* Red is less luminous to the eye than green, so a slightly stronger red
       bloom keeps the apparent frame weight equal without adding another line. */
    .video-shell.red:fullscreen,
    .video-shell.red:-webkit-full-screen {
      --fullscreen-glow-base: 0.19;
      --fullscreen-glow-peak: 0.31;
    }

    .video-shell.green:fullscreen,
    .video-shell.yellow:fullscreen,
    .video-shell.green:-webkit-full-screen,
    .video-shell.yellow:-webkit-full-screen {
      --fullscreen-glow-base: 0.14;
      --fullscreen-glow-peak: 0.24;
    }

    .video-shell.green:fullscreen,
    .video-shell.red:fullscreen,
    .video-shell.yellow:fullscreen,
    .video-shell.green:-webkit-full-screen,
    .video-shell.red:-webkit-full-screen,
    .video-shell.yellow:-webkit-full-screen {
      animation: signal-frame-fullscreen-glow 12s ease-in-out infinite;
    }

    @keyframes signal-frame-fullscreen-glow {
      0%, 100% {
        box-shadow:
          0 0 12px rgba(var(--signal-rgb), var(--fullscreen-glow-base, 0.14)),
          0 0 26px rgba(var(--signal-rgb), 0.055);
      }
      50% {
        box-shadow:
          0 0 20px rgba(var(--signal-rgb), var(--fullscreen-glow-peak, 0.24)),
          0 0 44px rgba(var(--signal-rgb), 0.095);
      }
    }

    .video-shell:fullscreen video,
    .video-shell:-webkit-full-screen video {
      width: 100%;
      height: 100%;
      max-height: none;
      border-radius: 0;
      object-fit: contain;
    }

    .video-shell:fullscreen .video-overlay,
    .video-shell:-webkit-full-screen .video-overlay {
      inset: 18px auto auto 18px;
    }

    .video-shell:fullscreen .event-popup,
    .video-shell:-webkit-full-screen .event-popup {
      bottom: 28px;
    }

    audio {
      display: none;
    }

    .video-overlay {
      position: absolute;
      inset: 20px auto auto 20px;
      z-index: 5;
      pointer-events: none;
      transform: translateY(-2px);
    }

    .tag {
      display: none;
      width: fit-content;
      padding: 5px 10px;
      border-radius: 999px;
      color: #fff;
      font-size: 0.8rem;
      font-weight: 800;
      letter-spacing: 0.03em;
    }

    .tag.visible {
      display: inline-block;
    }

    .tag.green {
      border: 1px solid rgba(34, 197, 94, 0.65);
      background: rgba(22, 101, 52, 0.85);
    }

    .tag.red {
      border: 1px solid rgba(239, 68, 68, 0.65);
      background: rgba(153, 27, 27, 0.88);
    }

    .tag.yellow {
      border: 1px solid rgba(245, 158, 11, 0.72);
      color: #1c1202;
      background: rgba(251, 191, 36, 0.92);
    }

    .tag.audio {
      border: 1px solid rgba(96, 165, 250, 0.65);
      background: rgba(30, 64, 175, 0.85);
    }

    .event-popup {
      position: absolute;
      left: 50%;
      bottom: 24px;
      z-index: 8;
      width: max-content;
      max-width: calc(100% - 40px);
      padding: 13px 22px;
      transform: translateX(-50%);
      border: 1px solid rgba(255, 255, 255, 0.28);
      border-radius: 14px;
      color: #fff;
      background: rgba(15, 23, 42, 0.92);
      box-shadow: 0 10px 28px rgba(0, 0, 0, 0.5);
      font-size: clamp(1rem, 2.5vw, 1.35rem);
      font-weight: 850;
      letter-spacing: 0.01em;
      text-align: center;
      text-shadow: 0 2px 8px rgba(0, 0, 0, 0.85);
      pointer-events: none;
      backdrop-filter: blur(9px);
      animation: event-popup-life 4s ease forwards;
    }

    @keyframes event-popup-life {
      0%, 78% {
        opacity: 1;
        transform: translate(-50%, 0);
      }
      100% {
        opacity: 0;
        transform: translate(-50%, 8px);
      }
    }

    .event-popup[hidden] {
      display: none;
    }

    .event-popup.edging {
      border-color: rgba(245, 158, 11, 0.78);
      background: rgba(69, 26, 3, 0.92);
    }

    .event-popup.tasting {
      border-color: rgba(168, 85, 247, 0.78);
      background: rgba(59, 7, 100, 0.92);
    }

    .event-popup.flicking {
      border-color: rgba(56, 189, 248, 0.78);
      background: rgba(8, 47, 73, 0.92);
    }



    .event-popup.premium-event {
      border-color: rgba(168, 85, 247, 0.86);
      color: #faf5ff;
      background: rgba(59, 7, 100, 0.94);
      box-shadow:
        0 10px 28px rgba(0, 0, 0, 0.5),
        0 0 28px rgba(168, 85, 247, 0.18);
    }

    .event-popup.yellow-event {
      border-color: rgba(251, 191, 36, 0.88);
      color: #fff7d6;
      background: rgba(92, 49, 5, 0.94);
      box-shadow:
        0 10px 28px rgba(0, 0, 0, 0.5),
        0 0 28px rgba(245, 158, 11, 0.15);
    }

    .end-fade-overlay {
      position: absolute;
      inset: 0;
      /*
        The session-end black fade must sit above the final outcome
        popup so the outcome text fades away with the rest of the
        player instead of remaining visible over the black screen.
      */
      z-index: 13;
      background: #000;
      opacity: 0;
      pointer-events: none;
      transition: opacity 2.4s ease-in-out;
    }

    .end-fade-overlay.active {
      opacity: 1;
    }


    .final-popup {
      position: absolute;
      inset: 0;
      z-index: 12;
      display: grid;
      place-items: center;
      padding: clamp(20px, 5vw, 64px);
      pointer-events: none;
    }

    .final-popup[hidden] {
      display: none;
    }

    .final-popup-text {
      max-width: min(92%, 1100px);
      padding: clamp(20px, 4vw, 48px) clamp(26px, 6vw, 72px);
      border: 2px solid rgba(255, 255, 255, 0.52);
      border-radius: 24px;
      color: #fff;
      background: rgba(2, 6, 23, 0.9);
      box-shadow: 0 20px 70px rgba(0, 0, 0, 0.72);
      font-size: clamp(2.4rem, 9vw, 7.5rem);
      font-weight: 950;
      line-height: 0.98;
      letter-spacing: -0.03em;
      text-align: center;
      text-shadow: 0 4px 18px rgba(0, 0, 0, 0.9);
      backdrop-filter: blur(12px);
    }

    .final-popup.ruin-eat .final-popup-text {
      border-color: rgba(251, 146, 60, 0.92);
      background: rgba(67, 20, 7, 0.93);
    }

    .final-popup.ruin .final-popup-text {
      border-color: rgba(248, 113, 113, 0.92);
      background: rgba(69, 10, 10, 0.93);
    }

    .final-popup.release .final-popup-text {
      border-color: rgba(74, 222, 128, 0.92);
      background: rgba(5, 46, 22, 0.93);
    }

    .final-popup.stop .final-popup-text {
      border-color: rgba(226, 232, 240, 0.92);
      background: rgba(15, 23, 42, 0.95);
    }

    .final-popup.release-eat .final-popup-text {
      border-color: rgba(163, 230, 53, 0.92);
      background: rgba(20, 83, 45, 0.94);
    }

    .duration-setting {
      border-color: rgba(59, 130, 246, 0.5);
    }

    .duration-options {
      display: grid;
      gap: 10px;
    }

    .outcome-setting {
      grid-column: span 2;
      border-color: rgba(168, 85, 247, 0.5);
    }

    .outcome-grid {
      display: grid;
      grid-template-columns: repeat(2, minmax(0, 1fr));
      gap: 9px 14px;
    }

    .outcome-row {
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 10px;
      padding: 9px 10px;
      border: 1px solid rgba(148, 163, 184, 0.24);
      border-radius: 10px;
      background: rgba(2, 6, 23, 0.28);
    }

    .outcome-row .probability-input {
      width: 104px;
    }

    .outcome-total {
      color: var(--muted);
      font-size: 0.88rem;
      font-weight: 700;
    }

    .final-countdown[hidden] {
      display: none;
    }

    .probability-row {
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 12px;
    }

    .probability-input {
      display: inline-flex;
      align-items: center;
      gap: 6px;
      width: 112px;
      flex: 0 0 auto;
    }

    .probability-input input {
      min-width: 0;
    }

    .event-options {
      display: grid;
      gap: 10px;
      margin-top: 2px;
    }

    .event-range-row {
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 12px;
    }

    .event-range-pair {
      display: grid;
      grid-template-columns: repeat(2, 120px);
      gap: 7px;
      flex: 0 0 auto;
    }

    .event-range-pair label,
    .humiliation-lines label {
      display: grid;
      gap: 4px;
      color: var(--muted);
      font-size: 0.72rem;
      font-weight: 700;
      letter-spacing: 0.03em;
    }

    .event-range-pair input {
      width: 100%;
      min-width: 0;
    }

    .dual-probability {
      display: grid;
      gap: 8px;
    }

    .humiliation-lines {
      display: grid;
      grid-template-columns: repeat(2, minmax(0, 1fr));
      gap: 8px;
    }

    .humiliation-lines input {
      min-width: 0;
    }

    @media (max-width: 560px) {
      .event-range-row {
        align-items: flex-start;
        flex-direction: column;
      }

      .event-range-pair,
      .humiliation-lines {
        width: 100%;
        grid-template-columns: repeat(2, minmax(0, 1fr));
      }
    }

    .event-setting .hint {
      min-height: 2.7em;
    }



    .events-content {
      display: grid;
      gap: 18px;
    }

    .event-intro {
      padding: 13px 15px;
      border: 1px solid rgba(148, 163, 184, 0.24);
      border-radius: 14px;
      color: var(--muted);
      background: rgba(2, 6, 23, 0.28);
      line-height: 1.5;
    }

    .event-intro strong {
      color: var(--text);
    }

    .event-tier-heading {
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 12px;
      margin-bottom: -4px;
    }

    .event-tier-heading strong {
      font-size: 1.02rem;
    }

    .event-grid {
      display: grid;
      grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
      gap: 14px;
    }

    .event-setting.premium-event-setting {
      border-color: rgba(168, 85, 247, 0.36);
      background: linear-gradient(150deg, rgba(46, 16, 101, 0.34), rgba(15, 23, 42, 0.9));
    }

    .event-setting.premium-event-setting::after {
      content: "PREMIUM";
      position: absolute;
      top: 12px;
      right: 12px;
      color: #ddd6fe;
      font-size: 0.66rem;
      font-weight: 900;
      letter-spacing: 0.1em;
    }

    .event-setting.premium-event-setting .inline-setting {
      padding-right: 76px;
    }

    .event-priority-note {
      grid-column: 1 / -1;
      padding: 12px 14px;
      border: 1px dashed rgba(148, 163, 184, 0.4);
      border-radius: 12px;
      color: var(--muted);
      background: rgba(2, 6, 23, 0.28);
      font-size: 0.9rem;
      line-height: 1.5;
    }

    .meta {
      display: grid;
      gap: 6px;
      margin-top: 12px;
      color: var(--muted);
      font-size: 0.95rem;
    }

    .meta strong {
      color: var(--text);
    }

    .session-stats {
      display: flex;
      flex-wrap: wrap;
      gap: 8px 16px;
      margin-top: 8px;
      color: var(--muted);
      font-size: 0.9rem;
    }

    .theater-controls {
      display: none;
      position: fixed;
      right: 12px;
      bottom: 12px;
      z-index: 100;
      gap: 8px;
      padding: 8px;
      border: 1px solid rgba(148, 163, 184, 0.3);
      border-radius: 14px;
      background: rgba(15, 23, 42, 0.82);
      backdrop-filter: blur(10px);
    }

    .theater-controls button {
      min-height: 38px;
      padding: 8px 11px;
      font-size: 0.86rem;
    }

    body.theater-mode .hero-card,
    body.theater-mode .uploads-card,
    body.theater-mode .settings-card,
    body.theater-mode .controls-card {
      display: none;
    }

    body.theater-mode .theater-controls {
      display: flex;
    }

    body.theater-mode .app {
      display: block;
      max-width: none;
      margin: 0;
    }

    body.theater-mode .video-card {
      position: fixed;
      inset: 0;
      z-index: 10;
      margin: 0;
      padding: 12px;
      border: 0;
      border-radius: 0;
      background: #000;
      box-shadow: none;
    }

    body.theater-mode .video-shell {
      height: calc(100vh - 24px);
      padding: 10px;
      border-width: 10px;
      background: #000;
    }

    body.theater-mode video {
      height: 100%;
      max-height: none;
      object-fit: contain;
    }

    body.theater-mode .meta,
    body.theater-mode .session-stats {
      display: none;
    }

    body.theater-mode .event-popup {
      bottom: 72px;
    }

    @media (max-width: 760px) {
      .premium-intro {
        display: grid;
      }

      body {
        padding: 14px;
      }

      .card {
        padding: 14px;
      }

      .toggle-wrap {
        width: 100%;
        margin-left: 0;
      }

      .settings-summary {
        align-items: flex-start;
      }

      .settings-summary-copy small {
        max-width: 190px;
      }

      .settings-summary-action {
        padding: 7px 9px;
      }

      .video-shell {
        min-height: 180px;
        padding: 7px;
        border-width: 6px;
      }

      .video-overlay {
        inset: 12px 12px auto 12px;
      }

      .event-popup {
        bottom: 16px;
        max-width: calc(100% - 24px);
        padding: 11px 16px;
      }

      body.theater-mode .event-popup {
        bottom: 66px;
      }


      .outcome-setting {
        grid-column: auto;
      }

      .outcome-grid {
        grid-template-columns: 1fr;
      }

      .final-popup-text {
        max-width: 96%;
      }
    }

    @media (prefers-reduced-motion: reduce) {
      *,
      *::before,
      *::after {
        scroll-behavior: auto !important;
        transition: none !important;
        animation: none !important;
      }
    }
/* Stable Premium header accent from first paint. */
.premium-card {
  border-top-color: rgba(167, 139, 250, 0.86) !important;
}

.premium-card::before {
  display: none !important;
}

/* ============================================================
   SESSION ENDING VISUAL HIERARCHY
   ============================================================ */

.outcome-row {
  min-height: 72px;
  padding: 12px 14px;
  border-radius: 14px;
  background:
    linear-gradient(
      145deg,
      rgba(15, 23, 42, 0.72),
      rgba(2, 6, 23, 0.42)
    );
  transition:
    border-color 0.15s ease,
    background-color 0.15s ease;
}

.outcome-row:hover {
  border-color: rgba(148, 163, 184, 0.36);
}

.outcome-row:focus-within {
  border-color: rgba(167, 139, 250, 0.48);
}

/*
  Match the normal control-label size used by
  "Randomize duration", while retaining stronger weight.
*/
.outcome-setting .outcome-row > span:first-child {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;

  color: #f1f5f9;
  font-size: 1rem !important;
  font-weight: 800;
  line-height: 1.25;
  letter-spacing: -0.01em;
}

.outcome-row > span:first-child::before {
  content: "";

  flex: 0 0 42px;
  width: 42px;
  height: 42px;

  border: 1px solid rgba(148, 163, 184, 0.22);
  border-radius: 12px;

  background-repeat: no-repeat;
  background-position: center;
  background-size: 24px 24px;

  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.04),
    0 4px 14px rgba(0, 0, 0, 0.12);
}

.outcome-row .probability-input {
  flex: 0 0 104px;
  width: 104px;
}


/* ---------- Outcome order ---------- */

/* Row 1 */
.outcome-row:has(#releaseChanceInput) {
  order: 1;
}

.outcome-row:has(#ruinChanceInput) {
  order: 2;
}

/* Row 2 */
.outcome-row:has(#releaseEatChanceInput) {
  order: 3;
}

.outcome-row:has(#ruinEatChanceInput) {
  order: 4;
}

/* Row 3 */
.outcome-row:has(#selfFacialChanceInput) {
  order: 5;
}

.outcome-row:has(#stopChanceInput) {
  order: 6;
}


/* ---------- Cum: green ---------- */

.outcome-row:has(#releaseChanceInput)
  > span:first-child::before {
  border-color: rgba(74, 222, 128, 0.45);
  background-color: rgba(5, 46, 22, 0.58);
  background-image:
    url("../assets/icons/outcomes/cum.svg");
}

.final-popup.release .final-popup-text {
  border-color: rgba(74, 222, 128, 0.92);
  background: rgba(5, 46, 22, 0.93);
}


/* ---------- Ruin: orange ---------- */

.outcome-row:has(#ruinChanceInput)
  > span:first-child::before {
  border-color: rgba(249, 115, 22, 0.45);
  background-color: rgba(67, 20, 7, 0.58);
  background-image:
    url("../assets/icons/outcomes/ruin.svg");
}

.final-popup.ruin .final-popup-text {
  border-color: rgba(249, 115, 22, 0.92);
  background: rgba(67, 20, 7, 0.93);
}


/* ---------- Cum & Eat: lime ---------- */

.outcome-row:has(#releaseEatChanceInput)
  > span:first-child::before {
  border-color: rgba(163, 230, 53, 0.45);
  background-color: rgba(26, 46, 5, 0.62);
  background-image:
    url("../assets/icons/outcomes/cum-eat.svg");
}

.final-popup.release-eat .final-popup-text {
  border-color: rgba(163, 230, 53, 0.92);
  background: rgba(26, 46, 5, 0.94);
}


/* ---------- Ruin & Eat: amber ---------- */

.outcome-row:has(#ruinEatChanceInput)
  > span:first-child::before {
  border-color: rgba(245, 158, 11, 0.45);
  background-color: rgba(69, 26, 3, 0.60);
  background-image:
    url("../assets/icons/outcomes/ruin-eat.svg");
}

.final-popup.ruin-eat .final-popup-text {
  border-color: rgba(245, 158, 11, 0.92);
  background: rgba(69, 26, 3, 0.93);
}


/* ---------- Self-facial: pink ---------- */

.outcome-row:has(#selfFacialChanceInput)
  > span:first-child::before {
  border-color: rgba(244, 114, 182, 0.45);
  background-color: rgba(80, 7, 36, 0.58);
  background-image:
    url("../assets/icons/outcomes/self-facial.svg");
}

.final-popup.self-facial .final-popup-text {
  border-color: rgba(244, 114, 182, 0.92);
  background: rgba(80, 7, 36, 0.93);
}


/* ---------- STOP: red ---------- */

.outcome-row:has(#stopChanceInput)
  > span:first-child::before {
  border-color: rgba(239, 68, 68, 0.48);
  background-color: rgba(69, 10, 10, 0.62);
  background-image:
    url("../assets/icons/outcomes/stop.svg");
}

.final-popup.stop .final-popup-text {
  border-color: rgba(239, 68, 68, 0.92);
  background: rgba(69, 10, 10, 0.95);
}


@media (max-width: 520px) {
  .outcome-row {
    min-height: 66px;
    padding: 10px 12px;
  }

  /*
    Keep the label at exactly 1rem on mobile too.
  */
  .outcome-setting .outcome-row > span:first-child {
    gap: 10px;
    font-size: 1rem !important;
  }

  .outcome-row > span:first-child::before {
    flex-basis: 36px;
    width: 36px;
    height: 36px;
    border-radius: 10px;
    background-size: 21px 21px;
  }
}

/* ============================================================
   SESSION ENDING VISUAL HIERARCHY END
   ============================================================ */

/* ============================================================
   EVENT POPUP ACCENT SYNC
   ============================================================ */

/*
  The Event card is the source of truth.

  JavaScript copies that card's computed
  --otl-event-accent-rgb value onto the popup as
  --otl-event-popup-accent-rgb.
*/
.event-popup[data-otl-event-accent="true"]:not(.yellow-event) {
  border-color:
    rgba(
      var(--otl-event-popup-accent-rgb),
      0.82
    ) !important;

  color: #ffffff;

  background:
    color-mix(
      in srgb,
      rgb(var(--otl-event-popup-accent-rgb)) 32%,
      #0f172a 68%
    ) !important;

  box-shadow:
    0 10px 28px rgba(0, 0, 0, 0.50),
    0 0 28px
      rgba(
        var(--otl-event-popup-accent-rgb),
        0.16
      ) !important;
}

/*
  Interactive Event popup actions inherit the Event accent too.
*/
.event-popup[data-otl-event-accent="true"]
.otl-event-popup-actions
button.primary {
  border-color:
    rgba(
      var(--otl-event-popup-accent-rgb),
      0.52
    ) !important;

  background:
    rgba(
      var(--otl-event-popup-accent-rgb),
      0.22
    ) !important;
}

/* ============================================================
   EVENT POPUP ACCENT SYNC END
   ============================================================ */

/* Session Endings heading */
.outcome-setting .otl-outcome-heading > strong {
  font-weight: 800;
}

/* ============================================================
   SESSION DURATION COMPACT LAYOUT
   ============================================================ */

.duration-setting {
  display: grid !important;
  grid-template-columns: 1fr !important;
  align-content: start !important;

  row-gap: 0 !important;
}

.duration-setting
.otl-session-duration-title {
  grid-column: 1 !important;

  width: 100%;
  margin: 0 !important;
}

.duration-setting
.otl-session-duration-mode {
  grid-column: 1 !important;

  display: block;

  width: 100%;
  min-width: 0;

  margin: 16px 0 0 !important;
}

.duration-setting
.otl-session-duration-mode select {
  box-sizing: border-box;

  display: block;

  width: 100% !important;
  min-width: 0;
  min-height: 44px;

  margin: 0 !important;

  padding:
    9px
    38px
    9px
    12px;

  border:
    1px solid
    rgba(100, 116, 139, .56);

  border-radius: 10px;

  color: #f8fafc;

  background-color:
    rgba(2, 6, 23, .58);
}

.duration-setting
.otl-session-duration-mode select:disabled {
  cursor: not-allowed;
  opacity: .55;
}

#randomizeSessionDurationInput {
  display: none !important;
}

.duration-setting
.otl-session-duration-value {
  grid-column: 1 !important;

  display: flex;
  align-items: center;
  gap: 8px;

  margin: 14px 0 0 !important;

  color: #cbd5e1;
}

.duration-setting
.otl-session-duration-value[hidden] {
  display: none !important;
}

.duration-setting
.otl-session-duration-value input {
  width: 92px;
}

/* ============================================================
   SESSION DURATION COMPACT LAYOUT END
   ============================================================ */
