*{box-sizing:border-box;margin:0;padding:0}
html,body{min-height:100%}
body{
  font-family:-apple-system,BlinkMacSystemFont,"PingFang SC","Microsoft YaHei","Helvetica Neue",Arial,sans-serif;
  color:#1f2937;
  background:
    radial-gradient(900px 520px at 12% 4%, rgba(41,58,140,.85) 0%, rgba(41,58,140,0) 60%),
    radial-gradient(760px 620px at 92% 90%, rgba(255,178,36,.75) 0%, rgba(255,178,36,0) 62%),
    linear-gradient(128deg,#20367f 0%,#4b2d80 22%,#8a2e69 44%,#bd364c 64%,#dd5038 82%,#f4a11f 100%);
  background-attachment:fixed;
  -webkit-font-smoothing:antialiased;
}
.page{max-width:640px;margin:0 auto;padding:26px 16px 54px}

/* ---------- header ---------- */
.hero{text-align:center;color:#fff;margin-bottom:20px;text-shadow:0 2px 12px rgba(20,20,60,.28)}
.hero h1{font-size:21px;font-weight:800;letter-spacing:.6px}
.hero p{font-size:12px;opacity:.88;margin-top:7px;letter-spacing:.3px}

/* ---------- cards ---------- */
.card{background:#fff;border-radius:18px;padding:20px;margin-bottom:15px;
  box-shadow:0 16px 38px rgba(28,24,70,.20),0 2px 6px rgba(28,24,70,.08)}
.card-head{display:flex;align-items:center;justify-content:space-between;gap:10px;margin-bottom:15px}
.card-title{display:flex;align-items:center;gap:7px;font-size:15px;font-weight:750;color:#1e293b}
.card-title .ic{font-size:15px}
.badges{display:flex;gap:6px;flex-wrap:wrap}
.badge{display:inline-flex;align-items:center;font-size:11px;font-weight:700;padding:4px 11px;border-radius:999px;white-space:nowrap;line-height:1.5}
.badge-blue{color:#2563eb;border:1.5px solid #3b82f6;background:#fff}
.badge-green{color:#16a34a;border:1.5px solid #22c55e;background:#f6fef8}
.badge-gray{color:#94a3b8;border:1.5px solid #cbd5e1;background:#f8fafc}
.card-history{cursor:pointer}
.card-history .card-head{margin-bottom:0}

/* ---------- mode switch ---------- */
.modes{display:grid;grid-template-columns:1fr 1fr;gap:11px;margin-bottom:15px}
.mode{border:1.5px solid #e2e8f0;background:#f8fafc;border-radius:12px;padding:13px 8px;cursor:pointer;
  text-align:center;transition:.18s;font-family:inherit}
.mode:hover{border-color:#93c5fd}
.mode.active{border-color:#3b82f6;background:#eef4ff;box-shadow:0 0 0 3px rgba(59,130,246,.09)}
.mode-t{font-size:13.5px;font-weight:750;color:#1e293b}
.mode-s{font-size:10.5px;color:#94a3b8;margin-top:5px;line-height:1.4}
.mode.active .mode-t{color:#1d4ed8}

/* ---------- teams ---------- */
.teams{display:grid;grid-template-columns:1fr 1fr;gap:11px}
.team{border:1.6px solid;border-radius:13px;padding:11px 11px 12px;min-height:180px}
.team-guard{border-color:#3b82f6;background:#f7faff}
.team-spy{border-color:#fb923c;background:#fff8f3}
.team-head{display:flex;align-items:center;justify-content:space-between;gap:6px}
.team-name{font-size:13px;font-weight:750;color:#1e293b;display:flex;align-items:center;gap:4px}
.team-count{font-size:11px;font-weight:700;padding:2px 9px;border-radius:999px;white-space:nowrap}
.team-guard .team-count{color:#2563eb;border:1.4px solid #60a5fa;background:#fff}
.team-spy .team-count{color:#ea580c;border:1.4px solid #fb923c;background:#fff}
.team-score{font-size:10px;color:#94a3b8;margin:5px 0 9px}
.team-list{display:flex;flex-direction:column;gap:7px}
.player-row{display:flex;align-items:center;justify-content:space-between;gap:6px;background:#fff;
  border:1px solid #eaf0f7;border-radius:8px;padding:7px 9px;min-height:32px}
.team-spy .player-row{border-color:#f6e9df}
.player-name{font-size:12.5px;font-weight:650;color:#263244;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.lv{font-size:10px;font-weight:600;color:#6366f1;background:#eef2ff;border-radius:6px;padding:2px 7px;white-space:nowrap}
.team-spy .lv{color:#ea580c;background:#fff1e7}
.empty-team{font-size:11px;color:#a8b3c4;text-align:center;padding:20px 4px;line-height:1.6}

.note{text-align:center;font-size:10.5px;color:#9aa6b8;line-height:1.7;margin:13px 0 12px}
.btn-shuffle{width:100%;height:47px;border:0;border-radius:11px;cursor:pointer;font-family:inherit;
  font-size:15px;font-weight:800;color:#fff;letter-spacing:.4px;
  background:linear-gradient(180deg,#ffc32e,#f7a600);box-shadow:0 6px 16px rgba(245,166,0,.34);
  transition:.18s}
.btn-shuffle:hover{filter:brightness(1.05);transform:translateY(-1px)}
.btn-shuffle:active{transform:translateY(1px)}
.btn-shuffle:disabled,.btn-clear:disabled{opacity:.6;cursor:wait;transform:none}
.btn-clear{width:100%;margin-top:9px;border:0;border-radius:9px;background:#f1f5f9;color:#64748b;
  font-family:inherit;font-size:12px;font-weight:600;padding:9px;cursor:pointer;transition:.18s}
.btn-clear:hover{background:#e2e8f0;color:#334155}

/* ---------- history ---------- */
.history-body{margin-top:13px;border-top:1px solid #eef2f7;padding-top:12px;max-height:330px;overflow:auto}
.hist{background:#f8fafc;border:1px solid #eef2f7;border-radius:10px;padding:10px 11px;margin-bottom:8px}
.hist-top{display:flex;align-items:center;justify-content:space-between;gap:8px;margin-bottom:7px}
.hist-meta{font-size:11px;color:#64748b;font-weight:650}
.hist-mode{font-size:10px;color:#2563eb;background:#eaf1ff;border-radius:5px;padding:2px 7px}
.hist-cols{display:grid;grid-template-columns:1fr 1fr;gap:8px;font-size:11px;color:#475569;line-height:1.65}
.hist-cols b{display:block;font-size:10px;margin-bottom:2px}
.hist-cols .g{color:#2563eb}.hist-cols .s{color:#ea580c}
.hist-foot{display:flex;align-items:center;justify-content:space-between;margin-top:7px;font-size:10px;color:#94a3b8}
.link{border:0;background:none;color:#2563eb;font-size:10.5px;cursor:pointer;font-family:inherit;padding:2px 4px}
.link:hover{text-decoration:underline}
.hist-empty{font-size:11px;color:#a8b3c4;text-align:center;padding:14px}

/* ---------- add row ---------- */
.add-row{display:grid;grid-template-columns:1fr 128px 62px;gap:8px}
.input,.select,.textarea{font-family:inherit;font-size:13px;color:#1e293b;background:#fff;
  border:1.5px solid #e2e8f0;border-radius:9px;padding:9px 11px;outline:none;transition:.16s;width:100%}
.input:focus,.select:focus,.textarea:focus{border-color:#3b82f6;box-shadow:0 0 0 3px rgba(59,130,246,.10)}
.input::placeholder,.textarea::placeholder{color:#b3bdcc}
.select{appearance:none;-webkit-appearance:none;cursor:pointer;font-size:12px;padding-right:22px;
  background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%2394a3b8' stroke-width='1.6' fill='none'/%3E%3C/svg%3E");
  background-repeat:no-repeat;background-position:right 8px center}
.select.wide{margin-bottom:12px}
.btn-add{border:0;border-radius:9px;background:#2563eb;color:#fff;font-family:inherit;font-size:13px;
  font-weight:700;cursor:pointer;transition:.18s}
.btn-add:hover{background:#1d4ed8}
.btn-add:disabled{opacity:.6;cursor:wait}

/* ---------- OCR zone ---------- */
.ocr-zone{display:flex;align-items:center;gap:11px;margin-top:11px;padding:12px 13px;
  border:1.6px dashed #a9c2ff;border-radius:12px;background:#f6f9ff;cursor:pointer;transition:.18s}
.ocr-zone:hover{background:#eef4ff;border-color:#3b82f6}
.ocr-zone.drag{background:#e5efff;border-color:#2563eb}
.ocr-icon{font-size:22px;line-height:1;flex:none}
.ocr-main{flex:1;min-width:0}
.ocr-t{font-size:12.5px;font-weight:750;color:#1d4ed8}
.ocr-s{font-size:10px;color:#8fa0bd;margin-top:4px;line-height:1.5}
.ocr-go{flex:none;font-size:11px;font-weight:700;color:#fff;background:#3b82f6;border-radius:8px;padding:7px 10px}
.ocr-opt{display:flex;align-items:center;gap:6px;font-size:10.5px;color:#8b97ab;margin:8px 2px 0;cursor:pointer}
.ocr-opt input{accent-color:#2563eb}

/* ---------- batch ---------- */
.batch-toggle{margin-top:13px;background:#f1f5ff;color:#3b62c4;font-size:11.5px;font-weight:650;
  border-radius:8px;padding:9px 11px;cursor:pointer;user-select:none}
.batch-toggle:hover{background:#e8efff}
.batch-body{margin-top:9px}
.textarea{min-height:78px;resize:vertical;line-height:1.6;font-size:12px}
.batch-actions{display:flex;align-items:center;justify-content:space-between;gap:8px;margin-top:8px}
.hint{font-size:10.5px;color:#a3aec0}
.btn-mini{border:0;border-radius:8px;background:#2563eb;color:#fff;font-family:inherit;font-size:11.5px;
  font-weight:700;padding:8px 14px;cursor:pointer}
.btn-mini:hover{background:#1d4ed8}

/* ---------- chips ---------- */
.chips{display:flex;flex-wrap:wrap;gap:7px;margin-top:14px}
.chip{display:inline-flex;align-items:center;gap:5px;border:1.5px solid #22c55e;background:#f7fef9;
  border-radius:999px;padding:5px 7px 5px 11px;font-size:11.5px;color:#263244;font-weight:650;max-width:100%}
.chip.leave{border-color:#cbd5e1;background:#f8fafc;color:#94a3b8}
.chip .cn{max-width:120px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.chip .cl{font-size:9.5px;font-weight:600;color:#16a34a;background:#e7f8ec;border-radius:5px;padding:2px 5px;white-space:nowrap}
.chip.leave .cl{color:#94a3b8;background:#eef2f6}
.chip button{border:0;background:none;cursor:pointer;font-size:11px;color:#94a3b8;padding:2px 3px;line-height:1}
.chip button:hover{color:#1e293b}
.roster-foot{margin-top:12px;font-size:10.5px;color:#a8b3c4;text-align:center}
.footer{text-align:center;color:rgba(255,255,255,.72);font-size:10.5px;margin-top:18px}

/* ---------- modal ---------- */
.overlay{position:fixed;inset:0;background:rgba(15,23,42,.55);backdrop-filter:blur(3px);
  display:flex;align-items:center;justify-content:center;padding:16px;z-index:50}
.overlay[hidden]{display:none}
.modal{background:#fff;border-radius:16px;padding:20px;width:100%;max-width:360px;
  box-shadow:0 24px 60px rgba(0,0,0,.28);max-height:90vh;overflow:auto}
.modal-wide{max-width:520px}
.modal-head{display:flex;align-items:center;justify-content:space-between;margin-bottom:15px;font-size:15px;color:#1e293b}
.modal-head .x{border:0;background:none;font-size:22px;line-height:1;color:#94a3b8;cursor:pointer}
.modal-head .x:hover{color:#1e293b}
.fl{display:block;font-size:11px;color:#94a3b8;font-weight:650;margin:0 0 5px}
.modal .input{margin-bottom:12px}
.modal-actions{display:flex;gap:9px;justify-content:flex-end;margin-top:16px}
.btn-primary{border:0;border-radius:9px;background:#2563eb;color:#fff;font-family:inherit;font-size:12.5px;
  font-weight:700;padding:9px 20px;cursor:pointer}
.btn-primary:hover{background:#1d4ed8}
.btn-danger{border:1.5px solid #fecaca;background:#fff5f5;color:#dc2626;border-radius:9px;
  font-family:inherit;font-size:12.5px;font-weight:650;padding:9px 15px;cursor:pointer;margin-right:auto}
.btn-danger:hover{background:#fee2e2}

/* ---------- OCR result ---------- */
.ocr-preview{display:flex;gap:12px;align-items:center;background:#f8fafc;border:1px solid #eef2f7;
  border-radius:10px;padding:9px;margin-bottom:12px}
.ocr-preview img{width:118px;height:78px;object-fit:cover;border-radius:7px;background:#e2e8f0;flex:none}
.ocr-summary{font-size:12px;color:#334155;line-height:1.7;font-weight:600}
.ocr-summary small{display:block;font-weight:500;color:#94a3b8;font-size:10.5px;margin-top:4px}
.ocr-tip{font-size:10.5px;color:#8b97ab;line-height:1.6;margin-bottom:11px}
.ocr-groups{max-height:290px;overflow:auto}
.ogrp{margin-bottom:11px}
.ogrp-t{font-size:11px;font-weight:750;color:#64748b;margin-bottom:6px;display:flex;align-items:center;gap:6px}
.ogrp-t span{font-size:10px;font-weight:600;color:#94a3b8}
.ocr-items{display:grid;grid-template-columns:1fr 1fr;gap:6px}
.ocr-item{display:flex;align-items:center;gap:4px;border:1px solid #e2e8f0;border-radius:8px;padding:3px 5px;background:#fff}
.ocr-item input{border:0;outline:none;font-family:inherit;font-size:12px;font-weight:650;color:#1e293b;
  width:100%;min-width:0;padding:4px 3px;background:transparent}
.ocr-item input:focus{background:#f1f5ff;border-radius:5px}
.ocr-item .x{border:0;background:none;color:#cbd5e1;cursor:pointer;font-size:16px;line-height:1;padding:0 3px}
.ocr-item .x:hover{color:#ef4444}
.ocr-addrow{display:flex;gap:7px;margin-top:10px}
.ocr-addrow .input{flex:1}

/* ---------- loading + toast ---------- */
.loading-box{background:#fff;border-radius:16px;padding:28px 34px;text-align:center;
  box-shadow:0 24px 60px rgba(0,0,0,.28);display:flex;flex-direction:column;align-items:center;gap:9px}
.loading-box b{font-size:14px;color:#1e293b}
.loading-box span{font-size:11px;color:#94a3b8}
.spinner{width:34px;height:34px;border:3px solid #dbeafe;border-top-color:#2563eb;border-radius:50%;
  animation:spin .8s linear infinite;margin-bottom:4px}
@keyframes spin{to{transform:rotate(360deg)}}
.toast{position:fixed;left:50%;bottom:28px;transform:translateX(-50%);background:rgba(24,32,52,.94);
  color:#fff;font-size:12.5px;font-weight:600;padding:11px 18px;border-radius:10px;z-index:99;
  box-shadow:0 10px 30px rgba(0,0,0,.25);max-width:88vw;text-align:center}
.toast[hidden]{display:none}

/* ---------- responsive ---------- */
@media(max-width:480px){
  .page{padding:20px 11px 44px}
  .card{padding:15px;border-radius:15px}
  .hero h1{font-size:18px}
  .modes{gap:8px}
  .mode-t{font-size:12px}.mode-s{font-size:9.5px}
  .teams{gap:8px}
  .team{padding:9px 8px}
  .team-name{font-size:11.5px}
  .player-name{font-size:11.5px}
  .add-row{grid-template-columns:1fr 106px 56px;gap:6px}
  .input,.select{font-size:12px;padding:8px}
  .ocr-go{display:none}
  .ocr-items{grid-template-columns:1fr}
}
