* { box-sizing: border-box; margin: 0; padding: 0; }
html, body {
  width: 100%; height: 100%;
  background: #02040c;
  overflow: hidden;
  font-family: 'Hiragino Kaku Gothic ProN', 'Hiragino Sans', 'Noto Sans JP', 'Yu Gothic', Meiryo, sans-serif;
  color: #e8ecff;
  user-select: none;
  -webkit-user-select: none;
}

/* 1280x720 の舞台を画面に合わせて拡大縮小する（main.js で transform を設定） */
#stage {
  position: absolute;
  left: 50%; top: 50%;
  width: 1280px; height: 720px;
  transform-origin: 0 0;
  overflow: hidden;
  background: #050817;
  box-shadow: 0 0 60px rgba(40, 80, 200, 0.25);
}
#game { position: absolute; left: 0; top: 0; width: 1280px; height: 720px; display: block; cursor: crosshair; }

.overlay {
  position: absolute; inset: 0;
  display: none;
  align-items: center; justify-content: center;
  flex-direction: column;
  z-index: 10;
}
.overlay.show { display: flex; }
#title { background: radial-gradient(ellipse at 50% 30%, rgba(30, 50, 120, 0.25), rgba(2, 4, 12, 0.55)); }
#help, #pause, #bullpen, #result { background: rgba(2, 4, 14, 0.72); backdrop-filter: blur(3px); }

/* ---- タイトル ---- */
.logo { text-align: center; margin-bottom: 18px; animation: logoIn 0.8s ease-out; }
.logo-sub { letter-spacing: 0.6em; font-size: 15px; color: #8fb2ff; font-weight: 700; margin-bottom: 4px; }
.logo-main {
  font-size: 64px; font-weight: 900; letter-spacing: 0.04em;
  background: linear-gradient(180deg, #fff9d6 0%, #ffd34d 45%, #ff8a2a 100%);
  -webkit-background-clip: text; background-clip: text; color: transparent;
  filter: drop-shadow(0 4px 0 #5a2100) drop-shadow(0 0 22px rgba(255, 180, 60, 0.45));
}
.logo-main span { color: #ffd34d; -webkit-text-fill-color: #ffd34d; }
@keyframes logoIn { from { transform: translateY(-30px) scale(0.9); opacity: 0; } to { transform: none; opacity: 1; } }

.menu {
  width: 1060px;
  background: linear-gradient(180deg, rgba(16, 22, 48, 0.88), rgba(8, 11, 26, 0.92));
  border: 1px solid rgba(140, 170, 255, 0.3);
  border-radius: 16px;
  padding: 18px 24px 14px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
}
.section { margin-bottom: 12px; flex: 1; }
.row { display: flex; gap: 24px; }
.label { font-size: 13px; color: #8ea0d6; font-weight: 700; margin-bottom: 7px; letter-spacing: 0.08em; }
.team-list { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.team-card {
  position: relative;
  border-radius: 12px;
  padding: 12px 12px 10px;
  background: rgba(255, 255, 255, 0.05);
  border: 2px solid transparent;
  cursor: pointer;
  transition: transform 0.12s, border-color 0.12s, background 0.12s;
  overflow: hidden;
}
.team-card:hover { transform: translateY(-2px); background: rgba(255, 255, 255, 0.09); }
.team-card.sel { border-color: var(--tc); background: linear-gradient(160deg, color-mix(in srgb, var(--tc) 35%, transparent), rgba(255, 255, 255, 0.04)); }
.team-card .emb {
  width: 40px; height: 40px; border-radius: 10px;
  background: var(--tc); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-weight: 900; font-size: 22px; float: left; margin-right: 10px;
  box-shadow: inset 0 -3px 0 rgba(0, 0, 0, 0.25);
}
.team-card .nm { font-weight: 900; font-size: 16px; line-height: 1.2; }
.team-card .st { font-size: 12px; color: var(--tc); font-weight: 700; filter: brightness(1.5); }
.team-card .ds { clear: both; font-size: 11.5px; color: #b9c3e6; margin-top: 8px; min-height: 32px; line-height: 1.4; }
.team-card .rt { display: grid; grid-template-columns: 1fr 1fr; gap: 2px 10px; margin-top: 6px; font-size: 11px; color: #8ea0d6; }
.team-card .rt b { color: #ffd34d; letter-spacing: 1px; }

.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chip {
  padding: 7px 14px;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.07);
  border: 1.5px solid rgba(255, 255, 255, 0.12);
  font-weight: 700; font-size: 14px;
  cursor: pointer; color: #dfe6ff;
  transition: background 0.12s;
}
.chip:hover { background: rgba(255, 255, 255, 0.13); }
.chip.sel { background: #ffd34d; color: #1b1400; border-color: #fff3b0; }
.chip:disabled { opacity: 0.3; cursor: default; }

.actions { display: flex; gap: 12px; justify-content: center; margin-top: 10px; }
.actions.col { flex-direction: column; align-items: stretch; }
.btn {
  font-family: inherit;
  padding: 11px 26px;
  border-radius: 10px;
  border: 1.5px solid rgba(160, 185, 255, 0.4);
  background: rgba(255, 255, 255, 0.07);
  color: #e8ecff;
  font-weight: 800; font-size: 16px;
  cursor: pointer;
  transition: transform 0.1s, background 0.12s;
}
.btn:hover { background: rgba(255, 255, 255, 0.14); transform: translateY(-1px); }
.btn.primary {
  background: linear-gradient(180deg, #ffe27a, #ffb52a);
  color: #2a1700; border-color: #fff1b8;
  box-shadow: 0 4px 0 #9a5a00, 0 0 18px rgba(255, 190, 60, 0.35);
  font-size: 18px;
}
.btn.primary:hover { background: linear-gradient(180deg, #fff0a8, #ffc24a); }
.btn.danger { border-color: rgba(255, 110, 110, 0.5); color: #ffb4b4; }
.foot { text-align: center; font-size: 12px; color: #6f7eb0; margin-top: 10px; }

/* ---- ダイアログ ---- */
.dialog {
  min-width: 380px;
  max-width: 1140px;
  max-height: 690px;
  overflow: auto;
  background: linear-gradient(180deg, rgba(18, 24, 52, 0.97), rgba(9, 12, 28, 0.97));
  border: 1px solid rgba(140, 170, 255, 0.35);
  border-radius: 16px;
  padding: 22px 28px;
  box-shadow: 0 16px 50px rgba(0, 0, 0, 0.6);
}
.dialog.wide { width: 1140px; }
.dialog h2 { text-align: center; font-size: 26px; font-weight: 900; color: #ffd34d; margin-bottom: 14px; }
.dialog h3 { font-size: 16px; color: #9fd0ff; margin: 6px 0 8px; }
.dialog p, .dialog li { font-size: 13.5px; line-height: 1.7; color: #d4dbf5; }
.dialog ul { padding-left: 18px; margin-bottom: 8px; }
.help-grid { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 22px; }
.help-grid > div { background: rgba(255, 255, 255, 0.04); border-radius: 12px; padding: 12px 14px; }
.help-grid p { margin-bottom: 8px; }

.bullpen-list { display: flex; flex-direction: column; gap: 8px; margin-bottom: 8px; }
.bp-item {
  display: flex; justify-content: space-between; align-items: center; gap: 16px;
  padding: 10px 14px; border-radius: 10px;
  background: rgba(255, 255, 255, 0.06); border: 1.5px solid rgba(255, 255, 255, 0.12);
  cursor: pointer; font-weight: 700;
}
.bp-item:hover { background: rgba(255, 211, 77, 0.15); border-color: #ffd34d; }
.bp-item .nm { font-size: 18px; font-weight: 900; }
.bp-item .meta { font-size: 12px; color: #9fb0e0; }
.bp-empty { text-align: center; color: #9fb0e0; padding: 12px; }

/* ---- 結果 ---- */
.result-score { display: flex; justify-content: center; align-items: center; gap: 30px; margin-bottom: 12px; }
.result-score .tm { text-align: center; min-width: 240px; }
.result-score .tm .nm { font-size: 20px; font-weight: 900; }
.result-score .tm .sc { font-size: 64px; font-weight: 900; color: #ffd34d; line-height: 1.1; }
.result-score .vs { font-size: 26px; color: #6f7eb0; font-weight: 900; }
.result-score .win { color: #ffd34d; font-size: 13px; font-weight: 900; letter-spacing: 0.2em; }
table.line, table.stats { border-collapse: collapse; margin: 0 auto 12px; font-size: 13px; }
table.line td, table.line th { padding: 4px 9px; text-align: center; border-bottom: 1px solid rgba(255, 255, 255, 0.08); }
table.line th { color: #8ea0d6; font-weight: 700; }
table.line td.r { color: #ffd34d; font-weight: 900; }
.mvp { text-align: center; margin: 4px 0 12px; font-size: 15px; color: #ffe9a0; font-weight: 800; }
.stats-wrap { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.stats-wrap h4 { font-size: 14px; margin-bottom: 6px; color: #9fd0ff; }
table.stats { width: 100%; font-size: 12px; }
table.stats th, table.stats td { padding: 3px 6px; text-align: center; border-bottom: 1px solid rgba(255, 255, 255, 0.06); }
table.stats th { color: #8ea0d6; }
table.stats td.nm { text-align: left; font-weight: 700; }
table.stats tr.hl td { color: #ffd34d; }

/* 結果画面：成績表だけスクロールさせ、ボタンは常に見えるようにする */
#result .dialog { display: flex; flex-direction: column; max-height: 700px; padding: 16px 24px 14px; }
#result h2 { margin-bottom: 4px; }
#result .result-score { margin-bottom: 6px; }
#result .result-score .tm .sc { font-size: 50px; }
#result table.line { margin-bottom: 6px; }
#result .mvp { margin: 2px 0 8px; }
#result .stats-wrap { overflow: auto; flex: 1; min-height: 0; padding-right: 4px; }
#result .actions { flex-shrink: 0; margin-top: 10px; }
#result table.stats { font-size: 11.5px; margin-bottom: 6px; }
#result table.stats th, #result table.stats td { padding: 2px 5px; }
