@import url('https://fonts.googleapis.com/css2?family=Noto+Sans+KR:wght@400;500;600;700&display=swap');

:root {
  font-family: 'Noto Sans KR', system-ui, -apple-system, sans-serif;
  color: #202d3b;
  background: #f4f6f9;
  font-synthesis: none;
}

* { box-sizing: border-box; }
body { margin: 0; }
button, input { font: inherit; }
button {
  cursor: pointer;
  transition: background .16s, border-color .16s, box-shadow .16s;
}
button:focus-visible, input:focus-visible {
  outline: 3px solid #a5c8fb;
  outline-offset: 2px;
}

.layout {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  min-height: 100dvh;
}
.layout.sidebar-collapsed { grid-template-columns: minmax(0, 1fr); }
.layout.sidebar-collapsed .sidebar { display: none; }

.sidebar {
  min-width: 0;
  padding: 26px 16px;
  overflow: auto;
  border-right: 1px solid #e4e9f0;
  background: #fff;
  box-shadow: 2px 0 14px #152b4405;
}
.brand {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 4px 12px 20px;
  border-bottom: 1px solid #edf0f5;
}
.brand-home {
  display: block;
  flex: 0 0 48px;
  border-radius: 9px;
  transition: opacity .16s ease, box-shadow .16s ease;
}
.brand-home:hover { opacity: .72; }
.brand-home:focus-visible {
  outline: 3px solid #a5c8fb;
  outline-offset: 3px;
}
.brand-logo {
  display: block;
  width: 48px;
  height: 48px;
  flex: 0 0 48px;
  object-fit: contain;
  border: 0;
  background: transparent;
}
.brand-meta { min-width: 0; }
.brand-kicker {
  color: #8494aa;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .11em;
}
.sidebar h1 {
  margin: 3px 0 0;
  overflow-wrap: anywhere;
  font-size: 15px;
  font-weight: 700;
  line-height: 1.4;
}
.sidebar-label {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin: 56px 13px 12px;
  padding-top: 18px;
  border-top: 1px solid #dce5ef;
  color: #243e59;
  font-size: 16px;
  font-weight: 700;
  line-height: 1.5;
}
.sidebar-label-en {
  color: #8494aa;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: .12em;
}
.chapters { display: grid; gap: 3px; }
.chapter {
  display: block;
  width: 100%;
  padding: 9px 14px;
  overflow-wrap: anywhere;
  border: 1px solid transparent;
  border-radius: 11px;
  background: transparent;
  color: #506178;
  text-align: left;
  font-size: 13px;
  font-weight: 500;
  line-height: 1.6;
}
.chapter:hover { background: #f3f6fa; color: #163d69; }
.chapter.active {
  border-color: #d6e7fb;
  background: #e9f1fb;
  color: #18538c;
  font-weight: 700;
  box-shadow: inset 3px 0 #3379be;
}
.sidebar-note {
  margin: 25px 12px;
  color: #9aa7b8;
  font-size: 11px;
  line-height: 1.7;
}

.main {
  position: relative;
  display: flex;
  min-width: 0;
  flex-direction: column;
}
.toolbar {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 74px;
  padding: 12px 22px;
  border-bottom: 1px solid #e3e8ee;
  background: #ffffffee;
  box-shadow: 0 3px 13px #25344b08;
  backdrop-filter: blur(12px);
}
.toolbar button {
  min-height: 38px;
  padding: 9px 12px;
  border: 1px solid #dce3eb;
  border-radius: 9px;
  background: #fff;
  color: #44566b;
  white-space: nowrap;
  font-size: 12px;
  font-weight: 600;
}
.toolbar button:hover { border-color: #aec8e4; background: #eff5fb; }
.toolbar button:disabled { cursor: default; opacity: .36; }

.viewer {
  width: 100%;
  min-width: 0;
  min-height: 0;
  flex: 1;
  overflow: auto;
  background: radial-gradient(ellipse at 55% 5%, #fafbfd 0%, #f2f5f9 72%);
}
.message {
  padding: 32px;
  color: #62748a;
  font-size: 14px;
  line-height: 1.75;
}
.message.error { color: #b42332; }
.message[hidden] { display: none; }

.layout.focus-reading { display: block !important; }
.layout.focus-reading .sidebar,
.layout.focus-reading .toolbar { display: none !important; }
.layout.focus-reading .main { min-height: 100dvh; }

@media (max-width: 1100px) {
  .layout { grid-template-columns: 250px minmax(0, 1fr); }
}
