/* 책등 — 밝은 서점형 */

:root {
  --bg:        #ffffff;
  --bg-soft:   #f6f6f7;
  --bg-sunk:   #fafafa;
  --line:      #e7e7ea;
  --line-soft: #f0f0f2;
  --tx:        #15161a;
  --tx-mid:    #5c5f68;
  --tx-faint:  #90939c;
  --ac:        #12664a;
  --ac-soft:   #e9f3ef;
  --ac-line:   #bcd9cd;
  --warn:      #b3421f;
  --warn-soft: #fbeee9;

  --r:   10px;
  --r-s: 6px;
  --shadow: 0 1px 2px rgba(20,22,26,.05), 0 8px 24px -12px rgba(20,22,26,.18);
  --shadow-up: 0 2px 4px rgba(20,22,26,.06), 0 16px 32px -16px rgba(20,22,26,.26);

  --sans: 'Pretendard Variable', Pretendard, -apple-system, BlinkMacSystemFont,
          'Apple SD Gothic Neo', system-ui, sans-serif;

  --wrap: 1080px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg:        #0f1113;
    --bg-soft:   #17191c;
    --bg-sunk:   #131518;
    --line:      #26292e;
    --line-soft: #1d2024;
    --tx:        #e9eaec;
    --tx-mid:    #a0a4ac;
    --tx-faint:  #71757e;
    --ac:        #5cc39a;
    --ac-soft:   #13241e;
    --ac-line:   #24463a;
    --warn:      #e08765;
    --warn-soft: #2a1c16;
    --shadow: 0 1px 2px rgba(0,0,0,.4), 0 8px 24px -12px rgba(0,0,0,.6);
    --shadow-up: 0 2px 4px rgba(0,0,0,.5), 0 16px 32px -16px rgba(0,0,0,.7);
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--tx);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.7;
  letter-spacing: -0.01em;
  word-break: keep-all;
  overflow-wrap: break-word;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3 { letter-spacing: -0.03em; line-height: 1.3; margin: 0; }
button, input, textarea, select { font-family: inherit; letter-spacing: inherit; }

/* ── 히어로 ────────────────────────────────────────── */
.hero {
  max-width: var(--wrap);
  margin: 0 auto;
  padding: clamp(3.5rem, 10vw, 6.5rem) clamp(1rem, 4vw, 2rem) clamp(2rem, 5vw, 3.5rem);
}
/* 고정하지 않는다. 정체만 알리고 스크롤과 함께 사라진다.
 * 선택자를 .hero .wordmark 로 두는 이유: 아래 .hero p 가 (0,1,1)이라
 * .wordmark (0,1,0) 만으로는 색·크기를 뺏긴다. */
.hero .wordmark {
  margin: 0 0 1.5rem;
  max-width: none;
  font-size: .95rem; font-weight: 800;
  letter-spacing: .18em; text-indent: .18em;
  color: var(--ac);
}
.hero h1 {
  font-size: clamp(2rem, 6vw, 3.4rem);
  font-weight: 800;
  max-width: 20ch;
}
.hero h1 em { font-style: normal; color: var(--ac); }
.hero p {
  margin: 1.4rem 0 0;
  max-width: 46ch;
  font-size: clamp(1rem, 2.2vw, 1.12rem);
  color: var(--tx-mid);
  line-height: 1.75;
}
.hero__note {
  margin-top: 1.6rem;
  display: inline-flex; align-items: center; gap: .5rem;
  padding: .45rem .8rem;
  background: var(--ac-soft);
  border: 1px solid var(--ac-line);
  border-radius: 999px;
  font-size: .82rem;
  color: var(--ac);
}

/* ── 단계 ──────────────────────────────────────────── */
main { max-width: var(--wrap); margin: 0 auto; padding: 0 clamp(1rem, 4vw, 2rem) 5rem; }

.step { padding: clamp(2rem, 5vw, 3.2rem) 0; border-top: 1px solid var(--line); }
.step__no {
  display: inline-block;
  font-size: .72rem; font-weight: 700; letter-spacing: .14em;
  color: var(--ac);
  margin-bottom: .55rem;
}
.step h2 { font-size: clamp(1.3rem, 3vw, 1.6rem); font-weight: 800; }
.step__lede { margin: .6rem 0 0; color: var(--tx-mid); font-size: .95rem; max-width: 56ch; }
.step__body { margin-top: 1.8rem; }

/* ── 시작 방식 카드 ────────────────────────────────── */
.modes {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(215px, 1fr));
  gap: .75rem;
  list-style: none; margin: 1.8rem 0 0; padding: 0;
}
.mode {
  width: 100%; height: 100%;
  display: flex; flex-direction: column; gap: .35rem;
  padding: 1.15rem 1.1rem 1.25rem;
  background: var(--bg-sunk);
  border: 1px solid var(--line);
  border-radius: var(--r);
  text-align: left; cursor: pointer;
  color: inherit;
  transition: border-color .16s, background .16s, transform .16s;
}
.mode:hover { border-color: var(--ac-line); background: var(--bg-soft); transform: translateY(-1px); }
.mode__name { font-size: 1.02rem; font-weight: 700; }
.mode__desc { font-size: .85rem; color: var(--tx-faint); line-height: 1.6; }
.mode.is-on {
  border-color: var(--ac);
  background: var(--ac-soft);
  box-shadow: inset 0 0 0 1px var(--ac);
}
.mode.is-on .mode__name { color: var(--ac); }

/* ── 입력 ──────────────────────────────────────────── */
.field { position: relative; }
.field__label {
  display: block; font-size: .8rem; font-weight: 600;
  color: var(--tx-mid); margin-bottom: .45rem;
}
.field__input, .field__area {
  width: 100%;
  padding: .7rem .85rem;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: var(--r-s);
  font-size: .97rem; color: var(--tx);
  transition: border-color .15s, box-shadow .15s;
}
.field__area { line-height: 1.8; resize: vertical; min-height: 9rem; }
.field__input:focus, .field__area:focus {
  outline: 0; border-color: var(--ac);
  box-shadow: 0 0 0 3px var(--ac-soft);
}
::placeholder { color: var(--tx-faint); }

.suggest {
  list-style: none; margin: .4rem 0 0; padding: .25rem;
  border: 1px solid var(--line); border-radius: var(--r-s);
  background: var(--bg); box-shadow: var(--shadow);
  max-height: 20rem; overflow-y: auto;
}
.suggest:empty { display: none; }
.suggest button {
  display: flex; align-items: center; gap: .6rem; width: 100%;
  padding: .5rem .55rem; background: none; border: 0; border-radius: var(--r-s);
  text-align: left; cursor: pointer; color: inherit; font-size: .92rem;
}
.suggest button:hover { background: var(--bg-soft); }
.suggest .t { font-weight: 600; }
.suggest .by { color: var(--tx-faint); font-size: .84rem; }
.suggest .tail { margin-left: auto; font-size: .74rem; color: var(--tx-faint); white-space: nowrap; }
.suggest .miss { color: var(--warn); }

.hint { font-size: .85rem; color: var(--tx-faint); margin: .7rem 0 0; }

.linkbtn {
  background: none; border: 0; padding: 0;
  font: inherit; color: var(--ac); cursor: pointer;
  text-decoration: underline; text-underline-offset: 3px;
}
.linkbtn:hover { opacity: .75; }

/* 고른 것 */
.picked { list-style: none; margin: 1.1rem 0 0; padding: 0; display: flex; flex-wrap: wrap; gap: .5rem; }
.picked li {
  display: inline-flex; align-items: center; gap: .5rem;
  padding: .38rem .5rem .38rem .7rem;
  background: var(--bg-soft); border: 1px solid var(--line);
  border-radius: 999px; font-size: .88rem;
}
.picked .by { color: var(--tx-faint); font-size: .8rem; }
.picked .x {
  width: 1.15rem; height: 1.15rem; display: grid; place-items: center;
  background: none; border: 0; border-radius: 999px; cursor: pointer;
  color: var(--tx-faint); font-size: 1rem; line-height: 1; padding: 0;
}
.picked .x:hover { background: var(--line); color: var(--tx); }

/* 덮은 책 */
.drops { list-style: none; margin: 1.1rem 0 0; padding: 0; display: grid; gap: .55rem; }
.drop {
  display: flex; flex-wrap: wrap; align-items: center; gap: .5rem;
  padding: .7rem .85rem;
  background: var(--warn-soft); border: 1px solid color-mix(in srgb, var(--warn) 22%, transparent);
  border-radius: var(--r-s);
}
.drop__t { font-weight: 600; font-size: .92rem; }
.drop__by { color: var(--tx-faint); font-size: .82rem; }
.drop__ctl { margin-left: auto; display: flex; gap: .4rem; flex-wrap: wrap; }
.drop select {
  padding: .3rem .5rem; font-size: .84rem;
  background: var(--bg); color: var(--tx);
  border: 1px solid var(--line); border-radius: var(--r-s);
}

.caveat {
  margin: 1.4rem 0 0; padding: .85rem 1rem;
  background: var(--bg-sunk); border: 1px solid var(--line);
  border-radius: var(--r-s);
  font-size: .86rem; line-height: 1.75; color: var(--tx-mid);
}
.caveat b { color: var(--tx); }

/* ── 문단 계측 ─────────────────────────────────────── */
.metrics { margin-top: 1.2rem; display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: .5rem; }
.metric {
  padding: .65rem .8rem; background: var(--bg-sunk);
  border: 1px solid var(--line); border-radius: var(--r-s);
}
.metric__k { font-size: .76rem; color: var(--tx-faint); }
.metric__v { font-size: 1.15rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.metric__v small { font-size: .72rem; font-weight: 500; color: var(--tx-faint); margin-left: .15rem; }
.warns { margin: .9rem 0 0; padding: 0; list-style: none; font-size: .85rem; color: var(--warn); }
.warns li { margin-top: .3rem; }

/* ── 다이얼 ────────────────────────────────────────── */
.dials { display: grid; gap: .1rem; }
.dial { padding: .55rem 0; }
.dial__top { display: flex; justify-content: space-between; align-items: baseline; font-size: .84rem; }
.dial__name { font-weight: 700; }
.dial__ends { display: flex; justify-content: space-between; font-size: .74rem; color: var(--tx-faint); margin-top: .1rem; }
.dial.is-off .dial__name { color: var(--tx-faint); }
.dial__off { font-size: .7rem; color: var(--tx-faint); }

input[type=range] {
  -webkit-appearance: none; appearance: none;
  width: 100%; height: 1.5rem; background: none; cursor: pointer; margin: 0;
}
input[type=range]::-webkit-slider-runnable-track {
  height: 4px; border-radius: 999px; background: var(--line);
}
input[type=range]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 16px; height: 16px; margin-top: -6px;
  background: var(--bg); border: 2px solid var(--ac);
  border-radius: 999px; box-shadow: var(--shadow);
}
input[type=range]::-moz-range-track { height: 4px; border-radius: 999px; background: var(--line); }
input[type=range]::-moz-range-thumb {
  width: 14px; height: 14px; background: var(--bg);
  border: 2px solid var(--ac); border-radius: 999px;
}

/* ── 조건 ──────────────────────────────────────────── */
.cond { display: grid; gap: 1.3rem; }
.cond__row { display: grid; grid-template-columns: 7rem 1fr; gap: .5rem 1.2rem; align-items: start; }
.cond__label { font-size: .85rem; font-weight: 600; color: var(--tx-mid); padding-top: .3rem; }
.cond__ctl { display: flex; align-items: center; gap: 1rem; }
.cond__ctl input[type=range] { max-width: 18rem; }
.cond__ctl output { font-size: .86rem; color: var(--tx-mid); }

.chips { display: flex; flex-wrap: wrap; gap: .4rem; }
.chip { cursor: pointer; }
.chip input { position: absolute; opacity: 0; pointer-events: none; }
.chip span {
  display: inline-block; padding: .35rem .75rem;
  border: 1px solid var(--line); border-radius: 999px;
  font-size: .86rem; color: var(--tx-faint);
  background: var(--bg); transition: .14s;
}
.chip span:hover { border-color: var(--tx-faint); }
.chip input:checked + span {
  border-color: var(--ac); color: var(--ac);
  background: var(--ac-soft); font-weight: 600;
}
.chip input:focus-visible + span { outline: 2px solid var(--ac); outline-offset: 2px; }

/* ── 버튼 ──────────────────────────────────────────── */
.actions { margin-top: 2rem; display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; }
.btn {
  padding: .68rem 1.3rem;
  border: 1px solid var(--line); border-radius: var(--r-s);
  background: var(--bg); color: var(--tx);
  font-size: .95rem; font-weight: 600; cursor: pointer;
  transition: .14s;
}
.btn:hover { border-color: var(--tx-faint); }
.btn--go {
  background: var(--ac); border-color: var(--ac); color: #fff;
  padding-inline: 1.7rem;
}
@media (prefers-color-scheme: dark) { .btn--go { color: #0f1113; } }
.btn--go:hover { filter: brightness(1.08); }
.btn[disabled] { opacity: .4; cursor: not-allowed; }

/* ── 결과 ──────────────────────────────────────────── */
.result__lede { margin: .7rem 0 0; color: var(--tx-mid); font-size: .93rem; }
.rules { margin: 1rem 0 0; padding: 0; list-style: none; display: grid; gap: .4rem; }
.rules li {
  padding: .55rem .8rem; font-size: .87rem; color: var(--tx-mid);
  background: var(--warn-soft);
  border-left: 3px solid var(--warn); border-radius: 0 var(--r-s) var(--r-s) 0;
}

.grid {
  list-style: none; margin: 1.8rem 0 0; padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(158px, 1fr));
  gap: 1.6rem 1.1rem;
}

.card { display: flex; flex-direction: column; gap: .55rem; cursor: pointer; }
.card__coverwrap { position: relative; }
.card__cover {
  position: relative;
  aspect-ratio: 2 / 3;
  border-radius: var(--r-s);
  overflow: hidden;
  background: var(--bg-soft);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  transition: transform .18s, box-shadow .18s;
  display: grid;
}
.card:hover .card__cover { transform: translateY(-3px); box-shadow: var(--shadow-up); }
.card__cover img { width: 100%; height: 100%; object-fit: cover; display: block; }

/* 표지를 못 받아왔을 때 — 빈칸 대신 조판으로 채운다 */
.card__fallback {
  padding: .9rem .8rem 2.5rem;   /* 아래쪽은 순번 배지 자리 */
  display: flex; flex-direction: column; justify-content: space-between; gap: .6rem;
  color: #fff;
}
.card__fallback .ft {
  font-size: .95rem; font-weight: 700; line-height: 1.35;
  display: -webkit-box; -webkit-line-clamp: 5; -webkit-box-orient: vertical; overflow: hidden;
}
.card__fallback .fa { font-size: .76rem; opacity: .78; align-self: flex-end; }
/* 표지 대부분은 위쪽에 제목이 있다. 순번은 아래로 내려야 가리지 않는다. */
.card__rank {
  position: absolute; bottom: .45rem; left: .45rem;
  min-width: 1.45rem; height: 1.45rem; padding: 0 .35rem;
  display: grid; place-items: center;
  background: rgba(12,14,16,.72); color: #fff;
  border-radius: var(--r-s);
  font-size: .74rem; font-weight: 700; font-variant-numeric: tabular-nums;
  backdrop-filter: blur(4px);
}
.card__flag {
  position: absolute; top: .45rem; right: .45rem;
  padding: .12rem .4rem;
  background: var(--warn); color: #fff;
  border-radius: var(--r-s); font-size: .68rem; font-weight: 700;
}
.card__t { font-size: .92rem; font-weight: 700; line-height: 1.4; }
.card__by { font-size: .8rem; color: var(--tx-faint); margin-top: -.35rem; }
.card__spark {
  display: flex; gap: 2px; align-items: flex-end;
  height: 18px; margin-top: .1rem;
  padding-bottom: 1px; border-bottom: 1px solid var(--line);
}
.card__spark i { flex: 1; background: var(--ac-line); border-radius: 1px 1px 0 0; min-height: 2px; }
.card__risk { font-size: .74rem; color: var(--warn); font-weight: 600; }

/* 상세 */
.detail {
  grid-column: 1 / -1;
  background: var(--bg-sunk);
  border: 1px solid var(--line);
  border-radius: var(--r);
  padding: clamp(1.1rem, 3vw, 1.8rem);
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr);
  gap: clamp(1.2rem, 3vw, 2.2rem);
}
.detail__close {
  position: absolute; top: .7rem; right: .8rem;
  width: 1.8rem; height: 1.8rem; display: grid; place-items: center;
  background: var(--bg); border: 1px solid var(--line); border-radius: 999px;
  cursor: pointer; color: var(--tx-mid); font-size: 1rem; line-height: 1;
}
.detail__wrap { position: relative; grid-column: 1 / -1; }
.detail h3 { font-size: 1.25rem; font-weight: 800; }
.detail__by { color: var(--tx-mid); font-size: .9rem; margin-top: .15rem; }
.detail__meta { margin-top: .5rem; display: flex; flex-wrap: wrap; gap: .35rem; }
.tag {
  font-size: .74rem; padding: .18rem .5rem;
  background: var(--bg-soft); border: 1px solid var(--line);
  border-radius: 999px; color: var(--tx-faint);
}
.detail__why { margin: 1.1rem 0 0; font-size: .97rem; line-height: 1.8; }
.detail__but, .detail__risk {
  margin: .7rem 0 0; padding: .6rem .85rem;
  font-size: .89rem; line-height: 1.7; color: var(--tx-mid);
  border-radius: var(--r-s);
  background: var(--bg-soft);
  border-left: 3px solid var(--line);
}
.detail__risk { background: var(--warn-soft); border-left-color: var(--warn); color: var(--tx); }
.detail__memo {
  margin: 1rem 0 0; padding-top: 1rem; border-top: 1px solid var(--line);
  font-size: .9rem; line-height: 1.75; color: var(--tx-mid);
}
.detail__memo b {
  display: block; font-size: .72rem; letter-spacing: .1em;
  color: var(--tx-faint); margin-bottom: .3rem; font-weight: 700;
}
.detail__links { margin: 1.2rem 0 0; display: flex; flex-wrap: wrap; gap: .45rem; }
.detail__links a, .detail__links button {
  padding: .42rem .8rem; font-size: .85rem; font-weight: 600;
  border: 1px solid var(--line); border-radius: var(--r-s);
  background: var(--bg); color: var(--tx-mid);
  text-decoration: none; cursor: pointer;
}
.detail__links a:hover { border-color: var(--ac); color: var(--ac); }
.detail__links .no { color: var(--warn); }
.detail__links .no:hover { border-color: var(--warn); }

/* 눈금 비교 */
.cmp { display: grid; gap: .5rem; align-content: start; padding-top: 1.6rem; }
.cmp__head {
  display: flex; justify-content: space-between; align-items: baseline;
  flex-wrap: wrap; gap: .3rem .8rem;
  font-size: .78rem; color: var(--tx-faint);
  margin-bottom: .3rem;
}
.cmp__legend { display: flex; gap: .9rem; white-space: nowrap; }
.cmp__legend i { display: inline-block; width: 9px; height: 9px; border-radius: 2px; margin-right: .3rem; }
.cmp__legend i.you { border: 1.5px solid var(--tx-faint); }
.cmp__legend i.bk { background: var(--ac); }
.cmp__row { display: grid; grid-template-columns: 2.6rem 1fr; gap: .6rem; align-items: center; font-size: .78rem; }
.cmp__name { color: var(--tx-mid); font-weight: 600; }
.cmp__track { position: relative; height: 18px; }
.cmp__track::before {
  content: ''; position: absolute; inset: 50% 0 auto; height: 4px;
  margin-top: -2px; border-radius: 999px; background: var(--line-soft);
}
.cmp__fill {
  position: absolute; top: 50%; height: 4px; margin-top: -2px;
  background: var(--ac-line); border-radius: 999px;
}
.cmp__mark { position: absolute; top: 50%; width: 10px; height: 10px; margin: -5px 0 0 -5px; border-radius: 2px; }
.cmp__mark--you { border: 1.5px solid var(--tx-faint); background: var(--bg); }
.cmp__mark--bk { background: var(--ac); }
.cmp__ends { display: flex; justify-content: space-between; font-size: .7rem; color: var(--tx-faint); }

.empty {
  grid-column: 1 / -1; padding: 2.5rem 1rem; text-align: center;
  color: var(--tx-mid); font-size: .95rem;
  background: var(--bg-sunk); border: 1px dashed var(--line); border-radius: var(--r);
}

/* ── 미세조정 ──────────────────────────────────────── */
.tuner { margin-top: 3rem; padding: clamp(1.2rem,3vw,1.8rem); background: var(--bg-sunk); border: 1px solid var(--line); border-radius: var(--r); }
.tuner h3 { font-size: 1.05rem; font-weight: 800; }
.tuner__lede { margin: .4rem 0 0; font-size: .87rem; color: var(--tx-faint); }
.tuner__note { margin: .5rem 0 0; font-size: .85rem; color: var(--warn); }
.tuner__note:empty { display: none; }
.tuner .dials { margin-top: 1.2rem; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: .3rem 1.6rem; }

/* ── 처음부터 다시 ─────────────────────────────────── */
.restart {
  margin: 2.5rem 0 0; padding-top: 2rem;
  border-top: 1px solid var(--line);
  display: flex; align-items: center; gap: 1rem; flex-wrap: wrap;
}
.restart__note { font-size: .85rem; color: var(--tx-faint); }

/* ── 각주 ──────────────────────────────────────────── */
.colophon { border-top: 1px solid var(--line); background: var(--bg-sunk); }
.colophon__in { max-width: var(--wrap); margin: 0 auto; padding: 2.6rem clamp(1rem,4vw,2rem) 3.5rem; }
.notes { list-style: none; margin: 0; padding: 0; display: grid; gap: .8rem; max-width: 62ch; }
.notes li { font-size: .84rem; line-height: 1.75; color: var(--tx-faint); }
.notes b { color: var(--tx-mid); }
.imprint { margin: 2rem 0 0; font-size: .78rem; color: var(--tx-faint); }

/* ── 좁은 화면 ─────────────────────────────────────── */
@media (max-width: 760px) {
  .grid { grid-template-columns: repeat(auto-fill, minmax(132px, 1fr)); gap: 1.3rem .8rem; }
  .detail { grid-template-columns: 1fr; }
  .cond__row { grid-template-columns: 1fr; }
  .cond__ctl input[type=range] { max-width: none; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  * { transition: none !important; }
}
