/* 득실장부 — 공통 토큰·컴포넌트 */
:root {
  --celadon: #E2E9E3;   /* 청자 바탕 */
  --celadon-2: #D5DFD8;
  --paper: #F5F8F4;     /* 지면 */
  --white: #FBFCFA;
  --ink: #1C2726;       /* 먹 */
  --ink-2: #4A5856;
  --ink-3: #6E7C79;
  --line: #C3CEC6;
  --gold: #A8770F;      /* 득 */
  --gold-2: #C89A2E;
  --gold-soft: #EEDFB4;
  --seal: #A6262E;      /* 실 · 인주 */
  --seal-soft: #EFCFCB;
  --guard: #2E5F5B;     /* 방어 */
  --guard-soft: #CFE0DB;
  --wood: #3F7A4E; --fire: #C5432F; --earth: #8F6430; --metal: #6F767C; --water: #27406E;
  --f-display: "Hahmlet", "Noto Serif KR", serif;
  --f-hanja: "Noto Serif KR", "Hahmlet", serif;
  --f-body: "IBM Plex Sans KR", system-ui, sans-serif;
  --f-mono: "IBM Plex Mono", ui-monospace, monospace;
  --r: 6px;
  --shadow: 0 1px 0 rgba(28, 39, 38, .04), 0 8px 24px -12px rgba(28, 39, 38, .18);
}
* { box-sizing: border-box }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto } }
body { margin: 0; background: var(--celadon); color: var(--ink); font-family: var(--f-body); font-size: 15px; line-height: 1.6; -webkit-font-smoothing: antialiased }
button, input, select, textarea { font: inherit; color: inherit }
a { color: inherit }
img { max-width: 100%; display: block }
:focus-visible { outline: 2px solid var(--guard); outline-offset: 2px; border-radius: 3px }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap }
.hanja { font-family: var(--f-hanja) }
.mono { font-family: var(--f-mono); font-feature-settings: "tnum" }
.wrap { max-width: 1200px; margin: 0 auto; padding: 0 24px }
@media (max-width: 640px) { .wrap { padding: 0 16px } }
.hidden { display: none !important }

.e-wood { color: var(--wood) } .e-fire { color: var(--fire) } .e-earth { color: var(--earth) } .e-metal { color: var(--metal) } .e-water { color: var(--water) }

/* top bar */
.top { position: sticky; top: 0; z-index: 40; background: color-mix(in srgb, var(--celadon) 86%, transparent); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line) }
.top .wrap { display: flex; align-items: center; gap: 20px; height: 60px }
.brand { display: flex; align-items: center; gap: 9px; font-family: var(--f-display); font-weight: 800; font-size: 19px; letter-spacing: -.02em; text-decoration: none }
.seal-mark { display: inline-grid; place-items: center; width: 28px; height: 28px; background: var(--seal); color: #fff; border-radius: 4px; font-family: var(--f-hanja); font-weight: 900; font-size: 15px; box-shadow: inset 0 0 0 2px rgba(255,255,255,.18) }
.brand small { font-family: var(--f-mono); font-size: 11px; font-weight: 400; color: var(--ink-3) }
.nav { display: flex; gap: 4px; margin-left: auto; align-items: center }
.nav a, .nav button { border: 0; background: transparent; padding: 8px 12px; border-radius: 999px; cursor: pointer; color: var(--ink-2); font-weight: 500; text-decoration: none; font-size: 14px }
.nav a:hover, .nav button:hover { color: var(--ink) }
.nav [aria-current="page"], .nav [aria-selected="true"] { background: var(--ink); color: var(--paper) }
@media (max-width: 720px) { .brand small { display: none } .nav .opt { display: none } .nav a, .nav button { padding: 6px 9px; font-size: 13px } }

/* type */
.eyebrow { font-family: var(--f-mono); font-size: 12px; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-3); margin: 0 0 10px }
h1, h2, h3 { font-family: var(--f-display); letter-spacing: -.025em; margin: 0 }
h2 { font-weight: 800; font-size: clamp(25px, 3.2vw, 36px); line-height: 1.22; margin-bottom: 10px }
h3 { font-weight: 600; font-size: 19px; line-height: 1.35; margin-bottom: 6px; letter-spacing: -.01em }
.lede { color: var(--ink-2); max-width: 62ch; margin: 0 }

/* surfaces */
.card { background: var(--paper); border: 1px solid var(--line); border-radius: var(--r); padding: 22px }
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 2px 10px; border-radius: 999px; font-size: 12.5px; font-weight: 600; white-space: nowrap; line-height: 1.6 }
.g-길 { background: var(--gold); color: #fff }
.g-소길 { background: var(--gold-soft); color: #6B4A05 }
.g-평 { background: #DDE3DF; color: var(--ink-2) }
.g-주의 { background: var(--seal-soft); color: #7A1820 }
.g-위험 { background: var(--seal); color: #fff }
.v-성립 { background: var(--gold-soft); color: #6B4A05 }
.v-경합 { background: linear-gradient(90deg, var(--gold-soft) 50%, var(--seal-soft) 50%); color: var(--ink) }
.v-미정 { background: #DDE3DF; color: var(--ink-2) }
.p-guard { background: var(--guard-soft); color: #1D4440 }

/* buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 0; border-radius: var(--r); padding: 12px 20px; font-weight: 600; cursor: pointer; text-decoration: none; transition: transform .15s ease, background .15s ease }
.btn:active { transform: translateY(1px) }
.btn-ink { background: var(--ink); color: var(--paper) }
.btn-ink:hover { background: #2B3937 }
.btn-gold { background: var(--gold); color: #fff }
.btn-gold:hover { background: #8F650C }
.btn-line { background: transparent; border: 1px solid var(--ink); color: var(--ink) }
.btn-line:hover { background: rgba(28,39,38,.05) }
.btn-sm { padding: 7px 12px; font-size: 13px }
.btn[disabled] { opacity: .5; cursor: not-allowed }

/* form */
.field { display: grid; gap: 6px; margin-bottom: 14px }
.field > label, .field .lab { font-size: 13px; font-weight: 600 }
.field small { font-size: 12px; color: var(--ink-3) }
.input, .select { width: 100%; padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--r); background: #fff; min-height: 44px }
.seg { justify-self: start; width: max-content; display: inline-flex; border: 1px solid var(--line); border-radius: 999px; padding: 3px; background: #fff; flex-wrap: wrap }
.seg button { border: 0; background: transparent; padding: 6px 14px; border-radius: 999px; cursor: pointer; font-size: 14px; min-height: 34px }
.seg button[aria-pressed="true"] { background: var(--ink); color: var(--paper) }
.chips { display: flex; flex-wrap: wrap; gap: 6px }
.chip { border: 1px solid var(--line); background: #fff; border-radius: 999px; padding: 6px 12px; cursor: pointer; font-size: 13.5px; min-height: 34px }
.chip[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: var(--paper); font-weight: 600 }

/* pillars */
.pillars { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px }
.pillar { background: var(--paper); border: 1px solid var(--line); border-radius: var(--r); text-align: center; padding: 10px 4px 8px; position: relative }
.pillar.me { border-color: var(--ink); box-shadow: inset 0 0 0 1px var(--ink) }
.pillar .pos { font-size: 11.5px; color: var(--ink-3) }
.pillar .ten { font-size: 11.5px; color: var(--ink-2); min-height: 17px }
.pillar .g { font-family: var(--f-hanja); font-weight: 900; font-size: clamp(30px, 4vw, 46px); line-height: 1.1 }
.pillar .hid { font-family: var(--f-hanja); font-size: 11.5px; color: var(--ink-3); letter-spacing: .12em }
.pillar .me-tag { position: absolute; top: -9px; left: 50%; transform: translateX(-50%); background: var(--ink); color: var(--paper); font-size: 10.5px; padding: 0 8px; border-radius: 999px }
.pillar.empty .g { color: var(--line) }

footer.site { border-top: 1px solid var(--line); padding: 26px 0 44px; font-size: 12.5px; color: var(--ink-3) }
footer.site .wrap { display: flex; flex-wrap: wrap; gap: 8px 24px; justify-content: space-between }

/* tide chart shared */
.tide-svg { display: block; width: 100%; height: auto }
.tide-svg .unit { cursor: pointer }
.tide-svg .unit:focus { outline: none }
.tide-svg .unit:focus-visible .hit { stroke: var(--guard); stroke-width: 2 }
.tide-svg text { font-family: var(--f-body) }
@media (prefers-reduced-motion: no-preference) {
  .bar { transform-box: fill-box; transform-origin: bottom; animation: rise .6s cubic-bezier(.2, .8, .2, 1) both }
  .bar.down { transform-origin: top }
  @keyframes rise { from { transform: scaleY(0) } }
  .fade-in { animation: fade .45s ease both }
  @keyframes fade { from { opacity: 0; transform: translateY(6px) } }
}
