:root {
  color-scheme: light;
  --ink: #2f251d;
  --muted: #6d5e52;
  --paper: #fffdf8;
  --paper-soft: #fff7e9;
  --line: #ead9c5;
  --orange: #e86f16;
  --orange-dark: #a94208;
  --orange-soft: #fff0df;
  --diamond: #2ba8a0;
  --diamond-soft: #e5f8f5;
  --danger: #9e2d22;
  --shadow: 0 12px 32px rgba(84, 49, 20, 0.1);
  --radius: 18px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 1rem; }
body {
  margin: 0;
  color: var(--ink);
  background:
    linear-gradient(rgba(232, 111, 22, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(232, 111, 22, 0.035) 1px, transparent 1px),
    #f8f1e8;
  background-size: 24px 24px;
  font-family: "Pretendard", "Noto Sans KR", "Malgun Gothic", system-ui, sans-serif;
  line-height: 1.65;
}

a { color: var(--orange-dark); }
a:focus-visible { outline: 3px solid var(--diamond); outline-offset: 3px; border-radius: 4px; }
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
.skip-link { position: fixed; left: 1rem; top: -5rem; z-index: 10; padding: .7rem 1rem; background: #fff; }
.skip-link:focus { top: 1rem; }

.hero {
  display: flex;
  gap: 1.2rem;
  align-items: center;
  max-width: 1100px;
  margin: 0 auto;
  padding: 4rem 1.25rem 2.2rem;
}
.hero__gem {
  display: grid;
  place-items: center;
  flex: 0 0 76px;
  height: 76px;
  color: #fff;
  background: var(--diamond);
  border: 6px solid #167b77;
  box-shadow: 8px 8px 0 rgba(43, 168, 160, .18);
  font-size: 2.2rem;
  transform: rotate(45deg);
}
.hero__gem::first-letter { transform: rotate(-45deg); }
.eyebrow, .section-kicker { margin: 0; color: var(--orange-dark); font-weight: 800; letter-spacing: .12em; font-size: .78rem; }
h1 { margin: .15rem 0 .4rem; font-size: clamp(2rem, 7vw, 4rem); line-height: 1.05; letter-spacing: -.04em; }
.hero__lead { max-width: 720px; margin: 0; color: var(--muted); font-size: 1.04rem; }

.toc {
  display: flex;
  gap: .45rem;
  max-width: 1100px;
  margin: 0 auto 1rem;
  padding: 0 1.25rem .75rem;
  overflow-x: auto;
  scrollbar-width: thin;
}
.toc a {
  flex: 0 0 auto;
  padding: .48rem .75rem;
  color: var(--ink);
  background: rgba(255, 253, 248, .88);
  border: 1px solid var(--line);
  border-radius: 999px;
  text-decoration: none;
  font-size: .88rem;
  font-weight: 700;
}
.toc a:hover { border-color: var(--orange); color: var(--orange-dark); }

.page-shell { max-width: 1100px; margin: 0 auto; padding: 0 1.25rem 3rem; }
.section {
  margin: 1rem 0;
  padding: clamp(1.2rem, 4vw, 2rem);
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.section--status { border-top: 5px solid var(--diamond); }
.section-heading { margin-bottom: 1rem; }
h2 { margin: .1rem 0 0; font-size: clamp(1.45rem, 4vw, 2rem); letter-spacing: -.025em; }
h3 { margin: 1.5rem 0 .55rem; font-size: 1.14rem; }
p { overflow-wrap: anywhere; }

.status-card { padding: 1rem; background: var(--diamond-soft); border: 1px solid #b8e4df; border-radius: 14px; }
.status-card--stale { background: #fff8df; border-color: #efd685; }
.status-card--error { background: #fff0ed; border-color: #efbbb4; }
.status-card__top { display: flex; flex-wrap: wrap; align-items: center; gap: .6rem; margin-bottom: 1rem; }
.status-card__title { margin: 0; font-size: 1.25rem; font-weight: 900; }
.status-card__message { margin: 0; color: var(--muted); }
.status-card__time { margin: .7rem 0 0; color: var(--muted); font-size: .86rem; }
.badge { display: inline-flex; align-items: center; padding: .2rem .55rem; border-radius: 999px; background: var(--orange); color: #fff; font-size: .76rem; font-weight: 800; }
.price-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: .7rem; }
.price-card { padding: .85rem; background: #fff; border: 1px solid #cde8e5; border-radius: 12px; }
.price-card__label { display: block; color: var(--muted); font-size: .86rem; }
.price-card__value { display: block; margin-top: .15rem; font-size: 1.2rem; font-weight: 900; color: var(--orange-dark); }

.notice, .callout { padding: .9rem 1rem; border-radius: 12px; }
.notice { margin: 1rem 0; background: var(--paper); border: 1px solid var(--line); }
.notice--error { color: var(--danger); background: #fff0ed; border-color: #efbbb4; }
.callout { margin: 0 0 1rem; background: var(--orange-soft); border-left: 4px solid var(--orange); }
.callout p { margin: 0; }
.subtle { color: var(--muted); font-size: .9rem; }
.positive-note { background: var(--diamond-soft); border-left-color: var(--diamond); }

.table-wrap { width: 100%; overflow-x: auto; border: 1px solid var(--line); border-radius: 12px; }
table { width: 100%; min-width: 560px; border-collapse: collapse; background: #fff; font-size: .93rem; }
th, td { padding: .72rem .8rem; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; white-space: nowrap; }
th { background: var(--paper-soft); color: #59402d; font-weight: 800; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: #fffaf2; }
.probability { color: var(--orange-dark); font-weight: 800; }

.product-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .8rem; }
.product { padding: 1rem; background: var(--paper-soft); border: 1px solid var(--line); border-radius: 14px; }
.product__price { margin: 0; color: var(--orange-dark); font-size: 1.3rem; font-weight: 900; }
.product__title { margin: .35rem 0 .2rem; font-weight: 800; }
.product__description { margin: 0; color: var(--muted); font-size: .9rem; }

.outcome-grid { display: grid; grid-template-columns: repeat(7, minmax(76px, 1fr)); gap: .45rem; }
.outcome { padding: .65rem .4rem; text-align: center; background: var(--paper-soft); border: 1px solid var(--line); border-radius: 10px; }
.outcome strong, .outcome span { display: block; }
.outcome span { color: var(--orange-dark); font-weight: 900; }
.rule-list { margin: .4rem 0 0; padding-left: 1.3rem; }
.rule-list li + li { margin-top: .35rem; }
.example-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .55rem; }
.example { padding: .75rem; background: #fff9f0; border: 1px solid var(--line); border-radius: 10px; }
.example code { display: block; margin-top: .2rem; color: var(--orange-dark); font-family: inherit; font-weight: 800; }
.split { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; align-items: start; }
.split > * { min-width: 0; }
.mini-panel { padding: 1rem; background: #fffaf2; border: 1px solid var(--line); border-radius: 12px; }
.mini-panel h3 { margin-top: 0; }

.footer { max-width: 1100px; margin: 0 auto; padding: 1rem 1.25rem 3rem; color: var(--muted); font-size: .85rem; }
.footer p { margin: .2rem 0; }
.noscript { margin: 1rem; padding: 1rem; background: #fff; border: 2px solid var(--danger); }

@media (max-width: 760px) {
  .hero { align-items: flex-start; padding-top: 2.5rem; }
  .hero__gem { flex-basis: 54px; height: 54px; border-width: 4px; font-size: 1.5rem; }
  .price-cards, .product-grid, .split { grid-template-columns: 1fr; }
  .outcome-grid { grid-template-columns: repeat(4, minmax(62px, 1fr)); }
}

@media (max-width: 500px) {
  .hero { gap: .85rem; }
  .page-shell, .toc { padding-left: .75rem; padding-right: .75rem; }
  .section { padding: 1rem; border-radius: 14px; }
  .outcome-grid { grid-template-columns: repeat(3, minmax(62px, 1fr)); }
  .example-list { grid-template-columns: 1fr; }
  table { min-width: 520px; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
}
