    /* ==========================================================================
       カラーパレット & デザイントークン（ダークスレート＆ロイヤルネイビー基調）
       ========================================================================== */
    :root {
      --bg-body: #090e1a;
      --bg-surface: #0f172a;
      --bg-surface-elevated: #162038;
      --bg-surface-hover: #1c2947;
      --bg-input: #0b1222;
      --border-subtle: #1e293b;
      --border-strong: #334155;
      --border-accent: rgba(234, 179, 8, 0.45);

      --text-primary: #f1f5f9;
      --text-secondary: #94a3b8;
      --text-muted: #64748b;

      --gold: #eab308;
      --gold-soft: rgba(234, 179, 8, 0.14);
      --indigo: #6366f1;
      --indigo-soft: rgba(99, 102, 241, 0.16);
      --sky: #38bdf8;
      --sky-soft: rgba(56, 189, 248, 0.15);
      --emerald: #10b981;
      --emerald-soft: rgba(16, 185, 129, 0.16);
      --rose: #f43f5e;
      --rose-soft: rgba(244, 63, 94, 0.16);
      --amber: #f59e0b;
      --amber-soft: rgba(245, 158, 11, 0.16);

      --radius-sm: 6px;
      --radius-md: 10px;
      --radius-lg: 14px;
      --shadow-card: 0 8px 24px rgba(0, 0, 0, 0.35);
      --font-sans: "Inter", "Hiragino Kaku Gothic ProN", "Hiragino Sans", "Yu Gothic", "Meiryo", system-ui, -apple-system, sans-serif;
      --font-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
    }

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

    html, body {
      margin: 0;
      padding: 0;
      background-color: var(--bg-body);
      background-image:
        radial-gradient(ellipse 80% 50% at 50% -15%, rgba(49, 46, 129, 0.32), transparent),
        radial-gradient(ellipse 50% 40% at 95% 10%, rgba(234, 179, 8, 0.08), transparent);
      color: var(--text-primary);
      font-family: var(--font-sans);
      font-size: 14px;
      line-height: 1.5;
      min-height: 100vh;
      -webkit-font-smoothing: antialiased;
    }

    /* ==========================================================================
       レイアウト
       ========================================================================== */
    .app-container {
      width: 100%;
      max-width: 1480px;
      margin: 0 auto;
      padding: 18px 16px 36px;
    }

    @media (min-width: 768px) {
      .app-container {
        padding: 24px 24px 44px;
      }
    }

    /* ヘッダー */
    .app-header {
      display: flex;
      flex-wrap: wrap;
      align-items: center;
      justify-content: space-between;
      gap: 12px;
      margin-bottom: 18px;
    }

    .title-group {
      display: flex;
      align-items: center;
      gap: 12px;
    }

    .emblem {
      width: 42px;
      height: 42px;
      border-radius: 12px;
      background: linear-gradient(135deg, #1e1b4b, #312e81);
      border: 1px solid var(--border-accent);
      display: flex;
      align-items: center;
      justify-content: center;
      font-size: 20px;
      box-shadow: 0 4px 14px rgba(234, 179, 8, 0.15);
      flex-shrink: 0;
    }

    .app-title {
      margin: 0;
      font-size: 1.3rem;
      font-weight: 800;
      letter-spacing: 0.02em;
      background: linear-gradient(90deg, #fef08a, #f8fafc 60%, #93c5fd);
      background-clip: text;
      -webkit-background-clip: text;
      -webkit-text-fill-color: transparent;
    }

    .app-subtitle {
      margin: 2px 0 0;
      font-size: 0.78rem;
      color: var(--text-secondary);
    }

    /* ==========================================================================
       ツールバー
       ========================================================================== */
    .toolbar {
      display: flex;
      flex-wrap: wrap;
      align-items: center;
      justify-content: space-between;
      gap: 10px;
      background: var(--bg-surface);
      border: 1px solid var(--border-subtle);
      border-radius: var(--radius-lg);
      padding: 12px 14px;
      margin-bottom: 14px;
    }

    .toolbar-group {
      display: flex;
      flex-wrap: wrap;
      align-items: center;
      gap: 8px;
    }

    .btn {
      display: inline-flex;
      align-items: center;
      justify-content: center;
      gap: 6px;
      padding: 8px 13px;
      border-radius: var(--radius-md);
      font-family: inherit;
      font-size: 0.82rem;
      font-weight: 600;
      border: 1px solid var(--border-strong);
      background: var(--bg-surface-elevated);
      color: var(--text-primary);
      cursor: pointer;
      transition: background-color 0.15s ease, border-color 0.15s ease, transform 0.1s ease;
      white-space: nowrap;
      min-height: 36px;
    }

    .btn:hover {
      background: var(--bg-surface-hover);
      border-color: #475569;
    }

    .btn:active {
      transform: translateY(1px);
    }

    .btn-primary {
      background: linear-gradient(180deg, #4f46e5, #4338ca);
      border-color: #6366f1;
      color: #ffffff;
    }

    .btn-primary:hover {
      background: linear-gradient(180deg, #6366f1, #4f46e5);
      border-color: #818cf8;
    }

    .btn-teal {
      background: linear-gradient(180deg, #0d9488, #0f766e);
      border-color: #14b8a6;
      color: #ffffff;
    }

    .btn-teal:hover {
      background: linear-gradient(180deg, #14b8a6, #0d9488);
      border-color: #2dd4bf;
    }

    .btn-gold {
      background: rgba(234, 179, 8, 0.12);
      border-color: rgba(234, 179, 8, 0.45);
      color: #fde047;
    }

    .btn-gold:hover {
      background: rgba(234, 179, 8, 0.22);
      border-color: rgba(234, 179, 8, 0.7);
    }

    .btn-danger {
      background: rgba(244, 63, 94, 0.12);
      border-color: rgba(244, 63, 94, 0.4);
      color: #fda4af;
    }

    .btn-danger:hover {
      background: rgba(244, 63, 94, 0.24);
      border-color: rgba(244, 63, 94, 0.65);
    }

    .btn svg {
      width: 15px;
      height: 15px;
      flex-shrink: 0;
    }

    .hint-bar {
      display: flex;
      flex-wrap: wrap;
      gap: 12px;
      font-size: 0.75rem;
      color: var(--text-secondary);
      margin-bottom: 10px;
      padding: 0 4px;
    }

    .hint-item {
      display: inline-flex;
      align-items: center;
      gap: 5px;
    }

    .hint-dot {
      width: 6px;
      height: 6px;
      border-radius: 50%;
      background: var(--gold);
    }

    /* ==========================================================================
       メインテーブル
       ========================================================================== */
    .table-card {
      background: var(--bg-surface);
      border: 1px solid var(--border-subtle);
      border-radius: var(--radius-lg);
      box-shadow: var(--shadow-card);
      overflow: hidden;
    }

    .table-scroll {
      width: 100%;
      max-height: 70vh;
      overflow: auto;
      position: relative;
      -webkit-overflow-scrolling: touch;
    }

    /* スクロールバー装飾 */
    .table-scroll::-webkit-scrollbar {
      width: 10px;
      height: 10px;
    }
    .table-scroll::-webkit-scrollbar-track {
      background: #0b1120;
    }
    .table-scroll::-webkit-scrollbar-thumb {
      background: #334155;
      border-radius: 5px;
      border: 2px solid #0b1120;
    }
    .table-scroll::-webkit-scrollbar-thumb:hover {
      background: #475569;
    }

    table.calc-table {
      width: 100%;
      border-collapse: separate;
      border-spacing: 0;
      min-width: 1020px;
      font-size: 0.84rem;
    }

    table.calc-table thead th {
      position: sticky;
      top: 0;
      z-index: 20;
      background: #131d35;
      color: #cbd5e1;
      font-size: 0.74rem;
      font-weight: 700;
      letter-spacing: 0.03em;
      padding: 10px 8px;
      border-bottom: 2px solid #293859;
      text-align: center;
      white-space: nowrap;
      vertical-align: middle;
    }

    table.calc-table thead th.col-event,
    table.calc-table thead th.col-remark {
      text-align: left;
    }

    table.calc-table thead th .col-letter {
      display: block;
      font-size: 0.65rem;
      color: var(--gold);
      font-family: var(--font-mono);
      margin-bottom: 1px;
      opacity: 0.85;
    }

    table.calc-table tbody tr {
      background: var(--bg-surface);
      transition: background-color 0.12s ease;
    }

    table.calc-table tbody tr:nth-child(even) {
      background: rgba(22, 32, 56, 0.45);
    }

    table.calc-table tbody tr:hover {
      background: rgba(30, 46, 82, 0.72);
    }

    table.calc-table tbody tr.row-disabled {
      opacity: 0.44;
      background: rgba(11, 17, 32, 0.75);
    }

    table.calc-table tbody tr.row-disabled:hover {
      opacity: 0.65;
    }

    table.calc-table tbody tr.row-jumped {
      background: rgba(234, 179, 8, 0.08);
    }

    table.calc-table tbody tr.row-jumped td {
      border-bottom: 2px solid rgba(234, 179, 8, 0.45);
    }

    table.calc-table tbody tr.row-final-jump {
      background: rgba(244, 63, 94, 0.1);
    }

    table.calc-table tbody tr.row-final-jump td {
      border-bottom: 2px solid rgba(244, 63, 94, 0.55);
    }

    table.calc-table tbody tr.row-dragging {
      opacity: 0.85;
      background: #1e293b !important;
      outline: 2px solid var(--gold);
      outline-offset: -2px;
      box-shadow: 0 10px 28px rgba(0, 0, 0, 0.55);
      position: relative;
      z-index: 10;
    }

    table.calc-table tbody td {
      padding: 7px 8px;
      border-bottom: 1px solid var(--border-subtle);
      vertical-align: middle;
      white-space: nowrap;
    }

    .cell-num {
      text-align: right;
      font-family: var(--font-mono);
      font-variant-numeric: tabular-nums;
    }

    .cell-center {
      text-align: center;
    }

    .cell-year {
      font-weight: 700;
      font-family: var(--font-mono);
      font-variant-numeric: tabular-nums;
      color: #fde68a;
    }

    .cell-gen {
      font-weight: 700;
      color: #c7d2fe;
    }

    .cell-gen.is-final {
      color: #fda4af;
    }

    .cell-enemy-pt {
      color: #7dd3fc;
    }

    .cell-cum-pt {
      font-weight: 700;
      color: #e2e8f0;
    }

    .cell-level {
      font-weight: 800;
    }

    .lv-pill {
      display: inline-block;
      min-width: 34px;
      padding: 2px 7px;
      border-radius: 999px;
      font-family: var(--font-mono);
      font-size: 0.76rem;
      font-weight: 800;
      background: rgba(99, 102, 241, 0.2);
      color: #c7d2fe;
      border: 1px solid rgba(99, 102, 241, 0.35);
      text-align: center;
    }

    .lv-pill.lv-high {
      background: rgba(244, 63, 94, 0.2);
      color: #fda4af;
      border-color: rgba(244, 63, 94, 0.45);
    }

    .lv-pill.lv-mid {
      background: rgba(245, 158, 11, 0.2);
      color: #fcd34d;
      border-color: rgba(245, 158, 11, 0.4);
    }

    /* ドラッグハンドル */
    .drag-handle {
      cursor: grab;
      color: var(--text-muted);
      font-size: 1.05rem;
      user-select: none;
      touch-action: none;
      padding: 4px 6px;
      border-radius: 6px;
      display: inline-flex;
      align-items: center;
      justify-content: center;
      line-height: 1;
    }

    .drag-handle:hover {
      color: var(--gold);
      background: rgba(255, 255, 255, 0.06);
    }

    .drag-handle:active {
      cursor: grabbing;
    }

    .drag-handle-locked {
      color: var(--text-muted);
      opacity: 0.45;
      font-size: 0.85rem;
      user-select: none;
      padding: 4px 6px;
      display: inline-flex;
      align-items: center;
      justify-content: center;
      line-height: 1;
      cursor: not-allowed;
    }

    /* チェックボックス */
    .row-checkbox,
    .col-checkbox {
      width: 17px;
      height: 17px;
      accent-color: var(--indigo);
      cursor: pointer;
      vertical-align: middle;
    }

    .row-checkbox.is-custom-check,
    .col-checkbox {
      accent-color: #14b8a6;
    }

    .row-checkbox:disabled {
      cursor: not-allowed;
      opacity: 0.72;
    }

    /* イベント名セル */
    .event-name-wrap {
      display: flex;
      align-items: center;
      gap: 6px;
      min-width: 170px;
    }

    .hero-tag {
      display: inline-flex;
      align-items: center;
      padding: 1px 6px;
      border-radius: 999px;
      font-size: 0.67rem;
      font-weight: 700;
      background: rgba(244, 63, 94, 0.16);
      color: #fda4af;
      border: 1px solid rgba(244, 63, 94, 0.4);
      flex-shrink: 0;
    }

    .custom-tag {
      display: inline-flex;
      align-items: center;
      padding: 1px 6px;
      border-radius: 999px;
      font-size: 0.67rem;
      font-weight: 700;
      background: rgba(20, 184, 166, 0.16);
      color: #5eead4;
      border: 1px solid rgba(20, 184, 166, 0.4);
      flex-shrink: 0;
    }

    /* 字幕マーク */
    .subtitle-mark {
      display: inline-flex;
      align-items: center;
      justify-content: center;
      width: 24px;
      height: 24px;
      border-radius: 6px;
      font-size: 0.8rem;
      font-weight: 800;
      background: var(--amber-soft);
      color: #fcd34d;
      border: 1px solid rgba(245, 158, 11, 0.35);
    }

    .dash-muted {
      color: var(--text-muted);
    }

    /* 入力欄（カスタム行・カスタム列） */
    .table-input {
      background: var(--bg-input);
      border: 1px solid var(--border-strong);
      border-radius: var(--radius-sm);
      color: var(--text-primary);
      font-family: inherit;
      font-size: 0.82rem;
      padding: 5px 8px;
      outline: none;
      transition: border-color 0.15s ease, box-shadow 0.15s ease;
    }

    .table-input:focus {
      border-color: var(--sky);
      box-shadow: 0 0 0 2px rgba(56, 189, 248, 0.22);
    }

    .input-event-name {
      width: 155px;
    }

    .input-battles {
      width: 68px;
      text-align: right;
      font-family: var(--font-mono);
    }

    .input-custom-col-name {
      width: 96px;
      padding: 4px 6px;
      font-size: 0.74rem;
      font-weight: 600;
      background: #0b1222;
      border-color: #3b4f75;
    }

    .input-custom-val {
      width: 86px;
      text-align: right;
      font-family: var(--font-mono);
      padding: 4px 7px;
    }

    /* カスタム列ヘッダー */
    .custom-col-th-inner {
      display: inline-flex;
      align-items: center;
      gap: 6px;
      justify-content: center;
    }

    /* 備考バッジ */
    .remark-wrap {
      display: flex;
      flex-wrap: wrap;
      align-items: center;
      gap: 5px;
      min-width: 195px;
    }

    .badge {
      display: inline-flex;
      align-items: center;
      gap: 4px;
      padding: 2px 8px;
      border-radius: 6px;
      font-size: 0.72rem;
      font-weight: 700;
      white-space: nowrap;
    }

    .badge-coronation {
      background: var(--indigo-soft);
      color: #a5b4fc;
      border: 1px solid rgba(99, 102, 241, 0.4);
    }

    .badge-jump {
      background: var(--gold-soft);
      color: #fde047;
      border: 1px solid rgba(234, 179, 8, 0.45);
    }

    .badge-final {
      background: var(--rose-soft);
      color: #fda4af;
      border: 1px solid rgba(244, 63, 94, 0.5);
    }

    .badge-subinfo {
      background: rgba(148, 163, 184, 0.12);
      color: #cbd5e1;
      border: 1px solid rgba(148, 163, 184, 0.25);
      font-family: var(--font-mono);
      font-weight: 600;
    }

    /* ==========================================================================
       モーダル
       ========================================================================== */
    .modal-backdrop {
      position: fixed;
      inset: 0;
      z-index: 100;
      background: rgba(4, 8, 18, 0.78);
      backdrop-filter: blur(4px);
      display: none;
      align-items: center;
      justify-content: center;
      padding: 16px;
    }

    .modal-backdrop.is-open {
      display: flex;
    }

    .modal-panel {
      width: 100%;
      max-width: 880px;
      max-height: 88vh;
      background: var(--bg-surface);
      border: 1px solid var(--border-strong);
      border-radius: 16px;
      box-shadow: 0 24px 60px rgba(0, 0, 0, 0.6);
      display: flex;
      flex-direction: column;
      overflow: hidden;
    }

    .modal-panel.modal-sm {
      max-width: 440px;
    }

    .modal-header {
      display: flex;
      align-items: center;
      justify-content: space-between;
      padding: 15px 20px;
      background: #131d35;
      border-bottom: 1px solid var(--border-subtle);
    }

    .modal-title {
      margin: 0;
      font-size: 1rem;
      font-weight: 700;
      color: #fde047;
    }

    .modal-close {
      background: transparent;
      border: none;
      color: var(--text-secondary);
      font-size: 1.4rem;
      line-height: 1;
      cursor: pointer;
      padding: 4px 8px;
      border-radius: 6px;
    }

    .modal-close:hover {
      background: rgba(255, 255, 255, 0.08);
      color: #ffffff;
    }

    .modal-body {
      padding: 18px 20px;
      overflow-y: auto;
      display: flex;
      flex-direction: column;
      gap: 20px;
    }

    .modal-footer {
      padding: 12px 20px;
      background: #131d35;
      border-top: 1px solid var(--border-subtle);
      display: flex;
      justify-content: flex-end;
      gap: 10px;
    }

    .ref-section-title {
      margin: 0 0 10px;
      font-size: 0.88rem;
      font-weight: 700;
      color: var(--gold);
      display: flex;
      align-items: center;
      gap: 8px;
    }

    .ref-section-title::before {
      content: "";
      width: 4px;
      height: 16px;
      border-radius: 2px;
      background: var(--gold);
    }

    .ref-cards {
      display: grid;
      grid-template-columns: 1fr;
      gap: 10px;
    }

    @media (min-width: 640px) {
      .ref-cards {
        grid-template-columns: repeat(3, 1fr);
      }
    }

    .ref-card {
      background: var(--bg-surface-elevated);
      border: 1px solid var(--border-subtle);
      border-radius: var(--radius-md);
      padding: 12px;
      font-size: 0.78rem;
      color: #cbd5e1;
      line-height: 1.6;
    }

    .ref-card-title {
      font-weight: 700;
      margin-bottom: 4px;
    }

    .ref-two-col {
      display: grid;
      grid-template-columns: 1fr;
      gap: 14px;
    }

    @media (min-width: 640px) {
      .ref-two-col {
        grid-template-columns: 1fr 1fr;
      }
    }

    .ref-table {
      width: 100%;
      border-collapse: collapse;
      font-size: 0.78rem;
      background: var(--bg-surface-elevated);
      border-radius: var(--radius-md);
      overflow: hidden;
      border: 1px solid var(--border-subtle);
    }

    .ref-table th,
    .ref-table td {
      padding: 7px 10px;
      border-bottom: 1px solid var(--border-subtle);
      text-align: left;
    }

    .ref-table th {
      background: #10182b;
      color: var(--text-secondary);
      font-weight: 700;
    }

    .ref-table td.num {
      text-align: right;
      font-family: var(--font-mono);
    }

    .ref-table tr.is-current-lv {
      background: rgba(234, 179, 8, 0.18);
      color: #fef08a;
      font-weight: 700;
    }

    .ref-note {
      background: rgba(15, 23, 42, 0.8);
      border: 1px solid var(--border-subtle);
      border-radius: var(--radius-md);
      padding: 10px 12px;
      font-size: 0.77rem;
      color: #cbd5e1;
      line-height: 1.65;
    }

    .ref-note code {
      font-family: var(--font-mono);
      background: rgba(255, 255, 255, 0.08);
      padding: 1px 5px;
      border-radius: 4px;
      color: #fde68a;
    }

    /* トースト通知 */
    .toast {
      position: fixed;
      bottom: 22px;
      right: 22px;
      z-index: 200;
      background: #1e293b;
      color: #f8fafc;
      border: 1px solid var(--border-accent);
      border-radius: var(--radius-md);
      padding: 10px 16px;
      font-size: 0.82rem;
      font-weight: 600;
      box-shadow: 0 10px 28px rgba(0, 0, 0, 0.5);
      opacity: 0;
      transform: translateY(12px);
      pointer-events: none;
      transition: opacity 0.2s ease, transform 0.2s ease;
    }

    .toast.is-visible {
      opacity: 1;
      transform: translateY(0);
    }

    .sr-only {
      position: absolute;
      width: 1px;
      height: 1px;
      padding: 0;
      margin: -1px;
      overflow: hidden;
      clip: rect(0, 0, 0, 0);
      white-space: nowrap;
      border: 0;
    }
