:root {
  --bg: #0f1420;
  --card: #1a2230;
  --card-2: #222d40;
  --text: #e8edf4;
  --muted: #8a97ab;
  --line: #2d3a50;
  --korea: #c8102e;
  --korea-bg: rgba(200, 16, 46, 0.16);
  --good: #2ecc71;
  --warn: #f1c40f;
  --bad: #e74c3c;
  --best: #2ecc71;
  --best-bg: rgba(46, 204, 113, 0.18);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  padding: 0 16px 48px;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto,
    'Helvetica Neue', Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
}

main {
  max-width: 900px;
  margin: 0 auto;
}

/* 헤더 */
.page-header {
  max-width: 900px;
  margin: 0 auto;
  padding: 28px 0 12px;
  text-align: center;
}

.page-header h1 {
  margin: 0 0 8px;
  font-size: 1.55rem;
}

.status {
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.status.error {
  color: var(--bad);
}

/* 섹션 공통 */
.section {
  margin-top: 28px;
}

.section h2 {
  font-size: 1.2rem;
  margin: 0 0 6px;
  border-left: 4px solid var(--korea);
  padding-left: 10px;
}

.section-note {
  color: var(--muted);
  font-size: 0.88rem;
  margin: 0 0 14px;
}

.section-note.small {
  font-size: 0.8rem;
  margin-top: 10px;
}

/* 진출 확률 카드 */
.prob-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 28px 20px;
  text-align: center;
}

.prob-label {
  color: var(--muted);
  font-size: 0.95rem;
}

.prob-value {
  font-size: 3.4rem;
  font-weight: 800;
  margin: 6px 0;
  letter-spacing: -1px;
}

.prob-value.good {
  color: var(--good);
}
.prob-value.warn {
  color: var(--warn);
}
.prob-value.bad {
  color: var(--bad);
}

.prob-sub {
  color: var(--muted);
  font-size: 0.82rem;
}

/* 3위 순위표 */
.standings {
  width: 100%;
  border-collapse: collapse;
  background: var(--card);
  border-radius: 12px;
  overflow: hidden;
  font-size: 0.9rem;
}

.standings th,
.standings td {
  padding: 9px 8px;
  text-align: center;
  border-bottom: 1px solid var(--line);
}

.standings th {
  background: var(--card-2);
  color: var(--muted);
  font-weight: 600;
  font-size: 0.8rem;
}

.standings .team-col {
  text-align: left;
  font-weight: 600;
}

.standings .rank-col {
  font-weight: 700;
  color: var(--muted);
}

.standings tr.out td {
  color: var(--muted);
  background: rgba(231, 76, 60, 0.06);
}

.standings tr.cutline td {
  border-bottom: 2px dashed var(--good);
}

.standings tr.korea td {
  background: var(--korea-bg);
  color: var(--text);
}

.standings tr.korea .team-col {
  color: #ff8ba0;
}

.standings .third-col {
  text-align: left;
  white-space: nowrap;
  font-size: 0.82rem;
}

.third-pending {
  color: var(--muted);
}

.third-result {
  font-weight: 700;
}

.third-result.r-승 {
  color: var(--good);
}
.third-result.r-패 {
  color: var(--bad);
}
.third-result.r-무 {
  color: var(--warn);
}

.proj-adv {
  font-weight: 700;
}
.proj-adv.in {
  color: var(--good);
}
.proj-adv.no {
  color: var(--bad);
}

.third-expected {
  font-size: 0.72rem;
  font-weight: 700;
  padding: 1px 5px;
  border-radius: 4px;
  border: 1px dashed currentColor;
}

.third-expected.r-승 {
  color: var(--good);
}
.third-expected.r-패 {
  color: var(--bad);
}
.third-expected.r-무 {
  color: var(--warn);
}

/* 응원 가이드 */
.guide-sub {
  font-size: 1rem;
  margin: 22px 0 10px;
}

.guide-sub.muted {
  color: var(--muted);
}

.match-row {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 12px 14px;
  margin-bottom: 10px;
}

.match-title {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}

.match-time {
  background: var(--card-2);
  color: var(--text);
  font-size: 0.78rem;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 6px;
}

.match-group {
  background: var(--card-2);
  color: var(--muted);
  font-size: 0.78rem;
  padding: 2px 8px;
  border-radius: 6px;
}

.match-teams {
  font-weight: 600;
}

.match-flag {
  margin-left: auto;
  color: #ff8ba0;
  font-size: 0.8rem;
  font-weight: 600;
}

.outcome-bar {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 8px;
}

.outcome {
  background: var(--card-2);
  border: 1px solid transparent;
  border-radius: 8px;
  padding: 8px 4px;
  text-align: center;
}

.outcome-label {
  font-size: 0.78rem;
  color: var(--muted);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
}

.fav-tag {
  background: #3a4258;
  color: #cdd6e6;
  font-size: 0.62rem;
  font-weight: 700;
  padding: 1px 5px;
  border-radius: 4px;
}

.outcome.favorite {
  box-shadow: inset 0 0 0 1px #4a5878;
}

.outcome.cheer-pick {
  background: var(--korea-bg);
  box-shadow: inset 0 0 0 2px var(--korea);
}

.cheer-tag {
  background: var(--korea);
  color: #fff;
  font-size: 0.62rem;
  font-weight: 700;
  padding: 1px 5px;
  border-radius: 4px;
}

.outcome.favorite .fav-tag {
  background: #ffd24a;
  color: #2a2300;
}


.outcome-pct {
  font-size: 1.05rem;
  font-weight: 700;
  margin-top: 2px;
}

.outcome-pct.fav-pct {
  color: var(--best);
}

.cheer {
  margin-top: 10px;
  color: var(--good);
  font-weight: 600;
  font-size: 0.9rem;
}

/* 푸터 */
.page-footer {
  max-width: 900px;
  margin: 36px auto 0;
  text-align: center;
  color: var(--muted);
  font-size: 0.78rem;
}

/* 최악의 시나리오 TOP3 */
.worst-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.worst-item {
  display: flex;
  align-items: center;
  gap: 14px;
  background: var(--card);
  border: 1px solid var(--line);
  border-left: 4px solid var(--bad);
  border-radius: 10px;
  padding: 12px 14px;
}

.worst-rank {
  font-size: 1.6rem;
  font-weight: 800;
  color: var(--bad);
  min-width: 24px;
  text-align: center;
}

.worst-body {
  flex: 1;
}

.worst-head {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 6px;
}

.worst-teams {
  font-weight: 600;
}

.worst-detail {
  color: var(--bad);
  font-weight: 600;
  font-size: 0.9rem;
}

/* 표 가로 스크롤 래퍼 (모바일에서 표 깨짐 방지) */
.table-scroll {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border-radius: 12px;
}

.table-scroll .standings {
  border-radius: 0;
}

@media (max-width: 560px) {
  body {
    padding: 0 12px 40px;
  }
  .page-header {
    padding: 20px 0 10px;
  }
  .page-header h1 {
    font-size: 1.25rem;
  }
  .section h2 {
    font-size: 1.05rem;
  }
  .prob-card {
    padding: 22px 16px;
  }
  .prob-value {
    font-size: 2.6rem;
  }

  /* 표: 가로 스크롤 안에서 줄바꿈 없이, 핵심 컬럼만 넉넉히 */
  .standings {
    font-size: 0.82rem;
    min-width: 460px;
  }
  .standings th,
  .standings td {
    padding: 8px 6px;
    white-space: nowrap;
  }
  .standings .team-col {
    position: sticky;
    left: 0;
    background: var(--card);
    z-index: 1;
  }
  .standings tr.korea .team-col {
    background: #2a1820;
  }
  .standings tr.out .team-col {
    background: #1c1f29;
  }

  /* 응원 가이드: 3분할 그대로 두되 글자 축소 */
  .outcome {
    padding: 8px 2px;
  }
  .outcome-label {
    font-size: 0.7rem;
    flex-direction: column;
    gap: 2px;
  }
  .outcome-pct {
    font-size: 0.95rem;
  }
  .match-teams {
    font-size: 0.92rem;
  }
  .cheer {
    font-size: 0.82rem;
  }

  /* 최악 시나리오 */
  .worst-item {
    gap: 10px;
    padding: 10px 12px;
  }
  .worst-rank {
    font-size: 1.3rem;
    min-width: 18px;
  }
  .worst-detail {
    font-size: 0.84rem;
  }
}

@media (max-width: 380px) {
  .outcome-label {
    font-size: 0.64rem;
  }
  .fav-tag,
  .cheer-tag {
    font-size: 0.56rem;
    padding: 1px 4px;
  }
  .match-time,
  .match-group {
    font-size: 0.72rem;
  }
}
