@font-face {
  font-family: "Noto Sans KR";
  src: url("fonts/noto-sans-kr-400.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Noto Sans KR";
  src: url("fonts/noto-sans-kr-700.woff2") format("woff2");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Black Han Sans";
  src: url("fonts/black-han-sans.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

:root {
  --red: #c8102e;
  --blue: #0a3d91;
  --yellow: #ffd100;
  --ink: #141414;
  --paper: #f3eee4;
  --card: #fffdf8;
  --muted: #5c564c;
  --header-h: 108px;
  --sans: "Noto Sans KR", "Apple SD Gothic Neo", "Malgun Gothic", sans-serif;
  --display: "Black Han Sans", "Noto Sans KR", sans-serif;
  color-scheme: light;
}

*,
*::before,
*::after { box-sizing: border-box; }

html {
  scroll-behavior: smooth;
  overflow-x: hidden;
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.5;
  word-break: keep-all;
}

:focus { outline: none; }

:focus-visible {
  outline: 3px solid var(--blue);
  outline-offset: 2px;
}

::selection {
  background: var(--yellow);
  color: var(--ink);
}

button {
  font: inherit;
  color: inherit;
  background: none;
  border: 0;
  padding: 0;
  cursor: pointer;
  touch-action: manipulation;
}

a { color: inherit; }

.skip {
  position: absolute;
  left: 12px;
  top: -40px;
  background: var(--yellow);
  color: var(--ink);
  padding: 8px 10px;
  z-index: 80;
  border: 2px solid var(--ink);
}

.skip:focus { top: 12px; }

.sr {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.wrap {
  width: min(1440px, 100%);
  margin: 0 auto;
  padding: 0 16px;
}

.stripe {
  height: 12px;
  background: repeating-linear-gradient(
    -45deg,
    var(--red) 0 10px,
    var(--yellow) 10px 20px,
    var(--blue) 20px 30px,
    var(--ink) 30px 40px
  );
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 40;
  background: var(--paper);
  border-bottom: 3px solid var(--ink);
}

.bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 16px;
  padding-top: 10px;
  padding-bottom: 10px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
}

.emblem {
  position: relative;
  width: 46px;
  height: 46px;
  flex: none;
}

.emblem i { position: absolute; display: block; }

.emblem i:nth-child(1) {
  width: 28px;
  height: 28px;
  background: var(--red);
  border-top-left-radius: 28px;
  top: 0;
  left: 0;
}

.emblem i:nth-child(2) {
  width: 16px;
  height: 28px;
  background: var(--blue);
  top: 0;
  right: 0;
}

.emblem i:nth-child(3) {
  width: 46px;
  height: 14px;
  background: var(--yellow);
  left: 0;
  bottom: 0;
}

.brand-text { display: flex; flex-direction: column; }

.brand-kicker {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.14em;
}

.brand-title {
  font-family: var(--display);
  font-size: clamp(1.25rem, 4vw, 1.85rem);
  line-height: 1.05;
  font-weight: 400;
}

.nav { display: flex; flex-wrap: wrap; gap: 4px; }

.nav a {
  text-decoration: none;
  font-weight: 700;
  padding: 8px 10px;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
}

.nav a.is-on { background: var(--yellow); }

main.wrap { padding-bottom: 56px; }

.noscript {
  border: 2px solid var(--ink);
  background: var(--yellow);
  padding: 10px;
  font-weight: 700;
}

section { margin-top: 36px; scroll-margin-top: calc(var(--header-h) + 8px); }

#org { overflow: clip; }

.sec-head {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  margin-bottom: 12px;
}

.sec-no {
  font-family: var(--display);
  width: 48px;
  height: 48px;
  display: grid;
  place-items: center;
  flex: none;
  background: var(--ink);
  color: var(--yellow);
  font-size: 1.2rem;
  font-weight: 400;
}

#org .sec-no { background: var(--red); color: #fff; }
#flow .sec-no { background: var(--blue); color: #fff; }
#pipe .sec-no { background: var(--yellow); color: var(--ink); }

h2 {
  font-family: var(--display);
  font-weight: 400;
  font-size: clamp(1.8rem, 4vw, 2.7rem);
  line-height: 1;
  margin: 0;
  font-synthesis: none;
}

h3 {
  font-family: var(--sans);
  font-size: 1.25rem;
  margin: 0 0 8px;
}

h4 {
  margin: 14px 0 4px;
  font-size: 0.78rem;
  letter-spacing: 0.02em;
}

.lead, .note, .detail p, .readout p, .pipe-panel p, .rule-card p { margin: 4px 0; }

.lead, .note { max-width: 46rem; }

.note { color: var(--muted); font-size: 0.92rem; }

.kicker {
  margin: 0 0 4px;
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--red);
}

.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 16px;
  padding: 0;
  margin: 0 0 10px;
  list-style: none;
  font-weight: 700;
  font-size: 0.9rem;
}

.legend li { display: flex; align-items: center; gap: 6px; }

.lg { width: 22px; height: 6px; display: block; background: var(--ink); }
.lg-room { background: var(--blue); }
.lg-res { background: var(--red); }

.scroll-hint {
  margin: 0 0 8px;
  background: var(--yellow);
  border: 2px solid var(--ink);
  padding: 6px 8px;
  font-weight: 700;
  font-size: 0.9rem;
}

.org-layout { display: flex; flex-direction: column; gap: 12px; }

.board-scroll {
  min-width: 0;
  overflow-x: auto;
  scrollbar-color: var(--ink) var(--yellow);
}

.board {
  position: relative;
  width: 100%;
  padding: 14px 12px 18px;
}

.links {
  position: absolute;
  left: 0;
  top: 0;
  z-index: 0;
  pointer-events: none;
  overflow: visible;
}

.link { fill: none; stroke-linejoin: miter; stroke-linecap: square; }
.link-cmd { stroke: var(--ink); stroke-width: 3px; }
.link-room { stroke: var(--link, var(--blue)); stroke-width: 2px; }
.link-res { stroke: var(--red); stroke-width: 3px; }
.link.is-hot { stroke-width: 4px; }
.link-cmd.is-hot { stroke: var(--red); }

.has-hover .link.is-dim { opacity: 0.12; }
.has-hover .node.is-dim { opacity: 0.38; }

.row { display: flex; }
.row-center { justify-content: center; margin-bottom: 12px; }
.row-staff { flex-direction: column; gap: 8px; }
.row-rooms { flex-direction: column; gap: 8px; }

.lane-gap { height: 0; }

.art-stack {
  display: flex;
  flex-direction: column;
  gap: 8px;
  outline: 3px solid var(--yellow);
  background: transparent;
  padding: 6px;
}

.folder-row { display: flex; flex-direction: column; gap: 6px; }

.art-kids {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-left: 10px;
  border-left: 6px solid var(--yellow);
  padding-left: 8px;
}

.node {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 8px;
  width: 100%;
  min-height: 48px;
  padding: 8px 10px 8px 14px;
  text-align: left;
  background: var(--card);
  border: 2px solid var(--ink);
  box-shadow: 3px 3px 0 var(--ink);
  --tone: var(--ink);
}

.node::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 6px;
  background: var(--tone);
}

.tone-red { --tone: var(--red); }
.tone-blue { --tone: var(--blue); }
.tone-yellow { --tone: var(--yellow); }
.tone-ink { --tone: var(--ink); }
.tone-gold { --tone: #a56b00; }

.node.fill { color: #fff; padding-left: 12px; }
.node.fill::before { display: none; }
.node.fill.tone-red { background: var(--red); }
.node.fill.tone-blue { background: var(--blue); }
.node.fill.tone-ink { background: var(--ink); }
.node.fill.tone-yellow { background: var(--yellow); color: var(--ink); }

.node.split {
  background: linear-gradient(90deg, var(--red) 0 10px, var(--yellow) 10px);
  color: var(--ink);
  padding-left: 16px;
}
.node.split::before { display: none; }

.shape-circle { border-radius: 999px; }

.node-mark {
  font-size: 11px;
  font-weight: 700;
  min-width: 2.4rem;
  opacity: 0.85;
}

.node-name { font-weight: 700; font-size: 1rem; line-height: 1.25; }

.dots { display: flex; gap: 3px; margin-left: auto; }
.dot { width: 8px; height: 8px; border: 1px solid var(--ink); display: block; }

.node.is-hot { outline: 3px solid var(--red); outline-offset: 2px; }
.node.is-pinned { box-shadow: 5px 5px 0 var(--red); }

.res-wrap { margin-top: 16px; display: flex; flex-direction: column; gap: 14px; }
.layer-label { margin: 0 0 6px; font-size: 0.78rem; font-weight: 700; }
.res-row { display: flex; flex-direction: column; gap: 8px; }

.res-card {
  border: 2px solid var(--ink);
  background: rgba(255, 253, 248, 0.72);
  box-shadow: 3px 3px 0 var(--ink);
  padding: 6px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.res-card .node { box-shadow: none; }

.detail {
  background: var(--card);
  border: 2px solid var(--ink);
  box-shadow: 4px 4px 0 var(--ink);
  padding: 12px 14px 16px;
}

.detail h3 { font-size: 1.35rem; line-height: 1.25; }
.role { font-weight: 700; }

.detail ul { margin: 0; padding-left: 1.15rem; }
.detail li + li { margin-top: 4px; }

.chips { display: flex; flex-wrap: wrap; gap: 6px; }

.chip {
  border: 2px solid var(--ink);
  background: var(--paper);
  padding: 4px 8px;
  min-height: 36px;
  font-weight: 700;
  font-size: 0.85rem;
}

@media (max-width: 1179px) {
  .detail {
    order: -1;
    position: sticky;
    top: var(--header-h);
    z-index: 25;
    max-height: 32vh;
    overflow: auto;
    margin-bottom: 4px;
  }
  .node { scroll-margin-top: calc(var(--header-h) + 34vh); }
}

@media (min-width: 960px) {
  .board { min-width: 1000px; padding-left: 16px; }
  .row-staff { flex-direction: row; align-items: flex-start; gap: 8px; }
  .row-rooms { flex-direction: row; align-items: stretch; }
  .row-center { margin-bottom: 36px; }
  .lane-gap { height: 104px; }
  .node-staff,
  .art-stack .node,
  .row-rooms .node {
    flex: 1 1 0;
    min-width: 0;
    width: auto;
    flex-direction: column;
    justify-content: center;
    text-align: center;
    gap: 2px;
    min-height: 76px;
    padding: 8px 6px 8px 12px;
  }
  .art-stack {
    flex: 2.05 1 0;
    min-width: 0;
    padding: 0 6px 6px;
    gap: 0;
  }
  .art-stack > .node { width: 100%; }
  .art-kids {
    flex-direction: row;
    margin: 22px 0 0;
    border-left: 0;
    padding-left: 0;
    gap: 8px;
  }
  .art-kids .node { flex: 1 1 0; }
  .row-staff .node-name,
  .art-stack .node-name,
  .row-rooms .node-name { font-size: 0.84rem; }
  .row-center .node {
    width: auto;
    min-width: 168px;
    flex-direction: column;
    align-items: center;
    text-align: center;
    min-height: 72px;
  }
  .dots { display: none; }
  .res-row { flex-direction: row; flex-wrap: wrap; align-items: flex-start; }
  .res-row > .node,
  .res-card { flex: 1 1 180px; align-self: flex-start; }
}

@media (min-width: 1180px) {
  .org-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 300px;
    align-items: start;
    gap: 16px;
  }
  .detail {
    order: 0;
    position: sticky;
    top: calc(var(--header-h) + 12px);
    max-height: calc(100vh - var(--header-h) - 24px);
    overflow: auto;
    margin: 0;
  }
}

.scenarios, .flow-controls, .pipe-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.scenario,
.flow-controls button,
.pipe-nav button {
  min-height: 44px;
  padding: 8px 14px;
  border: 2px solid var(--ink);
  background: var(--card);
  box-shadow: 3px 3px 0 var(--ink);
  font-weight: 700;
}

.scenario[aria-pressed="true"],
#flowPlay[aria-pressed="true"] { background: var(--yellow); }

button:disabled { opacity: 0.4; cursor: not-allowed; }

.flow-count { margin: 0; font-weight: 700; min-width: 3.5rem; }

.flow-stage { position: relative; margin-top: 14px; }

.track {
  display: flex;
  flex-direction: column;
  gap: 8px;
  position: relative;
  padding-left: 22px;
}

.track::before {
  content: "";
  position: absolute;
  left: 7px;
  top: 12px;
  bottom: 12px;
  width: 3px;
  background: var(--ink);
}

.step { min-width: 0; }

.step-jump,
.fork-card {
  width: 100%;
  text-align: left;
  padding: 10px;
  border: 2px solid var(--ink);
  background: var(--card);
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 3px;
  min-height: 92px;
}

.fork { display: flex; flex-direction: column; gap: 6px; height: 100%; }
.step.is-on .step-jump,
.fork-card.is-on { background: var(--yellow); }

.step-no {
  width: 22px;
  height: 22px;
  background: var(--ink);
  color: #fff;
  display: grid;
  place-items: center;
  font-size: 12px;
  font-weight: 700;
  flex: none;
}

.step-who { font-weight: 700; }
.step-verb { font-size: 0.85rem; }
.mini-names { font-size: 0.75rem; line-height: 1.35; }

.packet {
  position: absolute;
  width: 14px;
  height: 14px;
  background: var(--yellow);
  border: 2px solid var(--ink);
  box-shadow: 3px 3px 0 var(--red);
  transform: translate(-50%, -50%);
  z-index: 3;
  pointer-events: none;
  transition: left 0.55s cubic-bezier(0.2, 0.7, 0.2, 1), top 0.55s cubic-bezier(0.2, 0.7, 0.2, 1);
}

.packet.alt { background: var(--red); box-shadow: 3px 3px 0 var(--blue); }
.packet[hidden] { display: none !important; }

.readout,
.pipe-panel,
.rule-card {
  border: 2px solid var(--ink);
  background: var(--card);
  padding: 14px;
}

.readout { margin-top: 12px; min-height: 7rem; }

.verdicts {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
  margin-top: 10px;
}

.verdict {
  border: 2px solid var(--ink);
  background: var(--paper);
  padding: 8px;
}

.verdict b { display: block; }

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

@media (min-width: 900px) {
  .track {
    flex-direction: row;
    align-items: stretch;
    padding-left: 0;
    padding-top: 18px;
  }
  .track::before {
    left: 12px;
    right: 12px;
    top: 6px;
    bottom: auto;
    width: auto;
    height: 3px;
  }
  .step { flex: 1 1 0; }
  .step.grow { flex: 1.65 1 0; }
  .fork { height: 100%; }
  .fork-card { height: auto; flex: 1; }
}

.pipe { display: grid; gap: 12px; }
.pipe-list {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  max-width: 100%;
  contain: inline-size;
  padding-bottom: 4px;
}

.pipe-step {
  display: flex;
  align-items: center;
  gap: 8px;
  text-align: left;
  border: 2px solid var(--ink);
  background: var(--card);
  padding: 8px;
  min-height: 44px;
  font-weight: 700;
  white-space: nowrap;
}

.pipe-step.is-on { background: var(--yellow); }
.pipe-nav { margin-top: 10px; }

@media (min-width: 800px) {
  .pipe { grid-template-columns: 280px minmax(0, 1fr); align-items: start; }
  .pipe-list { flex-direction: column; overflow: visible; }
  .pipe-step { white-space: normal; width: 100%; }
}

.pair { display: grid; grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr); }
.pair + .pair { margin-top: -2px; }
.pairs { margin-top: 12px; }
.pair-k, .pair-v { padding: 8px; border: 2px solid var(--ink); }
.pair-k { background: var(--ink); color: #fff; font-weight: 700; }
.pair-v { background: var(--yellow); font-weight: 700; margin-left: -2px; }

.loop { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin: 12px 0; }
.loop-node, .pass {
  border: 2px solid var(--ink);
  padding: 6px 8px;
  background: var(--yellow);
  font-weight: 700;
}
.pass { background: var(--card); }
.arrow { font-weight: 700; }

.sample {
  border: 2px solid var(--ink);
  background: var(--paper);
  padding: 10px 12px;
  margin-top: 12px;
}
.sample p { margin: 0 0 4px; }
.sample-k { font-size: 0.75rem; font-weight: 700; color: var(--blue); }

.folder-list { margin: 12px 0 0; padding-left: 1.15rem; }
.folder-list b { display: inline-block; min-width: 9rem; }

.rule-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 12px;
}

.rule-card h3 {
  font-family: var(--display);
  font-weight: 400;
  font-size: 1.45rem;
  line-height: 1.15;
}

.stamps, .msg3 { list-style: none; padding: 0; margin: 8px 0; }
.stamps { display: flex; flex-wrap: wrap; gap: 6px; }
.stamps li {
  background: var(--ink);
  color: #fff;
  padding: 8px 10px;
  font-weight: 700;
}
.msg3 li {
  border: 2px solid var(--ink);
  padding: 6px 8px;
  margin-top: -2px;
  background: #fff;
  font-weight: 700;
}
.msg3 li.empty { background: var(--paper); color: var(--muted); font-weight: 500; }

.ban, .ok {
  border: 2px solid var(--ink);
  padding: 8px;
  margin: 8px 0;
}
.ban { background: var(--red); color: #fff; }
.ok { background: var(--yellow); }

.subhead { margin: 22px 0 8px; }

.matrix-wrap {
  overflow-x: auto;
  max-width: 100%;
  contain: inline-size;
  border: 2px solid var(--ink);
  background: var(--card);
}

.matrix {
  border-collapse: collapse;
  width: 100%;
  min-width: 760px;
  font-size: 0.86rem;
}

.matrix th, .matrix td {
  border-bottom: 1px solid rgba(20, 20, 20, 0.14);
  padding: 7px 8px;
  text-align: center;
  white-space: nowrap;
}

.matrix th:first-child,
.matrix td:first-child {
  text-align: left;
  position: sticky;
  left: 0;
  background: var(--card);
  z-index: 1;
}

.matrix thead th { background: var(--ink); color: #fff; }
.matrix thead th:first-child { z-index: 2; background: var(--ink); }

.matrix tbody tr:hover td,
.matrix tbody tr:hover td:first-child { background: #fff3b0; }

.row-btn {
  font-weight: 700;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.dot-on, .dot-off {
  display: inline-block;
  width: 12px;
  height: 12px;
  border: 2px solid var(--ink);
  vertical-align: middle;
}
.dot-on { background: var(--red); }
.dot-off { background: transparent; }
.draft-mark { font-weight: 700; font-size: 0.78rem; }

.footer {
  background: var(--ink);
  color: #fff;
  border-top: 8px solid var(--red);
}

.footer .wrap { padding-top: 16px; padding-bottom: 22px; }
.footer p { margin: 0 0 6px; max-width: 40rem; }

@media (max-width: 959px) {
  .board { padding-left: 28px; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .packet { transition: none !important; }
}
