:root {
  color-scheme: dark;
  --ink: #f4ead2;
  --muted: #b7a98c;
  --paper: #e9d9b5;
  --panel: #201a15;
  --panel-2: #2a2119;
  --panel-3: #3a2b1d;
  --line: #765939;
  --line-soft: rgba(213, 174, 103, 0.3);
  --red: #b31f28;
  --red-dark: #681019;
  --gold: #d5ae67;
  --green: #355f4d;
  --blue: #273f65;
  --purple: #5c3d63;
  --shadow: 0 24px 50px rgba(0, 0, 0, 0.38);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at 18% 0%, rgba(179, 31, 40, 0.22), transparent 30%),
    radial-gradient(circle at 88% 12%, rgba(213, 174, 103, 0.18), transparent 28%),
    linear-gradient(90deg, rgba(255, 255, 255, 0.035) 1px, transparent 1px),
    linear-gradient(rgba(255, 255, 255, 0.03) 1px, transparent 1px),
    #13110f;
  background-size: auto, auto, 32px 32px, 32px 32px, auto;
  color: var(--ink);
  font-family: ui-serif, Georgia, "Noto Serif KR", "Apple SD Gothic Neo", serif;
}

button,
input,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

.shell-header {
  width: min(1220px, calc(100% - 28px));
  min-height: 220px;
  align-items: end;
  margin: 0 auto;
  padding: 42px 0 28px;
  position: relative;
}

.shell-header::after {
  content: "野人時代";
  position: absolute;
  right: 230px;
  bottom: 10px;
  color: rgba(244, 234, 210, 0.055);
  font-size: clamp(84px, 15vw, 190px);
  font-weight: 900;
  line-height: 1;
  pointer-events: none;
}

.brand-block {
  position: relative;
  z-index: 1;
  max-width: 760px;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--gold);
  font-family: ui-sans-serif, system-ui, sans-serif;
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0.14em;
}

h1,
h2,
h3,
h4,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 14px;
  font-size: clamp(48px, 8vw, 92px);
  line-height: 0.95;
  text-shadow: 0 5px 0 rgba(0, 0, 0, 0.5), 0 0 34px rgba(179, 31, 40, 0.45);
}

.brand-block p:last-child {
  margin-bottom: 0;
  color: #d8c9ac;
  font-size: 18px;
}

.mode-nav {
  position: sticky;
  top: 0;
  z-index: 10;
  width: min(1220px, calc(100% - 28px));
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 8px;
  margin: 0 auto 18px;
  padding: 10px;
  background: rgba(19, 17, 15, 0.9);
  border: 1px solid var(--line-soft);
  backdrop-filter: blur(10px);
}

.mode-button {
  min-height: 48px;
  border: 1px solid var(--line);
  background: linear-gradient(180deg, var(--panel-3), var(--panel));
  color: var(--ink);
  font-weight: 900;
}

.mode-button.active,
.mode-button:hover {
  background: linear-gradient(180deg, var(--red), var(--red-dark));
  border-color: #d75151;
}

main {
  width: min(1220px, calc(100% - 28px));
  margin: 0 auto 80px;
}

.view {
  display: none;
}

.view.active {
  display: block;
}

.home-grid {
  display: grid;
  grid-template-columns: 1fr;
  justify-items: center;
  gap: 16px;
}

#view-home {
  padding: 0;
  background: transparent;
  border: 0;
  box-shadow: none;
}

.hero-card,
.gateway-panel,
.view,
.detail-dialog {
  background:
    linear-gradient(180deg, rgba(42, 33, 25, 0.97), rgba(28, 23, 19, 0.98));
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}

.hero-card,
.gateway-panel,
.view {
  padding: 24px;
}

.hero-card {
  width: min(100%, 920px);
  display: flex;
  flex-direction: column;
  text-align: center;
  padding: 24px 0 0;
  background: transparent;
  border: 0;
  box-shadow: none;
}

.hero-card > .muted {
  max-width: 620px;
  margin-inline: auto;
}

.view-heading {
  display: flex;
  justify-content: space-between;
  gap: 22px;
  align-items: end;
  margin-bottom: 18px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--line-soft);
}

.view-heading h2,
.hero-card h2,
.gateway-panel h2 {
  margin-bottom: 8px;
  font-size: 34px;
}

.muted {
  color: var(--muted);
}

.random-actions {
  display: flex;
  gap: 12px;
  align-items: center;
  justify-content: center;
  margin: 20px 0;
}

.toggle {
  display: inline-flex;
  gap: 8px;
  align-items: center;
  color: var(--muted);
  font-family: ui-sans-serif, system-ui, sans-serif;
  font-size: 13px;
  font-weight: 800;
}

.primary-button,
.secondary-button,
.chip-button {
  min-height: 40px;
  border: 1px solid transparent;
  padding: 0 16px;
  color: #fff;
  background: linear-gradient(180deg, var(--red), var(--red-dark));
  font-weight: 900;
  box-shadow: 4px 4px 0 rgba(0, 0, 0, 0.32);
}

.secondary-button {
  background: linear-gradient(180deg, #51402c, #2a2119);
  border-color: var(--line);
}

.officer-card {
  display: grid;
  grid-template-columns: minmax(168px, 0.34fr) minmax(0, 1fr);
  gap: 24px;
  align-items: stretch;
  min-height: 0;
  padding: 18px;
  background:
    linear-gradient(135deg, rgba(233, 217, 181, 0.14), transparent 42%),
    var(--panel);
  border: 1px solid var(--line);
  text-align: left;
}

.officer-card.empty {
  min-height: 280px;
  align-items: center;
}

.portrait-fallback,
.avatar {
  display: grid;
  place-items: center;
  overflow: hidden;
  background:
    radial-gradient(circle at 50% 20%, rgba(213, 174, 103, 0.28), transparent 32%),
    #090807;
  color: #fff;
  border: 2px solid #111;
  outline: 1px solid var(--line);
  font-size: 42px;
  font-weight: 900;
}

.avatar.image-placeholder {
  position: relative;
  background:
    linear-gradient(150deg, rgba(255, 255, 255, 0.08), transparent 36%),
    radial-gradient(circle at 50% 24%, rgba(213, 174, 103, 0.32), transparent 34%),
    linear-gradient(180deg, #14100d, #050403);
}

.avatar.image-placeholder::after {
  content: "";
  position: absolute;
  inset: 10px;
  border: 1px solid rgba(213, 174, 103, 0.3);
  pointer-events: none;
}

.avatar.force-woomi {
  background-color: #1c251b;
}

.avatar.force-honmachi {
  background-color: #241a23;
}

.avatar.force-myeongdong {
  background-color: #151f2a;
}

.avatar.force-dongdaemun {
  background-color: #291717;
}

.avatar.force-politics {
  background-color: #202029;
}

.avatar.force-police {
  background-color: #152426;
}

.avatar.image-episode_thumbnail img {
  filter: saturate(0.82) contrast(1.06);
}

.avatar.image-historical_photo img {
  filter: sepia(0.18) contrast(1.04);
}

.portrait-fallback,
.avatar.large,
.avatar.portrait {
  aspect-ratio: 3 / 4;
}

.portrait-fallback,
.avatar.large {
  width: 100%;
  min-width: 0;
  min-height: 0;
  align-self: stretch;
}

.officer-card .avatar.large,
.officer-card .portrait-fallback {
  height: 100%;
  max-height: 340px;
}

.avatar.portrait {
  min-height: 220px;
}

.avatar.normal {
  width: 56px;
  min-height: 74px;
  aspect-ratio: 3 / 4;
  font-size: 18px;
}

.avatar img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
}

.officer-card-body {
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  align-items: flex-start;
  gap: 12px;
  min-width: 0;
}

.officer-card h3 {
  margin: 0;
  max-width: 100%;
  font-size: clamp(30px, 4vw, 46px);
  line-height: 1.05;
  overflow-wrap: anywhere;
}

.officer-card p {
  margin: 0;
  max-width: 100%;
  line-height: 1.55;
  overflow-wrap: anywhere;
}

.officer-card-body p:not(.muted) {
  display: -webkit-box;
  overflow: hidden;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
}

.officer-card-body .secondary-button {
  width: 100%;
  margin-top: auto;
}

.tag-row,
.meta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.pill {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 0 9px;
  background: rgba(213, 174, 103, 0.16);
  border: 1px solid rgba(213, 174, 103, 0.32);
  color: #f4dfb3;
  font-family: ui-sans-serif, system-ui, sans-serif;
  font-size: 12px;
  font-weight: 900;
}

.pill.official {
  background: rgba(179, 31, 40, 0.28);
  color: #ffd7d7;
}

.pill.semi {
  background: rgba(47, 102, 87, 0.34);
  color: #c9f1e3;
}

.pill.candidate {
  background: rgba(213, 174, 103, 0.18);
  color: #f2d9a8;
}

.gateway-list {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.gateway-panel {
  width: min(100%, 1040px);
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 14px;
  align-items: center;
  padding: 10px 12px;
}

.gateway-panel .eyebrow {
  margin: 0;
  white-space: nowrap;
}

.gateway-panel h2 {
  display: none;
}

.gateway-list button,
.force-card,
.person-card {
  text-align: left;
  color: var(--ink);
  background:
    linear-gradient(90deg, rgba(213, 174, 103, 0.13), transparent),
    var(--panel-2);
  border: 1px solid var(--line);
}

.gateway-list button {
  min-height: 54px;
  padding: 9px 13px;
}

.gateway-list strong {
  display: block;
  margin-bottom: 2px;
  font-size: 16px;
  line-height: 1.2;
}

.gateway-list span {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.25;
}

.initial-nav {
  position: sticky;
  top: 78px;
  z-index: 5;
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  padding: 10px 0 18px;
  background: rgba(42, 33, 25, 0.95);
}

.initial-nav a {
  min-width: 39px;
  min-height: 36px;
  display: grid;
  place-items: center;
  color: var(--ink);
  text-decoration: none;
  border: 1px solid var(--line);
  background: var(--panel);
  font-weight: 900;
}

.letter-section {
  padding-top: 8px;
  border-top: 1px solid var(--line-soft);
}

.letter-section h3 {
  margin: 18px 0;
  color: var(--gold);
  font-size: 34px;
}

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 12px;
  align-items: stretch;
}

.person-card {
  min-height: 104px;
  height: 100%;
  display: grid;
  grid-template-columns: 56px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  padding: 10px;
  overflow: hidden;
}

.person-card:hover,
.person-card:focus-visible,
.gateway-list button:hover,
.force-card:hover,
.force-card.active {
  border-color: var(--gold);
  outline: 2px solid rgba(213, 174, 103, 0.22);
}

.person-card h4 {
  margin: 0 0 3px;
  font-size: 17px;
  line-height: 1.24;
}

.person-card p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.comment-count {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  margin-top: 7px;
  padding: 0 7px;
  color: #f4dfb3;
  background: rgba(213, 174, 103, 0.14);
  border: 1px solid rgba(213, 174, 103, 0.28);
  font-family: ui-sans-serif, system-ui, sans-serif;
  font-size: 11px;
  font-weight: 900;
}

.force-board {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 20px;
}

.force-card {
  min-height: 126px;
  padding: 16px;
}

.force-card strong {
  display: block;
  margin-bottom: 10px;
  font-size: 22px;
}

.force-card span {
  color: var(--muted);
}

.force-roster .card-grid {
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
}

.org-chart {
  margin-bottom: 22px;
  padding: 18px;
  background:
    linear-gradient(90deg, rgba(213, 174, 103, 0.1), transparent),
    #171310;
  border: 1px solid var(--line);
}

.org-title {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: baseline;
  margin-bottom: 14px;
  border-bottom: 1px solid var(--line-soft);
}

.org-title h3 {
  margin-bottom: 8px;
}

.org-levels {
  display: grid;
  gap: 14px;
}

.org-level {
  display: grid;
  grid-template-columns: 86px 1fr;
  gap: 12px;
  align-items: center;
}

.org-level + .org-level {
  position: relative;
}

.org-level + .org-level::before {
  content: "";
  position: absolute;
  left: 42px;
  top: -14px;
  width: 1px;
  height: 14px;
  background: var(--gold);
}

.org-level-label {
  display: grid;
  place-items: center;
  min-height: 34px;
  color: var(--gold);
  border: 1px solid var(--line);
  background: var(--panel);
  font-weight: 900;
}

.org-nodes {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.org-node {
  min-height: 38px;
  padding: 0 13px;
  color: var(--ink);
  background: linear-gradient(180deg, var(--panel-3), var(--panel-2));
  border: 1px solid var(--line);
  font-weight: 900;
}

.org-node.ghost {
  opacity: 0.72;
  border-style: dashed;
}

.relation-controls {
  margin-bottom: 14px;
}

.chip-button {
  min-height: 36px;
  background: var(--panel-2);
  border-color: var(--line);
  box-shadow: none;
}

.chip-button.active {
  background: linear-gradient(180deg, var(--red), var(--red-dark));
}

.relation-workbench,
.ontology-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 330px;
  gap: 16px;
  align-items: stretch;
}

.relation-toolbar {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) auto auto;
  gap: 12px;
  align-items: end;
  padding: 12px;
  background:
    linear-gradient(180deg, rgba(42, 33, 25, 0.96), rgba(20, 17, 15, 0.96));
  border: 1px solid var(--line);
}

.relation-toolbar label {
  display: grid;
  gap: 6px;
  color: var(--gold);
  font-weight: 900;
}

.relation-toolbar label span {
  font-size: 11px;
  letter-spacing: 0.14em;
}

.relation-toolbar select {
  width: 100%;
  min-height: 40px;
  border: 1px solid var(--line);
  background: #171310;
  color: var(--ink);
  padding: 0 10px;
  font-weight: 900;
}

.depth-control {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.relation-legend {
  align-self: center;
}

.map-frame {
  overflow: hidden;
  min-height: 480px;
  background:
    radial-gradient(circle at center, rgba(213, 174, 103, 0.15), transparent 45%),
    linear-gradient(90deg, rgba(213, 174, 103, 0.07) 1px, transparent 1px),
    linear-gradient(rgba(213, 174, 103, 0.06) 1px, transparent 1px),
    #171310;
  background-size: auto, 36px 36px, 36px 36px, auto;
  border: 1px solid var(--line);
}

#relation-map {
  display: block;
  width: 100%;
  height: 480px;
  min-height: 480px;
}

.relation-line {
  stroke: #a99167;
  stroke-width: 2;
}

.relation-line.enemy {
  stroke: #d9444c;
  stroke-width: 3.5;
}

.relation-line.family {
  stroke: var(--gold);
}

.relation-line.org {
  stroke: #6c95d4;
}

.relation-line.politic {
  stroke: #b26bc1;
  stroke-dasharray: 8 6;
}

.relation-line.ideology {
  stroke: #8a8f99;
  stroke-dasharray: 3 5;
}

.relation-label {
  fill: #f4dfb3;
  font-family: ui-sans-serif, system-ui, sans-serif;
  font-size: 12px;
  font-weight: 900;
  paint-order: stroke;
  stroke: #171310;
  stroke-width: 5px;
}

.relation-label-box {
  fill: rgba(23, 19, 16, 0.92);
  stroke: rgba(213, 174, 103, 0.5);
}

.relation-label-box.enemy {
  stroke: rgba(217, 68, 76, 0.7);
}

.relation-label-box.family {
  stroke: rgba(213, 174, 103, 0.85);
}

.relation-label-box.politic {
  stroke: rgba(178, 107, 193, 0.8);
}

.node circle {
  fill: #241b14;
  stroke: var(--gold);
  stroke-width: 3;
}

.node.center circle {
  fill: #3a2418;
  stroke: #f4dfb3;
  stroke-width: 4;
  filter: drop-shadow(0 0 14px rgba(213, 174, 103, 0.35));
}

.relation-card-node {
  cursor: pointer;
}

.node-card-bg {
  fill: rgba(35, 27, 21, 0.96);
  stroke: rgba(213, 174, 103, 0.68);
  stroke-width: 1.5;
  filter: drop-shadow(0 8px 12px rgba(0, 0, 0, 0.28));
}

.relation-card-node.center .node-card-bg {
  fill: rgba(62, 38, 25, 0.98);
  stroke: #f4dfb3;
  stroke-width: 2.5;
  filter: drop-shadow(0 0 18px rgba(213, 174, 103, 0.34));
}

.relation-card-node image {
  opacity: 0.95;
}

.node-mark {
  fill: rgba(244, 223, 179, 0.18);
  font-size: 24px;
  font-weight: 900;
  text-anchor: middle;
}

.node text {
  fill: var(--ink);
  font-size: 13px;
  font-weight: 900;
  text-anchor: middle;
}

.relation-card-node .node-title {
  fill: #fff4dc;
  font-weight: 950;
}

.ontology-panel {
  min-height: 480px;
  padding: 18px;
  overflow: auto;
  background:
    linear-gradient(180deg, rgba(42, 33, 25, 0.98), rgba(20, 17, 15, 0.98));
  border: 1px solid var(--line);
}

.relation-panel-note {
  margin-bottom: 14px;
}

.legend-row.compact {
  display: grid;
  grid-template-columns: 1fr 1fr;
}

.ontology-panel h3 {
  margin-bottom: 12px;
}

.legend-row {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-bottom: 18px;
}

.legend {
  padding: 4px 8px;
  border: 1px solid var(--line);
  font-size: 12px;
  font-weight: 900;
}

.legend.family {
  color: #ffe1a3;
}

.legend.enemy {
  color: #ffb2b6;
}

.legend.org {
  color: #bdd4ff;
}

.legend.politic {
  color: #e5b9f0;
}

.triple-group {
  margin-top: 16px;
}

.triple-group h4 {
  margin-bottom: 8px;
  color: var(--gold);
}

.triple {
  width: 100%;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 6px;
  align-items: center;
  margin-bottom: 8px;
  padding: 10px;
  text-align: left;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.035);
  border: 1px solid var(--line-soft);
}

.triple span {
  color: var(--gold);
  font-size: 12px;
  font-weight: 900;
}

.triple em {
  grid-column: 1 / -1;
  color: var(--muted);
  font-size: 12px;
  font-style: normal;
  line-height: 1.35;
}

.detail-dialog {
  width: min(980px, calc(100% - 24px));
  max-height: min(900px, calc(100% - 24px));
  padding: 0;
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--ink);
  box-shadow: var(--shadow);
}

.detail-dialog::backdrop {
  background: rgba(0, 0, 0, 0.72);
}

.icon-button {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 2;
  width: 42px;
  height: 42px;
  border: 1px solid #d75151;
  background: var(--red);
  color: #fff;
  font-size: 28px;
}

.detail-layout {
  display: grid;
  grid-template-columns: 300px 1fr;
}

.detail-aside {
  padding: 28px;
  background:
    linear-gradient(180deg, rgba(179, 31, 40, 0.2), transparent 45%),
    #11100f;
}

.detail-aside .avatar {
  width: 220px;
  min-height: 296px;
  margin-bottom: 18px;
}

.image-credit {
  margin-top: 12px;
  color: var(--muted);
  font-size: 12px;
}

.detail-main {
  padding: 32px;
  overflow: auto;
}

.detail-main h2 {
  margin-bottom: 8px;
  font-size: 38px;
}

.info-list {
  display: grid;
  grid-template-columns: 132px 1fr;
  gap: 10px 16px;
  margin: 22px 0;
}

.info-list dt {
  color: var(--gold);
  font-weight: 900;
}

.info-list dd {
  margin: 0;
}

.detail-block {
  margin: 24px 0;
  padding-top: 18px;
  border-top: 1px solid var(--line-soft);
}

.relation-list {
  display: grid;
  gap: 8px;
}

.relation-row {
  display: grid;
  grid-template-columns: minmax(90px, 1fr) minmax(80px, 1fr) auto;
  gap: 10px;
  align-items: center;
  width: 100%;
  border: 1px solid var(--line-soft);
  background: rgba(255, 255, 255, 0.03);
  color: var(--ink);
  padding: 10px 12px;
  text-align: left;
}

.relation-row span,
.relation-row em {
  color: var(--muted);
  font-style: normal;
  font-size: 13px;
}

.mini-map {
  display: block;
  width: 100%;
  height: 300px;
  min-height: 300px;
  background: #171310;
  border: 1px solid var(--line);
}

.comment-form {
  display: grid;
  grid-template-columns: 160px 1fr;
  gap: 10px;
}

.comment-form textarea {
  grid-column: 1 / -1;
  min-height: 92px;
  resize: vertical;
}

.comment-form input,
.comment-form textarea {
  width: 100%;
  border: 1px solid var(--line);
  padding: 10px 12px;
  background: #120f0d;
  color: var(--ink);
}

.comment-form button {
  justify-self: start;
}

.comment-list {
  display: grid;
  gap: 10px;
  margin-top: 16px;
}

.comment-item {
  padding: 12px;
  background: var(--panel-2);
  border: 1px solid var(--line-soft);
}

.comment-item strong {
  display: block;
  margin-bottom: 4px;
}

.comment-item p {
  margin: 0 0 12px;
}

.comment-reactions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.comment-reactions button {
  min-height: 30px;
  padding: 0 10px;
  color: var(--ink);
  background: #171310;
  border: 1px solid var(--line-soft);
  font-family: ui-sans-serif, system-ui, sans-serif;
  font-size: 12px;
  font-weight: 900;
  box-shadow: none;
}

.comment-reactions button:hover,
.comment-reactions button:focus-visible {
  border-color: var(--gold);
  outline: 2px solid rgba(213, 174, 103, 0.2);
}

.comment-reactions span {
  color: var(--gold);
}

.comment-reactions .comment-delete {
  margin-left: auto;
  color: #ffd7d7;
  border-color: rgba(179, 31, 40, 0.42);
  background: rgba(179, 31, 40, 0.14);
}

.comment-board {
  display: grid;
  gap: 12px;
}

.comment-feed-item {
  padding: 16px;
  background: var(--panel-2);
  border: 1px solid var(--line);
}

.comment-feed-item button {
  display: flex;
  width: 100%;
  justify-content: space-between;
  gap: 14px;
  padding: 0;
  color: var(--ink);
  text-align: left;
  background: transparent;
  border: 0;
}

.comment-feed-item strong {
  font-size: 18px;
}

.comment-feed-item button span,
.comment-feed-meta {
  color: var(--muted);
  font-family: ui-sans-serif, system-ui, sans-serif;
  font-size: 12px;
  font-weight: 800;
}

.comment-feed-item p {
  margin: 12px 0 10px;
}

.admin-header {
  min-height: 170px;
}

.admin-link {
  color: #f1c56b;
  font-weight: 900;
}

.admin-layout {
  display: grid;
  grid-template-columns: minmax(220px, 320px) minmax(0, 1fr);
  gap: 20px;
}

.admin-filter,
.admin-form input,
.admin-form textarea {
  width: 100%;
  border: 1px solid var(--line);
  padding: 10px 12px;
  background: #120f0d;
  color: var(--ink);
}

.admin-list {
  display: grid;
  gap: 8px;
  max-height: 680px;
  margin-top: 10px;
  overflow: auto;
}

.admin-list button {
  padding: 12px;
  color: var(--ink);
  text-align: left;
  background: var(--panel-2);
  border: 1px solid var(--line);
}

.admin-list button.active,
.admin-list button:hover {
  border-color: var(--gold);
  outline: 2px solid rgba(213, 174, 103, 0.2);
}

.admin-list strong,
.admin-list span {
  display: block;
}

.admin-list span {
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
}

.admin-form {
  display: grid;
  gap: 14px;
}

.admin-form label {
  display: grid;
  gap: 6px;
  color: var(--gold);
  font-weight: 900;
}

.admin-form textarea {
  min-height: 220px;
  resize: vertical;
}

.admin-knowledge {
  margin-top: 36px;
}

.knowledge-form textarea {
  min-height: 260px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px;
  line-height: 1.5;
}

a {
  color: #f1c56b;
}

.site-footer {
  width: min(1220px, calc(100% - 28px));
  display: flex;
  flex-wrap: wrap;
  gap: 10px 20px;
  justify-content: center;
  margin: 0 auto 36px;
  padding: 18px 0 0;
  color: var(--muted);
  border-top: 1px solid var(--line-soft);
  font-family: ui-sans-serif, system-ui, sans-serif;
  font-size: 13px;
  font-weight: 800;
}

.site-footer a {
  color: #f1c56b;
  text-decoration: none;
}

@media (max-width: 1040px) {
  .shell-header,
  .home-grid,
  .detail-layout {
    grid-template-columns: 1fr;
  }

  .detail-dialog {
    overflow: auto;
  }

  .detail-main {
    overflow: visible;
  }

  .force-board {
    grid-template-columns: repeat(3, 1fr);
  }

  .relation-workbench {
    grid-template-columns: minmax(0, 1fr);
  }

  .relation-toolbar {
    grid-template-columns: 1fr;
  }

  .ontology-layout {
    grid-template-columns: 1fr;
  }

  .ontology-panel {
    grid-column: 1 / -1;
    min-height: 260px;
    max-height: 360px;
  }

  .admin-layout {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 720px) {
  .shell-header,
  main,
  .mode-nav {
    width: min(100% - 20px, 1220px);
  }

  .mode-nav {
    grid-template-columns: repeat(2, 1fr);
  }

  .force-board,
  .org-level,
  .officer-card,
  .person-card,
  .comment-form,
  .info-list,
  .relation-workbench {
    grid-template-columns: 1fr;
  }

  .ontology-panel,
  .map-frame {
    min-height: auto;
  }

  .map-frame {
    max-width: 100%;
  }

  #relation-map {
    height: 360px;
    min-height: 360px;
  }

  #relation-map .relation-label,
  #relation-map .relation-label-box,
  .mini-map .relation-label,
  .mini-map .relation-label-box {
    display: none;
  }

  .detail-main {
    padding: 22px 16px;
  }

  .detail-aside {
    padding: 22px 16px;
  }

  .mini-map {
    height: 300px;
    min-height: 300px;
  }

  .depth-control,
  .legend-row.compact {
    grid-template-columns: repeat(2, 1fr);
  }

  .view-heading,
  .random-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .gateway-panel {
    grid-template-columns: 1fr;
  }

  .initial-nav {
    top: 116px;
  }
}
