@font-face {
  font-family: 'NanumBarunGothic';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('https://hangeul.pstatic.net/hangeul_static/webfont/NanumBarunGothic/NanumBarunGothicWeb.woff') format('woff');
}
@font-face {
  font-family: 'NanumBarunGothic';
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url('https://hangeul.pstatic.net/hangeul_static/webfont/NanumBarunGothic/NanumBarunGothicWebBold.woff') format('woff');
}

:root {
  color-scheme: light;
  --bg: #f5f1fa;
  --surface: #eee7f6;
  --paper: #fffefe;
  --ink: #372d45;
  --secondary: #655671;
  --muted: #6d5e7b;
  --line: #ded4e9;
  --green: #78549d;
  --accent: #8865ac;
  --tint: #eae0f5;
  --error: #9b4161;
  --sans: 'NanumBarunGothic', sans-serif;
  --lab-sync-font-family: 'NanumBarunGothic', sans-serif;
  --lab-sync-surface: var(--paper);
  --lab-sync-text: var(--ink);
  --lab-sync-border: var(--line);
  --lab-sync-accent: var(--green);
  --lab-sync-soft: var(--tint);
  --lab-sync-on-accent: #fff;
  --lab-sync-muted: var(--muted);
}

* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--ink); font-family: var(--sans); font-size: 14px; -webkit-font-smoothing: antialiased; }
button, input, textarea, select { font: inherit; }
button, a, input, textarea { -webkit-tap-highlight-color: transparent; }
button { color: inherit; cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: .45; }
a { color: inherit; text-decoration: none; }
button:focus-visible, a:focus-visible, input:focus-visible, textarea:focus-visible, summary:focus-visible { outline: 2px solid var(--accent); outline-offset: 4px; }
button:hover:not(:disabled) { filter: brightness(.97); }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
.skip-link { position: fixed; top: -100px; left: 20px; z-index: 50; padding: 12px; background: var(--green); color: #fff; }
.skip-link:focus { top: 10px; }

.app-shell { max-width: 1536px; margin: auto; padding: 0 4%; }
.masthead { min-height: 106px; border-bottom: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; gap: 20px; }
.brand { display: flex; align-items: center; gap: 17px; color: var(--green); }
.brand > span { font-size: 23px; font-weight: 700; letter-spacing: -.055em; color: var(--ink); }
.brand small { display: block; font: 9px var(--sans); letter-spacing: .19em; color: var(--muted); margin-top: 7px; }
.header-tools { display: flex; gap: 28px; align-items: center; }
.edition { color: var(--muted); font-size: 9px; letter-spacing: .16em; }
.edition b { color: var(--secondary); font-weight: 400; margin-left: 9px; }
.lab-back { display: none; font-size: 12px; color: var(--secondary); }
.from-lab .lab-back { display: inline; }
.button { background: var(--paper); border: 1px solid var(--line); padding: 11px 14px; border-radius: 7px; font-size: 12px; font-weight: 700; min-height: 40px; transition: background .15s, border-color .15s; }
.button span { margin-left: 14px; }
.button.subtle { background: var(--tint); border-color: var(--tint); color: var(--green); }
.button.primary { background: var(--green); border-color: var(--green); color: #fff; }
.button.wide { width: 100%; display: flex; align-items: center; justify-content: space-between; }

.workspace { display: grid; grid-template-columns: 225px minmax(300px, 1fr) 236px; gap: 32px; padding: 30px 0 28px; align-items: start; }
.archive, .shelf { min-width: 0; }
.section-label { font-size: 12px; font-weight: 700; display: flex; flex-direction: column; gap: 6px; margin-bottom: 22px; }
.section-label > span { font-weight: 400; font-size: 8px; letter-spacing: .17em; color: var(--muted); }
.calendar { min-width: 0; }
.calendar-toggle { display: flex; align-items: center; justify-content: space-between; width: 100%; min-height: 37px; margin: 0 0 12px; padding: 0 1px 10px; background: transparent; border: 0; border-bottom: 1px solid var(--line); color: var(--secondary); font-size: 12px; text-align: left; }
.calendar-toggle-icon { display: inline-flex; align-items: center; justify-content: center; width: 22px; height: 22px; color: var(--green); font-size: 18px; transition: transform .15s; }
.calendar-view-switch { display: flex; gap: 4px; padding: 4px; margin-bottom: 14px; background: var(--surface); border-radius: 8px; }
.calendar-view-switch button { flex: 1; min-width: 0; min-height: 32px; padding: 6px 8px; border: 0; border-radius: 5px; background: transparent; color: var(--secondary); font-size: 11px; }
.calendar-view-switch button.active, .calendar-view-switch button[aria-pressed="true"] { background: var(--paper); color: var(--green); font-weight: 700; box-shadow: 0 1px 4px #4930610e; }
.month-heading { display: flex; align-items: center; justify-content: space-between; gap: 3px; }
.month-heading h2 { font-size: 15px; letter-spacing: .015em; font-weight: 700; text-align: center; margin: 0; }
.icon-button { background: transparent; border: none; font: 24px var(--sans); color: var(--secondary); width: 31px; height: 36px; border-radius: 5px; flex-shrink: 0; }
.icon-button:hover { background: var(--tint); }
.weekdays, .calendar-days { display: grid; grid-template-columns: repeat(7, 1fr); text-align: center; }
.weekdays { font-size: 10px; color: var(--muted); padding: 14px 0 8px; }
.calendar-days { row-gap: 3px; }
.day { aspect-ratio: 1; border: 0; background: transparent; position: relative; font-size: 11px; border-radius: 50%; padding: 0; color: var(--secondary); }
.day:hover:not(:disabled) { background: var(--tint); }
.day.today { box-shadow: inset 0 0 0 1px var(--accent); }
.day.selected, .day.selected:hover { color: #fff; background: var(--green); font-weight: 700; }
.day.has-entry::after { content: ""; position: absolute; bottom: 4px; left: calc(50% - 1.5px); height: 3px; width: 3px; background: var(--accent); border-radius: 50%; }
.day.selected.has-entry::after { background: #fff; }
.period-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 7px; margin: 12px 0 22px; }
.period-button { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 7px; min-width: 0; min-height: 61px; padding: 10px 4px; border: 1px solid transparent; border-radius: 8px; background: var(--paper); color: var(--secondary); }
.period-label { font-size: 12px; line-height: 1.3; }
.period-count { font-size: 10px; line-height: 1.3; color: var(--muted); }
.period-button.has-entry { border-color: var(--line); }
.period-button.has-entry .period-count { color: var(--green); }
.period-button:hover:not(:disabled) { background: var(--tint); }
.period-button.selected, .period-button[aria-pressed="true"] { border-color: var(--accent); background: var(--tint); }
.period-button.selected .period-label, .period-button[aria-pressed="true"] .period-label { color: var(--green); font-weight: 700; }
.calendar-key { display: flex; align-items: center; gap: 5px; color: var(--muted); font-size: 10px; justify-content: flex-end; margin: 13px 0 23px; }
.calendar-key span { width: 3px; height: 3px; background: var(--accent); border-radius: 50%; }
.search { display: flex; align-items: center; gap: 10px; border: 1px solid var(--line); border-radius: 7px; padding: 11px 12px; color: var(--muted); background: var(--paper); }
.search input { width: 100%; min-width: 0; border: 0; background: transparent; color: var(--ink); outline: 0; font-size: 12px; }
.search:focus-within { border-color: var(--green); }
.search input::placeholder { color: var(--muted); }
.list-heading { display: flex; justify-content: space-between; align-items: center; margin: 24px 0 9px; gap: 8px; }
.list-heading h2 { font-size: 11px; font-weight: 700; margin: 0; }
.list-heading > span { font-size: 10px; color: var(--muted); }
.entry-list { max-height: max(385px, calc(100dvh - 650px)); overflow: auto; scrollbar-width: thin; scrollbar-color: #cbbadf transparent; }
.entry-link { display: block; width: 100%; text-align: left; border: 0; border-left: 2px solid transparent; border-bottom: 1px solid var(--line); background: transparent; padding: 14px 10px; border-radius: 0; color: var(--secondary); }
.entry-link:hover { background: var(--surface); }
.entry-link.active { border-left-color: var(--green); background: var(--tint); }
.entry-link time { font-size: 10px; color: var(--muted); display: block; margin-bottom: 6px; letter-spacing: .02em; }
.entry-link strong { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12px; font-weight: 400; line-height: 1.6; }
.empty-list { font-size: 12px; color: var(--muted); line-height: 1.9; padding: 19px 4px; }
.archive-foot { font: 12px/1.9 var(--sans); color: var(--muted); margin: 27px 10px; }

.notebook { display: flex; flex-direction: column; min-width: 0; min-height: max(840px, calc(100dvh - 220px)); border: 1px solid var(--line); border-radius: 10px; background: var(--paper); padding: 25px 32px 0; box-shadow: 0 8px 30px #61477709; position: relative; }
.notebook::before { content: ""; position: absolute; right: 31px; top: -1px; width: 12px; height: 27px; background: #c9b3e4; clip-path: polygon(0 0, 100% 0, 100% 100%, 50% 78%, 0 100%); }
.paper-top { display: flex; justify-content: space-between; gap: 10px; padding-right: 26px; min-height: 36px; }
.paper-top > span:first-child { font-size: 8px; letter-spacing: .15em; color: var(--muted); }
#save-status { font-size: 10px; color: var(--green); }
#save-status.error { color: var(--error); }
.date-line { display: flex; justify-content: space-between; align-items: end; gap: 12px; margin: 22px 0 26px; }
.eyebrow { color: var(--green); font-size: 10px; letter-spacing: .1em; margin: 0 0 10px; }
h1 { font: 400 34px/1.3 var(--sans); letter-spacing: -.045em; margin: 0; }
.date-picker input { background: var(--paper); border: 1px solid var(--line); border-radius: 5px; color: var(--secondary); font-size: 10px; padding: 7px; max-width: 123px; }
.rule { display: flex; gap: 15px; align-items: center; margin-bottom: 25px; }
.rule span { color: var(--muted); font: 12px var(--sans); white-space: nowrap; }
.rule i { height: 1px; background: var(--line); flex: 1; }
textarea { flex: 1 0 auto; resize: vertical; width: 100%; height: clamp(520px, calc(100dvh - 520px), 1120px); min-height: 520px; display: block; border: 0; background: transparent; color: var(--ink); font: 16px/2.05 var(--sans); letter-spacing: -.015em; padding: 0 0 20px; outline: 0 !important; scrollbar-width: thin; scrollbar-color: #cbbadf transparent; }
textarea::placeholder { color: var(--muted); opacity: .85; font-family: var(--sans); font-size: 16px; line-height: 2.05; }
textarea:focus-visible { box-shadow: -2px 0 var(--line); padding-left: 10px; }
.editor-bottom { display: flex; justify-content: space-between; gap: 15px; font-size: 10px; color: var(--muted); padding: 18px 0; border-bottom: 1px solid var(--line); }
.editor-actions { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 17px 0; }
.editor-actions > div { display: flex; gap: 20px; }
.text-button { border: 0; background: transparent; padding: 5px 0; color: var(--secondary); font-size: 11px; line-height: 1.6; min-height: 30px; text-align: left; }
.text-button span { margin-left: 7px; }
.text-button:hover:not(:disabled) { color: var(--green); }
.text-button.muted { color: var(--muted); }

.sync-card { border: 1px solid var(--line); border-radius: 9px; padding: 21px 20px; margin-bottom: 17px; }
.card-heading { display: flex; align-items: center; justify-content: space-between; height: 27px; margin-bottom: 17px; }
.service-icon { font-size: 30px; line-height: 1; color: var(--secondary); }
.status-dot { width: 6px; height: 6px; border-radius: 100%; background: var(--muted); }
.status-dot.online { background: var(--green); }
.sync-card h2 { font-size: 15px; font-weight: 700; letter-spacing: -.02em; margin: 0 0 11px; }
.card-description { color: var(--secondary); font-size: 12px; line-height: 1.85; margin: 0 0 18px; }
.service-status { font-size: 10px; line-height: 1.75; color: var(--muted); margin: 13px 0; overflow-wrap: anywhere; }
.service-status.error { color: var(--error); }
.fine-print { font-size: 10px; line-height: 1.7; color: var(--muted); margin: 12px 0 0; }
.folder-card { background: var(--surface); }
.folder-icon { color: var(--accent); }
.mini-label { font-size: 8px; letter-spacing: .1em; color: var(--muted); }
.folder-location { border: 1px solid var(--line); border-radius: 6px; padding: 11px 12px; margin: 18px 0 15px; background: #f9f6fc; }
.folder-location > span { display: block; font-size: 9px; letter-spacing: 0; }
.folder-location strong { font-size: 11px; font-weight: 400; display: block; color: var(--secondary); margin: 7px 0 2px; overflow-wrap: anywhere; }
.folder-location .text-button { font-size: 10px; color: var(--green); }
.backup-button { display: flex; justify-content: space-between; width: 100%; font-size: 10px; border-bottom: 1px solid var(--line); padding: 4px 0 16px; }
.shelf-note { font-size: 10px; line-height: 1.85; color: var(--muted); margin: 17px 0; }
.page-footer { display: flex; justify-content: space-between; gap: 15px; border-top: 1px solid var(--line); padding: 20px 0 25px; color: var(--muted); font-size: 9px; letter-spacing: .04em; }
.page-footer i { font-style: normal; margin: 0 8px; }
.page-footer > span:last-child { font-family: var(--sans); letter-spacing: 0; font-size: 11px; }
.notice, .conflict { padding: 12px 14px; background: var(--tint); border: 1px solid #c7b2df; border-radius: 7px; color: var(--secondary); font-size: 12px; line-height: 1.7; margin-bottom: 20px; }
.conflict p { margin: 0 0 9px; }
.conflict pre { font: 12px/1.7 var(--sans); white-space: pre-wrap; overflow-wrap: anywhere; max-height: 180px; overflow: auto; }
.button-row { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.full { display: block; width: 100%; text-align: center; }

@media (min-width: 1400px) {
  .workspace { grid-template-columns: 245px minmax(300px, 1fr) 253px; gap: 42px; }
  .notebook { padding-left: 43px; padding-right: 43px; }
}
@media (max-width: 1100px) {
  .workspace { grid-template-columns: 205px minmax(280px, 1fr); gap: 25px; }
  .shelf { grid-column: 1 / -1; display: grid; grid-template-columns: 1fr 1fr; gap: 16px; align-items: start; }
  .shelf > .section-label { grid-column: 1 / -1; margin: 8px 0 0; }
  .shelf .folder-card { grid-column: 1; grid-row: 2 / 4; }
  .sync-card { margin: 0; }
  .card-description br { display: none; }
  .backup-button { grid-column: 2; align-self: start; }
  .shelf-note { grid-column: 2; margin: 0; }
  .notebook { padding: 24px 25px 0; }
  .edition { display: none; }
}
@media (max-width: 650px) {
  .app-shell { padding: 0 18px; }
  .masthead { min-height: 92px; gap: 12px; }
  .brand { gap: 11px; }
  .brand > span { font-size: 20px; }
  .brand small { font-size: 7px; letter-spacing: .12em; }
  .brand svg { width: 26px; }
  .header-tools { gap: 12px; }
  .header-tools .button { font-size: 11px; padding: 8px 10px; }
  .lab-back { font-size: 10px; }
  .workspace { display: flex; flex-direction: column; gap: 24px; padding-top: 24px; }
  .archive { width: 100%; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 12px 20px; }
  .archive > .section-label { grid-column: 1 / -1; margin: 0 0 2px; }
  .calendar { grid-column: 1; grid-row: 2 / 6; }
  .calendar-key { margin-bottom: 0; }
  .calendar-view-switch { gap: 2px; }
  .period-grid { gap: 5px; margin-bottom: 0; }
  .period-button { min-height: 57px; padding: 8px 2px; }
  .period-label { font-size: 11px; }
  .period-count { font-size: 9px; }
  .month-heading h2 { font-size: 13px; }
  .icon-button { width: 26px; }
  .search { grid-column: 2; grid-row: 2; padding: 8px; align-self: start; }
  .list-heading { grid-column: 2; grid-row: 3; margin: 0; align-self: start; }
  .entry-list { grid-column: 2; grid-row: 4 / 6; max-height: 300px; align-self: start; }
  .entry-link { padding: 10px; }
  .archive-foot { display: none; }
  .notebook { width: 100%; min-height: 760px; padding: 23px 21px 0; }
  .paper-top { padding-right: 10px; gap: 6px; }
  .paper-top > span:first-child { font-size: 7px; }
  #save-status { font-size: 9px; }
  .notebook::before { right: 15px; width: 9px; height: 18px; }
  .date-line { margin-top: 20px; flex-wrap: wrap; }
  h1 { font-size: 30px; }
  .date-picker input { font-size: 10px; }
  textarea { font-size: 16px; height: 470px; min-height: 470px; }
  .editor-actions { flex-wrap: wrap; }
  .editor-actions > div { gap: 13px; }
  .editor-actions .text-button { font-size: 10px; }
  .shelf { width: 100%; display: grid; gap: 14px; }
  .sync-card { padding: 17px 15px; }
  .button.wide { font-size: 11px; padding: 10px; }
  .button.wide span { margin-left: 4px; }
  .page-footer { flex-direction: column; gap: 8px; padding-bottom: 65px; }
  .shelf-note { font-size: 10px; }
  .backup-button { font-size: 10px; }
  .empty-list { font-size: 11px; padding-top: 5px; }
}
@media (max-width: 420px) {
  .archive { display: block; }
  .archive > .section-label { margin-bottom: 18px; }
  .calendar { margin-bottom: 20px; }
  .calendar-view-switch button { min-height: 36px; }
  .period-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .period-button { min-height: 62px; }
  .period-label { font-size: 12px; }
  .period-count { font-size: 10px; }
  .month-heading h2 { font-size: 15px; }
  .day { max-height: 42px; }
  .search { padding: 11px 12px; }
  .list-heading { margin: 20px 0 9px; }
  .entry-list { max-height: 215px; }
  .shelf { grid-template-columns: 1fr; }
  .shelf > .section-label { grid-column: 1; }
  .shelf .folder-card, .backup-button, .shelf-note { grid-column: 1; grid-row: auto; }
  .notebook { padding-left: 18px; padding-right: 18px; }
  .editor-bottom { flex-wrap: wrap; gap: 8px; }
}
@media (prefers-reduced-motion: reduce) {
  * { scroll-behavior: auto !important; transition: none !important; }
}
