:root {
  color-scheme: dark;
  --bg: #070b15;
  --bg-soft: #0c1222;
  --panel: #121a2b;
  --panel-2: #182235;
  --ink: #eef4ff;
  --muted: #a8b3c7;
  --line: #27344d;
  --line-strong: #3a4b6a;
  --blue: #89d8ff;
  --violet: #b38cff;
  --green: #9bed88;
  --gold: #ffd46b;
  --shadow: 0 28px 80px rgba(0, 0, 0, 0.38);
  font-family: Pretendard, "Noto Sans KR", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

body.light {
  color-scheme: light;
  --bg: #e8edf5;
  --bg-soft: #dfe6f1;
  --panel: #f7f9fd;
  --panel-2: #eef3fa;
  --ink: #1d2638;
  --muted: #5f6c80;
  --line: #c9d2df;
  --line-strong: #b8c4d4;
  --shadow: 0 22px 62px rgba(35, 48, 72, 0.16);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at 18% 0%, rgba(94, 137, 255, 0.22), transparent 34rem),
    radial-gradient(circle at 82% 12%, rgba(179, 140, 255, 0.2), transparent 30rem),
    var(--bg);
  color: var(--ink);
}

body.light {
  background:
    radial-gradient(circle at 18% 0%, rgba(107, 151, 214, 0.22), transparent 34rem),
    radial-gradient(circle at 82% 12%, rgba(156, 132, 202, 0.16), transparent 30rem),
    var(--bg);
}

button,
input,
a {
  font: inherit;
}

button,
.button {
  min-height: 40px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: linear-gradient(135deg, #8fd6ff, #b994ff);
  color: #07101f;
  font-weight: 800;
  padding: 9px 14px;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
}

button:hover,
.button:hover {
  filter: brightness(1.06);
}

.ghost {
  background: rgba(255, 255, 255, 0.08);
  color: var(--ink);
}

.small {
  min-height: 34px;
  padding: 7px 11px;
  font-size: 13px;
}

.site-head {
  width: min(100% - 32px, 1120px);
  margin: 0 auto;
  min-height: 72px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.brand {
  color: var(--ink);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 900;
  letter-spacing: 0;
}

.brand-mark {
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: linear-gradient(135deg, #8fd6ff, #b994ff);
  color: #101827;
}

.page {
  width: min(100% - 32px, 1120px);
  margin: 0 auto 64px;
}

.hero {
  min-height: 350px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background:
    linear-gradient(130deg, rgba(125, 211, 252, 0.18), rgba(179, 140, 255, 0.14) 54%, rgba(255, 255, 255, 0.03)),
    rgba(18, 26, 43, 0.86);
  box-shadow: var(--shadow);
  padding: clamp(28px, 6vw, 44px);
  display: grid;
  align-content: center;
  gap: 18px;
}

.pill {
  width: max-content;
  max-width: 100%;
  border: 1px solid rgba(137, 216, 255, 0.42);
  border-radius: 999px;
  background: rgba(137, 216, 255, 0.13);
  color: #cdefff;
  padding: 7px 13px;
  font-size: 13px;
  font-weight: 800;
}

body.light .pill {
  color: #22627f;
}

.hero h1 {
  margin: 0;
  font-size: clamp(64px, 12vw, 104px);
  line-height: 0.9;
  letter-spacing: 0;
}

.hero p {
  margin: 0;
  color: var(--muted);
  font-size: 17px;
  line-height: 1.7;
  max-width: 760px;
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-top: 14px;
}

.metric-grid div {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(7, 11, 21, 0.24);
  padding: 17px;
}

.metric-grid strong,
.metric-grid span {
  display: block;
}

.metric-grid strong {
  font-size: 22px;
}

.metric-grid span {
  margin-top: 7px;
  color: var(--muted);
  font-size: 13px;
}

.notice,
.toolbar,
.note-section {
  margin-top: 24px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(18, 26, 43, 0.78);
}

body.light .notice,
body.light .toolbar,
body.light .note-section,
body.light .hero {
  background-color: rgba(247, 249, 253, 0.86);
}

.notice {
  padding: 22px 24px;
}

.notice strong {
  display: block;
  margin-bottom: 8px;
}

.notice p {
  margin: 0;
  color: var(--muted);
  line-height: 1.65;
}

.notice.safe {
  border-color: #264064;
}

.notice.safe::before {
  content: "◆";
  color: var(--blue);
  margin-right: 10px;
}

.notice.comet {
  border-color: rgba(255, 212, 107, 0.64);
}

.notice.comet::before {
  content: "※";
  color: var(--gold);
  margin-right: 10px;
  font-weight: 900;
}

.guide-link,
.mini-guide {
  width: max-content;
  max-width: 100%;
  margin-top: 14px;
  border: 1px solid rgba(255, 212, 107, 0.55);
  border-radius: 8px;
  background: rgba(255, 212, 107, 0.15);
  color: var(--ink);
  text-decoration: none;
  font-weight: 800;
  display: inline-flex;
  padding: 9px 13px;
}

.mini-guide {
  margin: 4px 0 12px;
  font-size: 12px;
}

.toolbar {
  padding: 16px;
}

.toolbar label {
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

input[type="search"] {
  width: 100%;
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(7, 11, 21, 0.28);
  color: var(--ink);
  padding: 0 14px;
  outline: none;
}

body.light input[type="search"] {
  background: #f9fbff;
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.filter-grid {
  display: grid;
  gap: 12px;
  margin-top: 14px;
}

.filter-row {
  display: grid;
  grid-template-columns: 54px minmax(0, 1fr);
  align-items: center;
  gap: 10px;
}

.filter-row > span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 900;
}

.filter-row .chips {
  margin-top: 0;
}

.chip {
  min-height: 34px;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  font-weight: 700;
}

.chip.active {
  color: #101827;
  background: linear-gradient(135deg, #8fd6ff, #b994ff);
}

.sections {
  display: grid;
  gap: 26px;
  margin-top: 24px;
}

.note-section {
  overflow: hidden;
}

.note-section details {
  display: block;
}

.note-section summary {
  min-height: 118px;
  list-style: none;
  cursor: pointer;
  padding: 24px;
  border-bottom: 1px solid var(--line);
}

.note-section summary::-webkit-details-marker {
  display: none;
}

.note-section summary::after {
  content: "∨";
  float: right;
  font-weight: 900;
  color: var(--ink);
}

.note-section em,
.eyebrow {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-style: normal;
  font-weight: 900;
  letter-spacing: 0.12em;
}

.note-section strong {
  display: block;
  margin-top: 8px;
  font-size: 28px;
}

.note-section small {
  display: block;
  margin-top: 8px;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.5;
}

.card-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  padding: 14px;
}

.note-card {
  min-height: 220px;
  border: 1px solid var(--line-strong);
  border-top: 3px solid var(--blue);
  border-radius: 8px;
  background:
    linear-gradient(150deg, rgba(255, 255, 255, 0.06), transparent 52%),
    var(--panel-2);
  padding: 16px;
  display: flex;
  flex-direction: column;
}

.lite .note-card {
  border-top-color: var(--green);
}

.casual .note-card {
  border-top-color: var(--gold);
}

.deep .note-card {
  border-top-color: var(--violet);
}

.code {
  width: max-content;
  border: 1px solid currentColor;
  border-radius: 999px;
  color: var(--green);
  padding: 3px 9px;
  font-size: 12px;
  font-weight: 900;
}

.standard .code {
  color: var(--blue);
}

.casual .code {
  color: var(--gold);
}

.deep .code {
  color: var(--violet);
}

.note-card h3 {
  margin: 16px 0 8px;
  font-size: 19px;
}

.note-card p {
  margin: 0;
  color: var(--muted);
  line-height: 1.55;
}

.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: auto;
  padding-top: 18px;
}

.tags span {
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  padding: 4px 8px;
  font-size: 12px;
}

.card-actions {
  display: flex;
  gap: 8px;
  margin-top: 12px;
}

.dialog {
  width: min(100% - 28px, 980px);
  max-height: min(86vh, 840px);
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: var(--panel);
  color: var(--ink);
  padding: 0;
  box-shadow: var(--shadow);
}

.dialog::backdrop {
  background: rgba(0, 0, 0, 0.68);
}

.dialog-head,
.dialog-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px;
  border-bottom: 1px solid var(--line);
}

.dialog-head h2 {
  margin: 4px 0 0;
}

.dialog-actions {
  border-top: 1px solid var(--line);
  border-bottom: 0;
  justify-content: flex-end;
}

.preview {
  margin: 0;
  padding: 18px;
  max-height: 58vh;
  overflow: auto;
  white-space: pre-wrap;
  word-break: keep-all;
  overflow-wrap: anywhere;
  font-family: "D2Coding", "Cascadia Mono", Consolas, monospace;
  font-size: 13px;
  line-height: 1.62;
  background: rgba(7, 11, 21, 0.3);
}

.empty {
  margin: 0;
  border: 1px dashed var(--line);
  border-radius: 8px;
  color: var(--muted);
  padding: 22px;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 22px;
  transform: translateX(-50%) translateY(18px);
  opacity: 0;
  pointer-events: none;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: var(--panel);
  color: var(--ink);
  padding: 11px 14px;
  box-shadow: var(--shadow);
  transition: opacity 150ms ease, transform 150ms ease;
}

.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

@media (max-width: 820px) {
  .metric-grid,
  .card-grid {
    grid-template-columns: 1fr;
  }

  .hero {
    min-height: auto;
  }
}

@media (max-width: 560px) {
  .site-head,
  .page {
    width: min(100% - 22px, 1120px);
  }

  .site-head {
    min-height: 62px;
  }

  .hero,
  .notice,
  .toolbar,
  .note-section summary {
    padding: 18px;
  }

  .card-grid {
    padding: 10px;
  }

  .filter-row {
    grid-template-columns: 1fr;
    gap: 7px;
  }

  .card-actions,
  .dialog-actions {
    flex-direction: column;
    align-items: stretch;
  }
}
