/* =========================================================================
 * styles.css — 자동진행 야구단 프로토타입 UI
 * ========================================================================= */
:root {
  --bg: #0e1116; --panel: #171c24; --panel2: #1f2630; --line: #2b3340;
  --txt: #e7ecf3; --muted: #8b97a7; --accent: #4ea1ff; --accent2: #ffb547;
  --win: #54d68a; --lose: #ff6b6b; --draw: #b9c2cf;
  --normal: #9aa6b2; --special: #4ea1ff; --rare: #c977ff; --sig: #ffce54;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  background: var(--bg); color: var(--txt);
  font-family: "Pretendard", "Malgun Gothic", -apple-system, system-ui, sans-serif;
  font-size: 14px; line-height: 1.45; -webkit-font-smoothing: antialiased;
  display: flex; justify-content: center;
}
#app {
  width: 100%; max-width: 460px; height: 100vh; overflow: hidden;
  background: var(--bg); display: flex; flex-direction: column;
  position: relative; box-shadow: 0 0 40px rgba(0,0,0,.5);
}

/* ---- 헤더 ---- */
.hdr { background: var(--panel); border-bottom: 1px solid var(--line); padding: 8px 12px; }
.hdr-row { display: flex; align-items: center; gap: 8px; }
.hdr-title { font-weight: 800; font-size: 15px; letter-spacing: -.3px; }
.hdr-title .em { color: var(--accent2); }
.coins { margin-left: auto; font-weight: 700; color: var(--accent2); }
.icon-btn { margin-left: 10px; background: none; border: none; color: var(--muted);
  font-size: 17px; line-height: 1; cursor: pointer; padding: 2px 2px; }
.icon-btn:hover { filter: brightness(1.25); }
.set-sec { margin: 14px 0; }
.set-label { font-size: 12px; color: var(--muted); font-weight: 600; margin-bottom: 8px; }
.coins::before { content: "🪙 "; }
.hdr-sub { display: flex; gap: 8px; align-items: center; margin-top: 6px; flex-wrap: wrap; font-size: 12px; color: var(--muted); }
.pill { background: var(--panel2); border: 1px solid var(--line); border-radius: 999px; padding: 2px 9px; color: var(--txt); }
.pill.stage { color: var(--accent2); border-color: #3a3320; }
.btn-link { background: none; border: 1px solid var(--line); color: var(--txt); border-radius: 8px; padding: 3px 9px; cursor: pointer; font-size: 12px; }
.btn-link:hover { border-color: var(--accent); }
.btn-link.on { color: #0e1116; background: var(--accent); border-color: var(--accent); font-weight: 700; }
.btn-link.danger { color: var(--lose); border-color: #4a2b2f; }
.btn-link.danger:hover { border-color: var(--lose); background: rgba(255,107,107,.08); }
.btn.danger-btn { background: var(--lose); color: #fff; }

/* ---- 속도 선택 ---- */
.speeds { display: flex; gap: 4px; margin-left: auto; }
.speed { background: var(--panel2); border: 1px solid var(--line); color: var(--muted);
  border-radius: 7px; padding: 3px 8px; cursor: pointer; font-size: 12px; font-weight: 600; }
.speed.active { color: #0e1116; background: var(--accent); border-color: var(--accent); }
.speed.locked { opacity: .45; cursor: not-allowed; }

/* ---- 본문 ---- */
.body { flex: 1; min-height: 0; overflow-y: auto; padding: 12px; }

/* ---- 스코어보드 ---- */
.scoreboard { background: linear-gradient(180deg,#1b2330,#141a23); border: 1px solid var(--line);
  border-radius: 14px; padding: 14px; }
.sb-teams { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 8px; }
.sb-team { text-align: center; }
.sb-team .nm { font-size: 13px; color: var(--muted); margin-bottom: 2px; }
.sb-team .nm.me { color: var(--accent); font-weight: 700; }
.sb-team .rn { font-size: 40px; font-weight: 800; line-height: 1; }
.sb-vs { color: var(--muted); font-size: 12px; }
.sb-meta { display: flex; justify-content: center; gap: 10px; margin-top: 10px; color: var(--muted); font-size: 12px; }
.sb-meta .b { color: var(--txt); font-weight: 700; }

/* 베이스 다이아몬드 + 아웃카운트 */
.field { display: flex; align-items: center; justify-content: center; gap: 18px; margin: 12px 0 4px; }
.diamond { position: relative; width: 64px; height: 64px; }
.base { position: absolute; width: 16px; height: 16px; background: var(--panel2);
  border: 1px solid var(--line); transform: rotate(45deg); }
.base.on { background: var(--accent2); border-color: var(--accent2); box-shadow: 0 0 8px var(--accent2); }
.base.b1 { right: 0; top: 24px; } .base.b2 { left: 24px; top: 0; } .base.b3 { left: 0; top: 24px; }
.outs { display: flex; gap: 5px; }
.out-dot { width: 11px; height: 11px; border-radius: 50%; background: var(--panel2); border: 1px solid var(--line); }
.out-dot.on { background: var(--lose); border-color: var(--lose); }
.outs-label { font-size: 11px; color: var(--muted); margin-top: 4px; text-align: center; }

/* 현재 타석 */
.atbat { display: flex; justify-content: space-between; gap: 8px; margin-top: 10px;
  background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; }
.atbat .col { font-size: 12px; }
.atbat .lbl { color: var(--muted); font-size: 11px; }
.atbat .val { font-weight: 700; }

/* 로그 (라이브 화면 내부 스크롤만, 페이지 전체는 스크롤되지 않음) */
.log { margin-top: 0; flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; }
.log h4 { font-size: 12px; color: var(--muted); margin-bottom: 6px; flex: none; }
.log-list { background: var(--panel); border: 1px solid var(--line); border-radius: 10px;
  flex: 1 1 auto; min-height: 48px; overflow-y: auto; }
.log-item { padding: 6px 10px; border-bottom: 1px solid var(--line); font-size: 12.5px; }
.log-item:last-child { border-bottom: none; }
.log-item .ev { color: var(--muted); margin-right: 6px; }
.log-item.score { color: var(--win); font-weight: 600; }
.log-item.inn { color: var(--accent); background: rgba(78,161,255,.06); font-weight: 600; }

/* ---- 탭 바 ---- */
.tabs { display: flex; border-top: 1px solid var(--line); background: var(--panel); }
.tab { flex: 1; text-align: center; padding: 11px 4px; cursor: pointer; color: var(--muted);
  font-size: 12px; font-weight: 600; }
.tab .ic { font-size: 18px; display: block; margin-bottom: 2px; line-height: 1; height: 22px; }
.tab .ic-img { width: 22px; height: 22px; object-fit: contain; display: block; margin: 0 auto; }
.tab:not(.active) .ic-img { opacity: .82; }
.tab.active { color: var(--accent); }

/* ---- 공통 카드/버튼 ---- */
.section-title { font-size: 13px; font-weight: 700; margin: 4px 2px 10px; display: flex; align-items: center; gap: 8px; }
.badge-next { font-size: 11px; color: var(--accent2); background: rgba(255,181,71,.1);
  border: 1px solid #3a3320; border-radius: 6px; padding: 2px 7px; font-weight: 600; }
.subtabs { display: flex; gap: 6px; margin-bottom: 12px; }
.subtab { flex: 1; text-align: center; padding: 8px; border-radius: 9px; cursor: pointer;
  background: var(--panel); border: 1px solid var(--line); color: var(--muted); font-weight: 600; }
.subtab.active { color: var(--txt); border-color: var(--accent); }
.btn { background: var(--accent); color: #0e1116; border: none; border-radius: 9px;
  padding: 10px 14px; font-weight: 700; cursor: pointer; font-size: 13px; }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn.ghost { background: var(--panel2); color: var(--txt); border: 1px solid var(--line); }

/* 라인업 / 투수 슬롯 */
.slot-list { display: flex; flex-direction: column; gap: 6px; }
/* 로스터 화면: 하위탭·헤더는 고정, 선수 목록만 내부 스크롤 */
.roster-screen { display: flex; flex-direction: column; height: 100%; }
.roster-screen > .subtabs { flex: none; }
#rosterMain { flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; }
#rosterMain > .section-title, #rosterMain > .subtabs, #rosterMain > p { flex: none; }
#rosterMain .enh-list, #rosterMain #rosterBody { flex: 1 1 auto; min-height: 0; overflow-y: auto; }
.slot { display: flex; align-items: center; gap: 8px; background: var(--panel);
  border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; cursor: pointer; }
.slot:hover { border-color: var(--accent); }
.slot .pos { width: 34px; font-weight: 800; color: var(--accent2); font-size: 12px; text-align: center; }
.slot .ord { width: 22px; color: var(--muted); font-size: 12px; text-align: center; }
.slot .who { flex: 1; }
.slot .who .nm { font-weight: 600; }
.slot .who .tm { font-size: 11px; color: var(--muted); }
.slot .ovr { font-weight: 800; font-size: 15px; }
.slot .empty { color: var(--lose); }
.grade { font-size: 10px; font-weight: 800; padding: 1px 6px; border-radius: 5px; margin-left: 6px; }
.grade.NORMAL, .grade.SEASON { color: var(--normal); border: 1px solid var(--normal); }
.grade.SPECIAL, .grade.IMPACT { color: var(--special); border: 1px solid var(--special); }
.grade.RARE, .grade.SIGNATURE { color: var(--sig); border: 1px solid var(--sig); }
.nm .yr { font-size: 10px; color: var(--muted); font-weight: 600; }
.cand.locked { opacity: .5; cursor: default; }
.cand.locked:hover { border-color: var(--line); }
.ord-btns { display: flex; flex-direction: column; gap: 2px; }
.ord-btns button { background: var(--panel2); border: 1px solid var(--line); color: var(--txt);
  border-radius: 5px; width: 22px; height: 16px; line-height: 1; cursor: pointer; font-size: 10px; }

.staff-group { margin-bottom: 14px; }
.staff-group h5 { font-size: 12px; color: var(--muted); margin: 0 2px 6px; }

/* ---- 뽑기 ---- */
.gacha-rates { display: flex; gap: 8px; margin: 10px 0; }
.rate { flex: 1; text-align: center; background: var(--panel); border: 1px solid var(--line);
  border-radius: 9px; padding: 8px; }
.rate .g { font-weight: 800; } .rate .p { color: var(--muted); font-size: 12px; }
.gacha-btns { display: flex; gap: 8px; margin: 12px 0; }
.gacha-btns .btn { flex: 1; }
.draw-results { display: grid; grid-template-columns: repeat(2,1fr); gap: 8px; margin-top: 12px; }
.draw-card { background: var(--panel); border: 1px solid var(--line); border-radius: 10px;
  padding: 10px; position: relative; animation: pop .25s ease; }
.draw-card.RARE, .draw-card.SIGNATURE { border-color: var(--sig); box-shadow: 0 0 12px rgba(255,206,84,.3); }
.draw-card.SPECIAL, .draw-card.IMPACT { border-color: var(--special); }
.draw-card .nm { font-weight: 700; }
.draw-card .meta { font-size: 11px; color: var(--muted); }
.draw-card .new { position: absolute; top: 6px; right: 6px; font-size: 10px; font-weight: 800;
  color: var(--win); }
@keyframes pop { from { transform: scale(.8); opacity: 0; } to { transform: scale(1); opacity: 1; } }

/* ---- 모달 ---- */
.overlay { position: fixed; inset: 0; background: rgba(0,0,0,.6); display: flex;
  align-items: center; justify-content: center; z-index: 50; padding: 16px; }
.modal { background: var(--panel); border: 1px solid var(--line); border-radius: 14px;
  width: 100%; max-width: 420px; max-height: 86vh; overflow-y: auto; padding: 16px; }
.modal h3 { font-size: 16px; margin-bottom: 12px; }
.modal .row-btns { display: flex; gap: 8px; margin-top: 14px; }
.modal .row-btns .btn { flex: 1; }

/* 순위표 */
.standings { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.standings th, .standings td { padding: 6px 5px; text-align: center; border-bottom: 1px solid var(--line); }
.standings th { color: var(--muted); font-weight: 600; }
.standings td.tm { text-align: left; font-weight: 600; }
.standings tr.me td { color: var(--accent); font-weight: 700; }
.standings tr.cut td { border-bottom: 2px solid var(--accent2); }
.standings tr.relegcut td { border-bottom: 2px solid var(--lose); }
.standings tr.releg td { color: var(--lose); }
.standings tr.releg.me td { color: var(--lose); }

/* 리그 단계 */
.pill.league { cursor: pointer; color: var(--sig); border-color: #3a3320; }
.pill.league:hover { background: rgba(255,206,84,.1); }
.league-cond { display: flex; flex-direction: column; gap: 6px; margin-top: 10px; }
.league-cond .cond { font-size: 12.5px; padding: 8px 11px; border-radius: 9px; border: 1px solid var(--line); }
.league-cond .cond.up { color: var(--win); background: rgba(84,214,138,.08); border-color: #244a36; }
.league-cond .cond.down { color: var(--lose); background: rgba(255,107,107,.07); border-color: #4a2b2f; }
.promo-banner { margin: 10px 0 4px; padding: 9px 12px; border-radius: 10px; font-size: 14px;
  font-weight: 700; text-align: center; border: 1px solid var(--line); }
.promo-banner.up { color: var(--win); background: rgba(84,214,138,.1); border-color: #244a36; }
.promo-banner.down { color: var(--lose); background: rgba(255,107,107,.1); border-color: #4a2b2f; }
.promo-banner.stay { color: var(--muted); }

/* 순위 · 기록실 */
.rec-filter { display: flex; align-items: center; gap: 8px; margin: 8px 0 10px; }
.rec-filter label { font-size: 12px; color: var(--muted); }
.rec-filter select { background: var(--panel2); color: var(--txt); border: 1px solid var(--line);
  border-radius: 8px; padding: 5px 9px; font-size: 12px; }
.tbl-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; border: 1px solid var(--line); border-radius: 10px;
  scrollbar-width: none; -ms-overflow-style: none; }
.tbl-scroll::-webkit-scrollbar { display: none; height: 0; }   /* 하단 스크롤바 숨김(헤더 드래그로 이동) */
.rec-table thead { cursor: grab; }
.rec-table thead.dragging { cursor: grabbing; }
.rec-table thead.dragging th { color: var(--accent2); }
.rec-table { border-collapse: collapse; font-size: 11.5px; white-space: nowrap; min-width: 100%; }
.rec-table th, .rec-table td { padding: 6px 7px; text-align: center; border-bottom: 1px solid var(--line); }
.rec-table th { color: var(--muted); font-weight: 600; background: var(--panel); position: sticky; top: 0; z-index: 1; }
.rec-table th.srt { cursor: pointer; user-select: none; }
.rec-table th.srt:hover { color: var(--txt); }
.rec-table th.sorted { color: var(--accent2); }
.rec-table td.sorted { color: var(--accent2); font-weight: 700; }
.rec-table td.hl { color: var(--accent); font-weight: 700; }
.rec-table .lft { text-align: left; }
.rec-table td.tm, .rec-table td.lft.tm { font-weight: 600; }
.rec-table tr.me td { color: var(--accent); }
.rec-table tr.me td.sorted { color: var(--accent2); }
.rec-table tr.cut td { border-bottom: 2px solid var(--accent2); }
.rec-table tr.relegcut td { border-bottom: 2px solid var(--lose); }
.rec-table tr.releg td { color: var(--lose); }
.rec-table .nm-col { min-width: 62px; }
.rec-table .pl-nm { font-weight: 700; color: var(--txt); }
.rec-table tr.me .pl-nm { color: var(--accent); }
.rec-table .pl-tm { font-size: 10px; color: var(--muted); }
.rec-table .form-cell { min-width: 96px; }
.form5 { display: inline-block; width: 16px; height: 16px; line-height: 16px; border-radius: 4px;
  font-size: 9px; font-weight: 700; color: #fff; margin-right: 2px; text-align: center; }
.form5.w { background: var(--win); } .form5.l { background: var(--lose); } .form5.d { background: var(--draw); color: #222; }
.rec-sub-h { font-size: 12.5px; font-weight: 700; color: var(--accent2); margin: 0 2px 8px; }
.season-sub { margin-top: 4px; }
.next-tag { font-size: 10px; font-weight: 700; color: var(--accent); border: 1px solid var(--accent);
  border-radius: 5px; padding: 1px 5px; }
.rec-table.sched td { padding: 7px 6px; }

/* 구단 정보 */
.mt16 { margin-top: 16px; }
.club-card { background: var(--panel2); border: 1px solid var(--line); border-radius: 12px; padding: 4px 14px; }
.club-row { display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 9px 0; border-bottom: 1px solid var(--line); font-size: 13px; }
.club-row:last-child { border-bottom: none; }
.club-row .k { color: var(--muted); }
.club-row .v { font-weight: 600; text-align: right; }
.club-row .v.hl { color: var(--accent); font-weight: 800; }
.club-row .v.up { color: var(--win); }
.club-row .v.down { color: var(--lose); }
.club-speeds { display: flex; gap: 6px; margin-left: 0; }
.club-speeds .speed { flex: 1; padding: 10px 4px; font-size: 13px; }

/* 보상 팝업 */
.reward-pop { position: absolute; left: 50%; top: 40%; transform: translate(-50%,-50%);
  background: var(--panel2); border: 1px solid var(--accent2); border-radius: 14px;
  padding: 16px 22px; text-align: center; z-index: 40; animation: pop .3s ease; min-width: 200px; }
.reward-pop .res { font-size: 20px; font-weight: 800; margin-bottom: 4px; }
.reward-pop .res.win { color: var(--win); } .reward-pop .res.lose { color: var(--lose); }
.reward-pop .res.draw { color: var(--draw); }
.reward-pop .coin { color: var(--accent2); font-weight: 700; }
.reward-pop .sl { font-size: 12px; color: var(--muted); margin-top: 4px; }

/* 토스트 */
.toast { position: absolute; left: 50%; bottom: 70px; transform: translateX(-50%);
  background: var(--panel2); border: 1px solid var(--line); border-radius: 9px;
  padding: 8px 14px; font-size: 12.5px; z-index: 60; animation: pop .2s ease; }

/* 구단 선택 모달 */
.team-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; margin-bottom: 14px; }
.team-pick { display: flex; flex-direction: column; align-items: center; gap: 5px;
  background: var(--panel2); border: 1px solid var(--line); color: var(--txt);
  border-radius: 8px; padding: 9px 2px; font-weight: 700; font-size: 12px; cursor: pointer; }
.team-pick .tlogo.lg { width: 34px; height: 34px; }
.team-pick:hover { border-color: var(--accent); }
.team-pick.active { background: var(--accent); color: #06202f; border-color: var(--accent); }
.team-pick.active .tlogo { filter: drop-shadow(0 0 2px rgba(0,0,0,.35)); }

/* =================== 구단 로고(공통) =================== */
.tlogo { object-fit: contain; vertical-align: middle; flex: none; }
.tlogo.xs { width: 13px; height: 13px; }
.tlogo.sm { width: 17px; height: 17px; }
.tlogo.lg { width: 32px; height: 32px; }
.tlogo.av-logo { width: 22px; height: 22px; }
/* 로고 + 팀명 묶음(표 셀·정보 행 등에서 inline 정렬) */
.tcell { display: inline-flex; align-items: center; gap: 5px; min-width: 0; vertical-align: middle; }
.tcell .tnm { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rec-table .pl-tm .tcell { gap: 4px; }
.name-row { display: flex; align-items: center; gap: 8px; }
.name-row label { font-size: 12px; color: var(--muted); white-space: nowrap; }
.name-row input { flex: 1; background: var(--panel2); border: 1px solid var(--line); color: var(--txt);
  border-radius: 8px; padding: 9px 10px; font-size: 13px; font-family: inherit; }
.name-row input:focus { outline: none; border-color: var(--accent); }

/* =================== 튜토리얼(신규 게임 시작 안내) =================== */
.tut-modal { max-width: 440px; }
.tut-top { display: flex; align-items: center; gap: 8px; margin-bottom: 4px; }
.tut-step { font-size: 11px; color: var(--muted); font-weight: 700; }
.tut-skip { margin-left: auto; background: none; border: none; color: var(--muted);
  font-size: 11.5px; cursor: pointer; text-decoration: underline; padding: 2px 4px; }
.tut-skip:hover { color: var(--txt); }
.tut-page { min-height: 318px; animation: tutFade .22s ease; }
@keyframes tutFade { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.tut-head { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.tut-emoji { font-size: 30px; line-height: 1; }
.tut-title { font-size: 17px; font-weight: 800; }
.tut-intro { font-size: 13px; line-height: 1.7; color: var(--txt); margin-bottom: 12px; }
.tut-bullets { list-style: none; display: flex; flex-direction: column; gap: 7px; margin: 10px 0 0; }
.tut-bullets li { position: relative; padding-left: 18px; font-size: 12.5px; line-height: 1.55; color: var(--txt); }
.tut-bullets li::before { content: '▸'; position: absolute; left: 2px; top: 0; color: var(--accent2); font-weight: 800; }
.tut-bullets li b { color: var(--accent2); }
.tut-callout { margin-top: 12px; padding: 9px 12px; border-radius: 10px; font-size: 12px; line-height: 1.6;
  color: var(--win); background: rgba(84,214,138,.08); border: 1px solid #244a36; }
.tut-callout b { color: #7ce0a6; }

/* 페이지 네비게이션(점 + 이전/다음) */
.tut-nav { display: flex; align-items: center; gap: 8px; margin-top: 16px; }
.tut-dots { display: flex; gap: 6px; margin: 0 auto; }
.tut-dots .d { width: 7px; height: 7px; border-radius: 50%; background: var(--line); transition: all .2s; }
.tut-dots .d.on { background: var(--accent2); width: 18px; border-radius: 4px; }
.tut-nav .btn { flex: none; min-width: 88px; }
.tut-nav .btn.ghost.hidden { visibility: hidden; }

/* 위젯: 리그 7단계 표(현재 단계 강조 + 승급/강등 구간 색) */
.tut-leagues { width: 100%; border-collapse: collapse; font-size: 12px; }
.tut-leagues th, .tut-leagues td { padding: 6px 6px; border-bottom: 1px solid var(--line); text-align: center; }
.tut-leagues th { color: var(--muted); font-weight: 600; font-size: 11px; }
.tut-leagues td.lg { text-align: left; font-weight: 700; }
.tut-leagues .tier { display: inline-block; min-width: 16px; color: var(--muted); }
.tut-leagues tr.start td { color: var(--accent); }
.tut-leagues tr.start td.lg::after { content: ' ◀ 시작'; font-size: 10px; color: var(--accent); }
.tut-leagues .pm { font-size: 11px; }
.tut-leagues .pm.post { color: var(--accent2); }
.tut-leagues .pm.champ { color: var(--sig); }
.tut-leagues .pm.top { color: var(--win); }

/* 위젯: 보상표 */
.tut-reward-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 7px; margin: 4px 0 10px; }
.tut-rw { background: var(--panel2); border: 1px solid var(--line); border-radius: 10px; padding: 9px 4px; text-align: center; }
.tut-rw .t { font-size: 11px; color: var(--muted); font-weight: 700; }
.tut-rw .v { font-size: 17px; font-weight: 800; margin-top: 2px; }
.tut-rw.win .v { color: var(--win); }
.tut-rw.draw .v { color: var(--draw); }
.tut-rw.lose .v { color: var(--lose); }
.tut-stage { width: 100%; border-collapse: collapse; font-size: 11.5px; }
.tut-stage th, .tut-stage td { padding: 5px 4px; border-bottom: 1px solid var(--line); text-align: center; }
.tut-stage th { color: var(--muted); font-weight: 600; }
.tut-stage td.x { color: var(--accent2); font-weight: 800; }

/* 위젯: 등급 카드 */
.tut-grades { display: flex; flex-direction: column; gap: 8px; margin: 4px 0 2px; }
.tut-gr { display: flex; align-items: center; gap: 10px; background: var(--panel2);
  border: 1px solid var(--line); border-radius: 10px; padding: 9px 12px; }
.tut-gr .lead { font-size: 22px; font-weight: 800; min-width: 56px; text-align: center; }
.tut-gr.SEASON { border-left: 3px solid var(--normal); } .tut-gr.SEASON .lead { color: var(--normal); }
.tut-gr.IMPACT { border-left: 3px solid var(--special); } .tut-gr.IMPACT .lead { color: var(--special); }
.tut-gr.SIGNATURE { border-left: 3px solid var(--sig); } .tut-gr.SIGNATURE .lead { color: var(--sig); }
.tut-gr .gx .gname { font-size: 13px; font-weight: 800; }
.tut-gr .gx .gdesc { font-size: 11px; color: var(--muted); margin-top: 1px; }

/* 위젯: 로스터 구성도 */
.tut-roster { display: flex; flex-direction: column; gap: 8px; margin: 4px 0 2px; }
.tut-rrow { background: var(--panel2); border: 1px solid var(--line); border-radius: 10px; padding: 9px 12px; }
.tut-rrow .rh { font-size: 12px; font-weight: 800; color: var(--accent); margin-bottom: 5px; }
.tut-chips { display: flex; flex-wrap: wrap; gap: 4px; }
.tut-chips span { font-size: 10.5px; font-weight: 700; color: var(--txt); background: var(--bg);
  border: 1px solid var(--line); border-radius: 6px; padding: 2px 7px; }

/* =================== 선수 카드 상세 / 후보 능력치 비교 =================== */
/* 카드 헤더(로고·이름·등급·포지션 + OVR) */
.pc-head { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.pc-id { flex: 1; min-width: 0; }
.pc-nm { font-size: 15px; font-weight: 800; }
.pc-sub { font-size: 11.5px; color: var(--muted); margin-top: 3px; display: flex; align-items: center; gap: 4px; }
.pc-ovr { text-align: center; background: var(--panel2); border: 1px solid var(--line); border-radius: 10px; padding: 4px 12px; }
.pc-ovr .o { font-size: 22px; font-weight: 900; color: var(--accent); line-height: 1.05; }
.pc-ovr .ol { font-size: 9px; color: var(--muted); font-weight: 700; }

/* 스탯 막대(단일 카드 상세) */
.stat-bars { display: flex; flex-direction: column; gap: 7px; }
.stat-row { display: grid; grid-template-columns: 38px 1fr 26px; align-items: center; gap: 8px; }
.stat-row .sl { font-size: 12px; color: var(--muted); font-weight: 600; }
.stat-row .sbar { height: 8px; background: var(--bg); border-radius: 5px; overflow: hidden; }
.stat-row .sfill { display: block; height: 100%; border-radius: 5px; transition: width .25s; }
.stat-row .sfill.elite { background: var(--sig); }
.stat-row .sfill.good { background: var(--accent); }
.stat-row .sfill.avg { background: var(--win); }
.stat-row .sfill.low { background: var(--muted); }
.stat-row .sv { font-size: 13px; font-weight: 800; text-align: right; }

/* 후보 비교 패널(피커 하단) */
.cmp-panel { margin-top: 10px; }
.cmp-panel:empty { display: none; }
.cmp-table { background: var(--panel2); border: 1px solid var(--line); border-radius: 10px; padding: 8px 12px; }
.cmp-head, .cmp-row { display: grid; grid-template-columns: 44px 1fr 50px 1fr; align-items: center; }
.cmp-head { padding-bottom: 6px; margin-bottom: 2px; border-bottom: 1px solid var(--line); }
.cmp-head .cv { color: var(--muted); font-weight: 700; font-size: 11px; text-align: center;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cmp-head .cv.cand { color: var(--accent); }
.cmp-row { padding: 4px 0; font-size: 13px; }
.cmp-row .cl { font-size: 11.5px; color: var(--muted); }
.cmp-row .cv { text-align: center; font-weight: 700; }
.cmp-row .cv.cand { color: var(--txt); font-weight: 800; }
.cmp-row .cd { text-align: center; font-size: 11px; font-weight: 800; }
.cmp-row .cd.up { color: var(--win); }
.cmp-row .cd.down { color: var(--lose); }
.cmp-row .cd.same, .cmp-row .cd.na { color: var(--muted); }
.cmp-row.ovr { margin-top: 4px; border-top: 1px solid var(--line); padding-top: 6px; }
.cmp-row.ovr .cl { color: var(--txt); font-weight: 800; }
.cmp-row.ovr .cv.cand { color: var(--accent); }

/* 후보 선택 강조 */
.cand.selected { border-color: var(--accent); box-shadow: inset 0 0 0 1.5px var(--accent); }

/* 뽑기 카드: 눌러서 능력치 보기 */
.draw-card[data-card] { cursor: pointer; transition: transform .1s, border-color .15s; }
.draw-card[data-card]:hover { transform: translateY(-1px); }
.draw-card .tap-hint { font-size: 9px; color: var(--accent); font-weight: 700; }

/* =================== 선수 강화 =================== */
/* 강화 단계 배지(카드 모든 위치). 5단계(MAX)는 흐르는 금빛+글로우로 화려하게 */
.enh { display: inline-block; font-size: 9.5px; font-weight: 800; color: #06202f; background: var(--accent2);
  border-radius: 5px; padding: 1px 5px; vertical-align: middle; line-height: 1.45; }
.enh.max { color: #3a2400; background: linear-gradient(90deg, #ffce54, #ff7a3d, #ffce54, #ff7a3d);
  background-size: 300% 100%; animation: enhmax 2.2s linear infinite; box-shadow: 0 0 7px rgba(255,170,60,.7); }
@keyframes enhmax { from { background-position: 0% 0; } to { background-position: 300% 0; } }
/* 강화 화면 목록 + 모달 */
.enh-row { cursor: pointer; }
.enh-meta { display: flex; gap: 8px; margin-top: 12px; }
.enh-meta .em { flex: 1; background: var(--panel2); border: 1px solid var(--line); border-radius: 10px; padding: 9px 10px; text-align: center; }
.enh-meta .em .k { display: block; font-size: 11px; color: var(--muted); margin-bottom: 2px; }
.enh-meta .em .v { font-size: 17px; font-weight: 800; }
.enh-meta .em .v.lack { color: var(--lose); }
.enh-maxed { text-align: center; padding: 20px 10px; font-size: 15px; font-weight: 800; color: var(--sig); }

.empty-note { color: var(--muted); text-align: center; padding: 24px 12px; font-size: 13px; }
/* 후보 리스트는 자체 스크롤을 두지 않는다 → 모달 하나만 스크롤(이중 스크롤 방지) */
.cand-list { display: flex; flex-direction: column; gap: 6px; padding-bottom: 4px; }
/* 비교+버튼은 모달 하단에 sticky 고정 → 후보가 길어 모달이 스크롤돼도 항상 보임. 단일 스크롤 유지 */
.picker-modal .pick-foot { position: sticky; bottom: -16px; margin: 8px -16px -16px; padding: 10px 16px 16px;
  background: var(--panel); border-top: 1px solid var(--line); }
.picker-modal .pick-foot .row-btns { margin-top: 10px; }

/* 후보창: 이미 라인업에 편성된 선수 구분 */
.cand.in-use { background: var(--bg); border-color: #34404e; opacity: .9; }
.cand.in-use .ovr { opacity: .6; }
.cand.is-current { border-color: var(--accent); box-shadow: inset 0 0 0 1px rgba(78,161,255,.35); }
.badge-used, .badge-cur { font-size: 10px; font-weight: 800; border-radius: 5px; padding: 1px 6px; margin-left: 6px;
  white-space: nowrap; vertical-align: middle; }
.badge-used { color: var(--accent2); border: 1px solid #3a3320; background: rgba(255,181,71,.12); }
.badge-cur { color: var(--accent); border: 1px solid #24405c; background: rgba(78,161,255,.14); }
.muted { color: var(--muted); }
.center { text-align: center; }
.mt8 { margin-top: 8px; } .mt12 { margin-top: 12px; }

/* =========================================================================
 * 라이브 스타디움 뷰 (경기 화면)
 * ========================================================================= */
.livewrap { display: flex; flex-direction: column; gap: 10px; height: 100%; }
.livewrap > .score-banner, .livewrap > .stadium, .livewrap > .meta-strip { flex: none; }

/* 점수 배너 */
.score-banner { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center;
  background: linear-gradient(180deg,#212c3c,#141a24); border: 1px solid var(--line);
  border-radius: 12px; padding: 8px 12px; }
.sb-side { display: flex; align-items: center; gap: 10px; }
.sb-side.away { justify-content: flex-start; }
.sb-side.home { justify-content: flex-end; }
.sb-side .chip { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; font-weight: 800;
  letter-spacing: .4px; padding: 3px 8px; border-radius: 7px; background: var(--panel2);
  border: 1px solid var(--line); color: var(--muted); max-width: 96px; white-space: nowrap; }
.sb-side .chip .ab { overflow: hidden; text-overflow: ellipsis; }
.sb-side .chip.me { color: #06202f; background: var(--accent); border-color: var(--accent); }
.sb-side .chip .chip-logo { width: 20px; height: 20px; }
.sb-side .rn { font-size: 30px; font-weight: 900; line-height: 1; min-width: 30px; text-align: center; }
.sb-center { text-align: center; padding: 0 10px; }
.sb-center .inn { font-size: 19px; font-weight: 800; line-height: 1.1; }
.sb-center .ud { font-size: 11px; color: var(--accent2); height: 13px; font-weight: 700; }

/* 스타디움 */
.stadium { position: relative; width: 100%; aspect-ratio: 1/1; border-radius: 14px; overflow: hidden;
  border: 1px solid var(--line); background: #0b1020; }
/* 아이소 도트 야구장 캔버스(js/iso-field.js): 저해상도 버퍼를 정수배로 키운 것이라 nearest로 표시 */
.iso-cv { position: absolute; left: 0; top: 0; display: block; image-rendering: pixelated; }
.callflash { position: absolute; left: 50%; top: 44%; transform: translate(-50%,-50%);
  font-size: 26px; font-weight: 900; z-index: 8; pointer-events: none; opacity: 0; white-space: nowrap;
  text-shadow: 0 2px 8px #000, 0 0 16px rgba(0,0,0,.7); }
.callflash.show { animation: flashpop .6s ease forwards; }
.callflash.ball { color: #54d68a; } .callflash.strike { color: var(--accent2); }
.callflash.foul { color: #d3dae2; } .callflash.hit { color: #fff; }
.callflash.out { color: #ff6b6b; } .callflash.hr { color: #ffd24a; font-size: 30px; }
@keyframes flashpop {
  0% { opacity: 0; transform: translate(-50%,-50%) scale(.5); }
  18% { opacity: 1; transform: translate(-50%,-50%) scale(1.18); }
  78% { opacity: 1; transform: translate(-50%,-50%) scale(1); }
  100% { opacity: 0; transform: translate(-50%,-50%) scale(1.02); }
}

/* 오버레이: B-S-O 카운트 */
.bso { position: absolute; top: 8px; left: 8px; z-index: 9; background: rgba(10,14,20,.74);
  border: 1px solid var(--line); border-radius: 9px; padding: 5px 8px; display: flex; gap: 9px; align-items: center; }
.bso .grp { display: flex; align-items: center; gap: 3px; }
.bso .k { color: var(--muted); font-weight: 800; font-size: 10px; width: 9px; }
.pip { width: 9px; height: 9px; border-radius: 50%; background: rgba(255,255,255,.16);
  border: 1px solid rgba(255,255,255,.28); }
.pip.b.on { background: #54d68a; border-color: #54d68a; }
.pip.s.on { background: var(--accent2); border-color: var(--accent2); }
.pip.o.on { background: var(--lose); border-color: var(--lose); }

/* 선수 카드 오버레이 */
.pcard, .bcard { position: absolute; bottom: 8px; z-index: 9; width: 45%; max-width: 180px;
  background: rgba(11,15,21,.84); border: 1px solid var(--line); border-radius: 10px;
  padding: 6px 8px; display: flex; gap: 7px; align-items: center; }
.pcard { left: 8px; } .bcard { right: 8px; flex-direction: row-reverse; text-align: right; }
.pcard.me, .bcard.me { border-color: var(--accent); box-shadow: 0 0 10px rgba(78,161,255,.3); }
.pcard .av, .bcard .av { width: 30px; height: 30px; border-radius: 50%; flex: none;
  background: linear-gradient(160deg,#3a4658,#222b38); display: flex; align-items: center;
  justify-content: center; font-weight: 900; font-size: 14px; color: #fff; border: 1px solid var(--line); }
.pcard .info, .bcard .info { min-width: 0; flex: 1; }
.pcard .role, .bcard .role { font-size: 9px; color: var(--accent2); font-weight: 800; }
.pcard .nm, .bcard .nm { font-size: 12px; font-weight: 800; white-space: nowrap;
  overflow: hidden; text-overflow: ellipsis; }
.pcard .stat, .bcard .stat { font-size: 9.5px; color: var(--muted); white-space: nowrap;
  overflow: hidden; text-overflow: ellipsis; }

.meta-strip { display: flex; align-items: center; justify-content: center; gap: 8px;
  font-size: 11.5px; min-height: 18px; position: relative; }
.skip-btn { position: absolute; right: 4px; top: 50%; transform: translateY(-50%);
  background: var(--panel2, rgba(255,255,255,.06)); color: var(--muted);
  border: 1px solid var(--line, rgba(255,255,255,.12)); border-radius: 6px;
  font-size: 10px; font-weight: 800; padding: 2px 8px; cursor: pointer; }
.skip-btn:hover { color: var(--txt); border-color: var(--accent2); }
