/* Golem v5 — proper design */
@import url('https://fonts.googleapis.com/css2?family=IBM+Plex+Mono:ital,wght@0,400;0,500;0,600;1,400&family=EB+Garamond:ital,wght@0,400;0,600;1,400&display=swap');

:root {
  --bg: #f0e6d3;
  --bg2: #e8dcc6;
  --bg3: #ddd0b8;
  --panel-bg: rgba(232,220,198,0.4);
  --panel-bg-hover: rgba(232,220,198,0.7);
  --text: #3d3224;
  --text2: #5e4f3c;
  --text3: #8a7a6a;
  --link: #5a7d5a;
  --link-h: #3c5c3c;
  --border: #b3a48c;
  --border2: #cdbfa8;
  --border-light: #d8ccb4;
  --red: #8b2020;
  --purple: #6a0dad;
  --gold: #b8860b;
  --teal: #2a9d8f;
  --slate: #4a708b;
  --umber: #8b6914;
  --mono: "IBM Plex Mono", "Courier New", monospace;
  --serif: "EB Garamond", "Georgia", serif;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html { height: 100%; }

body {
  background: var(--bg);
  background-image:
    radial-gradient(ellipse at 20% 50%, rgba(180,160,130,0.15) 0%, transparent 70%),
    radial-gradient(ellipse at 80% 20%, rgba(160,140,110,0.1) 0%, transparent 60%);
  color: var(--text);
  font: 12px/1.6 var(--mono);
  min-height: 100%;
  display: flex;
  flex-direction: column;
}

a { color: var(--link); text-decoration: none; transition: color 0.15s; }
a:hover { color: var(--link-h); text-decoration: underline; }
strong { font-weight: 600; }
.muted { color: var(--text3); font-size: 11px; font-style: italic; }
.hidden { display: none !important; }

/* ══ PAGE SHELL ══ */
.page {
  max-width: 1400px;
  margin: 0 auto;
  padding: 16px 28px 0;
  flex: 1;
  display: flex;
  flex-direction: column;
  width: 100%;
}

/* ══ HEADER ══ */
.header { text-align: center; margin-bottom: 14px; }

.site-title {
  font-family: var(--serif);
  font-size: 32px;
  font-weight: 400;
  letter-spacing: 12px;
  text-transform: lowercase;
  margin-bottom: 10px;
  color: var(--text);
}

.hero-wrap {
  width: 100%;
  margin: 0 auto 10px;
  padding: 10px;
  line-height: 0;
  border: 1px solid var(--border);
  border-radius: 2px;
  overflow: hidden;
  box-shadow: 0 2px 12px rgba(0,0,0,0.15);
}
.hero-wrap img { width: 100%; display: block; }

.nav-row {
  font-size: 11px;
  margin-bottom: 8px;
  color: var(--text3);
  letter-spacing: 0.5px;
}
.nav-link {
  padding: 2px 6px;
  transition: all 0.15s;
  border-bottom: 1px solid transparent;
}
.nav-link.active {
  color: var(--text);
  font-weight: 600;
  border-bottom-color: var(--text);
}
.nav-link:hover { color: var(--text); text-decoration: none; }

.sub-status {
  font-size: 10px;
  color: var(--text3);
  letter-spacing: 0.4px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--border-light);
}

.dot-live {
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--link);
  margin-right: 3px;
  vertical-align: middle;
  animation: pulse 2s ease-in-out infinite;
  box-shadow: 0 0 4px rgba(90,125,90,0.5);
}

/* ══ THREE-COLUMN GRID ══ */
.columns {
  display: grid;
  grid-template-columns: 250px 1fr 260px;
  gap: 14px;
  flex: 1;
}
.sidebar-left, .sidebar-right, .main-col {
  display: flex;
  flex-direction: column;
  min-height: 0;
}
.sidebar-left > fieldset.panel:last-child,
.sidebar-right > fieldset.panel:last-child,
.main-col > fieldset.panel:last-child { flex: 1; }

/* ══ SINGLE COLUMN ══ */
.single-col {
  width: 100%;
  flex: 1;
  display: flex;
  flex-direction: column;
}
.single-col > fieldset.panel { flex: 1; }

/* ══ AGENTS LAYOUT ══ */
.agents-layout {
  display: grid;
  grid-template-columns: 1fr 290px;
  gap: 14px;
  flex: 1;
  align-items: stretch;
}
.agents-main { display: flex; flex-direction: column; }
.agents-main > fieldset.panel:last-child { flex: 1; }
.agents-aside { display: flex; flex-direction: column; }
.agents-aside > fieldset.panel:last-child { flex: 1; }

/* ══ FIELDSET PANELS ══ */
fieldset.panel {
  border: 1px solid var(--border);
  padding: 12px 14px;
  margin: 0 0 10px;
  background: var(--panel-bg);
  display: flex;
  flex-direction: column;
  box-shadow: inset 0 1px 3px rgba(0,0,0,0.04);
  transition: box-shadow 0.2s;
}
fieldset.panel:last-child { margin-bottom: 0; }

fieldset.panel legend {
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--text3);
  padding: 0 8px;
}

fieldset.panel-stretch { flex: 1; }
fieldset.panel-stretch .feed { flex: 1; min-height: 380px; }

/* ══ PAGE INTROS ══ */
.page-intro {
  font-size: 11px;
  color: var(--text2);
  font-style: italic;
  margin-bottom: 14px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border-light);
  line-height: 1.6;
}

/* ══ EMPTY STATES ══ */
.empty-state {
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 1;
  min-height: 60px;
  color: var(--text3);
  font-size: 11px;
  font-style: italic;
  text-align: center;
  padding: 20px 10px;
}

/* ══ AGENTS LIST (sidebar) ══ */
.agent-row {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 7px 4px;
  border-bottom: 1px solid var(--border-light);
  transition: background 0.15s;
}
.agent-row:hover { background: var(--panel-bg-hover); }
.agent-row:last-child { border-bottom: none; }

.agent-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
  margin-top: 3px;
  box-shadow: 0 0 3px rgba(0,0,0,0.2);
}
.agent-info { flex: 1; min-width: 0; }
.agent-name { font-weight: 600; font-size: 11px; line-height: 1.3; }
.agent-meta { font-size: 10px; color: var(--text3); line-height: 1.3; }
.agent-meta.eliminated { color: var(--red); font-weight: 500; }

.c-golem { background: var(--red); }
.c-a1 { background: var(--purple); }
.c-a2 { background: var(--gold); }
.c-a3 { background: var(--teal); }
.c-a4 { background: var(--umber); }
.c-a5 { background: var(--slate); }

/* color classes for borders/accents */
.bc-golem { border-left-color: var(--red); }
.bc-a1 { border-left-color: var(--purple); }
.bc-a2 { border-left-color: var(--gold); }
.bc-a3 { border-left-color: var(--teal); }
.bc-a4 { border-left-color: var(--umber); }
.bc-a5 { border-left-color: var(--slate); }

/* ══ AGENT CARDS ══ */
.agent-card {
  display: flex;
  gap: 14px;
  padding: 14px 10px;
  border-bottom: 1px solid var(--border-light);
  border-left: 3px solid transparent;
  transition: background 0.15s;
}
.agent-card:hover { background: var(--panel-bg-hover); }
.agent-card:first-child { padding-top: 6px; }
.agent-card:last-child { border-bottom: none; padding-bottom: 6px; }

.agent-card-dot {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  flex-shrink: 0;
  margin-top: 2px;
  box-shadow: 0 0 4px rgba(0,0,0,0.2);
}
.agent-card-body { flex: 1; min-width: 0; }
.agent-card-header { display: flex; align-items: baseline; gap: 10px; margin-bottom: 2px; }
.agent-card-name { font-weight: 600; font-size: 13px; line-height: 1.3; }
.agent-card-status-badge {
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.8px;
  text-transform: uppercase;
  padding: 1px 6px;
  border: 1px solid;
  border-radius: 2px;
}
.agent-card-status-badge.active { color: var(--link); border-color: var(--link); }
.agent-card-status-badge.eliminated { color: var(--red); border-color: var(--red); }
.agent-card-role { font-size: 11px; color: var(--text2); font-style: italic; margin-bottom: 4px; line-height: 1.4; }
.agent-card-desc { font-size: 11px; color: var(--text2); line-height: 1.55; margin-bottom: 4px; }
.agent-card-traits { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 6px; }
.agent-trait {
  font-size: 9px;
  padding: 1px 6px;
  background: var(--bg2);
  border: 1px solid var(--border-light);
  color: var(--text3);
  border-radius: 2px;
  letter-spacing: 0.3px;
}

/* ══ RELATIONSHIP TABLE ══ */
.rel-table { width: 100%; border-collapse: collapse; font-size: 10px; text-align: center; }
.rel-table th, .rel-table td { padding: 4px 5px; border: 1px solid var(--border-light); min-width: 26px; }
.rel-table th { font-weight: 600; background: var(--bg2); font-size: 9px; color: var(--text2); }
.rel-table-lg { font-size: 12px; }
.rel-table-lg th, .rel-table-lg td { padding: 7px 10px; }
.rel-table-lg th { font-size: 11px; }
.rel-pos { color: var(--link); font-weight: 600; background: rgba(90,125,90,0.08); }
.rel-neg { color: var(--red); font-weight: 600; background: rgba(139,32,32,0.06); }
.rel-neutral { color: var(--text3); }

/* ══ FEED MESSAGES ══ */
.feed-msg {
  display: flex;
  gap: 10px;
  padding: 10px 6px;
  border-bottom: 1px solid var(--border-light);
  border-left: 3px solid transparent;
  animation: fadeIn 0.3s ease-out;
  transition: background 0.15s;
}
.feed-msg:hover { background: var(--panel-bg-hover); }
.feed-msg:first-child { padding-top: 6px; }
.feed-msg:last-child { border-bottom: none; }

.msg-avatar {
  width: 36px;
  height: 36px;
  border: 1px solid var(--border);
  flex-shrink: 0;
  overflow: hidden;
  border-radius: 2px;
  background: var(--bg2);
}
.msg-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.msg-body { flex: 1; min-width: 0; }

.msg-head {
  font-size: 10px;
  color: var(--text3);
  margin-bottom: 3px;
  display: flex;
  align-items: baseline;
  gap: 6px;
  flex-wrap: wrap;
  line-height: 1.4;
}
.msg-who { font-weight: 600; color: var(--text); font-size: 11px; }

.msg-tag {
  font-size: 8px;
  text-transform: uppercase;
  letter-spacing: 1px;
  padding: 1px 5px;
  border: 1px solid var(--border2);
  color: var(--text3);
  border-radius: 1px;
}

.msg-text {
  font-size: 12px;
  line-height: 1.6;
  white-space: pre-wrap;
  word-break: break-word;
}

.msg-thinking {
  font-size: 10px;
  color: var(--text3);
  font-style: italic;
  margin-top: 4px;
  padding: 4px 8px;
  background: rgba(0,0,0,0.03);
  border-left: 2px solid var(--border-light);
  border-radius: 0 2px 2px 0;
}

/* cycle dividers in feed */
.cycle-divider {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 0;
  font-size: 9px;
  color: var(--text3);
  letter-spacing: 1.5px;
  text-transform: uppercase;
}
.cycle-divider::before, .cycle-divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--border-light);
}

/* ══ JOURNAL ══ */
.journal-entry {
  padding: 12px 10px;
  border-bottom: 1px solid var(--border-light);
  border-left: 2px solid var(--red);
  margin-left: 0;
  transition: background 0.15s;
}
.journal-entry:hover { background: var(--panel-bg-hover); }
.journal-entry:first-child { padding-top: 6px; }
.journal-entry:last-child { border-bottom: none; padding-bottom: 6px; }

.journal-ts {
  font-size: 9px;
  color: var(--text3);
  display: block;
  margin-bottom: 4px;
  letter-spacing: 0.3px;
}
.journal-body {
  font-style: italic;
  font-size: 11px;
  line-height: 1.65;
  color: var(--text2);
}

/* sidebar journal — tighter */
.sidebar-right .journal-entry { padding: 6px 8px; border-left-width: 2px; }
.sidebar-right .journal-body {
  font-size: 10px;
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* ══ EVENTS — TIMELINE ══ */
.events-timeline { position: relative; }

.event-row {
  padding: 8px 0 8px 20px;
  border-bottom: 1px solid var(--border-light);
  font-size: 11px;
  line-height: 1.5;
  position: relative;
  transition: background 0.15s;
}
.event-row:hover { background: var(--panel-bg-hover); }
.event-row:first-child { padding-top: 4px; }
.event-row:last-child { border-bottom: none; }

/* timeline dot */
.event-row::before {
  content: "";
  position: absolute;
  left: 4px;
  top: 12px;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--border);
  border: 1px solid var(--bg);
}
/* timeline line */
.event-row::after {
  content: "";
  position: absolute;
  left: 7px;
  top: 20px;
  bottom: 0;
  width: 1px;
  background: var(--border-light);
}
.event-row:last-child::after { display: none; }

/* color the dots by type */
.event-row.alliance::before { background: var(--purple); }
.event-row.conflict::before { background: var(--red); }
.event-row.intervention::before { background: var(--link); }
.event-row.elimination::before { background: var(--red); box-shadow: 0 0 4px rgba(139,32,32,0.5); }
.event-row.pow::before { background: var(--gold); }
.event-row.manipulation::before { background: var(--umber); }
.event-row.shift::before { background: var(--teal); }

.event-ts { color: var(--text3); font-size: 9px; }
.event-tag {
  font-weight: 600;
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  padding: 0 4px;
  border-radius: 1px;
}
.event-tag.alliance { color: var(--purple); background: rgba(106,13,173,0.06); }
.event-tag.conflict { color: var(--red); background: rgba(139,32,32,0.06); }
.event-tag.intervention { color: var(--link); background: rgba(90,125,90,0.08); }
.event-tag.elimination { color: var(--red); background: rgba(139,32,32,0.1); }
.event-tag.pow { color: var(--gold); background: rgba(184,134,11,0.08); }
.event-tag.manipulation { color: var(--umber); }
.event-tag.shift { color: var(--teal); }

/* sidebar events — no timeline */
.sidebar-right .event-row { padding-left: 0; }
.sidebar-right .event-row::before, .sidebar-right .event-row::after { display: none; }

/* ══ RULES ══ */
.rules-content { font-size: 12px; line-height: 1.75; color: var(--text2); }

.rules-content h3 {
  font-family: var(--serif);
  font-size: 18px;
  font-weight: 400;
  margin: 28px 0 10px;
  color: var(--text);
  letter-spacing: 1px;
  text-transform: lowercase;
  border-bottom: 1px solid var(--border-light);
  padding-bottom: 6px;
}
.rules-content h3:first-child { margin-top: 4px; }

.rules-content p { margin-bottom: 12px; }
.rules-content p strong { color: var(--text); }
.rules-content ol, .rules-content ul { margin: 10px 0 14px 24px; }
.rules-content li { margin-bottom: 6px; }

.rules-epigraph {
  font-family: var(--serif);
  font-style: italic;
  color: var(--text3);
  font-size: 14px;
  border-left: 3px solid var(--red);
  padding: 12px 18px;
  margin: 20px 0;
  line-height: 1.6;
  background: rgba(139,32,32,0.03);
}

/* ══ PAGINATION ══ */
.pager {
  display: flex;
  justify-content: center;
  gap: 10px;
  padding: 10px 0 4px;
  font-size: 11px;
  border-top: 1px solid var(--border-light);
  margin-top: auto;
}
.pager:empty { display: none; border: none; padding: 0; }
.pager a { color: var(--link); cursor: pointer; padding: 2px 6px; transition: background 0.15s; border-radius: 2px; }
.pager a:hover { background: var(--panel-bg-hover); text-decoration: none; }
.pager a.disabled { color: var(--text3); pointer-events: none; }
.pager span { color: var(--text3); }

/* ══ POW ══ */
.pow-entry { padding: 6px 0; }
.pow-bar { height: 4px; background: var(--border2); margin-top: 4px; border-radius: 2px; overflow: hidden; }
.pow-fill { height: 100%; background: linear-gradient(90deg, var(--red), var(--gold)); transition: width 0.5s; border-radius: 2px; }

/* ══ GOLEM MOOD ══ */
.golem-mood-wrap {
  margin-bottom: 10px;
  text-align: center;
  padding: 14px 0;
}
.golem-mood-img {
  max-width: 240px;
  width: 100%;
  display: block;
  margin: 0 auto;
  filter: drop-shadow(0 4px 16px rgba(0,0,0,0.25));
  transition: opacity 0.3s;
}
.golem-mood-label {
  font-size: 10px;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--text3);
  margin-top: 10px;
}

/* ══ FOOTER ══ */
.footer {
  margin-top: auto;
  padding-top: 24px;
  border-top: 1px solid var(--border);
  text-align: center;
}
.footer-img {
  margin: 8px auto 0;
  max-width: 380px;
  line-height: 0;
}
.footer-img img {
  width: 100%;
  display: block;
  mix-blend-mode: multiply;
  opacity: 0.45;
}
.footer-links {
  font-size: 11px;
  letter-spacing: 1px;
  padding: 6px 0;
}
.footer-links a {
  color: var(--text2);
  text-decoration: none;
  padding: 2px 6px;
  transition: color 0.15s;
}
.footer-links a:hover { color: var(--text); }
.footer-text {
  font-size: 9px;
  color: var(--text3);
  padding: 4px 0 20px;
  letter-spacing: 0.6px;
}

/* ══ ANATOMY PAGE ══ */
.anatomy-container {
  width: 100%;
  flex: 1;
  display: flex;
  flex-direction: column;
}
.anatomy-header {
  text-align: center;
  margin-bottom: 28px;
}
.anatomy-title {
  font-family: var(--serif);
  font-size: 22px;
  font-weight: 400;
  letter-spacing: 4px;
  text-transform: lowercase;
  color: var(--text);
  margin-bottom: 8px;
}

/* figure: image centered with wide padding for labels on each side */
.anatomy-figure {
  position: relative;
  max-width: 1200px;
  margin: 0 auto;
  padding: 20px 280px;
}
.anatomy-img {
  width: 100%;
  display: block;
  filter: drop-shadow(0 4px 20px rgba(0,0,0,0.2));
}

/* label boxes */
.anatomy-label {
  position: absolute;
  width: 220px;
}
.label-content {
  background: var(--panel-bg);
  border: 1px solid var(--border);
  padding: 10px 12px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}
.label-content strong {
  display: block;
  font-size: 10px;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--text);
  margin-bottom: 4px;
}
.label-content span {
  display: block;
  font-size: 11px;
  line-height: 1.5;
  color: var(--text2);
}

/* dot at the end of the line */
.label-dot {
  position: absolute;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--red);
  box-shadow: 0 0 6px rgba(139,32,32,0.4);
}

/* horizontal line from label to figure */
.label-line-h {
  position: absolute;
  height: 1px;
  background: var(--border);
  top: 22px;
}

/* ── left side labels ── */
.label-left {
  left: 10px;
  text-align: right;
}
.label-left .label-line-h {
  right: -56px;
  width: 54px;
}
.label-left .label-dot {
  right: -60px;
  top: 18px;
}

/* ── right side labels ── */
.label-right {
  right: 10px;
  text-align: left;
}
.label-right .label-line-h {
  left: -56px;
  width: 54px;
}
.label-right .label-dot {
  left: -60px;
  top: 18px;
}

/* ── vertical positions — spread evenly so nothing overlaps ── */
.label-pos-1 { top: 5%; }      /* observation engine — left, head area */
.label-pos-2 { top: 35%; }     /* constraint: no harm — left, arm area */
.label-pos-3 { top: 65%; }     /* the cracks — left, lower body */
.label-pos-4 { top: 12%; }     /* emet — right, chest area */
.label-pos-5 { top: 42%; }     /* tools of peace — right, mid */
.label-pos-6 { top: 72%; }     /* private journal — right, lower */

/* ── responsive: stack labels below image on small screens ── */
@media (max-width: 1000px) {
  .anatomy-figure { padding: 20px 10px; }
  .anatomy-label {
    position: relative;
    width: 100%;
    top: auto !important;
    left: auto !important;
    right: auto !important;
    text-align: left !important;
    margin-top: 12px;
  }
  .label-line-h, .label-dot { display: none; }
}

/* ══ ROUTE PAGES ══ */
.route-page { flex: 1; display: flex; flex-direction: column; }

/* ══ ANIMATIONS ══ */
@keyframes fadeIn { from { opacity: 0; transform: translateY(3px); } to { opacity: 1; transform: translateY(0); } }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.2; } }

/* ══ SCROLLBAR ══ */
::-webkit-scrollbar { width: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }

/* ══ RESPONSIVE ══ */
@media (max-width: 1000px) {
  .columns { grid-template-columns: 1fr; }
  .agents-layout { grid-template-columns: 1fr; }
  .hero-wrap { max-width: 100%; }
  .page { padding: 12px 14px 0; }
}
@media (max-width: 600px) {
  .site-title { font-size: 24px; letter-spacing: 6px; }
  .nav-row { font-size: 10px; }
  fieldset.panel { padding: 8px 10px; }
}
