:root{font:15px/1.55 -apple-system,BlinkMacSystemFont,"Apple SD Gothic Neo","Noto Sans KR",sans-serif;color:#1b293c;background:white;--blue:#286bea;--muted:#65758b;--line:#e1e7ee}*{box-sizing:border-box}[hidden]{display:none!important}body{margin:0}a{color:inherit;text-decoration:none}button,select{font:inherit;color:inherit;cursor:pointer}button{border:0}button:disabled,select:disabled{opacity:.48;cursor:default}button:focus-visible,select:focus-visible,a:focus-visible,#bodyText:focus-visible{outline:3px solid #85b3ff;outline-offset:3px}header{border-bottom:1px solid var(--line)}.headerInner,main{width:min(1120px,calc(100% - 64px));margin:auto}.headerInner{min-height:68px;display:flex;align-items:center;gap:18px}.brand{display:flex;align-items:center;gap:10px;font-size:20px;font-weight:750;letter-spacing:-.07em}.mark,.sound{display:flex;align-items:center;justify-content:center;gap:3px;background:var(--blue);color:white;border-radius:8px}.mark{width:31px;height:31px}.mark i,.sound i{width:2px;background:currentColor;border-radius:2px;height:9px}.mark i:nth-child(2),.sound i:nth-child(2){height:18px}.mark i:nth-child(3),.sound i:nth-child(4){height:13px}.scope{border-left:1px solid var(--line);padding-left:18px;color:var(--muted);font-size:13px}.storage{margin-left:auto;font-size:12px;color:var(--muted);display:flex;align-items:center;gap:7px}.storage b,.dot{display:inline-block;width:7px;height:7px;background:#518065;border-radius:50%}main{padding:46px 0 60px}h1,h2,h3,p{margin:0}h1{font-size:clamp(29px,4vw,40px);letter-spacing:-.065em;line-height:1.28;overflow-wrap:anywhere}h2{font-size:20px;letter-spacing:-.045em}h3{font-size:15px}.titleBlock p,.upload p,.intro,.empty{color:var(--muted)}.titleBlock p{margin-top:10px}.titleBlock{margin-bottom:28px}.upload{background:#f3f7ff;border:1px dashed #a9c2ef;border-radius:14px;display:flex;align-items:center;padding:26px 34px;gap:24px;min-height:165px}.upload.drag{background:#e2edff;border-color:var(--blue)}.upload p{margin-top:4px;font-size:14px}.docArt{position:relative;width:80px;height:84px;flex:none}.paper{border:1.5px solid #88abed;border-radius:5px;width:44px;height:58px;position:absolute;background:white}.back{top:9px;left:10px;transform:rotate(-13deg);background:#dbe8fe}.front{top:13px;left:22px;transform:rotate(6deg);padding:13px 8px}.paper i{display:block;height:2px;background:#91ade1;margin-bottom:5px}.paper i:last-child{width:60%}.sound{position:absolute;bottom:5px;right:0;width:36px;height:28px;box-shadow:0 2px 5px #285abb20}.primary,.secondary{display:inline-flex;align-items:center;justify-content:center;gap:8px;padding:10px 17px;border-radius:7px;font-size:14px;font-weight:650}.primary{color:white;background:var(--blue)}.primary:hover{background:#1959d2}.upload button{margin-left:auto;white-space:nowrap}.secondary{background:#eaf1ff;color:#235bb7}.listHeading,.takesHeading,.toolbar,.speechBar{display:flex;align-items:center;justify-content:space-between}.listHeading{border-bottom:1px solid #aebaca;margin-top:38px;padding-bottom:13px}.listHeading span,.takesHeading span{color:var(--blue);font-size:14px;margin-left:5px}.listHeading small,.empty,small{color:var(--muted);font-size:13px}.empty{padding:34px 12px;text-align:center}.docRow{padding:17px 6px;display:flex;align-items:center;gap:14px;border-bottom:1px solid var(--line)}.docRow:hover{background:#f8faff}.fileIcon{width:46px;height:45px;background:#edf3fe;color:#356ab7;display:grid;place-items:center;border-radius:7px;font-size:11px;font-weight:700;flex:none}.docRow strong{display:block;overflow-wrap:anywhere}.arrow{margin-left:auto;color:#8192a8}.backLink{font-size:13px;color:var(--blue);display:inline-block;margin-bottom:17px}.workspace{display:grid;grid-template-columns:minmax(0,1fr) minmax(265px,32%);gap:20px;align-items:start}.textCard,.recordCard{border:1px solid var(--line);border-radius:12px;overflow:hidden}.toolbar{padding:12px 20px;background:#f7f9fc;border-bottom:1px solid var(--line);font-size:13px;color:var(--muted)}select,.paging button{border:1px solid var(--line);background:white;border-radius:5px;padding:4px 7px}.paging{display:flex;gap:5px}.paging button{font-size:21px;line-height:1;width:32px;height:31px}.toolbar select{margin-left:6px}#bodyText{white-space:pre-wrap;overflow-wrap:anywhere;padding:27px;line-height:1.9;font-size:17px;min-height:220px;max-height:62vh;overflow:auto}.speechBar{border-top:1px solid var(--line);padding:13px 20px}.speechBar select{font-size:13px}.recordCard{padding:20px}.intro{font-size:13px;margin:4px 0 17px}.recordCard .primary{width:100%}.dot{background:white}.takesHeading{margin-top:22px;border-bottom:1px solid var(--line);padding-bottom:9px}.take{padding:13px 0;border-bottom:1px solid var(--line)}.take:last-child{border-bottom:0}.take small{display:block;margin-bottom:6px}.take audio{width:100%;height:36px}.activeRecord{background:#b13246}#status{color:#244d83;background:#eff5ff;border-radius:6px;padding:10px 14px;margin-bottom:17px;overflow-wrap:anywhere}
@media(max-width:730px){.headerInner,main{width:calc(100% - 32px)}main{padding-top:28px}.scope{display:none}.upload{flex-wrap:wrap;padding:20px;gap:14px}.upload button{margin-left:0}.docArt{width:68px}.workspace{grid-template-columns:1fr}.recordCard{padding:18px}#bodyText{max-height:48vh;padding:20px}.listHeading{margin-top:26px}}@media(max-width:530px){.upload{flex-direction:column;text-align:center;justify-content:center;padding:21px 12px}.brand{font-size:18px}.storage{font-size:11px}}
.sourceControls{display:flex;align-items:center;gap:14px;min-height:43px;padding:7px 18px;font-size:12px;color:var(--muted);border-bottom:1px solid var(--line)}
.sourceControls span{margin-right:auto;color:#40546e;font-weight:650}
.sourceControls select{font-size:12px}
.sourceControls a,#attachButton{color:var(--blue)}
#pageSurface{padding:12px;background:#eaf0f6;max-height:68vh;min-height:140px;overflow:auto;scrollbar-gutter:stable}
#pageDrawing{width:max-content;min-width:100%}
#pageDrawing canvas,#pageDrawing img{display:block;margin:auto;background:white;box-shadow:0 1px 5px #172a4226}
#pageDrawing img{max-width:100%;width:auto;height:auto}
#pageDrawing:has(img){width:100%}
#renderStatus:empty{display:none}#renderStatus{color:var(--muted);font-size:13px}
#legacyPdf{padding:10px 18px;color:var(--muted);background:#f3f7ff;font-size:13px}
#attachButton{background:none;text-decoration:underline;padding:3px}
#narration:not(:empty){padding:12px 20px;border-top:1px solid var(--line);font-size:13px}#narration audio{width:100%;height:36px}

/* The toolbar spans the book and its docked practice panel. */
body:has(#reader:not([hidden])) > header { display: none; }
main:has(#reader:not([hidden])) { width: 100%; padding: 0; }
main:has(#reader:not([hidden])) #status:not([hidden]) {
  position: fixed; inset: auto 8px 8px; z-index: 2;
  width: fit-content; max-width: calc(100% - 16px); margin: 0;
}
#reader {
  display: grid; height: 100dvh;
  grid-template: auto minmax(0, 1fr) / minmax(0, 1fr) auto;
}
#reader > .bookBar { grid-column: 1 / -1; }
#reader > .textCard { grid-area: 2 / 1; min-width: 0; }
.bookBar { display: flex; align-items: center; gap: 10px; padding: 0 6px; border-bottom: 1px solid var(--line); }
.bookBar h1 { flex: 1; min-width: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; font-size: 15px; letter-spacing: -.025em; }
.bookBar .backLink, .practiceToggle { margin: 0; white-space: nowrap; }
.bookBar .backLink { display: inline-flex; align-items: center; gap: 4px; min-height: 44px; }
.bookBar .toolbar { padding: 0; background: white; border: 0; gap: 6px; }
.bookBar .paging button { height: 42px; width: 42px; background: transparent; border: 0; }
.bookBar select { min-height: 36px; }
.practiceToggle { min-height: 40px; padding: 4px 12px; }
#reader:has(.activeRecord) .practiceToggle { color: #a82737; background: #fff0f2; }
#reader > .textCard { flex: 1; min-height: 0; display: flex; flex-direction: column; border: 0; border-radius: 0; }
#sourceView { flex: 1; min-height: 0; }
#pageSurface { height: 100%; min-height: 0; max-height: none; padding: 0; scrollbar-gutter: auto; background: #fafafa; }
#pageDrawing canvas, #pageDrawing img { box-shadow: none; }
#reader #bodyText { flex: 1; min-height: 0; max-height: none; padding: 6px 10px; }
#practice {
  grid-area: 2 / 2; width: clamp(230px, 25vw, 340px); min-height: 0;
  overflow: auto; overscroll-behavior: contain; border-left: 1px solid var(--line);
  padding: 10px 14px; background: white;
}
@media (max-width: 599px) {
  #reader { grid-template: auto minmax(0, 1fr) auto / minmax(0, 1fr); }
  #practice {
    grid-area: 3 / 1; width: 100%; max-height: 45dvh;
    border-left: 0; border-top: 1px solid var(--line);
  }
}
.practiceHead { display: flex; align-items: center; justify-content: space-between; }
.practiceHead button { min-width: 40px; min-height: 40px; background: transparent; font-size: 22px; }
#docInfo { color: var(--muted); font-size: 12px; }
#practice .sourceControls, #practice .speechBar, #practice #narration { padding: 10px 0; }
#practice .recordCard { padding: 12px 0 0; border: 0; border-top: 1px solid var(--line); border-radius: 0; }
@media (max-width: 600px) {
  .bookBar { gap: 4px; }
  .bookBar .backLink { min-width: 36px; justify-content: center; }
  .bookBar .backLink span { display: none; }
  .bookBar .toolbar label { font-size: 0; }
  .bookBar .toolbar select { margin: 0; font-size: 13px; }
  .bookBar .paging { gap: 0; }
  .practiceToggle { padding-inline: 6px; font-size: 13px; }
}

#sourceView { display: flex; position: relative; }
#pageSurface { min-width: 0; flex: 1; }
#thumbRail {
  flex: 0 0 144px; overflow: auto; overscroll-behavior: contain;
  background: #f4f6fa; border-right: 1px solid var(--line); padding: 6px;
}
#thumbRail button {
  display: grid; justify-items: center; align-content: center; gap: 4px;
  width: 100%; height: 150px; margin-bottom: 4px; border: 2px solid transparent;
  border-radius: 5px; background: transparent; font-size: 12px;
}
#thumbRail button[aria-current="page"] { border-color: var(--blue); background: #eaf1ff; }
#thumbRail canvas { display: block; width: auto; height: auto; max-width: 108px; max-height: 116px; box-shadow: 0 1px 4px #14243930; }
#zoomControl { display: flex; align-items: center; }
#zoomControl button, #thumbToggle { min-width: 36px; height: 40px; background: transparent; border-radius: 5px; font-size: 20px; }
#thumbToggle[aria-expanded="true"] { color: var(--blue); background: #edf3ff; }
@media(max-width:900px) {
  #thumbRail { position: absolute; inset: 0 auto 0 0; width: 144px; z-index: 1; }
}
@media(max-width:600px) {
  .bookBar:has(#zoomControl:not([hidden])) .paging { display: none; }
  #zoomControl button, #thumbToggle { min-width: 30px; }
  #zoomControl select { padding-inline: 2px; font-size: 12px; }
}

/* Library */
body:has(#library:not([hidden])) main,
body:has(#library:not([hidden])) .headerInner {
  width: min(1064px, calc(100% - 64px));
}
#library .titleBlock { margin: 0 0 22px; }
#library .titleBlock h1 { font-size: clamp(30px, 4vw, 42px); letter-spacing: -.055em; }
#library .titleBlock p { margin-top: 6px; color: #58677c; }
#library .upload {
  position: relative; display: flex; align-items: center; justify-content: flex-start;
  isolation: isolate; overflow: hidden; min-height: 218px; padding: 32px 38px;
  border: 1px solid #d6e3f5; border-radius: 16px; background: #edf4fc; text-align: left;
}
#library .upload.drag { outline: 3px dashed #2766d8; outline-offset: -6px; }
#library .libraryArt {
  position: absolute; z-index: -1; inset: 0 0 0 auto; width: 53%; height: 100%;
  object-fit: cover; object-position: 50% 55%;
  mask-image: linear-gradient(to right, transparent, #000 30%);
}
#library .uploadCopy { position: relative; max-width: 54%; }
#library .uploadCopy h2 { font-size: clamp(21px, 3vw, 28px); line-height: 1.35; }
#library .uploadCopy p { color: #526581; margin-top: 6px; line-height: 1.55; word-break: keep-all; }
#library #uploadButton { min-height: 43px; margin: 19px 0 0; padding: 9px 19px; background: #215fd8; }
#library #uploadButton:hover { background: #184cba; }
#library .listHeading { margin-top: 32px; padding: 0 2px 12px; border-color: #cad5e3; }
#library .listHeading h2 { display: flex; gap: 8px; align-items: center; font-size: 19px; }
#library #docCount { min-width: 22px; margin: 0; padding: 0 5px; border-radius: 7px; background: #edf3ff; text-align: center; font-size: 12px; }
#library .docRow { gap: 14px; padding: 14px 6px; }
#library .docRow > div { min-width: 0; }
#library .docRow strong { font-size: 16px; letter-spacing: -.025em; line-height: 1.45; }
#library .docRow small { display: block; margin-top: 3px; }
#library .fileIcon {
  position: relative; width: 36px; height: 45px; align-items: end; padding-bottom: 6px;
  border: 1px solid #cad9ed; border-radius: 3px 9px 3px 3px;
  background: linear-gradient(225deg,#fff 5px,#d5e4f7 5px,#d5e4f7 8px,transparent 8px), #f1f6ff;
  color: #355d9c; font-size: 10px; letter-spacing: .02em;
}
#library .fileIcon::before { content: ""; position: absolute; top: 12px; left: 7px; height: 5px; width: 10px; border-block: 1px solid #9cb6d8; }
#library #documents > .empty { padding: 27px 10px; border-bottom: 1px solid var(--line); }
@media (max-width: 700px) {
  body:has(#library:not([hidden])) main,
  body:has(#library:not([hidden])) .headerInner { width: calc(100% - 32px); }
  #library .upload { min-height: 195px; padding: 22px; }
  #library .uploadCopy { max-width: 60%; }
}
@media (max-width: 530px) {
  #library .upload { display: flex; align-items: flex-start; flex-direction: column; justify-content: center; min-height: 178px; padding: 18px; }
  #library .libraryArt { width: 47%; object-position: 54% 50%; mask-image: linear-gradient(to right,transparent,#000 18%); }
  #library .uploadCopy { max-width: 57%; }
  #library .uploadCopy p { font-size: 13px; }
  #library #uploadButton { margin-top: 14px; }
  #library .titleBlock p { font-size: 14px; }
  #library .listHeading { margin-top: 24px; }
}

#pageSurface { overflow-anchor: none; }
#pageDrawing.pdfStream {
  position: relative; display: flex; flex-direction: column; align-items: center;
  gap: 6px; width: max(100%, var(--sheet-width, 100%));
}
.pdfSheet {
  position: relative; flex: none; width: var(--sheet-width, 100%);
  background: white; outline: 1px solid #dce2e9;
}
#pageDrawing .pdfSheet canvas {
  position: absolute; inset: 0; width: 100%; height: 100%; margin: 0;
}
