* {
  box-sizing: border-box;
}
:root {
  font-family: "Malgun Gothic", "Apple SD Gothic Neo", sans-serif;
  color: #172d3b;
  background: #f3f5f7;
  font-size: 16px;
  font-synthesis: none;
}
body {
  margin: 0;
}
button,
input {
  font: inherit;
}
textarea { font: inherit; color: inherit; border: 1px solid #b9c6cf; border-radius: 7px; padding: 12px; width: 100%; resize: vertical; }
.document-actions { flex-wrap: wrap; }
#editor-shell.prose-engine { position: fixed; left: -20000px; top: 0; width: 900px; height: 800px; visibility: hidden; pointer-events: none; }
#prose-shell { flex: 1; min-height: 0; display: flex; flex-direction: column; background: #fff; }
.prose-caption { padding: 10px 20px 0; font-size: 12px; color: #637c89; }
#prose-input { flex: 1; min-height: 0; border: 0; border-radius: 0; resize: none; padding: 24px max(22px, calc((100% - 740px) / 2)); font-family: '제주명조', serif; font-size: 18px; line-height: 1.6; letter-spacing: -.05em; outline-offset: -3px; white-space: pre-wrap; overflow-wrap: anywhere; }
#snippet-dialog { width: min(680px, calc(100vw - 24px)); max-height: calc(100dvh - 32px); overflow-y: auto; }
#snippet-dialog label { display: block; margin: 14px 0; font-size: 14px; }
#snippet-dialog input, #snippet-dialog textarea { display: block; margin-top: 7px; }
#snippet-list { max-height: 230px; overflow-y: auto; }
.snippet-row { display: flex; gap: 8px; align-items: center; padding: 12px 0; border-bottom: 1px solid #e1e7eb; }
.snippet-row > div { flex: 1; min-width: 0; }
.snippet-row strong, .snippet-row small { display: block; overflow-wrap: anywhere; }
.snippet-row small { color: #637c89; margin-top: 5px; white-space: pre-wrap; }
.snippet-actions { display: flex; justify-content: flex-end; gap: 8px; }
#snippet-error { color: #a42d28; }
#prose-input:focus { outline: 1px solid #b9c6cf; outline-offset: -1px; }
@media (max-width: 680px) {
  .document-header.prose-header { min-height: 72px; }
  .document-header.prose-header:not(.tools-open) .document-actions { display: none; }
  #toggle-tools { font-size: .75rem; padding: 6px 9px; }
}
button {
  min-height: 42px;
  border: 1px solid #d1d9df;
  border-radius: 7px;
  background: #fff;
  color: #233d4c;
  padding: 9px 14px;
  cursor: pointer;
  font-size: 0.875rem;
  font-weight: 600;
  white-space: nowrap;
}
button:hover {
  background: #edf1f4;
}
button:disabled {
  opacity: 0.45;
  cursor: default;
}
button.primary {
  background: #213e50;
  color: white;
  border-color: #213e50;
}
button.primary:hover {
  background: #30556a;
}
button.quiet {
  border-color: transparent;
  background: transparent;
}
input {
  border: 1px solid #b9c6cf;
  border-radius: 7px;
  padding: 12px;
  width: 100%;
  min-width: 0;
  background: #fff;
}
input:focus,
button:focus-visible {
  outline: 2px solid #4582a2;
  outline-offset: 2px;
}
[hidden] {
  display: none !important;
}
.workspace {
  display: flex;
  height: 100dvh;
  overflow: hidden;
}
.sidebar {
  width: 272px;
  flex-shrink: 0;
  background: #182b3a;
  color: #f3f5f7;
  display: flex;
  flex-direction: column;
  padding: 28px 18px 16px;
}
.brand {
  display: flex;
  align-items: center;
  gap: 13px;
  margin-bottom: 32px;
  padding: 0 8px;
}
.brand strong {
  display: block;
  font-size: 1.15rem;
  letter-spacing: -0.03em;
}
.brand span:not(.brand-mark) {
  display: block;
  font-size: 0.78rem;
  color: #bac8d0;
  margin-top: 6px;
}
.brand-mark {
  height: 58px;
  width: 58px;
  display: grid;
  place-items: center;
  border: 1px solid #8798a6;
  color: #e1bb87;
  font-family: serif;
  font-size: 2rem;
}
.brand-mark.small {
  height: 42px;
  width: 42px;
  font-size: 1.6rem;
  flex-shrink: 0;
}
.library-actions {
  display: flex;
  flex-direction: column;
  gap: 9px;
}
.library-actions .primary {
  background: #e5ba80;
  color: #213344;
  border-color: #e5ba80;
}
.library-actions button:not(.primary) {
  background: transparent;
  color: #d6e0e7;
  border-color: #526474;
}
.list-label {
  display: flex;
  justify-content: space-between;
  font-size: 0.78rem;
  letter-spacing: 0.04em;
  color: #a7bbc7;
  padding: 30px 10px 12px;
}
#document-list {
  overflow: auto;
  flex: 1;
  min-height: 0;
}
.document-item {
  display: block;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: #dce5eb;
  width: 100%;
  text-align: left;
  margin-bottom: 7px;
  padding: 14px 12px;
  white-space: normal;
}
.document-item:hover {
  background: #263e50;
}
.document-item.active {
  background: #304b5f;
  box-shadow: inset 3px 0 #e5ba80;
}
.document-item strong {
  display: block;
  font-size: 0.9rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.document-item small {
  display: block;
  font-size: 0.75rem;
  font-weight: 400;
  color: #b4c6d2;
  margin-top: 8px;
}
.sidebar-footer {
  border-top: 1px solid #3a4d5c;
  padding-top: 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  font-size: 0.75rem;
  color: #b3c3ce;
}
.sidebar-footer button {
  color: #dbe4e9;
  font-size: 0.75rem;
  padding: 8px;
}
.main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  position: relative;
  background: #eef2f5;
}
.document-header {
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 16px 24px;
  background: #fff;
  border-bottom: 1px solid #dce3e8;
  flex-shrink: 0;
  min-height: 95px;
}
.document-heading {
  flex: 1;
  min-width: 0;
}
#document-title {
  border: 0;
  padding: 3px 0;
  font-size: 1.1rem;
  font-weight: 700;
  color: #203a4b;
  background: transparent;
}
#document-title:disabled {
  opacity: 0.6;
}
#save-status {
  font-size: 0.75rem;
  color: #637c89;
  margin-top: 6px;
  min-height: 18px;
}
.document-actions {
  display: flex;
  gap: 8px;
}
.empty {
  margin: auto;
  width: min(600px, 85%);
  padding: 56px 20px;
  color: #243e50;
}
.eyebrow {
  font-size: 0.7rem;
  letter-spacing: 0.19em;
  font-weight: 700;
  color: #6c8190;
}
.empty-rule {
  width: 45px;
  height: 3px;
  background: #b38c59;
  margin-bottom: 25px;
}
.empty h2 {
  font-family: Georgia, "Batang", serif;
  font-size: clamp(2.5rem, 4vw, 3.7rem);
  line-height: 1.35;
  font-weight: 400;
  letter-spacing: -0.065em;
  margin: 28px 0 22px;
}
.empty p:not(.eyebrow) {
  line-height: 1.9;
  color: #5b7483;
  margin-bottom: 28px;
}
.empty-foot {
  display: block;
  font-size: 0.75rem;
  color: #748995;
  margin-top: 55px;
  letter-spacing: 0.04em;
}
#editor-shell {
  flex: 1;
  min-height: 0;
  position: relative;
}
#editor {
  height: 100%;
  width: 100%;
}
#editor iframe {
  display: block;
  border: 0;
  width: 100%;
  height: 100%;
}
#editor-loading {
  position: absolute;
  z-index: 2;
  inset: 0;
  display: grid;
  place-items: center;
  background: #eef2f5;
  color: #637c89;
}
.notice {
  padding: 12px 22px;
  font-size: 0.85rem;
  line-height: 1.6;
  background: #fff1d6;
  color: #714900;
  border-bottom: 1px solid #e1d0ad;
  display: flex;
  gap: 16px;
  align-items: center;
  flex-wrap: wrap;
}
#notice-text {
  flex: 1;
  min-width: 180px;
}
#notice-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
#notice-actions button {
  font-size: 0.8rem;
}
.mobile-only {
  display: none;
}
.auth-screen {
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: 24px;
  background: linear-gradient(120deg, #182b3a 0%, #182b3a 45%, #263f50 100%);
}
.auth-card {
  width: min(430px, 100%);
  background: #fff;
  padding: 44px 42px;
  border-radius: 12px;
  box-shadow: 0 24px 70px #06131f55;
}
.auth-card .brand-mark {
  background: #182b3a;
}
.auth-card h1 {
  font-size: 1.9rem;
  margin: 20px 0 12px;
  letter-spacing: -0.06em;
}
#auth-description {
  color: #68808e;
  line-height: 1.6;
  font-size: 0.9rem;
  margin-bottom: 30px;
}
.auth-card label {
  display: block;
  font-size: 0.875rem;
  font-weight: 600;
  margin: 16px 0;
}
.auth-card label input {
  display: block;
  margin-top: 8px;
}
.auth-card form button {
  width: 100%;
}
.privacy-note {
  color: #607986;
  font-size: 0.75rem;
  line-height: 1.8;
  border-top: 1px solid #e1e7eb;
  margin: 28px 0 0;
  padding-top: 22px;
}
.error {
  color: #a33330;
  font-size: 0.85rem;
  line-height: 1.6;
  min-height: 1.4em;
}
dialog {
  width: min(600px, 94vw);
  max-height: 85dvh;
  border: 1px solid #cfdae1;
  border-radius: 12px;
  padding: 26px;
  color: #233e50;
  box-shadow: 0 30px 90px #10203044;
}
dialog::backdrop {
  background: #142b3b66;
}
.dialog-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}
.dialog-heading h2 {
  font-size: 1.25rem;
  margin: 0;
}
dialog p {
  font-size: 0.85rem;
  line-height: 1.8;
  color: #597180;
}
.version-row {
  padding: 16px 0;
  border-bottom: 1px solid #e0e6ea;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.version-row small {
  display: block;
  font-size: 0.75rem;
  margin-top: 6px;
  color: #748591;
}
#toast {
  position: fixed;
  bottom: 22px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 10;
  background: #142d3f;
  color: #fff;
  padding: 14px 22px;
  border-radius: 8px;
  max-width: 90vw;
  box-shadow: 0 6px 24px #142b3b33;
  font-size: 0.9rem;
}
.empty-list {
  padding: 15px 10px;
  color: #adbfca;
  font-size: 0.85rem;
  line-height: 1.8;
}
@media (max-width: 900px) {
  .sidebar {
    width: 230px;
  }
  .document-header {
    gap: 10px;
    padding: 12px 16px;
  }
  .document-actions button {
    padding: 8px 10px;
    font-size: 0.8rem;
  }
}
@media (max-width: 680px) {
  .mobile-only {
    display: block;
  }
  .sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    width: min(320px, 90vw);
    z-index: 6;
    transform: translateX(-100%);
    transition: transform 0.18s;
    box-shadow: 12px 0 40px #152c3e33;
  }
  .workspace.sidebar-open .sidebar {
    transform: translateX(0);
  }
  .brand {
    padding: 0;
    gap: 10px;
  }
  .brand #close-sidebar {
    margin-left: auto;
    color: #fff;
    font-size: 0.75rem;
  }
  .document-header {
    flex-wrap: wrap;
    gap: 8px;
    padding: 10px 12px;
    min-height: 114px;
  }
  .document-heading {
    flex: 1;
    width: calc(100% - 65px);
  }
  .document-actions {
    width: 100%;
    justify-content: flex-end;
  }
  .document-actions button {
    min-height: 34px;
    padding: 6px 12px;
    font-size: 0.8rem;
  }
  #document-title {
    font-size: 1rem;
  }
  #save-status {
    font-size: 0.7rem;
  }
  .empty {
    padding: 25px 8px;
  }
  .empty h2 {
    font-size: 2.7rem;
  }
  .empty-foot {
    margin-top: 30px;
  }
  .auth-card {
    padding: 32px 26px;
  }
  .notice {
    padding: 10px 14px;
    gap: 8px;
  }
  dialog {
    padding: 20px;
  }
}
