@import url('https://cdn.jsdelivr.net/gh/orioncactus/pretendard@v1.3.9/dist/web/variable/pretendardvariable-dynamic-subset.min.css');

:root {
  --paper: #fbf7ef;
  --card: #ffffff;
  --ink: #26241f;
  --muted: #6b665c;
  --line: #e4ddcd;
  --accent: #2754c5;
  --accent-soft: #e7eefc;
  --yellow: #fff2bf;
  --green: #dcf5e3;
  --pink: #fde4ec;
  --blue: #e3eefc;
  --danger: #c0392b;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(38, 36, 31, 0.06), 0 4px 14px rgba(38, 36, 31, 0.06);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: 'Pretendard Variable', Pretendard, -apple-system, BlinkMacSystemFont, 'Apple SD Gothic Neo', 'Malgun Gothic', sans-serif;
  font-size: 17px;
  line-height: 1.65;
  word-break: keep-all;
  overflow-wrap: break-word;
}
a { color: var(--accent); }
img { max-width: 100%; }
code { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 0.9em; background: #f1ece0; padding: 0.1em 0.35em; border-radius: 5px; }

.wrap { max-width: 980px; margin: 0 auto; padding: 0 16px; }

/* 머리말 */
.site-header { background: var(--card); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 10; }
.site-header .top { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding-top: 10px; }
.brand { font-weight: 800; font-size: 1.05rem; color: var(--ink); text-decoration: none; white-space: nowrap; }
.level-switch { display: inline-flex; background: #f1ece0; border-radius: 999px; padding: 3px; }
.level-switch button { border: 0; background: transparent; font: inherit; font-size: 0.9rem; padding: 4px 12px; border-radius: 999px; cursor: pointer; color: var(--muted); }
.level-switch button[aria-pressed='true'] { background: var(--card); color: var(--ink); font-weight: 700; box-shadow: var(--shadow); }
.site-nav { display: flex; gap: 4px; overflow-x: auto; padding: 8px 0 10px; scrollbar-width: none; }
.site-nav::-webkit-scrollbar { display: none; }
.site-nav a { flex: none; text-decoration: none; color: var(--muted); padding: 5px 12px; border-radius: 999px; font-size: 0.95rem; }
.site-nav a[aria-current='page'] { background: var(--accent-soft); color: var(--accent); font-weight: 700; }
.site-nav a.board-link { background: var(--accent); color: #fff; font-weight: 700; }

main { padding: 24px 0 48px; }
h1 { font-size: clamp(1.5rem, 4.5vw, 2.1rem); line-height: 1.3; margin: 0.2em 0 0.4em; }
h2 { font-size: 1.3rem; margin: 2em 0 0.6em; line-height: 1.35; }
h3 { font-size: 1.08rem; margin: 1.4em 0 0.4em; }
p { margin: 0.5em 0; }
.lead { color: var(--muted); font-size: 1.05rem; }
.muted { color: var(--muted); }
.small { font-size: 0.88rem; }

.site-footer { border-top: 1px solid var(--line); padding: 20px 0 40px; color: var(--muted); font-size: 0.88rem; }

/* 카드·상자 */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow); }
.note { border-radius: 12px; padding: 12px 14px; margin: 12px 0; background: var(--yellow); }
.note.green { background: var(--green); }
.note.pink { background: var(--pink); }
.note.blue { background: var(--blue); }
.note > :first-child { margin-top: 0; }
.note > :last-child { margin-bottom: 0; }
.grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; border: 1px solid var(--line); background: var(--card); color: var(--ink); font: inherit; font-size: 0.95rem; font-weight: 600; padding: 8px 14px; border-radius: 10px; cursor: pointer; text-decoration: none; }
.btn:hover { border-color: #cfc6b2; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.big { font-size: 1.1rem; padding: 14px 20px; border-radius: 12px; }
.btn.danger { color: var(--danger); }
.btn[disabled] { opacity: 0.5; cursor: not-allowed; }
.btn.small { font-size: 0.85rem; padding: 5px 10px; }

/* 첫 화면 */
.hero { padding: 8px 0 4px; }
.hero .day { display: inline-block; background: var(--pink); border-radius: 999px; padding: 2px 12px; font-weight: 700; font-size: 0.95rem; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 10px; margin: 18px 0 6px; }

/* 흐름 표 */
.flow { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; }
.flow li a { display: grid; grid-template-columns: 3.2em 1fr auto; align-items: center; gap: 10px; background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 10px 14px; text-decoration: none; color: var(--ink); }
.flow .no { font-size: 1.3rem; font-weight: 800; color: var(--accent); text-align: center; }
.flow .name { font-weight: 700; }
.flow .what { display: block; color: var(--muted); font-size: 0.9rem; font-weight: 400; }
.flow .time { color: var(--muted); font-size: 0.85rem; white-space: nowrap; }
.flow li.break a { background: #f4efe3; border-style: dashed; }

/* 단계 */
.step { scroll-margin-top: 110px; margin-top: 28px; }
.step-head { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; border-bottom: 2px solid var(--ink); padding-bottom: 6px; }
.step-head h2 { margin: 0; }
.step-head .time { color: var(--muted); font-size: 0.9rem; }
.step ol, .step ul { padding-left: 1.3em; }
.step li { margin: 0.3em 0; }
.skip { display: inline-block; background: var(--green); border-radius: 6px; padding: 0 8px; font-size: 0.85rem; font-weight: 700; }
.step-index { display: flex; flex-wrap: wrap; gap: 6px; margin: 10px 0 0; }
.step-index a { text-decoration: none; background: var(--card); border: 1px solid var(--line); border-radius: 999px; padding: 3px 12px; font-size: 0.92rem; color: var(--ink); }

/* 표 */
.table-wrap { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; background: var(--card); border-radius: 12px; overflow: hidden; font-size: 0.95rem; }
th, td { border-bottom: 1px solid var(--line); padding: 9px 12px; text-align: left; vertical-align: top; }
th { background: #f4efe3; font-weight: 700; white-space: nowrap; }
tr:last-child td { border-bottom: 0; }
td code { white-space: nowrap; }

/* 프롬프트 */
.prompt { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); margin: 12px 0; overflow: hidden; }
.prompt-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 14px; background: #f4efe3; }
.prompt-head .title { font-weight: 700; }
.prompt-head .id { display: inline-block; min-width: 2.2em; text-align: center; background: var(--ink); color: #fff; border-radius: 6px; font-size: 0.8rem; padding: 1px 6px; margin-right: 6px; }
.prompt-head .where { color: var(--muted); font-size: 0.85rem; font-weight: 400; margin-left: 4px; }
.prompt pre { margin: 0; padding: 14px; white-space: pre-wrap; word-break: break-word; font-family: inherit; font-size: 0.98rem; line-height: 1.7; }
.prompt .pending { padding: 14px; color: var(--muted); font-style: italic; }
.prompt .block-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 8px 14px; border-top: 1px dashed var(--line); font-weight: 700; font-size: 0.92rem; }
.prompt .when { margin: 0; padding: 10px 14px; border-top: 1px solid var(--line); font-size: 0.93rem; background: #fffdf6; }
.prompt .when b { margin-right: 4px; }
details.more { border-top: 1px solid var(--line); padding: 8px 14px; font-size: 0.93rem; }
details.more summary { cursor: pointer; color: var(--accent); font-weight: 600; }
details.more.card { padding: 10px 14px; margin: 10px 0; box-shadow: none; }
.note ul { margin: 0; padding-left: 1.2em; }
.step .sub table { font-size: 0.92rem; }
details.stuck { background: var(--yellow); border-radius: 12px; padding: 10px 14px; margin: 14px 0; }
details.stuck > summary { cursor: pointer; font-weight: 700; }
details.stuck h4 { margin: 1.2em 0 0.3em; font-size: 1rem; }
details.stuck table { font-size: 0.9rem; }
details.stuck .prompt pre { font-size: 0.92rem; }
.copy-btn.done { background: var(--green); border-color: #9bd3ad; }

/* 용어 */
.term-groups { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }
.term-group h3 { margin-top: 0; }
.term-group dl { margin: 0; }
.term-group dt { font-weight: 700; margin-top: 10px; }
.term-group dd { margin: 2px 0 0; color: #3d3a33; }
.term-group dd.analogy { color: var(--muted); font-size: 0.92rem; }
.term-group dd.analogy span { display: inline-block; background: rgba(255,255,255,0.7); border-radius: 5px; padding: 0 6px; font-size: 0.8rem; font-weight: 700; margin-right: 4px; }
.term-notes { margin-top: 12px; font-size: 0.93rem; }
.term-notes p { margin: 6px 0 0; }
.term-group:nth-child(1) { background: var(--blue); }
.term-group:nth-child(2) { background: var(--green); }
.term-group:nth-child(3) { background: var(--yellow); }
.term-group:nth-child(4) { background: var(--pink); }
.term-group { border: 0; box-shadow: none; }

/* 게시판 */
.board-bar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 14px; }
.board-bar h1 { margin: 0; }
.entry { max-width: 420px; margin: 30px auto; }
.field { display: grid; gap: 4px; margin: 10px 0; }
.field label { font-weight: 700; font-size: 0.95rem; }
.field .hint { color: var(--muted); font-size: 0.85rem; }
input[type='text'], input[type='url'], input[type='password'], textarea { font: inherit; font-size: 16px; padding: 9px 11px; border: 1px solid #d6cdb8; border-radius: 10px; background: #fff; width: 100%; }
textarea { resize: vertical; min-height: 4em; }
input:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: 0; border-color: transparent; }
.seg { display: inline-flex; border: 1px solid #d6cdb8; border-radius: 10px; overflow: hidden; }
.seg label { padding: 7px 14px; cursor: pointer; font-weight: 600; font-size: 0.95rem; }
.seg input { position: absolute; opacity: 0; pointer-events: none; }
.seg label:has(input:checked) { background: var(--accent); color: #fff; }
.form-error { color: var(--danger); font-weight: 600; min-height: 1.4em; }
.compose { margin-bottom: 18px; }
.compose[hidden] { display: none; }

.posts { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); align-items: start; }
.post { margin: 0; }
.post .app { font-size: 1.15rem; font-weight: 800; line-height: 1.35; margin: 0; }
.post .chip { display: inline-block; background: var(--yellow); border-radius: 6px; padding: 0 8px; font-size: 0.85rem; font-weight: 600; margin: 6px 0; }
.post .intro { margin: 4px 0 8px; }
.post .meta { color: var(--muted); font-size: 0.85rem; }
.post .actions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.post:nth-child(4n+2) { background: #fffdf6; }
.comments { border-top: 1px dashed var(--line); margin-top: 12px; padding-top: 8px; }
.comments[hidden] { display: none; }
.comment { font-size: 0.93rem; margin: 6px 0; }
.comment b { margin-right: 4px; }
.comment .when { color: var(--muted); font-size: 0.8rem; margin-left: 4px; }
.comment-form { display: grid; gap: 6px; margin-top: 8px; }
.comment-form .row { display: flex; gap: 6px; }
.comment-form .row input { flex: 1; }
.empty { text-align: center; color: var(--muted); padding: 40px 0; }
.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); background: var(--ink); color: #fff; padding: 10px 18px; border-radius: 999px; font-size: 0.95rem; z-index: 50; }

@media (max-width: 560px) {
  body { font-size: 16px; }
  .brand { font-size: 0.95rem; }
  .flow li a { grid-template-columns: 2.4em 1fr; }
  .flow .time { grid-column: 2; }
  .card { padding: 14px; }
  th, td { padding: 8px 9px; font-size: 0.9rem; }
  /* 막힐 때 표는 휴대폰에서 줄마다 카드처럼 쌓는다 */
  :is(details.stuck, .sub) :is(table, tbody, tr, td) { display: block; width: 100%; }
  :is(details.stuck, .sub) thead { display: none; }
  :is(details.stuck, .sub) tr { border-bottom: 1px solid var(--line); padding: 6px 0; }
  :is(details.stuck, .sub) td { border: 0; padding: 3px 10px; }
  :is(details.stuck, .sub) td:first-child { font-weight: 700; }
}
