@font-face {
  font-family: "Pretendard";
  src: url("https://cdn.jsdelivr.net/gh/projectnoonnu/pretendard@1.0/Pretendard-Regular.woff2") format("woff2");
  font-weight: 400;
  font-display: swap;
}

@font-face {
  font-family: "Pretendard";
  src: url("https://cdn.jsdelivr.net/gh/projectnoonnu/pretendard@1.0/Pretendard-Bold.woff2") format("woff2");
  font-weight: 700;
  font-display: swap;
}

@font-face {
  font-family: "KoPub Batang";
  src: url("https://cdn.jsdelivr.net/npm/font-kopub@1.0/fonts/KoPubBatang-Medium.woff") format("woff");
  font-weight: 400;
  font-display: swap;
}

@font-face {
  font-family: "KoPub Dotum";
  src: url("https://cdn.jsdelivr.net/npm/font-kopub@1.0/fonts/KoPubDotum-Medium.woff") format("woff");
  font-weight: 400;
  font-display: swap;
}

@font-face {
  font-family: "SUIT";
  src: url("https://cdn.jsdelivr.net/gh/sunn-us/SUIT/fonts/static/woff2/SUIT-Regular.woff2") format("woff2");
  font-weight: 400;
  font-display: swap;
}

@font-face {
  font-family: "SUIT";
  src: url("https://cdn.jsdelivr.net/gh/sunn-us/SUIT/fonts/static/woff2/SUIT-Bold.woff2") format("woff2");
  font-weight: 700;
  font-display: swap;
}

@font-face {
  font-family: "Gmarket Sans";
  src: url("https://cdn.jsdelivr.net/gh/projectnoonnu/noonfonts_2001@1.1/GmarketSansMedium.woff") format("woff");
  font-weight: 500;
  font-display: swap;
}

@font-face {
  font-family: "Gmarket Sans";
  src: url("https://cdn.jsdelivr.net/gh/projectnoonnu/noonfonts_2001@1.1/GmarketSansBold.woff") format("woff");
  font-weight: 700;
  font-display: swap;
}

@font-face {
  font-family: "Chosunilbo_myungjo";
  src: url("https://cdn.jsdelivr.net/gh/projectnoonnu/noonfonts_20-04@1.0/Chosunilbo_myungjo.woff") format("woff");
  font-weight: 400;
  font-display: swap;
}

@font-face {
  font-family: "MaruBuri";
  src: url("https://hangeul.pstatic.net/hangeul_static/webfont/MaruBuri/MaruBuri-Regular.eot");
  src: url("https://hangeul.pstatic.net/hangeul_static/webfont/MaruBuri/MaruBuri-Regular.eot?#iefix") format("embedded-opentype"),
    url("https://hangeul.pstatic.net/hangeul_static/webfont/MaruBuri/MaruBuri-Regular.woff2") format("woff2"),
    url("https://hangeul.pstatic.net/hangeul_static/webfont/MaruBuri/MaruBuri-Regular.woff") format("woff"),
    url("https://hangeul.pstatic.net/hangeul_static/webfont/MaruBuri/MaruBuri-Regular.ttf") format("truetype");
  font-weight: 400;
  font-display: swap;
}

@font-face {
  font-family: "MaruBuri";
  src: url("https://hangeul.pstatic.net/hangeul_static/webfont/MaruBuri/MaruBuri-Bold.eot");
  src: url("https://hangeul.pstatic.net/hangeul_static/webfont/MaruBuri/MaruBuri-Bold.eot?#iefix") format("embedded-opentype"),
    url("https://hangeul.pstatic.net/hangeul_static/webfont/MaruBuri/MaruBuri-Bold.woff2") format("woff2"),
    url("https://hangeul.pstatic.net/hangeul_static/webfont/MaruBuri/MaruBuri-Bold.woff") format("woff"),
    url("https://hangeul.pstatic.net/hangeul_static/webfont/MaruBuri/MaruBuri-Bold.ttf") format("truetype");
  font-weight: 700;
  font-display: swap;
}

@font-face {
  font-family: "GimpoPeaceFoundation";
  src: url("https://cdn.jsdelivr.net/gh/projectnoonnu/noonfonts_20-04@2.1/GimpoBatang00.woff") format("woff");
  font-weight: 400;
  font-display: swap;
}

@font-face {
  font-family: "BookkMyungjo";
  src: url("https://cdn.jsdelivr.net/gh/projectnoonnu/noonfonts_2302@1.0/BookkMyungjo-Lt.woff2") format("woff2");
  font-weight: 400;
  font-display: swap;
}

@font-face {
  font-family: "BookkMyungjo";
  src: url("https://cdn.jsdelivr.net/gh/projectnoonnu/noonfonts_2302@1.0/BookkMyungjo-Bd.woff2") format("woff2");
  font-weight: 700;
  font-display: swap;
}

@font-face {
  font-family: "OngleipParkDahyeon";
  src: url("https://cdn.jsdelivr.net/gh/projectnoonnu/2411-3@1.0/Ownglyph_ParkDaHyun.woff2") format("woff2");
  font-weight: 400;
  font-display: swap;
}

@font-face {
  font-family: "IsYun";
  src: url("https://cdn.jsdelivr.net/gh/projectnoonnu/noonfonts_2202-2@1.0/LeeSeoyun.woff") format("woff");
  font-weight: 400;
  font-display: swap;
}

@font-face {
  font-family: "HeirofLight";
  src: url("https://cdn.jsdelivr.net/gh/projectnoonnu/noonfonts_20-10@1.0/HeirofLightBold.woff") format("woff");
  font-weight: 700;
  font-display: swap;
}

@font-face {
  font-family: "DnfTemperedBlade";
  src: url("https://cdn.df.nexon.com/img/common/font/DNFForgedBlade-Light.otf") format("opentype");
  font-weight: 300;
  font-display: swap;
}

@font-face {
  font-family: "DnfTemperedBlade";
  src: url("https://cdn.df.nexon.com/img/common/font/DNFForgedBlade-Medium.otf") format("opentype");
  font-weight: 500;
  font-display: swap;
}

@font-face {
  font-family: "DnfTemperedBlade";
  src: url("https://cdn.df.nexon.com/img/common/font/DNFForgedBlade-Bold.otf") format("opentype");
  font-weight: 700;
  font-display: swap;
}

@font-face {
  font-family: "DungeonFighterOnlineBeatBeat";
  src: url("https://cdn.df.nexon.com/img/common/font/DNFBitBit-Regular.woff2") format("woff2"),
    url("https://cdn.df.nexon.com/img/common/font/DNFBitBit-Regular.woff") format("woff");
  font-weight: 400;
  font-display: swap;
}

:root {
  --ink: #242424;
  --muted: #747b80;
  --line: #d7dee1;
  --panel: #f7f9f9;
  --paper: #ffffff;
  --accent: #242424;
  --accent-dark: #171717;
  --soft: #eef1f2;
  --paper-width: 860px;
  --body-size: 15px;
  --body-leading: 1.88;
  --note-font: "Pretendard";
  font-family: "Pretendard", "Apple SD Gothic Neo", "Malgun Gothic", system-ui, sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: #f8f9f9;
  color: var(--ink);
}

button,
input,
textarea,
select {
  font: inherit;
}

button {
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  padding: 8px 12px;
  font-weight: 700;
  cursor: pointer;
}

button:hover {
  border-color: var(--accent);
}

button:disabled {
  color: #aeb8bc;
  cursor: default;
  background: #f5f7f7;
}

button:disabled:hover {
  border-color: var(--line);
}

.primary {
  border-color: var(--accent-dark);
  background: var(--accent-dark);
  color: #fff;
}

.note-app {
  display: grid;
  grid-template-columns: minmax(400px, 430px) minmax(0, 1fr);
  min-height: 100vh;
}

.editor {
  overflow: auto;
  height: 100vh;
  padding: 0 24px 40px;
  border-right: 1px solid var(--line);
  background: rgba(247, 249, 249, 0.94);
  scrollbar-gutter: stable;
}

.editor-head {
  position: relative;
  z-index: 2;
  display: grid;
  gap: 12px;
  margin: 0 -24px;
  padding: 22px 24px 18px;
  border-bottom: 1px solid var(--line);
  background: #f7f9f9;
}

.editor-brand {
  display: flex;
  align-items: center;
  gap: 10px;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  font-size: 20px;
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--accent-dark);
  font-size: 11px;
  font-weight: 700;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-family: "KoPub Batang", "Pretendard", serif;
  font-size: 24px;
  line-height: 1;
}

.page-tabs {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.page-tabs a {
  display: grid;
  place-items: center;
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  font-size: 13px;
  font-weight: 800;
  text-decoration: none;
}

.page-tabs a.active {
  border-color: var(--accent-dark);
  background: var(--accent-dark);
  color: #fff;
}

h2 {
  font-size: 17px;
  font-weight: 800;
}

.panel-block {
  display: grid;
  gap: 12px;
  padding: 22px 0;
  border-bottom: 1px solid #e3e8ea;
}

.block-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

label {
  display: grid;
  gap: 7px;
  font-size: 13px;
  font-weight: 800;
}

input,
textarea,
select {
  width: 100%;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  color: var(--ink);
  padding: 10px 12px;
  outline: none;
  font-weight: 600;
}

textarea {
  min-height: 140px;
  resize: vertical;
  line-height: 1.55;
}

input:focus,
textarea:focus,
select:focus {
  border-color: var(--accent-dark);
  box-shadow: 0 0 0 4px rgba(135, 169, 173, 0.18);
}

input[type="color"] {
  height: 42px;
  padding: 4px;
}

.theme-presets,
.writing-tools,
.stats-row,
.export-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.focus-exit {
  display: none;
}

.theme-button {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 34px;
  padding: 6px 10px;
  font-size: 13px;
}

.template-cards {
  display: grid;
  gap: 9px;
}

.template-card {
  display: grid;
  gap: 6px;
  justify-items: start;
  text-align: left;
  min-height: 0;
  padding: 13px;
  border-radius: 12px;
}

.template-card:hover {
  background: #fff;
  box-shadow: 0 8px 24px rgba(70, 91, 96, 0.08);
}

.template-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  gap: 10px;
}

.template-card span:not(.template-card-head):not(.theme-chip) {
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
  line-height: 1.45;
}

.template-card small {
  color: var(--accent-dark);
  font-size: 12px;
  font-weight: 800;
}

.note-save-list {
  display: grid;
  gap: 8px;
  max-height: 220px;
  overflow: auto;
  padding-right: 2px;
}

.note-save-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 54px;
  gap: 8px;
}

.note-save-load {
  display: grid;
  justify-items: start;
  min-height: 54px;
  padding: 9px 11px;
  text-align: left;
}

.note-save-load strong,
.note-save-load small {
  display: block;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.note-save-load small {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.note-save-item.active .note-save-load {
  border-color: var(--accent-dark);
  box-shadow: inset 0 0 0 1px var(--accent-dark);
}

.note-save-delete {
  min-height: 54px;
  padding-inline: 8px;
}

.empty-note-save {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.theme-chip {
  width: 18px;
  height: 18px;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: var(--chip);
}

.color-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.stats-row span,
#previewStats {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  border-radius: 999px;
  background: var(--soft);
  color: var(--muted);
  padding: 4px 10px;
  font-size: 12px;
  font-weight: 800;
}

.scratch {
  min-height: 110px;
}

.stack {
  display: grid;
  gap: 10px;
}

.meta-row,
.section-card {
  display: grid;
  gap: 8px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.78);
}

.meta-row {
  grid-template-columns: 1fr 1.4fr 42px;
}

.section-actions {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr 52px;
  gap: 8px;
}

.button-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.danger {
  color: #9b5151;
}

.hint {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.preview-wrap {
  min-width: 0;
  display: grid;
  grid-template-rows: auto 1fr;
  overflow: auto;
}

.preview-toolbar {
  position: sticky;
  top: 0;
  z-index: 3;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 58px;
  padding: 0 30px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.82);
  backdrop-filter: blur(12px);
}

.note-paper {
  width: min(var(--paper-width), calc(100% - 64px));
  min-height: 1020px;
  margin: 40px auto;
  padding: 58px 64px;
  border: 1px solid var(--line);
  background: var(--paper);
  color: var(--ink);
  font-family: var(--note-font), "Pretendard", "Apple SD Gothic Neo", "Malgun Gothic", serif;
  box-shadow: 0 20px 70px rgba(70, 91, 96, 0.11);
}

.paper-head {
  position: relative;
  padding-bottom: 28px;
}

.paper-alias {
  position: absolute;
  left: 36px;
  top: -24px;
  color: color-mix(in srgb, var(--accent) 45%, transparent);
  font-size: 24px;
  font-style: italic;
}

.paper-title {
  color: var(--ink);
  font-size: 38px;
  font-weight: 700;
  line-height: 1.1;
}

.editable-text {
  min-width: 1.2em;
  border-radius: 6px;
  outline: 0;
  transition: background 0.14s ease, box-shadow 0.14s ease;
}

.editable-text:hover {
  background: color-mix(in srgb, var(--accent) 7%, transparent);
}

.editable-text:focus {
  background: color-mix(in srgb, var(--accent) 10%, transparent);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent) 22%, transparent);
}

.editable-text:empty::before {
  content: attr(data-placeholder);
  color: color-mix(in srgb, var(--muted) 70%, transparent);
}

.meta-list {
  display: grid;
  gap: 9px;
  max-width: 360px;
  margin-top: 26px;
}

.meta-line {
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr);
  gap: 16px;
  align-items: center;
  color: var(--muted);
  font-size: 14px;
}

.meta-label {
  display: inline-flex;
  justify-content: center;
  border-radius: 8px;
  background: var(--accent);
  color: #fff;
  padding: 4px 10px;
  font-size: 12px;
  font-weight: 800;
}

.quote {
  margin: 28px 0 34px;
  padding: 8px 0 8px 20px;
  border-left: 5px solid var(--accent);
  color: var(--ink);
  font-size: 18px;
  font-weight: 800;
  line-height: 1.6;
}

.note-section {
  margin-top: 30px;
}

.note-section h3 {
  margin: 0 0 14px;
  color: var(--accent-dark);
  font-size: 19px;
}

.note-section-body {
  white-space: pre-wrap;
  color: var(--ink);
  font-size: var(--body-size);
  line-height: var(--body-leading);
}

.boxed-section {
  padding: 28px 32px;
  border: 2px solid var(--ink);
}

.boxed-section .note-section-body {
  line-height: 1.78;
}

details.note-section {
  border: 2px solid var(--ink);
  padding: 0;
}

details.note-section summary {
  cursor: pointer;
  padding: 12px 16px;
  color: var(--ink);
  font-weight: 800;
}

details.note-section .note-section-body {
  padding: 16px 32px 30px;
}

.signature {
  margin-top: 40px;
  color: #a3adb2;
  text-align: right;
  font-size: 13px;
  font-weight: 700;
}

.empty-paper {
  color: var(--muted);
  font-size: 15px;
  line-height: 1.7;
}

.focus-mode .editor {
  display: none;
}

.focus-mode .note-app {
  display: block;
}

.focus-mode .preview-wrap {
  min-height: 100vh;
}

.focus-mode .focus-exit {
  display: inline-flex;
}

@media (max-width: 980px) {
  .note-app {
    grid-template-columns: 1fr;
  }

  .editor {
    height: auto;
    max-height: none;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .note-paper {
    width: min(100% - 28px, 760px);
    margin: 22px auto;
    padding: 42px 28px;
  }
}

@media (max-width: 520px) {
  .meta-row {
    grid-template-columns: 1fr;
  }

  .section-actions {
    grid-template-columns: 1fr 1fr;
  }

  .preview-toolbar {
    padding: 0 16px;
    align-items: flex-start;
    flex-direction: column;
    padding-block: 12px;
  }

  .note-paper {
    padding: 36px 22px;
  }

  .color-grid {
    grid-template-columns: 1fr;
  }

  .paper-title {
    font-size: 32px;
  }
}

@media print {
  body {
    background: #fff;
  }

  .editor,
  .preview-toolbar {
    display: none;
  }

  .note-app {
    display: block;
  }

  .note-paper {
    width: 100%;
    margin: 0;
    border: 0;
    box-shadow: none;
  }
}
