/* 아이콘, 위쪽 줄, 책장 진행 막대, 책 안 진행 줄·단추, 설정(자동 넘기기), 다시 읽기 확인 창.
   css/ 의 파일은 index.html 에서 번호 순서대로 겹쳐 적용된다(뒤 파일이 앞 파일을 덮는다). 순서를 바꾸지 말 것. */
/* ───── 아이콘 한 벌: 24px 격자, 둥근 선 (index.html 맨 위 icon-sprite) ───── */
.icon-sprite {
  position: absolute;
  width: 0;
  height: 0;
  overflow: hidden;
}
.icon {
  width: 1.15em;
  height: 1.15em;
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.2;
  stroke-linecap: round;
  stroke-linejoin: round;
  vertical-align: -0.2em;
}

/* ───── 위쪽 줄: 책장·책 안·다 읽은 화면 모두 같은 줄 하나. 왼쪽 앱 이름/책장, 가운데 책 제목, 오른쪽 설정 ───── */
#gnb {
  display: grid;
  grid-template-columns: 1fr minmax(0, auto) 1fr;
  align-items: center;
  gap: 12px;
  height: 76px;
  max-width: 1440px;
  padding: 0 clamp(16px, 2.4vw, 36px);
  border-bottom: 1px solid #e5e8dc;
}
#gnb .gnb-side {
  display: flex;
  align-items: center;
  min-width: 0;
}
#gnb .gnb-end {
  justify-content: flex-end;
}
#gnb .brand {
  gap: 10px;
  font-size: 24px;
  white-space: nowrap;
  color: #29483d;
}
#gnb .brand-icon {
  width: 30px;
  height: 30px;
  color: #63826a;
  stroke-width: 2;
}
#gnb .gnb-title {
  min-width: 0;
  text-align: center;
  font:
    clamp(22px, 2.5vw, 32px)/1.2 Jua,
    sans-serif;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: #29483d;
}
body:not(.reading-book) #shelf-button {
  display: none;
}
body:not(.reading-book) #gnb .gnb-title {
  visibility: hidden;
}
body.reading-book #gnb-brand {
  display: none;
}
.gnb-button,
.restart-button,
.plain-box {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 1px solid #dce3d3;
  background: #f2f5e9;
  color: #365941;
  font-family: Jua, sans-serif;
  white-space: nowrap;
  touch-action: manipulation;
}
.gnb-button {
  min-height: 52px;
  padding: 10px 18px;
  border-radius: 16px;
  font-size: 19px;
  line-height: 1.2;
}
.gnb-button .icon {
  width: 22px;
  height: 22px;
}
.gnb-button:hover,
.restart-button:hover,
.plain-box:hover {
  background: #e9efdd;
}
.gnb-button:focus-visible,
.restart-button:focus-visible,
.book-card:focus-visible {
  outline: 3px solid #664a9b;
  outline-offset: 3px;
}
#shelf {
  padding: 0 clamp(16px, 2.4vw, 36px);
}

/* ───── 책장: 카드 어디를 눌러도 이어 읽기, 표지 아래 진행 막대, 다 읽은 책은 별 ───── */
.books {
  padding-top: 28px;
}
.book-card {
  cursor: pointer;
  transition:
    transform 0.15s,
    box-shadow 0.15s;
}
.book-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 10px 24px #2b3f2f14;
}
.book-card h2 {
  margin: 16px 8px 2px;
  min-height: 0;
}
.cover-progress {
  position: absolute;
  z-index: 3;
  left: 0;
  right: 0;
  bottom: 0;
  height: 8px;
  background: #1f332952;
}
.cover-progress > span {
  display: block;
  height: 100%;
  background: #e8913a;
  border-radius: 0 4px 4px 0;
}

/* ───── 책 안: 진행 막대 줄(쪽 수·처음부터), 제목 옆 다시 듣기·멈추기 ───── */
#reader .reader-progress {
  display: flex;
  align-items: center;
  gap: 14px;
  margin: 14px 0 16px;
}
#reader .reader-progress .page-dots {
  flex: 1;
  margin: 0;
  gap: 8px;
}
#reader #page-count {
  font-size: 15px;
  color: #59684f;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
.restart-button {
  min-height: 44px;
  padding: 8px 14px;
  border-radius: 14px;
  font-size: 16px;
  line-height: 1.2;
  background: #fffdf5;
}
.restart-button .icon {
  width: 18px;
  height: 18px;
}
#reader .scene-title {
  flex-wrap: wrap;
}
.media-button {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  flex: none;
  height: 48px;
  padding: 0 16px;
  border: 1px solid #dce3d3;
  border-radius: 24px;
  background: #f2f5e9;
  color: #365941;
  font:
    17px/1 Jua,
    sans-serif;
  white-space: nowrap;
  touch-action: manipulation;
}
.media-button:hover:enabled {
  background: #e9efdd;
}
.media-button:focus-visible {
  outline: 3px solid #664a9b;
  outline-offset: 3px;
}
.media-button .icon {
  width: 22px;
  height: 22px;
}
#reader .page-arrow .icon {
  width: 32px;
  height: 32px;
  stroke-width: 2.6;
}
#reader .page-arrow.nudge {
  background: #365941;
  border-color: #365941;
  color: #fff;
  animation: nudge 1.1s ease-in-out infinite;
}
@keyframes nudge {
  50% {
    transform: translateX(5px);
  }
}
@keyframes call-out {
  50% {
    box-shadow: 0 0 0 8px #36594133;
  }
}
#target-symbol {
  display: grid !important;
  place-items: center;
}
#target-symbol .icon {
  width: 20px;
  height: 20px;
  stroke-width: 2.6;
}
.scene-status {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.scene-status .icon {
  width: 14px;
  height: 14px;
  stroke-width: 3;
}
.sound-button {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.sound-button .icon {
  width: 18px;
  height: 18px;
}
#reader .item-rail #again {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}
#reader .item-rail #again .icon {
  width: 20px;
  height: 20px;
}
#finish #finish-shelf,
#finish #finish-again {
  gap: 10px;
}
#finish #finish-shelf .icon,
#finish #finish-again .icon {
  width: 26px;
  height: 26px;
}

/* ───── 설정: 자동으로 다음 장 넘기기 ───── */
#reader-settings header .plain {
  display: grid;
  place-items: center;
  width: 44px;
  padding: 0;
  color: #365941;
}
#reader-settings header .plain .icon {
  width: 24px;
  height: 24px;
}
#reader-settings .setting-switch {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  margin: 20px 0 0;
  padding: 14px;
  border: 1px solid #dce3d3;
  border-radius: 16px;
  background: #fff;
  cursor: pointer;
}
#reader-settings .setting-switch input {
  appearance: none;
  -webkit-appearance: none;
  flex: none;
  position: relative;
  width: 54px;
  height: 32px;
  margin: 0;
  border-radius: 16px;
  background: #cfd8c6;
  cursor: pointer;
  transition: background 0.15s;
}
#reader-settings .setting-switch input::after {
  content: '';
  position: absolute;
  top: 3px;
  left: 3px;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px #0003;
  transition: transform 0.15s;
}
#reader-settings .setting-switch input:checked {
  background: #3e5c45;
}
#reader-settings .setting-switch input:checked::after {
  transform: translateX(22px);
}
#reader-settings .setting-switch input:focus-visible {
  outline: 3px solid #664a9b;
  outline-offset: 3px;
}
#reader-settings .setting-switch b {
  display: block;
  font:
    18px/1.3 Jua,
    sans-serif;
  font-weight: 400;
}
#reader-settings .setting-switch small {
  display: block;
  margin-top: 4px;
  font-size: 13px;
  line-height: 1.5;
  color: #59684f;
}

/* ───── 처음부터 다시 읽을지 묻는 창 ───── */
#restart-confirm {
  width: min(380px, calc(100vw - 40px));
  padding: 28px 24px 24px;
  border: 1px solid #d9e1cf;
  border-radius: 24px;
  background: #fffaf1;
  color: #29483d;
  box-shadow: 0 16px 60px #243b3526;
  text-align: center;
}
#restart-confirm::backdrop {
  background: #243b3570;
}
#restart-confirm h2 {
  font-size: 26px;
}
#restart-confirm p {
  margin: 10px 0 22px;
  color: #59684f;
}
#restart-confirm .confirm-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
#restart-confirm button {
  min-height: 56px;
  margin: 0;
  padding: 10px;
  justify-content: center;
  border-radius: 16px;
  font:
    19px/1.2 Jua,
    sans-serif;
}

@media (min-width: 701px) and (orientation: landscape) and (max-height: 900px) {
  #gnb {
    height: 64px;
  }
  .gnb-button {
    min-height: 48px;
    padding: 8px 16px;
  }
  #reader .reader-progress {
    margin: 10px 0 12px;
  }
}
@media (max-width: 700px) {
  #gnb {
    height: 62px;
    gap: 8px;
  }
  #gnb .brand {
    font-size: 20px;
  }
  #gnb .brand-icon {
    width: 26px;
    height: 26px;
  }
  .gnb-button {
    min-height: 46px;
    padding: 8px 12px;
    font-size: 17px;
  }
  #gnb .gnb-title {
    font-size: 20px;
  }
  #reader .reader-progress {
    gap: 8px;
    margin: 10px 0 12px;
  }
  .restart-button {
    min-height: 40px;
    padding: 6px 10px;
    font-size: 14px;
  }
}
@media (max-width: 500px) {
  .gnb-button > span {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
  }
  .gnb-button {
    padding: 8px 12px;
  }
  .books {
    padding-top: 18px;
  }
}
@media (prefers-reduced-motion: reduce) {
  #reader .page-arrow.nudge,
  #pause-voice.blocked {
    animation: none;
  }
  .book-card {
    transition: none;
  }
  .book-card:hover {
    transform: none;
  }
}
