:root {
  --bg: #0b0f14;
  --surface: #111821;
  --surface-2: #1a222d;
  --line: rgba(255, 255, 255, 0.06);
  --line-2: #33404f;
  --text: #e6e9ee;
  --muted: #8b95a1;
  --accent: #c9a24a;
  --lose: #d65b5b;
  --team1: #5b9bd5;
  --team2: #d46a6a;
  --edited: #7fb7e6;
  --radius: 10px;
  --radius-sm: 6px;
  --page: 48rem; /* 목록·설정·검토 화면 공통 폭 */
  /* 배경 위에 떠 보이게: 테두리 대신 그림자 */
  --shadow: 0 1px 0 rgba(255, 255, 255, 0.04) inset, 0 10px 30px rgba(0, 0, 0, 0.55), 0 2px 6px rgba(0, 0, 0, 0.35);
  --font: "Pretendard Variable", Pretendard, -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo", "Malgun Gothic", sans-serif;
  /* 영문·숫자만 Cinzel, 한글은 자동으로 Pretendard로 */
  --font-display: "Cinzel", var(--font);
}
* { box-sizing: border-box; }
/* display를 지정한 요소도 hidden이면 항상 숨긴다 */
[hidden] { display: none !important; }
/* 기준 글자 크기: 화면 폭에 따라 15px ~ 18px. 나머지 글자·칸은 rem/em 비율로 따라 커진다 */
/* scrollbar-gutter: 스크롤이 있는 탭과 없는 탭을 오가도 화면이 좌우로 밀리지 않게 자리를 잡아 둔다 */
html { color-scheme: dark; font-size: clamp(15px, 0.35vw + 11px, 18px); scrollbar-gutter: stable; }
/* 세로로 쌓고 본문이 남는 높이를 채운다 → 내용이 짧은 탭에서도 맨 아래 안내문구가 화면 아래쪽에 붙어 있다 */
body {
  margin: 0;
  display: flex; flex-direction: column;
  min-height: 100vh; min-height: 100dvh;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-size: 1rem;
  line-height: 1.6;
}
button { font: inherit; }
kbd {
  font: inherit; font-size: 0.857rem; padding: 0 5px; border-radius: var(--radius-sm);
  background: var(--surface-2); color: var(--text);
}
.hint { color: var(--muted); font-size: 0.929rem; }
.warn { color: var(--accent); }

/* 강조 글꼴 (영문·숫자는 Cinzel) */
h1, .brand, .rh-label, .rh-dmg, .steps li span, .dz-title, .team-bar b { font-family: var(--font-display); }

/* 배경 이미지: 어둡게 깔기만 한다 */
.bg { position: fixed; inset: 0; z-index: -1; pointer-events: none; }
.bg::before {
  content: ""; position: absolute; inset: 0;
  background: url("img/bg-abyss.webp") center / cover no-repeat;
  opacity: 0.28;
}

/* ---------- 상단 ---------- */
.topbar {
  display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 8px 24px;
  padding: 0 24px; min-height: 3.7rem;
  background: rgba(8, 11, 16, 0.96); box-shadow: 0 4px 18px rgba(0, 0, 0, 0.45);
  position: sticky; top: 0; z-index: 5;
}
h1, .brand { font-size: 1.143rem; margin: 0; font-weight: 700; letter-spacing: 0.02em; }
h1 a, .brand a { color: inherit; text-decoration: none; }
h1 a:hover, .brand a:hover { color: var(--accent); }
nav { display: flex; align-self: stretch; position: relative; }
/* 고른 탭 아래 금색 줄 (위치·폭은 app.js의 moveTabLine이 정한다) */
nav::after {
  content: ""; position: absolute; left: 0; bottom: 0; height: 2px; width: var(--tab-w, 0);
  transform: translateX(var(--tab-x, 0)); background: var(--accent);
}
.tab {
  background: none; border: 0; border-bottom: 2px solid transparent; color: var(--muted);
  padding: 0 14px; cursor: pointer; font-size: 1rem;
  display: inline-flex; flex-direction: column; align-items: center; justify-content: center;
}
/* 굵은 글씨일 때의 폭을 미리 차지해 둔다 (탭을 바꿔도 옆 탭이 안 밀리게) */
.tab::after { content: attr(data-label); height: 0; overflow: hidden; visibility: hidden; font-weight: 600; pointer-events: none; }
.tab:hover { color: var(--text); }
.tab.active { color: var(--text); font-weight: 600; }
main { flex: 1 0 auto; width: 100%; max-width: 80rem; margin: 0 auto; padding: 36px 24px 72px; }

/* ---------- 버튼·링크 ---------- */
.primary, .ghost {
  padding: 7px 14px; border-radius: var(--radius-sm); cursor: pointer; border: 0;
  font-size: 1rem; font-weight: 600;
}
.primary { background: var(--accent); color: #15110a; }
.primary:hover { background: #d6b05a; }
.primary:disabled { opacity: .35; cursor: not-allowed; }
.primary.small { padding: 7px 14px; font-size: 0.929rem; min-width: 0; }
.ghost { background: var(--surface-2); color: var(--text); }
.ghost:hover { background: #1f2833; }
.link {
  margin-left: auto; background: none; border: 0; padding: 0; color: var(--muted);
  font-size: 0.857rem; cursor: pointer; text-decoration: underline; text-underline-offset: 3px;
}
.link:hover { color: var(--text); }
.danger-link { color: var(--muted); }
.danger-link:hover { color: var(--lose); }
.row-center { display: flex; gap: 8px; justify-content: center; margin-top: 24px; flex-wrap: wrap; }

/* ---------- 공통 레이아웃: 모든 탭이 같은 폭·머리·상자·버튼 규칙을 쓴다 ---------- */
.panel:not(#tab-new) { max-width: var(--page); margin: 0 auto; }
.card { background: var(--surface); border-radius: var(--radius); padding: 20px 22px; box-shadow: var(--shadow); }

/* 페이지 머리: 제목 + 한 줄 설명 + 오른쪽 요약 */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin: 0 4px 18px; }
.page-head h2 { margin: 0; font-size: 1.5rem; font-weight: 800; letter-spacing: -0.01em; }
.page-head p { margin: 4px 0 0; color: var(--muted); font-size: 0.929rem; }
.page-meta { flex: none; color: var(--accent); font-size: 0.929rem; font-weight: 700; }

/* 아래 버튼 (새 게임 올리기, 저장, 결과 보기 등) */
.page-actions, .review-actions { display: flex; flex-direction: column; align-items: center; gap: 10px; margin: 28px auto 0; }
.page-actions .primary, .review-actions .primary { min-width: 16rem; padding: 14px 28px; font-size: 1.143rem; }
.review-actions .hint { margin: 0; }
.review-actions .link { margin: 4px 0 0; }

/* 목록 상자: 하나의 상자 안에 줄 단위 */
.list { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.list > * + * { border-top: 1px solid var(--line); }
.list-add { display: flex; gap: 8px; padding: 14px 18px; background: rgba(255, 255, 255, 0.015); }
.list-more {
  display: flex; align-items: baseline; justify-content: center; gap: 10px; width: 100%;
  padding: 14px 20px; background: none; border: 0; color: var(--text); font: inherit; font-size: 0.929rem; font-weight: 600; cursor: pointer;
}
.list-more span { color: var(--muted); font-size: 0.786rem; font-weight: 500; }
.list-more:hover { background: rgba(255, 255, 255, 0.03); color: var(--accent); }
.empty-state { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 48px 24px; text-align: center; }
.empty-state b { font-size: 1.071rem; }
.empty-state span { color: var(--muted); font-size: 0.929rem; }
.empty-state.flat { padding: 40px 24px; }

/* 글자 입력칸 (친구 추가·핸디캡·친구 수정) */
.list-add input, .hc-add input[type="text"], .friend-row.editing input, .hc-input input {
  background: #080b0f; color: var(--text); border: 0; border-radius: var(--radius-sm); font: inherit;
}
.list-add input, .hc-add input[type="text"] { flex: 1; padding: 9px 12px; }
.list-add input:focus, .hc-add input[type="text"]:focus, .friend-row.editing input:focus, .hc-input input:focus {
  outline: none; box-shadow: inset 0 0 0 1px var(--accent);
}

/* ---------- 단계 표시 ---------- */
.steps {
  list-style: none; margin: 0 0 32px; padding: 0;
  display: flex; justify-content: center; gap: 20px; font-size: 0.929rem; color: var(--muted);
}
.steps li span { margin-right: 6px; font-variant-numeric: tabular-nums; }
.steps li.active { color: var(--text); font-weight: 600; }
.steps li.done { color: var(--text); }

/* ---------- 업로드 ---------- */
#step-upload { max-width: 68rem; margin: 0 auto; }
#dropzone {
  display: grid; grid-template-columns: auto 1fr; align-items: center; gap: 56px;
  min-height: 22rem; border-radius: var(--radius); padding: 48px 56px; cursor: pointer;
  background: var(--surface); box-shadow: var(--shadow);
}
#dropzone:hover, #dropzone:focus-visible { background: rgba(20, 26, 35, 0.96); outline: none; }
#dropzone.over { background: var(--surface-2); box-shadow: inset 0 0 0 2px var(--accent); }
.dz-body { display: flex; flex-direction: column; align-items: flex-start; gap: 18px; }
.dz-title { font-size: 1.857rem; font-weight: 700; line-height: 1.35; letter-spacing: -0.01em; }
.dz-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.dz-actions .primary, .dz-actions .ghost { padding: 13px 24px; font-size: 1.071rem; }
.dz-btn { pointer-events: none; } /* label 안의 '캡처 파일 선택'은 모양만 버튼 */
.dz-desc { color: var(--muted); font-size: 1rem; line-height: 1.8; }
@media (max-width: 860px) {
  /* minmax(0, 1fr): 예시 점수판(340px)·제목이 좁은 폰에서 상자 밖으로 넘치지 않고 줄어들게 */
  #dropzone { grid-template-columns: minmax(0, 1fr); gap: 28px; padding: 32px 22px; justify-items: center; }
  .dz-body { align-items: center; text-align: center; max-width: 100%; }
  .dz-body .dz-actions { justify-content: center; }
  .dz-example { width: 100%; max-width: 340px; }
  .dz-example .dz-visual { width: 100%; }
  .dz-title { word-break: keep-all; }
}

/* 클라이언트 창을 기다릴 때·못 받았을 때 업로드 상자 자리를 대신하는 화면 */
.dz-state {
  min-height: 22rem; padding: 48px 32px; border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; text-align: center;
}
.dz-state .spinner { margin: 0 0 6px; }
.dz-state-desc { margin: 0; color: var(--muted); font-size: 1.071rem; line-height: 1.7; }
.dz-state-keys { margin: 0; color: var(--muted); font-size: 0.929rem; }
.dz-state .ghost, .dz-state .primary { margin-top: 10px; }
.dz-state .dz-actions { justify-content: center; }
#cap-wait .dz-title { color: var(--accent); }
.cap-status { margin: 16px 0 0; font-size: 0.929rem; color: var(--muted); text-align: center; }
.cap-status .link { margin-left: 8px; }

/* 예시 점수판 (업로드 상자 왼쪽 그림) */
.dz-example { display: flex; flex-direction: column; gap: 6px; }
.dz-visual {
  position: relative; width: 340px; padding: 12px 14px 14px; text-align: left;
  border-radius: var(--radius-sm); background: #080b0f;
  display: flex; flex-direction: column; gap: 6px;
  --dmg-w: 68px;
}
.sb-head, .sb-row { display: grid; grid-template-columns: 12px 1fr 40px var(--dmg-w); gap: 8px; align-items: center; padding: 0 6px; }
.sb-head span { font-size: 12px; color: var(--accent); text-align: right; }
.sb-team { font-size: 12px; font-weight: 700; margin-top: 2px; }
.sb-team.t1 { color: var(--team1); }
.sb-team.t2 { color: var(--team2); margin-top: 5px; }
.sb-row { height: 20px; }
.sb-row i { display: block; height: 4px; border-radius: 2px; background: #2a333e; }
.sb-row .sb-lv { height: 9px; border-radius: 2px; }
.sb-row .sb-name { width: 70%; }
.sb-row.me .sb-name { background: #6b5a32; }
.sb-dmg { font-size: 13px; font-weight: 600; color: var(--text); text-align: right; font-variant-numeric: tabular-nums; }
.sb-col-mark {
  position: absolute; top: 6px; bottom: 6px; right: 14px; width: calc(var(--dmg-w) + 10px);
  border: 1px solid var(--accent); border-radius: var(--radius-sm); pointer-events: none;
}

/* ---------- 사용 가이드 ---------- */
.guide {
  width: min(calc(100% - 32px), 56rem); max-height: calc(100vh - 64px); overflow: auto;
  padding: 24px 26px; border: 0; border-radius: var(--radius);
  background: var(--bg); color: var(--text);
}
.guide::backdrop, .ask::backdrop { background: rgba(0, 0, 0, 0.65); }
/* 확인 팝업 */
.ask {
  width: min(calc(100% - 32px), 24rem); padding: 24px 24px 20px; border: 0; border-radius: var(--radius);
  background: var(--surface); color: var(--text); box-shadow: var(--shadow);
}
.ask h2 { margin: 0; font-size: 1.143rem; font-weight: 700; line-height: 1.45; word-break: keep-all; }
.ask p { margin: 8px 0 0; color: var(--muted); font-size: 0.929rem; line-height: 1.65; word-break: keep-all; }
.ask-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 22px; }
.ask-actions button { min-width: 5.5rem; padding: 9px 16px; }
.primary.danger { background: var(--lose); color: #fff; }
.primary.danger:hover { background: #e06a6a; }
.guide-head { display: flex; align-items: center; gap: 12px; margin-bottom: 18px; }
.guide-head h2 { margin: 0; font-size: 1.071rem; font-weight: 700; }
.dialog-close { margin-left: auto; background: none; border: 0; color: var(--muted); font: inherit; cursor: pointer; padding: 4px 6px; }
.dialog-close:hover { color: var(--text); }
.guide-tabs { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 10px; margin-bottom: 16px; }
.os-tabs { display: flex; gap: 2px; background: var(--surface); border-radius: var(--radius-sm); padding: 2px; }
.os-tabs button {
  background: none; border: 0; color: var(--muted); padding: 4px 12px; border-radius: var(--radius-sm);
  font: inherit; font-size: 0.929rem; cursor: pointer;
}
.os-tabs button:hover { color: var(--text); }
.os-tabs button.active { background: var(--surface-2); color: var(--text); font-weight: 600; }
.os-tabs small { margin-left: 6px; font-size: 0.75rem; color: var(--accent); font-weight: 500; }
.guide-steps {
  list-style: none; margin: 0; padding: 0; counter-reset: step;
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px;
}
.guide-steps li { counter-increment: step; padding: 18px; background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); }
.guide-steps li > b { display: block; margin-bottom: 4px; font-size: 0.929rem; }
.guide-steps li > b::before { content: counter(step); color: var(--accent); margin-right: 8px; font-variant-numeric: tabular-nums; }
.guide-steps li > span { color: var(--muted); font-size: 0.929rem; line-height: 1.7; }
.guide-steps em, .guide-tips em { font-style: normal; color: var(--text); }
.guide-tips {
  margin: 14px 0 0; padding: 14px 18px 14px 34px; background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow);
  color: var(--muted); font-size: 0.929rem; line-height: 1.8;
}
@media (max-width: 720px) { .guide-steps { grid-template-columns: 1fr; } }

/* 단계마다 그림이 있는 가이드 (왼쪽 그림, 오른쪽 설명) */
.guide-steps.with-figs { grid-template-columns: 1fr; gap: 10px; }
.guide-steps.with-figs li {
  display: grid; grid-template-columns: minmax(0, 22rem) 1fr; grid-template-rows: auto 1fr;
  column-gap: 22px; align-items: start;
}
.guide-steps.with-figs .g-fig { grid-row: 1 / 3; }
.guide-steps.with-figs li > b { margin-top: 4px; }
@media (max-width: 720px) {
  .guide-steps.with-figs li { grid-template-columns: 1fr; }
  .guide-steps.with-figs .g-fig { grid-row: auto; margin-bottom: 12px; }
}
.g-fig { margin: 0; }
.g-fig img { display: block; width: 100%; height: auto; border-radius: var(--radius-sm); box-shadow: 0 4px 14px rgba(0, 0, 0, 0.5); }
.g-fig figcaption { margin-top: 6px; color: var(--muted); font-size: 0.786rem; }
.g-fig-wide { margin-bottom: 14px; }
.g-fig-wide img { max-height: 22rem; width: auto; max-width: 100%; margin: 0 auto; }
.g-fig-wide figcaption { text-align: center; }

/* 크롬 공유 창 예시 그림 */
.fig-picker { background: #f1f3f4; color: #202124; border-radius: 8px; padding: 12px 14px; font-size: 0.75rem; box-shadow: 0 4px 14px rgba(0, 0, 0, 0.5); }
.fp-title { font-weight: 700; font-size: 0.857rem; margin-bottom: 8px; }
.fp-tabs { display: flex; gap: 14px; border-bottom: 1px solid #dadce0; margin-bottom: 10px; }
.fp-tabs span { padding: 0 2px 6px; color: #5f6368; }
.fp-tabs .on { color: #1a73e8; font-weight: 700; box-shadow: inset 0 -2px 0 #1a73e8; }
.fp-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.fp-tile { border-radius: 6px; padding: 5px; text-align: center; }
.fp-tile i { display: block; height: 42px; border-radius: 4px; background: #c8ccd1; margin-bottom: 4px; }
.fp-tile.on { background: #d2e3fc; box-shadow: inset 0 0 0 2px #1a73e8; }
.fp-tile.on i { background: #0c1a26; box-shadow: inset 0 -10px 0 #13283a; }
.fp-tile b { font-weight: 500; font-size: 0.714rem; }
.fp-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 10px; }
.fp-actions span { padding: 4px 12px; border-radius: 999px; color: #1a73e8; box-shadow: inset 0 0 0 1px #dadce0; }
.fp-actions .on { background: #1a73e8; color: #fff; box-shadow: none; }

/* 대기 화면 예시 그림 */
.fig-wait {
  display: flex; flex-direction: column; align-items: center; gap: 6px; text-align: center;
  padding: 18px 12px; border-radius: var(--radius-sm); background: var(--bg); box-shadow: 0 4px 14px rgba(0, 0, 0, 0.5);
}
.fig-wait .spinner { width: 20px; height: 20px; margin: 0 0 4px; }
.fig-wait b { color: var(--accent); font-size: 0.929rem; }
.fig-wait span { color: var(--muted); font-size: 0.786rem; }

/* ---------- 인식 중 ---------- */
#step-loading { max-width: 52rem; margin: 0 auto; text-align: center; }
.ld-frame { position: relative; overflow: hidden; border-radius: var(--radius); background: #080b0f; --scan: 2.6s; }
.ld-frame img { display: block; width: 100%; height: auto; }
.ld-base { filter: brightness(0.35) saturate(0.6); }
.ld-lit {
  position: absolute; inset: 0; height: 100%; object-fit: cover;
  clip-path: inset(0 0 100% 0); animation: ld-reveal var(--scan) ease-in-out infinite;
}
.ld-line {
  position: absolute; left: 0; right: 0; top: 0; height: 2px; background: var(--accent);
  animation: ld-move var(--scan) ease-in-out infinite;
}
@keyframes ld-reveal { 0% { clip-path: inset(0 0 100% 0); } 85%, 100% { clip-path: inset(0 0 0 0); } }
@keyframes ld-move { 0% { top: 0; opacity: 1; } 85% { top: calc(100% - 2px); opacity: 1; } 100% { top: calc(100% - 2px); opacity: 0; } }
@media (prefers-reduced-motion: reduce) {
  .ld-lit { animation: none; clip-path: none; }
  .ld-line { display: none; }
}
.ld-text { margin: 22px 0 4px; font-size: 1.143rem; display: flex; justify-content: center; align-items: baseline; gap: 10px; }
.ld-text span { color: var(--muted); font-size: 0.929rem; font-variant-numeric: tabular-nums; }
.ld-sub { margin: 0; color: var(--muted); font-size: 0.857rem; }
.spinner {
  width: 28px; height: 28px; margin: 0 auto 14px; border-radius: 50%;
  border: 2px solid var(--line-2); border-top-color: var(--text);
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- 검토 ---------- */
.review-left { max-width: var(--page); margin: 0 auto; overflow-x: auto; background: var(--surface); border-radius: var(--radius); padding: 22px 24px; box-shadow: var(--shadow); }
.review-left > .hint { margin: 0 4px 12px; }
.warnings { margin: 0 0 6px; padding: 0; list-style: none; }
.warnings li { color: var(--accent); border-left: 2px solid var(--accent); padding: 2px 10px; margin-bottom: 4px; font-size: 0.929rem; }
.team-bar { display: flex; align-items: baseline; gap: 8px; padding: 0 8px 10px; }
.team-bar b { font-size: 0.929rem; }
.team-bar.t1 b { color: var(--team1); }
.team-bar.t2 b { color: var(--team2); }
.team-bar span { color: var(--muted); font-size: 0.857rem; }
.hc-mode { margin-left: 8px; color: var(--muted); font-size: 0.786rem; }

.review-table { width: 100%; min-width: 36rem; border-collapse: collapse; }
.review-table th, .review-table td { text-align: left; border-bottom: 1px solid var(--line); white-space: nowrap; }
.review-table th { padding: 6px 8px; color: var(--muted); font-weight: 500; font-size: 0.857rem; }
.review-table td { padding: 9px 4px; }
.review-table th:first-child, .review-table td:first-child { padding-left: 8px; }
.review-table .num { text-align: right; font-variant-numeric: tabular-nums; }
.review-table tbody tr:hover td { background: rgba(255, 255, 255, 0.02); }
.review-table .c-name { min-width: 12rem; }
.review-table .c-kda { width: 7.5rem; }
.review-table .c-dmg { width: 6.5rem; }
.review-table .c-pick { width: 7rem; text-align: right; padding-right: 6px; }
.review-table tr.is-friend td:first-child { box-shadow: inset 2px 0 0 var(--accent); }
/* 참여하는 사람만 선명하게, 나머지는 흐리게 (참여 버튼은 누를 수 있게 그대로) */
.review-table tbody tr:not(.is-friend) td:not(.c-pick) { opacity: 0.35; }
.review-table tbody tr:not(.is-friend):hover td:not(.c-pick) { opacity: 0.6; }
.review-table tr.is-self .cell-name::after { content: "나"; margin-left: 6px; font-size: 0.786rem; font-weight: 500; color: var(--muted); }

/* 글자처럼 보이다가 누르면 입력칸이 되는 값 */
.cell {
  display: block; width: 100%; background: none; border: 1px solid transparent; border-radius: var(--radius-sm);
  color: var(--text); text-align: left; padding: 2px 6px; cursor: text; font: inherit; font-size: 1rem;
}
.cell:hover { background: rgba(255, 255, 255, 0.06); }
.cell:focus-visible { outline: none; border-color: var(--accent); }
.cell.num { text-align: right; font-variant-numeric: tabular-nums; }
.cell.edited { color: var(--edited); }
.cell .muted { color: var(--muted); }
.c-name .cell { display: inline-block; width: auto; max-width: 100%; vertical-align: baseline; }
.cell-name { font-weight: 600; }
.cell-champ { font-size: 0.857rem; color: var(--muted); }
.cell-dmg { font-weight: 700; }
.cell-input {
  display: block; width: 100%; background: #080b0f; color: var(--text);
  border: 1px solid var(--accent); border-radius: var(--radius-sm); padding: 2px 6px; font: inherit; font-size: 1rem; outline: none;
}
.cell-input.num { text-align: right; font-variant-numeric: tabular-nums; }
.cell-input.champ { display: inline-block; width: 8em; }
.hc-note { padding: 0 6px; font-size: 0.786rem; color: var(--accent); text-align: right; font-variant-numeric: tabular-nums; cursor: default; outline: none; }

/* 내기 참여 버튼 */
.pick {
  display: inline-flex; align-items: center; justify-content: center; min-width: 5.5em;
  background: var(--surface-2); color: var(--muted); border: 0; border-radius: var(--radius-sm);
  padding: 3px 10px; font: inherit; font-size: 0.929rem; cursor: pointer; white-space: nowrap;
}
.pick:hover { background: #1f2833; color: var(--text); }
.pick.on { color: #15110a; background: var(--accent); font-weight: 600; }
.pick.on:hover { background: #d6b05a; }

/* 폰 화면: 검토 표가 화면 폭 안에 들어가게 (챔피언 글자는 숨기고 초상화만) */
@media (max-width: 560px) {
  .review-left { padding: 14px 10px; }
  .review-table { min-width: 0; }
  .review-table td { padding: 8px 2px; }
  .review-table th:first-child, .review-table td:first-child { padding-left: 4px; }
  .review-table .c-name { min-width: 0; max-width: 0; width: 100%; }
  .review-table .c-name .cell-name { max-width: calc(100% - 34px); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; vertical-align: middle; }
  .review-table .cell-champ { display: none; }
  .review-table .c-kda { width: auto; }
  .review-table .c-kda .cell { font-size: 0.857rem; padding-inline: 2px; }
  .review-table .c-dmg { width: auto; }
  .review-table .c-pick { width: auto; padding-right: 0; }
  .pick { min-width: 0; padding: 4px 8px; font-size: 0.857rem; }
}
@media (max-width: 380px) { .review-table .c-kda { display: none; } }

/* ---------- 결과 ---------- */
.result-card { max-width: 40rem; margin: 0 auto; padding: 28px 24px 12px; }
.result-hero { text-align: center; padding-bottom: 22px; margin-bottom: 4px; border-bottom: 1px solid var(--line); }
.rh-icons { display: flex; justify-content: center; gap: 8px; margin-bottom: 12px; }
.rh-label { font-size: 0.857rem; font-weight: 700; color: var(--accent); letter-spacing: 0.08em; }
.rh-win { margin-top: 2px; font-size: 1.714rem; font-weight: 800; line-height: 1.3; color: var(--text); word-break: keep-all; }
.rh-dmg { margin-top: 2px; font-size: 1.357rem; font-weight: 700; color: var(--accent); font-variant-numeric: tabular-nums; letter-spacing: 0.03em; }
.rh-lose { margin-top: 12px; color: var(--muted); font-size: 0.929rem; }
.rh-lose span { margin-right: 8px; }
.rh-lose b { color: var(--lose); font-weight: 700; }

/* 순위 표 (결과·기록 공통) */
.rank-table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
.rank-table th { white-space: nowrap; padding: 8px 10px; font-size: 0.75rem; font-weight: 600; color: var(--muted); text-align: left; border-bottom: 1px solid var(--line); }
.rank-table td { padding: 8px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; vertical-align: middle; }
.rank-table tbody tr:last-child td { border-bottom: 0; }
.rank-table .num { text-align: right; }
.rank-table .c-badge { width: 3.4rem; }
.rank-table tr.win td.c-badge { box-shadow: inset 2px 0 0 var(--accent); }
.rank-table tr.lose td.c-badge { box-shadow: inset 2px 0 0 var(--lose); }
.rank-table tr.win .badge { color: var(--accent); font-weight: 700; }
.rank-table tr.lose .badge { color: var(--lose); font-weight: 700; }
.rank-table .c-who, .board-table .c-who { width: 100%; max-width: 0; }
.rank-table .c-who span, .board-table .c-who span { display: flex; align-items: center; gap: 10px; min-width: 0; }
.rank-table .c-who b, .board-table .c-who b { overflow: hidden; text-overflow: ellipsis; font-weight: 600; }
.rank-table .c-kda { color: var(--muted); font-size: 0.929rem; }
.rank-table .c-dmg { position: relative; min-width: 6.5rem; }
.rt-dmg { display: inline-flex; align-items: baseline; gap: 6px; }
.rt-dmg b { font-weight: 700; }
.rank-table tr.win .rt-dmg b { color: var(--accent); }
.rt-hc { font-size: 0.75rem; color: var(--muted); cursor: default; border-bottom: 1px dotted var(--line-2); outline: none; }
.rank-table .bar { position: absolute; right: 10px; bottom: 4px; height: 2px; border-radius: 1px; background: var(--line-2); max-width: calc(100% - 20px); }
.rank-table tr.win .bar { background: var(--accent); }
.rank-table tr.lose .bar { background: var(--lose); }
@media (max-width: 560px) { .rank-table .c-kda { display: none; } }

/* ---------- 누적 순위 (한 줄 표) ---------- */
.board-table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
.board-table th {
  padding: 10px 12px; font-size: 0.75rem; font-weight: 500; color: var(--muted); text-align: left; white-space: nowrap;
  background: rgba(255, 255, 255, 0.02); border-bottom: 1px solid var(--line);
}
/* 칸 제목 = 정렬 버튼. 지금 기준인 칸은 밝게 + 화살표(다시 누르면 뒤집힘) */
.th-sort {
  display: inline-flex; align-items: center; gap: 5px; margin: -4px -6px; padding: 4px 6px; border: 0; border-radius: 4px;
  background: none; color: inherit; font: inherit; cursor: pointer; white-space: nowrap;
}
.th-sort:hover { color: var(--text); background: rgba(255, 255, 255, 0.05); }
.th-sort.on { color: var(--text); font-weight: 700; }
.th-sort i { width: 0; height: 0; border-inline: 3.5px solid transparent; border-top: 5px solid currentColor; opacity: 0; }
.th-sort:hover i { opacity: 0.35; }
.th-sort.on i { opacity: 1; color: var(--accent); }
.th-sort.rev i { transform: rotate(180deg); }
.board-table td { padding: 10px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; vertical-align: middle; }
.board-table tbody tr:last-child td { border-bottom: 0; }
.board-table tbody tr:hover td { background: rgba(255, 255, 255, 0.025); }
.board-table .num { text-align: right; }
.board-table .c-rank { width: 2.4rem; text-align: center; color: var(--muted); font-family: var(--font-display); font-weight: 700; }
.board-table tr.top1 .c-rank, .board-table tr.top1 .c-who b { color: var(--accent); }
.board-table tr.top2 .c-rank { color: #c3ccd6; }
.board-table tr.top3 .c-rank { color: #c08a5a; }
.board-table tr.top1 td.c-rank { box-shadow: inset 2px 0 0 var(--accent); }
/* 이름 아래 판수, 숫자 아래 작은 설명 */
/* 표에 칸이 많아 이 탭만 조금 넓게. 이름 칸은 남는 폭을 다 쓰고, 긴 이름은 말줄임 */
.panel#tab-board { max-width: 58rem; }
.board-table .c-who .bd-name { display: block; flex: 1; min-width: 0; overflow: hidden; text-align: left; }
.bd-name b, .bd-name small { display: block; white-space: nowrap; }
.bd-name small, .board-table .c-kda small { font-size: 0.75rem; color: var(--muted); }
.board-table .c-kda b, .board-table .c-avg b { font-weight: 600; }
.board-table .c-kda small { display: block; margin-top: 1px; }
.board-table .c-avg small { margin-left: 2px; font-size: 0.75rem; color: var(--muted); }
.board-table .c-dmg { min-width: 5rem; }
/* 내기 전적: 1등(금색)·중간(회색)·꼴등(빨강) 비율 막대 */
.bd-rec { width: 8rem; }
.bd-rec-text { display: flex; justify-content: space-between; margin-bottom: 5px; font-size: 0.786rem; color: var(--muted); }
.bd-rec-text .w b { color: var(--accent); }
.bd-rec-text .l b { color: var(--lose); }
.bd-rec-text b { font-size: 0.929rem; font-weight: 700; }
.bd-bar { display: flex; gap: 2px; height: 6px; border-radius: 3px; overflow: hidden; background: var(--surface-2); outline: none; }
.bd-bar i { background: var(--line-2); min-width: 0; }
.bd-bar i.w { background: var(--accent); }
.bd-bar i.l { background: var(--lose); }
/* 최근 5판: 왼쪽이 가장 최근 */
.board-table .c-recent span { display: flex; gap: 3px; }
.bd-chip {
  display: inline-flex; align-items: center; justify-content: center; width: 1.45rem; height: 1.45rem; border-radius: 4px;
  font-style: normal; font-size: 0.714rem; font-weight: 700; color: var(--muted); background: var(--surface-2);
}
.bd-chip.win { color: #15110a; background: var(--accent); }
.bd-chip.lose { color: #fff; background: var(--lose); }
@media (max-width: 1000px) { .board-table .c-recent { display: none; } }
@media (max-width: 760px) { .board-table .c-kda { display: none; } }
@media (max-width: 640px) {
  .board-table .c-dmg { display: none; }
  .board-table th, .board-table td { padding-inline: 8px; }
  .bd-rec { width: 6.5rem; }
}
@media (max-width: 380px) { .board-table .c-avg, .board-table th:nth-child(4) { display: none; } .bd-rec { width: 5.5rem; } }

/* ---------- 기록 (날짜별 묶음, 판마다 접히는 줄) ---------- */
.day-head { display: flex; align-items: baseline; gap: 8px; padding: 12px 20px 8px; background: rgba(255, 255, 255, 0.02); }
.day-head b { font-size: 0.857rem; color: var(--text); }
.day-head span { font-size: 0.786rem; color: var(--muted); }
/* 한 줄 요약: 왼쪽 색 띠와 옅은 배경이 승패를 알려 준다 (승리 파랑, 패배 빨강, 모르면 무색) */
.game-item summary {
  display: flex; align-items: center; gap: 14px;
  padding: 12px 20px 12px 17px; border-left: 3px solid transparent; cursor: pointer; list-style: none;
}
.game-item summary.res-win { background: rgba(91, 155, 213, 0.11); border-left-color: var(--team1); }
.game-item summary.res-lose { background: rgba(212, 106, 106, 0.11); border-left-color: var(--team2); }
.game-item summary.res-win:hover { background: rgba(91, 155, 213, 0.16); }
.game-item summary.res-lose:hover { background: rgba(212, 106, 106, 0.16); }
.gi-res { display: flex; flex-direction: column; gap: 2px; flex: none; width: 4.4rem; }
.gi-res b { font-size: 0.929rem; font-weight: 700; color: var(--muted); }
.res-win .gi-res b { color: var(--team1); }
.res-lose .gi-res b { color: var(--team2); }
.gi-me { display: flex; align-items: center; gap: 8px; flex: 1; min-width: 0; }
.gi-me b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.gi-stat { display: flex; flex-direction: column; align-items: flex-end; gap: 2px; flex: none; white-space: nowrap; font-variant-numeric: tabular-nums; }
.gi-stat b { font-size: 0.929rem; font-weight: 600; }
.gi-stat small { font-size: 0.75rem; color: var(--muted); }
.gi-dmg { min-width: 4.2rem; }
/* 평점 색 (기록 줄·전적 표 공통) */
.game-item .kda.t3, .board-table .kda.t3 { color: #4fb39a; }
.game-item .kda.t4, .board-table .kda.t4 { color: #5b9bd5; }
.game-item .kda.t5, .board-table .kda.t5 { color: #e8964a; font-weight: 600; }
.game-item summary .gi-del { margin-left: 4px; }
.game-item summary::-webkit-details-marker { display: none; }
.game-item summary::after {
  content: ""; flex: none; width: 7px; height: 7px; margin-top: -3px;
  border-right: 1.5px solid var(--muted); border-bottom: 1.5px solid var(--muted); transform: rotate(45deg);
  transition: transform .15s;
}
.game-item[open] summary::after { transform: rotate(225deg); margin-top: 3px; }
.game-item summary:hover { background: rgba(255, 255, 255, 0.02); }
.game-item time { color: var(--muted); font-size: 0.857rem; font-variant-numeric: tabular-nums; }
.gi-body { padding: 0 20px 14px; background: rgba(0, 0, 0, 0.18); border-top: 1px solid var(--line); }
.gi-body .rank-table { margin-top: 6px; }
.gi-foot { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 16px; margin-top: 12px; padding: 0 2px; font-size: 0.857rem; color: var(--muted); }
/* 승리/패배 고르기 (검토 화면·기록) */
.res-pick { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-left: auto; font-size: 0.857rem; color: var(--muted); }
.res-pick > span { margin-right: 4px; }
.res-pick .pick { min-width: 3.6em; }
.res-pick small { flex-basis: 100%; text-align: right; font-size: 0.786rem; }
.res-pick .pick.res-win.on { color: #fff; background: var(--team1); }
.res-pick .pick.res-lose.on { color: #fff; background: var(--team2); }
#review-tables .res-pick { margin-top: 12px; padding: 0 6px; }

/* 전체 전적: 팀별 표 (우리 팀 위, 상대 팀 아래). 한 사람 한 줄 */
.match { display: grid; gap: 10px; margin-top: 14px; }
.match-table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; background: rgba(255, 255, 255, 0.02); border-radius: var(--radius-sm); overflow: hidden; }
.match-table th { padding: 8px 10px; font-size: 0.75rem; font-weight: 500; color: var(--muted); text-align: left; white-space: nowrap; border-bottom: 1px solid var(--line); }
.match-table th b { margin-right: 8px; font-size: 0.857rem; font-weight: 700; }
.match-table.tone-blue th b { color: var(--team1); }
.match-table.tone-red th b { color: var(--team2); }
.match-table.tone-blue th:first-child { box-shadow: inset 2px 0 0 var(--team1); }
.match-table.tone-red th:first-child { box-shadow: inset 2px 0 0 var(--team2); }
.match-table th em { margin-right: 8px; font-style: normal; font-weight: 600; color: var(--text); }
.match-table td { padding: 6px 10px; white-space: nowrap; vertical-align: middle; border-bottom: 1px solid var(--line); font-size: 0.929rem; }
.match-table tbody tr:last-child td { border-bottom: 0; }
.match-table .num { text-align: right; }
.match-table .c-who { width: 100%; max-width: 0; }
.match-table .c-who span { display: flex; align-items: center; gap: 8px; min-width: 0; }
.match-table .c-who b { overflow: hidden; text-overflow: ellipsis; font-weight: 500; color: var(--muted); }
.match-table tr.is-bet .c-who b { font-weight: 700; color: var(--text); }
.mt-lv { flex: none; min-width: 1.3em; font-style: normal; font-size: 0.75rem; color: var(--muted); text-align: center; }
.mt-bet { flex: none; padding: 1px 6px; border-radius: 4px; font-size: 0.714rem; font-weight: 700; color: var(--muted); background: rgba(255, 255, 255, 0.06); }
.mt-bet.win { color: #15110a; background: var(--accent); }
.mt-bet.lose { color: #fff; background: var(--lose); }
.match-table .c-kda b { font-weight: 500; }
.match-table .c-kda small { display: inline-block; min-width: 3.6em; margin-left: 8px; font-size: 0.786rem; color: var(--muted); }
.match-table .c-kp { color: var(--muted); }
.match-table .c-dmg { position: relative; min-width: 6rem; }
.match-table .c-gold { color: var(--muted); }
.match-table .bar { position: absolute; right: 10px; bottom: 3px; height: 2px; border-radius: 1px; max-width: calc(100% - 20px); }
.match-table.tone-blue .bar { background: var(--team1); }
.match-table.tone-red .bar { background: var(--team2); }
@media (max-width: 640px) {
  .match-table .c-kp, .match-table .c-gold, .match-table .c-kda small, .match-table th.c-dmg span { display: none; }
  .match-table th, .match-table td { padding-inline: 6px; font-size: 0.857rem; }
  .match-table th { font-size: 0.714rem; }
  .match-table .c-dmg { min-width: 4.4rem; }
  .match-table .bar { right: 6px; max-width: calc(100% - 12px); }
  .mt-lv { display: none; }
}
/* 아주 좁은 폰: 머리줄의 팀 합계(K/D/A)를 숨겨 이름 칸을 넓힌다 */
@media (max-width: 420px) { .match-table th:first-child span { display: none; } .mt-bet { padding: 1px 4px; } }
@media (max-width: 560px) {
  .game-item summary { gap: 10px; padding: 11px 12px 11px 9px; }
  .gi-res { width: 3.6rem; }
  .gi-dmg { display: none; }
  .gi-body { padding: 0 10px 12px; }
}
.page-actions .gi-del { margin: 0; }
.gi-del { color: var(--muted); font-size: 0.857rem; text-decoration: none; }
.gi-del:hover { color: var(--lose); text-decoration: underline; }

/* ---------- 친구 ---------- */
.friend-row { display: grid; grid-template-columns: 1fr auto auto; align-items: center; gap: 18px; padding: 15px 20px; }
.fr-main { min-width: 0; }
.fr-main b { display: block; font-size: 1.036rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fr-main span { display: block; color: var(--muted); font-size: 0.857rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fr-games { color: var(--muted); font-size: 0.857rem; font-variant-numeric: tabular-nums; }
.fr-actions { display: flex; align-items: center; gap: 14px; }
.fr-actions .link { text-decoration: none; }
.fr-actions .link:hover { text-decoration: underline; }
.friend-row.editing { grid-template-columns: 1fr 1.4fr auto; background: rgba(201, 162, 74, 0.05); }
.friend-row.editing label { display: flex; flex-direction: column; gap: 4px; }
.friend-row.editing label span { color: var(--muted); font-size: 0.786rem; }
.friend-row.editing input { width: 100%; padding: 8px 10px; }

/* ---------- 핸디캡 ---------- */
.hc-card { display: flex; flex-direction: column; gap: 18px; padding: 24px 26px; }
.hc-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.hc-row > span:first-child { color: var(--muted); font-size: 0.929rem; }
/* 방식 고르기는 위에 한 줄, 그 아래 왼쪽 인원수 · 오른쪽 단위 */
.hc-card > .seg { align-self: flex-start; }
.hc-bar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; }
.hc-bar .seg { margin-left: auto; }
@media (max-width: 420px) {
  .hc-card { padding: 20px 16px; }
  .hc-bar { flex-wrap: nowrap; gap: 6px; }
  .hc-bar .os-tabs button { padding-inline: 8px; }
}
.hc-values { display: flex; flex-direction: column; gap: 12px; padding-top: 16px; border-top: 1px solid var(--line); }
.hc-values .hc-row > span:first-child { color: var(--text); font-weight: 600; }
.hc-input { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); }
.hc-input input { width: 8rem; text-align: right; padding: 7px 10px; font-variant-numeric: tabular-nums; appearance: textfield; -moz-appearance: textfield; }
/* 숫자 칸의 위아래 조정 버튼 숨기기 */
.hc-input input::-webkit-inner-spin-button,
.hc-input input::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
.hc-add { display: flex; flex-direction: column; gap: 12px; padding-bottom: 16px; border-bottom: 1px solid var(--line); }
.hc-recent { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.hc-recent > span { width: 100%; color: var(--muted); font-size: 0.857rem; margin-bottom: 2px; }
.hc-chip {
  background: var(--surface-2); color: var(--text); border: 0; border-radius: 999px;
  padding: 5px 12px; font: inherit; font-size: 0.857rem; cursor: pointer;
}
.hc-chip:hover { background: #1f2833; }
.hc-right { display: inline-flex; align-items: center; gap: 12px; }
.hc-empty { margin: 0; }

/* ---------- 챔피언 초상화 ---------- */
.champ-icon {
  display: block; width: 34px; height: 34px; border-radius: var(--radius-sm); object-fit: cover;
  background: var(--surface-2); box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.4);
}
.champ-icon.empty { opacity: 0.6; }
.champ-icon.sm { display: inline-block; width: 26px; height: 26px; margin-right: 8px; vertical-align: middle; border-radius: 5px; }
@media (max-width: 560px) { .champ-icon.sm { margin-right: 6px; } }
.champ-icon.row { width: 28px; height: 28px; border-radius: 5px; flex: none; }
.champ-icon.xs { display: inline-block; width: 22px; height: 22px; border-radius: 4px; flex: none; }
.champ-icon.xs.empty { display: none; }
.champ-icon.hero { width: 72px; height: 72px; border-radius: 12px; box-shadow: 0 0 0 2px var(--accent), 0 8px 24px rgba(0, 0, 0, 0.5); }
.champ-icon.hero.empty { display: none; }

/* ---------- 알림·말풍선·안내 문구 ---------- */
#toast {
  position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); z-index: 10;
  max-width: min(92vw, 34rem); padding: 9px 16px; border-radius: var(--radius-sm); line-height: 1.6;
  background: var(--surface-2); box-shadow: var(--shadow);
}
.tipbox {
  position: fixed; z-index: 50; max-width: 18rem; padding: 6px 10px; border-radius: var(--radius-sm);
  background: #222c38; color: var(--text); font-size: 0.786rem; line-height: 1.5; pointer-events: none;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.5);
}
/* 라이엇 팬 사이트 안내 */
.site-footer { flex: none; width: 100%; max-width: var(--page); margin: 0 auto; padding: 8px 24px 28px; }
.footer-links { display: flex; justify-content: center; gap: 18px; margin-bottom: 10px; align-self: auto; }
.footer-links a { color: var(--muted); font-size: 0.857rem; text-decoration: none; }
.footer-links a:hover { color: var(--text); text-decoration: underline; }
.site-footer p + p { margin-top: 6px; }
.site-footer p { margin: 0; color: rgba(139, 149, 161, 0.7); font-size: 0.75rem; line-height: 1.7; text-align: center; word-break: keep-all; }

/* ---------- 좁은 화면 공통 ---------- */
@media (max-width: 640px) {
  .topbar { padding: 0 12px; }
  .tab { padding: 10px 10px; }
  main { padding: 16px 12px 40px; }
  .page-head { flex-direction: column; align-items: flex-start; gap: 6px; }
  .friend-row, .friend-row.editing { grid-template-columns: 1fr; gap: 10px; }
}

/* ---------- 글 페이지 (사용법, 개인정보처리방침) ---------- */
.doc { max-width: var(--page); margin: 0 auto; padding: 32px 30px 36px; background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); line-height: 1.8; word-break: keep-all; }
.doc h1 { margin: 0 0 14px; font-family: var(--font); font-size: 1.714rem; letter-spacing: -0.01em; line-height: 1.4; }
.doc h2 { margin: 36px 0 10px; font-size: 1.214rem; }
.doc p, .doc ul, .doc ol, .doc dl { margin: 0 0 12px; }
.doc ul { padding-left: 1.2em; }
.doc li { margin-bottom: 6px; }
.doc a { color: var(--accent); }
.doc-lead { color: var(--text); font-size: 1.071rem; }
.doc-date { color: var(--muted); font-size: 0.857rem; }
.doc a.doc-cta { display: inline-block; margin-top: 6px; padding: 12px 24px; border-radius: var(--radius-sm); background: var(--accent); color: #15110a; font-weight: 700; text-decoration: none; }
.doc a.doc-cta:hover { background: #d6b05a; }
.doc-steps { list-style: none; padding: 0; counter-reset: step; display: grid; gap: 10px; }
.doc-steps li { counter-increment: step; margin: 0; padding: 16px 18px; background: var(--surface-2); border-radius: var(--radius-sm); }
.doc-steps li b { display: block; margin-bottom: 2px; }
.doc-steps li b::before { content: counter(step); margin-right: 8px; color: var(--accent); }
.doc-steps li span { color: var(--muted); }
.doc-fig { margin: 18px 0 0; }
.doc-fig img { display: block; width: 100%; height: auto; border-radius: var(--radius-sm); }
.doc-fig figcaption { margin-top: 6px; color: var(--muted); font-size: 0.857rem; }
.doc-faq dt { margin-top: 16px; font-weight: 700; }
.doc-faq dd { margin: 4px 0 0; color: var(--muted); }
.topbar nav a.tab { text-decoration: none; }
@media (max-width: 560px) { .doc { padding: 24px 18px 28px; } }

/* ---------- 움직임: 짧고 작게. 화면이 바뀌는 순간만 부드럽게 잇는다 ---------- */
/* 처음 열 때: 준비가 끝날 때까지 본문을 숨겼다가 한 번에 보여 준다 (index.html의 booting) */
main, .site-footer { transition: opacity .18s ease-out; }
html.booting main, html.booting .site-footer { opacity: 0; }

@media (prefers-reduced-motion: no-preference) {
  /* 버튼·탭·링크: 색이 뚝 바뀌지 않게 */
  .tab, .primary, .ghost, .link, .pick, .cell, h1 a, .steps li, .game-item summary, .seg button {
    transition: color .15s ease, background-color .15s ease, opacity .15s ease, box-shadow .15s ease;
  }
  .primary:active:not(:disabled), .ghost:active { transform: scale(0.98); }
  /* 탭 줄은 첫 화면이 자리 잡은 뒤부터 미끄러진다 */
  html.ready nav::after { transition: transform .24s cubic-bezier(.3, .7, .2, 1), width .24s cubic-bezier(.3, .7, .2, 1); }

  /* 탭·단계가 바뀔 때: 살짝 올라오며 나타남 (display가 켜질 때마다 한 번) */
  .panel, [id^="step-"], .dz-state, .guide-pane, .game-item[open] .gi-body { animation: rise-in .22s ease-out; }
  @keyframes rise-in { from { opacity: 0; transform: translateY(6px); } }

  /* 결과 화면: 1등부터 차례로, 피해량 막대는 오른쪽에서 자라남 */
  #done-result .result-hero { animation: rise-in .3s ease-out; }
  #done-result .rank-table tbody tr { animation: rise-in .3s ease-out backwards; }
  #done-result .rank-table tbody tr:nth-child(1) { animation-delay: .08s; }
  #done-result .rank-table tbody tr:nth-child(2) { animation-delay: .13s; }
  #done-result .rank-table tbody tr:nth-child(3) { animation-delay: .18s; }
  #done-result .rank-table tbody tr:nth-child(4) { animation-delay: .23s; }
  #done-result .rank-table tbody tr:nth-child(5) { animation-delay: .28s; }
  #done-result .rank-table .bar { transform-origin: right; animation: bar-grow .6s cubic-bezier(.2, .7, .2, 1) .2s backwards; }
  @keyframes bar-grow { from { transform: scaleX(0); } }

  /* 사용 가이드 창·알림·말풍선 */
  .guide[open], .ask[open] { animation: pop-in .2s ease-out; }
  .guide[open]::backdrop, .ask[open]::backdrop { animation: fade-in .2s ease-out; }
  @keyframes pop-in { from { opacity: 0; transform: translateY(8px) scale(0.985); } }
  @keyframes fade-in { from { opacity: 0; } }
  #toast { animation: toast-in .2s ease-out; transition: opacity .2s ease, transform .2s ease; }
  #toast.out { opacity: 0; transform: translate(-50%, 6px); }
  @keyframes toast-in { from { opacity: 0; transform: translate(-50%, 8px); } }
  .tipbox { animation: fade-in .1s ease-out; }
}
