:root {
  /* 로또랩 색: 남색 바탕에 노랑 강조. 처음 디자인보다 한 단계씩 밝게, 패널은 반투명 유리처럼 잡았다. */
  --bg: #1b2240;
  --panel: rgba(255, 255, 255, 0.07);
  --soft: rgba(255, 255, 255, 0.07);
  --line: rgba(255, 255, 255, 0.14);
  --text: #f6f8ff;
  --muted: #b7bfdc;
  --faint: #8f98ba;
  --accent: #ffd23f;
  --sky: #69c8f2;
  --danger: #ff9a9a;
  /* 3D 추첨기가 놓이는 무대. `render/mod.rs`의 배경색과 같다. */
  --stage: #141a33;
  --shadow: 0 10px 30px rgba(6, 9, 26, 0.3);
  --brand: #ffd23f;
  --chip: rgba(255, 255, 255, 0.06);
  --chip-strong: rgba(255, 255, 255, 0.1);
  --ad-bg: rgba(10, 13, 32, 0.35);
  --glow-sky: rgba(105, 200, 242, 0.3);
  --glow-violet: rgba(140, 120, 255, 0.28);
  --glow-yellow: rgba(255, 210, 63, 0.2);
  /* 광고 영역 높이. 광고가 늦게 떠도 본문이 밀리지 않도록 미리 잡아 둔다. */
  --ad-height: 100px;
}

/* 밝은 테마(기본). `index.html`의 스크립트와 머리말 버튼이 `<html data-theme>`를 정한다.
   추첨기 캔버스는 두 테마 모두 어두운 무대로 둔다. 레일과 혼합실이 밝은 색이라 흰 바탕에서는 보이지 않는다. */
:root[data-theme="light"] {
  --bg: #ffffff;
  --panel: #ffffff;
  --soft: #f3f5fb;
  --line: #e3e7f1;
  --text: #1b2240;
  --muted: #5d6688;
  --faint: #8a92b0;
  --danger: #d6336c;
  --shadow: 0 8px 24px rgba(27, 34, 64, 0.08);
  --brand: #f2a900;
  --chip: #f3f5fb;
  --chip-strong: #e8ebf4;
  --ad-bg: #f6f7fb;
  --glow-sky: rgba(105, 200, 242, 0.16);
  --glow-violet: rgba(140, 120, 255, 0.1);
  --glow-yellow: rgba(255, 210, 63, 0.14);
}

@media (min-width: 768px) {
  :root {
    --ad-height: 90px;
  }
}

* {
  box-sizing: border-box;
}

html {
  background: var(--bg);
}

body {
  /* 위쪽에 하늘색·보라·노랑 빛을 깔아 화면을 밝힌다. */
  background:
    radial-gradient(900px 460px at 8% -80px, var(--glow-sky), transparent 70%),
    radial-gradient(700px 420px at 55% -140px, var(--glow-violet), transparent 70%),
    radial-gradient(760px 400px at 96% -60px, var(--glow-yellow), transparent 70%),
    var(--bg);
  background-repeat: no-repeat;
}

html,
body {
  margin: 0;
  color: var(--text);
  font-family: "Pretendard", "Apple SD Gothic Neo", "Malgun Gothic", system-ui, sans-serif;
  -webkit-text-size-adjust: 100%;
}

a {
  color: inherit;
}

.page {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  padding-left: env(safe-area-inset-left);
  padding-right: env(safe-area-inset-right);
}

/* ---------- 광고 ---------- */

.ad-slot {
  flex: none;
  height: var(--ad-height);
  min-height: var(--ad-height);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--ad-bg);
  border-bottom: 1px solid var(--line);
}

.ad-slot--top {
  padding-top: env(safe-area-inset-top);
  height: calc(var(--ad-height) + env(safe-area-inset-top));
}

.ad-slot--bottom {
  border-bottom: 0;
  border-top: 1px solid var(--line);
  /* 광고와 그 위의 조작 요소가 붙지 않게 한다. */
  margin-top: 32px;
  padding-bottom: env(safe-area-inset-bottom);
  height: calc(var(--ad-height) + env(safe-area-inset-bottom));
}

.ad-slot__placeholder {
  width: min(100% - 32px, 728px);
  height: calc(var(--ad-height) - 20px);
  border: 1px dashed var(--line);
  border-radius: 6px;
  color: var(--faint);
  font-size: 12px;
  letter-spacing: 0.08em;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ---------- 머리말 ---------- */

.site-header {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  grid-template-areas:
    "title tools"
    "nav nav";
  align-items: center;
  gap: 8px 12px;
  padding: 12px 16px;
  width: min(100%, 1080px);
  margin: 0 auto;
}

.site-header__title {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  font-size: 23px;
  font-weight: 800;
  text-decoration: none;
  letter-spacing: -0.02em;
}

.site-header__logo {
  width: 38px;
  height: 38px;
  flex: none;
}

.site-header__title b {
  color: var(--brand);
}

/* 메뉴는 알약 모양 묶음 하나로 만든다. */
.site-header__title {
  grid-area: title;
}

.site-nav {
  grid-area: nav;
  justify-self: start;
  display: flex;
  gap: 4px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--chip);
}

.site-nav a {
  min-height: 44px;
  padding: 0 16px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  border-radius: 999px;
  color: var(--muted);
  text-decoration: none;
  font-size: 16px;
  font-weight: 700;
  white-space: nowrap;
}

.site-nav__icon {
  width: 22px;
  height: 22px;
  flex: none;
}

.site-nav a:hover {
  color: var(--text);
}

.site-nav a[aria-current="page"] {
  color: #1a1a2e;
  background: var(--accent);
  box-shadow: 0 4px 14px rgba(255, 210, 63, 0.28);
}

@media (max-width: 420px) {
  .site-header {
    padding-inline: 12px;
  }

  .site-nav {
    gap: 2px;
  }

  .site-nav a {
    padding: 0 11px;
    gap: 5px;
    font-size: 14px;
  }

  .site-nav__icon {
    width: 19px;
    height: 19px;
  }
}

/* ---------- 본문 ---------- */

.content {
  flex: 1;
  width: min(100%, 1080px);
  margin: 0 auto;
  padding: 0 16px;
}

.home {
  display: grid;
  /* 자식의 최소 폭이 화면보다 넓어도 열이 따라 넓어지지 않게 한다. */
  grid-template-columns: minmax(0, 1fr);
  gap: 16px;
}

/* 데스크톱: 맨 위에 누적 당첨금 띠, 그 아래에 추첨기와 뽑힌 번호를 같은 높이로 나란히 둔다. */
@media (min-width: 960px) {
  .home {
    grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr);
    grid-template-areas:
      "prize prize"
      "machine draw";
    align-items: stretch;
    gap: 20px;
  }

  .home > .prize-card {
    grid-area: prize;
  }

  .home .machine {
    grid-area: machine;
    display: flex;
  }

  .home .machine__canvas {
    flex: 1 1 0;
    height: auto;
    min-height: 480px;
  }

  .home__side {
    grid-area: draw;
    display: flex;
    flex-direction: column;
  }

  .home__side > .panel:first-child {
    flex: 1;
  }
}

.machine {
  position: relative;
  background: var(--stage);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  border-radius: 22px;
  overflow: hidden;
}

.machine__canvas {
  display: block;
  width: 100%;
  height: clamp(340px, 56vh, 620px);
  /* 모바일에서 주소 표시줄이 숨었다 보일 때마다 추첨기가 커졌다 작아지지 않게 가장 작은 뷰포트 높이를 쓴다. */
  height: clamp(340px, 56svh, 620px);
  touch-action: pan-y;
}

.machine__brand {
  position: absolute;
  top: 14px;
  left: 16px;
  font-size: 22px;
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1;
  color: #eef1f8;
  opacity: 0.9;
  pointer-events: none;
  user-select: none;
}

.machine__brand b {
  color: #ffd23f;
  font-weight: inherit;
}

@media (max-width: 480px) {
  .machine__brand {
    top: 12px;
    left: 14px;
    font-size: 18px;
  }
}

.machine__overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  text-align: center;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.6;
  background: rgba(20, 26, 51, 0.86);
}

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 22px;
  padding: 20px 18px;
  box-shadow: var(--shadow);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
}

.panel + .panel {
  margin-top: 16px;
}

.panel h2 {
  margin: 0 0 12px;
  font-size: 15px;
  font-weight: 700;
}

.round-label {
  margin: 0 0 12px;
  color: var(--muted);
  font-size: 13px;
}

.balls {
  display: flex;
  justify-content: center;
  gap: clamp(6px, 2vw, 12px);
  margin: 0;
  padding: 0;
  list-style: none;
}

.ball {
  flex: none;
  width: clamp(40px, 12vw, 52px);
  aspect-ratio: 1;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: clamp(16px, 4.6vw, 20px);
  font-weight: 800;
  color: #fff;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.35);
  box-shadow: inset -4px -5px 8px rgba(0, 0, 0, 0.22), inset 3px 4px 6px rgba(255, 255, 255, 0.28);
}

.ball--empty {
  background: transparent;
  border: 2px dashed var(--line);
  box-shadow: none;
}

.ball--small {
  width: 30px;
  font-size: 13px;
}

.ball--bonus {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

.games {
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.game {
  display: grid;
  grid-template-columns: 14px minmax(0, 1fr) 58px;
  align-items: center;
  gap: 8px;
  min-height: 44px;
}

.game .balls {
  gap: clamp(3px, 1.2vw, 8px);
}

.balls__plus {
  align-self: center;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.game__label {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.game__status {
  color: var(--muted);
  font-size: 12px;
  text-align: right;
}

.game__status--ok {
  color: var(--text);
}

.game .ball--small {
  /* 좁은 화면에서는 공이 줄어들어 줄 안에 들어간다. */
  flex: 0 1 auto;
  min-width: 0;
  width: clamp(25px, 7.2vw, 30px);
  font-size: clamp(11px, 3.3vw, 13px);
}

.game .retry-button {
  min-height: 36px;
  margin: 0;
  padding: 0 4px;
  font-size: 11px;
  white-space: nowrap;
}

.draw-button {
  width: 100%;
  min-height: 56px;
  margin-top: 18px;
  border: 0;
  border-radius: 999px;
  background: linear-gradient(180deg, #ffe37a, var(--accent));
  color: #1a1a2e;
  box-shadow: 0 8px 22px rgba(255, 210, 63, 0.3);
  font: inherit;
  font-size: 17px;
  font-weight: 800;
  cursor: pointer;
}

.draw-button:disabled {
  background: var(--chip-strong);
  color: var(--faint);
  box-shadow: none;
  cursor: default;
}

.status {
  min-height: 22px;
  margin: 12px 0 0;
  text-align: center;
  font-size: 13px;
  color: var(--muted);
}

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

.retry-button {
  min-height: 44px;
  margin-left: 8px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: transparent;
  color: var(--text);
  font: inherit;
  font-size: 13px;
  cursor: pointer;
}

.disclaimer {
  margin: 14px 0 0;
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
  text-align: center;
}

.notice {
  margin: 16px 0 0;
  color: var(--faint);
  font-size: 12px;
  line-height: 1.6;
}

/* ---------- 집계 ---------- */

/* 누적 당첨금 띠: 위아래로 얇게, 추첨기 위에 둔다. 띠 전체가 당첨 기록으로 가는 링크다. */
.prize-card {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  grid-template-areas:
    "monster main more"
    "detail detail detail";
  align-items: center;
  column-gap: 12px;
  row-gap: 8px;
  padding: 12px 14px;
  border-radius: 22px;
  background:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 220 90'%3E%3Ccircle cx='40' cy='70' r='30' fill='%23fbc400' opacity='.34'/%3E%3Ccircle cx='112' cy='18' r='24' fill='%2369c8f2' opacity='.3'/%3E%3Ccircle cx='178' cy='66' r='34' fill='%23ff7272' opacity='.26'/%3E%3Ccircle cx='96' cy='82' r='14' fill='%23b0d840' opacity='.3'/%3E%3C/svg%3E") right -36px top -22px / auto 120px no-repeat,
    linear-gradient(120deg, #3a3fa8, #4a6fe0 55%, #46a6e6);
  border: 1px solid rgba(255, 255, 255, 0.18);
  color: #fff;
  text-decoration: none;
  box-shadow: var(--shadow);
}

.prize-card:hover,
.prize-card:focus-visible {
  filter: brightness(1.06);
}

.prize-card__logo {
  grid-area: monster;
  width: 44px;
  height: 44px;
  padding: 5px;
  border-radius: 50%;
  background: rgba(14, 18, 40, 0.45);
}

.prize-card__main {
  grid-area: main;
  min-width: 0;
}

.prize-card h2 {
  margin: 0;
  color: rgba(255, 255, 255, 0.82);
  font-size: 12px;
  font-weight: 600;
}

.prize-card__total,
.prize-card__empty {
  margin: 2px 0 0;
}

.prize-card__empty {
  font-size: 14px;
  font-weight: 600;
}

.prize-card__total {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  column-gap: 8px;
}

.prize-card__amount {
  color: var(--accent);
  font-size: clamp(24px, 7.4vw, 30px);
  font-weight: 800;
  line-height: 1.15;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
}

.prize-card__tax {
  color: rgba(255, 255, 255, 0.75);
  font-size: 11px;
}

.prize-card__detail {
  grid-area: detail;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 12px;
  padding-top: 8px;
  border-top: 1px solid rgba(255, 255, 255, 0.2);
  color: rgba(255, 255, 255, 0.85);
  font-size: 12px;
}

.prize-card__cost,
.prize-card__week {
  margin: 0;
}

.rank-line {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 7px;
  margin: 0;
  padding: 4px 0;
  list-style: none;
}

/* 등수 칩: 1~3등은 금·은·동 메달 버튼처럼 볼록하게, 4·5등은 작은 알약. */
.rank-chip {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(14, 18, 40, 0.38);
  white-space: nowrap;
  font-size: 12px;
}

.rank-chip__count {
  color: #fff;
  font-variant-numeric: tabular-nums;
}

.rank-chip--1,
.rank-chip--2,
.rank-chip--3 {
  padding: 7px 14px;
  font-size: 14px;
  font-weight: 800;
  border: 1px solid rgba(255, 255, 255, 0.55);
  box-shadow:
    inset 0 2px 0 rgba(255, 255, 255, 0.65),
    inset 0 -3px 0 rgba(0, 0, 0, 0.18),
    0 4px 10px rgba(10, 14, 40, 0.28);
}

.rank-chip--1 .rank-chip__count,
.rank-chip--2 .rank-chip__count,
.rank-chip--3 .rank-chip__count {
  font-size: 16px;
  text-shadow: none;
}

.rank-chip--2 {
  background: linear-gradient(180deg, #ffffff, #d9e0ee 55%, #b9c3d8);
  color: #3a4566;
}

.rank-chip--2 .rank-chip__count {
  color: #1f2a4a;
}

.rank-chip--3 {
  background: linear-gradient(180deg, #ffd9b0, #e79a5b 55%, #c0703a);
  color: #5a2c0d;
}

.rank-chip--3 .rank-chip__count {
  color: #3d1c05;
}

/* 1등: 금빛 버튼에 빛줄기가 지나가고, 뒤에서 빛이 번지고, 별이 반짝인다. */
.rank-chip--1 {
  isolation: isolate;
  padding: 8px 16px;
  font-size: 15px;
  background: linear-gradient(180deg, #fff6b8, #ffd23f 50%, #f2a900);
  color: #6b4500;
  animation: rank-pulse 2.4s ease-in-out infinite;
}

.rank-chip--1 .rank-chip__count {
  color: #3d2600;
  font-size: 18px;
}

.rank-chip--1::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: linear-gradient(105deg, transparent 35%, rgba(255, 255, 255, 0.9) 50%, transparent 65%);
  background-size: 250% 100%;
  animation: rank-shine 2.4s ease-in-out infinite;
  pointer-events: none;
}

.rank-chip__burst {
  position: absolute;
  inset: -14px -18px;
  z-index: -1;
  border-radius: 50%;
  background:
    repeating-conic-gradient(from 0deg, rgba(255, 236, 140, 0.55) 0deg 9deg, transparent 9deg 30deg);
  -webkit-mask: radial-gradient(closest-side, #000 35%, transparent 100%);
  mask: radial-gradient(closest-side, #000 35%, transparent 100%);
  animation: rank-burst 6s linear infinite;
  pointer-events: none;
}

.rank-chip__spark {
  position: absolute;
  color: #fff7c2;
  font-size: 12px;
  line-height: 1;
  text-shadow: 0 0 6px rgba(255, 224, 100, 0.95);
  animation: rank-twinkle 1.8s ease-in-out infinite;
  pointer-events: none;
}

.rank-chip__spark--a {
  top: -8px;
  left: -4px;
}

.rank-chip__spark--b {
  top: -10px;
  right: 2px;
  font-size: 9px;
  animation-delay: 0.6s;
}

.rank-chip__spark--c {
  bottom: -8px;
  right: -6px;
  font-size: 10px;
  animation-delay: 1.2s;
}

/* 실제로 1등 번호가 나왔으면 더 크게 터진다. */
.rank-chip--1.rank-chip--hit {
  animation-duration: 1.4s;
}

.rank-chip--1.rank-chip--hit .rank-chip__burst {
  inset: -22px -28px;
  animation-duration: 3s;
}

@keyframes rank-shine {
  0%,
  55% {
    background-position: 130% 0;
  }
  100% {
    background-position: -30% 0;
  }
}

@keyframes rank-pulse {
  0%,
  100% {
    transform: scale(1);
    filter: drop-shadow(0 0 0 rgba(255, 210, 63, 0));
  }
  50% {
    transform: scale(1.06);
    filter: drop-shadow(0 0 10px rgba(255, 220, 90, 0.85));
  }
}

@keyframes rank-burst {
  to {
    transform: rotate(360deg);
  }
}

@keyframes rank-twinkle {
  0%,
  100% {
    opacity: 0;
    transform: scale(0.4) rotate(0deg);
  }
  50% {
    opacity: 1;
    transform: scale(1.15) rotate(45deg);
  }
}

@media (prefers-reduced-motion: reduce) {
  .rank-chip--1,
  .rank-chip--1::after,
  .rank-chip__burst,
  .rank-chip__spark {
    animation: none;
  }

  .rank-chip__spark {
    opacity: 1;
  }
}

.prize-card__more {
  grid-area: more;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: rgba(14, 18, 40, 0.38);
  font-size: 20px;
  line-height: 1;
}

@media (min-width: 960px) {
  .prize-card {
    grid-template-columns: auto auto minmax(0, 1fr) auto;
    grid-template-areas: "monster main detail more";
    column-gap: 18px;
    padding: 12px 20px;
  }

  .prize-card__detail {
    justify-content: flex-end;
    padding: 0 0 0 18px;
    border-top: 0;
    border-left: 1px solid rgba(255, 255, 255, 0.2);
    font-size: 13px;
  }
}

/* 발표 뒤에 봉인된 회차라는 표시. */
.history-item__late {
  margin: 12px 0 0;
  padding: 8px 12px;
  border: 1px dashed var(--line);
  border-radius: 12px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

.history-item__prize,
.page-note {
  margin: 12px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.6;
}

.page-note {
  margin: 0 0 16px;
}

.rank-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 6px;
  margin: 14px 0 0;
  padding: 0;
  list-style: none;
  text-align: center;
}

.rank-grid li {
  padding: 10px 2px;
  border-radius: 10px;
  background: var(--soft);
}

.rank-grid__label {
  display: block;
  color: var(--muted);
  font-size: 12px;
}

.rank-grid__count {
  display: block;
  margin-top: 2px;
  font-size: 16px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

.history-list {
  display: grid;
  gap: 12px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.history-item__head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px;
  margin-bottom: 10px;
}

.history-item__round {
  font-size: 16px;
  font-weight: 800;
}

.history-item__meta {
  color: var(--muted);
  font-size: 12px;
}

.history-item .balls {
  justify-content: flex-start;
  gap: 6px;
  flex-wrap: wrap;
}

.plus {
  align-self: center;
  color: var(--muted);
}

.empty {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.6;
}

.page-title {
  margin: 8px 0 16px;
  font-size: 20px;
}

.site-footer {
  width: min(100%, 1080px);
  margin: 24px auto 0;
  padding: 0 16px;
  color: var(--faint);
  font-size: 12px;
  line-height: 1.6;
  text-align: center;
  word-break: keep-all;
}

.site-footer__contact {
  margin: 8px 0 0;
}

/* 누르기 쉽도록 줄 높이를 44px로 잡는다. */
.site-footer__contact a,
.site-footer__contact a:visited {
  display: inline-block;
  min-height: 44px;
  line-height: 44px;
  color: var(--muted);
  text-decoration: underline;
  text-underline-offset: 2px;
}

/* ---------- 개인정보처리방침 같은 긴 글 ---------- */
.prose {
  max-width: 760px;
  margin: 0 auto;
  line-height: 1.7;
  word-break: keep-all;
  overflow-wrap: anywhere;
}

.prose h1 {
  font-size: 1.4rem;
  margin: 0 0 12px;
}

.prose h2 {
  font-size: 1.05rem;
  margin: 28px 0 8px;
}

.prose p,
.prose ul {
  margin: 0 0 12px;
  color: var(--muted);
}

.prose ul {
  padding-left: 20px;
}

.prose a {
  color: inherit;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.prose__table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
  margin: 0 0 12px;
}

.prose__table th,
.prose__table td {
  border-top: 1px solid var(--line);
  padding: 8px 6px;
  text-align: left;
  vertical-align: top;
}

.prose__table {
  overflow-wrap: normal;
}

/* 보관 기간 열은 짧은 말이라 좁아지면 글자 단위로 끊긴다. 폭을 잡아 둔다. */
.prose__table th:last-child,
.prose__table td:last-child {
  width: 5.5em;
}

.prose__table th {
  color: var(--faint);
  font-weight: 600;
}

.prose__date {
  margin-top: 28px;
  font-size: 13px;
}

/* ---------- 머리말 도구 ---------- */

@media (min-width: 640px) {
  .site-header {
    grid-template-columns: auto minmax(0, 1fr) auto;
    grid-template-areas: "title nav tools";
  }

  .site-nav {
    justify-self: end;
  }
}

.site-tools {
  grid-area: tools;
  position: relative;
  display: flex;
  align-items: center;
  gap: 6px;
}

.tool-button {
  min-height: 44px;
  padding: 0 14px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--chip);
  color: var(--text);
  font: inherit;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
}

.tool-button:hover {
  border-color: var(--accent);
}

.tool-button--round {
  width: 44px;
  padding: 0;
  justify-content: center;
}

.tool-button__icon {
  width: 19px;
  height: 19px;
  flex: none;
}

.tool-button .tool-button__icon {
  color: var(--brand);
}

.toast {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 10;
  width: max-content;
  max-width: min(300px, calc(100vw - 32px));
  margin: 0;
  padding: 10px 14px;
  border-radius: 14px;
  background: var(--text);
  color: var(--bg);
  font-size: 13px;
  line-height: 1.5;
  box-shadow: var(--shadow);
}

/* ---------- 회차 페이지 ---------- */

.pager {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-top: 20px;
}

.pager__link {
  min-height: 44px;
  padding: 0 16px;
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--panel);
  font-size: 14px;
  font-weight: 700;
  text-decoration: none;
  white-space: nowrap;
}

.pager__link:hover {
  border-color: var(--accent);
}

.pager__link--off {
  color: var(--faint);
  background: transparent;
}

.pager__now {
  min-width: 56px;
  color: var(--muted);
  font-size: 14px;
  font-variant-numeric: tabular-nums;
  text-align: center;
}

/* 좁은 화면: 메달 셋을 윗줄, 4·5등을 아랫줄에 둔다. 빈 줄바꿈 칸(::after)을 3등 뒤에 끼운다. */
@media (max-width: 480px) {
  .rank-line::after {
    content: "";
    flex-basis: 100%;
    order: 3;
  }

  .rank-chip--4,
  .rank-chip--5 {
    order: 4;
  }
}

/* 데스크톱 띠: 등수 버튼 줄을 띠 높이의 가운데에 두고, 게임 수와 안내는 그 오른쪽에 쌓는다. */
@media (min-width: 960px) {
  .prize-card__detail {
    display: grid;
    grid-template-columns: auto auto;
    justify-content: end;
    align-items: center;
    column-gap: 18px;
    row-gap: 4px;
  }

  .prize-card__detail > * {
    grid-column: 2;
  }

  .prize-card__detail > .rank-line {
    grid-column: 1;
    grid-row: 1 / span 3;
    align-self: center;
  }
}
