/* Admin Panel + Map Editor + Terrain Editor + Deck Editor - extracted from index.html */
  /* =====================================================================
     ADMIN PANEL
  ===================================================================== */
  .admin-panel { position: fixed; inset: 0; z-index: 200; display: flex; flex-direction: column; background: var(--bg); overflow-y: auto; }
  .admin-header {
    display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
    padding: 10px 24px; background: #0d1117;
    border-bottom: 1px solid #1e293b; flex-shrink: 0;
  }
  .admin-title { font-size: 1rem; font-weight: 700; color: #f1f5f9; flex: 1; }
  .admin-user  { font-size: .75rem; color: #94a3b8; }
  .admin-tabs  { display: flex; gap: 4px; padding: 12px 24px 0; border-bottom: 1px solid #1e293b; flex-shrink: 0; }
  .admin-tab-btn {
    padding: 8px 18px; border: none; cursor: pointer; border-radius: 8px 8px 0 0;
    background: rgba(255,255,255,.05); color: #64748b; font-size: .8rem; font-weight: 600; transition: all .2s;
  }
  .admin-tab-btn.active { background: rgba(37,99,235,.1); color: #f1f5f9; border-bottom: 2px solid #2563eb; }
  .admin-tab-btn.terrain { color: #38bdf8; }
  .admin-tab-btn.terrain.active { background: rgba(56,189,248,.12); color: #38bdf8; border-bottom: 2px solid #38bdf8; }
  .admin-flash {
    margin: 12px 24px 0; padding: 8px 14px; border-radius: 8px;
    background: rgba(74,222,128,.15); border: 1px solid rgba(74,222,128,.3);
    color: #4ade80; font-size: .8rem;
  }
  .admin-content  { padding: 24px; width: 100%; flex: 1; }

  /* =====================================================================
     MAP POSITION EDITOR
  ===================================================================== */
  .mpe-editor {
    position: fixed; inset: 0; z-index: 300;
    display: flex; flex-direction: column; overflow: hidden;
    background: #080810; color: #e2e8f0;
    font-family: 'Segoe UI', system-ui, sans-serif;
  }
  .mpe-header {
    display: flex; align-items: center; gap: 12px;
    padding: 10px 16px;
    background: rgba(0,0,0,.6);
    border-bottom: 1px solid rgba(250,204,21,.3);
  }
  .mpe-title { font-size: 1rem; font-weight: 700; color: #facc15; flex: 1; }
  .mpe-header-actions { display: flex; gap: 8px; }
  .mpe-btn {
    padding: 6px 14px; border-radius: 6px; border: 1px solid rgba(255,255,255,.15);
    background: rgba(0,0,0,.5); color: #e2e8f0; font-size: .75rem; font-weight: 700;
    cursor: pointer; transition: all .2s; text-transform: uppercase;
  }
  .mpe-btn:hover { background: rgba(255,255,255,.1); border-color: rgba(250,204,21,.4); }
  .mpe-btn-save { border-color: #22c55e; color: #22c55e; }
  .mpe-btn-save:hover { background: rgba(34,197,94,.15); }
  .mpe-btn-reset { border-color: #ef4444; color: #ef4444; }
  .mpe-btn-reset:hover { background: rgba(239,68,68,.15); }
  .mpe-btn-reset-one { font-size: .65rem; padding: 3px 8px; border-color: #f59e0b; color: #f59e0b; }
  .mpe-flash {
    padding: 8px 16px; background: rgba(34,197,94,.15); color: #22c55e;
    text-align: center; font-weight: 700; font-size: .8rem;
  }
  .mpe-body { display: flex; flex: 1; overflow: hidden; }

  /* Sidebar */
  .mpe-sidebar {
    width: 260px; min-width: 220px; background: rgba(0,0,0,.4);
    border-right: 1px solid rgba(255,255,255,.08);
    display: flex; flex-direction: column; overflow: hidden;
  }
  .mpe-search {
    margin: 8px; padding: 6px 10px; border-radius: 6px;
    border: 1px solid rgba(255,255,255,.15); background: rgba(0,0,0,.3);
    color: #e2e8f0; font-size: .75rem; outline: none;
  }
  .mpe-search:focus { border-color: #facc15; }
  .mpe-list { flex: 1; overflow-y: auto; padding: 0 4px 8px; }
  .mpe-list-item {
    display: flex; align-items: center; gap: 6px;
    padding: 5px 8px; border-radius: 4px; cursor: pointer;
    font-size: .7rem; transition: background .15s;
  }
  .mpe-list-item:hover { background: rgba(255,255,255,.06); }
  .mpe-list-item.selected { background: rgba(250,204,21,.12); border: 1px solid rgba(250,204,21,.3); }
  .mpe-list-item.modified .mpe-list-name { color: #f59e0b; }
  .mpe-list-icon { font-size: .9rem; width: 20px; text-align: center; }
  .mpe-list-name { flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .mpe-list-pos { color: #64748b; font-size: .6rem; font-family: monospace; }
  .mpe-list-modified { color: #f59e0b; font-size: .5rem; }

  /* Map wrapper */
  .mpe-map-wrapper { flex: 1; display: flex; flex-direction: column; overflow: hidden; }
  .mpe-map {
    flex: 1; position: relative; overflow: hidden;
    cursor: crosshair; user-select: none; touch-action: none;
    aspect-ratio: 3055 / 1645;
    max-width: 100%;
    max-height: 100%;
    margin: auto;
    align-self: center;
  }
  .mpe-map-bg { position: absolute; inset: 0; pointer-events: none; z-index: 0; }
  .mpe-map-bg img { width: 100%; height: 100%; object-fit: fill; display: block; }

  /* Markers */
  .mpe-marker {
    position: absolute; z-index: 10;
    transform: translate(-50%, -50%);
    cursor: grab; touch-action: none;
  }
  .mpe-marker.dragging { cursor: grabbing; z-index: 20; }
  .mpe-marker-dot {
    width: 26px; height: 26px; border-radius: 50%;
    background: rgba(185,28,28,.85); border: 2px solid rgba(250,204,21,.7);
    display: flex; align-items: center; justify-content: center;
    font-size: .55rem; font-weight: 900; color: #fff;
    box-shadow: 0 0 6px rgba(0,0,0,.5);
    transition: transform .15s, box-shadow .15s;
  }
  .mpe-marker.selected .mpe-marker-dot {
    background: rgba(250,204,21,.9); color: #000;
    transform: scale(1.3);
    box-shadow: 0 0 12px rgba(250,204,21,.5);
  }
  .mpe-marker.dragging .mpe-marker-dot {
    transform: scale(1.4);
    box-shadow: 0 0 16px rgba(250,204,21,.7);
  }
  .mpe-marker-label {
    position: absolute; top: 100%; left: 50%; transform: translateX(-50%);
    white-space: nowrap; font-size: .55rem; font-weight: 700;
    color: #facc15; background: rgba(0,0,0,.7); padding: 1px 5px;
    border-radius: 3px; margin-top: 2px; pointer-events: none;
  }

  /* Detail strip */
  .mpe-detail-strip {
    display: flex; align-items: center; gap: 10px;
    padding: 8px 16px;
    background: rgba(0,0,0,.5); border-top: 1px solid rgba(250,204,21,.2);
  }
  .mpe-detail-icon { font-size: 1.2rem; }
  .mpe-detail-name { font-weight: 700; color: #facc15; font-size: .85rem; min-width: 140px; }
  .mpe-detail-field {
    display: flex; align-items: center; gap: 4px;
    color: #94a3b8; font-size: .75rem; font-weight: 600;
  }
  .mpe-detail-field input {
    width: 60px; padding: 3px 6px; border-radius: 4px;
    border: 1px solid rgba(255,255,255,.15); background: rgba(0,0,0,.3);
    color: #e2e8f0; font-size: .75rem; text-align: center;
  }
  .mpe-detail-field input:focus { border-color: #facc15; outline: none; }

  /* Responsive — stack on small screens */
  @media (max-width: 700px) {
    .mpe-body { flex-direction: column; }
    .mpe-sidebar { width: 100%; max-height: 160px; border-right: none; border-bottom: 1px solid rgba(255,255,255,.08); }
  }

  /* =====================================================================
     TERRAIN EDITOR
  ===================================================================== */
  .terrain-editor {
    position: fixed; inset: 0; z-index: 300;
    display: flex; flex-direction: column; overflow: hidden;
    background: #080810;
  }
  .te-header {
    display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
    padding: 10px 20px; background: #0d1117;
    border-bottom: 1px solid #1e293b; flex-shrink: 0;
  }
  .te-title { font-size: 1rem; font-weight: 700; color: #38bdf8; margin-right: 4px; }
  .te-duelist-select {
    padding: 7px 14px; border-radius: 8px; background: rgba(255,255,255,.06);
    border: 1px solid rgba(255,255,255,.15); color: #f1f5f9; font-size: .85rem; cursor: pointer; outline: none; min-width: 200px;
  }
  .te-override-badge {
    padding: 3px 10px; border-radius: 20px; font-size: .7rem;
    background: rgba(250,204,21,.15); color: var(--gold); border: 1px solid rgba(250,204,21,.3);
  }
  .te-save-btn {
    padding: 8px 20px; border-radius: 8px; border: none; cursor: pointer;
    background: linear-gradient(135deg, #4f46e5, #7c3aed); color: white;
    font-size: .85rem; font-weight: 700; transition: opacity .2s; margin-left: auto;
  }
  .te-save-btn:hover { opacity: .8; }
  .te-reset-btn {
    padding: 6px 14px; border-radius: 8px; cursor: pointer;
    background: rgba(239,68,68,.12); border: 1px solid rgba(239,68,68,.3);
    color: #f87171; font-size: .8rem; transition: all .2s;
  }
  .te-reset-btn:hover { background: rgba(239,68,68,.25); }
  .te-body { flex: 1; display: flex; overflow: hidden; }
  .te-palette {
    width: 210px; flex-shrink: 0; overflow-y: auto;
    padding: 14px 10px; background: rgba(0,0,0,.4);
    border-right: 1px solid #1e293b; display: flex; flex-direction: column; gap: 6px;
  }
  .te-panel-title { font-size: .65rem; font-weight: 700; color: #475569; text-transform: uppercase; letter-spacing: .08em; margin-bottom: 2px; padding: 0 2px; }
  .te-terrain-tile {
    display: flex; align-items: center; gap: 10px;
    padding: 9px 10px; border-radius: 10px; cursor: pointer;
    border: 2px solid transparent; transition: all .15s;
    background: rgba(255,255,255,.04); user-select: none;
  }
  .te-terrain-tile:hover { border-color: rgba(255,255,255,.2); transform: translateX(3px); }
  .te-terrain-tile.selected { border-color: #facc15; box-shadow: 0 0 10px rgba(250,204,21,.3); }
  .tet-icon { font-size: 1.35rem; flex-shrink: 0; }
  .tet-info { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
  .tet-name { font-size: .8rem; font-weight: 700; color: #e2e8f0; }
  .tet-boost  { font-size: .6rem; color: #4ade80; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .tet-weaken { font-size: .6rem; color: #f87171; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .te-hint { font-size: .65rem; color: #334155; text-align: center; margin-top: 6px; line-height: 1.5; border-top: 1px solid #1e293b; padding-top: 8px; }
  .te-board-wrap {
    flex: 1; display: flex; flex-direction: column; align-items: center;
    justify-content: center; padding: 16px; overflow: auto; background: #0a0a18;
  }
  .te-board-label { font-size: .75rem; font-weight: 600; color: #475569; margin: 6px 0; }
  .te-board-label.enemy  { color: #f87171; }
  .te-board-label.player { color: #4ade80; }
  .te-board {
    display: grid; grid-template-columns: repeat(7, 72px);
    gap: 3px; user-select: none;
    border: 2px solid #1e293b; border-radius: 8px; padding: 5px;
    background: #0d1117;
  }
  .te-cell {
    width: 72px; height: 72px;
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    border-radius: 6px; cursor: crosshair; position: relative;
    transition: transform .1s, box-shadow .1s; border: 2px solid transparent;
  }
  .te-cell:hover { transform: scale(1.06); box-shadow: 0 0 14px rgba(250,204,21,.5); border-color: rgba(250,204,21,.6); z-index: 2; }
  .te-cell.drag-over { border-color: #38bdf8; box-shadow: 0 0 14px rgba(56,189,248,.5); }
  .te-cell-icon { font-size: 1.5rem; pointer-events: none; }
  .te-cell-idx  { font-size: .5rem; color: rgba(255,255,255,.25); position: absolute; bottom: 2px; right: 4px; pointer-events: none; }
  .te-info-panel {
    width: 200px; flex-shrink: 0; overflow-y: auto;
    padding: 14px 10px; background: rgba(0,0,0,.4);
    border-left: 1px solid #1e293b; display: flex; flex-direction: column; gap: 8px;
  }
  .te-current-brush {
    display: flex; flex-direction: column; align-items: center;
    gap: 6px; padding: 14px 10px; border-radius: 12px;
    border: 2px solid rgba(250,204,21,.25); background: rgba(255,255,255,.03); text-align: center;
  }
  .te-current-brush .cb-name { font-weight: 700; color: #f1f5f9; font-size: .9rem; }
  .te-stat-row { font-size: .7rem; padding: 4px 8px; border-radius: 6px; text-align: center; }
  .te-stat-row.boost  { background: rgba(74,222,128,.1); color: #4ade80; }
  .te-stat-row.weaken { background: rgba(248,113,113,.1); color: #f87171; }
  .te-dist-row {
    display: flex; align-items: center; gap: 8px;
    padding: 5px 8px; border-radius: 6px; background: rgba(255,255,255,.03);
  }
  .te-dist-name { flex: 1; font-size: .72rem; color: #cbd5e1; }
  .te-dist-count { font-size: .72rem; color: #64748b; }
  .admin-add-btn {
    padding: 8px 16px; border-radius: 8px; border: 1px dashed rgba(37,99,235,.4);
    background: rgba(37,99,235,.07); color: #60a5fa; font-size: .8rem; cursor: pointer;
    margin-bottom: 16px; transition: all .2s;
  }
  .admin-add-btn:hover { background: rgba(37,99,235,.15); }
  .admin-section-title { font-size: 1rem; font-weight: 700; color: #e2e8f0; margin: 0 0 16px; }
  .admin-deck-list { display: flex; flex-direction: column; gap: 8px; }
  .admin-deck-row {
    display: flex; align-items: center; gap: 10px;
    background: rgba(255,255,255,.04); border: 1px solid rgba(255,255,255,.07);
    border-radius: 8px; padding: 10px 14px;
  }
  .adr-icon  { font-size: 1.2rem; }
  .adr-name  { flex: 1; font-size: .85rem; font-weight: 600; color: #f1f5f9; }
  .adr-count { font-size: .7rem; color: #64748b; }
  .adr-status.on  { font-size: .65rem; color: #4ade80; background: rgba(74,222,128,.12); padding: 2px 8px; border-radius: 20px; }
  .adr-status.off { font-size: .65rem; color: #f87171; background: rgba(239,68,68,.12); padding: 2px 8px; border-radius: 20px; }
  .adr-edit { background: rgba(99,102,241,.15); border: 1px solid #4f46e5; color: #818cf8; padding: 4px 10px; border-radius: 6px; font-size: .7rem; cursor: pointer; }
  .adr-del  { background: rgba(239,68,68,.15); border: 1px solid #ef4444; color: #f87171; padding: 4px 8px; border-radius: 6px; font-size: .7rem; cursor: pointer; }
  .admin-form-grid {
    display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 14px;
  }
  .admin-form-field { display: flex; flex-direction: column; gap: 5px; }
  .admin-form-field label { font-size: .7rem; color: #94a3b8; font-weight: 600; }
  .admin-form-field input, .admin-form-field textarea {
    padding: 8px 10px; border-radius: 6px;
    background: rgba(255,255,255,.06); border: 1px solid rgba(255,255,255,.1);
    color: #f1f5f9; font-size: .85rem; outline: none;
  }
  .admin-form-field input:focus, .admin-form-field textarea:focus { border-color: #2563eb; }
  .admin-form-field input:disabled { opacity: .5; cursor: not-allowed; }
  .admin-user-table { display: flex; flex-direction: column; gap: 3px; }
  .aut-header {
    display: grid; grid-template-columns: 1.1fr 1.4fr .55fr .7fr .9fr 34px;
    padding: 5px 10px; font-size: .6rem; color: #475569; font-weight: 700; letter-spacing: .05em;
  }
  .aut-row {
    display: grid; grid-template-columns: 1.1fr 1.4fr .55fr .7fr .9fr 34px;
    padding: 8px 10px; border-radius: 6px;
    background: rgba(255,255,255,.03); border: 1px solid rgba(255,255,255,.05);
    font-size: .78rem; color: #e2e8f0; align-items: center;
  }
  .aut-row.is-admin { border-color: rgba(250,204,21,.2); background: rgba(250,204,21,.04); }
  .role-admin  { color: var(--gold); font-weight: 700; font-size: .7rem; }
  .role-player { color: #94a3b8; font-size: .7rem; }

  /* ── Admin Users Dashboard ── */
  .au-dashboard { display: flex; flex-direction: column; gap: 14px; padding-top: 4px; }
  .au-kpi-row {
    display: flex; gap: 10px; flex-wrap: wrap;
  }
  .au-kpi {
    flex: 1; min-width: 100px;
    border-radius: 10px; padding: 12px 14px;
    border: 1px solid rgba(255,255,255,.08);
    background: rgba(255,255,255,.04);
    display: flex; flex-direction: column; align-items: center; gap: 4px;
  }
  .au-kpi-val   { font-size: 1.9rem; font-weight: 900; line-height: 1; }
  .au-kpi-label { font-size: .6rem; color: #64748b; text-transform: uppercase; letter-spacing: .06em; text-align: center; }
  .au-kpi-total       { border-color: rgba(99,102,241,.3);  }
  .au-kpi-total .au-kpi-val       { color: #e2e8f0; }
  .au-kpi-today       { border-color: rgba(34,197,94,.3);   }
  .au-kpi-today .au-kpi-val       { color: #22c55e; }
  .au-kpi-month       { border-color: rgba(56,189,248,.3);  }
  .au-kpi-month .au-kpi-val       { color: #38bdf8; }
  .au-kpi-new-today   { border-color: rgba(250,204,21,.3);  }
  .au-kpi-new-today .au-kpi-val   { color: #facc15; }
  .au-kpi-new-month   { border-color: rgba(251,146,60,.3);  }
  .au-kpi-new-month .au-kpi-val   { color: #fb923c; }

  .au-body-split {
    display: grid; grid-template-columns: 260px 1fr; gap: 14px;
    min-height: 0; align-items: start;
  }
  .au-chart-panel {
    background: rgba(255,255,255,.03); border: 1px solid rgba(255,255,255,.06);
    border-radius: 10px; padding: 14px 12px;
    display: flex; flex-direction: column; gap: 8px;
    max-height: 280px; overflow: hidden;
  }
  .au-chart-title { font-size: .75rem; font-weight: 700; color: #e2e8f0; }
  .au-chart-legend { display: flex; gap: 10px; font-size: .62rem; color: #94a3b8; align-items: center; }
  .au-legend-dot { font-size: .9rem; }
  .au-ld-login  { color: #38bdf8; }
  .au-ld-signup { color: #facc15; }
  .au-bar-chart {
    display: flex; align-items: flex-end; gap: 6px;
    height: 120px; padding-bottom: 28px; position: relative;
  }
  .au-bar-col {
    flex: 1; display: flex; flex-direction: column; align-items: center;
    height: 100%; justify-content: flex-end; gap: 2px;
  }
  .au-bar-count { font-size: .55rem; color: #64748b; min-height: 10px; }
  .au-bar-pair {
    display: flex; gap: 2px; align-items: flex-end;
    flex: 1; width: 100%;
  }
  .au-bar {
    flex: 1; border-radius: 3px 3px 0 0; min-height: 2px;
    transition: height .3s ease;
  }
  .au-bar-login  { background: #38bdf8; }
  .au-bar-signup { background: #facc15; }
  .au-bar-label {
    font-size: .55rem; color: #475569; text-align: center; white-space: nowrap;
    text-transform: capitalize;
  }
  .au-table-wrap { overflow-y: auto; max-height: 60vh; min-width: 0; }
  @media (max-width: 768px) {
    .au-body-split { grid-template-columns: 1fr; }
    .au-chart-panel { max-height: 220px; }
  }

  /* ── Admin Visual Card Picker ──────────────────────────── */
  .admin-deck-editor-content {
    display: flex; flex-direction: column; overflow: hidden;
  }
  .admin-card-picker-layout {
    display: grid;
    grid-template-columns: 340px 1fr;
    gap: 0;
    margin-top: 16px;
    border: 1px solid rgba(255,255,255,.08);
    border-radius: 10px;
    overflow: hidden;
    flex: 1;
    min-height: 400px;
    max-height: 55vh;
  }

  /* Left: deck cards list */
  .admin-deck-cards-panel {
    display: flex; flex-direction: column;
    background: rgba(0,0,0,.3);
    border-right: 1px solid rgba(255,255,255,.08);
    overflow: hidden;
  }
  .admin-deck-cards-header {
    padding: 10px 14px;
    border-bottom: 1px solid rgba(255,255,255,.06);
    flex-shrink: 0;
  }
  .admin-deck-cards-header h4 {
    color: #e2e8f0; margin: 0; font-size: .85rem;
  }
  .admin-deck-cards-list {
    flex: 1; overflow-y: auto; padding: 6px;
  }
  .admin-deck-cards-empty {
    text-align: center; color: #475569; font-size: .8rem;
    padding: 32px 12px; line-height: 1.8;
  }
  .admin-deck-card-row {
    display: flex; align-items: center; gap: 8px;
    padding: 5px 8px; border-radius: 6px;
    cursor: pointer; transition: all .15s;
    border: 1px solid transparent;
  }
  .admin-deck-card-row:hover {
    background: rgba(239,68,68,.1);
    border-color: rgba(239,68,68,.3);
  }
  .admin-deck-card-thumb {
    width: 32px; height: 46px; object-fit: cover;
    border-radius: 3px; flex-shrink: 0;
  }
  span.admin-deck-card-thumb {
    display: flex; align-items: center; justify-content: center;
    font-size: 1rem; background: rgba(255,255,255,.05);
    width: 32px; height: 46px; border-radius: 3px;
  }
  .admin-deck-card-info {
    flex: 1; min-width: 0;
    display: flex; flex-direction: column; gap: 1px;
  }
  .admin-deck-card-name {
    color: #e2e8f0; font-size: .72rem; font-weight: 600;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  }
  .admin-deck-card-stats {
    color: #64748b; font-size: .6rem;
  }
  .admin-deck-card-id {
    color: #475569; font-size: .55rem; flex-shrink: 0;
  }
  .admin-deck-card-remove {
    color: #ef4444; font-size: .65rem; font-weight: 700;
    opacity: 0; transition: opacity .15s;
  }
  .admin-deck-card-row:hover .admin-deck-card-remove { opacity: 1; }

  /* Right: card browser */
  .admin-card-browser-panel {
    display: flex; flex-direction: column;
    overflow: hidden;
  }
  .admin-card-browser-header {
    padding: 10px 14px;
    border-bottom: 1px solid rgba(255,255,255,.06);
    display: flex; flex-wrap: wrap; align-items: center; gap: 8px;
    flex-shrink: 0;
  }
  .admin-card-browser-header h4 {
    color: #e2e8f0; margin: 0; font-size: .85rem; margin-right: auto;
  }
  .admin-card-search {
    background: rgba(255,255,255,.06);
    border: 1px solid rgba(255,255,255,.1);
    color: #f1f5f9; padding: 5px 10px;
    border-radius: 6px; font-size: .8rem; outline: none;
    width: 180px;
  }
  .admin-card-search:focus { border-color: #2563eb; }
  .admin-card-type-filters {
    display: flex; gap: 4px;
  }
  .admin-card-type-btn {
    background: rgba(255,255,255,.05);
    border: 1px solid rgba(255,255,255,.08);
    color: #94a3b8; padding: 3px 10px;
    border-radius: 5px; font-size: .7rem; cursor: pointer;
    transition: all .15s;
  }
  .admin-card-type-btn:hover { background: rgba(255,255,255,.1); }
  .admin-card-type-btn.active {
    background: rgba(250,204,21,.15); color: var(--gold);
    border-color: rgba(250,204,21,.3);
  }

  .admin-card-browser-grid {
    flex: 1; overflow-y: auto; padding: 10px;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    gap: 8px;
    align-content: start;
  }
  .admin-card-browser-empty {
    grid-column: 1 / -1;
    text-align: center; color: #475569; padding: 32px;
  }
  .admin-card-browser-item {
    background: rgba(255,255,255,.03);
    border: 1px solid rgba(255,255,255,.06);
    border-radius: 7px;
    padding: 5px;
    cursor: pointer;
    transition: all .15s;
    text-align: center;
  }
  .admin-card-browser-item:hover {
    border-color: rgba(250,204,21,.4);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,.4);
  }
  .admin-card-browser-item.in-deck {
    border-color: rgba(99,102,241,.4);
    background: rgba(99,102,241,.08);
  }
  .admin-card-browser-thumb-wrap {
    position: relative;
  }
  .admin-card-browser-thumb {
    width: 100%; aspect-ratio: 421/614;
    object-fit: cover; border-radius: 4px;
    display: block;
  }
  span.admin-card-browser-thumb {
    display: flex; align-items: center; justify-content: center;
    font-size: 2rem; background: rgba(255,255,255,.04);
    aspect-ratio: 421/614; border-radius: 4px;
  }
  .admin-card-browser-badge {
    position: absolute; top: 3px; right: 3px;
    background: #6366f1; color: #fff;
    width: 22px; height: 22px; border-radius: 50%;
    font-size: .6rem; font-weight: 700;
    display: flex; align-items: center; justify-content: center;
  }
  .admin-card-browser-name {
    color: #cbd5e1; font-size: .6rem; font-weight: 600;
    margin-top: 4px;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  }
  .admin-card-browser-stats {
    color: #64748b; font-size: .55rem; margin-top: 1px;
  }
  .admin-card-browser-limit {
    text-align: center; padding: 8px;
    color: #64748b; font-size: .7rem;
    border-top: 1px solid rgba(255,255,255,.04);
  }

  /* =====================================================================
     DECK EDITOR
  ===================================================================== */
  .deck-editor {
    position: fixed; inset: 0; z-index: 200;
    display: flex; flex-direction: column; overflow: hidden;
    background: #080810;
  }
  .de-header-wrap { display: flex; flex-direction: column; flex-shrink: 0; }
  .de-header {
    display: flex; align-items: center; gap: 12px;
    padding: 10px 18px; background: #0d1117;
    border-bottom: 1px solid #1e293b; flex-shrink: 0;
  }
  /* ── Deck Tabs Row ── */
  .de-deck-tabs-row {
    display: flex; align-items: center; gap: 8px;
    padding: 0 12px; background: #090d14;
    border-bottom: 2px solid #1e293b; min-height: 36px; flex-shrink: 0;
  }
  .de-deck-tabs {
    display: flex; align-items: stretch; gap: 2px;
    overflow-x: auto; flex: 1;
    scrollbar-width: thin; scrollbar-color: #1e293b transparent;
  }
  .de-deck-tabs::-webkit-scrollbar { height: 3px; }
  .de-deck-tabs::-webkit-scrollbar-thumb { background: #1e293b; border-radius: 2px; }
  .de-deck-tab {
    display: flex; align-items: center; gap: 5px;
    padding: 0 12px; height: 36px; white-space: nowrap;
    background: transparent; border: none; border-bottom: 2px solid transparent;
    color: #64748b; font-size: .72rem; font-weight: 600;
    cursor: pointer; transition: all .15s; margin-bottom: -2px;
    border-radius: 0;
  }
  .de-deck-tab:hover { color: #94a3b8; background: rgba(255,255,255,.04); }
  .de-deck-tab-active {
    color: #f1f5f9; border-bottom-color: #2563eb;
    background: rgba(37,99,235,.08);
  }
  .de-deck-tab-battle .de-tab-sword { color: #facc15; }
  .de-deck-tab-active.de-deck-tab-battle { border-bottom-color: #facc15; }
  .de-tab-sword { font-size: .75rem; }
  .de-tab-name { font-weight: 700; }
  .de-tab-count {
    font-size: .6rem; color: #475569; background: rgba(255,255,255,.05);
    padding: 1px 5px; border-radius: 8px; font-weight: 600;
  }
  .de-deck-tab-active .de-tab-count { color: #94a3b8; }
  .de-new-deck-btn {
    flex-shrink: 0; padding: 4px 12px; border-radius: 5px;
    background: rgba(37,99,235,.15); border: 1px solid rgba(37,99,235,.35);
    color: #60a5fa; font-size: .68rem; font-weight: 700;
    cursor: pointer; white-space: nowrap; transition: all .15s;
  }
  .de-new-deck-btn:hover { background: rgba(37,99,235,.3); border-color: #3b82f6; }
  .de-title { flex: 1; font-size: 1rem; font-weight: 700; color: #f1f5f9; }
  .de-header-right { display: flex; align-items: center; gap: 10px; }
  .de-count-badge {
    padding: 3px 10px; border-radius: 20px; font-size: .75rem; font-weight: 700;
    background: rgba(148,163,184,.15); color: #94a3b8;
    border: 1px solid #334155;
  }
  .de-count-badge.full { background: rgba(239,68,68,.2); color: #f87171; border-color: #f87171; }
  .de-save-btn {
    padding: 6px 16px; border-radius: 6px; border: none;
    background: #2563eb; color: #fff; font-size: .8rem; font-weight: 700;
    cursor: pointer; transition: background .18s;
  }
  .de-save-btn:hover:not(:disabled) { background: #3b82f6; }
  .de-save-btn:disabled { opacity: .5; cursor: not-allowed; }
  .de-flash {
    text-align: center; padding: 7px 20px; font-size: .82rem; font-weight: 600;
    border-bottom: 1px solid #1e293b; flex-shrink: 0;
    animation: flashIn .15s ease;
  }
  @keyframes flashIn { from { opacity:0; transform:translateY(-4px) } to { opacity:1; transform:translateY(0) } }
  .de-flash-ok  { background: rgba(74,222,128,.12); color: #4ade80; }
  .de-flash-err { background: rgba(239,68,68,.12);  color: #f87171; }
  .de-body {
    display: flex; flex: 1; overflow: hidden; user-select: none;
  }

  /* ── Sidebar (leader + deck list) ── */
  .de-sidebar {
    flex-shrink: 0; display: flex; flex-direction: column;
    background: #0d1117; overflow: hidden;
    min-width: 160px; max-width: 520px;
  }
  .de-leader-box {
    display: flex; align-items: center; gap: 10px;
    padding: 12px 12px 10px; border-bottom: 1px solid #1e293b;
    background: linear-gradient(180deg, rgba(250,204,21,.07) 0%, transparent 100%);
  }
  .de-leader-icon { font-size: 2rem; line-height: 1; flex-shrink: 0; }
  .de-leader-info { flex: 1; min-width: 0; }
  .de-leader-deck-name {
    font-size: .78rem; font-weight: 700; color: #e2e8f0;
    cursor: pointer; display: flex; align-items: center; gap: 5px;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  }
  .de-deck-name-edit-icon { font-size: .6rem; color: #475569; opacity: 0; transition: opacity .15s; }
  .de-leader-deck-name:hover .de-deck-name-edit-icon { opacity: 1; }
  .de-deck-name-input {
    width: 100%; background: rgba(255,255,255,.08);
    border: 1px solid #3b82f6; border-radius: 4px;
    color: #f1f5f9; font-size: .78rem; font-weight: 700;
    padding: 2px 6px; outline: none;
  }
  .de-leader-name { font-size: .65rem; color: #64748b; margin-top: 2px; }

  /* Deck action row (set active + delete) */
  .de-deck-actions-box {
    display: flex; align-items: center; gap: 6px;
    padding: 7px 10px; border-bottom: 1px solid #1e293b;
    flex-shrink: 0;
  }
  .de-active-badge {
    flex: 1; font-size: .6rem; font-weight: 800; color: #facc15;
    letter-spacing: .5px;
  }
  .de-set-active-btn {
    flex: 1; padding: 4px 8px; border-radius: 5px;
    background: rgba(250,204,21,.1); border: 1px solid rgba(250,204,21,.3);
    color: #fbbf24; font-size: .62rem; font-weight: 700;
    cursor: pointer; transition: all .15s; text-align: center;
  }
  .de-set-active-btn:hover { background: rgba(250,204,21,.2); border-color: #facc15; }
  .de-delete-deck-btn {
    padding: 4px 8px; border-radius: 5px;
    background: rgba(239,68,68,.08); border: 1px solid rgba(239,68,68,.2);
    color: #f87171; font-size: .75rem;
    cursor: pointer; transition: all .15s; flex-shrink: 0;
  }
  .de-delete-deck-btn:hover:not(:disabled) { background: rgba(239,68,68,.2); border-color: #ef4444; }
  .de-delete-deck-btn:disabled { opacity: .3; cursor: not-allowed; }
  .de-delete-confirm {
    display: flex; align-items: center; gap: 5px; flex: 1;
    font-size: .62rem; color: #f87171;
  }
  .de-delete-yes, .de-delete-no {
    padding: 2px 8px; border-radius: 4px; border: 1px solid;
    font-size: .62rem; font-weight: 700; cursor: pointer;
  }
  .de-delete-yes { background: rgba(239,68,68,.2); border-color: #ef4444; color: #f87171; }
  .de-delete-no  { background: rgba(255,255,255,.04); border-color: #334155; color: #94a3b8; }
  .de-deck-title {
    display: flex; align-items: center; justify-content: space-between;
    padding: 8px 12px; font-size: .72rem; font-weight: 700; color: #94a3b8;
    border-bottom: 1px solid #1e293b; flex-shrink: 0;
  }
  .de-deck-count-badge {
    font-size: .65rem; background: rgba(148,163,184,.15);
    padding: 1px 7px; border-radius: 10px; color: #64748b;
  }
  /* Deck Cost bar (PS2 DotR style) */
  .de-deck-cost-counter {
    display: flex; justify-content: space-between; align-items: center;
    padding: 4px 12px 6px; flex-shrink: 0;
    font-size: .6rem; color: #94a3b8; font-weight: 600;
  }
  .de-deck-cost-value {
    color: #fbbf24; font-size: .7rem; font-weight: 800;
    text-shadow: 0 0 6px rgba(251,191,36,.4);
  }
  /* Reincarnation button */
  .de-reincar-btn {
    display: block; width: calc(100% - 24px); margin: 4px 12px 6px;
    padding: 6px 10px; border: 1px solid #334155; border-radius: 6px;
    background: linear-gradient(135deg, #1e1b4b 0%, #312e81 100%);
    color: #c4b5fd; font-size: .68rem; font-weight: 700; cursor: pointer;
    transition: all .2s; text-align: center;
  }
  .de-reincar-btn:hover { background: linear-gradient(135deg, #312e81 0%, #4338ca 100%); color: #e0d5ff; border-color: #6366f1; }
  .de-reincar-btn.active { border-color: #818cf8; box-shadow: 0 0 8px rgba(129,140,248,.3); }

  /* Reincarnation Modal */
  .reincar-overlay {
    position: fixed; inset: 0; z-index: 9999;
    background: rgba(0,0,0,.75); backdrop-filter: blur(4px);
    display: flex; align-items: center; justify-content: center;
    animation: fadeIn .2s ease;
  }
  .reincar-modal {
    background: linear-gradient(160deg, #0f172a 0%, #1e1b4b 100%);
    border: 1px solid #334155; border-radius: 14px;
    width: min(92vw, 600px); max-height: 85vh;
    display: flex; flex-direction: column; overflow: hidden;
    box-shadow: 0 12px 40px rgba(0,0,0,.6);
  }
  .reincar-header {
    display: flex; justify-content: space-between; align-items: center;
    padding: 14px 18px; border-bottom: 1px solid #334155;
  }
  .reincar-header h2 { margin: 0; font-size: 1rem; color: #c4b5fd; }
  .reincar-close {
    background: none; border: none; color: #94a3b8; font-size: 1.1rem;
    cursor: pointer; padding: 4px 8px; border-radius: 6px;
  }
  .reincar-close:hover { background: rgba(255,255,255,.1); color: #e2e8f0; }
  .reincar-info { padding: 12px 18px; border-bottom: 1px solid #1e293b; }
  .reincar-info p { margin: 0 0 8px; color: #94a3b8; font-size: .78rem; line-height: 1.5; }
  .reincar-stats {
    display: flex; gap: 14px; flex-wrap: wrap; font-size: .72rem; color: #64748b;
  }
  .reincar-stats strong { color: #e2e8f0; }
  .reincar-tip { color: #818cf8; font-style: italic; }
  .reincar-charges-ok { color: #34d399; font-weight: 600; }
  .reincar-charges-ok strong { color: #6ee7b7; }
  .reincar-charges-zero { color: #f87171; font-weight: 600; }
  .reincar-charges-zero strong { color: #fca5a5; }
  .reincar-locked {
    padding: 20px 18px; text-align: center; color: #f87171;
    font-size: .82rem; line-height: 1.6;
  }
  .reincar-locked strong { color: #fca5a5; }
  .reincar-card-list {
    overflow-y: auto; flex: 1; padding: 8px 12px; max-height: 50vh;
  }
  .reincar-empty { color: #64748b; text-align: center; padding: 24px; font-size: .78rem; }
  .reincar-card-row {
    display: flex; align-items: center; gap: 10px;
    padding: 8px 10px; border-radius: 8px; cursor: pointer;
    transition: background .15s;
  }
  .reincar-card-row:hover { background: rgba(99,102,241,.12); }
  .reincar-card-row-img { width: 36px; height: 36px; border-radius: 4px; object-fit: cover; flex-shrink: 0; }
  .reincar-card-row-info { flex: 1; min-width: 0; }
  .reincar-card-row-name { display: block; color: #e2e8f0; font-size: .76rem; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .reincar-card-row-details { display: block; color: #64748b; font-size: .65rem; }
  .reincar-card-row-qty { color: #64748b; font-size: .68rem; flex-shrink: 0; }
  .reincar-sacrifice-btn {
    padding: 5px 12px; border: 1px solid #dc2626; border-radius: 6px;
    background: rgba(220,38,38,.15); color: #f87171; font-size: .68rem;
    font-weight: 700; cursor: pointer; flex-shrink: 0; transition: all .15s;
  }
  .reincar-sacrifice-btn:hover { background: rgba(220,38,38,.3); color: #fca5a5; }
  .reincar-sacrifice-btn:disabled { opacity: .5; cursor: wait; }
  .reincar-result {
    padding: 20px 18px; display: flex; flex-direction: column; align-items: center; gap: 16px;
  }
  .reincar-sacrificed, .reincar-new-cards { text-align: center; }
  .reincar-label { font-size: .68rem; color: #64748b; margin-bottom: 8px; font-weight: 600; text-transform: uppercase; letter-spacing: .05em; }
  .reincar-arrow { font-size: 1.5rem; color: #818cf8; }
  .reincar-card-display {
    display: flex; flex-direction: column; align-items: center; gap: 4px;
    padding: 10px; border-radius: 8px; font-size: .75rem;
  }
  .reincar-card-display.sacrificed { background: rgba(220,38,38,.1); color: #f87171; border: 1px solid rgba(220,38,38,.2); }
  .reincar-card-display.gained {
    background: rgba(74,222,128,.08); color: #4ade80; border: 1px solid rgba(74,222,128,.15);
    animation: reincarReveal .5s ease both;
  }
  .reincar-card-img { width: 48px; height: 48px; border-radius: 6px; object-fit: cover; }
  .reincar-card-cost { font-size: .62rem; color: #fbbf24; }
  .reincar-card-display.reincar-new { box-shadow: 0 0 12px 3px rgba(251,191,36,.45); border: 1px solid #fbbf24; }
  .reincar-new-badge {
    font-size: .58rem; font-weight: 700; color: #fbbf24; text-transform: uppercase;
    animation: reincarNewPulse 1.2s ease-in-out infinite;
  }
  @keyframes reincarNewPulse { 0%,100%{ opacity:.7; } 50%{ opacity:1; text-shadow:0 0 6px #fbbf24; } }
  .reincar-cards-row { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }
  .reincar-again-btn {
    margin-top: 8px; padding: 8px 20px; border: 1px solid #6366f1;
    border-radius: 8px; background: rgba(99,102,241,.15);
    color: #a5b4fc; font-size: .78rem; font-weight: 700;
    cursor: pointer; transition: all .15s;
  }
  .reincar-again-btn:hover { background: rgba(99,102,241,.3); color: #c7d2fe; }
  @keyframes reincarReveal {
    from { opacity: 0; transform: scale(.7) rotateY(90deg); }
    to { opacity: 1; transform: scale(1) rotateY(0deg); }
  }

  /* Deck Password input (player-side) */
  .de-pw-box {
    padding: 4px 12px 6px; flex-shrink: 0;
  }
  .de-pw-input-row {
    display: flex; gap: 4px; align-items: center;
  }
  .de-pw-input {
    flex: 1; padding: 5px 8px; border: 1px solid #334155; border-radius: 5px;
    background: #0f172a; color: #e2e8f0; font-size: .68rem; font-weight: 600;
    outline: none; letter-spacing: .05em;
  }
  .de-pw-input::placeholder { color: #475569; text-transform: none; }
  .de-pw-input:focus { border-color: #6366f1; }
  .de-pw-btn {
    padding: 5px 10px; border: 1px solid #334155; border-radius: 5px;
    background: rgba(99,102,241,.15); color: #a5b4fc; font-size: .72rem;
    cursor: pointer; transition: all .15s; flex-shrink: 0;
  }
  .de-pw-btn:hover { background: rgba(99,102,241,.3); border-color: #6366f1; }
  .de-pw-btn:disabled { opacity: .4; cursor: not-allowed; }
  .de-pw-result {
    margin-top: 6px; padding: 8px; border-radius: 6px;
    background: rgba(74,222,128,.08); border: 1px solid rgba(74,222,128,.15);
    animation: fadeIn .3s ease;
  }
  .de-pw-result-label { display: block; font-size: .62rem; color: #4ade80; font-weight: 700; margin-bottom: 4px; }
  .de-pw-result-card {
    display: flex; align-items: center; gap: 6px;
    padding: 3px 0; font-size: .68rem; color: #e2e8f0;
  }
  .de-pw-result-img { width: 24px; height: 24px; border-radius: 3px; object-fit: cover; }
  .de-pw-result-close {
    margin-top: 6px; padding: 3px 12px; border: 1px solid #334155;
    border-radius: 4px; background: rgba(255,255,255,.05);
    color: #94a3b8; font-size: .62rem; cursor: pointer;
  }
  .de-pw-result-close:hover { background: rgba(255,255,255,.1); }

  /* Admin Passwords tab */
  .admin-pw-list { display: flex; flex-direction: column; gap: 6px; }
  .admin-pw-row {
    display: flex; align-items: center; gap: 12px;
    padding: 10px 14px; border-radius: 8px;
    background: rgba(255,255,255,.03); border: 1px solid #1e293b;
    transition: background .15s;
  }
  .admin-pw-row:hover { background: rgba(255,255,255,.06); }
  .admin-pw-row.inactive { opacity: .5; }
  .admin-pw-code {
    font-family: monospace; font-size: .85rem; font-weight: 800;
    color: #fbbf24; min-width: 140px; letter-spacing: .08em;
  }
  .admin-pw-info {
    flex: 1; display: flex; gap: 14px; font-size: .72rem; color: #94a3b8;
  }
  .admin-pw-active { color: #4ade80; font-weight: 700; }
  .admin-pw-disabled { color: #f87171; font-weight: 700; }
  .admin-pw-actions { display: flex; gap: 6px; flex-shrink: 0; }

  /* ── Admin Push Notifications ── */
  .push-stats-row {
    display: flex; gap: 12px; align-items: center; margin-bottom: 20px;
  }
  .push-stat-card {
    background: rgba(255,255,255,.04); border: 1px solid rgba(255,255,255,.08);
    border-radius: 10px; padding: 14px 20px; text-align: center;
    display: flex; flex-direction: column; gap: 2px;
  }
  .push-stat-num { font-size: 1.5rem; font-weight: 900; color: #6366f1; }
  .push-stat-label { font-size: .6rem; color: #64748b; text-transform: uppercase; letter-spacing: 1px; }
  .push-refresh-btn {
    background: rgba(99,102,241,.1); border: 1px solid rgba(99,102,241,.3);
    color: #818cf8; width: 36px; height: 36px; border-radius: 8px; font-size: 1rem;
    cursor: pointer; display: flex; align-items: center; justify-content: center;
  }
  .push-refresh-btn:hover { background: rgba(99,102,241,.2); }
  .push-compose {
    background: rgba(255,255,255,.02); border: 1px solid rgba(255,255,255,.06);
    border-radius: 12px; padding: 18px;
  }
  .push-compose-title { font-size: .85rem; font-weight: 700; color: #e2e8f0; margin: 0 0 14px; }
  .push-form-field { margin-bottom: 12px; }
  .push-form-field label { display: block; font-size: .65rem; color: #94a3b8; margin-bottom: 4px; text-transform: uppercase; letter-spacing: .5px; }
  .push-form-field input,
  .push-form-field textarea {
    width: 100%; padding: 8px 10px; border: 1px solid rgba(255,255,255,.1);
    background: rgba(0,0,0,.3); color: #e2e8f0; border-radius: 7px; font-size: .78rem;
    font-family: inherit; resize: vertical;
  }
  .push-form-field input:focus,
  .push-form-field textarea:focus { border-color: #6366f1; outline: none; }
  .push-preview {
    background: rgba(0,0,0,.25); border: 1px solid rgba(255,255,255,.06);
    border-radius: 8px; padding: 10px; margin-bottom: 14px;
  }
  .push-preview-title { font-size: .55rem; color: #64748b; text-transform: uppercase; letter-spacing: 1px; margin-bottom: 8px; }
  .push-preview-notif {
    display: flex; align-items: center; gap: 10px;
    background: #1e293b; border-radius: 8px; padding: 10px 12px;
  }
  .push-preview-icon { width: 32px; height: 32px; border-radius: 6px; flex-shrink: 0; }
  .push-preview-h { font-size: .78rem; font-weight: 700; color: #f1f5f9; }
  .push-preview-b { font-size: .68rem; color: #94a3b8; margin-top: 2px; }
  .push-send-btn {
    width: 100%; padding: 10px; border: none; border-radius: 8px;
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    color: #fff; font-size: .82rem; font-weight: 700; cursor: pointer;
    transition: opacity .2s, transform .1s;
  }
  .push-send-btn:hover:not(:disabled) { opacity: .9; }
  .push-send-btn:active:not(:disabled) { transform: scale(.98); }
  .push-send-btn:disabled { opacity: .5; cursor: not-allowed; }
  .push-result-ok {
    margin-top: 10px; padding: 8px 12px; border-radius: 7px;
    background: rgba(74,222,128,.1); border: 1px solid rgba(74,222,128,.25);
    color: #4ade80; font-size: .7rem;
  }
  .push-result-err {
    margin-top: 10px; padding: 8px 12px; border-radius: 7px;
    background: rgba(239,68,68,.1); border: 1px solid rgba(239,68,68,.25);
    color: #f87171; font-size: .7rem;
  }

  /* Individual card cost badge */
  .de-deck-row-cost {
    display: inline-block;
    background: rgba(250,204,21,.15);
    color: #fbbf24;
    font-size: .5rem;
    font-weight: 800;
    padding: 0 4px;
    border-radius: 3px;
    border: 1px solid rgba(250,204,21,.25);
    margin-left: 4px;
  }
  .de-card-cost-badge {
    display: inline-block;
    background: rgba(250,204,21,.15);
    color: #fbbf24;
    font-size: .5rem;
    font-weight: 800;
    padding: 0 3px;
    border-radius: 3px;
    border: 1px solid rgba(250,204,21,.2);
    margin-left: 3px;
  }
  .de-deck-list {
    flex: 1; overflow-y: auto; padding: 4px 0;
  }
  .de-deck-list::-webkit-scrollbar { width: 4px; }
  .de-deck-list::-webkit-scrollbar-thumb { background: #1e293b; border-radius: 2px; }
  .de-deck-empty {
    padding: 20px 12px; text-align: center; font-size: .7rem;
    color: #475569; line-height: 1.5;
  }
  .de-deck-row {
    display: flex; align-items: center; gap: 6px;
    padding: 4px 8px; cursor: pointer; transition: background .14s;
    border-bottom: 1px solid rgba(30,41,59,.5);
  }
  .de-deck-row:hover { background: rgba(59,130,246,.07); }
  .de-deck-row-img { width: 28px; height: 38px; object-fit: cover; border-radius: 3px; flex-shrink: 0; }
  .card-img-fb.de-deck-row-img { position: relative; inset: auto; width: 28px; height: 38px; font-size: .9rem; display: flex; align-items: center; justify-content: center; background: #1e293b; border-radius: 3px; }
  .de-deck-row-name { flex: 1; font-size: .62rem; color: #cbd5e1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .de-deck-row-stats { display: flex; flex-direction: column; align-items: flex-end; flex-shrink: 0; gap: 1px; }
  .de-deck-row-level { font-size: .54rem; color: #facc15; font-weight: 700; line-height: 1; }
  .de-deck-row-atk { font-size: .56rem; color: #f87171; font-weight: 700; line-height: 1; }
  .de-deck-row-sep { color: #475569; margin: 0 1px; }
  .de-deck-row-owned { font-size: .58rem; color: #94a3b8; flex-shrink: 0; font-weight: 600; }
  .de-deck-row-rm-btn {
    background: none; border: none; cursor: pointer;
    font-size: .7rem; color: #475569; flex-shrink: 0;
    padding: 0 2px; opacity: 0; transition: opacity .14s;
    line-height: 1;
  }
  .de-deck-row:hover .de-deck-row-rm-btn { opacity: 1; color: #f87171; }

  /* ── Resize handle ── */
  .de-resize-handle {
    width: 5px; flex-shrink: 0; cursor: col-resize;
    background: #1e293b;
    display: flex; align-items: center; justify-content: center;
    transition: background .15s;
    position: relative;
  }
  .de-resize-handle:hover, .de-resize-handle:active { background: #3b82f6; }
  .de-resize-grip {
    width: 1px; height: 32px;
    background: rgba(148,163,184,.3);
    border-radius: 2px;
  }
  .de-resize-handle:hover .de-resize-grip { background: #93c5fd; }

  /* ── Collection panel ── */
  .de-collection {
    flex: 1; display: flex; flex-direction: column; overflow: hidden;
  }
  .de-col-header {
    display: flex; flex-direction: column; gap: 8px;
    padding: 10px 14px; background: #0d1117; border-bottom: 1px solid #1e293b; flex-shrink: 0;
  }
  .de-col-title { font-size: .78rem; font-weight: 700; color: #94a3b8; }
  .de-search-row { display: flex; gap: 6px; align-items: center; }
  .de-search-input {
    padding: 6px 12px; border-radius: 6px;
    border: 1px solid #1e293b; background: #0f172a; color: #f1f5f9;
    font-size: .78rem; outline: none; flex: 1 1 0; min-width: 0; box-sizing: border-box;
  }
  .de-search-input:focus { border-color: #3b82f6; }
  .de-filters-toggle {
    flex-shrink: 0; padding: 5px 10px; border-radius: 6px;
    border: 1px solid #1e293b; background: #0f172a; color: #64748b;
    font-size: .75rem; cursor: pointer; transition: all .15s; line-height: 1;
  }
  .de-filters-toggle:hover, .de-filters-toggle.open { background: rgba(59,130,246,.18); color: #93c5fd; border-color: #3b82f6; }
  .de-type-filters { display: flex; gap: 6px; flex-wrap: wrap; }
  .de-type-btn {
    padding: 3px 10px; border-radius: 14px; border: 1px solid #1e293b;
    background: transparent; color: #64748b; font-size: .65rem;
    cursor: pointer; transition: all .15s;
  }
  .de-type-btn.active, .de-type-btn:hover { background: rgba(59,130,246,.2); color: #93c5fd; border-color: #3b82f6; }
  .de-cards-grid {
    flex: 1; overflow-y: auto;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(90px, 1fr));
    gap: 8px; padding: 12px 14px;
    align-content: start;
  }
  .de-cards-grid::-webkit-scrollbar { width: 5px; }
  .de-cards-grid::-webkit-scrollbar-thumb { background: #1e293b; border-radius: 3px; }
  .de-card-item {
    display: flex; flex-direction: column; align-items: center;
    background: #0f172a; border: 1px solid #1e293b; border-radius: 8px;
    padding: 6px 4px; cursor: pointer; transition: all .15s;
    position: relative;
  }
  .de-card-item:hover:not(.de-card-maxed) {
    border-color: #3b82f6; background: rgba(59,130,246,.08);
    transform: translateY(-2px);
  }
  .de-card-item.de-card-maxed { opacity: .45; cursor: not-allowed; }
  .de-card-item.de-card-in-deck { border-color: rgba(250,204,21,.35); }
  .de-card-thumb-wrap { position: relative; width: 64px; height: 86px; flex-shrink: 0; }
  .de-card-thumb { width: 64px; height: 86px; object-fit: cover; border-radius: 4px; }
  .card-img-fb.de-card-thumb {
    position: relative; inset: auto;
    width: 64px; height: 86px; font-size: 1.5rem;
    display: flex; align-items: center; justify-content: center;
    background: #1e293b; border-radius: 4px;
  }
  .de-card-in-deck-badge {
    position: absolute; top: 2px; left: 2px;
    background: #facc15; color: #0f172a; border-radius: 50%;
    width: 18px; height: 18px; font-size: .6rem; font-weight: 800;
    display: flex; align-items: center; justify-content: center;
  }
  .de-card-owned-badge {
    position: absolute; bottom: 2px; right: 2px;
    background: rgba(0,0,0,.75); color: #94a3b8; border-radius: 4px;
    padding: 0 4px; font-size: .55rem; font-weight: 700;
  }
  .de-card-owned-badge.de-owned-maxed {
    background: rgba(239,68,68,.6); color: #fecaca;
  }
  .de-card-name {
    margin-top: 4px; font-size: .58rem; color: #cbd5e1;
    text-align: center; width: 100%; overflow: hidden;
    text-overflow: ellipsis; white-space: nowrap;
    padding: 0 2px; line-height: 1.2;
  }
  .de-card-stats { font-size: .56rem; color: #64748b; margin-top: 1px; }
  .de-no-cards {
    grid-column: 1/-1; text-align: center;
    padding: 40px 20px; color: #475569; font-size: .85rem; line-height: 1.6;
  }

  /* ── DeckEditor Main Tabs (Deck / Líderes) ── */
  .de-main-tabs {
    display: flex; gap: 4px; padding: 6px 12px 0;
    border-bottom: 1px solid #1e293b; background: #0f172a;
  }
  .de-main-tab {
    padding: 5px 16px; border-radius: 6px 6px 0 0; border: none;
    background: #1e293b; color: #64748b; font-size: .78rem;
    cursor: pointer; font-weight: 600; transition: background .15s, color .15s;
  }
  .de-main-tab:hover { background: #334155; color: #cbd5e1; }
  .de-main-tab.active { background: #0ea5e9; color: #fff; }

  /* ── "Usar como Líder" button in card preview ── */
  .de-set-leader-btn {
    display: block; width: calc(100% - 16px); margin: 8px auto 4px;
    padding: 7px 0; border-radius: 8px; border: none;
    background: linear-gradient(135deg, #f59e0b, #d97706);
    color: #1c1917; font-weight: 700; font-size: .8rem;
    cursor: pointer; transition: opacity .15s;
  }
  .de-set-leader-btn:hover { opacity: .85; }

  /* ── Leaders Panel Layout ── */
  .de-leaders-panel {
    display: flex; flex: 1; min-height: 0; overflow: hidden;
    gap: 0; background: #0f172a;
  }
  .de-leaders-list {
    display: flex; flex-direction: column; gap: 6px;
    width: 240px; flex-shrink: 0; overflow-y: auto;
    padding: 12px 8px; border-right: 1px solid #1e293b;
  }
  .de-leaders-list-title {
    font-size: .65rem; letter-spacing: 1px; text-transform: uppercase;
    color: #f59e0b; font-weight: 700; padding: 0 4px 4px;
    border-bottom: 1px solid #1e293b; margin-bottom: 4px;
  }
  .de-leader-card-item {
    display: flex; gap: 8px; align-items: center;
    padding: 6px 8px; border-radius: 8px; cursor: pointer;
    border: 1px solid #1e293b; background: #1e293b;
    transition: border-color .15s, background .15s;
  }
  .de-leader-card-item:hover { border-color: #334155; background: #253448; }
  .de-leader-card-item.selected { border-color: #0ea5e9; background: #0c2036; }
  .de-ldr-thumb { width: 40px; height: 56px; object-fit: cover; border-radius: 4px; flex-shrink: 0; }
  .de-ldr-info { flex: 1; min-width: 0; }
  .de-ldr-name { font-size: .7rem; font-weight: 700; color: #e2e8f0; overflow: hidden; }
  .de-ldr-rank-row { display: flex; gap: 6px; align-items: center; margin-top: 2px; }
  .de-ldr-rank { font-size: .62rem; font-weight: 700; color: #f59e0b; background: #451a03; padding: 1px 5px; border-radius: 4px; }
  .de-ldr-rank-img { height: 18px; width: auto; image-rendering: pixelated; filter: drop-shadow(0 0 3px rgba(251,191,36,.5)); }
  .de-ldr-type { font-size: .58rem; color: #64748b; }
  .de-ldr-xp-bar-wrap { height: 4px; background: #1e293b; border-radius: 2px; margin-top: 4px; overflow: hidden; }
  .de-ldr-xp-bar-wrap.large { height: 8px; border-radius: 4px; margin-top: 4px; }
  .de-ldr-xp-bar { height: 100%; background: linear-gradient(90deg, #0ea5e9, #38bdf8); border-radius: 2px; transition: width .4s; }
  .de-ldr-xp-text { font-size: .58rem; color: #64748b; margin-top: 2px; }

  /* ── Leaders Detail Panel ── */
  .de-leaders-detail { flex: 1; overflow-y: auto; padding: 16px; }
  .de-leaders-empty { display: flex; align-items: flex-start; justify-content: center; }
  .de-ldr-detail-top { display: flex; gap: 12px; align-items: flex-start; margin-bottom: 16px; }
  .de-ldr-detail-img { width: 72px; height: 100px; object-fit: cover; border-radius: 8px; flex-shrink: 0; box-shadow: 0 4px 12px rgba(0,0,0,.5); }
  .de-ldr-detail-name { font-size: 1rem; font-weight: 700; color: #f1f5f9; }
  .de-ldr-detail-rank { font-size: .75rem; color: #f59e0b; font-weight: 700; margin-top: 2px; }
  .de-ldr-detail-xp { font-size: .7rem; color: #94a3b8; margin-top: 4px; }
  .de-ldr-xp-next { font-size: .68rem; color: #38bdf8; margin-top: 3px; }

  /* badge "Atual" exibido inline no nome do líder ativo */
  .de-ldr-active-badge {
    display: inline-block; margin-left: 6px;
    font-size: .56rem; font-weight: 700; letter-spacing: .4px;
    background: linear-gradient(135deg, #d97706, #f59e0b);
    color: #0f0a00; padding: 1px 5px; border-radius: 4px;
    vertical-align: middle; white-space: nowrap;
  }
  /* borda dourada no item da lista quando for o líder ativo */
  .de-leader-card-item.de-ldr-active { border-color: #f59e0b; background: #1c1200; }
  .de-leader-card-item.de-ldr-active.selected { border-color: #fbbf24; background: #27190a; }

  /* botão "Definir como Líder" no painel de detalhes */
  .de-ldr-set-btn {
    display: inline-flex; align-items: center; gap: 5px;
    margin-top: 10px; padding: 7px 14px;
    background: linear-gradient(135deg, #d97706, #f59e0b);
    color: #0f0a00; font-size: .78rem; font-weight: 700;
    border: none; border-radius: 7px; cursor: pointer;
    transition: opacity .15s, transform .1s;
  }
  .de-ldr-set-btn:hover { opacity: .88; transform: translateY(-1px); }
  .de-ldr-set-btn:active { transform: translateY(0); }

  /* label quando o líder já é o ativo */
  .de-ldr-is-active {
    display: inline-flex; align-items: center; gap: 5px;
    margin-top: 10px; padding: 7px 14px;
    background: #1c1200; border: 1px solid #f59e0b;
    color: #f59e0b; font-size: .78rem; font-weight: 700;
    border-radius: 7px; user-select: none;
  }

  /* ── Rank Timeline ── */
  .de-ldr-ranks-timeline {
    display: flex; flex-wrap: wrap; gap: 4px; margin: 12px 0;
    padding: 10px; background: #1e293b; border-radius: 8px;
  }
  .de-ldr-rank-step {
    display: flex; flex-direction: column; align-items: center; gap: 1px;
    padding: 4px 6px; border-radius: 6px; border: 1px solid #334155;
    min-width: 42px; transition: border-color .15s, background .15s;
  }
  .de-ldr-rank-step.unlocked { border-color: #0ea5e9; background: #0c2036; }
  .de-ldr-rank-step.current  { border-color: #f59e0b; background: #451a03; }
  .de-rank-step-badge { font-size: .65rem; font-weight: 700; color: #e2e8f0; }
  .de-rank-step-img   { height: 16px; width: auto; image-rendering: pixelated; }
  .de-rank-step-xp    { font-size: .5rem; color: #64748b; }
  .de-ldr-rank-step.unlocked .de-rank-step-badge { color: #38bdf8; }
  .de-ldr-rank-step.current  .de-rank-step-badge { color: #f59e0b; }

  /* ── Leader Abilities ── */
  .de-ldr-abilities-title {
    font-size: .65rem; letter-spacing: 1px; text-transform: uppercase;
    color: #a78bfa; font-weight: 700; margin: 12px 0 6px;
  }
  .de-ldr-abilities { display: flex; flex-wrap: wrap; gap: 8px; }
  .de-ability-card {
    flex: 1 1 180px; padding: 10px 12px; border-radius: 8px;
    border: 1px solid #1e293b; background: #1e293b; cursor: pointer;
    transition: border-color .15s, background .15s; position: relative;
  }
  .de-ability-card.unlocked { border-color: #334155; }
  .de-ability-card.unlocked:hover { border-color: #a78bfa; background: #1e1b4b; }
  .de-ability-card.equipped { border-color: #a78bfa; background: #2e1065; }
  .de-ability-card.locked { opacity: .45; cursor: not-allowed; }
  .de-ability-label { font-size: .78rem; font-weight: 700; color: #e2e8f0; margin-bottom: 4px; display: flex; align-items: center; gap: 5px; }
  .ability-icon-img { width: 20px; height: 20px; image-rendering: pixelated; object-fit: contain; flex-shrink: 0; }
  .de-ability-card.equipped .de-ability-label { color: #c4b5fd; }
  .de-ability-desc  { font-size: .65rem; color: #94a3b8; line-height: 1.4; }
  .de-ability-lock  { font-size: .6rem; color: #f59e0b; margin-top: 4px; }

  /* ── DeckEditor Mobile (≤640px) ── */
  .de-header-mobile { display: none; }

  /* Mobile hamburger button */
  .de-mobile-hamburger {
    display: flex; flex-direction: column; justify-content: center; align-items: center;
    gap: 4px; width: 34px; height: 34px;
    background: rgba(148,163,184,.1); border: 1px solid rgba(148,163,184,.2);
    border-radius: 7px; cursor: pointer; padding: 0; flex-shrink: 0;
  }
  .de-mobile-hamburger span {
    display: block; width: 16px; height: 2px;
    background: #94a3b8; border-radius: 2px;
  }

  /* Dropdown */
  .de-hamburger-overlay {
    position: fixed; inset: 0; z-index: 299;
  }
  .de-hamburger-menu {
    position: absolute; top: 100%; right: 0; z-index: 300;
    background: #1e293b; border: 1px solid #334155;
    border-radius: 10px; padding: 6px; min-width: 200px;
    box-shadow: 0 8px 24px rgba(0,0,0,.6);
    display: flex; flex-direction: column; gap: 2px;
  }
  .de-hamburger-item {
    background: transparent; border: none; color: #e2e8f0;
    padding: 10px 14px; border-radius: 7px; cursor: pointer;
    font-size: .85rem; text-align: left; transition: background .15s;
  }
  .de-hamburger-item:hover { background: rgba(255,255,255,.07); }

  /* Mobile panel tabs (bottom bar) — hidden on desktop */
  .de-mobile-tabs { display: none; }

  /* Mobile panel visibility — default: all shown */
  .de-mobile-panel { display: flex; }

  @media (max-width: 640px) {
    /* Hide desktop header-right, show mobile strip */
    .de-header-right { display: none; }
    .de-header-mobile {
      display: flex; align-items: center; gap: 8px; margin-left: auto;
      position: relative;
    }
    .de-header { padding: 8px 12px; gap: 8px; }
    .de-title { font-size: .88rem; }

    /* Deck-tabs row: smaller, scroll OK */
    .de-deck-tabs-row { padding: 0 8px; }
    .de-deck-tab { padding: 0 8px; font-size: .68rem; }
    .de-new-deck-btn { font-size: .62rem; padding: 3px 8px; }

    /* Main tabs */
    .de-main-tabs { padding: 4px 8px 0; }
    .de-main-tab { font-size: .72rem; padding: 4px 12px; }

    /* Body: stack panels — only one visible at a time */
    .de-body {
      flex-direction: column;
      position: relative;
      padding-bottom: 52px; /* space for bottom tab bar */
    }

    /* Hide resize handle on mobile */
    .de-resize-handle { display: none; }

    /* Panels: fill full width, hidden by default */
    .de-mobile-panel {
      display: none;
      width: 100% !important;
      flex: none;
    }
    .de-mobile-panel.de-mobile-panel-active {
      display: flex;
      flex: 1;
      min-height: 0;
      height: calc(100vh - 160px);
    }

    /* Sidebar as full-width list */
    .de-sidebar {
      flex-direction: column;
      border-right: none;
      border-bottom: none;
    }
    .de-deck-list { flex: 1; }

    /* Collection grid: smaller cards */
    .de-cards-grid {
      grid-template-columns: repeat(auto-fill, minmax(78px, 1fr));
      gap: 6px; padding: 8px 10px;
    }
    .de-card-thumb-wrap { width: 56px; height: 76px; }
    .de-card-thumb { width: 56px; height: 76px; }
    .card-img-fb.de-card-thumb { width: 56px; height: 76px; font-size: 1.2rem; }

    /* Bottom tab bar */
    .de-mobile-tabs {
      display: flex;
      position: fixed; bottom: 0; left: 0; right: 0; z-index: 201;
      background: #0d1117;
      border-top: 1px solid #1e293b;
      height: 52px;
    }
    .de-mobile-tab {
      flex: 1; border: none; background: transparent;
      color: #64748b; font-size: .8rem; font-weight: 700;
      cursor: pointer; transition: color .15s, background .15s;
    }
    .de-mobile-tab.active {
      color: #f1f5f9;
      background: rgba(37,99,235,.12);
      border-top: 2px solid #3b82f6;
    }

    /* Leaders panel: stack on mobile */
    .de-leaders-panel { flex-direction: column; }
    .de-leaders-list {
      width: 100%; border-right: none;
      border-bottom: 1px solid #1e293b;
      max-height: 40vh; padding: 8px;
    }
    .de-leaders-detail { padding: 10px; }
  }

