﻿    *, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

    :root {
      --bg:           #FFFFFF;
      --surface:      #F5F5F5;
      --surface2:     #EBEBEB;
      --border:       #E2E2E2;
      --text:         #111111;
      --text2:        #666666;
      --text3:        #AAAAAA;
      --serve:        #00BFA5;
      --serve-light:  #E0F7FA;
      --home:         #1A73E8;
      --home-light:   #E8F0FE;
      --away:         #E53935;
      --away-light:   #FDECEA;
      --nopt:         #757575;
      --nopt-light:   #F0F0F0;
      --highlight:    #FFAB00;
      --danger:       #D32F2F;
      --radius:       14px;
      --radius-sm:    9px;
      --nav-h:        68px;
      --header-h:     56px;
      --trans:        0.18s ease;
    }

    html, body {
      height: 100%;
      overflow: hidden;
      font-family: 'Barlow', sans-serif;
      background: var(--bg);
      color: var(--text);
      -webkit-font-smoothing: antialiased;
      -webkit-text-size-adjust: 100%;
    }

    button { font-family: 'Barlow', sans-serif; -webkit-tap-highlight-color: transparent; user-select: none; -webkit-user-select: none; }

    /* ══════════════════════════════════════════
       MAIN VIEW
    ══════════════════════════════════════════ */
    #main-view {
      position: fixed; inset: 0;
      display: flex; flex-direction: column;
      background: var(--bg);
    }

    /* Header */
    #header {
      height: var(--header-h);
      display: flex; align-items: center;
      padding: 0 12px; gap: 8px;
      border-bottom: 1px solid var(--border);
      background: #fff; z-index: 10; flex-shrink: 0;
    }

    .logo {
      flex-shrink: 0; display: flex; align-items: center; gap: 7px; text-decoration: none;
    }
    .logo img { height: 32px; width: auto; display: block; }
    .logo-url {
      font-family: 'Cy Grotesk Key', 'Barlow Condensed', sans-serif;
      font-size: 13px; font-weight: 700; color: var(--text);
      letter-spacing: 0.2px; white-space: nowrap; line-height: 1;
    }
    @media (max-width: 420px) { .logo-url { display: none; } }

    .team-wrap { flex: 1; position: relative; min-width: 0; }
    .team-input {
      width: 100%;
      border: 1.5px solid var(--border); border-radius: var(--radius-sm);
      padding: 7px 10px;
      font-family: 'Barlow', sans-serif; font-size: 13px; font-weight: 600;
      color: var(--text); background: var(--surface);
      outline: none; transition: border-color var(--trans), background var(--trans);
    }
    .team-input::placeholder { color: var(--text3); font-weight: 400; }
    .team-input:focus { border-color: var(--home); background: #fff; }
    .team-input.away:focus { border-color: var(--away); }
    .team-color-bar {
      position: absolute; bottom: 0; left: 8px; right: 8px;
      height: 2px; border-radius: 1px;
      background: var(--home); opacity: 0;
      transition: opacity var(--trans);
    }
    .team-input:focus + .team-color-bar { opacity: 1; }
    .team-wrap.away .team-color-bar { background: var(--away); }

    .vs { font-family: 'Barlow Condensed', sans-serif; font-size: 12px; font-weight: 700; color: var(--text3); flex-shrink: 0; letter-spacing: 1px; }

    /* Video area */
    #video-area {
      flex: 1; display: flex; align-items: center; justify-content: center;
      background: #0a0a0a; position: relative; overflow: hidden;
    }

    #main-video { max-width: 100%; max-height: 100%; width: 100%; height: 100%; object-fit: contain; display: none; }

    #placeholder {
      display: flex; flex-direction: column; align-items: center; gap: 16px;
      cursor: pointer; padding: 40px; text-align: center;
      animation: fadeIn 0.4s ease;
    }
    .ph-ring {
      width: 80px; height: 80px; border-radius: 50%;
      border: 2px solid rgba(255,255,255,0.08);
      display: flex; align-items: center; justify-content: center;
      font-size: 34px;
      background: rgba(255,255,255,0.04);
    }
    #placeholder p { font-family: 'Barlow Condensed', sans-serif; font-size: 20px; font-weight: 700; color: rgba(255,255,255,0.55); }
    #placeholder small { font-size: 13px; color: rgba(255,255,255,0.3); }
    @keyframes fadeIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }

    /* Bottom Nav */
    #bottom-nav {
      height: var(--nav-h); display: flex; align-items: stretch;
      border-top: 1px solid var(--border); background: #fff; flex-shrink: 0;
    }

    .nav-btn {
      flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center;
      gap: 4px; border: none; background: none; cursor: pointer;
      color: var(--text3); font-size: 10px; font-weight: 700; letter-spacing: 0.5px;
      text-transform: uppercase; transition: color var(--trans);
      position: relative;
    }
    .nav-btn::after {
      content: ''; position: absolute; top: 0; left: 20%; right: 20%;
      height: 2px; background: var(--serve); border-radius: 1px;
      transform: scaleX(0); transition: transform var(--trans);
    }
    .nav-btn.active { color: var(--serve); }
    .nav-btn.active::after { transform: scaleX(1); }
    .nav-btn:active { color: var(--text2); }
    .nav-btn svg { width: 22px; height: 22px; stroke-width: 1.8; }

    #file-input { display: none; }

    /* ══════════════════════════════════════════
       EDITOR VIEW (fullscreen overlay)
    ══════════════════════════════════════════ */
    #editor-view {
      position: fixed; inset: 0;
      background: #000;
      display: flex; flex-direction: column;
      z-index: 100;
      visibility: hidden; opacity: 0;
      transition: opacity 0.22s ease, visibility 0.22s;
    }
    #editor-view.open { visibility: visible; opacity: 1; }

    #editor-video {
      position: absolute; inset: 0;
      width: 100%; height: 100%; object-fit: contain;
    }

    /* Top bar */
    #ed-top {
      position: relative; z-index: 5;
      display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
      align-items: center;
      padding: 10px 14px; gap: 10px;
      background: linear-gradient(to bottom, rgba(0,0,0,0.72) 0%, transparent 100%);
      pointer-events: none;
    }
    #ed-top > * { pointer-events: auto; }
    .ed-top-side {
      display: flex; align-items: center; gap: 10px;
      min-width: 0;
    }
    #ed-top-left { justify-self: start; position: relative; z-index: 200; }
    #ed-top-right { justify-self: end; justify-content: flex-end; }

    .gl-btn {
      width: 38px; height: 38px; border-radius: 50%;
      border: none; background: rgba(255,255,255,0.14);
      backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
      color: #fff; display: flex; align-items: center; justify-content: center;
      cursor: pointer; flex-shrink: 0;
      transition: background var(--trans), transform 0.1s;
    }
    .gl-btn:active { background: rgba(255,255,255,0.28); transform: scale(0.9); }
    .gl-btn:disabled { opacity: 0.35; }
    .gl-btn svg { width: 17px; height: 17px; stroke-width: 2.2; }

    #score-wrap { text-align: center; }
    #score-teams { font-family: 'Barlow Condensed', sans-serif; font-size: 11px; font-weight: 700; color: rgba(255,255,255,0.55); letter-spacing: 1.5px; text-transform: uppercase; }
    #score-nums { font-family: 'Barlow Condensed', sans-serif; font-size: 34px; font-weight: 900; line-height: 1; letter-spacing: 1px; color: #fff; }
    #score-nums .sh { color: #82b4ff; }
    #score-nums .sa { color: #ff8a80; }
    #score-nums .sep { color: rgba(255,255,255,0.35); font-weight: 500; margin: 0 3px; }

    /* Active clip indicator */
    #rec-bar {
      display: flex; align-items: center; justify-content: flex-end;
      min-width: 0;
    }
    .rec-pill {
      display: flex; align-items: center; gap: 7px;
      backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
      border: 1px solid transparent;
      border-radius: 100px; padding: 5px 14px;
      font-family: 'Barlow Condensed', sans-serif; font-size: 13px; font-weight: 700; letter-spacing: 0.5px;
      max-width: min(44vw, 260px);
      white-space: nowrap; overflow: hidden;
    }
    .rec-pill span { overflow: hidden; text-overflow: ellipsis; }
    .rec-dot { width: 7px; height: 7px; border-radius: 50%; flex-shrink: 0; animation: blink 1.1s ease-in-out infinite; }
    .rec-select {
      background: transparent; border: none; outline: none; cursor: pointer;
      font-family: 'Barlow Condensed', sans-serif; font-size: 13px; font-weight: 700; letter-spacing: 0.5px;
      min-width: 0; flex: 1; overflow: hidden;
    }
    @keyframes blink { 0%,100%{opacity:1;} 50%{opacity:0.3;} }

    /* Spacer */
    #ed-spacer { flex: 1; }

    /* Progress */
    #progress-wrap {
      position: absolute;
      left: 0;
      right: 0;
      bottom: 0;
      z-index: 6;
      padding: 0 16px calc(10px + env(safe-area-inset-bottom, 0px));
      background: linear-gradient(to top, rgba(0,0,0,0.82) 0%, rgba(0,0,0,0.28) 65%, transparent 100%);
    }
    #vid-progress {
      --progress-pct: 0%;
      width: 100%;
      height: 12px;
      -webkit-appearance: none;
      appearance: none;
      border: none;
      border-radius: 999px;
      outline: none;
      cursor: pointer;
      background: linear-gradient(
        to right,
        rgba(255,255,255,0.96) 0%,
        rgba(255,255,255,0.96) var(--progress-pct),
        rgba(255,255,255,0.22) var(--progress-pct),
        rgba(255,255,255,0.22) 100%
      );
      box-shadow: inset 0 0 0 1px rgba(255,255,255,0.1);
    }
    #vid-progress::-webkit-slider-runnable-track {
      height: 12px;
      border-radius: 999px;
      background: transparent;
    }
    #vid-progress::-webkit-slider-thumb {
      -webkit-appearance: none;
      width: 0;
      height: 0;
      border: 0;
      background: transparent;
      box-shadow: none;
    }
    #vid-progress::-moz-range-track {
      height: 12px;
      border: none;
      border-radius: 999px;
      background: transparent;
    }
    #vid-progress::-moz-range-progress {
      height: 12px;
      border-radius: 999px;
      background: transparent;
    }
    #vid-progress::-moz-range-thumb {
      width: 0;
      height: 0;
      border: 0;
      background: transparent;
    }

    /* Controls */
    #ed-controls {
      position: relative; z-index: 5;
      display: flex; align-items: center; justify-content: space-between;
      padding: 10px 20px 42px; 
      background: linear-gradient(to top, rgba(0,0,0,0.75) 0%, transparent 100%);
    }

    /* D-pad */
    #dpad { display: grid; grid-template-columns: 46px 46px 46px; grid-template-rows: 46px 46px 46px; gap: 5px; }

    .dp {
      border-radius: 10px; border: none;
      background: rgba(255,255,255,0.11);
      color: #fff; display: flex; align-items: center; justify-content: center;
      cursor: pointer; font-size: 14px; font-weight: 700;
      transition: background 0.1s, transform 0.1s;
    }
    .dp:active { background: rgba(255,255,255,0.26); transform: scale(0.88); }
    .dp.center { background: rgba(255,255,255,0.18); font-size: 16px; }
    .dp-empty { background: transparent !important; pointer-events: none; }
    .dp.star-on { background: rgba(255,171,0,0.3); color: var(--highlight); }
    .dp:disabled { opacity: 0.28; cursor: default; }
    .dp svg { width: 18px; height: 18px; stroke-width: 2.2; pointer-events: none; }

    /* Action pad */
    #action-pad { display: grid; grid-template-columns: 86px 76px; grid-template-rows: 46px 46px 46px; gap: 5px; opacity: 50%;}

    .act {
      border: solid; border-radius: 10px; color: #fff;
      font-family: 'Barlow Condensed', sans-serif; font-size: 13px; font-weight: 800; letter-spacing: 1px;
      cursor: pointer; text-transform: uppercase;
      display: flex; align-items: center; justify-content: center;
      transition: transform 0.1s, opacity var(--trans);
    }
    .act:active:not(:disabled) { transform: scale(0.88); }
    .act:disabled { opacity: 0.28; cursor: default; border:none; }

    #btn-serve { grid-row: 1/4; grid-column: 1; background: var(--serve); border-radius: 12px; font-size: 17px; letter-spacing: 1.5px; }
    #btn-home  { grid-row: 1; grid-column: 2; background: var(--home); }
    #btn-nopt  { grid-row: 2; grid-column: 2; background: var(--nopt); font-size: 12px; }
    #btn-away  { grid-row: 3; grid-column: 2; background: var(--away); }

    /* ══════════════════════════════════════════
       MARKS MODAL (bottom sheet)
    ══════════════════════════════════════════ */
    #marks-modal {
      position: fixed; inset: 0; z-index: 300;
      display: flex; align-items: flex-end;
      visibility: hidden; opacity: 0;
      transition: opacity 0.22s ease, visibility 0.22s;
    }
    #marks-modal.open { visibility: visible; opacity: 1; }

    .modal-backdrop { position: absolute; inset: 0; background: rgba(0,0,0,0.5); }

    .modal-sheet {
      position: relative; width: 100%; max-height: 72vh;
      background: #fff; border-radius: 20px 20px 0 0;
      display: flex; flex-direction: column; overflow: hidden;
      transform: translateY(30px);
      transition: transform 0.22s ease;
    }
    #marks-modal.open .modal-sheet { transform: translateY(0); }

    .modal-handle { width: 36px; height: 4px; background: var(--border); border-radius: 2px; margin: 12px auto 0; flex-shrink: 0; }
    .modal-head { display: flex; align-items: center; justify-content: space-between; padding: 10px 18px; border-bottom: 1px solid var(--border); flex-shrink: 0; }
    .modal-title { font-family: 'Barlow Condensed', sans-serif; font-size: 18px; font-weight: 800; color: var(--text); }
    .modal-x { background: none; border: none; color: var(--text3); cursor: pointer; font-size: 20px; line-height: 1; padding: 4px; }

    .marks-scroll { overflow-y: auto; flex: 1; }

    .mk-item {
      display: flex; align-items: center; gap: 10px;
      padding: 10px 16px; border-bottom: 1px solid var(--border);
      cursor: pointer;
    }
    .mk-item.is-active { background: rgba(0,191,165,0.04); }

    .mk-dot { width: 9px; height: 9px; border-radius: 50%; flex-shrink: 0; }

    .mk-times { flex: 1; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }

    .ts-btn {
      background: var(--surface); border: 1px solid var(--border); border-radius: 6px;
      padding: 4px 9px; font-family: 'Barlow', sans-serif; font-size: 12px; font-weight: 600;
      color: var(--text); cursor: pointer; transition: background 0.12s;
    }
    .ts-btn:active { background: var(--surface2); }
    .ts-btn.no-end { color: var(--text3); font-weight: 400; font-style: italic; border-style: dashed; }

    .mk-arrow { font-size: 11px; color: var(--text3); }

    .mk-type { font-family: 'Barlow Condensed', sans-serif; font-size: 12px; font-weight: 800; letter-spacing: 0.5px; flex-shrink: 0; border: none; background: transparent; cursor: pointer;}

    .mk-star { background: none; border: none; cursor: pointer; font-size: 18px; padding: 2px; transition: transform 0.12s; }
    .mk-star:active { transform: scale(1.4); }

    .mk-del { background: none; border: none; cursor: pointer; color: var(--away); font-size: 16px; padding: 4px; opacity: 0.7; }
    .mk-del:active { opacity: 1; }

    .marks-empty { padding: 40px 20px; text-align: center; color: var(--text3); font-family: 'Barlow Condensed', sans-serif; font-size: 16px; font-weight: 600; line-height: 1.6; }

    /* ══════════════════════════════════════════
       SLIDE PANELS (Review & Export)
    ══════════════════════════════════════════ */
    .panel {
      position: fixed; inset: 0; z-index: 50;
      background: var(--bg);
      display: flex; flex-direction: column;
      transform: translateY(100%);
      transition: transform 0.28s cubic-bezier(0.32, 0.72, 0, 1);
    }
    .panel.open { transform: translateY(0); }

    .panel-head {
      display: flex; align-items: center; gap: 12px;
      padding: 0 16px; height: var(--header-h);
      border-bottom: 1px solid var(--border); flex-shrink: 0;
    }
    .panel-title { font-family: 'Barlow Condensed', sans-serif; font-size: 22px; font-weight: 900; color: var(--text); flex: 1; letter-spacing: -0.3px; }
    .panel-x {
      width: 36px; height: 36px; border-radius: 50%; border: none;
      background: var(--surface); color: var(--text2); cursor: pointer;
      display: flex; align-items: center; justify-content: center;
      transition: background var(--trans);
    }
    .panel-x:active { background: var(--surface2); }
    .panel-x svg { width: 16px; height: 16px; stroke-width: 2.5; }

    .panel-body { flex: 1; overflow-y: auto; }

    /* Review list */
    .rv-item {
      display: flex; align-items: center; gap: 10px;
      padding: 11px 16px; border-bottom: 1px solid var(--border);
    }
    .rv-num { font-family: 'Barlow Condensed', sans-serif; font-size: 13px; font-weight: 700; color: var(--text3); width: 22px; text-align: right; flex-shrink: 0; }
    .rv-badge { border-radius: 6px; padding: 3px 8px; font-family: 'Barlow Condensed', sans-serif; font-size: 11px; font-weight: 800; letter-spacing: 0.5px; text-transform: uppercase; flex-shrink: 0; }
    .rv-times { flex: 1; display: flex; gap: 5px; flex-wrap: wrap; align-items: center; }
    .rv-chip { background: var(--surface); border-radius: 5px; padding: 2px 7px; font-size: 11px; color: var(--text2); font-weight: 600; font-family: 'Barlow', sans-serif; }
    .rv-star { font-size: 14px; flex-shrink: 0; }

    /* Export */
    .export-body {
      padding: 12px 14px calc(12px + env(safe-area-inset-bottom, 0px));
      display: flex; flex-direction: column; gap: 10px;
    }
    .export-info { display: flex; flex-direction: column; gap: 10px; }
    .export-settings { display: flex; flex-direction: column; gap: 10px; border-top: 1px solid var(--border); padding-top: 14px; }
    .section-head {
      font-family: 'Barlow Condensed', sans-serif; font-size: 13px; font-weight: 800;
      letter-spacing: 1.5px; text-transform: uppercase; color: var(--text3);
    }
    .section-chevron { display: none; }

    @media (max-width: 599px) {
      .section-head {
        display: flex; align-items: center; justify-content: space-between;
        cursor: pointer; padding: 2px 0 8px;
        -webkit-tap-highlight-color: transparent; user-select: none; -webkit-user-select: none;
      }
      .section-chevron {
        display: block; width: 16px; height: 16px; stroke-width: 2.5;
        color: var(--text3); flex-shrink: 0;
        transition: transform 0.2s ease;
      }
      .collapsed .section-chevron { transform: rotate(-90deg); }
      .export-info.collapsed > *:not(.section-head),
      .export-settings.collapsed > *:not(.section-head) { display: none; }
    }
    .export-settings-row { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; align-items: start; }
    .export-settings-col { display: flex; flex-direction: column; gap: 4px; }
    .export-dur-note { font-size: 11px; color: var(--text3); text-align: center; font-weight: 600; }

    /* Preview canvas */
    .preview-wrap {
      display: block; position: relative;
      border-radius: var(--radius); overflow: hidden;
      background: #0a0a0a; flex-shrink: 0;
    }
    #preview-canvas { width: 100%; height: auto; display: block; }
    .preview-label {
      position: absolute; top: 8px; left: 8px;
      background: rgba(0,0,0,0.52); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
      color: rgba(255,255,255,0.75);
      font-family: 'Barlow Condensed', sans-serif; font-size: 10px; font-weight: 800;
      letter-spacing: 1.2px; text-transform: uppercase;
      padding: 3px 7px; border-radius: 5px; pointer-events: none;
    }

    /* Scoreboard style selector */
    .sb-style-wrap { position: relative; }
    .sb-style-select {
      width: 100%; padding: 7px 36px 7px 10px;
      border: 1.5px solid var(--border); border-radius: var(--radius-sm);
      background: var(--surface); color: var(--text3);
      font-family: 'Barlow Condensed', sans-serif; font-size: 12px; font-weight: 700;
      letter-spacing: 0.5px; text-transform: uppercase;
      cursor: not-allowed; appearance: none; -webkit-appearance: none; opacity: 0.65;
    }
    .soon-tag {
      position: absolute; right: 7px; top: 50%; transform: translateY(-50%);
      font-size: 9px; font-weight: 800; letter-spacing: 0.5px; text-transform: uppercase;
      background: var(--surface2); color: var(--text3);
      padding: 2px 5px; border-radius: 4px; pointer-events: none;
    }

    .export-sections { display: flex; flex-direction: column; }
    @media (min-width: 600px) {
      .export-sections { flex-direction: row; align-items: flex-start; }
      .export-info { flex: 1; padding-right: 16px; }
      .export-settings { flex: 1; border-top: none; padding-top: 0; border-left: 1px solid var(--border); padding-left: 16px; }
    }

    .scoreboard {
      background: var(--text); border-radius: var(--radius);
      padding: 8px 16px; color: #fff; text-align: center;
    }
    .sb-heads { display: flex; justify-content: space-between; font-family: 'Barlow Condensed', sans-serif; font-size: 13px; font-weight: 700; color: rgba(255,255,255,0.5); text-transform: uppercase; letter-spacing: 1.5px; margin-bottom: 2px; }
    .sb-score { font-family: 'Barlow Condensed', sans-serif; font-size: 40px; font-weight: 900; line-height: 1; letter-spacing: -2px; }
    .sb-score .sh { color: #82b4ff; }
    .sb-score .sa { color: #ff8a80; }
    .sb-score .sep { color: rgba(255,255,255,0.25); font-weight: 400; margin: 0 6px; }

    .stats-grid { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 8px; }
    .stat-card { background: var(--surface); border-radius: var(--radius-sm); padding: 8px 6px; text-align: center; }
    .stat-n { font-family: 'Barlow Condensed', sans-serif; font-size: 24px; font-weight: 900; line-height: 1; }
    .stat-l { font-size: 10px; color: var(--text2); font-weight: 600; margin-top: 1px; text-transform: uppercase; letter-spacing: 0.5px; }

    .meta-card { background: var(--surface); border-radius: var(--radius-sm); padding: 1px 12px; }
    .meta-row { display: flex; justify-content: space-between; align-items: center; padding: 6px 0; border-bottom: 1px solid var(--border); font-size: 12px; }
    .meta-row:last-child { border-bottom: none; }
    .meta-l { color: var(--text2); font-weight: 500; }
    .meta-v { color: var(--text); font-weight: 700; text-align: right; max-width: 65%; word-break: break-all; }

    .dl-btn {
      display: flex; align-items: center; justify-content: center; gap: 10px;
      background: var(--text); color: #fff; border: none;
      border-radius: var(--radius); padding: 13px 16px;
      font-family: 'Barlow Condensed', sans-serif; font-size: 16px; font-weight: 800; letter-spacing: 1px;
      cursor: pointer; width: 100%; text-transform: uppercase;
      transition: opacity var(--trans);
    }
    .dl-btn:active { opacity: 0.8; }
    .dl-btn svg { width: 18px; height: 18px; stroke-width: 2.2; }

    /* ══════════════════════════════════════════
       SNACKBAR
    ══════════════════════════════════════════ */
    #snack {
      position: fixed; bottom: 82px; left: 50%;
      transform: translateX(-50%) translateY(16px);
      background: rgba(20,20,20,0.92); color: #fff;
      padding: 9px 18px; border-radius: 100px;
      font-size: 13px; font-weight: 600;
      opacity: 0; transition: opacity 0.18s, transform 0.18s;
      z-index: 9999; white-space: nowrap; pointer-events: none;
      backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
    }
    #snack.show { opacity: 1; transform: translateX(-50%) translateY(0); }

    /* Header icon button */
    .header-btn {
      width: 34px; height: 34px; border-radius: 50%;
      border: 1.5px solid var(--border);
      background: var(--surface); color: var(--text2);
      display: flex; align-items: center; justify-content: center;
      cursor: pointer; flex-shrink: 0;
      transition: background var(--trans), color var(--trans), border-color var(--trans);
    }
    .header-btn:active { background: var(--surface2); color: var(--danger); border-color: var(--danger); }
    .header-btn svg { width: 15px; height: 15px; stroke-width: 2.2; }

    /* Reset confirm modal */
    #reset-modal, #import-modal {
      position: fixed; inset: 0; z-index: 400;
      display: flex; align-items: center; justify-content: center;
      padding: 24px;
      visibility: hidden; opacity: 0;
      transition: opacity 0.18s ease, visibility 0.18s;
    }
    #reset-modal.open, #import-modal.open { visibility: visible; opacity: 1; }
    .reset-backdrop { position: absolute; inset: 0; background: rgba(0,0,0,0.45); }
    .reset-card {
      position: relative; background: #fff; border-radius: 18px;
      padding: 24px 20px 20px; width: 100%; max-width: 320px;
      box-shadow: 0 12px 40px rgba(0,0,0,0.2);
      transform: scale(0.94);
      transition: transform 0.18s ease;
    }
    #reset-modal.open .reset-card, #import-modal.open .reset-card { transform: scale(1); }
    .reset-icon {
      width: 48px; height: 48px; border-radius: 50%;
      background: #FDECEA; display: flex; align-items: center; justify-content: center;
      margin: 0 auto 14px;
    }
    .reset-icon svg { width: 22px; height: 22px; stroke: var(--danger); stroke-width: 2.2; }
    .reset-title { font-family: 'Barlow Condensed', sans-serif; font-size: 20px; font-weight: 900; text-align: center; color: var(--text); margin-bottom: 6px; }
    .reset-msg { font-size: 13px; color: var(--text2); text-align: center; line-height: 1.5; margin-bottom: 20px; }
    .reset-btns { display: flex; gap: 10px; }
    .reset-btn {
      flex: 1; padding: 12px; border-radius: var(--radius-sm); border: none;
      font-family: 'Barlow Condensed', sans-serif; font-size: 16px; font-weight: 800;
      letter-spacing: 0.5px; cursor: pointer; transition: opacity var(--trans);
    }
    .reset-btn:active { opacity: 0.75; }
    .reset-btn.cancel { background: var(--surface); color: var(--text); }
    .reset-btn.confirm { background: var(--danger); color: #fff; }

    /* Video export progress */
    .exp-progress {
      background: var(--surface); border-radius: var(--radius-sm);
      padding: 20px 16px; display: flex; flex-direction: column; gap: 12px;
    }
    .exp-status {
      font-size: 14px; font-weight: 700; color: var(--text); text-align: center;
    }
    .exp-bar-wrap {
      height: 8px; background: var(--surface2); border-radius: 4px; overflow: hidden;
    }
    .exp-bar {
      height: 100%; background: var(--serve); border-radius: 4px;
      width: 0%; transition: width 0.35s ease;
    }
    .exp-meta-txt {
      font-size: 12px; color: var(--text3); text-align: center;
    }
    .exp-cancel {
      align-self: center; background: none;
      border: 1.5px solid var(--border); border-radius: var(--radius-sm);
      padding: 9px 24px;
      font-family: 'Barlow Condensed', sans-serif; font-size: 14px; font-weight: 800;
      letter-spacing: 0.5px; color: var(--text2); cursor: pointer; text-transform: uppercase;
      transition: background var(--trans);
    }
    .exp-cancel:active { background: var(--surface2); }
    .exp-note {
      font-size: 11px; font-weight: 600; text-align: center;
      padding: 7px 12px; border-radius: var(--radius-sm);
      border: 1px solid var(--border); color: var(--text2);
      background: var(--surface); transition: background 0.2s, color 0.2s, border-color 0.2s;
    }
    .exp-note.warn {
      background: #FFF8E1; border-color: #FFD54F; color: #795548;
    }
    .dl-btn-secondary {
      display: flex; align-items: center; justify-content: center; gap: 10px;
      background: var(--surface); color: var(--text);
      border: 1.5px solid var(--border); border-radius: var(--radius); padding: 10px 14px;
      font-family: 'Barlow Condensed', sans-serif; font-size: 14px; font-weight: 800;
      letter-spacing: 1px; cursor: pointer; width: 100%; text-transform: uppercase;
      transition: opacity var(--trans);
    }
    .dl-btn-secondary:active { opacity: 0.7; }
    .dl-btn-secondary svg { width: 16px; height: 16px; stroke-width: 2.2; }

    /* Engine selector */
    .engine-toggle {
      display: flex; background: var(--surface); border-radius: var(--radius-sm);
      border: 1.5px solid var(--border); padding: 3px; gap: 3px;
    }
    .eng-btn {
      flex: 1; padding: 7px; border-radius: 7px; border: none;
      font-family: 'Barlow Condensed', sans-serif; font-size: 12px; font-weight: 800;
      letter-spacing: 0.5px; cursor: pointer; text-transform: uppercase;
      background: transparent; color: var(--text2);
      transition: background var(--trans), color var(--trans), box-shadow var(--trans);
    }
    .eng-btn.active {
      background: #fff; color: var(--text);
      box-shadow: 0 1px 4px rgba(0,0,0,0.12);
    }
    .opt-row {
      display: flex; align-items: center; gap: 10px; cursor: pointer;
      padding: 7px 12px; border-radius: var(--radius-sm);
      border: 1.5px solid var(--border); background: var(--surface);
      transition: border-color var(--trans);
    }
    .opt-row:has(input:checked) { border-color: var(--serve); }
    .opt-row input[type=checkbox] {
      width: 17px; height: 17px; flex-shrink: 0;
      accent-color: var(--serve); cursor: pointer;
    }
    .opt-row-label { font-size: 13px; font-weight: 700; color: var(--text); flex: 1; }
    .opt-row-sub   { font-size: 12px; color: var(--text3); }

    .eng-label {
      font-size: 10px; color: var(--text3); text-align: center; font-weight: 600;
      letter-spacing: 0.3px; text-transform: uppercase; margin-bottom: -3px;
    }

    /* Scrollbar */
    .marks-scroll::-webkit-scrollbar, .panel-body::-webkit-scrollbar { width: 3px; }
    .marks-scroll::-webkit-scrollbar-thumb, .panel-body::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }
