:root {
      --bg: #0b1020;
      --panel: rgba(18, 26, 48, 0.92);
      --panel-2: rgba(25, 35, 64, 0.85);
      --text: #eef4ff;
      --muted: #93a4bd;
      --line: rgba(255, 255, 255, 0.12);
      --green: #39d98a;
      --green-soft: rgba(57, 217, 138, 0.17);
      --red: #ff5c7a;
      --red-soft: rgba(255, 92, 122, 0.17);
      --blue: #55a7ff;
      --blue-soft: rgba(85, 167, 255, 0.16);
      --yellow: #ffd166;
      --chart-bg: #070b12;
      --chart-axis: rgba(160,174,196,.16);
      --chart-grid: rgba(160,174,196,.15);
      --chart-tick: rgba(171,184,205,.48);
      --chart-legend: rgba(238,244,255,.62);
      --chart-progress: rgba(238,244,255,.86);
      --chart-progress-soft: rgba(238,244,255,.18);
      --tooltip-bg: rgba(10, 14, 22, 0.96);
      --tooltip-border: rgba(255,255,255,.14);
      --shadow: 0 22px 60px rgba(0,0,0,.28);
      --radius: 18px;
    }

    html[data-theme="white"] {
      --bg: #f4f7fb;
      --panel: rgba(255, 255, 255, 0.96);
      --panel-2: rgba(247, 250, 255, 0.94);
      --text: #101827;
      --muted: #5c6b80;
      --line: rgba(20, 31, 48, 0.14);
      --green: #12884e;
      --green-soft: rgba(18, 136, 78, 0.12);
      --red: #c9354f;
      --red-soft: rgba(201, 53, 79, 0.12);
      --blue: #1e6fd9;
      --blue-soft: rgba(30, 111, 217, 0.12);
      --yellow: #9f6a00;
      --chart-bg: #f8fafc;
      --chart-axis: rgba(15, 23, 42, 0.16);
      --chart-grid: rgba(15, 23, 42, 0.11);
      --chart-tick: rgba(15, 23, 42, 0.52);
      --chart-legend: rgba(15, 23, 42, 0.72);
      --chart-progress: rgba(15, 23, 42, 0.86);
      --chart-progress-soft: rgba(15, 23, 42, 0.12);
      --tooltip-bg: rgba(255, 255, 255, 0.98);
      --tooltip-border: rgba(15, 23, 42, 0.16);
      --shadow: 0 18px 48px rgba(15, 23, 42, 0.12);
    }

    html[data-theme="black"] {
      --bg: #000000;
      --panel: rgba(5, 5, 5, 0.98);
      --panel-2: rgba(12, 12, 12, 0.94);
      --text: #f8fafc;
      --muted: #a3adbd;
      --line: rgba(255, 255, 255, 0.13);
      --chart-bg: #000000;
      --chart-axis: rgba(255,255,255,.18);
      --chart-grid: rgba(255,255,255,.11);
      --chart-tick: rgba(226,232,240,.50);
      --chart-legend: rgba(226,232,240,.70);
      --chart-progress: rgba(248,250,252,.92);
      --chart-progress-soft: rgba(248,250,252,.18);
      --tooltip-bg: rgba(0, 0, 0, 0.98);
      --tooltip-border: rgba(255,255,255,.18);
      --shadow: 0 22px 70px rgba(0,0,0,.72);
    }

    * { box-sizing: border-box; }

    html {
      scrollbar-width: auto;
      scrollbar-color: rgba(85,167,255,.86) rgba(4,18,36,.96);
    }

    *::-webkit-scrollbar {
      width: 20px;
      height: 18px;
    }

    html::-webkit-scrollbar,
    body::-webkit-scrollbar {
      width: 30px;
      height: 20px;
    }

    *::-webkit-scrollbar-track {
      background: linear-gradient(180deg, rgba(4,18,36,.98), rgba(7,28,55,.94));
      border-radius: 999px;
      box-shadow: inset 0 0 0 1px rgba(85,167,255,.12);
    }

    *::-webkit-scrollbar-thumb {
      background: linear-gradient(180deg, rgba(85,167,255,.9), rgba(38,99,175,.88));
      border: 5px solid rgba(4,18,36,.98);
      border-radius: 999px;
      box-shadow: inset 0 0 0 1px rgba(210,235,255,.22), 0 0 16px rgba(85,167,255,.24);
    }

    *::-webkit-scrollbar-thumb:hover {
      background: linear-gradient(180deg, rgba(130,205,255,.98), rgba(64,127,215,.94));
    }

    *::-webkit-scrollbar-corner { background: transparent; }

    html[data-theme="black"] {
      scrollbar-color: rgba(85,91,102,.92) rgba(2,2,3,.98);
    }

    html[data-theme="black"] *::-webkit-scrollbar-track {
      background: linear-gradient(180deg, rgba(2,2,3,.98), rgba(10,10,12,.96));
      box-shadow: inset 0 0 0 1px rgba(255,255,255,.08);
    }

    html[data-theme="black"] *::-webkit-scrollbar-thumb {
      border-color: rgba(2,2,3,.98);
      background: linear-gradient(180deg, rgba(95,101,112,.96), rgba(45,49,58,.94));
      box-shadow: inset 0 0 0 1px rgba(255,255,255,.16), 0 0 12px rgba(0,0,0,.45);
    }

    html[data-theme="black"] *::-webkit-scrollbar-thumb:hover {
      background: linear-gradient(180deg, rgba(120,126,138,.98), rgba(62,67,78,.96));
    }

    html[data-theme="white"] {
      scrollbar-color: rgba(30,111,217,.7) rgba(15,23,42,.08);
    }

    html[data-theme="white"] *::-webkit-scrollbar-track {
      background: linear-gradient(180deg, rgba(15,23,42,.08), rgba(15,23,42,.035));
    }

    html[data-theme="white"] *::-webkit-scrollbar-thumb {
      border-color: rgba(246,249,253,.96);
      background: linear-gradient(180deg, rgba(30,111,217,.78), rgba(18,136,78,.56));
      box-shadow: inset 0 0 0 1px rgba(255,255,255,.55), 0 0 12px rgba(30,111,217,.16);
    }


    body {
      margin: 0;
      min-height: 100vh;
      color: var(--text);
      font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
      background:
        radial-gradient(circle at top left, rgba(85, 167, 255, .22), transparent 34rem),
        radial-gradient(circle at top right, rgba(255, 92, 122, .16), transparent 35rem),
        linear-gradient(135deg, #070b16 0%, #0b1020 50%, #10182e 100%);
    }

    html[data-theme="white"] body {
      background:
        radial-gradient(circle at top left, rgba(30, 111, 217, .12), transparent 34rem),
        radial-gradient(circle at top right, rgba(18, 136, 78, .10), transparent 34rem),
        linear-gradient(135deg, #eef3fb 0%, #f8fafc 52%, #edf2f7 100%);
    }

    html[data-theme="black"] body {
      background:
        radial-gradient(circle at top left, rgba(85, 167, 255, .10), transparent 30rem),
        radial-gradient(circle at top right, rgba(255, 92, 122, .08), transparent 34rem),
        #000;
    }

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

    .app {
      width: min(1440px, calc(100% - 32px));
      margin: 0 auto;
      padding: 28px 0 44px;
    }

    .hero {
      display: flex;
      justify-content: center;
      align-items: center;
      margin-bottom: 22px;
      text-align: center;
    }

    .title-wrap { width: 100%; }

    .title-wrap h1 {
      margin: 0;
      font-size: clamp(30px, 4.4vw, 52px);
      letter-spacing: -0.04em;
      line-height: 1.02;
    }


    .tracker-switch {
      margin: -4px 0 18px;
      padding: 12px;
      border: 1px solid var(--line);
      border-radius: 18px;
      background: rgba(255,255,255,.04);
      box-shadow: 0 14px 35px rgba(0,0,0,.14);
    }

    .tracker-row, .tracker-subtabs {
      display: flex;
      gap: 8px;
      align-items: center;
      justify-content: center;
      flex-wrap: wrap;
    }

    .tracker-subtabs {
      margin-top: 10px;
      padding-top: 10px;
      border-top: 1px solid rgba(255,255,255,.08);
    }

    .tracker-subtabs.hidden { display: none; }

    .tracker-tab, .tracker-subtab {
      min-width: 130px;
      border: 1px solid var(--line);
      color: var(--muted);
      background: rgba(255,255,255,.055);
      border-radius: 999px;
      padding: 10px 14px;
      cursor: pointer;
      font-weight: 950;
      transition: transform .15s ease, background .15s ease, border-color .15s ease, color .15s ease;
    }

    .tracker-subtab { min-width: 86px; padding: 8px 13px; }

    .tracker-tab:hover, .tracker-subtab:hover {
      transform: translateY(-1px);
      background: rgba(255,255,255,.09);
      border-color: rgba(255,255,255,.22);
    }

    .tracker-tab.active, .tracker-subtab.active {
      color: #eaf3ff;
      border-color: rgba(85,167,255,.56);
      background: rgba(85,167,255,.19);
      box-shadow: inset 0 0 0 1px rgba(85,167,255,.10);
    }

    .tracker-context-label {
      margin: 10px 0 0;
      text-align: center;
    }


    .tracker-actions {
      margin-top: 12px;
      display: flex;
      align-items: center;
      justify-content: center;
      gap: 10px;
      flex-wrap: wrap;
    }

    .tactics-summary {
      color: var(--muted);
      font-size: 12px;
      font-weight: 800;
    }

    .theme-picker {
      display: inline-flex;
      align-items: center;
      gap: 8px;
      padding: 7px 9px;
      border: 1px solid var(--line);
      border-radius: 999px;
      background: rgba(255,255,255,.045);
      color: var(--muted);
      font-size: 12px;
      font-weight: 900;
    }

    .theme-picker select {
      width: auto;
      min-width: 132px;
      padding: 7px 30px 7px 10px;
      border-radius: 999px;
      font-size: 12px;
      font-weight: 900;
    }

    .top-theme-corner {
      position: absolute !important;
      top: 16px !important;
      right: 16px !important;
      z-index: 1200;
      transform: none !important;
      display: flex;
      justify-content: flex-end;
      align-items: center;
      gap: 8px;
      flex-wrap: wrap;
      pointer-events: none;
    }

    .top-theme-corner .theme-picker {
      pointer-events: auto;
      box-shadow: 0 14px 32px rgba(0,0,0,.22);
      backdrop-filter: blur(14px);
    }

    @media (max-width: 760px) {
      .top-theme-corner {
        top: 8px;
        right: 8px;
        gap: 6px;
      }
      .top-theme-corner .theme-picker {
        padding: 6px 7px;
        gap: 6px;
        font-size: 11px;
      }
      .top-theme-corner .theme-picker select {
        min-width: 104px;
        padding: 6px 26px 6px 8px;
        font-size: 11px;
      }
    }

    body > .top-theme-corner { position: absolute !important; top: 16px !important; right: 16px !important; left: auto !important; bottom: auto !important; }

    .duo-sync-box {
      border: 1px solid rgba(85,167,255,.24);
      border-radius: 16px;
      padding: 13px;
      background: rgba(85,167,255,.07);
    }

    .duo-sync-box.hidden { display: none; }

    .duo-sync-grid {
      display: grid;
      grid-template-columns: 1.2fr 1fr;
      gap: 12px;
      margin-top: 10px;
    }

    .duo-sync-grid .field { margin: 0; }

    @media (max-width: 720px) {
      .duo-sync-grid { grid-template-columns: 1fr; }
    }

    .modal-backdrop {
      position: fixed;
      inset: 0;
      z-index: 50;
      display: flex;
      align-items: center;
      justify-content: center;
      padding: 18px;
      background: rgba(3, 7, 18, .74);
      backdrop-filter: blur(10px);
    }

    .modal-backdrop.hidden { display: none; }

    .modal-panel {
      width: min(1180px, 100%);
      max-height: min(88vh, 920px);
      overflow: hidden;
      display: flex;
      flex-direction: column;
      border: 1px solid rgba(255,255,255,.16);
      border-radius: 22px;
      background: linear-gradient(180deg, rgba(18, 26, 48, .98), rgba(11, 16, 32, .98));
      box-shadow: 0 28px 90px rgba(0,0,0,.48);
    }

    .modal-header {
      padding: 18px;
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 12px;
      border-bottom: 1px solid var(--line);
    }

    .modal-title h2 {
      margin: 0;
      font-size: 22px;
      letter-spacing: -.02em;
    }

    .modal-body {
      overflow: auto;
      padding: 18px;
    }

    .tactics-layout {
      display: grid;
      grid-template-columns: minmax(280px, 360px) 1fr;
      gap: 16px;
      align-items: start;
    }

    .tactic-form-card, .tactics-column {
      border: 1px solid var(--line);
      border-radius: 18px;
      background: rgba(255,255,255,.045);
      padding: 14px;
    }

    .tactic-form-card h3, .tactics-column h3 {
      margin: 0 0 12px;
      font-size: 14px;
      text-transform: uppercase;
      letter-spacing: .06em;
      color: rgba(238,244,255,.86);
    }

    .tactics-board {
      display: grid;
      grid-template-columns: repeat(3, minmax(0, 1fr));
      gap: 12px;
    }

    .tactics-column {
      min-height: 240px;
    }

    .tactics-column.mastered { box-shadow: inset 0 2px 0 rgba(57,217,138,.72); }
    .tactics-column.work { box-shadow: inset 0 2px 0 rgba(255,209,102,.82); }
    .tactics-column.problem { box-shadow: inset 0 2px 0 rgba(255,92,122,.78); }

    .tactics-list {
      display: grid;
      gap: 10px;
    }

    .tactic-card {
      border: 1px solid rgba(255,255,255,.12);
      border-radius: 14px;
      padding: 12px;
      background: rgba(8,12,24,.48);
    }

    .tactic-card h4 {
      margin: 0 0 8px;
      font-size: 15px;
      line-height: 1.25;
      color: var(--text);
      word-break: break-word;
    }

    .tactic-card p {
      margin: 0;
      color: rgba(238,244,255,.78);
      white-space: pre-wrap;
      line-height: 1.45;
      word-break: break-word;
    }

    .tactic-card-actions {
      display: flex;
      gap: 8px;
      flex-wrap: wrap;
      margin-top: 12px;
    }

    .tactic-card-actions .btn {
      padding: 7px 9px;
      border-radius: 10px;
      font-size: 12px;
      font-weight: 850;
    }

    .tactic-status-select {
      display: grid;
      grid-template-columns: repeat(3, 1fr);
      gap: 8px;
      margin-top: 8px;
    }

    .tactic-status-btn {
      border: 1px solid var(--line);
      border-radius: 12px;
      padding: 9px 8px;
      background: rgba(255,255,255,.055);
      color: var(--muted);
      cursor: pointer;
      font-size: 12px;
      font-weight: 900;
    }

    .tactic-status-btn.active {
      border-color: rgba(85,167,255,.58);
      color: #eaf3ff;
      background: rgba(85,167,255,.18);
    }

    .tactic-empty {
      border: 1px dashed rgba(255,255,255,.14);
      border-radius: 12px;
      padding: 12px;
      color: var(--muted);
      font-size: 13px;
      line-height: 1.35;
    }

    .grid {
      display: grid;
      grid-template-columns: 410px 1fr;
      gap: 18px;
      align-items: start;
    }

    .panel {
      background: var(--panel);
      border: 1px solid var(--line);
      border-radius: var(--radius);
      box-shadow: var(--shadow);
      backdrop-filter: blur(18px);
      overflow: hidden;
    }

    .panel-header {
      padding: 18px 18px 12px;
      border-bottom: 1px solid var(--line);
      display: flex;
      justify-content: space-between;
      gap: 14px;
      align-items: center;
      flex-wrap: wrap;
    }

    .panel-header h2 {
      margin: 0;
      font-size: 16px;
      letter-spacing: -.01em;
    }

    .panel-body { padding: 18px; }

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

    .row.between { justify-content: space-between; }

    .icon-btn, .btn {
      border: 1px solid var(--line);
      color: var(--text);
      background: rgba(255,255,255,.07);
      border-radius: 12px;
      padding: 10px 12px;
      cursor: pointer;
      transition: transform .15s ease, background .15s ease, border-color .15s ease, opacity .15s ease;
    }

    .icon-btn:hover, .btn:hover {
      transform: translateY(-1px);
      background: rgba(255,255,255,.1);
      border-color: rgba(255,255,255,.2);
    }

    .icon-btn:disabled, .btn:disabled {
      opacity: .45;
      cursor: not-allowed;
      transform: none;
    }

    .btn.primary {
      background: linear-gradient(135deg, #2989ff, #55a7ff);
      border: 0;
      color: #061225;
      font-weight: 900;
    }

    .btn.win {
      background: linear-gradient(135deg, rgba(57,217,138,.95), rgba(85,255,178,.82));
      border: 0;
      color: #04160d;
      font-weight: 950;
      min-width: 120px;
    }

    .btn.loss {
      background: linear-gradient(135deg, rgba(255,92,122,.95), rgba(255,128,151,.82));
      border: 0;
      color: #25030a;
      font-weight: 950;
      min-width: 120px;
    }

    .btn.danger { color: #ffdce4; border-color: rgba(255,92,122,.36); background: rgba(255,92,122,.12); }
    .btn.ghost { color: var(--muted); }
    .btn.toggle.active {
      color: #eaf3ff;
      border-color: rgba(85,167,255,.54);
      background: rgba(85,167,255,.18);
      box-shadow: inset 0 0 0 1px rgba(85,167,255,.08);
    }
    .btn.full { width: 100%; }

    .calendar-controls {
      display: flex;
      gap: 10px;
      align-items: center;
      justify-content: space-between;
      margin-top: 14px;
    }

    .month-title {
      text-align: center;
      text-transform: capitalize;
      font-weight: 900;
      letter-spacing: -.02em;
      min-width: 160px;
    }

    .season-card {
      display: grid;
      grid-template-columns: 1fr 1fr;
      gap: 12px;
      margin-bottom: 10px;
    }

    .season-range {
      grid-column: 1 / -1;
      padding: 12px 13px;
      border: 1px solid var(--line);
      border-radius: 14px;
      background: rgba(255,255,255,.04);
      color: var(--muted);
      font-size: 13px;
      line-height: 1.35;
    }

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

    .season-edit-toggle { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-top: 8px; }
    .season-editor { grid-column: 1 / -1; display: none; margin-top: 2px; padding: 12px; border: 1px solid var(--border); border-radius: 16px; background: rgba(6, 12, 26, .28); }
    .season-editor.active { display: block; }
    .season-editor-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
    .season-editor-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
    html[data-theme="white"] .season-editor { background: rgba(255,255,255,.74); }
    html[data-theme="black"] .season-editor { background: rgba(2,6,23,.78); }

    .calendar {
      display: grid;
      grid-template-columns: repeat(7, 1fr);
      gap: 8px;
      margin-top: 16px;
    }

    .weekday {
      color: var(--muted);
      font-size: 12px;
      text-align: center;
      padding: 4px 0;
      font-weight: 800;
    }

    .day {
      position: relative;
      min-height: 68px;
      border: 1px solid var(--line);
      border-radius: 15px;
      background: rgba(255,255,255,.043);
      color: var(--text);
      cursor: pointer;
      display: grid;
      grid-template-rows: auto 1fr auto;
      gap: 5px;
      padding: 7px;
      transition: transform .15s ease, border-color .15s ease, background .15s ease;
      overflow: hidden;
      text-align: left;
    }

    .day:hover { transform: translateY(-1px); border-color: rgba(255,255,255,.22); }
    .day.muted { opacity: .28; cursor: default; pointer-events: none; }
    .day.out-season { opacity: .18; cursor: default; pointer-events: none; }
    .day.selected { outline: 2px solid var(--blue); border-color: transparent; }
    .day.today .day-number { background: rgba(85,167,255,.21); color: #dcecff; }
    .day.played.gain { background: linear-gradient(145deg, rgba(57,217,138,.24), rgba(255,255,255,.035)); border-color: rgba(57,217,138,.42); }
    .day.played.loss { background: linear-gradient(145deg, rgba(255,92,122,.24), rgba(255,255,255,.035)); border-color: rgba(255,92,122,.42); }
    .day.played.flat { background: linear-gradient(145deg, rgba(255,209,102,.18), rgba(255,255,255,.035)); border-color: rgba(255,209,102,.34); }
    .day.not-played {
      background:
        repeating-linear-gradient(135deg, rgba(255,255,255,.055) 0 7px, rgba(255,255,255,.018) 7px 14px),
        rgba(255,255,255,.026);
      border-color: rgba(147,164,189,.30);
      border-style: dashed;
    }
    .day.not-played .day-number {
      color: rgba(238,244,255,.82);
      background: rgba(147,164,189,.13);
    }

    .day-number {
      display: inline-flex;
      align-items: center;
      justify-content: center;
      justify-self: start;
      min-width: 22px;
      height: 22px;
      padding: 0 5px;
      border-radius: 8px;
      font-weight: 950;
      line-height: 1;
      z-index: 1;
      font-size: 12px;
    }

    .day-change {
      align-self: end;
      display: flex;
      flex-direction: column;
      justify-content: center;
      align-items: center;
      width: 100%;
      min-height: 28px;
      padding: 3px 5px;
      border-radius: 9px;
      background: rgba(3, 8, 18, .36);
      color: rgba(238,244,255,.94);
      font-size: 10px;
      font-weight: 950;
      line-height: 1.02;
      white-space: normal;
      overflow: hidden;
      text-align: center;
      z-index: 1;
      letter-spacing: -.01em;
      box-shadow: inset 0 0 0 1px rgba(255,255,255,.07);
    }

    .day-change .wl-line {
      margin-top: 2px;
      color: rgba(238,244,255,.76);
      font-size: 8px;
      letter-spacing: .02em;
      line-height: 1;
    }

    .day-change.off {
      color: rgba(238,244,255,.84);
      background: rgba(147,164,189,.14);
      border: 1px solid rgba(147,164,189,.24);
      box-shadow: none;
      font-size: 8px;
      text-transform: uppercase;
      letter-spacing: .06em;
    }

    .day.not-played .day-change.off {
      color: #d7e0ef;
      background: rgba(6, 12, 25, .56);
      border: 1px solid rgba(238,244,255,.16);
      font-size: 7px;
      letter-spacing: .055em;
      line-height: 1.03;
      white-space: normal;
      min-height: 27px;
      padding: 4px 2px 3px;
      display: flex;
      flex-direction: column;
      justify-content: center;
      gap: 1px;
    }

    .day.not-played .day-change.off span { display: block; }

    .form-grid {
      display: grid;
      grid-template-columns: 1fr 1fr;
      gap: 14px;
    }

    .field.full { grid-column: 1 / -1; }

    label {
      display: block;
      margin-bottom: 7px;
      color: var(--muted);
      font-size: 13px;
      font-weight: 800;
    }

    input[type="date"], input[type="number"], input[type="text"], input[type="url"], input[type="file"], textarea, select {
      width: 100%;
      border: 1px solid var(--line);
      border-radius: 13px;
      background: rgba(255,255,255,.06);
      color: var(--text);
      padding: 12px 12px;
      outline: none;
    }

    select option { color: #061225; }
    input:focus, textarea:focus, select:focus { border-color: rgba(85,167,255,.75); box-shadow: 0 0 0 4px rgba(85,167,255,.13); }
    textarea { min-height: 96px; resize: vertical; line-height: 1.45; overflow: hidden; }
    input::placeholder, textarea::placeholder { color: rgba(147,164,189,.72); }
    input[readonly] { color: #dbe9ff; background: rgba(255,255,255,.04); }

    .mode-tabs, .status-toggle {
      display: grid;
      grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
      gap: 8px;
      padding: 6px;
      border: 1px solid var(--line);
      background: rgba(255,255,255,.045);
      border-radius: 16px;
      margin-bottom: 16px;
    }

    .mode-tabs.hidden { display: none !important; }

    .mode-tab, .status-option {
      border: 1px solid transparent;
      border-radius: 12px;
      padding: 11px 12px;
      color: var(--muted);
      background: transparent;
      cursor: pointer;
      font-weight: 900;
      transition: background .15s ease, border-color .15s ease, color .15s ease, transform .15s ease;
    }

    .mode-tab:hover, .status-option:hover { transform: translateY(-1px); background: rgba(255,255,255,.06); }
    .mode-tab.active, .status-option.active {
      color: var(--text);
      border-color: rgba(85,167,255,.45);
      background: rgba(85,167,255,.16);
      box-shadow: inset 0 0 0 1px rgba(85,167,255,.12);
    }

    .view { display: none; }
    .view.active { display: block; }

    .mmr-preview, .session-card {
      padding: 13px 14px;
      border: 1px solid var(--line);
      border-radius: 14px;
      background: rgba(255,255,255,.045);
      color: var(--muted);
      line-height: 1.45;
    }

    .mmr-preview strong, .session-card strong { color: var(--text); }
    .green { color: var(--green) !important; }
    .red { color: var(--red) !important; }
    .yellow { color: var(--yellow) !important; }
    .blue { color: var(--blue) !important; }

    .session-score {
      display: grid;
      grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
      gap: 10px;
      margin: 14px 0;
    }

    .session-score div {
      padding: 13px;
      border: 1px solid var(--line);
      border-radius: 14px;
      background: rgba(255,255,255,.045);
    }

    .session-score span {
      display: block;
      color: var(--muted);
      font-size: 11px;
      font-weight: 900;
      text-transform: uppercase;
      letter-spacing: .05em;
    }

    .session-score strong {
      display: block;
      margin-top: 6px;
      font-size: 24px;
      letter-spacing: -.04em;
    }



    .match-section {
      margin-top: 14px;
      padding: 14px;
      border: 1px solid var(--line);
      border-radius: 16px;
      background: rgba(255,255,255,.035);
    }

    .match-section-header {
      display: flex;
      justify-content: space-between;
      align-items: center;
      gap: 10px;
      flex-wrap: wrap;
      margin-bottom: 10px;
    }

    .match-section-header h3 {
      margin: 0;
      font-size: 14px;
      letter-spacing: -.01em;
    }

    .match-list {
      display: grid;
      gap: 10px;
    }

    .match-list.collapsed { display: none; }
    .match-header-actions button[id$="MatchesToggleBtn"] {
      border-style: dashed;
      background: rgba(85,167,255,.08);
    }


    .match-header-actions {
      display: flex;
      align-items: center;
      justify-content: flex-end;
      gap: 8px;
      flex-wrap: wrap;
    }

    .match-card {
      border: 1px solid rgba(255,255,255,.1);
      border-radius: 15px;
      padding: 12px;
      background: rgba(6,12,25,.42);
    }

    .match-card-header {
      display: flex;
      justify-content: space-between;
      align-items: center;
      gap: 8px;
      margin-bottom: 10px;
    }

    .match-card-title {
      display: flex;
      align-items: center;
      gap: 8px;
      font-size: 13px;
      font-weight: 900;
    }

    .match-result-badge {
      display: inline-flex;
      align-items: center;
      justify-content: center;
      min-width: 30px;
      height: 24px;
      border-radius: 8px;
      font-size: 12px;
      font-weight: 950;
    }

    .match-result-badge.win { background: rgba(55,199,89,.18); color: var(--green); border: 1px solid rgba(55,199,89,.28); }
    .match-result-badge.loss { background: rgba(255,76,76,.18); color: var(--red); border: 1px solid rgba(255,76,76,.28); }
    .match-result-badge.neutral { background: rgba(244,194,75,.14); color: var(--yellow); border: 1px solid rgba(244,194,75,.24); }

    .match-grid {
      display: grid;
      grid-template-columns: 120px 1fr 1fr;
      gap: 10px;
    }

    .match-grid .field { min-width: 0; }
    .match-grid .field.full { grid-column: 1 / -1; }
    .match-grid .match-link-replay { grid-column: 2; }
    .match-grid .match-link-screenshot { grid-column: 3; }
    .match-note-media-row { grid-column: 1 / -1; display: grid; grid-template-columns: 1.4fr 1fr 1fr; gap: 10px; align-items: start; }
    .match-note-media-row textarea { min-height: 76px; resize: vertical; }
    .match-note-field textarea { min-height: 92px; }
    .file-status { color: var(--muted); font-size: 11px; line-height: 1.35; margin-top: 5px; word-break: break-word; }
    .file-status a { color: var(--blue); }
    .file-status.warn { color: var(--yellow); }
    .file-limit-note { margin: 6px 0 0; color: var(--muted); font-size: 10.5px; line-height: 1.35; }
    .file-limit-note strong { color: var(--yellow); }
    .match-empty { color: var(--muted); font-size: 12px; line-height: 1.45; padding: 8px 0; }
    .replay-import-box { border:1px solid var(--line); border-radius:18px; background: rgba(255,255,255,.035); padding:14px; margin-bottom:14px; }
    .replay-import-grid { display:grid; grid-template-columns: 1.4fr .9fr; gap:12px; align-items:start; }
    .replay-import-actions { display:flex; flex-wrap:wrap; gap:8px; align-items:center; margin-top:10px; }
    .replay-import-status { margin-top:10px; color: var(--muted); font-size:12px; line-height:1.45; white-space:pre-line; }
    .replay-folder-box { border:1px dashed var(--line); border-radius:14px; padding:10px; background:rgba(255,255,255,.025); margin-top:10px; }
    .replay-folder-status { margin-top:8px; color: var(--muted); font-size:12px; line-height:1.45; white-space:pre-line; }
    .replay-folder-status.good { color: var(--good); }
    .replay-folder-status.warn { color: var(--warn); }
    .replay-analysis-list { display:grid; gap:8px; margin-top:10px; }
    .replay-analysis-card { border:1px solid var(--line); border-radius:14px; background:rgba(0,0,0,.12); padding:10px; font-size:12px; line-height:1.45; }
    .replay-analysis-card.skipped { border-color: rgba(255, 190, 80, .32); background: rgba(255, 190, 80, .07); }
    .replay-analysis-card.error { border-color: rgba(255, 95, 95, .42); background: rgba(255, 95, 95, .08); }
    .replay-analysis-card.saved { border-color: rgba(72, 210, 130, .30); }
    .replay-analysis-card strong { color: var(--text); }
    .replay-file-title { display:block; max-width:100%; overflow-wrap:anywhere; word-break:break-word; line-height:1.35; }
    .replay-stats-box { grid-column: 1 / -1; border:1px solid var(--line); border-radius:14px; background:rgba(85,167,255,.055); padding:10px; color: var(--muted); font-size:12px; line-height:1.45; }
    .replay-stats-title { display:flex; flex-wrap:wrap; gap:8px; align-items:center; color:var(--text); font-weight:900; margin-bottom:6px; }
    .replay-stats-grid { display:grid; grid-template-columns: repeat(4, minmax(90px, 1fr)); gap:7px; }
    .replay-stat-pill { border:1px solid var(--line); border-radius:12px; padding:7px 8px; background:rgba(255,255,255,.035); }
    .replay-stat-pill span { display:block; color:var(--muted); font-size:10px; font-weight:800; text-transform:uppercase; letter-spacing:.03em; }
    .replay-stat-pill b { display:block; color:var(--text); font-size:13px; margin-top:2px; overflow-wrap:anywhere; word-break:break-word; }

    .replay-possession-strip { margin: 12px 0 10px; padding: 0 2px; }
    .replay-possession-head { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 12px; margin-bottom: 8px; font-size: 12px; font-weight: 900; letter-spacing: .02em; }
    .replay-possession-title { color: var(--muted); text-align: center; text-transform: uppercase; letter-spacing: .12em; font-size: 11px; font-weight: 900; }
    .replay-possession-pct.blue { color: #6daaff; text-align: left; }
    .replay-possession-pct.orange { color: #ff9b3d; text-align: right; }
    .replay-possession-track { width: 100%; height: 12px; border-radius: 999px; overflow: hidden; display: flex; background: rgba(255,255,255,.08); box-shadow: inset 0 0 0 1px rgba(255,255,255,.07); }
    .replay-possession-fill { display: block; min-width: 0; height: 100%; }
    .replay-possession-fill.blue { background: #4d8fff; border-radius: 999px 0 0 999px; }
    .replay-possession-fill.orange { background: #ff892e; border-radius: 0 999px 999px 0; }
    .replay-advanced-details { margin-top:8px; border:1px solid var(--line); border-radius:12px; padding:8px; background:rgba(255,255,255,.025); }
    .replay-advanced-details summary { cursor:pointer; color:var(--text); font-weight:900; list-style:none; }
    .replay-advanced-details summary::-webkit-details-marker { display:none; }
    .replay-advanced-details summary::before { content:'▶'; display:inline-block; margin-right:6px; transition:transform .15s ease; }
    .replay-advanced-details[open] summary::before { transform:rotate(90deg); }
    .replay-player-lines { margin-top:7px; white-space:pre-line; color: var(--muted); }
    .replay-player-lines-advanced { white-space:normal; }
    .replay-advanced-player { border-top:1px solid rgba(255,255,255,.08); padding-top:8px; margin-top:8px; }
    .replay-advanced-player:first-child { border-top:0; padding-top:0; }
    .replay-advanced-grid { display:grid; grid-template-columns:repeat(2, minmax(0,1fr)); gap:6px; margin-top:6px; }
    .replay-advanced-grid span { display:block; border:1px solid rgba(255,255,255,.08); border-radius:10px; padding:6px 7px; background:rgba(0,0,0,.12); color:var(--muted); }
    .replay-advanced-grid b { color:var(--text); }
    .replay-scoreboard { margin-top:10px; border:1px solid var(--line); border-radius:12px; overflow:hidden; background:rgba(0,0,0,.16); }
    .replay-scoreboard-title { display:flex; justify-content:space-between; gap:8px; align-items:center; padding:8px 10px; font-size:11px; font-weight:900; color:var(--text); background:rgba(255,255,255,.035); border-bottom:1px solid var(--line); }
    .replay-scoreboard table { width:100%; border-collapse:collapse; font-size:11px; }
    .replay-scoreboard th, .replay-scoreboard td { padding:6px 8px; border-bottom:1px solid rgba(255,255,255,.07); text-align:right; white-space:nowrap; }
    .replay-scoreboard th:first-child, .replay-scoreboard td:first-child { text-align:left; min-width:120px; }
    .replay-scoreboard th { color:var(--muted); font-size:10px; text-transform:uppercase; letter-spacing:.03em; background:rgba(255,255,255,.025); }
    .replay-scoreboard tr:last-child td { border-bottom:0; }
    .replay-scoreboard .team-row td { color:var(--text); font-weight:900; background:rgba(85,167,255,.055); text-align:left; }
    .replay-scoreboard .orange-team td { background:rgba(255,160,64,.06); }
    .replay-scoreboard .player-us td:first-child { color:var(--blue); font-weight:900; }
    .replay-scoreboard .mvp-badge { display:inline-block; margin-left:5px; color:var(--yellow); font-weight:900; }
    .replay-scoreboard .table-scroll { overflow-x:auto; }
    .ballchasing-note { color: var(--muted); font-size: 11px; line-height: 1.45; margin: -2px 0 10px; }
    .stat-card.wide { grid-column: span 2; }
    @media (max-width: 700px) { .stat-card.wide { grid-column: auto; } }
    .alias-grid { display:grid; grid-template-columns: repeat(3, 1fr); gap:8px; }
    .alias-grid textarea { min-height:82px; font-size:12px; }
    @media (max-width: 900px) {
      .replay-import-grid, .alias-grid, .replay-stats-grid { grid-template-columns: 1fr; }
    }
    @media (max-width: 760px) { .replay-advanced-grid { grid-template-columns:1fr; } }

    .clip-links { display: flex; flex-direction: column; gap: 4px; min-width: 120px; }
    .clip-links a { color: var(--blue); font-weight: 800; text-decoration: none; }
    .clip-links a:hover { text-decoration: underline; }


    .comparison-table-wrap { overflow-x: auto; margin-top: 14px; }
    .comparison-table { min-width: 860px; }
    .comparison-table th, .comparison-table td { white-space: nowrap; }
    .compare-grid { display: grid; grid-template-columns: repeat(3, minmax(190px, 1fr)); gap: 12px; margin-top: 12px; }
    @media (max-width: 900px) { .compare-grid { grid-template-columns: 1fr; } }
    .compare-card { border: 1px solid var(--line); border-radius: 16px; padding: 14px; background: rgba(255,255,255,.04); }
    .compare-card span { display:block; color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: .06em; font-weight: 900; }
    .compare-card strong { display:block; margin-top: 6px; font-size: 22px; }
    .compare-view-tabs { display:flex; gap:8px; flex-wrap:wrap; margin: 0 0 14px; }
    .compare-view-btn { border:1px solid var(--line); background: rgba(255,255,255,.05); color: var(--text); border-radius:999px; padding:9px 13px; font-weight:900; cursor:pointer; }
    .compare-view-btn.active { border-color: rgba(85,167,255,.55); background: rgba(85,167,255,.18); color: var(--text); }

    .opponents-toolbar {
      display:grid;
      grid-template-columns: 1.15fr 1fr .8fr .65fr 1fr auto;
      gap: 10px;
      align-items: end;
      margin-bottom: 14px;
      padding: 12px;
      border: 1px solid var(--line);
      border-radius: 18px;
      background: rgba(255,255,255,.035);
    }
    .opponents-toolbar .field { margin: 0; }
    .opponents-summary { margin: 0 0 14px; }
    .opponents-section { border:1px solid var(--line); border-radius:18px; padding:14px; margin-top:14px; background:rgba(255,255,255,.035); }
    .opponents-section-title { display:flex; align-items:center; justify-content:space-between; gap:10px; margin-bottom:10px; }
    .opponents-section-title h3 { margin:0; font-size:16px; }
    .opponents-table-wrap { margin-top: 8px; }
    .opponents-table { min-width: 980px; }
    .opponents-table th, .opponents-table td { white-space: nowrap; }
    .opponents-table td:first-child { white-space: normal; min-width: 220px; }

    .opponents-section-collapsible { padding: 0; overflow: hidden; }
    .opponents-section-summary { cursor: pointer; list-style: none; margin: 0; padding: 14px; }
    .opponents-section-summary::-webkit-details-marker { display: none; }
    .opponents-section-arrow { width: 28px; height: 28px; border: 1px solid var(--line); border-radius: 999px; display: inline-flex; align-items: center; justify-content: center; color: var(--blue); background: rgba(85,167,255,.10); font-weight: 950; margin-left: auto; }
    .opponents-section-arrow::before { content: '⌃'; line-height: 1; transform: translateY(-1px); }
    .opponents-section-collapsible:not([open]) .opponents-section-arrow::before { content: '⌄'; transform: translateY(-2px); }
    .opponents-section-collapsible .opponents-table-wrap, .opponents-section-collapsible > .empty-state { margin: 0 14px 14px; }
    .compare-mode-tabs { margin-bottom: 10px; padding-bottom: 10px; border-bottom: 1px solid var(--line); }
    .compare-mode-btn { min-width: 76px; }

    @media (max-width: 1120px) { .opponents-toolbar { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
    @media (max-width: 720px) { .opponents-toolbar { grid-template-columns: 1fr; } }
    .compare-view.hidden { display:none; }
    .compare-chart-grid { display:grid; grid-template-columns: repeat(3, minmax(240px, 1fr)); gap: 14px; margin-top: 12px; }
    @media (max-width: 1100px) { .compare-chart-grid { grid-template-columns: 1fr; } }
    .compare-chart-card { border: 1px solid var(--line); border-radius: 18px; background: rgba(255,255,255,.035); padding: 14px; }
    .compare-chart-card h3 { margin:0 0 10px; font-size: 14px; }
    .compare-chart-card .mini { margin-top: 8px; }
    .mini-progress-chart { border: 1px solid var(--line); border-radius: 16px; background: rgba(0,0,0,.14); padding: 8px; overflow: hidden; }
    .mini-progress-chart svg { display:block; width:100%; height:auto; }
    .mini-progress-chart .empty-state { min-height: 126px; display:flex; align-items:center; justify-content:center; padding: 10px; }
    .rank-share-text { font-size: 14px !important; letter-spacing: 0 !important; line-height: 1.25; }
    .stat-card strong.small { font-size: clamp(16px, 1.45vw, 18px); letter-spacing: -.015em; line-height: 1.32; white-space: pre-line; }

    .compare-mode-block { margin-top: 16px; padding-top: 12px; border-top: 1px solid var(--line); }
    .compare-mode-block:first-child { margin-top: 0; padding-top: 0; border-top: 0; }
    .compare-mode-title { display:flex; align-items:center; justify-content:space-between; gap:10px; margin: 0 0 10px; }
    .compare-mode-title h3 { margin: 0; font-size: 15px; }
    .compare-leader { font-size: 11px; color: var(--muted); font-weight: 900; }
    .compare-score-badge { display:inline-flex; align-items:center; justify-content:center; min-width: 46px; padding: 4px 8px; border-radius: 999px; background: rgba(85,167,255,.14); color: var(--blue); border:1px solid rgba(85,167,255,.25); font-weight: 950; }
    .compare-winner { color: var(--green); font-weight: 950; }
    .modal-panel.compare-panel {
      width: min(1500px, 98vw);
      max-height: min(94vh, 1080px);
      border-radius: 26px;
      box-shadow: 0 34px 120px rgba(0,0,0,.58);
    }
    .modal-panel.compare-panel .modal-header {
      background: radial-gradient(circle at 18% 0%, rgba(85,167,255,.18), transparent 38%), rgba(255,255,255,.025);
    }
    .modal-panel.compare-panel .modal-body { padding: 20px; }
    .modal-panel.opponents-panel {
      width: min(1500px, 98vw);
      max-height: min(94vh, 1080px);
      border-radius: 26px;
      box-shadow: 0 34px 120px rgba(0,0,0,.58);
    }
    .modal-panel.opponents-panel .modal-body { padding: 20px; }

    .compare-intro {
      display:grid;
      grid-template-columns: 1.15fr .85fr;
      gap: 14px;
      align-items: stretch;
      margin: 12px 0 16px;
    }
    .compare-intro-card {
      border:1px solid var(--line);
      border-radius:22px;
      padding:16px;
      background: linear-gradient(135deg, rgba(85,167,255,.13), rgba(48,205,90,.055));
    }
    .compare-intro-card h3 { margin:0 0 8px; font-size:16px; }
    .compare-intro-card p { margin:0; color:var(--muted); line-height:1.45; }
    .compare-kpi-row { display:grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap:10px; }
    .compare-kpi {
      border:1px solid rgba(255,255,255,.11);
      border-radius:18px;
      padding:12px;
      background:rgba(0,0,0,.15);
    }
    .compare-kpi span { display:block; color:var(--muted); font-size:10px; text-transform:uppercase; letter-spacing:.06em; font-weight:900; }
    .compare-kpi b { display:block; margin-top:4px; font-size:17px; color:var(--text); }
    .compare-score-details, .compare-advanced-details {
      margin-top: 12px;
      border:1px solid var(--line);
      border-radius:16px;
      background:rgba(255,255,255,.025);
      padding:10px 12px;
    }
    .compare-score-details summary, .compare-advanced-details summary { cursor:pointer; font-weight:950; color:var(--text); list-style:none; }
    .compare-score-details summary::-webkit-details-marker, .compare-advanced-details summary::-webkit-details-marker { display:none; }
    .compare-score-details summary::before, .compare-advanced-details summary::before { content:'▶'; display:inline-block; margin-right:7px; transition:transform .15s ease; }
    .compare-score-details[open] summary::before, .compare-advanced-details[open] summary::before { transform:rotate(90deg); }
    .compare-advanced-table { min-width: 1200px; }
    .compare-formula-note { margin: 8px 0 0; color: var(--muted); font-size: 12px; line-height: 1.45; }
    .opponent-match-hint { color: var(--muted); font-size: 11px; margin-top: 3px; }
    @media (max-width: 980px) {
      .compare-intro { grid-template-columns: 1fr; }
      .compare-kpi-row { grid-template-columns: 1fr; }
    }
    .grouped-bars { display:grid; grid-template-columns: repeat(3, minmax(82px, 1fr)); gap: 10px; align-items:end; min-height: 180px; padding: 12px 8px 4px; border:1px solid var(--line); border-radius:16px; background: rgba(255,255,255,.025); }
    .grouped-bar-item { display:grid; grid-template-rows: 1fr auto auto; gap:7px; min-height: 164px; text-align:center; }
    .grouped-bar-track { height: 118px; display:flex; align-items:end; justify-content:center; border-bottom:1px solid var(--line); }
    .grouped-bar-fill { width: min(58px, 72%); min-height: 4px; border-radius: 8px 8px 2px 2px; background: linear-gradient(180deg, var(--blue), var(--green)); box-shadow: 0 10px 20px rgba(0,0,0,.18); }
    .grouped-bar-fill.negative { background: linear-gradient(180deg, var(--red), rgba(255,128,128,.72)); }
    .grouped-bar-label { font-weight: 950; font-size: 12px; }
    .grouped-bar-value { color: var(--muted); font-size: 11px; font-weight: 900; }
    .mini-bar-row { display:grid; grid-template-columns: 86px 1fr 76px; gap: 10px; align-items:center; margin: 9px 0; font-size: 12px; }
    .mini-bar-label { font-weight:900; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
    .mini-bar-track { height: 11px; border-radius: 999px; background: rgba(255,255,255,.08); border: 1px solid var(--line); overflow:hidden; }
    .mini-bar-fill { height: 100%; border-radius: 999px; background: linear-gradient(90deg, var(--blue), var(--green)); }
    .mini-bar-value { text-align:right; color: var(--muted); font-weight:900; }
    .mvp-tag, .match-flag-tag { display:inline-flex; align-items:center; justify-content:center; gap:4px; padding:3px 7px; border-radius:999px; border:1px solid var(--line); background: rgba(255,255,255,.06); font-size: 10px; font-weight:900; color: var(--muted); }
    .mvp-tag { color: var(--yellow); border-color: rgba(244,194,75,.25); background: rgba(244,194,75,.11); }
    .match-flags { display:flex; flex-wrap:wrap; gap:5px; margin-top: 7px; }

    .checkbox-inline { display: flex; align-items: center; gap: 8px; min-height: 28px; font-size: 12px; font-weight: 800; color: var(--text); }
    .checkbox-inline input { width: auto; min-height: auto; accent-color: var(--blue); }
    .match-grid.session-extra { grid-template-columns: 120px 1fr 1fr; }

    @media (max-width: 900px) {
      .match-grid { grid-template-columns: 1fr; }
      .match-grid .match-link-replay, .match-grid .match-link-screenshot { grid-column: auto; }
      .match-note-media-row { grid-template-columns: 1fr; }
    }

    @media (max-width: 760px) {
      body { padding: 10px; }
      .wrap, .container, main, .main-grid, .layout, .dashboard-grid { max-width: 100%; width: 100%; }
      .topbar, .header, .controls, .actions, .tabs, .tracker-tabs, .sync-actions { flex-wrap: wrap; gap: 8px; }
      .panel, .card, .modal-panel { border-radius: 14px; }
      .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
      .table-wrap, .calendar-wrap, .chart-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
      table { min-width: 760px; }
      input, select, textarea, button { font-size: 16px; }
      .match-card { padding: 10px; }
      .match-card-header { align-items: flex-start; flex-direction: column; }
      .match-card-header .btn { width: 100%; }
      .modal-panel { width: calc(100vw - 14px); max-height: calc(100vh - 14px); }
      .modal-body { max-height: calc(100vh - 80px); overflow: auto; }
    }

    .actions { display: flex; gap: 10px; margin-top: 16px; flex-wrap: wrap; }
    .actions.no-top { margin-top: 0; }

    .stats {
      display: grid;
      grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
      gap: 12px;
      margin-bottom: 18px;
    }



    .stats-layout {
      display: grid;
      gap: 16px;
      margin-bottom: 18px;
    }

    .stats-section {
      border: 1px solid var(--line);
      border-radius: 20px;
      background: rgba(255,255,255,.025);
      padding: 14px;
    }

    .stats-section-title {
      margin: 0 0 12px;
      color: var(--muted);
      font-size: 12px;
      font-weight: 950;
      letter-spacing: .08em;
      text-transform: uppercase;
      display: flex;
      align-items: center;
      gap: 8px;
    }




    .stats-view.hidden { display: none !important; }

    .stats-view-tabs {
      display: flex;
      flex-wrap: wrap;
      gap: 8px;
      margin: 0 0 14px;
    }

    .stats-view-btn {
      border: 1px solid var(--line);
      border-radius: 999px;
      background: rgba(255,255,255,.04);
      color: var(--muted);
      padding: 8px 12px;
      font-weight: 900;
      cursor: pointer;
    }

    .stats-view-btn.active {
      border-color: rgba(85,167,255,.55);
      background: rgba(85,167,255,.16);
      color: #eaf4ff;
    }

    .stats-section.collapsible .stats-section-title {
      cursor: pointer;
      user-select: none;
    }

    .stats-section-toggle {
      margin-left: auto;
      width: 22px;
      height: 22px;
      border-radius: 999px;
      border: 1px solid var(--line);
      background: rgba(255,255,255,.04);
      color: var(--muted);
      display: inline-flex;
      align-items: center;
      justify-content: center;
      font-weight: 950;
      line-height: 1;
    }

    .stats-section-toggle::before { content: '⌃'; }
    .stats-section.collapsed .stats-section-toggle::before { content: '⌄'; }
    .replay-stats-group.collapsed .stats-section-toggle::before { content: '⌄'; }
    .stats-section.collapsed > :not(.stats-section-title) { display: none !important; }

    .replay-stats-group.collapsible .replay-stats-group-title {
      cursor: pointer;
      user-select: none;
      display: flex;
      align-items: center;
      gap: 8px;
    }

    .replay-stats-group.collapsed > :not(.replay-stats-group-title) { display: none !important; }


    .stat-card > span { padding-right: 34px; }
    .stat-card.has-info > span { padding-right: 58px; }

    .stat-favorite-btn {
      position: absolute;
      top: 10px;
      right: 10px;
      width: 22px;
      height: 22px;
      border-radius: 999px;
      border: 1px solid rgba(255,255,255,.20);
      background: rgba(255,255,255,.04);
      color: var(--muted);
      display: inline-flex;
      align-items: center;
      justify-content: center;
      font-size: 0;
      font-weight: 950;
      line-height: 1;
      cursor: pointer;
      z-index: 4;
      padding: 0;
      text-align: center;
    }

    .stat-favorite-btn::before {
      content: '+';
      display: block;
      width: 100%;
      text-align: center;
      font-family: Arial, Helvetica, sans-serif;
      font-size: 16px;
      font-weight: 900;
      line-height: 20px;
      transform: translateY(-.5px);
    }

    .stat-favorite-btn.is-favorite::before {
      content: '−';
      font-size: 18px;
      line-height: 20px;
      transform: translateY(-1px);
    }

    .stat-card.has-info .stat-favorite-btn { right: 36px; }

    .stat-favorite-btn:hover {
      border-color: rgba(85,167,255,.65);
      color: #eaf4ff;
      background: rgba(85,167,255,.16);
    }

    .stat-favorite-btn.is-favorite {
      border-color: rgba(255,212,93,.65);
      color: #ffd45d;
      background: rgba(255,212,93,.14);
    }

    .favorite-stat-owner {
      display: inline-flex;
      align-items: center;
      width: fit-content;
      max-width: 100%;
      margin: 0 0 8px;
      padding: 4px 8px;
      border-radius: 999px;
      border: 1px solid rgba(85,167,255,.32);
      background: rgba(85,167,255,.12);
      color: #dbeafe;
      font-size: 11px;
      font-weight: 800;
      letter-spacing: .02em;
      text-transform: uppercase;
    }


    .stats-scope-toolbar {
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 10px;
      flex-wrap: wrap;
      border: 1px solid var(--line);
      border-radius: 16px;
      background: rgba(255,255,255,.025);
      padding: 10px 12px;
      margin-bottom: 14px;
    }

    .stats-scope-actions {
      display: flex;
      flex-wrap: wrap;
      gap: 8px;
      align-items: center;
    }

    .stats-scope-actions .btn.active {
      border-color: rgba(85,167,255,.55);
      background: rgba(85,167,255,.16);
      color: #eaf4ff;
    }

    .ballchasing-subsection-title {
      margin: 14px 0 8px;
      color: var(--muted);
      font-size: 11px;
      font-weight: 950;
      letter-spacing: .08em;
      text-transform: uppercase;
    }

    .ballchasing-subsection-title:first-of-type { margin-top: 2px; }

    .stat-card.info-card {
      grid-column: 1 / -1;
      min-height: auto;
      background: rgba(85,167,255,.07);
      border-color: rgba(85,167,255,.22);
    }

    .stat-card.info-card strong {
      white-space: normal;
      line-height: 1.45;
      font-size: 13px;
    }

    .stats-section .stats {
      margin-bottom: 0;
      grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    }

    .stats-section .stat-card {
      min-height: 92px;
    }

    .stats-section.primary .stats {
      grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
    }

    .stat-card {
      position: relative;
      overflow: visible;
      padding: 16px;
      border: 1px solid var(--line);
      border-radius: 16px;
      background: var(--panel-2);
    }

    .stat-card span { display: block; padding-right: 24px; color: var(--muted); font-size: 12px; font-weight: 900; text-transform: uppercase; letter-spacing: .06em; line-height: 1.25; }

    .stat-info {
      position: absolute;
      top: 11px;
      right: 11px;
      display: inline-flex !important;
      align-items: center;
      justify-content: center;
      width: 17px;
      height: 17px;
      margin-left: 0;
      border-radius: 999px;
      border: 1px solid rgba(255,255,255,.28);
      color: var(--text) !important;
      background: rgba(85,167,255,.18);
      font-size: 11px !important;
      line-height: 1;
      font-weight: 950;
      text-transform: none !important;
      letter-spacing: 0 !important;
      cursor: help;
      vertical-align: middle;
      z-index: 5;
    }
    .stat-info::after {
      content: attr(data-tip);
      position: absolute;
      right: 0;
      bottom: calc(100% + 10px);
      transform: translateY(4px);
      width: min(300px, 72vw);
      padding: 9px 10px;
      border-radius: 12px;
      border: 1px solid var(--line);
      background: rgba(8, 13, 24, .98);
      color: var(--text);
      box-shadow: 0 16px 44px rgba(0,0,0,.35);
      font-size: 12px;
      font-weight: 700;
      line-height: 1.35;
      text-transform: none;
      letter-spacing: 0;
      opacity: 0;
      pointer-events: none;
      transition: opacity .15s ease, transform .15s ease;
      z-index: 30;
      white-space: normal;
      text-align: left;
    }
    .stat-info:hover::after,
    .stat-info:focus::after {
      opacity: 1;
      transform: translateY(0);
    }
    .stats-mechanics-grid { margin-top: 10px; }
    .stats-mechanics-grid .stat-card strong { font-size: clamp(16px, 1.55vw, 18px); line-height: 1.32; }
    .stat-card strong { display: block; margin-top: 8px; font-size: clamp(19px, 2.15vw, 25px); line-height: 1.14; letter-spacing: -.035em; white-space: pre-line; overflow-wrap: anywhere; }
    .compare-card strong { white-space: pre-line; }
    .stack-lines { white-space: pre-line; line-height: 1.35; }

    /* Mechanics FINAL stable v1.0 cards: long labels must wrap cleanly instead of leaking outside cards. */
    .replay-stats-group .stats { grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); align-items: stretch; }
    .replay-stats-group .stat-card { min-width: 0; }
    .replay-stats-group .stat-card span,
    .replay-stats-group .stat-card strong { max-width: 100%; overflow-wrap: anywhere; word-break: normal; hyphens: auto; }
    .replay-stats-group .stat-card span { letter-spacing: .035em; }
    .replay-stats-group .stat-card strong { font-size: clamp(15px, 1.45vw, 20px); line-height: 1.22; }


    /* Czytelne ikony informacji i dymki ponad panelami/statystykami. */
    .stat-card .stat-info {
      position: absolute;
      top: 10px;
      right: 10px;
      display: inline-flex !important;
      align-items: center;
      justify-content: center;
      width: 19px;
      height: 19px;
      min-width: 19px;
      min-height: 19px;
      padding: 0 !important;
      margin: 0 !important;
      box-sizing: border-box;
      border-radius: 999px;
      border: 1px solid rgba(122, 162, 255, .72);
      background: rgba(122, 162, 255, .20);
      color: var(--text) !important;
      font-family: Inter, ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
      font-size: 12px !important;
      font-weight: 950;
      line-height: 1 !important;
      text-align: center;
      text-transform: none !important;
      letter-spacing: 0 !important;
      cursor: help;
      z-index: 12;
      user-select: none;
    }
    .stat-card .stat-info::after { display: none !important; }
    .stat-info-tooltip {
      position: fixed;
      left: 0;
      top: 0;
      max-width: min(420px, calc(100vw - 28px));
      max-height: calc(100vh - 24px);
      overflow: auto;
      padding: 10px 12px;
      border-radius: 13px;
      border: 1px solid var(--tooltip-border);
      background: var(--tooltip-bg);
      color: var(--text);
      box-shadow: 0 22px 70px rgba(0,0,0,.52);
      font-size: 12px;
      font-weight: 750;
      line-height: 1.38;
      text-transform: none;
      letter-spacing: 0;
      pointer-events: none;
      opacity: 0;
      transform: translateY(4px);
      transition: opacity .12s ease, transform .12s ease;
      z-index: 2147483647;
      white-space: normal;
      overflow-wrap: break-word;
    }
    .stat-info-tooltip.show { opacity: 1; transform: translateY(0); }

    .replay-stats-group { margin-top: 16px; }
    .replay-stats-group-title {
      margin: 16px 0 9px;
      color: var(--text);
      font-size: 13px;
      font-weight: 950;
      letter-spacing: .05em;
      text-transform: uppercase;
      display: flex;
      align-items: center;
      gap: 8px;
    }
    .replay-stats-group-title::after {
      content: '';
      flex: 1;
      height: 1px;
      background: linear-gradient(90deg, var(--line), transparent);
      opacity: .75;
    }

    .app-modal-open .top-theme-corner { display: none !important; }
    body.player-replay-mode .history-panel,
    body.player-replay-mode .stats-layout,
    body.player-replay-mode .chart-toolbar,
    body.player-replay-mode .custom-chart-legend,
    body.player-replay-mode .chart-wrap,
    body.player-replay-mode .history-toolbar,
    body.player-replay-mode .table-wrap { display: none !important; }
    body.player-replay-mode .day { min-height: 58px; justify-content: center; }
    body.player-replay-mode .day.played,
    body.player-replay-mode .day.not-played,
    body.player-replay-mode .day.gain,
    body.player-replay-mode .day.loss,
    body.player-replay-mode .day.flat {
      background: var(--panel-2);
      border-color: var(--line);
      color: var(--text);
      box-shadow: none;
    }
    body.player-replay-mode .day .day-change { display: none !important; }
    body.player-replay-mode .day.out-season { opacity: 1 !important; filter: none !important; }
    body.player-replay-mode .day.muted { opacity: .46; }
    body.player-replay-mode .season-card { display: grid !important; }
    body.player-replay-mode .day.import-empty { visibility: hidden; pointer-events: none; }
    body.player-replay-mode .day:not(.import-empty) { filter: none !important; }
    body.player-replay-mode .day.out-season { opacity: 1 !important; pointer-events: auto !important; cursor: pointer !important; }
    .replay-individual-details { display: flex; flex-direction: column; gap: 12px; margin-top: 10px; }
    .player-replay-detail { width: 100%; margin: 0; }
    .player-replay-detail summary .mini { margin-left: 8px; font-weight: 800; }

    .chart-toolbar {
      display: flex;
      justify-content: space-between;
      align-items: center;
      gap: 10px;
      margin-bottom: 12px;
      flex-wrap: wrap;
    }

    .chart-wrap {
      height: 510px;
      padding: 10px 10px 6px;
      border: 1px solid rgba(255,255,255,.08);
      border-radius: 16px;
      background: var(--chart-bg);
      overflow-x: hidden;
      overflow-y: hidden;
      box-shadow: inset 0 0 0 1px rgba(255,255,255,.025);
      cursor: crosshair;
      user-select: none;
    }

    .chart-wrap.is-zoomed {
      overflow-x: auto;
    }

    .chart-inner {
      height: 100%;
      min-width: 100%;
      transition: width .18s ease;
      background: var(--chart-bg);
    }

    .chart-inner canvas {
      display: block;
    }



    .custom-chart-legend {
      display: flex;
      flex-wrap: wrap;
      gap: 10px 16px;
      align-items: center;
      padding: 10px 14px;
      margin: 10px 0 8px;
      border: 1px solid var(--border);
      border-radius: 14px;
      background: rgba(8, 13, 28, .42);
      color: var(--muted);
      font-size: 12px;
      font-weight: 800;
      letter-spacing: .02em;
    }

    body.theme-light .custom-chart-legend {
      background: rgba(255,255,255,.78);
    }

    body.theme-black .custom-chart-legend {
      background: rgba(0,0,0,.54);
    }

    .legend-item {
      display: inline-flex;
      align-items: center;
      gap: 7px;
      white-space: nowrap;
    }

    .legend-item.hidden { display: none !important; }

    .legend-swatch {
      flex: 0 0 auto;
      display: inline-block;
      width: 26px;
      height: 11px;
      border-radius: 3px;
      border: 1px solid rgba(255,255,255,.22);
    }

    .legend-swatch.goal-line {
      height: 0;
      width: 32px;
      border: 0;
      border-top: 2px dashed rgba(85, 167, 255, .95);
      border-radius: 0;
    }

    .legend-swatch.progress-line {
      height: 0;
      width: 32px;
      border: 0;
      border-top: 2px solid rgba(139, 178, 255, .95);
      border-radius: 0;
    }

    .legend-swatch.candle-swatch {
      width: 30px;
      height: 13px;
      border: 0;
      background: linear-gradient(90deg, rgba(48,205,90,.96) 0 48%, rgba(255,80,80,.96) 52% 100%);
    }

    .legend-swatch.rank-colors-swatch {
      width: 34px;
      height: 12px;
      border: 0;
      background: linear-gradient(90deg, rgba(125,244,255,.45), rgba(82,150,255,.48), rgba(168,96,250,.54), rgba(216,36,96,.56));
    }

    .legend-rank-logo {
      width: 18px;
      height: 18px;
      object-fit: contain;
      display: inline-block;
      filter: drop-shadow(0 1px 2px rgba(0,0,0,.45));
    }

    .chart-zoom-actions {
      display: inline-flex;
      gap: 8px;
      align-items: center;
      flex-wrap: wrap;
    }

    .history-toolbar {
      display: flex;
      justify-content: space-between;
      align-items: center;
      gap: 10px;
      margin-top: 18px;
      flex-wrap: wrap;
    }

    .history-toolbar .mini { margin-top: 0; }

    .table-wrap {
      overflow: auto;
      max-height: min(72vh, 680px);
      min-height: 520px;
      border: 1px solid var(--line);
      border-radius: 16px;
      margin-top: 18px;
    }

    .history-panel .table-wrap table { min-width: 1480px; }
    .history-panel .table-wrap th,
    .history-panel .table-wrap td { padding: 14px 16px; }

    @media (max-width: 760px) {
      .history-panel .table-wrap {
        max-height: 62vh;
        min-height: 430px;
      }
      .history-panel .table-wrap table { min-width: 1060px; }
      .history-panel .table-wrap th,
      .history-panel .table-wrap td { padding: 11px 12px; }
    }

    table { width: 100%; border-collapse: collapse; min-width: 1240px; }
    th, td { padding: 12px 14px; text-align: left; border-bottom: 1px solid var(--line); }
    th { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .06em; background: #070b13; background-color: #070b13; position: sticky; top: 0; z-index: 4; box-shadow: 0 1px 0 rgba(148,163,184,.24), 0 8px 18px rgba(0,0,0,.42); backdrop-filter: none; -webkit-backdrop-filter: none; }
    td { color: rgba(238,244,255,.92); }
    tr:last-child td { border-bottom: 0; }
    tr.clickable { cursor: pointer; }
    tr.clickable:hover { background: rgba(255,255,255,.045); }
    tr.clickable.selected-row { background: rgba(85, 167, 255, .11); box-shadow: inset 3px 0 0 rgba(85,167,255,.95); }
    tr.clickable.selected-row td:first-child { color: #dcecff; font-weight: 900; }

    th.sortable { cursor: pointer; user-select: none; }
    .sort-btn {
      all: unset;
      display: inline-flex;
      align-items: center;
      gap: 6px;
      cursor: pointer;
      line-height: 1.2;
    }
    .sort-btn:focus-visible {
      outline: 2px solid rgba(85,167,255,.65);
      outline-offset: 3px;
      border-radius: 8px;
    }
    .sort-arrow {
      color: rgba(171,184,205,.45);
      font-size: 12px;
      min-width: 12px;
    }
    th.sorted .sort-arrow { color: var(--blue); }
    th.sortable:hover { background: rgba(255,255,255,.065); }


    .gain-text { color: var(--green); font-weight: 900; }
    .loss-text { color: var(--red); font-weight: 900; }
    .flat-text { color: var(--yellow); font-weight: 900; }

    .status-pill {
      display: inline-flex;
      align-items: center;
      gap: 8px;
      padding: 10px 14px;
      border: 1px solid var(--line);
      border-radius: 999px;
      background: rgba(255,255,255,.055);
      color: var(--muted);
      white-space: nowrap;
    }

    .sync-pill { margin-bottom: 14px; }

    .dot {
      width: 9px;
      height: 9px;
      border-radius: 50%;
      background: var(--yellow);
      box-shadow: 0 0 18px var(--yellow);
    }

    .dot.online {
      background: var(--green);
      box-shadow: 0 0 18px var(--green);
    }

    details {
      margin-top: 18px;
      border: 1px solid var(--line);
      border-radius: 16px;
      background: rgba(255,255,255,.035);
      overflow: hidden;
    }

    summary {
      cursor: pointer;
      padding: 15px 16px;
      font-weight: 900;
    }

    .sync-body { padding: 0 16px 16px; color: var(--muted); line-height: 1.55; }
    .sync-body p { margin: 0 0 12px; }
    .sync-body code { color: #d9e8ff; background: rgba(255,255,255,.07); padding: 2px 6px; border-radius: 6px; }
    .sync-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 14px; margin-bottom: 14px; align-items:center; }
    .sync-body .field + .sync-actions { margin-top: 16px; }
    .sync-body textarea { display:block; position:relative; z-index:0; }
    #firebaseConfigInput { margin-bottom: 22px; min-height: 142px; }
    #importExportArea { margin-top: 24px; min-height: 132px; }
    #noteInput, #medalLinksInput { min-height: 118px; }
    .mini { font-size: 12px; color: var(--muted); margin-top: 8px; line-height: 1.4; }

    .toast {
      position: fixed;
      right: 18px;
      bottom: 18px;
      max-width: min(460px, calc(100vw - 28px));
      padding: 13px 15px;
      border-radius: 16px;
      background: linear-gradient(135deg, rgba(12, 18, 34, .98), rgba(20, 29, 50, .98));
      color: var(--text);
      border: 1px solid var(--line);
      box-shadow: 0 18px 42px rgba(0,0,0,.32);
      opacity: 0;
      transform: translateY(12px) scale(.985);
      pointer-events: none;
      transition: opacity .18s ease, transform .18s ease;
      z-index: 2147482600;
      white-space: pre-line;
      line-height: 1.42;
      font-size: 13px;
      font-weight: 760;
    }

    .toast.show { opacity: 1; transform: translateY(0) scale(1); }
    .toast.good { border-color: rgba(72,210,130,.48); box-shadow: 0 18px 42px rgba(0,0,0,.32), 0 0 0 1px rgba(72,210,130,.10) inset; }
    .toast.warn { border-color: rgba(255,190,80,.52); box-shadow: 0 18px 42px rgba(0,0,0,.32), 0 0 0 1px rgba(255,190,80,.10) inset; }
    .toast.error { border-color: rgba(255,95,95,.58); box-shadow: 0 18px 42px rgba(0,0,0,.32), 0 0 0 1px rgba(255,95,95,.11) inset; }

    .empty-state {
      text-align: center;
      color: var(--muted);
      padding: 34px 18px;
    }

    html[data-theme="white"] .tracker-switch,
    html[data-theme="white"] .tactic-form-card,
    html[data-theme="white"] .tactics-column,
    html[data-theme="white"] .mmr-preview,
    html[data-theme="white"] .session-card,
    html[data-theme="white"] .session-score div,
    html[data-theme="white"] .match-section,
    html[data-theme="white"] details,
    html[data-theme="white"] .season-range,
    html[data-theme="white"] .theme-picker,
    html[data-theme="white"] .status-pill,
    html[data-theme="white"] .day,
    html[data-theme="white"] .match-card,
    html[data-theme="white"] .tactic-card {
      background: rgba(255,255,255,.72);
    }

    html[data-theme="white"] .modal-panel {
      background: linear-gradient(180deg, rgba(255,255,255,.98), rgba(244,247,251,.98));
      border-color: rgba(15,23,42,.14);
    }

    html[data-theme="white"] .modal-backdrop { background: rgba(15, 23, 42, .30); }

    html[data-theme="black"] .modal-backdrop {
      background: rgba(0, 0, 0, .82);
      backdrop-filter: blur(10px);
    }

    html[data-theme="black"] .modal-panel {
      background: linear-gradient(180deg, rgba(6,6,6,.995), rgba(0,0,0,.995));
      border-color: rgba(255,255,255,.16);
      box-shadow: 0 30px 95px rgba(0,0,0,.86);
    }

    html[data-theme="black"] .modal-header,
    html[data-theme="black"] .modal-body {
      background: rgba(0,0,0,.96);
    }

    html[data-theme="black"] .tactic-form-card,
    html[data-theme="black"] .tactics-column,
    html[data-theme="black"] .tactic-card,
    html[data-theme="black"] .compare-card,
    html[data-theme="black"] .compare-chart-card,
    html[data-theme="black"] .compare-view-btn,
    html[data-theme="black"] .session-card,
    html[data-theme="black"] .match-section,
    html[data-theme="black"] details {
      background: rgba(8,8,8,.96);
      border-color: rgba(255,255,255,.14);
    }

    html[data-theme="black"] .compare-view-btn.active,
    html[data-theme="black"] .tactic-status-btn.active {
      background: rgba(85,167,255,.20);
      border-color: rgba(85,167,255,.55);
    }

    html[data-theme="black"] .tactic-form-card h3,
    html[data-theme="black"] .tactics-column h3,
    html[data-theme="black"] .modal-title h2 {
      color: rgba(248,250,252,.94);
    }

    html[data-theme="black"] .tactic-card p,
    html[data-theme="black"] .compare-leader,
    html[data-theme="black"] .modal-title .mini {
      color: var(--muted);
    }

    html[data-theme="white"] .tactic-form-card h3,
    html[data-theme="white"] .tactics-column h3,
    html[data-theme="white"] .tactic-card p,
    html[data-theme="white"] td,
    html[data-theme="white"] .day-change,
    html[data-theme="white"] .day-number,
    html[data-theme="white"] .sync-body code { color: rgba(15,23,42,.90); }
    html[data-theme="white"] .day-change { background: rgba(15, 23, 42, .07); }
    html[data-theme="white"] .day.today .day-number { color: #0f172a; background: rgba(30,111,217,.13); }
    html[data-theme="white"] .day.not-played .day-number { color: rgba(15,23,42,.72); background: rgba(15,23,42,.08); }
    html[data-theme="white"] th { background: rgba(15,23,42,.04); }
    html[data-theme="white"] tr.clickable:hover { background: rgba(15,23,42,.04); }
    html[data-theme="white"] tr.clickable.selected-row { background: rgba(30,111,217,.10); }
    html[data-theme="white"] .btn.toggle.active,
    html[data-theme="white"] .tracker-tab.active,
    html[data-theme="white"] .tracker-subtab.active,
    html[data-theme="white"] .mode-tab.active,
    html[data-theme="white"] .status-option.active,
    html[data-theme="white"] .tactic-status-btn.active { color: #0f172a; }
    html[data-theme="white"] .toast { background: rgba(255,255,255,.98); }

    @media (max-width: 1120px) {
      .grid { grid-template-columns: 1fr; }
      .stats { grid-template-columns: repeat(2, 1fr); }
      .hero { flex-direction: column; }
    }

    @media (max-width: 720px) {
      .app { width: min(100% - 20px, 1440px); padding-top: 16px; }
      .form-grid, .season-card { grid-template-columns: 1fr; }
      .season-range { grid-column: auto; }
      .stats, .session-score { grid-template-columns: 1fr; }
      .actions { flex-direction: column; }
      .calendar { gap: 5px; }
      .day { min-height: 54px; border-radius: 11px; padding: 5px; font-size: 13px; gap: 3px; }
      .day-number { min-width: 19px; height: 19px; font-size: 12px; }
      .day-change { min-height: 18px; padding: 3px 2px 2px; font-size: 9px; border-radius: 7px; }
      .day.not-played .day-change.off { min-height: 24px; font-size: 6.4px; letter-spacing: .04em; }
      .tracker-row, .tracker-subtabs { align-items: stretch; }
      .tracker-actions { align-items: stretch; }
      .tracker-actions .btn { width: 100%; }
      .tactics-layout { grid-template-columns: 1fr; }
      .tactics-board { grid-template-columns: 1fr; }
      .tactic-status-select { grid-template-columns: 1fr; }
      .tracker-tab, .tracker-subtab { width: 100%; }
      .mode-tabs, .status-toggle { grid-template-columns: 1fr; }
      .chart-wrap { height: 430px; }
      .chart-toolbar { align-items: stretch; }
      .chart-toolbar .btn { width: 100%; }
    }


    /* Patch: Import dnia calendar cleanup + fixed controls + embedded analyzer page */
    body > .top-theme-corner,
    .top-theme-corner {
      position: absolute !important;
      inset: 14px 14px auto auto !important;
      left: auto !important;
      bottom: auto !important;
      z-index: 2147483000 !important;
      transform: translateZ(0) !important;
      margin: 0 !important;
      max-width: calc(100vw - 28px);
      pointer-events: none;
    }
    .top-theme-corner .theme-picker { pointer-events: auto; }
    .app-modal-open .top-theme-corner { display: none !important; }

    .player-replay-season-card {
      display: none;
      grid-template-columns: minmax(160px, 220px) 1fr;
      gap: 12px;
      align-items: end;
      margin: 0 0 16px;
      padding: 14px;
      border: 1px solid var(--line);
      border-radius: 18px;
      background: linear-gradient(180deg, rgba(255,255,255,.055), rgba(255,255,255,.025));
    }
    .player-replay-season-card .field { margin: 0; }
    .player-replay-season-range {
      color: var(--muted);
      font-size: 13px;
      font-weight: 850;
      line-height: 1.45;
      align-self: center;
    }
    body.player-replay-mode .player-replay-season-card { display: grid !important; }
    body.player-replay-mode .panel-body > .season-card { display: none !important; }
    @media (max-width: 760px) {
      .player-replay-season-card { grid-template-columns: 1fr; }
    }

    body.player-replay-mode .calendar .day,
    body.player-replay-mode .calendar .day.played,
    body.player-replay-mode .calendar .day.not-played,
    body.player-replay-mode .calendar .day.gain,
    body.player-replay-mode .calendar .day.loss,
    body.player-replay-mode .calendar .day.flat,
    body.player-replay-mode .calendar .day.out-season,
    body.player-replay-mode .calendar .day.muted {
      background: var(--panel-2) !important;
      border: 1px solid var(--line) !important;
      color: var(--text) !important;
      box-shadow: none !important;
      opacity: 1 !important;
      filter: none !important;
      outline: 0 !important;
    }
    body.player-replay-mode .calendar .day:hover {
      border-color: var(--accent) !important;
      box-shadow: 0 0 0 2px rgba(85,167,255,.14) !important;
    }
    body.player-replay-mode .calendar .day.selected {
      border-color: var(--blue) !important;
      box-shadow: 0 0 0 2px rgba(85,167,255,.32) !important;
      background: rgba(85,167,255,.12) !important;
    }
    body.player-replay-mode .calendar .day.today:not(.selected) {
      border-color: rgba(255,255,255,.38) !important;
    }
    body.player-replay-mode .calendar .day .day-change,
    body.player-replay-mode .calendar .day .wl-line { display: none !important; }
    body.player-replay-mode .calendar .day-number {
      background: transparent !important;
      color: var(--text) !important;
      opacity: 1 !important;
      filter: none !important;
    }
    body.player-replay-mode .calendar .day.import-empty {
      visibility: hidden !important;
      pointer-events: none !important;
    }
    body.player-replay-mode .calendar .day .day-change,
    body.player-replay-mode .calendar .day .wl-line,
    body.player-replay-mode .calendar .day > span:not(.day-number) {
      display: none !important;
    }
    body.player-replay-mode .calendar .day.import-clean-day {
      display: flex !important;
      align-items: center !important;
      justify-content: center !important;
      min-height: 58px !important;
      background: var(--panel-2) !important;
      border: 1px solid var(--line) !important;
      color: var(--text) !important;
      opacity: 1 !important;
      filter: none !important;
    }
    body.player-replay-mode .calendar .day.import-clean-day.out-season,
    body.player-replay-mode .calendar .day.import-clean-day.muted {
      opacity: .38 !important;
      filter: saturate(.65) !important;
      pointer-events: auto !important;
    }
    body.player-replay-mode .calendar .day.import-clean-day .day-number {
      font-size: 15px !important;
      line-height: 1 !important;
      font-weight: 900 !important;
      display: block !important;
      background: transparent !important;
    }

    .analyzer-page {
      display: none;
      position: fixed;
      z-index: 1002;
      left: 50%;
      top: 18px;
      transform: translateX(-50%);
      width: min(1560px, calc(100vw - 28px));
      height: calc(100vh - 36px);
      margin: 0;
      overflow: hidden;
      border: 1px solid var(--line);
      border-radius: 28px;
      background: var(--panel);
      box-shadow: 0 26px 90px rgba(0,0,0,.62), inset 0 0 0 1px rgba(255,255,255,.025);
    }
    body.replay-analyzer-mode::after {
      content: '';
      position: fixed;
      inset: 0;
      z-index: 1001;
      background: rgba(0,0,0,.62);
      backdrop-filter: blur(8px);
    }
    body.replay-analyzer-mode #replayAnalyzerPage { display: flex !important; flex-direction: column; }
    .analyzer-page-header {
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 14px;
      padding: 18px 18px 14px;
      border-bottom: 1px solid var(--line);
      flex: 0 0 auto;
    }
    .analyzer-page-title h2 { margin: 0 0 4px; }
    .analyzer-page-title p { margin: 0; color: var(--muted); font-size: 13px; }
    .analyzer-frame-wrap { padding: 14px; flex: 1 1 auto; min-height: 0; }
    .replay-analyzer-frame {
      display: block;
      width: 100%;
      height: 100%;
      min-height: 0;
      border: 1px solid var(--line);
      border-radius: 22px;
      background: var(--panel-2);
      box-shadow: inset 0 0 0 1px rgba(255,255,255,.025);
    }
    @media (max-width: 760px) {
      .analyzer-page { top: 8px; width: calc(100vw - 12px); height: calc(100vh - 16px); border-radius: 20px; }
      .analyzer-page-header { align-items: stretch; flex-direction: column; }
    }


    /* Patch: analyzer focus + clean import calendar + compact replay scoreboards */
    body.replay-analyzer-mode .top-theme-corner { display: none !important; }
    body.player-replay-mode #playerReplaySeasonCard {
      display: grid !important;
      visibility: visible !important;
      opacity: 1 !important;
    }
    body.player-replay-mode .calendar .day.import-clean-day {
      background: var(--panel-2) !important;
      border: 1px solid var(--line) !important;
      color: var(--text) !important;
      box-shadow: none !important;
      filter: none !important;
    }
    body.player-replay-mode .calendar .day.import-clean-day.muted {
      opacity: .38 !important;
      pointer-events: none !important;
    }
    body.player-replay-mode .calendar .day.import-clean-day.out-season:not(.selected) {
      opacity: .38 !important;
      filter: grayscale(.35) !important;
      border-style: dashed !important;
      pointer-events: none !important;
    }
    body.player-replay-mode .calendar .day.import-clean-day.selected {
      border-color: var(--blue) !important;
      box-shadow: 0 0 0 2px rgba(85,167,255,.32) !important;
      background: rgba(85,167,255,.12) !important;
      opacity: 1 !important;
    }
    body.player-replay-mode .calendar .day.import-clean-day.today:not(.selected) {
      border-color: rgba(255,255,255,.38) !important;
    }
    body.player-replay-mode .calendar .day.import-clean-day .day-change,
    body.player-replay-mode .calendar .day.import-clean-day .wl-line { display: none !important; }
    body.player-replay-mode .calendar .day.import-clean-day .day-number {
      background: transparent !important;
      color: inherit !important;
      opacity: 1 !important;
      filter: none !important;
    }
    .replay-scoreboard .table-scroll {
      overflow-x: auto;
      max-width: 100%;
    }
    .replay-scoreboard table {
      width: 100% !important;
      min-width: 560px !important;
      max-width: none;
      table-layout: fixed !important;
    }
    .replay-scoreboard th,
    .replay-scoreboard td {
      padding: 7px 10px !important;
    }
    .replay-scoreboard th:first-child,
    .replay-scoreboard td:first-child {
      width: 38% !important;
      min-width: 180px !important;
      max-width: none;
      white-space: normal !important;
      overflow-wrap: anywhere;
    }
    .replay-scoreboard th:not(:first-child),
    .replay-scoreboard td:not(:first-child) {
      width: auto;
      text-align: center !important;
    }

    /* Patch: day import top cleanup + replay start MMR + update footer */
    body.player-replay-mode .panel-body > .season-card {
      display: grid !important;
      grid-template-columns: 1fr !important;
      gap: 12px !important;
      margin-bottom: 16px !important;
    }
    body.player-replay-mode #playerReplaySeasonCard { display: none !important; }
    body.player-replay-mode .season-card .field:has(#seasonGoalInput),
    body.player-replay-mode .season-card .season-goal-field { display: none !important; }
    body.player-replay-mode .season-card .season-range { grid-column: 1 / -1 !important; }
    body.player-replay-mode .season-card .season-edit-toggle { grid-column: 1 / -1 !important; }
    .replay-start-mmr-box {
      margin: 8px 0 4px;
      padding: 12px;
      border: 1px solid var(--line);
      border-radius: 16px;
      background: rgba(255,255,255,.035);
    }
    .replay-start-mmr-grid {
      display: grid;
      grid-template-columns: repeat(2, minmax(0, 1fr));
      gap: 12px;
      margin-top: 10px;
    }
    @media (max-width: 760px) { .replay-start-mmr-grid { grid-template-columns: 1fr; } }
    .site-update-footer {
      margin: 24px auto 0;
      padding: 12px 16px;
      max-width: 1480px;
      color: var(--muted);
      font-size: 12px;
      text-align: center;
      border: 1px solid var(--line);
      border-radius: 16px;
      background: rgba(255,255,255,.025);
    }

    .calendar-auto-actions {
      margin-top: 14px;
      display: grid;
      gap: 6px;
    }
    .calendar-auto-actions .btn { width: 100%; justify-content: center; }
    .calendar-auto-actions .mini { margin: 0; text-align: center; }

  
    /* Alias chips and replay import collapse patch */
    .alias-hidden-input { display:none !important; }
    .alias-chip-grid { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:14px; align-items:start; }
    @media (max-width: 980px) { .alias-chip-grid { grid-template-columns:1fr; } }
    .alias-editor { min-width:0; height:100%; }
    .alias-chip-list { display:grid; grid-template-columns:repeat(auto-fit,minmax(150px,1fr)); gap:8px; margin-top:8px; align-items:stretch; }
    .alias-chip { display:flex; align-items:center; justify-content:space-between; gap:8px; min-height:44px; width:100%; border:1px solid rgba(148,163,184,.35); border-radius:12px; padding:8px 10px; background:rgba(15,23,42,.72); color:var(--text); font-size:13px; line-height:1.25; box-shadow:inset 0 1px 0 rgba(255,255,255,.035); }
    .alias-chip-name { overflow-wrap:anywhere; word-break:break-word; min-width:0; }
    .alias-chip-remove { flex:0 0 auto; border:0; background:transparent; color:var(--muted); width:28px; height:28px; border-radius:9px; padding:0; display:inline-flex; align-items:center; justify-content:center; cursor:pointer; }
    .alias-chip-remove:hover { color:#fff; background:rgba(239,68,68,.22); }
    .alias-chip-add { justify-content:center; font-size:18px; font-weight:900; cursor:pointer; color:var(--accent); border-style:dashed; }
    .alias-modal-card { max-width:460px; width:min(92vw,460px); }
    .alias-modal-card input { width:100%; margin-top:10px; }
    .alias-modal-actions { display:flex; gap:10px; justify-content:flex-end; margin-top:14px; }
    .replay-analysis-toolbar { display:flex; justify-content:flex-end; margin:10px 0; }
    .player-title-badge { display:inline-flex; align-items:center; gap:6px; border:1px solid rgba(255,255,255,.22); border-radius:999px; padding:2px 8px; font-size:11px; font-weight:900; background:rgba(255,255,255,.06); }
    .player-title-badge .title-dot { width:7px; height:7px; border-radius:999px; background:currentColor; box-shadow:0 0 9px currentColor; }
    details.replay-analysis-card > summary { cursor:pointer; list-style:none; position:relative; min-height:18px; padding-right:104px; }
    details.replay-analysis-card > summary::-webkit-details-marker { display:none; }
    details.replay-analysis-card > summary::after { content:'Zwiń / rozwiń'; position:absolute; right:0; top:1px; line-height:1.2; font-size:11px; color:var(--muted); font-weight:600; }
    .replay-scoreboard td:nth-child(2), .replay-scoreboard th:nth-child(2) { max-width:160px; overflow-wrap:anywhere; }

  

    /* Final fix: alias layout and opponent database readability */
    .alias-chip-grid {
      grid-template-columns: repeat(3, minmax(220px, 1fr)) !important;
      align-items: stretch !important;
      gap: 16px !important;
      width: 100% !important;
    }
    @media (max-width: 1050px) { .alias-chip-grid { grid-template-columns: 1fr !important; } }
    .alias-editor {
      min-width: 0 !important;
      overflow: hidden !important;
      display: flex !important;
      flex-direction: column !important;
      gap: 8px !important;
    }
    .alias-chip-list {
      display: grid !important;
      grid-template-columns: 1fr !important;
      gap: 8px !important;
      min-width: 0 !important;
      width: 100% !important;
    }
    .alias-chip {
      box-sizing: border-box !important;
      max-width: 100% !important;
      min-width: 0 !important;
      min-height: 42px !important;
      display: grid !important;
      grid-template-columns: minmax(0,1fr) 32px !important;
      align-items: center !important;
      border-radius: 14px !important;
      padding: 8px 9px 8px 12px !important;
    }
    .alias-chip-name {
      display: block !important;
      min-width: 0 !important;
      max-width: 100% !important;
      overflow: hidden !important;
      text-overflow: ellipsis !important;
      white-space: nowrap !important;
    }
    .alias-chip-add {
      grid-template-columns: 1fr !important;
      justify-items: center !important;
      text-align: center !important;
      min-height: 42px !important;
    }
    #replayAliasDetails .actions.no-top,
    #playerReplayAliasDetails .actions.no-top {
      justify-content: center !important;
      margin-top: 16px !important;
      width: 100% !important;
    }
    #saveReplayAliasesBtn,
    #savePlayerReplayAliasesBtn {
      min-width: 190px !important;
      justify-content: center !important;
    }
    .opponent-goal-pill {
      display: inline-flex;
      align-items: center;
      justify-content: center;
      gap: 8px;
      border: 1px solid rgba(148,163,184,.32);
      border-radius: 999px;
      background: rgba(15,23,42,.72);
      padding: 4px 9px;
      white-space: nowrap;
      min-width: 82px;
    }
    .opponent-goal-pill strong { font-size: 15px; line-height: 1; }
    .opponent-goal-pill span { font-size: 11px; color: var(--muted); }
    .opponent-own-player-grid {
      display: grid;
      gap: 6px;
      min-width: 220px;
    }
    .opponent-own-player-chip {
      display: grid;
      gap: 2px;
      border: 1px solid rgba(148,163,184,.28);
      border-radius: 12px;
      background: rgba(15,23,42,.58);
      padding: 6px 8px;
      font-size: 11px;
      line-height: 1.25;
      white-space: normal;
    }
    .opponent-own-player-chip strong { font-size: 12px; }
    .opponents-table th[title="Bramki naszej drużyny : bramki drużyny przeciwnika"] { min-width: 94px; }

    /* Patch: alias manager modal + compact opponents stats + replay cards */
    .alias-manager-card { max-width: 1040px; width: min(94vw, 1040px); }
    .alias-manager-grid { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:16px; align-items:stretch; }
    @media (max-width: 980px) { .alias-manager-grid { grid-template-columns:1fr; } }
    .alias-manager-grid .alias-editor { min-width:0; height:auto; padding:14px; border-radius:16px; background:rgba(15,23,42,.74); border:1px solid rgba(148,163,184,.28); }
    .alias-manager-grid .alias-chip-list { display:grid; grid-template-columns:1fr; gap:9px; min-height:56px; }
    .alias-manager-grid .alias-chip { min-height:42px; width:100%; }
    .alias-manager-actions { display:flex; justify-content:center; gap:12px; flex-wrap:wrap; margin-top:16px; }
    .steam-alias-sync { margin-top:16px; padding:14px; border-radius:16px; background:rgba(15,23,42,.58); border:1px solid rgba(148,163,184,.22); }
    .steam-alias-sync h3 { margin:0 0 6px; font-size:16px; }
    .steam-profile-grid { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:12px; margin-top:12px; }
    .steam-profile-grid .field { padding:10px; border-radius:14px; background:rgba(2,6,23,.28); border:1px solid rgba(148,163,184,.18); }
    .steam-profile-grid input { width:100%; }
    .steam-alias-sync-status { margin-top:10px; white-space:pre-wrap; }
    .steam-alias-sync-status.good { color:#86efac; }
    .steam-alias-sync-status.warn { color:#fde68a; }
    .steam-alias-sync-status.error { color:#fca5a5; }
    @media (max-width: 980px) { .steam-profile-grid { grid-template-columns:1fr; } }
    .alias-open-card { display:flex; flex-direction:column; gap:10px; align-items:flex-start; justify-content:center; min-height:120px; }
    .opponent-goal-pill { min-width:76px; width:76px; padding:6px 7px; }
    .opponent-goal-pill strong { font-size:16px; }
    .opponent-gaos-cell { font-variant-numeric:tabular-nums; font-weight:800; white-space:nowrap; }
    .opponents-table { min-width: 860px; }
    .opponents-table th:nth-child(5), .opponents-table td:nth-child(5) { width: 84px; min-width: 84px; }
    .opponents-table th, .opponents-table td { vertical-align:middle; }
    .replay-analysis-toolbar { display:flex; justify-content:flex-end; margin: 12px 0 8px; }


    /* v0.89: raport meczowy + alias modal bez X + czytelna tabela replaya */
    .alias-modal-card .modal-title { justify-content: flex-start !important; }

    /* v0.90: małe okno dodawania aliasu musi być ponad managerem aliasów */
    #aliasModal { z-index: 80; }
    .replay-stats-grid { grid-template-columns: repeat(4, minmax(120px, 1fr)) !important; }
    .replay-scoreboard table {
      width: 100% !important;
      min-width: 760px !important;
      table-layout: fixed !important;
    }
    .replay-scoreboard col.replay-col-player { width: 24%; }
    .replay-scoreboard col.replay-col-title { width: 30%; }
    .replay-scoreboard col.replay-col-score { width: 12%; }
    .replay-scoreboard col.replay-col-small { width: 8.5%; }
    .replay-scoreboard th,
    .replay-scoreboard td {
      white-space: normal !important;
      overflow-wrap: anywhere !important;
      word-break: normal !important;
      vertical-align: middle !important;
    }
    .replay-scoreboard th:first-child,
    .replay-scoreboard td:first-child {
      width: auto !important;
      min-width: 0 !important;
    }
    .replay-scoreboard td:nth-child(2),
    .replay-scoreboard th:nth-child(2) {
      max-width: none !important;
    }
    .replay-scoreboard .player-title-badge {
      max-width: 100%;
      white-space: normal;
      line-height: 1.25;
    }
    @media (max-width: 760px) { .replay-stats-grid { grid-template-columns: 1fr !important; } }


    /* v0.92: strzałki, historia przeciwników i czytelne title w bazie przeciwników */
    .opponent-main-cell { min-width: 280px; }
    .opponent-history-line,
    .opponent-history-details { margin-top: 4px; font-size: 12px; color: var(--muted); }
    .opponent-history-line span:first-child { color: var(--muted); }
    .opponent-history-details > summary { cursor: pointer; list-style: none; display: inline-flex; align-items: center; gap: 6px; flex-wrap: wrap; }
    .opponent-history-details > summary::-webkit-details-marker { display: none; }
    .opponent-history-details > summary::after { content: '⌄'; color: var(--muted); font-weight: 900; }
    .opponent-history-details[open] > summary::after { content: '⌃'; }
    .opponent-history-list { display: grid; gap: 4px; margin-top: 5px; padding-left: 10px; border-left: 1px solid var(--line); }
    .opponent-title-badge { margin: 2px 4px 2px 0; vertical-align: middle; }
    .opponents-table td, .opponents-table th { padding-top: 11px; padding-bottom: 11px; }
    .ballchasing-subsection-title { margin-top: 18px; }



    /* v1.29: analizator w stylu okienka bazy przeciwników + bezpieczne optymalizacje renderu. */
    .analyzer-page {
      top: 8px;
      width: min(1560px, 98vw);
      height: calc(100vh - 16px);
      border-radius: 26px;
      background: var(--panel);
      box-shadow: 0 34px 120px rgba(0,0,0,.64), inset 0 0 0 1px rgba(255,255,255,.025);
    }
    .analyzer-page-header {
      padding: 12px 16px 10px;
      background: radial-gradient(circle at 18% 0%, rgba(85,167,255,.14), transparent 38%), rgba(255,255,255,.022);
    }
    .analyzer-frame-wrap { padding: 10px; }
    .replay-analyzer-frame { border-radius: 20px; background: #050607; }
    .stat-card, .card, .compare-kpi, .compare-chart-card, .opponents-section, .entry-card, .season-box, .panel-soft {
      contain: layout paint;
    }
    .compare-table-wrap, .opponents-table-wrap, .replay-table-wrap {
      overscroll-behavior: contain;
    }
    @media (max-width: 760px) {
      .analyzer-page { top: 4px; width: calc(100vw - 8px); height: calc(100vh - 8px); border-radius: 18px; }
      .analyzer-page-header { padding: 10px 12px; }
      .analyzer-frame-wrap { padding: 6px; }
    }


    /* v1.30: wycentrowane strzałki zwijania i czytelniejsze dymki informacji. */
    .stats-section-toggle,
    .opponents-section-arrow {
      display: inline-flex !important;
      align-items: center !important;
      justify-content: center !important;
      line-height: 1 !important;
      text-align: center !important;
      font-family: Inter, ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif !important;
    }
    .stats-section-toggle::before,
    .opponents-section-arrow::before {
      display: block !important;
      width: 100% !important;
      height: 100% !important;
      line-height: 20px !important;
      transform: none !important;
      text-align: center !important;
      font-size: 13px !important;
    }
    .stats-section-toggle::before { content: '▴' !important; }
    .stats-section.collapsed .stats-section-toggle::before,
    .replay-stats-group.collapsed .stats-section-toggle::before { content: '▾' !important; }
    .opponents-section-arrow::before { content: '▴' !important; line-height: 26px !important; }
    .opponents-section-collapsible:not([open]) .opponents-section-arrow::before { content: '▾' !important; transform: none !important; }
    .stat-info-tooltip { font-weight: 700 !important; line-height: 1.45 !important; max-width: min(460px, calc(100vw - 28px)) !important; }

    /* v1.32: baza przeciwników — scroll nad tabelą i sortowanie po kliknięciu nagłówków. */
    .modal-panel.opponents-panel .modal-body {
      overflow-y: auto;
      overscroll-behavior: contain;
      scrollbar-gutter: stable;
    }
    .opponents-content { min-height: 0; }
    .opponents-table-wrap {
      overflow-x: auto;
      overflow-y: visible;
      max-width: 100%;
      overscroll-behavior-x: contain;
      overscroll-behavior-y: auto;
      scrollbar-gutter: stable;
    }
    .opponents-table thead th { position: sticky; top: 0; z-index: 2; background: rgba(10,14,24,.96); }
    .opponents-sort-btn {
      width: 100%;
      border: 0;
      background: transparent;
      color: inherit;
      cursor: pointer;
      display: inline-flex;
      align-items: center;
      justify-content: center;
      gap: 6px;
      padding: 0;
      font: inherit;
      font-weight: 950;
      white-space: nowrap;
    }
    .opponents-sort-btn:hover,
    .opponents-sort-btn.active { color: var(--blue); }
    .opponents-sort-mark { font-size: 10px; opacity: .72; line-height: 1; }
    /* v1.42: pełne tło sticky nagłówków tabel i poprawione przewijanie/wyszukiwarka bazy przeciwników. */
    .comparison-table thead th,
    .opponents-table thead th {
      background: #070b13 !important;
      background-color: #070b13 !important;
      box-shadow: 0 1px 0 rgba(148,163,184,.24), 0 8px 18px rgba(0,0,0,.42) !important;
      backdrop-filter: none !important;
      -webkit-backdrop-filter: none !important;
    }
    .opponents-table-wrap { overscroll-behavior: contain; }


    /* v1.65: przedział skanowania dni i dopracowanie mobilnego UI bez zmian desktopu. */
    /* v1.66: wyrównanie toggle w raporcie replayów i przesuwanie peak/dołka przy MMR chain. */
    .replay-scan-range-grid {
      display: grid;
      grid-template-columns: repeat(2, minmax(0, 1fr));
      gap: 10px;
      margin-top: 8px;
    }
    .replay-scan-range-grid .field { margin: 0; }
    .replay-scan-range-grid .field.compact label { font-size: 11px; line-height: 1.25; }

    @media (max-width: 760px) {
      body > .top-theme-corner,
      .top-theme-corner {
        top: 8px !important;
        right: 8px !important;
        left: 8px !important;
        inset: 8px 8px auto 8px !important;
        justify-content: flex-end !important;
        gap: 5px !important;
        max-width: calc(100vw - 16px) !important;
      }
      .top-theme-corner .theme-picker {
        padding: 4px 6px !important;
        gap: 4px !important;
        font-size: 10px !important;
        max-width: 48vw;
      }
      .top-theme-corner .theme-picker select {
        min-width: 82px !important;
        max-width: 104px !important;
        padding: 5px 22px 5px 7px !important;
        font-size: 10px !important;
      }
      .app {
        width: calc(100% - 12px) !important;
        padding-top: 74px !important;
      }
      .hero { margin-bottom: 12px !important; }
      .title-wrap h1 { font-size: clamp(26px, 9.5vw, 38px) !important; line-height: 1.08 !important; }
      .tracker-switch { padding: 10px !important; border-radius: 16px !important; }
      .tracker-tab, .tracker-subtab, .btn { min-height: 38px; padding: 8px 10px; }
      .tracker-tab, .tracker-subtab { min-width: 0 !important; }
      .form-grid, .replay-import-grid, .replay-scan-range-grid { grid-template-columns: 1fr !important; }
      .chart-wrap { height: 340px !important; min-height: 320px; overflow-x: auto; }
      .chart-inner { min-width: 700px; }
      .table-wrap, .comparison-table-wrap, .opponents-table-wrap, .replay-table-wrap {
        overflow-x: auto !important;
        -webkit-overflow-scrolling: touch;
        max-width: 100%;
      }
      .table-wrap table, .comparison-table, .opponents-table, .replay-scoreboard { min-width: 720px; }
      .stats { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; gap: 8px !important; }
      .stat-card { padding: 10px !important; }
      .modal-panel { width: calc(100vw - 10px) !important; border-radius: 16px !important; }
      .modal-header, .modal-body { padding-left: 12px !important; padding-right: 12px !important; }
    }

    @media (max-width: 430px) {
      .app { padding-top: 86px !important; }
      .stats { grid-template-columns: 1fr !important; }
      .chart-inner { min-width: 640px; }
      .tracker-actions .btn, .actions .btn { width: 100%; }
    }


    /* v1.68: replay toolbar order and resumable folder scan control. */
    .replay-analysis-toolbar { display:flex; flex-wrap:wrap; gap:8px; align-items:center; }
    .replay-quality-report { margin:10px 0 12px; padding:12px 14px; border:1px solid var(--line); border-radius:14px; background:rgba(255,255,255,.035); color:var(--text); white-space:pre-wrap; line-height:1.45; font-size:12px; }
    .replay-quality-report.good { border-color:rgba(48,205,90,.45); background:rgba(48,205,90,.08); }
    .replay-quality-report.warn { border-color:rgba(255,209,102,.50); background:rgba(255,209,102,.09); }
    @media (max-width: 760px) {
      .chart-wrap { height: min(56vh, 380px) !important; min-height: 300px !important; padding: 8px 6px 6px !important; overflow-x: auto !important; overflow-y: hidden !important; cursor: default !important; touch-action: pan-x pan-y !important; }
      .chart-inner { min-width: 980px !important; height: 100% !important; }
      .chart-toolbar { gap: 6px !important; }
      .chart-toolbar .btn, .chart-zoom-actions .btn { min-height: 34px !important; padding: 7px 8px !important; font-size: 11px !important; }
      .custom-chart-legend { gap: 7px 10px !important; padding: 8px 10px !important; font-size: 11px !important; }
      #mmrChart { max-width: none !important; }
    }

    /* v1.76/v1.77: anti-artifact patch — mniej czerwonego glow i mniej GPU blurów przy modalach/panelach. */
    body {
      background:
        radial-gradient(circle at top left, rgba(85, 167, 255, .18), transparent 34rem),
        radial-gradient(circle at top right, rgba(255, 92, 122, .055), transparent 32rem),
        linear-gradient(135deg, #070b16 0%, #0b1020 50%, #10182e 100%) !important;
      isolation: isolate;
    }
    html[data-theme="black"] body {
      background:
        radial-gradient(circle at top left, rgba(85, 167, 255, .075), transparent 28rem),
        radial-gradient(circle at top right, rgba(255, 92, 122, .035), transparent 30rem),
        #000 !important;
    }
    html[data-theme="white"] body {
      background:
        radial-gradient(circle at top left, rgba(30, 111, 217, .10), transparent 34rem),
        radial-gradient(circle at top right, rgba(18, 136, 78, .08), transparent 34rem),
        linear-gradient(135deg, #eef3fb 0%, #f8fafc 52%, #edf2f7 100%) !important;
    }
    .modal-backdrop,
    html[data-theme="black"] .modal-backdrop,
    body.replay-analyzer-mode::after,
    .panel,
    .top-theme-corner .theme-picker,
    .analyzer-page-header {
      backdrop-filter: none !important;
      -webkit-backdrop-filter: none !important;
    }
    .modal-backdrop { background: rgba(3, 7, 18, .86) !important; }
    html[data-theme="black"] .modal-backdrop { background: rgba(0, 0, 0, .90) !important; }
    html[data-theme="white"] .modal-backdrop { background: rgba(15, 23, 42, .38) !important; }
    body.replay-analyzer-mode::after { background: rgba(0,0,0,.70) !important; }
    .modal-panel,
    .analyzer-page,
    .stat-card,
    .card,
    .entry-card,
    .compare-chart-card,
    .opponents-section,
    .replay-stats-group,
    .stats-section {
      backface-visibility: hidden;
      -webkit-font-smoothing: antialiased;
    }
    .player-title-badge .title-dot { box-shadow: 0 0 11px currentColor, 0 0 18px currentColor !important; }
    .title-wrap h1,
    .modal-title h2,
    .stats-section-title,
    .replay-stats-group-title,
    .opponents-section-title h3,
    .compare-mode-title h3,
    .compare-chart-card h3,
    .tactic-form-card h3,
    .tactics-column h3,
    .analyzer-page-title h2 {
      text-shadow: 0 0 18px rgba(85, 167, 255, .28), 0 0 30px rgba(255, 92, 122, .10);
    }
    html[data-theme="white"] .title-wrap h1,
    html[data-theme="white"] .modal-title h2,
    html[data-theme="white"] .stats-section-title,
    html[data-theme="white"] .replay-stats-group-title,
    html[data-theme="white"] .opponents-section-title h3,
    html[data-theme="white"] .compare-mode-title h3,
    html[data-theme="white"] .compare-chart-card h3,
    html[data-theme="white"] .tactic-form-card h3,
    html[data-theme="white"] .tactics-column h3,
    html[data-theme="white"] .analyzer-page-title h2 {
      text-shadow: 0 0 14px rgba(30, 111, 217, .16);
    }

    /* v1.76: content-visibility dla ciężkich sekcji poza ekranem. */
    .stats-section,
    .replay-stats-group,
    .entry-card,
    .match-card,
    .compare-chart-card,
    .compare-kpi,
    .opponents-section,
    .season-box,
    .panel-soft,
    .replay-summary-card,
    .analyzer-card {
      content-visibility: auto;
      contain-intrinsic-size: 1px 320px;
    }
    .opponents-section { contain-intrinsic-size: 1px 420px; }
    .entry-card, .match-card { contain-intrinsic-size: 1px 220px; }
