:root {
  font-family: Inter, "Segoe UI", Arial, sans-serif;
  color: #253247;
  background: #f5f6f8;
  font-synthesis: none;
  --surface: #fff;
  --surface-soft: #f8f9fb;
  --line: #e3e7ee;
  --text: #253247;
  --muted: #69768a;
  --blue: #346fe2;
  --code: #f2f4f8;
  --shadow: 0 16px 50px rgba(31, 45, 70, 0.07);
}
* {
  box-sizing: border-box;
}
html,
body {
  margin: 0;
  min-height: 100%;
  height: 100%;
}
button,
select,
input {
  font: inherit;
}
button {
  cursor: pointer;
}
button:focus-visible,
select:focus-visible,
input:focus-visible,
a:focus-visible {
  outline: 3px solid #91b5ff;
  outline-offset: 2px;
}
a {
  color: var(--blue);
}
[hidden] {
  display: none !important;
}
.app-shell {
  height: 100vh;
  min-height: 500px;
  display: flex;
  flex-direction: column;
}
.topbar {
  height: 70px;
  flex: none;
  display: flex;
  align-items: center;
  gap: 24px;
  padding: 0 28px;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 750;
  font-size: 17px;
  text-decoration: none;
  color: var(--text);
  white-space: nowrap;
}
.brand img {
  width: 33px;
  height: 33px;
}
.file-name {
  color: var(--muted);
  font-size: 13px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
}
.top-actions {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 12px;
  white-space: nowrap;
}
.local-badge {
  color: var(--muted);
  font-size: 12px;
  padding: 5px 9px;
  border-radius: 20px;
  background: var(--surface-soft);
  border: 1px solid var(--line);
}
.icon-button,
#languageSelect,
.outline-toggle {
  height: 35px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--text);
}
.icon-button {
  width: 35px;
  font-size: 20px;
  line-height: 1;
}
#languageSelect {
  padding: 0 26px 0 10px;
}
.primary-button {
  background: var(--blue);
  color: #fff;
  border: 1px solid var(--blue);
  border-radius: 8px;
  padding: 9px 15px;
  font-weight: 650;
  box-shadow: 0 3px 8px rgba(52, 111, 226, 0.14);
}
.primary-button:hover {
  background: #245dc7;
}
.primary-button.large {
  padding: 12px 20px;
  font-size: 15px;
}
.update-check {
  height: 35px;
  padding: 0 11px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--text);
  font-size: 12px;
}
.update-check:hover {
  background: var(--surface-soft);
}
.update-check:disabled,
.update-banner button:disabled {
  cursor: wait;
  opacity: 0.65;
}
.update-banner {
  flex: none;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 28px;
  border-bottom: 1px solid #c9d9fb;
  background: #edf3ff;
  color: var(--text);
  font-size: 13px;
}
.update-banner > span {
  flex: 1;
}
.update-dismiss {
  width: 28px;
  height: 28px;
  background: transparent;
  border: 0;
  border-radius: 6px;
  color: var(--muted);
  font-size: 22px;
  line-height: 1;
}
.update-dismiss:hover {
  background: rgba(50, 90, 170, 0.12);
  color: var(--text);
}
.toolbar {
  height: 54px;
  flex: none;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 0 28px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}
.view-switch {
  display: flex;
  padding: 3px;
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: 9px;
}
.view-switch button {
  background: transparent;
  border: 0;
  color: var(--muted);
  padding: 6px 14px;
  border-radius: 6px;
  font-size: 13px;
}
.view-switch button.selected {
  background: var(--surface);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.1);
  color: var(--text);
  font-weight: 650;
}
.toolbar-spacer {
  flex: 1;
}
.search-group {
  display: flex;
  align-items: center;
  gap: 4px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 5px;
  background: var(--surface);
}
.search-group input {
  width: 190px;
  border: 0;
  background: transparent;
  color: var(--text);
  height: 34px;
  outline: 0;
  padding: 0 6px;
  font-size: 13px;
}
.search-group span {
  font-size: 11px;
  color: var(--muted);
  min-width: 37px;
  text-align: center;
}
.search-group button {
  border: 0;
  background: transparent;
  color: var(--muted);
  width: 25px;
  height: 27px;
  border-radius: 5px;
}
.search-group button:hover {
  background: var(--surface-soft);
  color: var(--text);
}
.outline-toggle {
  padding: 0 12px;
  font-size: 13px;
}
.main-area {
  min-height: 0;
  flex: 1;
  position: relative;
}
.welcome {
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 42px 24px;
  background: radial-gradient(circle at 50% 25%, #e9efff 0, transparent 43%);
}
.welcome-mark {
  width: 76px;
  height: 76px;
  display: grid;
  place-items: center;
  border-radius: 18px;
  background: var(--surface);
  box-shadow: var(--shadow);
  margin-bottom: 24px;
}
.welcome-mark img {
  width: 54px;
  height: 54px;
}
.eyebrow {
  font-size: 12px;
  font-weight: 750;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--blue);
  margin: 0 0 12px;
}
.welcome h1 {
  font-size: clamp(29px, 4vw, 42px);
  letter-spacing: -0.035em;
  line-height: 1.15;
  margin: 0;
  max-width: 600px;
}
.welcome-copy {
  color: var(--muted);
  line-height: 1.6;
  max-width: 500px;
  margin: 16px 0 27px;
}
.welcome-hint {
  font-size: 12px;
  color: var(--muted);
  margin-top: 17px;
}
.reader {
  height: 100%;
  display: flex;
}
.outline {
  width: 235px;
  flex: none;
  overflow: auto;
  border-right: 1px solid var(--line);
  background: var(--surface-soft);
  padding: 25px 13px;
}
.outline-heading {
  color: var(--muted);
  font-size: 11px;
  font-weight: 750;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  padding: 0 11px 15px;
}
.outline nav {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.outline a {
  display: block;
  color: var(--muted);
  text-decoration: none;
  font-size: 12px;
  line-height: 1.4;
  padding: 7px 10px;
  border-radius: 6px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.outline a:hover,
.outline a.active {
  background: #e8eefb;
  color: var(--blue);
}
.outline a.level-2 {
  padding-left: 22px;
}
.outline a.level-3 {
  padding-left: 34px;
}
.outline a.level-4,
.outline a.level-5,
.outline a.level-6 {
  padding-left: 44px;
}
.document-scroller {
  flex: 1;
  min-width: 0;
  overflow: auto;
  scroll-behavior: smooth;
}
.markdown-body,
.source-body,
.document-footer {
  width: min(100% - 80px, 820px);
  margin-left: auto;
  margin-right: auto;
}
.markdown-body {
  padding: 47px 0 70px;
  font-family: Georgia, "Noto Serif KR", serif;
  font-size: 16px;
  line-height: 1.75;
  overflow-wrap: anywhere;
}
.markdown-body > *:first-child {
  margin-top: 0;
}
.markdown-body h1,
.markdown-body h2,
.markdown-body h3,
.markdown-body h4,
.markdown-body h5,
.markdown-body h6 {
  font-family: Inter, "Segoe UI", Arial, sans-serif;
  line-height: 1.3;
  letter-spacing: -0.02em;
  scroll-margin-top: 30px;
}
.markdown-body h1 {
  font-size: 2.25em;
  margin: 0 0 0.85em;
  padding-bottom: 0.35em;
  border-bottom: 1px solid var(--line);
}
.markdown-body h2 {
  font-size: 1.65em;
  margin: 1.7em 0 0.7em;
  padding-bottom: 0.25em;
  border-bottom: 1px solid var(--line);
}
.markdown-body h3 {
  font-size: 1.3em;
  margin: 1.55em 0 0.6em;
}
.markdown-body h4,
.markdown-body h5,
.markdown-body h6 {
  margin: 1.3em 0 0.5em;
}
.markdown-body p,
.markdown-body ul,
.markdown-body ol,
.markdown-body blockquote,
.markdown-body table,
.markdown-body pre {
  margin: 0 0 1.25em;
}
.markdown-body li {
  margin: 0.2em 0;
}
.markdown-body li > p {
  margin-bottom: 0.5em;
}
.markdown-body blockquote {
  border-left: 4px solid #abc4f4;
  margin-left: 0;
  padding: 2px 0 2px 18px;
  color: var(--muted);
}
.markdown-body code,
.source-body {
  font-family: "Cascadia Code", Consolas, "Courier New", monospace;
}
.markdown-body :not(pre) > code {
  background: var(--code);
  border-radius: 4px;
  padding: 2px 5px;
  font-size: 0.86em;
}
.markdown-body pre {
  background: var(--code);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 17px 20px;
  overflow: auto;
  font-size: 13px;
  line-height: 1.55;
}
.markdown-body pre code {
  background: none;
  padding: 0;
}
.markdown-body table {
  display: block;
  overflow-x: auto;
  border-collapse: collapse;
  width: max-content;
  max-width: 100%;
  font-family: Inter, "Segoe UI", Arial, sans-serif;
  font-size: 14px;
}
.markdown-body th,
.markdown-body td {
  border: 1px solid var(--line);
  padding: 8px 12px;
}
.markdown-body th {
  background: var(--surface-soft);
  font-weight: 700;
}
.markdown-body tr:nth-child(even) {
  background: var(--surface-soft);
}
.markdown-body img {
  max-width: 100%;
  height: auto;
  border-radius: 6px;
}
.markdown-body hr {
  border: 0;
  border-top: 1px solid var(--line);
  margin: 2em 0;
}
.markdown-body a {
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}
.markdown-body input[type="checkbox"] {
  pointer-events: none;
  accent-color: var(--blue);
}
.markdown-body .task-list-item {
  list-style: none;
}
.outline-empty {
  display: block;
  color: var(--muted);
  font-size: 12px;
  padding: 7px 11px;
}
.source-body {
  margin-top: 0;
  padding: 43px 0 70px;
  white-space: pre-wrap;
  word-break: break-word;
  color: var(--text);
  font-size: 13px;
  line-height: 1.65;
  background: transparent;
}
.document-footer {
  border-top: 1px solid var(--line);
  padding: 17px 0 28px;
  color: var(--muted);
  font-size: 12px;
}
mark.search-hit {
  background: #ffe38c;
  color: #273043;
  border-radius: 2px;
}
mark.search-hit.current {
  background: #ffae45;
  outline: 2px solid #ffae45;
}
.drop-overlay {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  background: rgba(51, 100, 194, 0.13);
  border: 5px dashed var(--blue);
  font-size: 24px;
  font-weight: 700;
  color: var(--blue);
  pointer-events: none;
}
.drop-overlay span {
  background: var(--surface);
  padding: 18px 26px;
  border-radius: 12px;
}
.toast {
  position: fixed;
  bottom: 22px;
  left: 50%;
  transform: translateX(-50%);
  background: #23324a;
  color: #fff;
  padding: 11px 16px;
  border-radius: 9px;
  box-shadow: var(--shadow);
  z-index: 30;
  font-size: 13px;
  max-width: calc(100vw - 30px);
}
html[data-theme="dark"] {
  color-scheme: dark;
  --surface: #1d2635;
  --surface-soft: #18212e;
  --line: #354153;
  --text: #e8edf5;
  --muted: #a2adbf;
  --blue: #80a9ff;
  --code: #18212d;
  --shadow: 0 16px 50px rgba(0, 0, 0, 0.25);
  background: #141c28;
  color: var(--text);
}
html[data-theme="dark"] .welcome {
  background: radial-gradient(circle at 50% 25%, #24365b 0, transparent 43%);
}
html[data-theme="dark"] .outline a:hover,
html[data-theme="dark"] .outline a.active {
  background: #2c3e5e;
}
html[data-theme="dark"] .primary-button {
  background: #4d7dec;
  border-color: #4d7dec;
  color: #fff;
}
html[data-theme="dark"] .drop-overlay {
  background: rgba(20, 34, 61, 0.72);
}
html[data-theme="dark"] .update-banner {
  background: #253755;
  border-bottom-color: #39537d;
}
@media (max-width: 800px) {
  .topbar {
    padding: 0 16px;
    gap: 10px;
  }
  .local-badge,
  .file-name {
    display: none;
  }
  .update-banner {
    padding: 9px 16px;
  }
  .toolbar {
    padding: 0 12px;
    gap: 7px;
  }
  .search-group input {
    width: 120px;
  }
  .outline {
    position: absolute;
    z-index: 8;
    top: 0;
    bottom: 0;
    box-shadow: var(--shadow);
  }
  .outline[hidden] {
    display: none !important;
  }
  .markdown-body,
  .source-body,
  .document-footer {
    width: min(100% - 38px, 820px);
  }
}
@media (max-width: 570px) {
  .brand span {
    display: none;
  }
  .top-actions {
    gap: 5px;
  }
  .topbar {
    height: 60px;
  }
  .update-check {
    max-width: 95px;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .update-banner {
    flex-wrap: wrap;
    padding: 9px 12px;
  }
  .toolbar {
    height: auto;
    min-height: 54px;
    flex-wrap: wrap;
    padding: 7px 10px;
  }
  .search-group {
    order: 3;
    width: 100%;
  }
  .search-group input {
    flex: 1;
  }
  .outline-toggle {
    margin-left: auto;
  }
  .toolbar-spacer {
    display: none;
  }
}
