/* 터치 화면 읽기 배치, 설정 창 기본, 화면 크기별(넓은 가로·아이패드 가로·폰).
   css/ 의 파일은 index.html 에서 번호 순서대로 겹쳐 적용된다(뒤 파일이 앞 파일을 덮는다). 순서를 바꾸지 말 것. */
/* A picture-book spread with a vertical sticker tray, sized for touch screens. */
#finish #finish-shelf,
#finish #finish-again {
  display: flex;
  align-items: center;
  justify-content: center;
  width: min(100%, 360px);
  min-height: 80px;
  margin: 0;
  padding: 18px 24px;
  border-radius: 24px;
  font: 26px/1.4 Jua;
  text-align: center;
  touch-action: manipulation;
}
#finish #finish-shelf:focus-visible,
#finish #finish-again:focus-visible {
  outline: 4px solid #caa15d;
  outline-offset: 5px;
}
#reader .waiting-for-story {
  opacity: 0.45;
  transition: opacity 0.2s;
}
#reader .waiting-for-story button {
  cursor: default;
}
#reader #intro-status {
  font-size: 16px;
  color: #718166;
  margin: 12px 0 4px;
}
#reader .item-rail #again {
  width: 100%;
  min-height: 56px;
  margin: 12px 0 0;
  padding: 12px 8px;
  border: 2px solid #c5d4b8;
  border-radius: 16px;
  background: #fffdf5;
  color: #365941;
  font: 19px/1.35 Jua;
  touch-action: manipulation;
}
#reader .item-rail #again:hover {
  background: #eaf1dd;
}
#reader .tray:has(#again:not([hidden])) .tray-copy {
  display: none;
}
#reader .item-rail #again:focus-visible {
  outline: 3px solid #315a42;
  outline-offset: 3px;
}
@media (max-width: 700px) {
  #reader .item-rail #again {
    font-size: 16px;
    min-height: 52px;
    padding: 10px 4px;
  }
}
#reader .scene-title {
  display: flex;
  align-items: center;
  gap: 12px;
}
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}
#reader .picture-nav {
  position: absolute;
  inset: 0;
  z-index: 4;
  pointer-events: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 10px;
}
#reader .page-arrow {
  pointer-events: auto;
  display: grid;
  place-items: center;
  flex: none;
  width: 52px;
  height: 64px;
  padding: 0;
  border: 1px solid #ffffffd9;
  border-radius: 22px;
  background: #fffaf1ed;
  color: #365941;
  box-shadow: 0 3px 12px #233c3526;
  touch-action: manipulation;
}
#reader .page-arrow:disabled {
  background: #fffaf1b3;
  color: #929d90;
  box-shadow: none;
  cursor: default;
}
#reader .page-arrow:enabled:hover {
  background: #fff;
  color: #244730;
}
#reader .page-arrow:focus-visible {
  outline: 3px solid #315a42;
  outline-offset: 3px;
}
@media (max-width: 700px) {
  #reader .picture-nav {
    padding: 0 4px;
  }
  #reader .page-arrow {
    width: 44px;
    height: 52px;
    border-radius: 16px;
    font-size: 38px;
  }
}
#reader-settings {
  width: min(400px, calc(100vw - 40px));
  padding: 24px;
  border: 1px solid #d9e1cf;
  border-radius: 24px;
  background: #fffaf1;
  color: #29483d;
  box-shadow: 0 16px 60px #243b3526;
}
#reader-settings::backdrop {
  background: #243b3570;
}
#reader-settings header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 22px;
}
#reader-settings h2 {
  margin: 0;
  font-size: 26px;
}
#reader-settings label {
  display: block;
  margin-bottom: 10px;
}
#reader-settings select {
  width: 100%;
  min-height: 52px;
  padding: 10px 46px 10px 14px;
  border: 1px solid #cad8bf;
  border-radius: 12px;
  font: inherit;
  color: #29483d;
  cursor: pointer;
  -webkit-appearance: none;
  appearance: none;
  background: #fff
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23365941' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E")
    no-repeat right 14px center/22px;
}
#reader-settings select:focus-visible {
  outline: 3px solid #664a9b;
  outline-offset: 3px;
}
#reader-settings button {
  min-height: 44px;
}
#reader-settings #voice-status {
  font-size: 14px;
  line-height: 1.5;
}
#reader-settings .settings-done {
  width: 100%;
  margin-top: 18px;
  justify-content: center;
  font:
    19px/1.2 Jua,
    sans-serif;
}
#reader {
  max-width: 1440px;
  padding: 0 clamp(16px, 2.4vw, 36px);
}
#reader .page-dots span {
  height: 6px;
}
#reader .reading-layout {
  max-width: none;
  gap: 18px;
}
#reader .picture-side {
  grid-template-columns: minmax(0, 1fr) clamp(140px, 16vw, 210px);
  gap: 20px;
}
#reader .board {
  border-radius: 24px;
}
#reader .item-rail {
  padding: 12px;
  border-radius: 24px;
}
#reader .choices {
  gap: 12px;
}
#reader .choice {
  padding: 10px 8px;
  border-radius: 20px;
  min-height: 112px;
}
#reader .choice img {
  height: clamp(76px, 10vw, 130px);
}
#reader .choice span {
  font-size: clamp(16px, 1.8vw, 22px);
  line-height: 1.3;
}
#reader #sticker-art > img {
  height: clamp(90px, 12vw, 150px);
}
#reader .item-rail .tray-copy p {
  font-size: 17px;
}
#reader .item-rail .step-tag {
  font-size: 18px;
}
#reader .story-copy {
  padding: 0;
}
#reader #chapter {
  display: none;
}
#reader .story-copy h2 {
  font-size: clamp(24px, 2.7vw, 34px);
  margin: 0;
}
#reader .story-copy #story-text {
  font-size: clamp(18px, 2vw, 23px);
  line-height: 1.65;
  margin: 6px 0 0;
}
/* The question stays readable without a second 'choose' panel. */
#reader .quiz {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px 12px;
  background: none;
  border: 0;
  border-radius: 0;
  padding: 0;
  margin: 10px 0 0;
}
#reader .quiz h3 {
  order: 0;
  flex: 0 1 auto;
  font: 19px/1.5 Jua;
  margin: 0 4px 0 0;
  color: #566c4e;
}
#reader .quiz-heading {
  display: contents;
}
#reader .quiz-heading > .step-tag {
  display: none;
}
#reader #hear-question {
  order: 1;
}
#reader #show-hint {
  order: 2;
}
#reader #quiz-feedback {
  order: 3;
  flex-basis: 100%;
  min-height: 0;
  margin: 0;
  font-size: 15px;
}
#reader #quiz-feedback:empty {
  display: none;
}
#reader .sound-button {
  min-height: 44px;
  padding: 8px 12px;
  font-size: 14px;
  border-radius: 12px;
}
#reader .narration {
  gap: 8px;
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid #e5e8dc;
}
#reader .narration > small {
  display: none;
}
#reader .narration label {
  font-size: 13px;
  margin-left: auto;
}
#reader .narration select {
  max-width: 210px;
  min-height: 44px;
  font-size: 14px;
}
#reader #voice-status {
  font-size: 12px;
  margin: 0;
}
#reader #voice-status:empty {
  display: none;
}
#reader .reader-nav {
  position: sticky;
  bottom: 0;
  z-index: 10;
  max-width: none;
  margin: 12px 0 0;
  padding: 10px 0 calc(10px + env(safe-area-inset-bottom));
  background: #fffaf1;
  border-top: 1px solid #e5e8dc;
  gap: 16px;
}
#reader .reader-nav button {
  min-height: 48px;
}
#reader .reader-nav .primary {
  min-width: 140px;
}
#reader .result-box {
  margin-top: 10px;
  padding: 12px 16px;
}
#reader .result-box p {
  font-size: 18px;
  line-height: 1.6;
}
/* 넓은 가로 화면(노트북·모니터): 그림판 양옆에 남는 자리만큼 스티커 칸과 스티커를 키운다. 아이패드 가로(1180px 안팎)는 그대로 */
@media (min-width: 1300px) and (orientation: landscape) {
  #reader .picture-side {
    grid-template-columns: minmax(0, 1fr) clamp(200px, 16vw, 260px);
  }
  #reader .choice img {
    height: clamp(110px, 9vw, 160px);
  }
  #reader .choice span {
    font-size: 19px;
  }
}
@media (min-width: 701px) and (orientation: landscape) and (max-height: 900px) {
  #reader .reading-layout {
    gap: 12px;
  }
  #reader .picture-side {
    grid-template-columns: minmax(0, 1fr) 150px;
    gap: 16px;
  }
  #reader .story-copy h2 {
    font-size: 23px;
  }
  #reader .story-copy #story-text {
    font-size: 18px;
    line-height: 1.5;
  }
  #reader .narration {
    margin-top: 8px;
    padding-top: 8px;
  }
  #reader .choice img {
    height: 85px;
  }
  #reader .choice span {
    font-size: 17px;
  }
}
@media (min-width: 1300px) and (orientation: landscape) and (max-height: 900px) {
  #reader .picture-side {
    grid-template-columns: minmax(0, 1fr) clamp(200px, 16vw, 260px);
  }
  #reader .choice img {
    height: clamp(110px, 9vw, 160px);
  }
  #reader .choice span {
    font-size: 19px;
  }
}
@media (max-width: 700px) {
  #reader {
    padding: 0 14px;
  }
  #reader .picture-side {
    grid-template-columns: minmax(0, 1fr) 98px;
    gap: 8px;
  }
  #reader .board {
    border-radius: 16px;
  }
  #reader .item-rail {
    padding: 6px;
    border-radius: 16px;
  }
  #reader .item-rail .step-tag {
    font-size: 14px;
  }
  #reader .choice {
    padding: 5px;
    min-height: 90px;
    border-radius: 14px;
  }
  #reader .choice img {
    height: 55px;
  }
  #reader .choice span {
    font-size: 14px;
  }
  #reader #sticker-art > img {
    height: 75px;
  }
  #reader .item-rail .tray-copy p {
    font-size: 14px;
  }
  #reader .quiz h3 {
    flex-basis: 100%;
    font-size: 18px;
  }
  #reader .narration label {
    margin-left: 0;
  }
  #reader .narration select {
    max-width: 175px;
  }
  #reader .reader-nav {
    gap: 8px;
  }
  #reader .reader-nav .primary {
    min-width: 105px;
  }
  #reader #next-hint {
    font-size: 10px;
    max-width: 140px;
  }
}
