@import url('https://fonts.googleapis.com/css2?family=Barlow:wght@400;500;600;700;800&family=Barlow+Condensed:wght@600;700&display=swap');

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

  :root {
    --navy:     #1C2B4A;
    --steel:    #3D5A80;
    --rule:     #CBD8E8;
    --input-bg: #F4F7FB;
    --skill-bg: #EFF4FB;
    --label:    #5B7A9D;
    --ghost:    #9AAFC4;
    --white:    #FFFFFF;
    --accent:   #4A90D9;
    --text:     #1C2B4A;
    --warning:  #E67E22;
    --danger:   #C0392B;
    --success:  #27AE60;
    --gold:     #D4A017;
  }

  body {
    font-family: 'Barlow', sans-serif;
    background-color: #0d1f3c;
    background-image: url('/public/img/court-blueprint.svg');
    background-size: 120%;
    background-position: 60% 8%;
    background-attachment: fixed;
    min-height: 100vh;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding: 40px 20px 60px;
  }

  .card {
    background: var(--white);
    width: 100%;
    max-width: 660px;
    border-radius: 2px;
    box-shadow: 0 8px 40px rgba(28,43,74,0.18);
  }

  /* ── Title bar ── */
  .title-bar {
    background: var(--navy);
    padding: 22px 28px 20px;
    display: flex;
    align-items: center;
    gap: 14px;
    border-radius: 2px 2px 0 0;
  }
  .title-accent { width:4px; height:36px; background:var(--accent); border-radius:2px; flex-shrink:0; }
  .title-text h1 {
    font-family: 'Barlow Condensed', sans-serif;
    font-weight: 700; font-size: 20px; letter-spacing: 0.08em; color: var(--white); line-height:1;
  }
  .title-text p { font-size:11px; color:rgba(255,255,255,0.45); letter-spacing:0.06em; margin-top:4px; font-weight:500; }

  /* ── Email section ── */
  .email-section { padding: 20px 28px 0; border-left: 4px solid var(--navy); }
  .email-row { display: flex; gap: 10px; align-items: flex-end; margin-bottom: 6px; }
  .email-field { flex: 1; }
  .email-field label, .field label, .skills-label {
    display: block; font-size: 9px; font-weight: 700; letter-spacing: 0.12em;
    color: var(--label); margin-bottom: 5px; text-transform: uppercase;
  }
  .email-input {
    width: 100%; background: var(--input-bg); border: 1px solid var(--rule); border-radius: 2px;
    padding: 9px 11px; font-family: 'Barlow', sans-serif; font-size: 13px; color: var(--navy);
    transition: border-color 0.15s, box-shadow 0.15s;
  }
  .email-input::placeholder { color: var(--ghost); font-style: italic; }
  .email-input:focus { outline: none; border-color: var(--steel); box-shadow: 0 0 0 3px rgba(61,90,128,0.1); }
  .email-input.error { border-color: var(--danger); }

  .btn-load {
    background: var(--steel); color: var(--white); border: none; border-radius: 2px;
    padding: 9px 16px; font-family: 'Barlow Condensed', sans-serif; font-size: 13px;
    font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; cursor: pointer;
    white-space: nowrap; transition: background 0.15s; height: 36px;
  }
  .btn-load:hover { background: var(--navy); }

  /* ── Usage dashboard ── */
  .usage-dashboard {
    display: none; margin: 14px 0 0; background: var(--input-bg);
    border: 1px solid var(--rule); border-radius: 2px; padding: 12px 14px;
  }
  .usage-dashboard.visible { display: block; }
  .usage-top { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
  .usage-label { font-size: 9px; font-weight: 700; letter-spacing: 0.12em; color: var(--label); text-transform: uppercase; }
  .usage-count { font-size: 12px; font-weight: 700; color: var(--steel); }
  .usage-count.warning { color: var(--warning); }
  .usage-count.danger { color: var(--danger); }
  .progress-bar-wrap { background: var(--rule); border-radius: 2px; height: 6px; overflow: hidden; }
  .progress-bar-fill { height: 100%; border-radius: 2px; background: var(--accent); transition: width 0.4s ease; }
  .progress-bar-fill.warning { background: var(--warning); }
  .progress-bar-fill.danger { background: var(--danger); }
  .usage-warning { display: none; margin-top: 8px; font-size: 11px; color: var(--warning); font-weight: 600; }
  .usage-warning.visible { display: block; }

  /* ── Limit reached ── */
  .limit-screen {
    display: none; margin: 14px 0 0; background: #FDF0EF;
    border: 1px solid #F5C6C2; border-radius: 2px; padding: 16px; text-align: center;
  }
  .limit-screen.visible { display: block; }
  .limit-screen h3 { font-family: 'Barlow Condensed', sans-serif; font-size: 16px; font-weight: 700; color: var(--danger); letter-spacing: 0.05em; margin-bottom: 8px; }
  .limit-screen p { font-size: 13px; color: #6B2D2D; line-height: 1.6; margin-bottom: 10px; }
  .limit-screen a { color: var(--accent); font-weight: 700; text-decoration: none; }
  .limit-screen a:hover { text-decoration: underline; }

  /* ── Form slide-down ── */
  .form-wrapper {
    overflow: hidden; max-height: 0; opacity: 0;
    transition: max-height 0.5s ease, opacity 0.4s ease;
  }
  .form-wrapper.revealed { max-height: 8000px; opacity: 1; }

  /* ── Mode toggle ── */
  .mode-toggle-row {
    display: flex; gap: 0; padding: 20px 28px 0;
  }
  .mode-btn {
    flex: 1; padding: 10px 14px;
    background: var(--input-bg); border: 1px solid var(--rule);
    color: var(--label); font-family: 'Barlow Condensed', sans-serif;
    font-size: 13px; font-weight: 700; letter-spacing: 0.08em;
    text-transform: uppercase; cursor: pointer;
    transition: background 0.15s, color 0.15s, border-color 0.15s;
  }
  .mode-btn:first-child { border-radius: 2px 0 0 2px; }
  .mode-btn:last-child  { border-radius: 0 2px 2px 0; border-left: none; }
  .mode-btn.active {
    background: var(--navy); color: var(--white); border-color: var(--navy);
  }
  .mode-btn:hover:not(.active) { background: var(--skill-bg); color: var(--steel); }

  /* ── Form ── */
  .form-body { padding: 0 28px 24px; border-left: 4px solid var(--navy); }
  .fields-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 20px; }
  .field { margin-bottom: 18px; }

  .field select {
    width: 100%; background: var(--input-bg); border: 1px solid var(--rule); border-radius: 2px;
    padding: 9px 30px 9px 11px; font-family: 'Barlow', sans-serif; font-size: 13px; color: var(--navy);
    appearance: none; -webkit-appearance: none; cursor: pointer;
    transition: border-color 0.15s, box-shadow 0.15s;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='7' viewBox='0 0 12 7'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%239AAFC4' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat; background-position: right 10px center;
  }
  .field select:focus { outline: none; border-color: var(--steel); box-shadow: 0 0 0 3px rgba(61,90,128,0.1); }
  .field select.unset { color: var(--ghost); font-style: italic; }

  /* ── Player stepper ── */
  .player-stepper {
    display: flex; align-items: center;
    background: var(--input-bg); border: 1px solid var(--rule); border-radius: 2px; overflow: hidden; height: 36px;
  }
  .stepper-btn {
    width: 34px; height: 100%; background: var(--steel); color: var(--white);
    border: none; font-size: 18px; font-weight: 700; cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    transition: background 0.15s; flex-shrink: 0; line-height: 1;
  }
  .stepper-btn:hover { background: var(--navy); }
  .stepper-btn:disabled { background: var(--rule); color: var(--ghost); cursor: not-allowed; }
  .stepper-input {
    flex: 1; border: none; background: transparent; text-align: center;
    font-family: 'Barlow', sans-serif; font-size: 14px; font-weight: 700; color: var(--navy);
    outline: none; min-width: 0;
  }
  .stepper-input::-webkit-inner-spin-button,
  .stepper-input::-webkit-outer-spin-button { -webkit-appearance: none; }

  /* ── Divider ── */
  .divider { height: 1px; background: var(--rule); margin: 6px 0 20px; }

  /* ── Skills section ── */
  .skills-label { margin-bottom: 10px; }
  .skills-optional { font-weight: 400; color: var(--ghost); text-transform: none; letter-spacing: 0; font-size: 9px; }
  .skills-list { display: flex; flex-direction: column; gap: 10px; margin-bottom: 16px; }

  .skill-block { display: flex; flex-direction: column; gap: 5px; }
  .skill-row { display: flex; align-items: center; gap: 10px; }
  .skill-num { font-size: 10px; font-weight: 700; color: var(--steel); width: 14px; text-align: right; flex-shrink: 0; }

  .skill-search-wrap { flex: 1; position: relative; }
  .skill-input {
    width: 100%; background: var(--skill-bg); border: 1px solid var(--rule); border-radius: 2px;
    padding: 8px 28px 8px 11px; font-family: 'Barlow', sans-serif; font-size: 13px; color: var(--navy);
    transition: border-color 0.15s, box-shadow 0.15s;
  }
  .skill-input::placeholder { color: var(--ghost); font-style: italic; }
  .skill-input:focus { outline: none; border-color: var(--steel); box-shadow: 0 0 0 3px rgba(61,90,128,0.1); }
  .skill-clear {
    position: absolute; right: 8px; top: 50%; transform: translateY(-50%);
    background: none; border: none; color: var(--ghost); cursor: pointer; font-size: 13px; display: none;
  }
  .skill-clear:hover { color: var(--steel); }
  .skill-clear.visible { display: block; }

  .skill-dropdown {
    position: absolute; top: calc(100% + 3px); left: 0; right: 0;
    background: var(--white); border: 1px solid var(--rule); border-radius: 2px;
    box-shadow: 0 6px 24px rgba(28,43,74,0.15); max-height: 210px; overflow-y: auto; z-index: 1000; display: none;
  }
  .skill-dropdown.open { display: block; }
  .skill-dropdown::-webkit-scrollbar { width: 4px; }
  .skill-dropdown::-webkit-scrollbar-thumb { background: var(--rule); border-radius: 2px; }
  .dropdown-item {
    padding: 9px 12px; font-size: 13px; color: var(--navy); cursor: pointer;
    border-bottom: 1px solid #F0F4F9; transition: background 0.08s;
  }
  .dropdown-item:last-child { border-bottom: none; }
  .dropdown-item:hover, .dropdown-item.active { background: var(--skill-bg); color: var(--steel); }
  .dropdown-item mark { background: none; color: var(--accent); font-weight: 700; }
  .dropdown-empty { padding: 10px 12px; font-size: 12px; color: var(--ghost); font-style: italic; }

  /* ── Time allocation row ── */
  .time-alloc-row {
    display: none; align-items: center; gap: 8px; padding-left: 24px; flex-wrap: wrap;
  }
  .time-alloc-row.visible { display: flex; }
  .time-alloc-label { font-size: 10px; color: var(--label); font-weight: 600; white-space: nowrap; }
  .time-alloc-select {
    background: var(--input-bg); border: 1px solid var(--rule); border-radius: 2px;
    padding: 5px 24px 5px 8px; font-family: 'Barlow', sans-serif; font-size: 12px; color: var(--navy);
    appearance: none; -webkit-appearance: none; cursor: pointer;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%239AAFC4' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat; background-position: right 7px center;
  }
  .time-alloc-select:focus { outline: none; border-color: var(--steel); }

  /* ── Split G/B checkbox ── */
  .split-checkbox-label {
    display: flex; align-items: center; gap: 5px; cursor: pointer;
    font-size: 10px; font-weight: 700; letter-spacing: 0.08em;
    color: var(--ghost); text-transform: uppercase; user-select: none;
    padding: 4px 8px; border: 1px solid var(--rule); border-radius: 2px;
    background: var(--white); transition: color 0.15s, border-color 0.15s, background 0.15s;
    white-space: nowrap;
  }
  .split-checkbox-label:hover { color: var(--steel); border-color: var(--steel); }
  .split-checkbox-label.active { color: var(--accent); border-color: var(--accent); background: var(--skill-bg); }
  .split-checkbox { accent-color: var(--accent); width: 12px; height: 12px; cursor: pointer; }

  /* ── Time tracker ── */
  .time-tracker {
    display: none; background: var(--skill-bg); border: 1px solid var(--rule);
    border-radius: 2px; padding: 10px 14px; margin-bottom: 20px;
  }
  .time-tracker.visible { display: block; }
  .time-tracker-top { display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px; }
  .time-tracker-label { font-size: 9px; font-weight: 700; letter-spacing: 0.1em; color: var(--label); text-transform: uppercase; }
  .time-tracker-nums { font-size: 12px; font-weight: 700; color: var(--steel); }
  .time-tracker-nums.over { color: var(--danger); }
  .time-track-bar-wrap { background: var(--rule); border-radius: 2px; height: 5px; overflow: hidden; }
  .time-track-bar-fill { height: 100%; border-radius: 2px; background: var(--accent); transition: width 0.3s ease; }
  .time-track-bar-fill.over { background: var(--danger); }
  .time-tracker-note { font-size: 10px; color: var(--ghost); margin-top: 5px; }
  .time-tracker-note.over { color: var(--danger); font-weight: 600; }

  /* ── Generate button ── */
  .btn-generate {
    width: 100%; background: var(--navy); color: var(--white); border: none; border-radius: 2px;
    padding: 14px; font-family: 'Barlow Condensed', sans-serif; font-size: 14px; font-weight: 700;
    letter-spacing: 0.1em; text-transform: uppercase; cursor: pointer;
    transition: background 0.15s; display: flex; align-items: center; justify-content: center; gap: 8px;
  }
  .btn-generate:hover { background: var(--steel); }
  .btn-generate:disabled { background: #8fa3bc; cursor: not-allowed; }

  /* ── Output section ── */
  .output-section { border-top: 1px solid var(--rule); padding: 28px 28px 32px; border-left: 4px solid var(--navy); display: none; }
  .output-section.visible { display: block; }
  .timing-notice {
    display: flex; align-items: flex-start; gap: 10px;
    background: #F4F7FB; border: 1px solid var(--rule); border-radius: 2px;
    padding: 12px 14px; margin-bottom: 20px;
  }
  .timing-notice .icon { font-size: 15px; flex-shrink: 0; margin-top: 1px; }
  .timing-notice p { font-size: 12px; color: var(--label); line-height: 1.5; }
  .timing-notice strong { color: var(--steel); }

  /* ── Loading ── */
  .loading-wrap { padding: 30px 0; display: flex; flex-direction: column; align-items: center; gap: 14px; }
  .loading-dots { display: flex; gap: 6px; }
  .loading-dots span {
    width: 8px; height: 8px; background: var(--steel); border-radius: 50%;
    animation: bounce 1.2s infinite ease-in-out;
  }
  .loading-dots span:nth-child(2) { animation-delay: 0.2s; }
  .loading-dots span:nth-child(3) { animation-delay: 0.4s; }
  @keyframes bounce { 0%,80%,100%{transform:scale(0.6);opacity:0.4;} 40%{transform:scale(1);opacity:1;} }
  .loading-text { font-size: 12px; color: var(--ghost); letter-spacing: 0.05em; }

  /* ── Plan output ── */
  .plan-output {
    background: var(--white); border: 1px solid var(--rule); border-radius: 2px;
    padding: 28px 30px; color: var(--text); line-height: 1.7;
  }
  .plan-output h1 {
    font-family: 'Barlow Condensed', sans-serif; font-size: 22px; font-weight: 700;
    color: var(--navy); letter-spacing: 0.04em; margin-bottom: 6px; margin-top: 0;
    border-bottom: 2px solid var(--accent); padding-bottom: 10px;
  }
  .plan-output h2, .section-h2 {
    font-family: 'Barlow Condensed', sans-serif; font-size: 17px; font-weight: 700;
    color: #FFFFFF; letter-spacing: 0.05em;
    background: var(--navy); padding: 8px 14px; margin: 0 -30px 16px;
    border-left: 4px solid var(--accent);
    display: flex; align-items: center; gap: 10px; cursor: grab;
  }
  .plan-output h2:active, .section-h2:active { cursor: grabbing; }
  .plan-output h3 {
    font-size: 14px; font-weight: 700; color: var(--steel);
    text-transform: uppercase; letter-spacing: 0.08em;
    margin: 20px 0 8px; border-bottom: 1px solid var(--rule); padding-bottom: 5px;
  }
  .plan-output h4 { font-size: 13px; font-weight: 700; color: var(--navy); margin: 14px 0 5px; }
  .plan-output p { font-size: 14px; margin-bottom: 12px; color: #2C3E58; }
  .plan-output ul, .plan-output ol { margin: 8px 0 14px 0; padding-left: 20px; }
  .plan-output li { font-size: 14px; margin-bottom: 6px; color: #2C3E58; }
  .plan-output ul li::marker { color: var(--accent); }
  .plan-output ol li::marker { color: var(--steel); font-weight: 700; }
  .plan-output strong { font-weight: 700; color: var(--navy); }
  .plan-output em { font-style: italic; color: var(--steel); }
  .plan-output hr { border: none; border-top: 1px solid var(--rule); margin: 20px 0; }
  .plan-output code {
    font-family: 'Barlow', sans-serif; background: var(--skill-bg);
    border: 1px solid var(--rule); border-radius: 2px; padding: 1px 5px; font-size: 13px;
  }
  .plan-output blockquote {
    border-left: 3px solid var(--accent); padding: 10px 16px;
    margin: 14px 0; background: var(--skill-bg); border-radius: 0 2px 2px 0;
  }
  .plan-output blockquote p { margin: 0; font-style: italic; color: var(--steel); }
  .error-msg { color: #c0392b; font-size: 13px; padding: 12px; background: #fdf0ef; border: 1px solid #f5c6c2; border-radius: 2px; }

  .footer-bar { height: 6px; background: var(--navy); border-radius: 0 0 2px 2px; }
  #printButtons.visible { display: block !important; }

  /* ── Summary section ── */
  .summary-section { display: none; margin-top: 32px; border-top: 3px solid #1C2B4A; padding-top: 24px; }
  .summary-section.visible { display: block; }
  .summary-loading { padding: 20px 0; display: flex; flex-direction: column; align-items: center; gap: 14px; }

  /* ── Section blocks ── */
  .section-block { margin-bottom: 4px; }
  .section-block-ghost { opacity: 0.4; background: var(--skill-bg); border: 2px dashed var(--accent); border-radius: 2px; }
  .section-block-chosen { box-shadow: 0 4px 20px rgba(28,43,74,0.18); }

  .section-drag-handle {
    font-size: 16px; color: rgba(255,255,255,0.5); cursor: grab;
    flex-shrink: 0; line-height: 1; transition: color 0.15s;
  }
  .section-drag-handle:hover { color: rgba(255,255,255,0.9); }
  .section-drag-handle:active { cursor: grabbing; }

  /* ── Drill cards ── */
  .drill-card { border: 1px solid var(--rule); border-radius: 2px; margin-bottom: 10px; overflow: hidden; background: var(--white); }
  .drill-card-custom .drill-header { border-left-color: var(--warning); }

  .drill-header {
    display: flex; justify-content: space-between; align-items: center;
    padding: 12px 16px; background: var(--skill-bg); cursor: pointer;
    user-select: none; transition: background 0.15s;
    border-left: 4px solid var(--accent); gap: 10px;
  }
  .drill-header:hover { background: #e4edf8; }

  .drill-drag-handle {
    font-size: 16px; color: var(--ghost); cursor: grab;
    flex-shrink: 0; line-height: 1; padding: 0 2px; transition: color 0.15s;
  }
  .drill-drag-handle:hover { color: var(--steel); }
  .drill-drag-handle:active { cursor: grabbing; }

  .drill-header-left { display: flex; align-items: center; gap: 10px; flex: 1; min-width: 0; }
  .drill-chevron { font-size: 9px; color: var(--accent); width: 12px; flex-shrink: 0; }
  .drill-name {
    font-family: 'Barlow Condensed', sans-serif; font-size: 15px; font-weight: 700;
    color: var(--navy); letter-spacing: 0.04em; text-transform: uppercase;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  }
  .drill-time { font-size: 11px; font-weight: 700; color: var(--accent); letter-spacing: 0.05em; white-space: nowrap; flex-shrink: 0; }
  .drill-summary { padding: 8px 16px 10px 42px; font-size: 13px; color: var(--label); line-height: 1.5; background: var(--skill-bg); border-top: 1px solid var(--rule); }
  .drill-body { display: none; padding: 16px; border-top: 1px solid var(--rule); background: var(--white); }
  .drill-card.open .drill-body { display: block; }

  .drill-section { margin-bottom: 14px; }
  .drill-section:last-child { margin-bottom: 0; }
  .drill-section-label { font-size: 9px; font-weight: 700; letter-spacing: 0.14em; text-transform: uppercase; color: var(--accent); margin-bottom: 6px; padding-bottom: 4px; border-bottom: 1px solid var(--rule); }
  .drill-section-content { font-size: 13px; color: #2C3E58; line-height: 1.6; }
  .drill-section-content p { margin-bottom: 6px; }
  .drill-section-content p:last-child { margin-bottom: 0; }
  .drill-section-content ul { padding-left: 18px; margin: 4px 0; }
  .drill-section-content li { margin-bottom: 4px; }
  .drill-section-content li::marker { color: var(--accent); }
  .drill-section-content strong { color: var(--navy); font-weight: 700; }
  .drill-section-content em { color: var(--steel); font-style: italic; }

  .drill-card-ghost { opacity: 0.4; background: var(--skill-bg); }
  .drill-card-chosen { box-shadow: 0 4px 20px rgba(28,43,74,0.2); }
  .drill-card-drag { box-shadow: 0 8px 30px rgba(28,43,74,0.25); transform: rotate(0.5deg); }

  /* ── Game Data Panel ── */
  .game-data-section { margin-bottom: 20px; }

  .btn-game-data-toggle {
    width: 100%; padding: 10px 14px; background: transparent;
    border: 1px solid var(--accent); border-radius: 2px; color: var(--accent);
    font-family: 'Barlow Condensed', sans-serif; font-size: 13px; font-weight: 700;
    letter-spacing: 0.1em; text-transform: uppercase; cursor: pointer;
    transition: background 0.15s, color 0.15s;
    display: flex; align-items: center; justify-content: center; gap: 8px;
  }
  .btn-game-data-toggle:hover,
  .btn-game-data-toggle.active { background: var(--accent); color: var(--white); }

  .game-data-panel {
    display: none; margin-top: 10px;
    border: 1px solid var(--accent); border-radius: 2px; overflow: hidden;
  }
  .game-data-panel.open { display: block; }

  .game-data-header {
    background: var(--accent); padding: 10px 16px;
    display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 6px;
  }
  .game-data-header span:first-child {
    font-family: 'Barlow Condensed', sans-serif; font-size: 13px; font-weight: 700;
    letter-spacing: 0.1em; color: var(--white);
  }
  .game-data-subtitle {
    font-size: 10px; color: rgba(255,255,255,0.75); font-style: italic; font-weight: 400;
    letter-spacing: 0;
  }

  /* ── Stat type toggle ── */
  .stat-type-row {
    display: flex; gap: 0; padding: 12px 16px 0;
  }
  .stat-type-btn {
    flex: 1; padding: 7px 10px; background: var(--input-bg);
    border: 1px solid var(--rule); color: var(--label);
    font-family: 'Barlow Condensed', sans-serif; font-size: 12px; font-weight: 700;
    letter-spacing: 0.08em; text-transform: uppercase; cursor: pointer;
    transition: background 0.15s, color 0.15s, border-color 0.15s;
  }
  .stat-type-btn:first-child { border-radius: 2px 0 0 2px; }
  .stat-type-btn:last-child  { border-radius: 0 2px 2px 0; border-left: none; }
  .stat-type-btn.active { background: var(--navy); color: var(--white); border-color: var(--navy); }
  .stat-type-btn:hover:not(.active) { background: var(--skill-bg); color: var(--steel); }

  /* ── Stat grid ── */
  .stat-grid {
    display: grid; grid-template-columns: 1fr 1fr; gap: 16px;
    padding: 14px 16px 0;
  }
  .stat-group-wide { grid-column: 1 / -1; }

  .stat-group-label {
    font-size: 9px; font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase;
    color: var(--label); margin-bottom: 8px;
  }
  .stat-fields { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 8px; }
  .stat-fields-4 { grid-template-columns: 1fr 1fr 1fr 1fr; }

  .stat-field { display: flex; flex-direction: column; gap: 4px; }

  .stat-field label {
    font-size: 9px; font-weight: 700; letter-spacing: 0.1em; color: var(--label); text-transform: uppercase;
  }
  .stat-field input {
    width: 100%; background: var(--white); border: 1px solid var(--rule); border-radius: 2px;
    padding: 6px 8px; font-family: 'Barlow', sans-serif; font-size: 13px; color: var(--navy);
    transition: border-color 0.15s, box-shadow 0.15s;
    -moz-appearance: textfield;
  }
  .stat-field input::-webkit-inner-spin-button,
  .stat-field input::-webkit-outer-spin-button { -webkit-appearance: none; }
  .stat-field input::placeholder { color: var(--ghost); font-style: italic; font-size: 11px; }
  .stat-field input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(74,144,217,0.12); }

  /* ── Individual player stats ── */
  .player-stats-header {
    display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 6px;
    padding: 10px 16px; margin-top: 4px;
    background: var(--navy); border-top: 2px solid var(--accent);
    font-family: 'Barlow Condensed', sans-serif; font-size: 12px; font-weight: 700;
    letter-spacing: 0.1em; color: var(--white);
  }
  .player-stats-subtitle {
    font-size: 10px; color: rgba(255,255,255,0.65); font-style: italic; font-weight: 400; letter-spacing: 0;
  }

  .player-name-row { margin-bottom: 0; }
  .player-name-input {
    width: 100%; background: var(--white); border: 1px solid var(--rule); border-radius: 2px;
    padding: 7px 10px; font-family: 'Barlow', sans-serif; font-size: 13px; color: var(--navy);
    transition: border-color 0.15s, box-shadow 0.15s;
  }
  .player-name-input::placeholder { color: var(--ghost); font-style: italic; }
  .player-name-input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(74,144,217,0.12); }

  /* ── File upload ── */
  .stats-upload-row { padding: 14px 16px 0; }
  .stats-upload-label {
    font-size: 9px; font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase;
    color: var(--label); margin-bottom: 8px;
  }
  .stats-upload-controls { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

  .stats-file-label {
    flex: 1; min-width: 0; cursor: pointer;
    background: var(--white); border: 1px solid var(--rule); border-radius: 2px;
    padding: 7px 10px; font-size: 12px; color: var(--label);
    transition: border-color 0.15s; display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  }
  .stats-file-label:hover { border-color: var(--accent); color: var(--steel); }
  .stats-file-label input[type="file"] { display: none; }

  .btn-parse-stats {
    flex-shrink: 0; padding: 7px 14px; background: var(--accent); color: var(--white);
    border: none; border-radius: 2px;
    font-family: 'Barlow Condensed', sans-serif; font-size: 12px; font-weight: 700;
    letter-spacing: 0.08em; text-transform: uppercase; cursor: pointer;
    transition: background 0.15s;
  }
  .btn-parse-stats:hover { background: var(--steel); }
  .btn-parse-stats:disabled { background: var(--ghost); cursor: not-allowed; }

  .stats-parse-status {
    margin-top: 6px; font-size: 11px; font-weight: 600; min-height: 16px;
  }
  .stats-parse-status.success { color: var(--success); }
  .stats-parse-status.error   { color: var(--danger); }
  .stats-parse-status.loading { color: var(--label); }

  /* ── Game data footer ── */
  .game-data-footer {
    padding: 12px 16px 14px; display: flex; justify-content: flex-end;
    border-top: 1px solid var(--rule); margin-top: 14px;
    background: var(--input-bg);
  }
  .btn-clear-stats {
    padding: 6px 14px; background: transparent; color: var(--ghost);
    border: 1px solid var(--rule); border-radius: 2px;
    font-family: 'Barlow Condensed', sans-serif; font-size: 11px; font-weight: 700;
    letter-spacing: 0.08em; text-transform: uppercase; cursor: pointer;
    transition: color 0.15s, border-color 0.15s;
  }
  .btn-clear-stats:hover { color: var(--danger); border-color: var(--danger); }

  /* ── Custom Drill Form ── */
  .custom-drill-toggle-row { margin-top: 14px; }
  .btn-custom-drill-toggle {
    width: 100%; padding: 10px 14px; background: transparent;
    border: 1px dashed var(--steel); border-radius: 2px; color: var(--steel);
    font-family: 'Barlow Condensed', sans-serif; font-size: 13px; font-weight: 700;
    letter-spacing: 0.1em; text-transform: uppercase; cursor: pointer;
    transition: background 0.15s, color 0.15s;
  }
  .btn-custom-drill-toggle:hover { background: var(--skill-bg); color: var(--navy); }

  .custom-drill-form { display: none; margin-top: 12px; border: 1px solid var(--rule); border-radius: 2px; overflow: hidden; }
  .custom-drill-form.open { display: block; }

  .custom-drill-form-header {
    display: flex; justify-content: space-between; align-items: center;
    padding: 10px 16px; background: var(--navy);
    font-family: 'Barlow Condensed', sans-serif; font-size: 13px; font-weight: 700;
    letter-spacing: 0.1em; color: var(--white);
  }
  .custom-drill-close { background: none; border: none; color: rgba(255,255,255,0.6); cursor: pointer; font-size: 14px; line-height: 1; padding: 0; transition: color 0.15s; }
  .custom-drill-close:hover { color: var(--white); }

  .custom-drill-fields { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 16px; padding: 16px; background: var(--input-bg); }
  .custom-field { display: flex; flex-direction: column; gap: 5px; }
  .custom-field-full { grid-column: 1 / -1; }
  .custom-field label { font-size: 9px; font-weight: 700; letter-spacing: 0.12em; color: var(--label); text-transform: uppercase; }
  .custom-field .required { color: var(--danger); }

  .custom-field input,
  .custom-field textarea {
    width: 100%; background: var(--white); border: 1px solid var(--rule); border-radius: 2px;
    padding: 8px 10px; font-family: 'Barlow', sans-serif; font-size: 13px; color: var(--navy);
    resize: vertical; transition: border-color 0.15s, box-shadow 0.15s;
  }
  .custom-field input::placeholder,
  .custom-field textarea::placeholder { color: var(--ghost); font-style: italic; }
  .custom-field input:focus,
  .custom-field textarea:focus { outline: none; border-color: var(--steel); box-shadow: 0 0 0 3px rgba(61,90,128,0.1); }

  .cd-time-wrap { display: flex; align-items: center; gap: 8px; }
  .cd-time-wrap input[type="number"] { width: 80px; flex-shrink: 0; -moz-appearance: textfield; }
  .cd-time-wrap input[type="number"]::-webkit-inner-spin-button,
  .cd-time-wrap input[type="number"]::-webkit-outer-spin-button { -webkit-appearance: none; }
  .cd-time-unit { font-size: 12px; color: var(--label); font-weight: 600; white-space: nowrap; }

  .custom-drill-actions { display: flex; gap: 10px; padding: 12px 16px; background: var(--white); border-top: 1px solid var(--rule); }
  .btn-save-drill {
    flex: 1; padding: 10px; background: var(--navy); color: var(--white); border: none; border-radius: 2px;
    font-family: 'Barlow Condensed', sans-serif; font-size: 13px; font-weight: 700;
    letter-spacing: 0.08em; text-transform: uppercase; cursor: pointer; transition: background 0.15s;
  }
  .btn-save-drill:hover { background: var(--steel); }
  .btn-clear-drill {
    padding: 10px 16px; background: transparent; color: var(--ghost); border: 1px solid var(--rule); border-radius: 2px;
    font-family: 'Barlow Condensed', sans-serif; font-size: 13px; font-weight: 700;
    letter-spacing: 0.08em; text-transform: uppercase; cursor: pointer; transition: color 0.15s, border-color 0.15s;
  }
  .btn-clear-drill:hover { color: var(--steel); border-color: var(--steel); }
  .custom-drill-error { padding: 0 16px 12px; font-size: 12px; color: var(--danger); font-weight: 600; background: var(--white); min-height: 0; }
