
/* BDC New Standalone v1 - Dark theme */
:root{
  --bg:#0f1a2b;
  --panel:#1e293b;
  --panel2:#1f2937;
  --text:#f1f5f9;
  --muted:#94a3b8;
  --accent:#60a5fa;
  --accent2:#34d399;
  --warn:#f59e0b;
  --danger:#ef4444;
  --ok:#22c55e;
}
*{box-sizing:border-box}
html,body{margin:0;padding:0;background:var(--bg);color:var(--text);font-family:system-ui,-apple-system,Segoe UI,Roboto,Helvetica,Arial,'Noto Sans JP','Hiragino Kaku Gothic ProN',Meiryo,sans-serif}
h1{font-size:20px;margin:0;padding:14px 16px;background:linear-gradient(90deg,var(--panel),transparent);border-bottom:1px solid #0b1220}
.container{max-width:1100px;margin:18px auto;padding:0 16px}
.tabs{display:flex;gap:8px;margin-bottom:12px;flex-wrap:wrap}
.tab{padding:10px 14px;border-radius:10px;background:var(--panel2);cursor:pointer;user-select:none;border:1px solid #0b1220}
.tab.active{outline:2px solid var(--accent)}
.view{display:none;background:var(--panel);border:1px solid #0b1220;border-radius:12px;padding:14px}
.view.active{display:block}
.row{display:flex;gap:12px;flex-wrap:wrap;margin-bottom:10px}
.card{flex:1;min-width:280px;background:#162033;border:1px solid #0b1220;border-radius:12px;padding:12px}
label{display:block;font-size:12px;color:var(--muted);margin-bottom:4px}
input[type=text],input[type=number],select{width:100%;padding:8px;border-radius:8px;border:1px solid #0b1220;background:#0b1220;color:var(--text)}
button{padding:10px 14px;border-radius:10px;border:1px solid #0b1220;background:#172554;color:var(--text);cursor:pointer}
button:hover{filter:brightness(1.1)}
.btn-accent{background:var(--accent);color:#0b1220;border-color:#0b1220}
.btn-green{background:var(--accent2);color:#0b1220;border-color:#0b1220}
.btn-danger{background:var(--danger);color:#fff;border-color:#0b1220}
.small{font-size:12px;color:var(--muted)}
.grid-2{display:grid;grid-template-columns:1fr 1fr;gap:10px}
.result{background:#111827;border:1px dashed #0b1220;border-radius:10px;padding:10px;margin-top:8px;white-space:pre-line}
.hr{height:1px;background:#0b1220;margin:10px 0}
.badge{display:inline-block;padding:2px 6px;border-radius:999px;background:#0b1220;border:1px solid #203048;color:var(--muted);font-size:11px;margin-right:6px}
.inline-btns{display:flex;gap:6px;margin-top:6px;flex-wrap:wrap}
.move-line{padding:6px 8px;border-radius:8px;background:#0b1220;margin:6px 0;border:1px solid #0b1220}
.checkbox{display:flex;align-items:center;gap:6px}
.hidden{display:none}

.hpbar{position:relative;height:16px;background:#1f2a34;border:1px solid #2b3a46;border-radius:8px;overflow:hidden;margin:4px 0}
.hpfill{height:100%;background:#1bb36b}

.stat-badge{margin-left:8px;color:#a7c2d6;font-size:12px;}

.team-row{display:grid;grid-template-columns:130px 84px 96px 1.8fr;gap:6px;margin-bottom:6px}
.team-def-row{display:grid;grid-template-columns:160px 92px 100px;gap:6px;margin-bottom:6px}
.team-small{font-size:12px;color:#93a8b3}
.team-table{width:100%;border-collapse:collapse}
.team-table th,.team-table td{border:1px solid #2b3a46;padding:6px;vertical-align:top}
.team-table th{background:#101a22;color:#cfdde6;position:sticky;top:0}

.team-moves{display:grid;grid-template-columns:1fr 1fr;gap:8px}
.team-moves input{width:100%}

.team-rightgrid{display:grid;grid-template-columns:300px 1fr;gap:12px;align-items:start}
.team-side{min-height:260px;max-height:560px;overflow:auto;border:1px solid #2b3a46;border-radius:10px;padding:8px;background:#0f1720}
.team-side table{width:100%}
.team-side pre{white-space:pre-wrap}

.combo-wrap{position:relative; display:flex; gap:6px; align-items:center}
.combo-wrap input{flex:1}
.combo-btn{min-width:28px;height:34px;border:1px solid #2b3a46;border-radius:8px;background:#0f1d29;color:#d8e6f0;cursor:pointer}
.combo-btn:hover{background:#132435}
.combo-menu{position:absolute; left:0; right:0; top:105%; background:#0b1620; border:1px solid #2b3a46; border-radius:10px; display:none; z-index:50; max-height:260px; overflow:auto; box-shadow:0 8px 18px rgba(0,0,0,.4)}
.combo-menu.open{display:block}
.combo-list{display:flex; flex-direction:column}
.combo-item{padding:8px 10px; cursor:pointer}
.combo-item:hover{background:#132435}
.combo-empty{padding:8px 10px; color:#89a2b2}

.team-row{display:grid; grid-template-columns: 180px 80px 90px repeat(4, minmax(160px,1fr)); gap:10px; align-items:center}
.team-row .move-input{width:100%}


/* === 6v6 layout tuning: widen move fields === */
.team-row{
  display:grid;
  grid-template-columns: 180px 84px 96px 1fr; /* name / nature / ev / moves block */
  gap:12px;
  align-items:center;
}
.team-row .team-moves{
  display:grid;
  grid-template-columns: repeat(4, minmax(200px, 1fr));
  gap:12px;
}
/* Ensure combo wrapper expands within grid cells */
.team-row .combo-wrap{ display:flex; align-items:center; gap:6px; width:100%; }
.team-row .combo-wrap input{ flex:1; min-width:160px; }
.team-row .combo-btn{ min-width:30px; height:36px; }
.team-row input[type="text"]{ width:100%; }


/* === 6v6 team view: stack defender under attacker to avoid overlap === */
#view-team .row{display:flex; flex-direction:column; gap:14px}
#view-team .row .card{width:100%; max-width:100%}
#teamAtkGrid, #teamDefGrid{width:100%}


/* === 6v6 width tuning (v6a18) === */
.team-row{
  display:grid;
  grid-template-columns: 160px 78px 90px 1fr; /* name / nature / ev / moves block */
  gap:10px;
  align-items:center;
}
.team-row .team-moves{
  display:grid;
  grid-template-columns: repeat(4, minmax(170px, 1fr));
  gap:10px;
}
@media (max-width: 1500px){
  .team-row{ grid-template-columns: 150px 74px 86px 1fr; }
  .team-row .team-moves{ grid-template-columns: repeat(4, minmax(160px, 1fr)); }
}
@media (max-width: 1360px){
  /* when tighter, wrap moves into 2 rows to avoid horizontal overflow */
  .team-row .team-moves{ grid-template-columns: repeat(2, minmax(220px, 1fr)); }
}


/* v6a19: fix combo buttons visibility for 技1〜4 and shrink columns */
#view-team .team-row{ grid-template-columns: 140px 72px 86px 1fr; }
#view-team .team-row .team-moves{ grid-template-columns: repeat(4, minmax(160px,1fr)); }
#view-team .team-row .combo-wrap{ width:100%; }
#view-team .team-row .combo-wrap input{ min-width:0; flex:1; }
#view-team .team-row input[type="text"]{ min-width:0; }


/* === v6a20: 6v6 layout — attacker left, defender right; moves can wrap to 2 rows; tweak widths === */

/* Place defender to the RIGHT again on wide screens */
#view-team .row{display:flex; flex-direction:row; gap:16px; align-items:flex-start; flex-wrap:nowrap;}
#view-team .row .card{flex:1 1 50%; max-width:50%;}

/* Attacker row: narrower name/nature/ev; give more to moves */
#view-team .team-row{display:grid; grid-template-columns: 130px 70px 82px 1fr; gap:10px; align-items:center;}
#view-team .team-row input[type="text"], 
#view-team .team-row select{ width:100%; min-width:0; }
#view-team .team-row .team-moves{ display:grid; grid-template-columns: repeat(4, minmax(180px,1fr)); gap:10px; }
#view-team .team-row .combo-wrap{ display:flex; gap:6px; align-items:center; width:100%; }
#view-team .team-row .combo-wrap input{ flex:1; min-width:0; }
#view-team .team-row .combo-btn{ min-width:30px; height:36px; }

/* Allow moves to wrap into 2 rows when horizontal space is tight */
@media (max-width: 1700px){
  #view-team .row .card{flex:1 1 48%; max-width:48%;}
  #view-team .team-row{ grid-template-columns: 120px 68px 78px 1fr; }
  #view-team .team-row .team-moves{ grid-template-columns: repeat(2, minmax(220px,1fr)); }
}
@media (max-width: 1450px){
  #view-team .row{flex-wrap:wrap;}
  #view-team .row .card{flex:1 1 100%; max-width:100%;}
  /* On narrow screens, stack again for safety */
  #view-team .team-row .team-moves{ grid-template-columns: repeat(2, minmax(200px,1fr)); }
}


/* === v6a21: Team view fixed 2-row layout (attacker row then defender row) === */
#view-team .row{ display:flex; flex-direction:column; gap:16px; align-items:stretch; }
#view-team .row .card{ width:100%; max-width:100%; flex:none; }

/* Attacker/Defender rows: allow move fields to break below name/nature/EV */
#view-team .team-row{ display:grid; grid-template-columns: 130px 70px 82px 1fr; gap:10px; align-items:center; }
#view-team .team-row input[type="text"], #view-team .team-row select{ width:100%; min-width:0; }
#view-team .team-row .team-moves{ 
  display:grid; 
  grid-template-columns: repeat(2, minmax(220px, 1fr)); 
  gap:10px; 
  grid-column: 1 / -1;  /* moves span full row under name/nature/EV */
}
#view-team .team-row .combo-wrap{ display:flex; gap:6px; align-items:center; width:100%; }
#view-team .team-row .combo-wrap input{ flex:1; min-width:0; }
#view-team .team-row .combo-btn{ min-width:30px; height:36px; }
