/* 홈 화면 */
.top { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 20px; }
.top h1 { margin: 0; font-size: calc(25px * var(--fs)); font-weight: 700; letter-spacing: -.01em; line-height: 1.25; word-break: keep-all; }
.top .sub { margin: 4px 0 0; color: var(--muted); font-size: calc(14px * var(--fs)); word-break: keep-all; }
.seg { display: inline-flex; flex: none; padding: 3px; border-radius: 10px; background: var(--surface-2); border: 1px solid var(--line); }
.seg button {
  border: 0; background: transparent; padding: 6px 10px; border-radius: 7px;
  font-size: calc(13.5px * var(--fs)); font-weight: 600; color: var(--muted); white-space: nowrap;
}
.seg button[aria-pressed="true"] { background: var(--surface); color: var(--accent-text); box-shadow: var(--shadow); }

.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 12px; }
.stat { background: var(--surface); border-radius: 14px; padding: 12px 12px 10px; box-shadow: var(--shadow); min-width: 0; }
.stat .n { font-family: var(--mono); font-size: calc(26px * var(--fs)); font-weight: 600; line-height: 1.1; }
.stat .n.hot { color: var(--accent-text); }
.stat .l { font-size: calc(12.5px * var(--fs)); color: var(--muted); margin-top: 4px; word-break: keep-all; }

.stages { display: flex; flex-direction: column; gap: 8px; }
.stage-row { display: flex; background: var(--surface); border-radius: 14px; box-shadow: var(--shadow); overflow: hidden; }
.stage {
  flex: 1; min-width: 0;
  display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 14px;
  text-align: left; border: 0; background: transparent; padding: 13px 12px 13px 14px;
}
.stage:active, .guide-btn:active { background: var(--surface-2); }
.stage .no { font-family: var(--mono); font-size: calc(15px * var(--fs)); font-weight: 600; color: var(--accent-text); }
.stage .names { display: flex; flex-wrap: wrap; align-items: baseline; column-gap: 8px; }
.stage .ko { font-weight: 600; font-size: calc(15.5px * var(--fs)); word-break: keep-all; }
.stage .en { font-family: var(--mono); font-size: calc(12.5px * var(--fs)); color: var(--faint); overflow-wrap: anywhere; }
.pbar { position: relative; display: block; height: 5px; border-radius: 3px; background: var(--track); overflow: hidden; margin-top: 7px; }
.pbar i { position: absolute; inset: 0 auto 0 0; border-radius: 3px; background: var(--accent); }
.pbar i.seen { opacity: .35; }
.badge { font-size: calc(12.5px * var(--fs)); font-weight: 600; white-space: nowrap; color: var(--muted); font-family: var(--mono); }
.badge.due { font-family: var(--ko); background: var(--accent-soft); color: var(--accent-text); padding: 3px 9px; border-radius: 999px; }
.badge.due b { font-family: var(--mono); }
.guide-btn {
  flex: none; width: 58px; border: 0; border-left: 1px solid var(--line); background: transparent;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  color: var(--muted); font-size: calc(11.5px * var(--fs)); font-weight: 600;
}
.guide-btn svg { width: 20px; height: 20px; }

.foot {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  margin-top: 26px; padding-top: 16px; border-top: 1px solid var(--line);
  font-size: calc(14px * var(--fs)); color: var(--muted);
}
.foot b { font-family: var(--mono); color: var(--text); }
.link { border: 0; background: none; padding: 6px 0; color: var(--muted); font-size: calc(14px * var(--fs)); text-decoration: underline; text-underline-offset: 3px; }
.confirm {
  margin-top: 12px; padding: 14px; border-radius: 14px; background: var(--bad-bg); color: var(--bad);
  font-size: calc(14.5px * var(--fs)); word-break: keep-all;
}
.confirm .row { display: flex; gap: 8px; margin-top: 10px; }
.confirm button { flex: 1; border-radius: 10px; padding: 10px; font-weight: 600; font-size: calc(14.5px * var(--fs)); }
.confirm .no-btn { border: 1px solid currentColor; background: transparent; }
.confirm .yes-btn { border: 0; background: var(--bad); color: var(--bad-bg); }

@media (max-width: 480px) {
  .stat .n { font-size: calc(23px * var(--fs)); }
}

.toolbar { display: flex; align-items: center; gap: 8px; margin-bottom: 14px; }
.search-open {
  flex: 1; min-width: 0; display: flex; align-items: center; gap: 8px;
  height: 36px; padding: 0 12px; border-radius: 10px; border: 1px solid var(--line);
  background: var(--surface); color: var(--faint); font-size: calc(14px * var(--fs)); text-align: left;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.search-open svg { width: 17px; height: 17px; flex: none; }
.quiz-start { margin-top: 8px; }

.topics { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.topic {
  display: flex; flex-direction: column; align-items: flex-start; gap: 4px; min-width: 0;
  border: 0; background: var(--surface); border-radius: 14px; padding: 13px 14px; box-shadow: var(--shadow); text-align: left;
}
.topic b { font-size: calc(15px * var(--fs)); word-break: keep-all; }
.topic span { font-size: calc(12.5px * var(--fs)); color: var(--muted); word-break: keep-all; line-height: 1.45; }
.topic:active { background: var(--surface-2); }
.topic.wide { grid-column: 1 / -1; border: 1px dashed var(--line); box-shadow: none; background: transparent; }
@media (max-width: 360px) { .topics { grid-template-columns: 1fr; } }

.foot { flex-wrap: wrap; }
.tools { display: flex; flex-wrap: wrap; gap: 14px; }
.notice { margin-top: 12px; padding: 12px 14px; border-radius: 12px; font-size: calc(14px * var(--fs)); word-break: keep-all; }
.notice.ok { background: var(--good-bg); color: var(--good); }
.notice.err { background: var(--bad-bg); color: var(--bad); }
.confirm.info { background: var(--accent-soft); color: var(--text); }
.confirm.info .yes-btn { background: var(--accent); color: var(--accent-ink); }
.topic.full { grid-column: 1 / -1; }
