/* ═══════════════════════════════════════
   styles/book.css — 책 메타포 UI 프레임
   모든 만다라트 단어에서 공유합니다.
   ═══════════════════════════════════════ */

:root {
  --paper: #f8f3e8;
  --paper-edge: #e8dfc8;
  --paper-shadow: #d4c9ad;
  --ink: #2a2018;
  --ink-light: #6b5d4a;
  --ink-faint: #a0927c;
  --accent: #7a5c1e;
  --accent-warm: #b8922e;
  --accent-glow: rgba(184, 146, 46, .12);
  --cover: #2c2218;
  --cover-light: #4a3c2a;
  --spine: #1e180f;
  --gold: #c4a44a;
  --gold-dim: #8a7432;
  --font-serif: 'Gowun Batang', 'Batang', '바탕', 'Georgia', serif;
  --font-sans: 'Noto Sans KR', 'Malgun Gothic', '맑은 고딕', sans-serif;
}

*,
*::before,
*::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box
}

html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility
}

body {
  background: #8a7e6e;
  background-image: url("data:image/svg+xml,%3Csvg width='60' height='60' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence baseFrequency='.65' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.04'/%3E%3C/svg%3E"), radial-gradient(ellipse at 40% 30%, #9e9282 0%, #7a7060 60%, #605848 100%);
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  font-family: var(--font-serif);
  color: var(--ink);
  overflow-x: hidden;
  overflow-y: auto;
  padding: 20px
}

#root {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center
}

.book-shell {
  position: relative;
  display: flex;
  width: 100%;
  max-width: 1100px;
  height: calc(100dvh - 60px);
  max-height: calc(100vh - 50px);
  min-height: 0;
  background: var(--cover);
  border-radius: 4px 10px 10px 4px;
  padding: 6px 6px 6px 0;
  box-shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 4px 12px rgba(0, 0, 0, .25), 0 16px 48px rgba(0, 0, 0, .35)
}

.book-aspect {
  aspect-ratio: 1.3 / 1;
}

@media (min-width: 768px) {
  .book-aspect {
    max-width: calc((100vh - 50px) * 1.3) !important;
    flex: none !important;
  }
}

.book-spine {
  width: 28px;
  min-width: 28px;
  background: linear-gradient(90deg, var(--spine), var(--cover-light) 40%, var(--cover) 70%, var(--cover-light));
  border-radius: 4px 0 0 4px;
  box-shadow: inset -2px 0 6px rgba(0, 0, 0, .4);
  position: relative
}

.book-spine::after {
  display: none
}

.book-pages {
  flex: 1;
  display: flex;
  background: var(--paper);
  border-radius: 0 6px 6px 0;
  overflow: hidden;
  position: relative;
  box-shadow: inset 2px 0 8px rgba(0, 0, 0, .06);
  min-height: 0
}

.book-pages::before {
  content: '';
  position: absolute;
  bottom: -3px;
  left: 8px;
  right: 4px;
  height: 3px;
  background: linear-gradient(90deg, var(--paper-edge), var(--paper-shadow), var(--paper-edge));
  border-radius: 0 0 2px 2px;
  z-index: -1
}

.book-pages::after {
  content: '';
  position: absolute;
  bottom: -5px;
  left: 12px;
  right: 8px;
  height: 2px;
  background: var(--paper-shadow);
  border-radius: 0 0 2px 2px;
  z-index: -2;
  opacity: .7
}

.book-gutter {
  position: absolute;
  top: 0 !important;
  bottom: 0 !important;
  left: 50%;
  width: 50px;
  transform: translateX(-50%);
  background: linear-gradient(90deg, transparent, rgba(30, 24, 15, .04) 15%, rgba(30, 24, 15, .09) 35%, rgba(30, 24, 15, .16) 50%, rgba(30, 24, 15, .09) 65%, rgba(30, 24, 15, .04) 85%, transparent);
  z-index: 2;
  pointer-events: none
}

.book-gutter::after {
  content: '';
  position: absolute;
  top: 0 !important;
  bottom: 0 !important;
  left: 50%;
  width: 1px;
  background: rgba(30, 24, 15, .1)
}

.book-edge-right {
  position: absolute;
  top: 4px;
  bottom: 4px;
  right: -3px;
  width: 3px;
  background: repeating-linear-gradient(180deg, var(--paper) 0px, var(--paper) 1px, var(--paper-edge) 1px, var(--paper-edge) 2px);
  border-radius: 0 2px 2px 0;
  z-index: -1
}

.page-wrapper {
  flex: 1;
  position: relative;
  z-index: 5;
  min-height: 0;
  display: flex;
  flex-direction: column
}

.page {
  flex: 1;
  padding: 44px 52px 20px;
  overflow-y: auto;
  scrollbar-width: none;
  display: flex;
  flex-direction: column
}

.page::-webkit-scrollbar {
  display: none
}

.page-left {
  background: linear-gradient(90deg, rgba(0, 0, 0, .01), transparent 3%, transparent 96%, rgba(0, 0, 0, .015))
}

.page-right {
  background: linear-gradient(90deg, rgba(0, 0, 0, .015), transparent 4%, transparent)
}

.page-num {
  display: none
}

.page-left .page-num {
  left: 24px
}

.page-right .page-num {
  right: 24px
}

.page-header-line {
  width: 100%;
  height: 1px;
  background: rgba(44, 36, 22, .08);
  margin-bottom: 16px
}

.running-header {
  font-family: var(--font-sans);
  font-size: .6rem;
  color: var(--ink-faint);
  letter-spacing: .12em;
  margin-bottom: 6px;
  text-align: right
}

.page h1 {
  font-size: 1.55rem;
  font-weight: 800;
  margin-bottom: 6px;
  letter-spacing: -.02em;
  line-height: 1.4
}

.page h2 {
  font-size: 1.05rem;
  font-weight: 700;
  margin-bottom: 12px;
  color: var(--accent);
  position: relative;
  padding-bottom: 8px
}

.page h2::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  width: 28px;
  height: 2px;
  background: var(--accent-warm);
  border-radius: 1px
}

.page p,
.t-body {
  font-size: .88rem;
  line-height: 1.9;
  margin-bottom: 14px;
  text-align: justify;
  word-break: keep-all
}

.page .subtitle {
  font-family: var(--font-sans);
  font-size: .68rem;
  color: var(--ink-faint);
  letter-spacing: .1em;
  margin-bottom: 16px
}

.t-small {
  font-family: var(--font-sans);
  font-size: .8rem;
  color: var(--ink-light);
  line-height: 1.7;
  margin-bottom: 12px
}

.t-label {
  font-family: var(--font-sans);
  font-size: .68rem;
  font-weight: 500;
  color: var(--accent);
  margin-bottom: 8px;
  letter-spacing: .05em
}

.book-footer {
  margin-top: 10px;
  font-family: var(--font-sans);
  font-size: .62rem;
  color: rgba(255, 255, 255, .3);
  text-align: center;
  letter-spacing: .06em
}

.mob-nav {
  position: absolute;
  bottom: 38px;
  width: 28px;
  height: 28px;
  border: none;
  background: #a89278;
  color: #fff;
  font-size: .78rem;
  cursor: pointer;
  border-radius: 50%;
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 20;
  box-shadow: 0 1px 4px rgba(0, 0, 0, .15)
}

.mob-nav:hover {
  background: #bea68c
}

@media(max-width:860px) {
  body {
    justify-content: flex-start;
    padding: 10px
  }

  .book-shell {
    max-width: 100%;
    height: calc(100dvh - 50px);
    border-radius: 8px;
    padding: 4px 4px 6px;
    flex-direction: column
  }

  .book-spine {
    width: 100%;
    min-width: unset;
    flex: 0 0 12px;
    border-radius: 6px 6px 0 0;
    background: linear-gradient(180deg, var(--spine), var(--cover-light), var(--cover));
    box-shadow: inset 0 -2px 6px rgba(0, 0, 0, .3)
  }

  .book-spine::after {
    display: none
  }

  .book-pages {
    flex: 1;
    border-radius: 0 0 6px 6px;
    min-height: 0
  }

  .book-gutter,
  .book-edge-right,
  .book-pages::before,
  .book-pages::after {
    display: none
  }

  .page {
    padding: 28px 24px 16px
  }

  .mob-nav {
    display: flex
  }

  .mob-nav-l {
    left: 10px
  }

  .mob-nav-r {
    right: 10px
  }
}