:root {
  --bg: #f3efe6;
  --ink: #1a1714;
  --muted: #5c564c;
  --faint: #8a8378;
  --card: #fffdf8;
  --line: rgba(26, 23, 20, 0.08);
  --teal: #0c6e58;
  --teal-bg: #e3f5ee;
  --gold: #b45309;
  --gold-bg: #fef3c7;
  --purple: #4c3fb8;
  --purple-bg: #eeedfe;
  --blue: #1d6bb8;
  --blue-bg: #e6f1fb;
  --red: #c43434;
  --red-bg: #fcebeb;
  --radius: 18px;
  --shadow: 0 10px 30px rgba(26, 23, 20, 0.07);
  --nav-h: 64px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }
body {
  font-family: "Pretendard Variable", Pretendard, "PingFang SC", "Noto Sans SC", "Noto Sans KR", system-ui, sans-serif;
  background:
    radial-gradient(900px 420px at 8% -8%, #d7efe6 0%, transparent 55%),
    radial-gradient(800px 380px at 110% 0%, #fde7bf 0%, transparent 48%),
    var(--bg);
  color: var(--ink);
  line-height: 1.65;
  font-size: 16px;
  padding-bottom: calc(var(--nav-h) + env(safe-area-inset-bottom));
}
img { max-width: 100%; display: block; }
button { font: inherit; cursor: pointer; background: none; border: 0; color: inherit; }
a { color: inherit; text-decoration: none; }

.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 16px;
  padding-top: max(10px, env(safe-area-inset-top));
  background: rgba(243, 239, 230, 0.88);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--line);
}
.brand {
  display: flex; align-items: center; gap: 8px;
  font-weight: 800; letter-spacing: 0.12em; font-size: 13px; color: var(--teal);
}
.brand-mark {
  width: 36px; height: 36px; border-radius: 10px;
  background: #05070d; object-fit: cover;
  box-shadow: 0 0 0 1px rgba(120, 200, 255, 0.18);
}
.langs { display: flex; gap: 4px; background: #fff; border-radius: 999px; padding: 3px; border: 1px solid var(--line); }
.langs button {
  min-width: 40px; height: 30px; border-radius: 999px; font-size: 12px; font-weight: 750;
  color: var(--muted);
}
.langs button.on { background: #12352f; color: #fff; }

.wrap { max-width: 640px; margin: 0 auto; padding: 16px 16px 28px; }
.page { display: none; }
.page.on { display: block; }

.hero-art {
  position: relative; border-radius: 22px; overflow: hidden;
  margin-bottom: 14px; box-shadow: var(--shadow);
  aspect-ratio: 16/9;
}
.hero-art img { width: 100%; height: 100%; object-fit: cover; }
.hero-art .cap {
  position: absolute; left: 12px; bottom: 12px;
  background: rgba(18, 24, 22, 0.62); color: #fff;
  font-size: 12px; font-weight: 650; padding: 6px 10px; border-radius: 999px;
  backdrop-filter: blur(8px);
}

h1 { font-size: clamp(22px, 6vw, 28px); letter-spacing: -0.03em; line-height: 1.28; margin: 8px 0 12px; }
.lead { color: var(--muted); font-size: 15px; margin-bottom: 14px; word-break: keep-all; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; }
.chip {
  font-size: 12.5px; font-weight: 700; padding: 7px 11px; border-radius: 999px; border: 1px solid;
}
.chip.te { background: var(--teal-bg); color: #04342c; border-color: #1d9e75; }
.chip.gd { background: var(--gold-bg); color: #5d4037; border-color: #f9a825; }
.chip.re { background: var(--red-bg); color: #791f1f; border-color: #e24b4a; }

.card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 16px; margin-bottom: 14px; box-shadow: var(--shadow);
}
.card.te { background: linear-gradient(180deg, #f1faf6, var(--card)); border-color: #b7e4d4; }
.card.gd { background: linear-gradient(180deg, #fff8e1, var(--card)); border-color: #f3d27a; }
.card.pu { background: linear-gradient(180deg, #f4f3ff, var(--card)); border-color: #c9c4f3; }
.card.re { background: linear-gradient(180deg, #fff4f4, var(--card)); border-color: #f0b6b6; }
.card.am { background: linear-gradient(180deg, #fff6e8, var(--card)); border-color: #efc48a; }
.card.dk { background: linear-gradient(180deg, #16323a, #11262d); border-color: #2c4a53; color: #d7e4e8; }

.ct {
  font-size: 15px; font-weight: 800; letter-spacing: -0.02em;
  padding-bottom: 10px; margin-bottom: 12px; border-bottom: 1px solid var(--line);
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
}
.card.dk .ct { color: #9ee7dc; border-color: #31545d; }

.fm {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12.5px; font-weight: 650; line-height: 1.55; text-align: center;
  padding: 10px 12px; border-radius: 12px; margin-bottom: 12px; word-break: break-word;
}
.fm.te { background: #c8f0e0; color: #04342c; }
.fm.gd { background: #fff59d; color: #5d4037; }
.fm.pu { background: #dddcfc; color: #26215c; }

.row { display: grid; grid-template-columns: 76px 1fr; gap: 8px 10px; margin-bottom: 10px; }
.pk { font-size: 13px; font-weight: 800; color: #085041; }
.card.gd .pk { color: #5d4037; }
.pv { font-size: 14px; color: var(--muted); word-break: keep-all; }
.card.dk .pv { color: #b7c9cf; }
.hl-r { color: var(--red); font-weight: 800; }
.hl-g { color: var(--teal); font-weight: 800; }
.hl-a { color: var(--gold); font-weight: 800; }
.hl-p { color: var(--purple); font-weight: 800; }

.flow { display: flex; flex-direction: column; gap: 10px; margin-bottom: 16px; }
.step {
  display: grid; grid-template-columns: 52px 1fr; gap: 12px; align-items: center;
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 12px; box-shadow: var(--shadow);
}
.badge {
  width: 52px; height: 52px; border-radius: 16px; display: grid; place-items: center;
}
.badge svg { width: 28px; height: 28px; }
.step h3 { font-size: 16px; font-weight: 800; }
.step p { font-size: 13.5px; color: var(--muted); }
.step .sub { font-size: 12.5px; color: var(--faint); }

.split { display: grid; gap: 10px; }
@media (min-width: 560px) { .split { grid-template-columns: 1fr 1fr; } }
.mini { border-radius: 14px; padding: 12px; border: 1px solid; }
.mini.pu { background: rgba(238,237,254,.7); border-color: #afa9ec; }
.mini.or { background: rgba(255,243,224,.85); border-color: #ffb300; }
.mini h4 { font-size: 14px; font-weight: 800; margin-bottom: 4px; }
.mini p { font-size: 13.5px; color: var(--muted); }

.tag { display: inline-block; padding: 3px 8px; border-radius: 999px; font-size: 11px; font-weight: 800; color: #fff; }
.tag.core { background: #166534; }
.tag.fix { background: var(--red); }

.note {
  background: rgba(83,74,183,.07); border: 1px solid #afa9ec; border-radius: 12px;
  padding: 11px 12px; font-size: 13.5px; color: #26215c; margin-top: 8px;
}
.valve {
  display: grid; grid-template-columns: 28px 1fr; gap: 8px;
  border-radius: 12px; padding: 10px 12px; border: 1px solid #f09595;
  background: #fff7f7; margin-bottom: 8px;
}
.vt { font-size: 14px; font-weight: 800; color: #501313; }
.vd { font-size: 13.5px; color: var(--muted); }
.warn { text-align: center; font-size: 13.5px; color: #501313; margin-bottom: 10px; font-weight: 700; }
.math { display: flex; flex-direction: column; gap: 6px; font-size: 13.5px; color: var(--muted); }

.exits { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.exit {
  background: rgba(255,255,255,.72); border: 1px solid #ef9f27; border-radius: 14px;
  padding: 12px 10px; text-align: center;
}
.exit b { display: block; font-size: 14px; color: #412402; margin-bottom: 4px; }
.exit span { font-size: 12.5px; color: var(--muted); }

.stat-label { font-size: 12px; color: #90a4ae; text-align: center; }
.stat-num { font-size: 26px; font-weight: 800; text-align: center; letter-spacing: -0.03em; margin: 4px 0 8px; color: #35d399; }
.bar { height: 28px; border-radius: 999px; overflow: hidden; background: #0f3d36; margin: 8px 0; }
.bar span { display: grid; place-items: center; height: 100%; background: #1d9e75; color: #fff; font-size: 12px; font-weight: 800; }
.fly { background: rgba(240,195,106,.1); border: 1px solid rgba(240,195,106,.32); border-radius: 12px; padding: 12px; color: #fef3c7; font-size: 13.5px; }

.rule {
  display: grid; grid-template-columns: 36px 1fr; gap: 10px;
  background: #faf8f3; border: 1px solid var(--line); border-radius: 14px; padding: 12px; margin-bottom: 8px;
}
.rn { width: 36px; height: 36px; border-radius: 11px; display: grid; place-items: center; font-weight: 800; background: #fff; }
.rn.g { color: var(--teal); } .rn.p { color: var(--purple); } .rn.a { color: var(--gold); }
.rn.b { color: var(--blue); } .rn.r { color: var(--red); }
.rt { font-weight: 800; } .rv { font-size: 13.5px; color: var(--muted); } .reffect { font-size: 12.5px; color: var(--faint); }

.gen {
  display: grid; grid-template-columns: 1fr auto; gap: 6px; align-items: center;
  padding: 10px 0; border-bottom: 1px solid var(--line);
}
.gen:last-child { border-bottom: 0; }
.meter { height: 8px; background: #efe8d8; border-radius: 999px; overflow: hidden; margin-top: 6px; }
.meter i { display: block; height: 100%; background: linear-gradient(90deg, #1d9e75, #f0c36a); border-radius: 999px; }
.big { font-weight: 800; color: var(--teal); font-variant-numeric: tabular-nums; }

.day {
  background: #fff; border: 1px solid var(--line); border-radius: 14px; padding: 12px; margin-bottom: 8px;
}
.day .hd { display: flex; justify-content: space-between; font-weight: 800; margin-bottom: 6px; }
.kv { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; font-size: 12.5px; color: var(--muted); }
.income { font-size: 20px; font-weight: 800; color: #b45309; }

.chart {
  width: 100%; height: 168px; margin: 8px 0 4px;
}
.kill { margin-bottom: 12px; }
.kill h4 { font-size: 15px; font-weight: 800; margin-bottom: 4px; }
.kill p { font-size: 14px; color: var(--muted); }

.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
  display: grid; grid-template-columns: 1fr 1fr;
  background: rgba(255,253,248,.94); backdrop-filter: blur(16px);
  border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom);
}
.tabbar button {
  height: var(--nav-h); display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 2px; font-size: 12px; font-weight: 750; color: var(--faint);
}
.tabbar button.on { color: var(--teal); }
.tabbar svg { width: 22px; height: 22px; }

.cascade {
  display: flex; justify-content: space-between; align-items: flex-end; gap: 4px; margin: 10px 0 4px;
}
.node {
  flex: 1; text-align: center; font-size: 11px; font-weight: 800;
  padding: 8px 2px; border-radius: 10px; background: #eef7f3; color: #085041;
}
.node.skip { background: #fcebeb; color: #791f1f; }
.node.me { background: #eeedfe; color: #3c3489; }

.foot { text-align: center; font-size: 12px; color: var(--faint); margin-top: 8px; }

.tri { display: grid; gap: 8px; }
@media (min-width: 520px) { .tri { grid-template-columns: 1fr 1fr 1fr; } }
.tri .box {
  text-align: center; border-radius: 14px; padding: 12px 10px; border: 1px solid;
  background: #fff;
}
.tri .box b { display: block; font-size: 20px; margin-bottom: 4px; }
.tri .box p { font-size: 12.5px; color: var(--muted); }
.wpi { width: 100%; border-collapse: collapse; font-size: 13px; }
.wpi th { font-size: 12px; color: var(--faint); font-weight: 650; padding: 6px 4px; border-bottom: 1px solid var(--line); text-align: center; }
.wpi td { text-align: center; padding: 7px 4px; color: var(--muted); }
.wpi tr:nth-child(even) td { background: rgba(0,0,0,.03); }
.paradox {
  background: rgba(255,255,255,.55); border: 1px solid #ffb300; border-radius: 12px;
  padding: 11px 12px; font-size: 14px; color: #4e342e; margin-top: 8px;
}
.hardcap {
  background: rgba(226,75,74,.08); border: 1px solid rgba(226,75,74,.3);
  border-radius: 12px; padding: 10px 12px; font-size: 13.5px; color: #791f1f;
  text-align: center; margin: 8px 0 10px;
}
.eq {
  background: rgba(29,158,117,.12); border: 1px solid #1d9e75; border-radius: 12px;
  padding: 11px 12px; font-size: 13.5px; color: #04342c; line-height: 1.7; margin: 8px 0;
}
.eq .line { display: block; }
