/* 블록체인 실습 교육 — 공통 디자인 */
:root {
  --bg: #0b0f17;
  --panel: #141a26;
  --panel2: #1b2331;
  --line: #2a3444;
  --text: #e6ecf5;
  --dim: #93a1b5;
  --dim2: #64748b;
  --accent: #38bdf8;
  --accent2: #22d3ee;
  --ok: #34d399;
  --warn: #fbbf24;
  --bad: #f87171;
  --purple: #a78bfa;
  --mono: 'Cascadia Mono', 'D2Coding', Consolas, 'Courier New', monospace;
  --sans: 'Pretendard', -apple-system, 'Segoe UI', 'Malgun Gothic', '맑은 고딕', sans-serif;
  --r: 12px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font-family: var(--sans); font-size: 16px; line-height: 1.75;
  -webkit-font-smoothing: antialiased;
}
.wrap { max-width: 1000px; margin: 0 auto; padding: 0 20px 100px; }

/* ---------- 상단바 ---------- */
.topbar {
  position: sticky; top: 0; z-index: 50;
  background: rgba(11,15,23,.88); backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}
.topbar-in {
  max-width: 1000px; margin: 0 auto; padding: 12px 20px;
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
}
.topbar a.home { color: var(--dim); text-decoration: none; font-weight: 600; font-size: 14px; }
.topbar a.home:hover { color: var(--accent); }
.chapnum {
  font-family: var(--mono); font-size: 12px; font-weight: 700;
  background: var(--accent); color: #06121c; padding: 3px 9px; border-radius: 20px;
}
.topbar .t { font-weight: 700; font-size: 15px; }
.progress-mini { margin-left: auto; display: flex; gap: 5px; }
.progress-mini i {
  width: 9px; height: 9px; border-radius: 50%; background: var(--line); display: block;
}
.progress-mini i.done { background: var(--ok); }
.progress-mini i.cur { background: var(--accent); box-shadow: 0 0 0 3px rgba(56,189,248,.2); }

/* ---------- 헤더 ---------- */
header.hero { padding: 52px 0 30px; }
header.hero .kicker {
  color: var(--accent); font-size: 13px; font-weight: 700; letter-spacing: .1em;
  text-transform: uppercase; margin-bottom: 10px;
}
header.hero h1 { font-size: 38px; line-height: 1.25; margin: 0 0 14px; letter-spacing: -.02em; }
header.hero p.lead { font-size: 18px; color: var(--dim); margin: 0; max-width: 70ch; }

h2 {
  font-size: 25px; margin: 56px 0 16px; letter-spacing: -.01em;
  padding-bottom: 10px; border-bottom: 1px solid var(--line);
}
h3 { font-size: 18px; margin: 32px 0 10px; }
p { margin: 0 0 14px; }
a { color: var(--accent); }
ul, ol { padding-left: 22px; margin: 0 0 14px; }
li { margin: 6px 0; }
strong { color: #fff; font-weight: 700; }
code {
  font-family: var(--mono); font-size: .88em; background: var(--panel2);
  padding: 2px 6px; border-radius: 5px; color: var(--accent2); word-break: break-all;
}

/* ---------- 카드/패널 ---------- */
.card {
  background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--r); padding: 22px; margin: 20px 0;
}
.lab {
  background: linear-gradient(180deg, #131b28, #0f1520);
  border: 1px solid #2b3a4f; border-radius: var(--r);
  padding: 24px; margin: 22px 0;
}
.lab-title {
  display: flex; align-items: center; gap: 9px;
  font-weight: 700; font-size: 15px; color: var(--accent);
  text-transform: uppercase; letter-spacing: .08em; margin-bottom: 16px;
}
.lab-title::before { content: '▶'; font-size: 11px; }

.note {
  border-left: 3px solid var(--accent); background: rgba(56,189,248,.07);
  padding: 14px 18px; border-radius: 0 8px 8px 0; margin: 18px 0;
}
.note.warn { border-color: var(--warn); background: rgba(251,191,36,.07); }
.note.bad { border-color: var(--bad); background: rgba(248,113,113,.07); }
.note.ok { border-color: var(--ok); background: rgba(52,211,153,.07); }
.note .h { font-weight: 700; display: block; margin-bottom: 4px; }

/* 개발자 소통 박스 */
.devtalk {
  border: 1px solid #3b3163; background: linear-gradient(180deg, #1a1630, #14121f);
  border-radius: var(--r); padding: 20px 22px; margin: 24px 0;
}
.devtalk > .h {
  color: var(--purple); font-weight: 700; font-size: 14px;
  letter-spacing: .06em; margin-bottom: 12px; display: flex; align-items: center; gap: 8px;
}
.devtalk > .h::before { content: '💬'; }
.say { margin: 10px 0; padding-left: 26px; position: relative; }
.say::before {
  position: absolute; left: 0; top: 0; font-weight: 700; font-family: var(--mono);
}
.say.good::before { content: '○'; color: var(--ok); }
.say.bad::before { content: '✕'; color: var(--bad); }
.say q { font-style: normal; color: #fff; }

/* ---------- 표 ---------- */
.tablewrap { overflow-x: auto; margin: 18px 0; }
table { border-collapse: collapse; width: 100%; font-size: 14.5px; min-width: 520px; }
th, td { text-align: left; padding: 10px 13px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { color: var(--dim); font-size: 12.5px; text-transform: uppercase; letter-spacing: .06em; font-weight: 700; }
td code { white-space: nowrap; }

/* ---------- 폼 요소 ---------- */
button {
  font-family: var(--sans); font-size: 14px; font-weight: 600;
  background: var(--accent); color: #06121c; border: 0;
  padding: 10px 18px; border-radius: 8px; cursor: pointer; transition: .15s;
}
button:hover { filter: brightness(1.12); }
button:active { transform: translateY(1px); }
button:disabled { opacity: .45; cursor: not-allowed; }
button.ghost { background: var(--panel2); color: var(--text); border: 1px solid var(--line); }
button.ghost:hover { border-color: var(--accent); color: var(--accent); }
button.danger { background: var(--bad); color: #2b0808; }
button.mine { background: var(--warn); color: #2a1c00; }
button.sm { padding: 6px 12px; font-size: 13px; }

input[type=text], input[type=number], textarea, select {
  font-family: var(--sans); font-size: 15px; width: 100%;
  background: #0c1119; color: var(--text);
  border: 1px solid var(--line); border-radius: 8px; padding: 10px 13px;
}
input:focus, textarea:focus, select:focus { outline: 0; border-color: var(--accent); }
textarea { resize: vertical; line-height: 1.6; }
label.fl { display: block; font-size: 13px; color: var(--dim); margin-bottom: 6px; font-weight: 600; }
.row { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; margin: 12px 0; }
.grow { flex: 1; min-width: 200px; }

input[type=range] { width: 100%; accent-color: var(--accent); }

/* ---------- 해시 출력 ---------- */
.hashout {
  font-family: var(--mono); font-size: 14px; word-break: break-all;
  background: #080c13; border: 1px solid var(--line); border-radius: 8px;
  padding: 13px 15px; line-height: 1.7; letter-spacing: .5px;
}
.hashout.big { font-size: 16px; }
.swatch { display: flex; height: 26px; border-radius: 6px; overflow: hidden; margin: 10px 0; }
.swatch span { flex: 1; }
.diff { color: var(--bad); font-weight: 700; background: rgba(248,113,113,.16); border-radius: 2px; }
.same { color: var(--dim2); }

/* ---------- 블록 ---------- */
.chain { display: flex; gap: 0; overflow-x: auto; padding: 6px 2px 16px; }
.blk {
  min-width: 215px; flex-shrink: 0; background: var(--panel2);
  border: 2px solid var(--ok); border-radius: 10px; padding: 13px; font-size: 13px;
}
.blk.invalid { border-color: var(--bad); background: rgba(248,113,113,.09); }
.blk.mining { border-color: var(--warn); }
.blk .bh { display: flex; justify-content: space-between; align-items: center; margin-bottom: 9px; }
.blk .bidx { font-weight: 700; font-size: 14px; }
.blk .badge { font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 20px; background: var(--ok); color: #04211a; }
.blk.invalid .badge { background: var(--bad); color: #2b0808; }
.blk.mining .badge { background: var(--warn); color: #2a1c00; }
.blk .f { margin: 7px 0; }
.blk .f .k { font-size: 11px; color: var(--dim2); text-transform: uppercase; letter-spacing: .05em; }
.blk .f .v { font-family: var(--mono); font-size: 11.5px; word-break: break-all; color: var(--dim); }
.blk .f .v.hash { color: var(--accent2); }
.blk input, .blk textarea { font-size: 13px; padding: 6px 9px; }
.link { display: flex; align-items: center; color: var(--line); flex-shrink: 0; padding: 0 3px; font-size: 20px; }
.link.bad { color: var(--bad); }

/* ---------- 기타 ---------- */
.kbd {
  font-family: var(--mono); font-size: 12px; background: var(--panel2);
  border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 5px; padding: 1px 6px;
}
.stat { display: flex; gap: 26px; flex-wrap: wrap; margin: 14px 0; }
.stat > div .n { font-family: var(--mono); font-size: 22px; font-weight: 700; color: var(--accent); }
.stat > div .l { font-size: 12px; color: var(--dim2); text-transform: uppercase; letter-spacing: .06em; }

.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 16px; }
.grid3 { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 14px; }

.quiz { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); padding: 20px; margin: 22px 0; }
.quiz .q { font-weight: 700; margin-bottom: 12px; }
.quiz button.opt {
  display: block; width: 100%; text-align: left; background: var(--panel2);
  color: var(--text); border: 1px solid var(--line); margin: 7px 0; font-weight: 500;
}
.quiz button.opt:hover { border-color: var(--accent); }
.quiz button.opt.right { border-color: var(--ok); background: rgba(52,211,153,.13); }
.quiz button.opt.wrong { border-color: var(--bad); background: rgba(248,113,113,.13); }
.quiz .exp { display: none; margin-top: 12px; font-size: 14.5px; color: var(--dim); border-top: 1px solid var(--line); padding-top: 12px; }

/* ---------- 하단 네비 ---------- */
.navfoot {
  display: flex; gap: 12px; justify-content: space-between; align-items: center;
  margin-top: 60px; padding-top: 24px; border-top: 1px solid var(--line); flex-wrap: wrap;
}
.navfoot a {
  text-decoration: none; color: var(--text); background: var(--panel);
  border: 1px solid var(--line); padding: 12px 18px; border-radius: 10px; font-weight: 600; font-size: 14px;
}
.navfoot a:hover { border-color: var(--accent); color: var(--accent); }
.navfoot a.next { background: var(--accent); color: #06121c; border-color: var(--accent); }
.navfoot a.next:hover { color: #06121c; filter: brightness(1.1); }

/* ---------- 홈 ---------- */
.chapters { display: grid; gap: 12px; margin: 24px 0; }
.chap {
  display: flex; gap: 16px; align-items: flex-start; text-decoration: none; color: inherit;
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--r);
  padding: 18px 20px; transition: .15s;
}
.chap:hover { border-color: var(--accent); transform: translateX(3px); }
.chap .num {
  font-family: var(--mono); font-weight: 700; font-size: 15px; flex-shrink: 0;
  width: 34px; height: 34px; display: grid; place-items: center;
  border-radius: 9px; background: var(--panel2); color: var(--dim);
}
.chap.done .num { background: var(--ok); color: #04211a; }
.chap .ct { font-weight: 700; font-size: 17px; margin-bottom: 3px; }
.chap .cd { font-size: 14px; color: var(--dim); line-height: 1.6; }
.chap .cq { font-size: 13px; color: var(--accent); margin-top: 6px; }

@media (max-width: 640px) {
  header.hero h1 { font-size: 29px; }
  header.hero { padding: 34px 0 20px; }
  .wrap { padding: 0 16px 70px; }
  .lab, .card { padding: 17px; }
}
