:root {
  --ink: #21160f;
  --paper: #fff6de;
  --paper-strong: #ffe6a8;
  --shell: #ff6b35;
  --shell-dark: #d9411e;
  --shell-soft: #ff9872;
  --ocean: #4ab1c8;
  --ocean-dark: #14708a;
  --lime: #d4ff56;
  --danger: #b62020;
  --card-shadow: 0 14px 0 rgba(33, 22, 15, 0.9);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Trebuchet MS", "Comic Sans MS", "Arial Black", sans-serif;
  color: var(--ink);
  background:
    radial-gradient(circle at 15% 15%, rgba(255, 255, 255, 0.45) 0 2px, transparent 3px 100%),
    radial-gradient(circle at 85% 20%, rgba(255, 255, 255, 0.25) 0 2px, transparent 3px 100%),
    linear-gradient(150deg, #ffb36d 0%, #ffdf7a 30%, #6fd8e4 100%);
  background-size: 24px 24px, 34px 34px, auto;
}

.page-shell {
  max-width: 1380px;
  margin: 0 auto;
  padding: 24px 24px 64px;
}

.hero {
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: 28px;
  align-items: stretch;
}

.hero-copy,
.hero-art,
.public-panel,
.admin-panel {
  background: var(--paper);
  border: 4px solid var(--ink);
  border-radius: 28px;
  box-shadow: var(--card-shadow);
  position: relative;
  overflow: hidden;
}

.hero-copy {
  padding: 30px;
}

.hero-copy::after,
.public-panel::after,
.admin-panel::after {
  content: "";
  position: absolute;
  inset: 14px;
  border: 2px dashed rgba(33, 22, 15, 0.18);
  border-radius: 18px;
  pointer-events: none;
}

.eyebrow,
.section-kicker,
.tiny-label {
  text-transform: uppercase;
  letter-spacing: 0.14em;
  font-size: 0.74rem;
  color: rgba(33, 22, 15, 0.7);
  margin: 0 0 10px;
}

h1,
h2,
h3 {
  margin: 0;
  font-family: Impact, "Arial Black", "Comic Sans MS", sans-serif;
  letter-spacing: 0.04em;
}

h1 {
  font-size: clamp(3.2rem, 7vw, 5.8rem);
  line-height: 0.95;
  max-width: 8ch;
}

.lede {
  max-width: 62ch;
  margin: 20px 0 24px;
  font-size: 1.08rem;
  line-height: 1.6;
}

.hero-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.hero-pill,
.session-pill,
.metric-chip,
.host-status {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 3px solid var(--ink);
  border-radius: 999px;
  background: white;
  min-height: 40px;
  padding: 0 14px;
  font-weight: 700;
}

.hero-pill {
  background: var(--lime);
  box-shadow: 0 6px 0 rgba(33, 22, 15, 0.8);
}

.hero-art {
  padding: 24px;
  background:
    linear-gradient(160deg, rgba(255,255,255,0.45), rgba(255,255,255,0)),
    linear-gradient(135deg, #ff8b5b, #ffcf77 65%, #4ec4d7);
}

.lobster-card {
  position: relative;
  height: 100%;
  min-height: 360px;
  border: 4px solid var(--ink);
  border-radius: 30px;
  background:
    radial-gradient(circle at 25% 25%, rgba(255,255,255,0.45) 0 3px, transparent 4px 100%),
    radial-gradient(circle at 70% 40%, rgba(33,22,15,0.08) 0 2px, transparent 3px 100%),
    linear-gradient(180deg, #fff3dd, #ffe0b0);
  overflow: hidden;
}

.burst {
  position: absolute;
  top: 20px;
  right: 24px;
  transform: rotate(10deg);
  font-family: Impact, sans-serif;
  font-size: 2rem;
  color: var(--danger);
}

.lobster-face {
  position: absolute;
  width: 180px;
  height: 200px;
  left: 50%;
  top: 48%;
  transform: translate(-50%, -50%);
  border: 4px solid var(--ink);
  border-radius: 48% 48% 40% 40%;
  background: linear-gradient(180deg, var(--shell-soft), var(--shell-dark));
}

.eye,
.cheek {
  position: absolute;
  border-radius: 999px;
}

.eye {
  top: 50px;
  width: 24px;
  height: 24px;
  background: white;
  border: 3px solid var(--ink);
}

.eye::after {
  content: "";
  position: absolute;
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: var(--ink);
  top: 5px;
  left: 5px;
}

.eye.left { left: 42px; }
.eye.right { right: 42px; }

.cheek {
  bottom: 52px;
  width: 22px;
  height: 12px;
  background: rgba(255, 255, 255, 0.45);
}

.cheek.left { left: 40px; }
.cheek.right { right: 40px; }

.claw {
  position: absolute;
  top: 38%;
  width: 100px;
  height: 100px;
  border: 4px solid var(--ink);
  background: linear-gradient(180deg, var(--shell), var(--shell-dark));
}

.claw.left {
  left: 44px;
  border-radius: 55% 30% 45% 60%;
  transform: rotate(22deg);
}

.claw.right {
  right: 44px;
  border-radius: 30% 55% 60% 45%;
  transform: rotate(-22deg);
}

.speech {
  position: absolute;
  left: 24px;
  bottom: 26px;
  max-width: 280px;
  padding: 18px;
  border: 4px solid var(--ink);
  border-radius: 22px;
  background: #fffef7;
  box-shadow: 0 8px 0 rgba(33, 22, 15, 0.8);
}

.speech strong {
  display: block;
  margin-bottom: 8px;
}

.main-grid {
  display: grid;
  grid-template-columns: 1.3fr 0.9fr;
  gap: 24px;
  margin-top: 28px;
}

.roster-panel,
.summary-panel,
.control-panel {
  padding: 24px;
}

.summary-panel {
  align-self: start;
}

.control-panel {
  grid-column: 1 / -1;
}

.section-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.ink-button {
  cursor: pointer;
  border: 3px solid var(--ink);
  border-radius: 999px;
  background: var(--shell);
  color: white;
  font: inherit;
  font-weight: 800;
  padding: 12px 18px;
  box-shadow: 0 8px 0 rgba(33, 22, 15, 0.85);
  transform: translateY(0);
  transition: transform 160ms ease, box-shadow 160ms ease, background 160ms ease;
}

.ink-button:hover {
  transform: translateY(2px);
  box-shadow: 0 6px 0 rgba(33, 22, 15, 0.85);
}

.ink-button.ghost {
  background: white;
  color: var(--ink);
}

.roster-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(290px, 1fr));
  gap: 18px;
}

.host-card,
.summary-card,
.control-block,
.login-panel {
  border: 4px solid var(--ink);
  border-radius: 24px;
  background: white;
  padding: 18px;
  box-shadow: 0 10px 0 rgba(33, 22, 15, 0.85);
}

.host-card {
  transform: rotate(calc((var(--card-tilt, 0) - 1) * 0.8deg));
  cursor: pointer;
}

.role-card {
  --role-accent: var(--shell);
  --role-wash: #fff0d5;
  position: relative;
  overflow: hidden;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(255, 246, 222, 0.96)),
    white;
}

.role-card::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 14px;
  background: var(--role-accent);
}

.role-tone-monitor {
  --role-accent: #1f9db7;
  --role-wash: #d7f8ff;
}

.role-tone-command {
  --role-accent: #ff8a3d;
  --role-wash: #ffe0ba;
}

.role-tone-execution {
  --role-accent: #7fbd31;
  --role-wash: #efffd4;
}

.role-tone-marketing {
  --role-accent: #ff4f6d;
  --role-wash: #ffd9e1;
}

.role-tone-overseas {
  --role-accent: #1873c9;
  --role-wash: #d9efff;
}

.role-tone-secretary {
  --role-accent: #9b6a3e;
  --role-wash: #f8e3cf;
}

.role-tone-leads {
  --role-accent: #f0b400;
  --role-wash: #fff1b8;
}

.host-card-top {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.host-name {
  margin: 0;
  font-size: 1.22rem;
  font-weight: 900;
}

.host-target {
  margin: 4px 0 0;
  font-size: 0.92rem;
  color: rgba(33, 22, 15, 0.72);
  word-break: break-all;
}

.role-card .host-target {
  max-width: 26ch;
  word-break: normal;
  line-height: 1.45;
}

.role-persona {
  margin: 14px 0 0;
  line-height: 1.65;
  color: rgba(33, 22, 15, 0.82);
}

.host-status.healthy {
  background: #b9ff9f;
}

.host-status.attention {
  background: #ffd078;
}

.metrics-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-top: 14px;
}

.metric-chip {
  justify-content: space-between;
  padding: 8px 12px;
  min-height: 0;
}

.metric-chip strong {
  font-size: 1rem;
}

.role-card .metric-chip {
  background: #fffef7;
}

.role-card .metric-chip span {
  font-size: 0.76rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: rgba(33, 22, 15, 0.62);
}

.host-tags {
  margin: 14px 0 0;
  font-size: 0.9rem;
  color: rgba(33, 22, 15, 0.72);
}

.role-card .host-tags {
  font-weight: 800;
  line-height: 1.5;
}

.role-missions {
  margin: 12px 0 0;
  line-height: 1.6;
  color: rgba(33, 22, 15, 0.82);
  font-size: 0.92rem;
  font-weight: 700;
}

.ability-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
}

.ability-pill {
  display: inline-flex;
  align-items: center;
  border: 3px solid var(--ink);
  border-radius: 999px;
  background: var(--role-wash, #fff0d5);
  min-height: 38px;
  padding: 0 12px;
  font-size: 0.9rem;
  font-weight: 800;
  line-height: 1.4;
}

.summary-stack {
  display: grid;
  gap: 14px;
}

.summary-card pre,
.action-output {
  margin: 12px 0 0;
  white-space: pre-wrap;
  word-break: break-word;
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-size: 0.92rem;
  line-height: 1.5;
}

.summary-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  font-size: 0.9rem;
}

.summary-role-lines {
  display: grid;
  gap: 10px;
  margin-top: 12px;
}

.summary-role-lines p {
  margin: 0;
  border: 3px solid var(--ink);
  border-radius: 16px;
  background: #fffef7;
  padding: 12px;
  line-height: 1.6;
}

.summary-role-lines strong {
  display: inline-block;
  min-width: 4.8em;
}

.summary-role-lines span {
  color: rgba(33, 22, 15, 0.8);
}

.admin-panel .session-bar {
  display: flex;
  gap: 10px;
  align-items: center;
}

.login-copy {
  margin: 0 0 18px;
  max-width: 58ch;
  line-height: 1.6;
}

.login-form,
.chat-form,
.host-controls {
  display: grid;
  gap: 14px;
}

label {
  display: grid;
  gap: 8px;
  font-weight: 800;
}

input,
select,
textarea {
  width: 100%;
  border: 3px solid var(--ink);
  border-radius: 18px;
  padding: 14px 16px;
  font: inherit;
  background: #fffef7;
}

textarea {
  min-height: 150px;
  resize: vertical;
}

.error-text {
  color: var(--danger);
  font-weight: 800;
  min-height: 1.4em;
}

.console-columns {
  display: grid;
  grid-template-columns: 0.8fr 1.2fr;
  gap: 20px;
  margin-top: 20px;
}

.action-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.action-grid.compact .ink-button {
  flex: 1;
}

.control-block {
  margin-top: 20px;
}

.block-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: baseline;
}

.chat-transcript {
  display: grid;
  gap: 12px;
  margin-top: 14px;
  max-height: 420px;
  overflow: auto;
}

.chat-subhead {
  margin-top: 14px;
  font-size: 0.9rem;
  font-weight: 800;
  color: rgba(33, 22, 15, 0.72);
}

.chat-bubble {
  border: 3px solid var(--ink);
  border-radius: 20px;
  padding: 14px 16px;
  max-width: 100%;
  line-height: 1.55;
  box-shadow: 0 8px 0 rgba(33, 22, 15, 0.8);
}

.chat-bubble.user {
  background: #ffe6a8;
}

.chat-bubble.assistant {
  background: #d7f8ff;
}

.action-output {
  min-height: 220px;
  background: #1d1511;
  color: #fff8dd;
  border-radius: 18px;
  padding: 18px;
  border: 3px solid var(--ink);
}

.empty-state {
  margin: 0;
  border: 3px dashed rgba(33, 22, 15, 0.4);
  border-radius: 18px;
  padding: 18px;
  background: rgba(255, 255, 255, 0.6);
}

.hidden {
  display: none !important;
}

.detail-panel {
  position: fixed;
  inset: 0;
  background: rgba(19, 10, 5, 0.5);
  display: flex;
  align-items: stretch;
  justify-content: flex-end;
  padding: 18px;
  z-index: 100;
}

.detail-card {
  width: min(560px, 100%);
  background: var(--paper);
  border: 4px solid var(--ink);
  border-radius: 28px;
  box-shadow: var(--card-shadow);
  padding: 24px;
  overflow: auto;
  position: relative;
}

.detail-close {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 42px;
  height: 42px;
  border-radius: 999px;
  border: 3px solid var(--ink);
  background: white;
  font-size: 1.6rem;
  cursor: pointer;
}

.detail-hero {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  padding-right: 52px;
}

.detail-subtitle,
.detail-tags {
  margin: 8px 0 0;
  color: rgba(33, 22, 15, 0.72);
  line-height: 1.5;
  word-break: break-word;
}

.detail-block {
  margin-top: 18px;
  border: 3px solid var(--ink);
  border-radius: 22px;
  background: white;
  padding: 16px;
}

.detail-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-top: 12px;
}

.detail-copy,
.detail-note {
  margin: 12px 0 0;
  line-height: 1.65;
}

.detail-note {
  color: rgba(33, 22, 15, 0.72);
}

.detail-metric {
  border: 3px solid var(--ink);
  border-radius: 16px;
  background: #fffef7;
  padding: 10px 12px;
  display: grid;
  gap: 4px;
}

.detail-metric span {
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: rgba(33, 22, 15, 0.65);
}

.history-list {
  display: grid;
  gap: 10px;
  margin-top: 12px;
}

.detail-list {
  display: grid;
  gap: 10px;
  margin-top: 12px;
}

.detail-list-item {
  border: 3px solid var(--ink);
  border-radius: 16px;
  background: #fffef7;
  padding: 12px;
  line-height: 1.6;
}

.history-row {
  border: 3px solid var(--ink);
  border-radius: 16px;
  background: #fffef7;
  padding: 12px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px 12px;
}

@media (max-width: 980px) {
  .hero,
  .main-grid,
  .console-columns {
    grid-template-columns: 1fr;
  }

  .lobster-card {
    min-height: 280px;
  }

  .speech {
    max-width: none;
    right: 24px;
  }
}

@media (max-width: 640px) {
  .metrics-grid,
  .detail-grid {
    grid-template-columns: 1fr;
  }

  .detail-card {
    padding: 20px 18px;
  }
}
