/* 비서루 첫 화면 (2026-11 리뉴얼).
 * 첫 화면은 이 파일 하나로 그린다 — style.css · choice-home.css 는 첫 화면에서 읽지 않는다.
 * 요소 이름은 ranking.js · choice-home.js 가 만드는 그대로 둔다 (모양만 새로 입힌다).
 * 색 이름표는 스박(spoon_bak)과 같은 값. 밝게/어둡게는 <html data-theme> 로 고른다 (머리말의 짧은 스크립트가 정한다).
 * 폰 = 720px 이하 (choice-home.js 의 기준과 같다). 두 칸 배치 = 1180px 이상. */

:root {
  --bg: #f4f5f7;
  --surface: #ffffff;
  --surface-2: #f0f1f4;
  --surface-3: #e3e5ea;
  --line: rgba(17, 17, 20, 0.09);
  --line-strong: rgba(17, 17, 20, 0.17);
  --text: #111114;
  --text-2: #3f3f46;
  --text-3: #6b6b76;
  --accent: #ff4100;
  --accent-press: #e63a00;
  --accent-soft: rgba(255, 65, 0, 0.09);
  --up: #0f9150;
  --down: #dc3327;
  --ok: #0f9150;
  --warn: #c2570c;
  --live: #f0354b;
  --top: #d6297b;
  --star: #5457d6;
  --yellow: #c98a00;
  --seg-on: #ffffff;
  --seg-shadow: 0 1px 2px rgba(17, 17, 20, 0.14);
  --overlay: rgba(17, 17, 20, 0.5);
  --shadow-pop: 0 18px 50px rgba(17, 17, 20, 0.22);
  --radius: 16px;
  /* 색감(palettes.css)을 고르지 않았을 때의 값 — 주조색·머리말 면·포인트 위 글자 */
  --brand: var(--text);
  --brand-soft: var(--surface-2);
  --on-brand: var(--surface);
  --chrome: var(--bg);
  --chrome-2: var(--surface-2);
  --chrome-text: var(--text);
  --chrome-text-2: var(--text-2);
  --chrome-line: var(--line);
  --on-accent: #ffffff;
  color-scheme: light;
}
:root[data-theme="dark"] {
  --bg: #0c0c0e;
  --surface: #151518;
  --surface-2: #1e1e23;
  --surface-3: #2a2a31;
  --line: rgba(255, 255, 255, 0.09);
  --line-strong: rgba(255, 255, 255, 0.18);
  --text: #fafafa;
  --text-2: #d0d0d6;
  --text-3: #9a9aa5;
  --accent: #ff4d12;
  --accent-press: #ff6430;
  --accent-soft: rgba(255, 77, 18, 0.17);
  --up: #3ddc84;
  --down: #ff6b61;
  --ok: #3ddc84;
  --warn: #fb923c;
  --live: #ff4d63;
  --top: #f472b6;
  --star: #8b93ff;
  --yellow: #facc15;
  --seg-on: #2f2f37;
  --seg-shadow: none;
  --overlay: rgba(0, 0, 0, 0.62);
  --shadow-pop: 0 18px 50px rgba(0, 0, 0, 0.6);
  color-scheme: dark;
}

/* ---------- 바탕 ---------- */
*, *::before, *::after { box-sizing: border-box; }
/* 세로 스크롤 막대 자리를 늘 비워 둔다 — 긴 화면(랭킹)과 한 장짜리 화면(도구)을 오가거나 창을 띄워 스크롤을 잠글 때
   막대가 생겼다 없어지면서 화면 전체가 옆으로 밀리지 않게 (막대가 내용 위에 뜨는 폰·맥 기본 설정에서는 달라지는 것 없음) */
html { -webkit-text-size-adjust: 100%; scrollbar-gutter: stable; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.5 "Pretendard Variable", Pretendard, -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo", "Malgun Gothic", sans-serif;
  -webkit-font-smoothing: antialiased;
  word-break: keep-all;
}
body.modal-open, body.dlg-open { overflow: hidden; }
button, input { font: inherit; color: inherit; }
button { -webkit-tap-highlight-color: transparent; }
a { color: inherit; }
h1, h2, h3, p, ol { margin: 0; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.wrap { max-width: 1480px; margin: 0 auto; padding: 0 24px; }

/* ---------- 머리말 ---------- */
.top { position: sticky; top: 0; z-index: 50; background: var(--bg); }
.top-in { display: flex; align-items: center; justify-content: space-between; height: 56px; }
.brand { font-size: 21px; font-weight: 800; letter-spacing: -0.02em; text-decoration: none; }

.icon-btn, .lock-button, .search-button {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 38px; min-width: 38px; padding: 0 10px;
  border: 1px solid var(--line-strong); border-radius: 10px;
  background: var(--surface); color: var(--text-2);
  font-size: 14.5px; font-weight: 700; text-decoration: none; cursor: pointer;
}
.icon-btn:hover, .lock-button:hover, .search-button:hover { background: var(--surface-2); color: var(--text); }
.lock-button.unlocked, #choiceSection .lock-button.on { color: var(--ok); border-color: currentColor; }
.theme-btn .fa-sun { display: none; }
:root[data-theme="dark"] .theme-btn .fa-sun { display: inline; }
:root[data-theme="dark"] .theme-btn .fa-moon { display: none; }

/* ---------- 판 배치 ---------- */
.board {
  display: grid; gap: 14px; padding-top: 4px; padding-bottom: 40px;
  grid-template-columns: minmax(0, 1fr);
  grid-template-areas: "tools" "rank" "choice" "guide";
}
.tools { grid-area: tools; }
.ranking-section { grid-area: rank; }
#choiceSection { grid-area: choice; }
.guide { grid-area: guide; }

.pane, #choiceSection {
  min-width: 0;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}
.pane-title, .section-title { font-size: 21px; font-weight: 800; letter-spacing: -0.02em; line-height: 1.3; }
.header-buttons { display: flex; gap: 6px; }

/* ---------- 도구 ---------- */
.tools {
  display: grid; grid-template-columns: minmax(0, 1fr);
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden;
}
.tool { display: flex; align-items: center; gap: 12px; min-width: 0; min-height: 54px; padding: 8px 14px; text-decoration: none; }
.tool + .tool { border-top: 1px solid var(--line); }
.tool:hover { background: var(--surface-2); }
.tool-ic {
  flex: none; width: 36px; height: 36px; border-radius: 11px;
  display: grid; place-items: center;
  background: var(--surface-2); color: var(--text); font-size: 15px;
}
.tool:hover .tool-ic { background: var(--surface-3); }
.tool-tx { flex: 1; min-width: 0; display: flex; align-items: baseline; gap: 10px; }
.tool-tx b { flex: none; font-size: 16px; font-weight: 700; }
.tool-tx span { min-width: 0; font-size: 14.5px; color: var(--text-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tool-go { flex: none; font-size: 12px; color: var(--text-3); }

/* ---------- 랭킹 ---------- */
.pane-head { display: flex; align-items: center; gap: 10px; padding: 14px 14px 12px 18px; }
.pane-meta { min-width: 0; font-size: 14px; color: var(--text-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pane-head .header-buttons { margin-left: auto; }

.ranking-tabs {
  display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 2px;
  margin: 0 14px 12px; padding: 3px;
  background: var(--surface-2); border-radius: 12px;
}
.ranking-tab {
  height: 38px; padding: 0 4px; border: 0; border-radius: 9px;
  background: transparent; color: var(--text-2);
  font-size: 15px; font-weight: 600; white-space: nowrap; cursor: pointer;
}
.ranking-tab:hover { color: var(--text); }
.ranking-tab.active { background: var(--seg-on); color: var(--text); font-weight: 800; box-shadow: var(--seg-shadow); }

.ranking-content { border-top: 1px solid var(--line); container-type: inline-size; }
.ranking-scroll-container {
  height: min(64vh, 620px); overflow-y: auto;
  scrollbar-width: thin; scrollbar-color: var(--surface-3) transparent;
  border-radius: 0 0 var(--radius) var(--radius);
}
.ranking-item {
  display: grid; grid-template-columns: 44px minmax(0, 1fr) auto; align-items: center; column-gap: 8px;
  min-height: 60px; padding: 8px 12px 8px 6px;
  border-bottom: 1px solid var(--line);
}
.ranking-item:hover { background: var(--surface-2); }
.ranking-rank {
  text-align: center; font-size: 17px; font-weight: 700; color: var(--text-3);
  font-variant-numeric: tabular-nums; letter-spacing: -0.02em;
}
.top-1 .ranking-rank, .top-2 .ranking-rank, .top-3 .ranking-rank { font-size: 22px; font-weight: 800; color: var(--accent); }

.ranking-info { min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.ranking-nickname-row { display: flex; align-items: center; gap: 6px; min-width: 0; }
.ranking-nickname { min-width: 0; font-size: 16px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ranking-details {
  display: flex; align-items: center; gap: 12px;
  font-size: 15px; font-weight: 500; color: var(--text-2);
  font-variant-numeric: tabular-nums; white-space: nowrap;
}
.ranking-details i { margin-right: 4px; font-size: 12px; color: var(--text-3); }
.ranking-engagement { display: inline-flex; align-items: center; }
.ranking-engagement i + i { margin-left: -2px; }
.real-score-value.blurred { filter: blur(4px); user-select: none; pointer-events: none; }

.ranking-actions { display: flex; align-items: center; gap: 2px; }
.info-button, .history-button {
  width: 36px; height: 36px; border: 0; border-radius: 10px;
  background: transparent; color: var(--text-3); font-size: 15px; cursor: pointer;
}
.info-button, .history-button { opacity: 0.6; }
.ranking-item:hover .info-button, .ranking-item:hover .history-button { opacity: 1; }
.info-button:hover, .history-button:hover { background: var(--surface-3); color: var(--text); }
.ranking-change {
  min-width: 44px; display: inline-flex; align-items: center; justify-content: flex-end; gap: 3px;
  font-size: 14px; font-weight: 700; font-variant-numeric: tabular-nums;
}
.ranking-change i { font-size: 10px; }
.ranking-change.up { color: var(--up); }
.ranking-change.down { color: var(--down); }
.ranking-change.same { color: var(--text-3); opacity: 0.55; }
.ranking-change.new { color: var(--accent); font-size: 12px; font-weight: 800; }
.ranking-change.new i { display: none; }

.fan-grade {
  flex: none; display: inline-flex; align-items: center; gap: 3px;
  height: 20px; padding: 0 7px; border-radius: 6px;
  font-size: 11.5px; font-weight: 800; letter-spacing: 0.02em; color: #fff; white-space: nowrap;
}
.fan-grade i { font-size: 9px; }
.fan-grade-vip { background: #a85f24; }
.fan-grade-vvip { background: #3767cf; }
.fan-grade-svip { background: #8438cf; }
.fan-grade-royal { background: #e6aa00; color: #332500; }

.ranking-item.birthday-user { background: rgba(255, 186, 0, 0.11); }
.ranking-item.love-user { background: rgba(255, 64, 129, 0.09); }
.birthday-message, .love-message, .special-message { flex: none; font-size: 13px; font-weight: 700; color: var(--top); white-space: nowrap; }
.ranking-item.highlight { background: var(--accent-soft); box-shadow: inset 3px 0 0 var(--accent); }

.ranking-loading, .record-loading {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px;
  padding: 56px 16px; color: var(--text-3); font-size: 15px; text-align: center;
}

/* 찾기 칸 · 최근 찾은 닉네임 (ranking.js 가 #rankSearchForm · #rankRecent 를 쓴다) */
.rank-search { position: relative; display: flex; align-items: center; min-width: 0; }
.rank-search > i { position: absolute; left: 13px; font-size: 14px; color: var(--text-3); pointer-events: none; }
.rank-search .rank-search-busy { display: none; }
.rank-searching .rank-search .fa-search { display: none; }
.rank-searching .rank-search .rank-search-busy { display: block; }
.rank-search input {
  width: 100%; min-width: 0; height: 42px; padding: 0 12px 0 38px;
  border: 1px solid transparent; border-radius: 12px;
  background: var(--surface-2); color: var(--text); font-size: 16px;
}
.rank-search input::placeholder { color: var(--text-3); }
.rank-search input:focus { outline: 2px solid var(--accent); outline-offset: -1px; }
.rank-recent { display: flex; align-items: center; gap: 6px; min-width: 0; overflow-x: auto; scrollbar-width: none; }
.rank-recent::-webkit-scrollbar { display: none; }
.recent-chip, .recent-clear {
  flex: none; height: 32px; padding: 0 12px; border-radius: 99px;
  font-size: 14px; font-weight: 600; white-space: nowrap; cursor: pointer;
}
.recent-chip { max-width: 11em; overflow: hidden; text-overflow: ellipsis; border: 1px solid var(--line-strong); background: var(--surface); color: var(--text-2); }
.recent-chip:hover { background: var(--surface-2); color: var(--text); }
.recent-clear { border: 0; background: transparent; color: var(--text-3); padding: 0 6px; }
.recent-clear:hover { color: var(--text); }

/* 줄을 눌러 기록을 연 줄 · 목록 끝 표지 */
.ranking-item.selected { background: var(--surface-2); box-shadow: inset 3px 0 0 var(--accent); }
.ranking-end { height: 1px; }

/* 줄이 넓으면 이름과 숫자를 옆으로 — 순위표처럼 숫자 칸이 줄마다 맞는다 */
@container (min-width: 560px) {
  .ranking-item { min-height: 54px; padding-top: 6px; padding-bottom: 6px; }
  .ranking-info { flex-direction: row; align-items: center; justify-content: space-between; gap: 16px; }
  .ranking-details { flex: none; gap: 0; }
  .ranking-details > span { min-width: 92px; justify-content: flex-end; text-align: right; }
  .ranking-details > .ranking-engagement { display: inline-flex; }
}

/* ---------- 순위 기록 창 (ranking.js 가 body 끝에 붙인다) ---------- */
.daily-history-modal {
  position: fixed; inset: 0; z-index: 1000;
  display: flex; align-items: center; justify-content: center; padding: 16px;
  opacity: 0; transition: opacity 0.2s ease;
}
.daily-history-modal.show { opacity: 1; }
.daily-history-modal.closing { opacity: 0; }
.daily-history-modal-backdrop { position: absolute; inset: 0; background: var(--overlay); }
.daily-history-modal-content {
  position: relative; z-index: 1;
  display: flex; flex-direction: column;
  width: 100%; max-width: 720px; max-height: min(86vh, 780px);
  background: var(--surface); border: 1px solid var(--line); border-radius: 20px;
  box-shadow: var(--shadow-pop); overflow: hidden;
}
.daily-history-modal-header { display: flex; align-items: center; gap: 12px; padding: 16px 12px 10px 20px; }
.daily-history-modal-header h3 { flex: 1; min-width: 0; font-size: 18px; font-weight: 800; letter-spacing: -0.01em; overflow-wrap: anywhere; }
.daily-history-modal-close {
  flex: none; width: 38px; height: 38px; border: 0; border-radius: 10px;
  background: transparent; color: var(--text-2); font-size: 26px; line-height: 1; cursor: pointer;
}
.daily-history-modal-close:hover { background: var(--surface-2); }
.record-profile {
  flex: none; display: inline-flex; align-items: center; gap: 6px; height: 36px; padding: 0 12px;
  border: 1px solid var(--line-strong); border-radius: 10px;
  color: var(--text); font-size: 14px; font-weight: 700; text-decoration: none; white-space: nowrap;
}
.record-profile i { font-size: 12px; color: var(--text-3); }
.record-profile:hover { background: var(--surface-2); }

.record-tabs { display: flex; gap: 2px; margin: 0 20px; padding: 3px; background: var(--surface-2); border-radius: 12px; }
.record-tab {
  flex: 1; height: 36px; border: 0; border-radius: 9px;
  background: transparent; color: var(--text-2); font-size: 15px; font-weight: 600; cursor: pointer;
}
.record-tab.active { background: var(--seg-on); color: var(--text); font-weight: 800; box-shadow: var(--seg-shadow); }
.record-views { display: flex; gap: 6px; padding: 10px 20px 0; }
.record-view {
  height: 32px; padding: 0 12px; border: 1px solid var(--line-strong); border-radius: 99px;
  background: transparent; color: var(--text-2); font-size: 14px; font-weight: 600; cursor: pointer;
}
.record-view.active { background: var(--text); border-color: var(--text); color: var(--surface); }

.daily-history-modal-body {
  flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain;
  padding: 14px 20px 20px; scrollbar-width: thin; scrollbar-color: var(--surface-3) transparent;
}
.record-summary { display: flex; flex-wrap: wrap; gap: 6px; }
.record-summary > span { padding: 6px 11px; border-radius: 10px; background: var(--surface-2); font-size: 15px; color: var(--text-2); }
.record-summary b { color: var(--text); font-weight: 800; }
.record-summary-sub { margin-left: 4px; font-size: 13px; color: var(--text-3); }

.rank-chart { margin: 14px 0 6px; }
.rank-chart-svg { display: block; overflow: visible; }
.rank-chart-grid { stroke: var(--line-strong); stroke-width: 1; }
.rank-chart-label { fill: var(--text-3); font-size: 11px; }
.rank-chart-line { fill: none; stroke: var(--accent); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.rank-chart-dot { fill: var(--accent); }
.rank-chart-dot.latest { fill: var(--surface); stroke: var(--accent); stroke-width: 2.5; }
.rank-chart-gap { stroke: var(--text-3); stroke-width: 1; stroke-dasharray: 3 3; }

.history-caption { margin: 4px 0 6px; font-size: 13px; color: var(--text-3); }
.history-empty { padding: 28px 0; text-align: center; color: var(--text-3); }
.history-gap-note {
  margin: 8px 0; padding: 9px 12px; border: 1px dashed var(--line-strong); border-radius: 10px;
  font-size: 13.5px; color: var(--text-3); text-align: center;
}
.record-row {
  display: grid; grid-template-columns: 6.4rem 3.8rem minmax(0, 1fr) 3.4rem; align-items: center; gap: 8px;
  padding: 9px 2px; border-bottom: 1px solid var(--line);
  font-size: 15px; font-variant-numeric: tabular-nums;
}
.record-row.record-head { padding: 6px 2px; font-size: 13px; font-weight: 600; color: var(--text-3); }
.record-date { color: var(--text-2); }
.record-rank { font-weight: 800; }
.record-value { display: flex; flex-wrap: wrap; gap: 2px 12px; min-width: 0; color: var(--text-2); }
.record-value i { margin-right: 4px; font-size: 12px; color: var(--text-3); }
.record-change { text-align: right; font-size: 13.5px; font-weight: 700; }
.updown-up { color: var(--up); }
.updown-down { color: var(--down); }
.updown-new { color: var(--accent); font-size: 12px; font-weight: 800; }
.updown-same { color: var(--text-3); }
.record-month-row { grid-template-columns: 6.4rem 3.8rem minmax(0, 1fr) auto; }
.record-month-row.in-progress { background: var(--surface-2); border-radius: 8px; }
.record-basis { text-align: right; font-size: 13px; color: var(--text-3); white-space: nowrap; }

/* ---------- 초이스 모니터 (choice-home.js) ---------- */
#choiceSection { font-size: 15px; line-height: 1.5; }
#choiceSection .ch-wrap { padding: 14px 14px 16px; }
#choiceSection .ch-headwrap {
  display: grid; grid-template-columns: auto auto minmax(0, 1fr); align-items: center; gap: 4px 10px;
  grid-template-areas: "title badge btns" "sub sub sub";
  margin: 0 0 10px 4px;
}
#choiceSection .section-header { display: contents; }
#choiceSection .section-title { grid-area: title; }
#choiceSection .header-buttons { grid-area: btns; justify-self: end; }
#choiceSection .ch-badges { grid-area: badge; }
#choiceSection .section-subtitle { grid-area: sub; font-size: 14px; color: var(--text-3); overflow-wrap: anywhere; }
/* 무엇인지 한 줄(.what) + 공개 기간(.when) — choice-home.js 가 채운다 */
#choiceSection .section-subtitle .what { display: block; margin-bottom: 2px; font-size: 15px; color: var(--text-2); }
#choiceSection .section-subtitle .when { display: block; }
#choiceSection .lock-button .fa-lock-open { display: none; }
#choiceSection .lock-button.on .fa-lock { display: none; }
#choiceSection .lock-button.on .fa-lock-open { display: inline; }

#choiceSection .phase {
  display: inline-block; padding: 3px 9px; border-radius: 99px; white-space: nowrap;
  font-size: 13px; font-weight: 700; color: var(--ok); background: rgba(15, 145, 80, 0.13);
  background: color-mix(in srgb, var(--ok) 15%, transparent);
}
#choiceSection .phase.overtime { color: var(--warn); background: rgba(194, 87, 12, 0.13); background: color-mix(in srgb, var(--warn) 15%, transparent); }
#choiceSection .phase.idle { color: var(--text-3); background: var(--surface-2); }

#choiceSection .strip { display: flex; flex-wrap: wrap; gap: 2px 14px; margin: 0 0 12px 4px; font-size: 13.5px; color: var(--text-3); }
#choiceSection .strip b { color: var(--text); font-weight: 700; }
#choiceSection .dot {
  display: inline-block; width: 8px; height: 8px; margin-right: 6px; border-radius: 50%;
  background: var(--live); vertical-align: 1px; animation: ch-blink 1.4s infinite;
}
@keyframes ch-blink { 50% { opacity: 0.35; } }

#choiceSection .search { display: flex; margin-bottom: 10px; }
#choiceSection .search input, #choiceSection .modal-box input, .dlg-box input {
  width: 100%; min-width: 0; height: 44px; padding: 0 13px;
  border: 1px solid transparent; border-radius: 12px;
  background: var(--surface-2); color: var(--text); font-size: 16px;
}
#choiceSection .search input::placeholder, #choiceSection .modal-box input::placeholder, .dlg-box input::placeholder { color: var(--text-3); }
#choiceSection .search input:focus, #choiceSection .modal-box input:focus, .dlg-box input:focus { outline: 2px solid var(--accent); outline-offset: -1px; border-color: transparent; }

#choiceSection .err { color: var(--warn); font-size: 14px; }
#choiceSection .me {
  margin-bottom: 8px; padding: 12px 14px;
  background: var(--surface-2); border-radius: 14px;
}
#choiceSection .me .nm { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 6px; font-size: 16.5px; font-weight: 800; line-height: 1.35; }
#choiceSection .me .nm .nick { min-width: 0; word-break: break-all; }
#choiceSection .me .nm .live, #choiceSection .me .nm .sus { margin-left: 0; white-space: nowrap; }
#choiceSection .me .who { margin-top: 2px; font-size: 13px; color: var(--text-3); word-break: break-all; }
#choiceSection .me .meta { margin: 2px 0 8px; font-size: 13.5px; color: var(--text-3); }
#choiceSection .me .stats { display: flex; gap: 6px; margin: 10px 0 6px; }
#choiceSection .me .stats > div { flex: 1 1 0; min-width: 0; padding: 7px 10px; border-radius: 10px; background: var(--surface); }
#choiceSection .me .stats > div > span { display: block; font-size: 12.5px; color: var(--text-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#choiceSection .me .stats b { display: block; font-size: 15.5px; font-variant-numeric: tabular-nums; white-space: nowrap; }
#choiceSection .me .stats .mv { font-size: 12px; }
#choiceSection .me .tr {
  display: grid; grid-template-columns: 78px minmax(0, 1fr) minmax(0, 1fr); align-items: center; gap: 8px;
  padding: 7px 0; border-top: 1px solid var(--line);
  font-size: 13.5px; font-variant-numeric: tabular-nums;
}
#choiceSection .me .tiers.one .tr { grid-template-columns: 78px minmax(0, 1fr); }
#choiceSection .me .tr > span { text-align: right; white-space: nowrap; }
#choiceSection .me .tr > span:first-child { text-align: left; font-weight: 800; color: var(--c); }
#choiceSection .me .tr.th { padding: 0 0 4px; border-top: 0; font-size: 12.5px; color: var(--text-3); }
#choiceSection .me .tr .ok { color: var(--ok); }
#choiceSection .me .tr .lack { color: var(--warn); }
#choiceSection .needs { display: flex; flex-wrap: wrap; gap: 8px; }
#choiceSection .need { padding: 4px 9px; border-radius: 8px; background: var(--surface); font-size: 13.5px; }
#choiceSection .lmline { margin-top: 8px; font-size: 13px; color: var(--text-3); }
#choiceSection .lmline b.ok { color: var(--ok); }

#choiceSection .cards { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin-bottom: 12px; }
#choiceSection .card {
  position: relative; min-width: 0; overflow: hidden; padding: 13px 12px 12px;
  border: 1px solid var(--line-strong); border-radius: 14px; background: var(--surface); cursor: pointer;
}
#choiceSection .card::before { content: ""; position: absolute; left: 0; right: 0; top: 0; height: 3px; background: var(--c); }
#choiceSection .card:hover { background: var(--surface-2); }
#choiceSection .card.sel { border-color: var(--c); box-shadow: inset 0 0 0 1px var(--c); }
#choiceSection .card.pulse { animation: ch-pulse 1.2s ease-out; }
@keyframes ch-pulse { 0% { box-shadow: 0 0 0 0 var(--c); } 100% { box-shadow: 0 0 0 12px transparent; } }
#choiceSection .card .t { font-size: 15px; font-weight: 800; }
#choiceSection .card .t small { margin-left: 5px; font-size: 13px; font-weight: 500; color: var(--text-3); }
#choiceSection .card .cut { margin-top: 2px; font-size: 24px; font-weight: 800; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
#choiceSection .card .u { font-size: 13px; color: var(--text-3); }
#choiceSection .card .row { display: flex; justify-content: space-between; gap: 6px; margin-top: 6px; font-size: 14px; color: var(--text-3); }
#choiceSection .card .row b { color: var(--text); font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }
#choiceSection .card .row b.upc { color: var(--warn); }
#choiceSection .card .row b.dnc { color: var(--ok); }

#choiceSection .tbl { position: relative; overflow: hidden; border: 1px solid var(--line-strong); border-radius: 14px; }
#choiceSection .tbl h2 { margin: 0; padding: 11px 14px; border-bottom: 1px solid var(--line); font-size: 15px; font-weight: 800; }
#choiceSection .tbl h2::before { content: ""; display: inline-block; width: 9px; height: 9px; margin-right: 8px; border-radius: 3px; background: var(--c); }
#choiceSection .r {
  position: relative; display: grid; grid-template-columns: 86px minmax(0, 1fr) 96px 92px 122px; align-items: center;
  background: var(--surface); border-bottom: 1px solid var(--line); font-variant-numeric: tabular-nums;
}
#choiceSection .r > div { padding: 9px 12px; text-align: right; white-space: nowrap; font-size: 15px; }
#choiceSection .r > div:nth-child(2) { text-align: left; white-space: normal; }
#choiceSection .r.hd > div { padding-top: 7px; padding-bottom: 7px; font-size: 13px; font-weight: 600; color: var(--text-3); }
#choiceSection .r.out > div { color: var(--text-3); }
#choiceSection .box { overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin; scrollbar-color: var(--surface-3) transparent; }
#choiceSection .box.up .r:last-child { border-bottom: 0; }
#choiceSection .cutbar {
  position: relative; z-index: 1; display: flex; align-items: center; gap: 10px; padding: 6px 12px;
  background: var(--surface-2); font-size: 13px; font-weight: 800;
}
#choiceSection .cutbar .lm { color: var(--text-3); font-weight: 500; }
#choiceSection .cutbar::before, #choiceSection .cutbar::after {
  content: ""; flex: 1; height: 3px;
  background: repeating-linear-gradient(90deg, var(--c) 0 10px, transparent 10px 18px);
}
#choiceSection .r.bump { animation: ch-bump 1.6s ease-out; }
@keyframes ch-bump { 0% { background: rgba(61, 220, 132, 0.3); } 100% { background: var(--surface); } }
#choiceSection .r.enter { animation: ch-fadein 0.5s both; }
@keyframes ch-fadein { from { opacity: 0; } }
#choiceSection .rk { font-weight: 800; }
#choiceSection .mv { margin-left: 3px; font-size: 12px; }
#choiceSection .mv.up { color: var(--up); }
#choiceSection .mv.dn { color: var(--text-3); }
#choiceSection .nick { font-weight: 600; word-break: break-all; }
#choiceSection .live {
  display: inline-block; margin-left: 5px; padding: 0 5px; border-radius: 4px; vertical-align: 1px;
  background: var(--live); color: #fff; font-size: 11.5px; font-weight: 800;
}
#choiceSection .plus { position: absolute; right: 12px; top: 2px; font-size: 12px; font-weight: 800; color: var(--ok); pointer-events: none; animation: ch-floatup 1.8s ease-out forwards; }
@keyframes ch-floatup { 0% { opacity: 0; transform: translateY(6px); } 15% { opacity: 1; } 100% { opacity: 0; transform: translateY(-14px); } }
#choiceSection .sus { display: inline-block; margin-left: 5px; padding: 0 4px; border: 1px solid currentColor; border-radius: 4px; vertical-align: 1px; font-size: 11.5px; color: var(--warn); cursor: help; }
#choiceSection .gap.in { color: var(--ok); }
#choiceSection .gap.out { color: var(--warn); font-weight: 800; }
#choiceSection .unit { display: inline-block; margin-left: 6px; padding: 1px 7px; border: 1px solid var(--line-strong); border-radius: 99px; vertical-align: 1px; font-size: 12px; font-weight: 700; color: var(--text-3); }
#choiceSection .unit.ls { border-color: transparent; color: var(--ok); background: rgba(15, 145, 80, 0.13); }
#choiceSection .recenter {
  position: absolute; right: 12px; bottom: 12px; z-index: 3; padding: 7px 13px; border: 0; border-radius: 99px;
  background: var(--text); color: var(--surface); font-size: 13px; font-weight: 700; cursor: pointer; box-shadow: var(--shadow-pop);
}
#choiceSection .more {
  display: flex; align-items: center; justify-content: center; gap: 6px; width: 100%; min-height: 44px;
  border: 0; border-bottom: 1px solid var(--line); background: var(--surface-2); color: var(--text-2);
  font-size: 14px; font-weight: 700; cursor: pointer;
}
#choiceSection .more.md { border-bottom: 0; border-top: 1px solid var(--line); }
#choiceSection .r.fold { display: none; }
#choiceSection .note { margin: 14px 4px 0; font-size: 14.5px; line-height: 1.65; color: var(--text-3); overflow-wrap: anywhere; }
#choiceSection .warnbox, #choiceSection .admin { margin-bottom: 8px; padding: 9px 12px; border-radius: 10px; font-size: 14px; overflow-wrap: anywhere; }
#choiceSection .warnbox { background: rgba(220, 51, 39, 0.1); color: var(--down); }
#choiceSection .warnbox b { color: var(--text); }
#choiceSection .admin { background: var(--surface-2); color: var(--text-2); }
#choiceSection .m-only { display: none; }

/* 공개 기간 밖: 제목 줄 대신 한 줄 안내 */
#choiceSection.is-closed .ch-headwrap, #choiceSection.is-closed .note, #choiceSection.is-closed #ch-warn, #choiceSection.is-closed .strip { display: none; }
#choiceSection .closed { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 14px; padding: 4px; }
#choiceSection .closed .ttl { font-size: 21px; font-weight: 800; letter-spacing: -0.02em; }
#choiceSection .closed .ttl i { display: none; }
#choiceSection .closed .what { flex-basis: 100%; font-size: 15px; color: var(--text-2); }
#choiceSection .closed .msg { font-size: 15px; color: var(--text-2); }
#choiceSection .closed .msg b { color: var(--text); font-weight: 700; }

/* 되감기 */
#choiceSection .ch-rw-btn { padding: 0 12px; }
#choiceSection .rw-ctl {
  position: sticky; top: 64px; z-index: 5;
  display: grid; grid-template-columns: auto auto 1fr auto; grid-template-areas: "tag time . exit" "play range range speed";
  align-items: center; gap: 8px 10px; margin-bottom: 10px; padding: 10px 12px;
  background: var(--surface); border: 1px solid var(--accent); border-radius: 14px; box-shadow: var(--shadow-pop);
}
#choiceSection .rw-tag { grid-area: tag; display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 800; color: var(--accent); }
#choiceSection .rw-time { grid-area: time; font-size: 18px; font-weight: 800; font-variant-numeric: tabular-nums; letter-spacing: -0.01em; }
#choiceSection .rw-exit { grid-area: exit; }
#choiceSection .rw-play { grid-area: play; }
#choiceSection #ch-rwRange { grid-area: range; width: 100%; min-width: 0; accent-color: var(--accent); }
#choiceSection #ch-rwSpeed { grid-area: speed; }
#choiceSection .rw-btn {
  height: 34px; min-width: 34px; padding: 0 11px; border: 1px solid var(--line-strong); border-radius: 99px;
  background: var(--surface-2); color: var(--text); font-size: 13px; font-weight: 700; cursor: pointer;
}
#choiceSection .rw-play { background: var(--accent); border-color: transparent; color: #fff; }
#choiceSection .rw-exit { background: transparent; color: var(--text-2); }
#choiceSection.is-replay .search, #choiceSection.is-replay #ch-found, #choiceSection.is-replay .strip,
#choiceSection.is-replay #ch-warn, #choiceSection.is-replay .card .row:last-child { display: none; }
#choiceSection.is-replay .r.bump { animation-duration: 0.6s; }
#choiceSection.is-replay .plus { animation-duration: 0.8s; }
#choiceSection.is-replay .r > div:nth-child(4) { color: var(--text-3); }

/* ---------- 창 · 알림 띠 (home-ui.js, 초이스 모니터의 창도 같은 모양) ---------- */
#choiceSection .modal, .dlg { position: fixed; inset: 0; z-index: 2000; display: flex; align-items: center; justify-content: center; padding: 16px; }
#choiceSection .modal-bg, .dlg-bg { position: absolute; inset: 0; background: var(--overlay); animation: ch-fadein 0.18s both; }
#choiceSection .modal-box, .dlg-box {
  position: relative; width: 100%; max-width: 380px; padding: 20px 20px 16px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 20px; box-shadow: var(--shadow-pop);
  animation: dlg-in 0.18s both;
}
@keyframes dlg-in { from { opacity: 0; transform: translateY(8px); } }
#choiceSection .modal-box h3, .dlg-box h3 { margin-bottom: 8px; font-size: 18px; font-weight: 800; letter-spacing: -0.01em; overflow-wrap: anywhere; }
#choiceSection .modal-box p, .dlg-box p { margin-bottom: 14px; font-size: 15px; line-height: 1.6; color: var(--text-2); overflow-wrap: anywhere; }
#choiceSection .modal-box p b { color: var(--text); }
#choiceSection .modal-err, .dlg-err { min-height: 22px; margin: 6px 2px 4px; font-size: 14px; color: var(--down); }
#choiceSection .modal-btns, .dlg-btns { display: flex; justify-content: flex-end; gap: 8px; }
#choiceSection .modal-btns button, .dlg-btns .btn {
  display: inline-flex; align-items: center; justify-content: center; height: 44px; padding: 0 18px;
  border: 0; border-radius: 12px; background: var(--accent); color: #fff;
  font-size: 15.5px; font-weight: 700; text-decoration: none; cursor: pointer;
}
#choiceSection .modal-btns button:hover, .dlg-btns .btn:hover { background: var(--accent-press); }
#choiceSection .modal-btns button.ghost, .dlg-btns .btn.ghost { background: var(--surface-2); color: var(--text); }
#choiceSection .modal-btns button.ghost:hover, .dlg-btns .btn.ghost:hover { background: var(--surface-3); }
#choiceSection .modal-btns button:disabled, .dlg-btns .btn:disabled { opacity: 0.6; cursor: wait; }
#choiceSection .shake, .dlg-box.shake { animation: ch-shake 0.35s; }
@keyframes ch-shake { 20%, 60% { transform: translateX(-6px); } 40%, 80% { transform: translateX(6px); } }
.dlg.closing { opacity: 0; transition: opacity 0.15s ease; }

#choiceSection .toast, .ui-toast {
  position: fixed; left: 50%; bottom: 24px; z-index: 2001; transform: translateX(-50%);
  max-width: calc(100vw - 32px); padding: 11px 16px; border-radius: 12px;
  background: var(--text); color: var(--surface); font-size: 15px; font-weight: 600;
  box-shadow: var(--shadow-pop); animation: dlg-in 0.2s both;
}
#choiceSection .toast { white-space: nowrap; }
.ui-toast { text-align: center; }

/* ---------- 사용법 · 꼬리말 ---------- */
.guide { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 24px; padding: 6px 6px 0; }
.guide h2 { margin-bottom: 6px; font-size: 16px; font-weight: 800; }
.guide ol { padding-left: 20px; font-size: 15px; color: var(--text-2); line-height: 1.7; }
.guide p { margin-top: 6px; font-size: 15px; color: var(--text-3); line-height: 1.6; }
.foot { padding: 18px 0 28px; border-top: 1px solid var(--line); font-size: 14px; color: var(--text-3); }
.foot a { color: var(--text-2); font-weight: 600; }

/* ---------- 넓은 화면: 왼쪽 순위표(고정) · 오른쪽 도구와 초이스 ---------- */
@media (min-width: 721px) {
  .tools { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .tool { min-height: 66px; padding: 12px 16px; }
  .tool + .tool { border-top: 0; }
  .tool:nth-child(odd) { border-right: 1px solid var(--line); }
  .tool:nth-child(n + 3) { border-top: 1px solid var(--line); }
  .tool-ic { width: 40px; height: 40px; font-size: 16px; }
  .tool-tx { flex-direction: column; align-items: stretch; gap: 0; }
  .tool-tx b { line-height: 1.35; }
  .tool-tx span { font-size: 14px; }
}
@media (min-width: 1180px) {
  .board {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); grid-template-rows: auto auto 1fr;
    grid-template-areas: "rank tools" "rank choice" "rank guide";
    gap: 16px 20px; align-items: start;
  }
  .ranking-section { position: sticky; top: 60px; display: flex; flex-direction: column; height: calc(100vh - 76px); min-height: 460px; }
  .ranking-content { flex: 1; min-height: 0; display: flex; }
  .ranking-scroll-container { flex: 1; height: auto; overscroll-behavior: contain; }
  #choiceSection .rw-ctl { grid-template-columns: auto auto auto 1fr auto auto; grid-template-areas: "tag time play range speed exit"; }
  #choiceSection .me { display: grid; grid-template-columns: 200px minmax(0, 1fr); column-gap: 18px; align-items: start; }
  #choiceSection .me > .nm, #choiceSection .me > .who, #choiceSection .me > .meta { grid-column: 1 / -1; }
  #choiceSection .me .stats { flex-direction: column; margin: 10px 0 0; }
  #choiceSection .me .stats > div { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
  #choiceSection .me .tiers { margin-top: 8px; }
}

/* ---------- 폰 ---------- */
@media (max-width: 720px) {
  .wrap { padding: 0 12px; }
  .top-in { height: 52px; }
  .board { gap: 12px; padding-top: 2px; padding-bottom: 28px; }
  .pane-head { padding: 12px 10px 10px 14px; }
  .pane-title, .section-title { font-size: 20px; }
  .icon-btn, .lock-button, .search-button { height: 40px; min-width: 40px; }
  .ranking-tabs { margin: 0 10px 10px; }
  .ranking-tab { height: 40px; font-size: 14.5px; }
  .ranking-item { min-height: 62px; padding-right: 8px; column-gap: 6px; }
  .ranking-nickname { font-size: 16.5px; }
  .ranking-details { font-size: 15px; gap: 10px; }
  .ranking-change { min-width: 40px; }
  .info-button { display: none; }
  .info-button, .history-button { width: 40px; height: 40px; }

  .daily-history-modal { align-items: flex-end; padding: 0; }
  .daily-history-modal-content {
    max-width: none; max-height: 90vh; border-radius: 20px 20px 0 0; border-bottom: 0;
    transform: translateY(24px); transition: transform 0.22s ease;
  }
  .daily-history-modal.show .daily-history-modal-content { transform: none; }
  .daily-history-modal-header { padding: 14px 8px 8px 16px; }
  .record-tabs { margin: 0 14px; }
  .record-tab { height: 40px; }
  .record-views { padding: 10px 14px 0; }
  .record-view { height: 36px; }
  .daily-history-modal-body { padding: 12px 14px calc(18px + env(safe-area-inset-bottom)); }
  .record-row { grid-template-columns: 5.6rem 3.2rem minmax(0, 1fr) 3rem; gap: 6px; }
  .record-month-row { grid-template-columns: 5.6rem 3.2rem minmax(0, 1fr); }
  .record-month-row .record-basis { grid-column: 1 / -1; margin-top: -4px; text-align: left; white-space: normal; }
  .record-head.record-month-row .record-basis { display: none; }

  #choiceSection .ch-wrap { padding: 12px 10px 14px; }
  #choiceSection .lock-button, #choiceSection .ch-rw-btn { height: 40px; min-width: 40px; }
  #choiceSection .d-only { display: none; }
  #choiceSection .m-only { display: block; font-size: 12px; line-height: 1.25; color: var(--text-3); }
  #choiceSection .cards { gap: 6px; margin-bottom: 10px; }
  #choiceSection .card { padding: 11px 9px 10px; border-radius: 12px; }
  #choiceSection .card .t { font-size: 14px; }
  #choiceSection .card .t small { display: block; margin: 0; font-size: 12px; }
  #choiceSection .card .cut { margin-top: 2px; font-size: clamp(14px, 4.3vw, 18px); letter-spacing: -0.02em; }
  #choiceSection .card .u, #choiceSection .card .row:not(.keep) { display: none; }
  #choiceSection .card .row.keep { display: block; margin-top: 6px; }
  #choiceSection .card .row.keep > span { display: block; font-size: 12.5px; color: var(--text-3); white-space: nowrap; }
  #choiceSection .card .row.keep b { display: block; font-size: clamp(13px, 3.7vw, 14.5px); white-space: nowrap; }
  #choiceSection .tbl h2 { padding: 10px 12px; }
  #choiceSection .r { grid-template-columns: 46px minmax(0, 1fr) 72px 104px; }
  #choiceSection .r > div { padding: 8px 6px; font-size: 14.5px; }
  #choiceSection .nick { font-size: 15.5px; }
  #choiceSection .note { font-size: 15px; }
  #choiceSection .strip { font-size: 14px; }
  #choiceSection .section-subtitle { font-size: 14.5px; }
  .tool-tx span { font-size: 15px; }
  #choiceSection .r > div:first-child { padding-left: 10px; }
  #choiceSection .r > div:last-child { padding-right: 10px; font-size: 14px; }
  #choiceSection .r > div:nth-child(4) { display: none; }
  #choiceSection .r.hd > div { font-size: 12.5px; }
  #choiceSection .r .mv { display: block; margin: 0; font-size: 11.5px; line-height: 1.1; }
  #choiceSection .cutbar { gap: 6px; padding: 6px 10px; font-size: 12.5px; }
  #choiceSection .box { max-height: none !important; overflow: visible; }
  #choiceSection .recenter { display: none; }
  #choiceSection .plus { right: 8px; }
  #choiceSection .rw-ctl { top: 58px; padding: 8px 10px; }
  #choiceSection .rw-btn { height: 40px; min-width: 40px; }
  #choiceSection .me { padding: 12px; }
  #choiceSection .me .tr { grid-template-columns: 72px minmax(0, 1fr) minmax(0, 1fr); gap: 6px; font-size: 13px; }
  #choiceSection .me .tiers.one .tr { grid-template-columns: 72px minmax(0, 1fr); }

  /* 누르기만 하는 창은 아래에서 올라오고, 글자를 넣는 창은 자판에 가리지 않게 위쪽에 둔다 */
  .dlg { align-items: flex-end; padding: 0; }
  .dlg-box { max-width: none; padding: 20px 16px calc(16px + env(safe-area-inset-bottom)); border-radius: 20px 20px 0 0; border-bottom: 0; }
  .dlg.dlg-input, #choiceSection .modal { align-items: flex-start; padding: 14vh 12px 0; }
  .dlg.dlg-input .dlg-box { padding: 20px 16px 16px; border-radius: 20px; border-bottom: 1px solid var(--line); }
  #choiceSection .modal-btns button, .dlg-btns .btn { flex: 1; height: 48px; }
  #choiceSection .toast, .ui-toast { bottom: calc(16px + env(safe-area-inset-bottom)); }

  .guide { grid-template-columns: minmax(0, 1fr); gap: 16px; padding: 4px 4px 0; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
