:root {
  --bg: #10261a;          /* 深緑 */
  --panel: #0a1a11;
  --line: #24442f;
  --text: #f2efe6;
  --muted: #9db3a6;
  --accent: #ffd447;      /* 電光掲示板の黄色 */
  --hl: #ffb052;
  --danger: #e55b5b;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font-family: "Hiragino Sans", "Noto Sans JP", system-ui, sans-serif;
  line-height: 1.6;
}
main { max-width: 560px; margin: 0 auto; padding: 0 16px 24px; }

.head { text-align: center; padding: 20px 16px 4px; }
h1 { margin: 0; font-size: clamp(1.3rem, 5vw, 1.8rem); color: var(--accent); }
.sub { margin: 2px 0 0; color: var(--muted); font-size: .9rem; }
.badge {
  display: inline-block; margin: 8px 0 0; background: var(--danger); color: #fff;
  font-weight: bold; padding: 2px 10px; border-radius: 4px; font-size: .8rem;
}
h2 { font-size: .95rem; color: var(--muted); font-weight: bold; margin: 28px 0 8px; }

/* スコアボード */
.scoreboard { background: var(--panel); border: 2px solid var(--line); border-radius: 8px; padding: 10px 12px; margin-top: 14px; }
.sb-title { text-align: center; font-family: "Courier New", monospace; color: var(--muted); font-size: .85rem; margin-bottom: 4px; }
.sb-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 2px 8px; margin: 0; text-align: center; }
.sb-grid dt { font-size: .7rem; color: var(--muted); }
.sb-grid dd { margin: 0; font-family: "Courier New", monospace; font-weight: bold; font-size: 1.6rem; line-height: 1.2; color: var(--accent); }
.sb-grid .hl dd { color: var(--hl); }
.sb-grid .sm { border-top: 1px solid var(--line); padding-top: 4px; }
.sb-grid .sm dd { font-size: 1rem; color: var(--text); }
.sb-grid .sm:nth-child(-n+8) { margin-top: 6px; }

/* 球場 */
.stadium { position: relative; margin-top: 12px; border: 2px solid var(--line); border-radius: 8px; overflow: hidden; transition: border-color .3s, box-shadow .3s; }
.stadium.hr { border-color: var(--accent); box-shadow: 0 0 12px rgba(255,212,71,.5); }
#field { display: block; width: 100%; height: auto; image-rendering: pixelated; image-rendering: crisp-edges; background: #2a2f45; }
.ticker {
  position: absolute; top: 6px; left: 6px; background: rgba(0,0,0,.6); color: var(--accent);
  font-family: "Courier New", monospace; font-weight: bold; font-size: .8rem; padding: 1px 8px; border-radius: 4px;
}
.ticker:empty { display: none; }
.caption {
  position: absolute; left: 0; right: 0; top: 14%; text-align: center; pointer-events: none;
  font-size: clamp(1.1rem, 5vw, 1.7rem); font-weight: 900; color: #fff;
  text-shadow: 2px 2px 0 #000, -2px -2px 0 #000, 2px -2px 0 #000, -2px 2px 0 #000;
}
.caption.pop { animation: cap .3s ease-out; }
@keyframes cap { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

.last-play { text-align: center; font-weight: bold; margin: 10px 0 0; min-height: 1.6em; }

/* ボタン */
.controls { display: flex; flex-wrap: wrap; gap: 8px; margin: 10px 0 4px; }
.btn {
  flex: 1 1 160px; padding: 13px; font-size: 1rem; font-weight: bold; text-align: center;
  border: 2px solid var(--accent); background: transparent; color: var(--accent);
  border-radius: 8px; cursor: pointer; text-decoration: none; font-family: inherit;
}
.btn:hover { background: rgba(255,212,71,.1); }
.btn.primary { background: var(--accent); color: #1a1a1a; }
.link {
  flex-basis: 100%; background: none; border: none; color: var(--muted); font-family: inherit;
  font-size: .85rem; text-decoration: underline; cursor: pointer; padding: 4px;
}
.options { display: flex; justify-content: center; gap: 20px; font-size: .85rem; color: var(--muted); }
.options input { accent-color: var(--accent); }
.options + .options { margin-top: 6px; }
.options input[type=range] { vertical-align: middle; width: 130px; }

/* 打席ログ */
.game-log {
  list-style: none; padding: 0; margin: 0; background: var(--panel); border-radius: 6px;
  max-height: 280px; overflow-y: auto; font-size: .9rem;
}
.game-log:empty::before { content: "まだ打席はありません"; display: block; padding: 10px; color: var(--muted); font-size: .85rem; }
.game-log li { display: grid; grid-template-columns: 5.5em 5.5em 1fr; gap: 8px; padding: 5px 12px; border-bottom: 1px solid var(--line); }
.game-log li span:not([class]) { color: var(--muted); font-family: "Courier New", monospace; }
.game-log li.has-hr { background: rgba(255,176,82,.12); }
.r-hr { color: #ff8a3d; font-weight: bold; }
.r-hit { color: #ffd447; font-weight: bold; }
.r-bb { color: #e9d97a; }
.r-out { color: var(--text); }
.r-so { color: #7cc8ff; }
.last-play .r-hr, .last-play .r-hit, .last-play .r-bb, .last-play .r-so { font-size: 1.1em; }
.scoreboard.career { margin-top: 0; }
.per-season { margin: 6px 0 0; text-align: center; font-size: .8rem; color: var(--muted); }
.link.small { display: block; margin: 8px auto 0; font-size: .75rem; }

/* 履歴 */
table { width: 100%; border-collapse: collapse; font-size: .85rem; }
th, td { border-bottom: 1px solid var(--line); padding: 5px 4px; text-align: center; }
th { color: var(--muted); font-weight: normal; }

.data-info { margin-top: 28px; }
.data-info summary { cursor: pointer; color: var(--muted); font-size: .9rem; font-weight: bold; }
.data-info ul { padding-left: 1.2em; font-size: .8rem; }
.note { font-size: .75rem; color: var(--muted); margin: 6px 0 0; }

footer { text-align: center; font-size: .7rem; color: var(--muted); padding: 16px; border-top: 1px solid var(--line); max-width: 560px; margin: 0 auto; }
.foot-links a { color: var(--muted); }
