:root {
  /*
   * Palette is 오방색 — the five directional colours — because in this system
   * the colour IS the data: 청 wood, 적 fire, 황 earth, 백 metal, 흑 water.
   * Nothing here is applied Korean styling; it is the same five-element table
   * the engine runs on, rendered.
   *
   * Two problems 오방색 has on screen, and how they are handled: 백 vanishes on
   * a light ground and 흑 vanishes on a dark one. So each element carries a
   * value per surface, and 흑 is rendered as 감청 — the blue-black that Korean
   * 단청 actually uses — rather than a true black.
   */
  --bg: #0b0b0e;
  --surface: #141419;
  --surface-2: #1c1c23;
  --border: #292930;
  --border-soft: #202027;
  --text: #f2efe8;
  --muted: #8e8b98;
  --dim: #5e5b69;
  --gold: #e0b878;
  --gold-dim: #a98a56;
  --accent-fill: var(--gold);
  --on-accent: #17140e;
  --paper: none;

  --wood: #4fa88c;   /* 청 */
  --fire: #e0603f;   /* 적 */
  --earth: #e8b54a;  /* 황 */
  --metal: #ded9cd;  /* 백 */
  --water: #6e86b8;  /* 흑 · 감청 */

  /* Display splits by script: a 명조 for Korean, a high-contrast serif for
   * Latin. Pretendard carries the interface in both. The system stacks that
   * were here before rendered Korean in whatever the OS had lying around,
   * which is why nothing looked designed. */
  --serif: 'Instrument Serif', 'Gowun Batang', 'Iowan Old Style', Palatino, Georgia, serif;
  --sans: Pretendard Variable, Pretendard, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --mono: ui-monospace, SFMono-Regular, 'SF Mono', Menlo, monospace;
  --wrap: 580px;
}

/*
 * The front door is hanji, not night sky. Both references that matter —
 * Co-Star's site and 사주도령 — chose a light entrance, and a dark landing for
 * a divination product reads as occult, which is precisely the reading the
 * whole positioning is trying to avoid. The dark surface starts where the
 * orrery does.
 */
body[data-surface="light"] {
  --bg: #f2ede2;
  --surface: #faf6ec;
  --surface-2: #ebe4d5;
  --border: #d9d0bd;
  --border-soft: #e3dbc9;
  --text: #191713;
  --muted: #6b6459;
  --dim: #968e80;
  --gold: #9a7434;
  --gold-dim: #8a6a33;
  /* A filled gold button goes muddy on paper, so the light surface fills with
   * ink instead — which is also what the references do. */
  --accent-fill: #191713;
  --on-accent: #f7f3e9;

  --wood: #1f6e5c;
  --fire: #b33b26;
  --earth: #b8862a;
  --metal: #8c9499;
  --water: #1b2230;

  /* Fibre, at the threshold of visible. */
  --paper: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='3'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3C/filter%3E%3Crect width='180' height='180' filter='url(%23n)' opacity='0.035'/%3E%3C/svg%3E");
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

/* Korean breaks between any two syllables by default, which splits words down
 * the middle. keep-all restores word-level wrapping; the CJK-safe hyphen rule
 * keeps long English strings from overflowing as a result. */
:lang(ko) body, body:lang(ko), html[lang="ko"] body { word-break: keep-all; overflow-wrap: anywhere; }

body {
  margin: 0;
  transition: background-color .5s ease, color .5s ease;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  padding-bottom: 4rem;
}

/* Warm bloom behind the fold, so the dark page does not read as flat black. */
body::before {
  content: '';
  position: fixed;
  inset: -20% -20% auto -20%;
  height: 60vh;
  background: radial-gradient(ellipse at 50% 0%, rgba(224, 184, 120, .10), transparent 65%);
  pointer-events: none;
  z-index: 0;
}
body[data-surface="light"]::before {
  inset: 0;
  height: 100%;
  background: var(--paper);
  background-repeat: repeat;
}

main, .topbar, .foot { position: relative; z-index: 1; }

/* ───────────────────────────── chrome ───────────────────────────── */

.topbar {
  max-width: var(--wrap);
  margin: 0 auto;
  padding: 1.25rem 1.25rem .5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.brand {
  font-family: var(--serif);
  font-size: 1.15rem;
  color: var(--text);
  text-decoration: none;
  letter-spacing: .02em;
}
.brand span {
  font-family: var(--sans);
  font-size: .62rem;
  letter-spacing: .28em;
  color: var(--gold-dim);
  vertical-align: middle;
  margin-left: .35rem;
}

main { max-width: var(--wrap); margin: 0 auto; padding: 0 1.25rem; }

.view { animation: rise .4s ease both; }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } }

/* ───────────────────────────── the plate ─────────────────────────────
 * Modelled on 천상열차분야지도 — the 1395 Korean star chart cut into black
 * stone, read as white line on dark. It is the one reference in this category
 * that is astronomical rather than mystical, it is unmistakably Korean without
 * a single costume element, and its concentric-ring construction is already
 * the shape of our orrery. */

.plate {
  --text: #f2efe8;
  --muted: #8e8b98;
  --dim: #5e5b69;
  --border: #33333c;
  --border-soft: #24242c;
  --gold: #e0b878;
  --gold-dim: #a98a56;
  --fire: #e0603f;
  --accent-fill: var(--gold);
  --on-accent: #17140e;
  --surface: #141419;
  --surface-2: #1c1c23;
}

/* The hero gets a wider measure than the rest of the page: two columns cannot
 * breathe inside a 580px reading column. */
.plate {
  position: relative;
  margin: .5rem calc(50% - 50vw) 0;
  padding-inline: max(1.25rem, calc(50vw - 1120px / 2 + 1.25rem));
  padding-block: 1.5rem 2.2rem;
  background:
    radial-gradient(120% 90% at 50% 8%, #15151d 0%, #0a0a0e 62%, #08080b 100%);
  overflow: hidden;
  isolation: isolate;
}
.plate::after {
  /* Engraved grain, kept clear of the canvas: see the note above about
     blend modes over a live WebGL surface. */
  content: '';
  position: absolute; inset: auto 0 0 0; height: 55%;
  pointer-events: none; z-index: 0;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='g'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2'/%3E%3C/filter%3E%3Crect width='140' height='140' filter='url(%23g)' opacity='0.04'/%3E%3C/svg%3E");
  opacity: .5;
}
/* The figure sits on pure black so additive light reads as light. */
/* The canvas breaks out of the plate's inline padding and runs the full width
 * of the viewport; the figure itself stays centred inside it. */
.plate-scene {
  display: block;
  width: 100%;
  border-radius: 3px;
  box-shadow: 0 0 0 1px rgba(224,184,120,.14), 0 24px 60px -30px rgba(0,0,0,.9);
  cursor: grab;
  touch-action: pan-y;
  isolation: isolate;
  transform: translateZ(0);
}
.plate-scene:active { cursor: grabbing; }
/* The line is not a caption under a picture — it is the title of what the
 * picture is doing, so it sits over the figure at display size. */
.stage { position: relative; }

/* Labels tracked to the bodies. Colour is the element, set inline from the same
 * 오방색 table the currents and atmospheres use, so nothing needs a key. */
.orb-labels { position: absolute; inset: 0; pointer-events: none; }
.orb-label {
  position: absolute; top: 0; left: 0;
  white-space: nowrap;
  font-family: var(--mono);
  font-size: .66rem;
  letter-spacing: .06em;
  padding: .24rem .55rem;
  border-radius: 2px;
  background: rgba(7,7,10,.62);
  backdrop-filter: blur(3px);
  opacity: 0;
  transition: opacity .18s ease;
}
.orb-label b { font-weight: 600; }
.orb-label { box-shadow: inset 0 0 0 1px currentColor; }
.orb-me {
  color: #17140e; background: rgba(240,214,160,.92);
  font-weight: 700; letter-spacing: .14em;
}
html[lang="ko"] .orb-label { font-family: var(--sans); font-size: .68rem; letter-spacing: 0; }
.stage-line {
  position: relative;
  width: 100%;
  margin: 1.1rem 0 0;
  text-align: center;
  font-family: 'Gowun Batang', var(--serif);
  font-weight: 400;
  font-size: clamp(1.05rem, 2.2vw, 1.35rem);
  line-height: 1.4;
  letter-spacing: -.01em;
  color: #d8d2c6;
  pointer-events: none;
}
/* Both lines are absolutely placed so they can cross-fade in the same spot,
 * which leaves the parent with no height of its own — hence the explicit one. */
.stage-line { min-height: 2.9em; }
.stage-line span {
  position: absolute; left: 0; right: 0; top: 0;
  text-align: center;
  opacity: 0; transform: translateY(14px);
}
.stage-line span.on { opacity: 1; transform: translateY(0); }
@media (prefers-reduced-motion: no-preference) {
  .stage-line span {
    transition: opacity 1.1s cubic-bezier(.2,.7,.3,1), transform 1.1s cubic-bezier(.2,.7,.3,1);
  }
}
.plate-rule {
  height: 1px; margin: 1.2rem 0 1.4rem;
  background: linear-gradient(90deg, transparent, rgba(224,184,120,.45), transparent);
}
.plate-copy { position: relative; z-index: 1; }
.plate-kicker {
  font-family: var(--mono);
  margin-left: 0;
  font-size: .64rem; letter-spacing: .34em; text-transform: uppercase;
  color: rgba(224,184,120,.8); margin: 0 0 1rem;
}
.plate-title {
  font-family: var(--serif); font-weight: 400;
  font-size: clamp(1.9rem, 7.4vw, 2.7rem);
  line-height: 1.22; letter-spacing: -.005em;
  color: #f4f1ea; margin: 0; text-wrap: balance;
}
.plate-title em { font-style: italic; color: var(--gold); }

/*
 * Large and small set as one block: the small line is indented to the display
 * line's optical left edge and given a rule, so it reads as a caption belonging
 * to the statement rather than as body copy that happens to follow it.
 */
.plate-sub {
  max-width: 23rem;
  margin: 1.7rem 0 0;
  padding-left: 1.1rem;
  border-left: 1px solid rgba(224,184,120,.28);
  font-size: clamp(.92rem, 2.6vw, 1.02rem);
  line-height: 1.7;
  color: rgba(238,233,222,.62);
  text-wrap: pretty;
}
html[lang="ko"] .plate-sub { word-break: keep-all; }
:lang(ko) .plate-title, html[lang="ko"] .plate-title {
  font-family: 'Gowun Batang', var(--serif);
  line-height: 1.3;
  letter-spacing: -.02em;
}
/* One short declarative line deserves to be set large. */
.plate-title {
  font-size: clamp(2.3rem, 9vw, 4.2rem);
  line-height: 1.08;
  text-wrap: balance;
}
html[lang="ko"] .plate-title { font-size: clamp(2.1rem, 8.2vw, 3.8rem); }

/* The paper page starts below the plate. */
body[data-surface="light"] .hero { padding-top: 2.5rem; }

/* ───────────────────────────── landing ───────────────────────────── */

.hero { padding: 2rem 0 1.75rem; }

.eyebrow {
  font-size: .68rem;
  letter-spacing: .22em;
  text-transform: uppercase;
  color: var(--gold-dim);
  margin: 0 0 1rem;
}

h1 {
  font-family: var(--serif);
  font-weight: 400;
  font-size: clamp(2.1rem, 8.5vw, 2.9rem);
  line-height: 1.12;
  font-weight: 400;
  margin: 0 0 1.1rem;
  letter-spacing: -.01em;
}
h1 em { font-style: italic; color: var(--gold); }
html[lang="ko"] h1 em,
html[lang="ko"] .plate-title em {
  font-style: normal;
  font-weight: 700;
  color: var(--gold);
}

.lede { color: var(--muted); margin: 0; font-size: 1.02rem; }
.lede.small { font-size: .95rem; margin-bottom: 1.25rem; }

.view-title {
  font-family: var(--serif);
  font-weight: 400;
  font-size: 1.7rem;
  margin: 1.5rem 0 1rem;
}

/* ───────────────────────────── cards ───────────────────────────── */

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 1.4rem;
  margin: 1.5rem 0;
}

.field { display: block; margin-bottom: 1rem; }
.field > span {
  display: block;
  font-size: .78rem;
  letter-spacing: .04em;
  color: var(--muted);
  margin-bottom: .45rem;
}

input[type=text], input[type=date], input[type=time], input[type=search] {
  width: 100%;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--text);
  font: inherit;
  font-size: 1rem;
  padding: .8rem .9rem;
  min-height: 48px;
}
input:focus-visible {
  outline: none;
  border-color: var(--gold-dim);
  box-shadow: 0 0 0 3px rgba(224, 184, 120, .12);
}
input::placeholder { color: var(--dim); }

.opt { margin: -.25rem 0 1rem; }
.opt summary {
  cursor: pointer;
  font-size: .85rem;
  color: var(--muted);
  padding: .35rem 0;
}
.opt summary::marker { color: var(--gold-dim); }
.opt .field { margin-top: .75rem; }

button { font: inherit; cursor: pointer; }

.primary {
  width: 100%;
  background: var(--accent-fill);
  color: var(--on-accent);
  border: none;
  border-radius: 10px;
  padding: .95rem 1rem;
  font-weight: 650;
  font-size: 1rem;
  min-height: 50px;
  transition: filter .15s;
}
.primary:hover { filter: brightness(1.08); }
.primary:active { transform: translateY(1px); }

.secondary {
  background: var(--surface-2);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: .95rem 1.15rem;
  min-height: 50px;
  white-space: nowrap;
}
.secondary:hover { border-color: var(--gold-dim); }

.ghost-btn {
  background: none;
  border: none;
  color: var(--muted);
  font-size: .8rem;
  text-decoration: underline;
  text-underline-offset: 3px;
  padding: .3rem;
}
.ghost-btn:hover { color: var(--text); }

.row { display: flex; gap: .6rem; }
.row .primary { flex: 1; }

.fineprint { font-size: .76rem; color: var(--dim); margin: .85rem 0 0; text-align: center; }
.muted { color: var(--muted); }

/* ───────────────────────── symmetric vs directional ───────────────────────── */

.vs { margin: 2.75rem 0 0; }
.vs h2 {
  font-family: var(--serif); font-weight: 400;
  font-size: clamp(1.4rem, 5.5vw, 1.8rem);
  margin: 0 0 .7rem; letter-spacing: -.01em; text-wrap: balance;
}
.vs-body { color: var(--muted); font-size: .95rem; margin: 0 0 1.6rem; }

.vs-pair { display: grid; gap: .7rem; grid-template-columns: 1fr 1fr; }
.vs-fig {
  margin: 0; padding: 1rem .8rem .9rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
}
.vs-fig svg { width: 100%; height: auto; display: block; }
.vs-dot { fill: var(--muted); }
.vs-line { stroke: var(--muted); stroke-width: 2; }
.vs-give { stroke: var(--gold); color: var(--gold); stroke-width: 3.5; }
.vs-take { stroke: var(--water); color: var(--water); stroke-width: 1.5; }
.vs-fig figcaption { margin-top: .7rem; text-align: center; }
.vs-fig figcaption b {
  display: block; font-size: .72rem; letter-spacing: .14em;
  text-transform: uppercase; color: var(--dim); margin-bottom: .2rem;
}
.vs-fig figcaption span { font-size: .86rem; color: var(--text); }

.vs-count {
  margin: 1.2rem 0 0; font-family: var(--serif);
  font-size: .98rem; color: var(--muted); text-wrap: balance;
}

/* ───────────────────────────── how-it-works ───────────────────────────── */

.how { list-style: none; padding: 0; margin: 2rem 0 0; }
.how li {
  display: flex;
  gap: .85rem;
  align-items: baseline;
  padding: .7rem 0;
  border-top: 1px solid var(--border-soft);
  color: var(--muted);
  font-size: .92rem;
}
.how b {
  font-family: var(--serif);
  color: var(--gold-dim);
  font-size: .95rem;
  flex: none;
  width: 1rem;
}

/* ───────────────────────────── day master card ───────────────────────────── */

.dm {
  background: linear-gradient(160deg, var(--surface-2), var(--surface));
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 1.6rem;
  margin: 1.5rem 0;
}
.dm-top { display: flex; align-items: center; gap: .7rem; margin-bottom: 1rem; }
.dm-hanja {
  font-family: var(--serif);
  font-size: 1.5rem;
  width: 2.6rem; height: 2.6rem;
  display: grid; place-items: center;
  border: 1px solid var(--border);
  border-radius: 9px;
  background: var(--bg);
  flex: none;
}
.dm-meta { font-size: .74rem; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); }
.dm-name { font-family: var(--serif); font-size: 1.9rem; line-height: 1.1; margin: 0; font-weight: 400; }
.dm-blurb { color: var(--muted); margin: .8rem 0 0; font-size: .96rem; }

/* Two layers, not a boast about counts: the one the reader already has, and
 * the one this system puts on top of it. */
.layers { margin: 1.1rem 0 0; display: grid; gap: .1rem; }
.layer { padding: .8rem 0; border-top: 1px solid var(--border-soft); }
.layer dt {
  font-family: var(--mono);
  font-size: .64rem; letter-spacing: .18em; text-transform: uppercase;
  color: var(--dim); margin-bottom: .3rem;
}
.layer dd { margin: 0; font-size: .88rem; color: var(--muted); line-height: 1.55; }
/* The name of the type carries the column. */
.layer-name {
  margin: .35rem 0 .5rem;
  font-size: 1.06rem;
  font-weight: 600;
  letter-spacing: -.01em;
  color: var(--text);
}
.layer--add .layer-name { color: var(--gold); }
/* The reconciling line is the one the reader is meant to leave with, so it is
 * set apart rather than being a third equal column. */
.layer--join { border-top: 1px solid var(--border); }
.layer--join dd { color: var(--text); }
.layer--add dt { color: var(--gold-dim); }
.layer--add dd { color: var(--text); }
.aspect-note {
  margin: .5rem 0 0 !important;
  font-size: .78rem !important;
  color: var(--dim) !important;
  letter-spacing: .01em;
}

.bars { margin-top: 1.25rem; display: grid; gap: .45rem; }
.bar { display: grid; grid-template-columns: 3.4rem 1fr 2.2rem; align-items: center; gap: .6rem; font-size: .76rem; }
.bar span:first-child { color: var(--muted); }
.bar .track { height: 5px; background: var(--surface-2); border-radius: 3px; overflow: hidden; }
.bar .fill { height: 100%; border-radius: 3px; transition: width .6s cubic-bezier(.2,.8,.3,1); }
.bar .pct { color: var(--dim); text-align: right; font-variant-numeric: tabular-nums; }

/* ───────────────────────────── tiles ───────────────────────────── */

.split { display: grid; gap: .75rem; margin: 1.5rem 0; }
.tile {
  text-align: left;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 1.1rem 1.2rem;
  color: var(--text);
  transition: border-color .15s, background .15s;
}
.tile:hover { border-color: var(--gold-dim); background: var(--surface-2); }
.tile b { display: block; font-size: 1.02rem; margin-bottom: .2rem; }
.tile span { color: var(--muted); font-size: .87rem; }

.tile.wide { width: 100%; margin-bottom: 1.5rem; }

/* ───────────────────────────── circle map ───────────────────────────── */

.msg-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 1.4rem;
  margin: 0 0 .8rem;
}
.msg-card.gold {
  background: linear-gradient(160deg, rgba(224,184,120,.11), rgba(224,184,120,.02));
  border-color: rgba(224,184,120,.32);
}
.msg-label {
  font-size: .7rem; letter-spacing: .18em; text-transform: uppercase;
  color: var(--gold-dim); margin: 0 0 .5rem;
}
.msg-card h3 {
  font-family: var(--serif); font-weight: 400;
  font-size: 1.55rem; line-height: 1.2; margin: 0 0 .6rem;
}
.msg-body { color: var(--muted); font-size: .95rem; margin: 0 0 1.1rem; }
.msg-send { width: 100%; }

/* ───────────────────────────── install ───────────────────────────── */

/* `display: flex` on a class outranks the UA rule for [hidden], so the bar
 * would sit there empty on every screen. Restore it explicitly. */
.install-bar[hidden] { display: none; }

.install-bar {
  position: fixed;
  left: 50%; bottom: max(1rem, env(safe-area-inset-bottom));
  transform: translateX(-50%);
  width: min(var(--wrap), calc(100vw - 2rem));
  display: flex; align-items: center; gap: .75rem;
  background: var(--surface-2);
  border: 1px solid var(--gold-dim);
  border-radius: 14px;
  padding: .8rem .9rem .8rem 1.05rem;
  box-shadow: 0 12px 34px rgba(0,0,0,.5);
  z-index: 40;
  animation: rise .35s ease both;
}
.install-copy { flex: 1; font-size: .86rem; }
.install-go {
  background: var(--accent-fill); color: var(--on-accent); border: none;
  border-radius: 8px; padding: .5rem .95rem; font-weight: 650; font-size: .85rem;
  white-space: nowrap;
}
.install-x {
  background: none; border: none; color: var(--dim);
  font-size: 1.3rem; line-height: 1; padding: .2rem .35rem;
}
.install-x:hover { color: var(--text); }

/* ───────────────────────────── rooms ───────────────────────────── */

.room-note { font-size: .88rem; margin: -.4rem 0 .9rem; max-width: 34rem; }
.rooms { display: grid; gap: .55rem; margin-bottom: 1.5rem; }
.room {
  display: grid; gap: .5rem; text-align: left; width: 100%;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 12px; padding: .85rem .95rem; color: var(--text);
  transition: border-color .15s;
}
.room:hover { border-color: var(--gold-dim); }
.room-head { display: flex; justify-content: space-between; align-items: baseline; gap: 1rem; }
.room-head b { font-size: .95rem; font-weight: 600; }
.room-n { font-family: inherit; font-size: .76rem; color: var(--dim); font-variant-numeric: tabular-nums; }
.room-bar { display: flex; height: 7px; border-radius: 4px; overflow: hidden; background: var(--surface-2); }
.room-bar i { display: block; }
.room-foot { display: flex; justify-content: space-between; gap: 1rem; font-size: .78rem; }
.room-role { color: var(--gold-dim); }
.room-tilt { color: var(--dim); }

/* ───────────────────────────── graph ───────────────────────────── */

.graph-wrap { margin: .5rem 0 1.5rem; }

.scene {
  width: 100%;
  display: block;
  touch-action: pan-y;
  cursor: grab;
}
.scene:active { cursor: grabbing; }
.scene-hint {
  text-align: center; font-size: .72rem; color: var(--dim);
  margin: .1rem 0 .5rem; letter-spacing: .06em;
}

.msg-card.sharp {
  background: linear-gradient(160deg, rgba(226,112,90,.09), rgba(226,112,90,.02));
  border-color: rgba(226,112,90,.28);
}
.msg-card.sharp .msg-label { color: var(--fire); }

.group-rows { display: grid; gap: .4rem; margin-top: .3rem; }
.group-row {
  display: flex; justify-content: space-between; align-items: baseline; gap: 1rem;
  padding: .55rem .75rem;
  background: var(--surface-2); border-radius: 9px;
}
.group-row b { font-size: .88rem; font-weight: 600; }
.group-row span { font-size: .82rem; color: var(--gold-dim); }

.member-top { display: flex; align-items: center; gap: .7rem; }
.member-tags { display: flex; gap: .5rem; margin-top: .6rem; align-items: center; }
.closeness { display: flex; gap: .25rem; flex: 1; }
.closeness .cl {
  flex: 1;
  background: var(--surface-2); border: 1px solid var(--border);
  color: var(--dim); border-radius: 7px;
  padding: .32rem .2rem; font-size: .72rem;
}
.closeness .cl[aria-pressed=true] {
  background: var(--accent-fill); color: var(--on-accent); border-color: var(--accent-fill); font-weight: 650;
}
.group-pick {
  background: var(--surface-2); border: 1px solid var(--border);
  color: var(--muted); border-radius: 7px;
  padding: .32rem .5rem; font-size: .74rem; font-family: inherit;
  min-height: 30px;
}
.group-pick.wide { flex: 1; min-height: 44px; font-size: .9rem; }

.graph { width: 100%; height: auto; display: block; overflow: visible; }

.graph .orbit { fill: none; stroke: var(--border-soft); stroke-width: 1; }
.graph .orbit.faint { stroke: rgba(38, 38, 46, .5); stroke-dasharray: 2 5; }

.graph .wedge-empty line { stroke: rgba(226, 112, 90, .22); stroke-width: 1; stroke-dasharray: 3 4; }
.graph .wedge-empty circle { fill: none; stroke: rgba(226, 112, 90, .3); stroke-width: 1; stroke-dasharray: 3 4; }
.graph .wedge-empty text {
  fill: rgba(226, 112, 90, .55); font-size: 8px; text-anchor: middle;
  font-family: var(--sans); letter-spacing: .1em; text-transform: uppercase;
}
.graph .wedge-empty .wedge-role {
  fill: rgba(226, 112, 90, .42); font-size: 8.5px;
  letter-spacing: 0; text-transform: none;
}

.graph .spoke {
  stroke-width: 1.5; opacity: 0;
  animation: draw .5s ease forwards;
}
.graph .spoke.in { stroke: var(--gold); }
.graph .spoke.out { stroke: var(--water); }
.graph .spoke.level { stroke: var(--dim); stroke-dasharray: 4 4; }

.graph .tie {
  stroke-width: 1; opacity: 0;
  animation: draw .5s ease forwards;
}
.graph .tie.harmony { stroke: rgba(224, 184, 120, .38); }
.graph .tie.clash { stroke: rgba(226, 112, 90, .3); stroke-dasharray: 3 3; }

@keyframes draw { to { opacity: .75; } }

.graph .node { opacity: 0; animation: pop .45s cubic-bezier(.2,1.2,.4,1) forwards; cursor: pointer; }
.graph .node.me { opacity: 1; animation: none; cursor: default; }
@keyframes pop { from { opacity: 0; transform: scale(.8); } to { opacity: 1; transform: scale(1); } }

.graph .node .disc { stroke: var(--bg); stroke-width: 2.5; }
.graph .node.me .disc { fill: var(--text); }
.graph .node .halo { fill: none; stroke: var(--gold); stroke-width: 1.5; opacity: .8; }
.graph .node .ini {
  font-family: var(--serif); font-size: 13px; text-anchor: middle;
  fill: var(--bg); font-weight: 600; pointer-events: none;
}
.graph .node.me .ini { font-size: 20px; }
.graph .node .lbl {
  font-size: 9px; text-anchor: middle; fill: var(--muted);
  font-family: var(--sans); pointer-events: none;
}
.graph .node.treasure .lbl { fill: var(--gold); font-weight: 650; }
.graph .node:hover .disc, .graph .node:focus-visible .disc { stroke: var(--gold); }
.graph .node:focus-visible { outline: none; }

.graph-key {
  display: flex; flex-wrap: wrap; gap: .25rem 1rem; justify-content: center;
  font-size: .7rem; color: var(--dim); margin-top: .25rem;
}
.graph-key span { display: inline-flex; align-items: center; gap: .35rem; }
.graph-key i { width: 14px; height: 2px; border-radius: 2px; display: inline-block; }
.graph-key .k-in { background: var(--gold); }
.graph-key .k-out { background: var(--water); }
.graph-key .k-tie { background: rgba(224, 184, 120, .4); }

.node-detail {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 1.1rem 1.2rem;
  margin-top: .75rem;
  animation: rise .25s ease both;
}
.node-detail h4 { font-family: var(--serif); font-weight: 400; font-size: 1.35rem; margin: 0 0 .2rem; }
.node-detail .detail-dir {
  font-size: .74rem; letter-spacing: .1em; text-transform: uppercase;
  color: var(--gold-dim); margin: 0 0 .6rem;
}
.node-detail .msg-body { margin: 0; }
.detail-close {
  position: absolute; top: .5rem; right: .6rem;
  background: none; border: none; color: var(--dim); font-size: 1.4rem; line-height: 1; padding: .25rem .4rem;
}
.detail-close:hover { color: var(--text); }

.gap-card {
  border-left: 2px solid var(--fire);
  background: var(--surface);
  border-radius: 0 12px 12px 0;
  padding: .95rem 1.1rem;
  margin-bottom: .6rem;
}
.gap-card b { display: block; font-size: .74rem; letter-spacing: .12em; text-transform: uppercase; color: var(--fire); margin-bottom: .35rem; }
.gap-card p { margin: 0; font-size: .94rem; color: var(--muted); }

.members { display: grid; gap: .5rem; margin-bottom: 1.5rem; }
.member {
  display: flex; align-items: center; gap: .7rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: .75rem .9rem;
}
.member .ini {
  width: 2.1rem; height: 2.1rem; flex: none;
  border-radius: 50%; display: grid; place-items: center;
  font-family: var(--serif); font-size: .95rem;
  background: var(--surface-2); border: 1px solid var(--border); color: var(--gold);
}
.member .who { flex: 1; min-width: 0; }
.member .who b { display: block; font-size: .92rem; }
.member .who span { font-size: .75rem; color: var(--dim); }
.member .drop {
  background: none; border: none; color: var(--dim);
  font-size: 1.35rem; line-height: 1; padding: .25rem .5rem;
}
.member .drop:hover { color: var(--fire); }

.map-note {
  background: linear-gradient(160deg, rgba(224,184,120,.09), rgba(224,184,120,.02));
  border: 1px solid rgba(224,184,120,.26);
  border-radius: 14px;
  padding: 1.15rem;
  margin: 1.75rem 0 0;
}
.map-note b { display: block; font-size: .95rem; margin-bottom: .3rem; }
.map-note p { color: var(--muted); font-size: .88rem; margin: 0 0 .9rem; }

#mapAddForm .row input[type=text] { flex: 1.2; }
#mapAddForm .row input[type=date] { flex: 1; }

/* ───────────────────────────── people grid ───────────────────────────── */

.search { margin-bottom: .9rem; }

.chips { display: flex; gap: .45rem; flex-wrap: wrap; margin-bottom: 1.1rem; }
.chip {
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--muted);
  border-radius: 999px;
  padding: .38rem .85rem;
  font-size: .82rem;
}
.chip[aria-pressed=true] { background: var(--accent-fill); color: var(--on-accent); border-color: var(--accent-fill); font-weight: 600; }

.people { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: .6rem; }
.person {
  text-align: left;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: .85rem .9rem;
  color: var(--text);
  display: flex; align-items: center; gap: .65rem;
  transition: border-color .15s;
}
.person:hover { border-color: var(--gold-dim); }
.person .ini {
  width: 2.1rem; height: 2.1rem; flex: none;
  border-radius: 50%;
  display: grid; place-items: center;
  font-family: var(--serif); font-size: .95rem;
  background: var(--surface-2); border: 1px solid var(--border);
  color: var(--gold);
}
.person .who { min-width: 0; }
.person .who b { display: block; font-size: .9rem; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.person .who span { font-size: .74rem; color: var(--dim); }

.empty { color: var(--dim); font-size: .9rem; padding: 1.5rem 0; text-align: center; }

.add-card h3 { font-family: var(--serif); font-weight: 400; font-size: 1.25rem; margin: 0 0 .4rem; }
.add-card .muted { font-size: .88rem; margin: 0 0 1.1rem; }

/* ───────────────────────────── join ───────────────────────────── */

.join-head { padding: 1.75rem 0 .5rem; }
.join-head h1 { font-size: clamp(1.85rem, 7.5vw, 2.5rem); }

/* ───────────────────────────── link card ───────────────────────────── */

.link-card #linkBox { margin-bottom: .7rem; font-size: .84rem; color: var(--muted); }
.link-preview {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: .95rem 1.05rem;
  margin-bottom: .9rem;
}
.link-preview .lp-title { font-weight: 650; font-size: .95rem; margin-bottom: .2rem; }
.link-preview .lp-desc { color: var(--muted); font-size: .84rem; }
.link-preview .lp-url { color: var(--dim); font-size: .72rem; letter-spacing: .06em; text-transform: uppercase; margin-top: .5rem; }

/* ───────────────────────────── result ───────────────────────────── */

.res-head { text-align: center; padding: 1.75rem 0 .5rem; }
.res-pair { font-size: .82rem; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); margin-bottom: 1.25rem; }

.ring { width: 132px; height: 132px; margin: 0 auto 1.1rem; position: relative; }
.ring svg { transform: rotate(-90deg); }
.ring .score {
  position: absolute; inset: 0;
  display: grid; place-content: center; text-align: center;
}
.ring .score b { font-family: var(--serif); font-size: 2.4rem; line-height: 1; font-weight: 400; }
.ring .score span { font-size: .62rem; letter-spacing: .18em; text-transform: uppercase; color: var(--muted); }

.arche-name {
  font-family: var(--serif);
  font-size: clamp(2rem, 8vw, 2.6rem);
  font-weight: 400;
  margin: .4rem 0 .5rem;
  color: var(--gold);
}
.arche-tag { color: var(--text); font-size: 1.05rem; margin: 0 0 .35rem; }

.flow-badge {
  display: inline-block;
  border: 1px solid var(--border);
  background: var(--surface);
  border-radius: 999px;
  padding: .3rem .85rem;
  font-size: .74rem;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--muted);
  margin-top: .9rem;
}

/* The element meeting — an image, set apart from the argument below it. */
.meet {
  font-family: var(--serif);
  font-size: 1.08rem;
  line-height: 1.5;
  color: var(--muted);
  text-align: center;
  margin: 1.6rem auto 0;
  max-width: 30rem;
  padding: 1.1rem 1.2rem;
  border-top: 1px solid var(--border-soft);
  border-bottom: 1px solid var(--border-soft);
}

.give-take { display: grid; gap: .7rem; margin: 1.75rem 0; }
.gt {
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 2px solid var(--gold-dim);
  border-radius: 0 12px 12px 0;
  padding: .95rem 1.1rem;
}
.gt b { display: block; font-size: .72rem; letter-spacing: .14em; text-transform: uppercase; color: var(--gold-dim); margin-bottom: .3rem; }
.gt p { margin: 0; font-size: .95rem; }

.section-label {
  font-size: .72rem; letter-spacing: .18em; text-transform: uppercase;
  color: var(--dim); margin: 2rem 0 .8rem;
}

.prose { color: var(--muted); font-size: .98rem; }
.prose p { margin: 0 0 .9rem; }
.prose p:last-child { margin-bottom: 0; }

.because { display: grid; gap: .1rem; }
.because li {
  list-style: none;
  padding: 1rem 0;
  border-top: 1px solid var(--border-soft);
}
.because li b {
  display: block;
  font-size: .74rem; letter-spacing: .12em; text-transform: uppercase;
  color: var(--gold-dim); margin-bottom: .35rem;
}
.because li p { margin: 0; color: var(--muted); font-size: .93rem; }

.friction {
  background: rgba(226, 112, 90, .06);
  border: 1px solid rgba(226, 112, 90, .2);
  border-radius: 12px;
  padding: 1.05rem 1.15rem;
  margin: 1.5rem 0;
}
.friction b { display: block; font-size: .72rem; letter-spacing: .14em; text-transform: uppercase; color: var(--fire); margin-bottom: .35rem; }
.friction p { margin: 0; font-size: .94rem; }

.charts { display: grid; grid-template-columns: 1fr 1fr; gap: .6rem; margin: 1.25rem 0; }
.mini {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: .9rem;
}
.mini .mini-name { font-size: .78rem; color: var(--muted); margin-bottom: .5rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mini .mini-dm { font-family: var(--serif); font-size: 1.15rem; margin-bottom: .1rem; }
.mini .mini-sub { font-size: .72rem; color: var(--dim); }
.mini .pillars { display: flex; gap: .3rem; margin-top: .7rem; }
.mini .pillars i {
  font-style: normal; font-family: var(--serif); font-size: .78rem;
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: 6px; padding: .2rem .35rem; color: var(--muted);
}

/* ───────────────────────────── paywall ───────────────────────────── */

.locked {
  position: relative;
  border: 1px solid var(--border);
  border-radius: 16px;
  overflow: hidden;
  margin: 1.5rem 0;
}
.locked .blurred {
  padding: 1.4rem;
  filter: blur(5px);
  opacity: .5;
  user-select: none;
  pointer-events: none;
}
.locked .blurred h4 { font-family: var(--serif); font-weight: 400; margin: 0 0 .5rem; font-size: 1.15rem; }
.locked .blurred p { margin: 0 0 .7rem; color: var(--muted); font-size: .92rem; }
.lock-overlay {
  position: absolute; inset: 0;
  background: linear-gradient(to bottom, rgba(10,10,12,.55), rgba(10,10,12,.94) 55%);
  display: flex; flex-direction: column; justify-content: flex-end;
  padding: 1.3rem;
  text-align: center;
}
.lock-overlay b { font-family: var(--serif); font-size: 1.3rem; font-weight: 400; display: block; margin-bottom: .3rem; }
.lock-overlay p { color: var(--muted); font-size: .88rem; margin: 0 0 1rem; }
.price { color: var(--gold); font-weight: 650; }

.loop-cta {
  background: linear-gradient(160deg, rgba(224,184,120,.10), rgba(224,184,120,.02));
  border: 1px solid rgba(224,184,120,.28);
  border-radius: 16px;
  padding: 1.4rem;
  margin: 2rem 0 1rem;
  text-align: center;
}
.loop-cta b { font-family: var(--serif); font-size: 1.3rem; font-weight: 400; display: block; margin-bottom: .35rem; }
.loop-cta p { color: var(--muted); font-size: .9rem; margin: 0 0 1.1rem; }

.toast {
  position: fixed; left: 50%; bottom: 1.5rem; transform: translateX(-50%) translateY(1rem);
  background: var(--text); color: var(--bg);
  padding: .7rem 1.2rem; border-radius: 999px;
  font-size: .88rem; font-weight: 600;
  opacity: 0; pointer-events: none; transition: .25s; z-index: 50;
}
.toast.on { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ───────────────────────────── footer ───────────────────────────── */

.foot {
  max-width: var(--wrap);
  margin: 3.5rem auto 0;
  padding: 1.75rem 1.25rem 0;
  border-top: 1px solid var(--border-soft);
  color: var(--dim);
  font-size: .78rem;
}
.foot p { margin: 0 0 .5rem; }
.foot .dim { color: var(--dim); opacity: .8; }

@media (min-width: 520px) {
  .split { grid-template-columns: 1fr 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}


/* Korean headings use the 명조; Latin keeps the high-contrast serif. */
html[lang="ko"] h1,
html[lang="ko"] h2,
html[lang="ko"] .view-title,
html[lang="ko"] .arche-name,
html[lang="ko"] .dm-name,
html[lang="ko"] .msg-card h3,
html[lang="ko"] .vs h2 {
  font-family: 'Gowun Batang', var(--serif);
  letter-spacing: -.01em;
}

/* The comparison figures read as plates, not wireframes. */
.vs-fig {
  background: linear-gradient(180deg, var(--surface), var(--surface-2));
  box-shadow: inset 0 1px 0 rgba(255,255,255,.04);
}
body[data-surface="light"] .vs-fig {
  box-shadow: 0 1px 2px rgba(25,23,19,.05), inset 0 1px 0 rgba(255,255,255,.6);
}
.vs-fig figcaption b { font-family: var(--mono); }


/* ═══════════════════════ 성도 · the engraved plate ═══════════════════════
 * Drawn from 천상열차분야지도, the 1395 star stone: warm ochre cut into black,
 * a ruled title cartouche, and rectangular blocks of text set in a grid around
 * a central disc. Two consequences for this stylesheet: corners get squared
 * off, because a chart is ruled and not rounded; and every panel is framed by
 * a hairline with a second rule inside it, which is how the stone separates
 * one field from the next. */

:root { --rule: 1px solid var(--border); --engrave: #c9a227; }

.card, .dm, .msg-card, .locked, .loop-cta, .room, .vs-fig, .mini,
.tile, .person, .member, .gap-card, .link-preview, .node-detail, .map-note {
  border-radius: 3px;
}
.primary, .secondary, .install-go, .group-pick, input, .room-bar { border-radius: 3px; }
.chip { border-radius: 2px; }

/* A framed field, ruled twice — the stone's convention for a bounded block. */
.dm, .msg-card.gold, .loop-cta, .locked {
  position: relative;
  box-shadow: inset 0 0 0 1px var(--bg), inset 0 0 0 2px var(--border-soft);
}

/* Title cartouche */
.plate-copy {
  padding: 0;
  max-width: 34rem;
  margin: 0 auto;
  text-align: left;
}
.plate-kicker {
  display: inline-block;
  padding: .34rem 1rem;
  border: 1px solid rgba(201,162,39,.34);
  border-radius: 2px;
  color: var(--engrave);
}
.plate-rule {
  background: none;
  height: 0;
  border-top: 1px solid rgba(201,162,39,.30);
  border-bottom: 1px solid rgba(201,162,39,.14);
  margin: 1.3rem 0 1.5rem;
}

/* Plate number on a reading — the figure's index in the chart. */
.plate-no {
  font-family: var(--mono);
  font-size: .68rem; letter-spacing: .24em;
  color: var(--gold-dim);
  display: block; margin-bottom: .5rem;
}

/* Section labels read as engraved captions. */
.section-label {
  border-top: 1px solid var(--border-soft);
  padding-top: .9rem;
}

/* Element marks — the 오방색 shown as what they are: the five planets. */
.marks { display: flex; gap: .4rem; justify-content: center; margin-top: .9rem; }
.mark {
  display: inline-flex; align-items: center; gap: .3rem;
  font-family: var(--mono); font-size: .62rem; letter-spacing: .1em;
  color: var(--dim);
}
.mark i { width: 7px; height: 7px; border-radius: 50%; display: inline-block; }




/* ── the split hero ───────────────────────────────────────────────────────
 * Copy and the ask on the left, the figure on the right. The figure is second
 * in source order on wide screens and first on narrow ones, because on a phone
 * the moving thing is the reason to keep scrolling and on a desktop the
 * sentence is what has to land first.
 */
.plate-grid { display: grid; gap: clamp(1.5rem, 4vw, 3.25rem); align-items: center; }
@media (min-width: 900px) {
  .plate-grid { grid-template-columns: minmax(0, 1.02fr) minmax(0, 1fr); }
  .plate-grid .stage { order: 2; }
  .plate-grid .plate-copy { order: 1; }
}

/* ── two birthdays, side by side ── */
.pair-form { margin: 1.75rem 0 0; }
.pair { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem 1.35rem; }
.pair-col { display: flex; flex-direction: column; gap: .5rem; min-width: 0; }
.pair-tag {
  display: flex; align-items: center; gap: .45rem;
  margin: 0;
  font-family: var(--mono);
  font-size: .62rem;
  letter-spacing: .14em;
  color: var(--muted);
}
/* A dot in each side's own colour: the only legend the pair needs. */
.pair-tag::before {
  content: ''; width: 6px; height: 6px; border-radius: 50%;
  background: currentColor;
}
.pair-you { color: var(--gold); }
.pair-them { color: var(--fire); }
.pair-col input {
  width: 100%;
  min-width: 0;
  padding: .55rem .1rem;
  border: none;
  border-bottom: 1px solid var(--border);
  background: none;
  color: var(--text);
  font: inherit;
  font-size: .95rem;
  border-radius: 0;
  transition: border-color .15s;
}
.pair-col input:focus { outline: none; border-bottom-color: var(--gold); }
.pair-col input::placeholder { color: var(--dim); }

.pair-go {
  display: flex; align-items: center; gap: 1rem; flex-wrap: wrap;
  margin-top: 1.5rem;
}
.pair-go .primary { flex: 0 0 auto; margin: 0; }
.pair-go .fineprint { flex: 1 1 12rem; margin: 0; text-align: left; }

.plate-copy .opt { margin-top: 1rem; }
.plate-note { text-align: left; margin-top: 1rem; }

/* ── what is actually true about this thing ── */
.trust {
  display: flex; flex-wrap: wrap; gap: 1.75rem 2.5rem;
  margin: 2.25rem 0 0; padding: 1.5rem 0 0;
  list-style: none;
  border-top: 1px solid var(--border-soft);
}
.trust li { display: flex; flex-direction: column; gap: .2rem; }
.trust b {
  font-family: var(--serif);
  font-size: 1.75rem;
  font-weight: 400;
  line-height: 1;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}
.trust span { font-size: .72rem; color: var(--muted); }

@media (max-width: 560px) {
  .pair { grid-template-columns: 1fr; gap: 1.35rem; }
  .pair-go .primary { width: 100%; }
}
