/* 게임 화면 틀 (PC 기준): 왼쪽 사이드바 + 오른쪽(위치 · 날짜 바 / 세그먼트 / 본문). 태블릿 · 모바일은 사이드바를 햄버거로 숨긴다 */
#screen-game { flex-direction: row !important; --sb-w: 232px; }
#screen-game .gm-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }

/* ---------- 사이드바 ---------- */
.sidebar {
  width: var(--sb-w); flex: none; display: flex; flex-direction: column; gap: 6px;
  background: linear-gradient(180deg, #0c1322, #0a0f1b); border-right: 1px solid var(--line);
  padding: 14px 10px 46px; overflow-y: auto; z-index: 30;
}
.sb-team { display: flex; align-items: center; gap: 10px; padding: 4px 8px 14px; margin-bottom: 4px; border-bottom: 1px solid var(--line); }
.sb-team .tb-badge { width: 40px; height: 40px; }
.sb-tname { min-width: 0; display: flex; flex-direction: column; line-height: 1.25; }
.sb-tname b { font-family: var(--f-ui); font-size: 16px; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sb-tname small { color: var(--muted); font-size: 11px; letter-spacing: .06em; }

.sidebar .tb-menu { display: flex; flex-direction: column; gap: 2px; height: auto; margin: 0; }
.sidebar .tb-item { display: block; position: static; }
.sidebar .tb-link {
  display: flex; align-items: center; gap: 11px; padding: 9px 10px; border-radius: 8px; border: 0;
  color: var(--muted); font-family: var(--f-ui); font-weight: 700; font-size: 16px; letter-spacing: .02em; text-decoration: none;
}
.sidebar .tb-link:hover { background: rgba(255, 255, 255, .04); color: var(--text); }
.sidebar .tb-item.on .tb-link { color: var(--gold-2); background: linear-gradient(90deg, rgba(200, 162, 74, .16), rgba(200, 162, 74, .03)); box-shadow: inset 3px 0 0 var(--gold); }
.sb-ic { width: 19px; height: 19px; flex: none; opacity: .9; }
.sb-tabs { display: none; flex-direction: column; padding: 3px 0 8px 40px; }
.sidebar .tb-item.on .sb-tabs { display: flex; }
.sb-tabs a { padding: 6px 10px; border-radius: 6px; color: var(--muted); font-size: 13.5px; text-decoration: none; }
.sb-tabs a:hover { color: var(--text); background: rgba(255, 255, 255, .04); }
.sb-tabs a.on { color: var(--text); font-weight: 700; background: rgba(255, 255, 255, .06); }
.sb-scrim { display: none; }

/* ---------- 위쪽 바: 뒤로/앞으로 · 위치 · 날짜 · 계속 ---------- */
#screen-game .topbar { gap: 12px; padding: 0 18px; }
.tb-crumb { display: flex; align-items: center; gap: 8px; min-width: 0; font-family: var(--f-ui); font-size: 17px; color: var(--muted); white-space: nowrap; }
.tb-crumb svg { width: 10px; height: 10px; opacity: .6; }
.tb-crumb b { color: var(--text); font-size: 20px; letter-spacing: .01em; }

/* ---------- 세그먼트 (합친 탭) ---------- */
#screen-game .subtabs:not([hidden]) {
  display: flex; align-items: center; gap: 6px; height: auto; min-height: 50px; padding: 8px 18px;
  background: rgba(10, 15, 27, .6); border-bottom: 1px solid var(--line);
}
#screen-game .subtabs[hidden] { display: none; }
#screen-game:not(.locked) .subtabs a {
  padding: 7px 16px; border: 1px solid var(--line); border-radius: 999px; border-bottom-width: 1px;
  color: var(--muted); font-size: 13.5px; font-weight: 600; text-decoration: none; white-space: nowrap;
}
#screen-game:not(.locked) .subtabs a:hover { color: var(--text); border-color: #3a4866; }
#screen-game:not(.locked) .subtabs a.on { color: #1a1306; background: var(--gold-2); border-color: var(--gold-2); }

/* ---------- 본문: PC 폭을 넓게 쓴다 ---------- */
#screen-game .game-body { padding: 22px 26px; font-size: 14.5px; }
#screen-game .cr-page { max-width: 1560px; }

/* 경기 중 잠금: 사이드바 메뉴 숨김 */
#screen-game.locked .sidebar .tb-menu { visibility: hidden; pointer-events: none; }

/* ---------- 태블릿 · 모바일: 사이드바는 햄버거로 ---------- */
@media (max-width: 1100px) {
  #screen-game .tb-burger { display: inline-flex; order: -1; }
  .sidebar { position: fixed; left: 0; top: 0; bottom: var(--footer-h, 34px); transform: translateX(-100%); transition: transform .2s; box-shadow: 8px 0 30px rgba(0, 0, 0, .5); }
  #screen-game.menu-open .sidebar { transform: none; }
  #screen-game.menu-open .sb-scrim { display: block; position: fixed; inset: 0; z-index: 29; background: rgba(0, 0, 0, .45); }
  .sidebar .tb-menu { display: flex !important; position: static; }
  #screen-game .game-body { padding: 14px; }
  .tb-crumb span, .tb-crumb svg { display: none; }
  .tb-crumb b { font-size: 17px; }
}
.sb-team .tb-badge { margin-left: 0 !important; }

/* ---------- 위쪽 툴바 모드 (#screen-game.nav-top) ---------- */
.tb-tabs { display: none; }
#screen-game.nav-top { flex-direction: column !important; }
#screen-game.nav-top .sidebar {
  position: static; transform: none; box-shadow: none; width: auto; height: 58px; flex-direction: row; align-items: stretch; gap: 0;
  padding: 0 18px; overflow: visible; border-right: 0; border-bottom: 1px solid var(--line);
  background: linear-gradient(180deg, #0e1628, #0b111e);
}
#screen-game.nav-top .sb-team { padding: 0 22px 0 0; margin: 0 8px 0 0; border-bottom: 0; border-right: 1px solid var(--line); }
#screen-game.nav-top .sb-team .tb-badge { width: 36px; height: 36px; }
#screen-game.nav-top .sidebar .tb-menu { flex-direction: row; gap: 2px; }
#screen-game.nav-top .sidebar .tb-item { display: flex; }
#screen-game.nav-top .sidebar .tb-link { border-radius: 0; padding: 0 16px; gap: 8px; font-size: 16.5px; box-shadow: none; border-bottom: 2px solid transparent; }
#screen-game.nav-top .sidebar .tb-item.on .tb-link { background: linear-gradient(180deg, transparent 40%, rgba(200, 162, 74, .1)); border-bottom-color: var(--gold); box-shadow: none; }
#screen-game.nav-top .sb-tabs { display: none !important; }
#screen-game.nav-top .tb-crumb { display: none; }
#screen-game.nav-top .topbar { height: 48px; background: rgba(12, 18, 32, .9); }
#screen-game.nav-top .tb-tabs { display: flex; align-items: stretch; height: 100%; gap: 2px; margin-left: 6px; overflow-x: auto; scrollbar-width: none; }
#screen-game.nav-top .tb-tabs a { display: flex; align-items: center; padding: 0 14px; color: var(--muted); font-size: 14.5px; font-weight: 600; text-decoration: none; border-bottom: 2px solid transparent; white-space: nowrap; }
#screen-game.nav-top .tb-tabs a:hover { color: var(--text); }
#screen-game.nav-top .tb-tabs a.on { color: var(--text); border-bottom-color: var(--gold-2); }
#screen-game.nav-top .sb-scrim { display: none !important; }
#screen-game.nav-top .tb-burger { display: none !important; }
@media (max-width: 1100px) {
  #screen-game.nav-top .sidebar { overflow-x: auto; padding: 0 8px; }
  #screen-game.nav-top .sb-tname { display: none; }
  #screen-game.nav-top .sidebar .tb-link { padding: 0 10px; font-size: 15px; }
  #screen-game.nav-top .sidebar .tb-link span { display: none; }
}
/* 위쪽 툴바 모드: 세로로 쌓이면 본문 영역이 화면 높이를 넘겨 늘어나 스크롤이 안 되던 문제 (flex 자식은 min-height: 0이어야 안쪽에서 스크롤된다) */
#screen-game.nav-top .gm-main { min-height: 0; }
#screen-game.nav-top .sidebar { flex: none; }
/* 작은 폰(400px 이하): 두 번째 줄 탭이 옆 버튼에 가려 잘리지 않게 (1.0 전 점검) */
@media (max-width: 400px) { #screen-game.nav-top .tb-tabs a { padding: 0 9px; font-size: 13.5px; } #screen-game.nav-top .tb-tabs { margin-left: 2px; } }
