:root {
  --mint:        #1DBFB0;
  --mint-dark:   #129E91;
  --mint-mid:    #D4F2EE;
  --mint-light:  #F0FAF9;
  --navy:        #1C1F33;
  --gray-bg:     #F7F8FA;
  --gray-border: #EEF0F3;
  --gray-text:   #6B7280;
  --white:       #FFFFFF;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; }

body {
  font-family: 'Apple SD Gothic Neo', 'Noto Sans KR', 'Malgun Gothic', sans-serif;
  background: var(--gray-bg);
  color: var(--navy);
}

a { text-decoration: none; color: inherit; }

/* ══ NAV ══ */
.site-nav {
  background: var(--white);
  border-bottom: 1px solid var(--gray-border);
  position: sticky;
  top: 0;
  z-index: 100;
}
.nav-inner {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 24px;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.nav-logo { font-size: 17px; font-weight: 900; color: var(--navy); white-space: nowrap; }
.nav-logo span { color: var(--mint); }
.nav-links { display: flex; gap: 2px; }
.nav-links a {
  font-size: 13px; font-weight: 600; color: var(--gray-text);
  padding: 6px 11px; border-radius: 20px; transition: all 0.18s; white-space: nowrap;
}
.nav-links a:hover { color: var(--navy); background: var(--gray-bg); }
.nav-links a.nav-active { color: var(--mint-dark); background: var(--mint-light); }
.nav-links .nav-disabled {
  font-size: 13px; font-weight: 600; color: var(--gray-text);
  padding: 6px 11px; border-radius: 20px; opacity: 0.4; cursor: default; white-space: nowrap;
}
.nav-hamburger {
  display: none; flex-direction: column; justify-content: center; gap: 5px;
  background: none; border: none; cursor: pointer; padding: 6px; width: 36px; height: 36px;
}
.nav-hamburger span {
  display: block; width: 22px; height: 2px;
  background: var(--navy); border-radius: 2px; transition: all 0.22s;
}
.nav-hamburger.open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.nav-hamburger.open span:nth-child(2) { opacity: 0; }
.nav-hamburger.open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }
.nav-mobile-menu {
  display: none; flex-direction: column; background: var(--white);
  border-top: 1px solid var(--gray-border); padding: 8px 16px 12px;
}
.nav-mobile-menu.open { display: flex; }
.nav-mobile-menu a {
  font-size: 15px; font-weight: 600; color: var(--gray-text);
  padding: 12px 8px; border-bottom: 1px solid var(--gray-border); transition: color 0.18s;
}
.nav-mobile-menu a:last-child { border-bottom: none; }
.nav-mobile-menu a:hover { color: var(--navy); }
.nav-mobile-menu a.nav-active { color: var(--mint-dark); }
.nav-mobile-menu .nav-disabled {
  font-size: 15px; font-weight: 600; color: var(--gray-text);
  padding: 12px 8px; border-bottom: 1px solid var(--gray-border); opacity: 0.4; cursor: default;
}
@media (max-width: 640px) { .nav-links { display: none; } .nav-hamburger { display: flex; } }

/* ══ PAGE TITLE ══ */
.page-title-area {
  background: var(--mint-light); text-align: center;
  padding: 53px 24px 62px; position: relative; overflow: hidden;
}
.page-title-area::before {
  content: ''; position: absolute; inset: 0;
  background-image: radial-gradient(circle, var(--mint-mid) 1.5px, transparent 1.5px);
  background-size: 28px 28px; opacity: 0.55; pointer-events: none;
}
.page-title-decos { position: absolute; inset: 0; pointer-events: none; }
.deco {
  position: absolute; font-weight: 900; opacity: 0.13;
  color: var(--mint-dark); user-select: none; line-height: 1;
}
.page-title-inner { position: relative; z-index: 1; }
.page-title-area h1 {
  font-size: 32px; font-weight: 900; color: var(--navy);
  letter-spacing: -0.8px; margin-bottom: 10px;
}
.page-title-area h1 .em { color: var(--mint); }
.page-title-area p { font-size: 15px; color: var(--gray-text); line-height: 1.6; }
.title-fade { height: 16px; background: linear-gradient(to bottom, var(--mint-light) 0%, var(--gray-bg) 100%); }

/* ══ MAIN WRAPPER ══ */
.answer-content { max-width: 860px; margin: 0 auto; padding: 12px 24px 60px; min-height: calc(100vh - 60px); }

/* ══ SEARCH ══ */
.search-section {
  background: var(--white); border: 1px solid var(--gray-border);
  border-radius: 16px; padding: 28px 28px 24px;
  margin-bottom: 32px; box-shadow: 0 1px 6px rgba(0,0,0,0.04);
}
.search-title { font-size: 15px; font-weight: 800; color: var(--navy); margin-bottom: 14px; }
.search-row { display: flex; gap: 10px; }
.search-input {
  flex: 1; height: 46px; border: 1.5px solid var(--gray-border);
  border-radius: 10px; padding: 0 16px; font-size: 14px; font-family: inherit;
  color: var(--navy); background: var(--gray-bg); outline: none; transition: border-color 0.18s;
}
.search-input:focus { border-color: var(--mint); background: var(--white); }
.search-input::placeholder { color: var(--gray-text); }
.search-btn {
  height: 46px; padding: 0 22px; background: var(--mint); color: white;
  font-size: 14px; font-weight: 700; font-family: inherit;
  border: none; border-radius: 10px; cursor: pointer; white-space: nowrap; transition: background 0.18s;
}
.search-btn:hover { background: var(--mint-dark); }
.qr-hint { margin-top: 12px; font-size: 12px; color: var(--gray-text); line-height: 1.6; word-break: keep-all; }
.qr-hint a { color: var(--mint-dark); font-weight: 600; }
.qr-hint strong { color: var(--mint-dark); font-weight: 700; }

/* ══ VIEW 1: 시리즈 카드 그리드 ══ */
.section-label {
  font-size: 12px; font-weight: 700; color: var(--gray-text);
  letter-spacing: 0.5px; margin-bottom: 14px; margin-top: 12px;
  text-transform: uppercase; padding-top: 20px; border-top: 1.5px solid var(--gray-border);
}
.view1-intro {
  text-align: center; padding: 8px 0 28px;
}
.view1-intro h2 {
  font-size: 22px; font-weight: 900; color: var(--navy);
  letter-spacing: -0.5px; margin-bottom: 8px;
}
.view1-intro h2 .em { color: var(--mint); }
.view1-intro p {
  font-size: 14px; color: var(--gray-text); line-height: 1.65; word-break: keep-all;
}

.series-card-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}
.series-card {
  background: var(--white); border: 1px solid var(--gray-border);
  border-radius: 14px; overflow: hidden; cursor: pointer;
  transition: transform 0.2s, box-shadow 0.2s;
  box-shadow: 0 1px 6px rgba(0,0,0,0.04);
}
.series-card:hover { transform: translateY(-3px); box-shadow: 0 6px 20px rgba(0,0,0,0.12); }
.series-card-cover {
  padding: 20px; background: var(--gray-bg);
  display: flex; align-items: center; justify-content: center; min-height: 190px;
}
.series-card-cover img { max-width: 100%; max-height: 160px; object-fit: contain; }
/* 표지가 아직 등록되지 않은 교재의 대체 블록.
   빈자리를 메우는 역할이므로 채도를 낮게 유지한다 (ver4) */
.series-cover-ph {
  width: 100%; min-height: 150px; border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 16px; font-weight: 900; color: var(--navy);
  background: var(--mint-mid);
  text-align: center; line-height: 1.4; padding: 16px;
}
.series-card-footer { padding: 14px 16px; border-top: 1px solid var(--gray-border); }
.series-card-name { font-size: 14px; font-weight: 800; color: var(--navy); margin-bottom: 3px; word-break: keep-all; }
.series-card-sub { font-size: 12px; color: var(--gray-text); }

/* ══ VIEW 2: 상세 ══ */
.back-bar { margin-bottom: 20px; }
.back-btn {
  background: none; border: none; cursor: pointer;
  font-size: 14px; font-weight: 700; color: var(--gray-text);
  font-family: inherit; padding: 8px 0; transition: color 0.15s;
  display: inline-flex; align-items: center; gap: 4px;
}
.back-btn:hover { color: var(--navy); }

.detail-header {
  display: flex; align-items: center; gap: 20px;
  background: white; border: 1px solid var(--gray-border);
  border-radius: 14px; padding: 20px 24px; margin-bottom: 16px;
  box-shadow: 0 1px 6px rgba(0,0,0,0.04);
}
.detail-cover-img { width: 68px; height: 88px; object-fit: contain; border-radius: 4px; flex-shrink: 0; }
.detail-cover-ph {
  width: 68px; height: 88px; border-radius: 8px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 900; color: white;
  text-align: center; line-height: 1.35; padding: 8px;
}
.detail-info h2 { font-size: 21px; font-weight: 900; color: var(--navy); margin-bottom: 5px; }
.detail-info p { font-size: 13px; color: var(--gray-text); }

/* 권 선택 */
.sub-card {
  background: white; border: 1px solid var(--gray-border);
  border-radius: 14px; padding: 18px 20px 20px;
  margin-bottom: 16px; box-shadow: 0 1px 6px rgba(0,0,0,0.04);
}
.sub-label { font-size: 13px; font-weight: 700; color: var(--navy); margin-bottom: 12px; }
.vol-pills { display: flex; flex-wrap: wrap; gap: 8px; }
.vol-pill {
  padding: 8px 18px; border-radius: 10px; border: 1.5px solid var(--gray-border);
  background: white; font-size: 14px; font-weight: 700;
  font-family: inherit; cursor: pointer; color: var(--gray-text); transition: all 0.15s;
}
.vol-pill:hover:not(.v-active) { border-color: var(--sc, var(--mint)); color: var(--sc, var(--mint)); }
.vol-pill.v-active { background: var(--sc, var(--mint)); border-color: var(--sc, var(--mint)); color: white; }

/* 단계 그리드 */
.stage-grid {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 12px;
}
/* ver4: 수십 개가 반복되는 자리라 기본 상태는 무채색으로 두고 민트는 상호작용할 때만.
   민트 위에 흰 글자는 대비가 2.3:1까지 떨어져 hover에서도 글자색은 navy를 유지한다 */
.day-btn {
  border-radius: 14px; padding: 16px 8px;
  font-size: 14px; font-weight: 700; font-family: inherit;
  cursor: pointer; text-align: center; line-height: 1.4; word-break: keep-all;
  border: 1px solid var(--gray-border);
  background: var(--white);
  color: var(--navy);
  transition: all 0.15s;
}
.day-btn:hover { background: var(--mint); border-color: var(--mint); }

/* ver4: 페이지 번호 검색이 이 화면의 주 동선이라 카드로 띄워 시선이 먼저 닿게 한다 */
.page-search-card {
  background: var(--white); border: 2px solid var(--mint);
  border-radius: 16px; padding: 22px 22px 24px;
  margin-bottom: 28px; box-shadow: 0 4px 16px rgba(0,0,0,0.07);
}
.page-search-label {
  font-size: 18px; font-weight: 900; color: var(--navy);
  letter-spacing: -0.3px; margin-bottom: 5px;
}
.page-search-desc {
  font-size: 13px; color: var(--gray-text); line-height: 1.6;
  margin-bottom: 14px; word-break: keep-all;
}
.page-search-card .search-input { width: 100%; height: 58px; font-size: 16px; }
.page-search-card .search-input:focus {
  border-color: var(--mint); box-shadow: 0 0 0 3px var(--mint-mid);
}

/* 목록은 검색이 안 통할 때의 보조 수단이라 라벨로 한 단계 낮춘다 */
.grid-alt-label { font-size: 13px; font-weight: 700; color: var(--gray-text); margin-bottom: 12px; }

.search-empty { grid-column: 1 / -1; text-align: center; padding: 60px 24px; color: var(--gray-text); font-size: 15px; }

/* ══ FOOTER ══ */
footer { background: var(--navy); color: white; padding: 32px 24px; text-align: center; }
.footer-links { display: flex; justify-content: center; flex-wrap: wrap; gap: 8px 4px; margin-bottom: 16px; }
.footer-links a { font-size: 14px; color: rgba(255,255,255,0.7); transition: color 0.18s; padding: 0 10px; }
.footer-links a:hover { color: white; }
.footer-links span { color: rgba(255,255,255,0.25); font-size: 14px; }
.footer-copy { font-size: 13px; color: rgba(255,255,255,0.4); }
@media (max-width: 640px) {
  .footer-links { display:grid; grid-template-columns:1fr 1fr; grid-template-rows:auto auto; grid-auto-flow:column; gap:14px 8px; }
  .footer-links span { display:none; }
  .footer-links a { padding:0; }
}

.mobile-only { display: none; }

/* ══ RESPONSIVE ══ */
@media (max-width: 640px) {
  .mobile-only { display: inline; }
  .page-title-area h1 { font-size: 26px; }
  .search-section { padding: 20px 16px 18px; }
  .search-row { flex-direction: column; }
  .search-input { font-size: 16px; width: 100%; }
  .search-btn { width: 100%; font-size: 16px; }
  .series-card-grid { grid-template-columns: repeat(2, 1fr); gap: 12px; }
  .stage-grid { grid-template-columns: repeat(2, 1fr); }
  /* 3열이면 표지가 87px까지 줄어 손에 든 책과 대조가 안 된다 */
  .vol-card-grid { grid-template-columns: repeat(2, 1fr); gap: 12px; }
}

/* ══ 검색 탭 ══ */
.search-tabs {
  display: flex;
  border-bottom: 2px solid #f0f0f0;
  margin-bottom: 20px;
}
.search-tab {
  flex: 1; padding: 10px 8px;
  background: none; border: none;
  border-bottom: 2px solid transparent; margin-bottom: -2px;
  font-family: inherit; font-size: 14px; font-weight: 700;
  color: var(--gray-text); cursor: pointer; transition: all 0.15s;
}
.search-tab.tab-active { color: var(--mint-dark); border-bottom-color: var(--mint); }
.search-tab:hover:not(.tab-active) { color: var(--navy); }
.qr-panel { text-align: center; padding: 16px 0 8px; }
.qr-panel-icon { font-size: 52px; line-height: 1; margin-bottom: 14px; }
.qr-panel-desc { font-size: 14px; color: var(--gray-text); line-height: 1.7; margin-bottom: 20px; }
.qr-scan-btn {
  display: inline-block; padding: 13px 36px;
  background: var(--mint); color: white; border-radius: 10px;
  font-size: 15px; font-weight: 800; cursor: pointer; transition: background 0.15s;
}
.qr-scan-btn:hover { background: var(--mint-dark); }
/* 스캔 진행·실패 안내 (성공하면 바로 화면이 넘어가므로 비운다) */
.qr-message { margin-top: 14px; font-size: 13px; line-height: 1.6; color: var(--gray-text); }
.qr-message.qr-message-error { color: var(--coral-dark); font-weight: 600; }

/* ══ VOL SELECTION (VIEW 2) ══ */
/* ver4: 헤더의 대표 표지를 없애고, 선택지 자체를 그 권의 표지로 둔다.
   손에 든 책과 화면을 그대로 대조할 수 있어야 하고, 1권 표지를 크게 띄우면
   다른 권을 산 사용자에게 잘못된 이정표가 된다. */
.vol-header { padding: 12px 0 22px; text-align: center; }
.vol-series-title {
  font-size: 22px; font-weight: 900; color: var(--navy);
  margin-bottom: 4px; word-break: keep-all;
}
.vol-series-sub { font-size: 13px; color: var(--gray-text); }

/* 표지를 알아볼 수 있는 크기가 이 화면의 목적이라 열 수를 늘리지 않는다 */
.vol-card-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
}
.vol-card {
  padding: 10px 10px 12px;
  border: 1px solid var(--gray-border);
  border-radius: 14px;
  background: var(--white);
  text-align: center;
  cursor: pointer;
  font-family: inherit;
  transition: all 0.15s;
}
.vol-card:hover {
  border-color: var(--mint);
  box-shadow: 0 6px 18px rgba(0,0,0,0.12);
  transform: translateY(-2px);
}
.vol-cover-img {
  width: 100%; aspect-ratio: 3 / 4; object-fit: contain;
  display: block; border-radius: 6px; margin-bottom: 8px;
}
/* 표지 미등록 권도 자리를 지켜서 "여기가 비었다"가 보이게 한다 */
.vol-cover-ph {
  width: 100%; aspect-ratio: 3 / 4;
  border-radius: 6px; margin-bottom: 8px;
  display: flex; align-items: center; justify-content: center;
  background: var(--gray-bg); border: 1px solid var(--gray-border);
  font-size: 11px; font-weight: 700; color: var(--gray-text);
  line-height: 1.4; padding: 6px; word-break: keep-all;
}
.vol-card-num {
  display: block;
  font-size: 14px; font-weight: 800;
  color: var(--navy);
}

/* ══ STAGE SELECTION (VIEW 3) ══ */
.stage-header { padding: 12px 0 20px; border-bottom: 1px solid var(--gray-border); margin-bottom: 20px; }
.stage-series-name { font-size: 22px; font-weight: 900; color: var(--navy); margin-bottom: 4px; }
.stage-vol-title { font-size: 15px; color: var(--gray-text); font-weight: 700; }
