:root {
  --bg: #f6efe7;
  --bg-accent: #fef8f1;
  --panel: rgba(255, 250, 244, 0.78);
  --panel-strong: rgba(255, 248, 240, 0.95);
  --stroke: rgba(98, 60, 42, 0.18);
  --text: #2f1d17;
  --muted: #74594f;
  --gold: #b98a3d;
  --rose: #be6a7a;
  --rose-soft: rgba(190, 106, 122, 0.22);
  --shadow: 0 24px 60px rgba(88, 56, 43, 0.12);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
}

body {
  font-family: "Manrope", sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at top left, rgba(235, 198, 137, 0.26), transparent 30%),
    radial-gradient(circle at right 20%, rgba(190, 106, 122, 0.2), transparent 26%),
    linear-gradient(180deg, #fbf4eb 0%, #f2e6da 100%);
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.18) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.15) 1px, transparent 1px);
  background-size: 28px 28px;
  mask-image: linear-gradient(180deg, rgba(0, 0, 0, 0.5), transparent 80%);
}

.page-shell {
  width: min(1480px, calc(100vw - 32px));
  margin: 0 auto;
  padding: 28px 0 32px;
}

.hero {
  padding: 18px 8px 26px;
  text-align: center;
}

.eyebrow,
.section-label,
.stat-label {
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 0.73rem;
  color: var(--muted);
}

.section-label:empty {
  display: none;
}

.hero h1 {
  margin: 6px 0 10px;
  font-family: "Cormorant Garamond", serif;
  font-size: clamp(2.8rem, 5vw, 5rem);
  line-height: 0.92;
  font-weight: 700;
}

.dashboard {
  display: grid;
  grid-template-columns: minmax(240px, 280px) minmax(0, 1fr) minmax(240px, 280px);
  gap: 20px;
  height: clamp(720px, 78vh, 900px);
  align-items: stretch;
}

.panel {
  position: relative;
  background: var(--panel);
  border: 1px solid var(--stroke);
  border-radius: 28px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(16px);
}

.panel-left,
.panel-right,
.graph-panel {
  display: flex;
  flex-direction: column;
  gap: 22px;
  padding: 24px;
  min-height: 0;
}

.panel-right > section:last-child {
  display: flex;
  flex: 1;
  min-height: 0;
  flex-direction: column;
}

.graph-panel {
  padding: 14px;
}

.graph-frame {
  position: relative;
  height: 100%;
  min-height: 0;
  overflow: hidden;
  border-radius: 22px;
  background:
    radial-gradient(circle at top, rgba(255, 255, 255, 0.95), rgba(255, 246, 236, 0.86)),
    linear-gradient(180deg, rgba(255, 250, 246, 0.96), rgba(246, 231, 220, 0.82));
  border: 1px solid rgba(132, 90, 66, 0.12);
}

#graph {
  width: 100%;
  height: 100%;
  display: block;
}

.info-list {
  padding-left: 18px;
  margin: 10px 0 0;
  line-height: 1.7;
  color: rgba(47, 29, 23, 0.84);
}

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

.definition-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  color: rgba(47, 29, 23, 0.84);
  position: relative;
}

.definition-label {
  line-height: 1.4;
}

.definition-info {
  position: relative;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 1px solid rgba(102, 63, 47, 0.24);
  background: rgba(255, 252, 248, 0.94);
  color: var(--muted);
  font: inherit;
  font-size: 0.78rem;
  font-weight: 700;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  cursor: help;
  flex-shrink: 0;
}

.definition-info::after {
  content: attr(data-tooltip);
  position: absolute;
  left: auto;
  right: 0;
  top: calc(100% + 8px);
  transform: none;
  width: min(260px, calc(100vw - 96px));
  padding: 10px 12px;
  border-radius: 14px;
  background: rgba(49, 29, 24, 0.94);
  color: rgba(255, 247, 240, 0.96);
  font-size: 0.88rem;
  font-weight: 500;
  line-height: 1.45;
  box-shadow: 0 14px 28px rgba(49, 29, 24, 0.18);
  opacity: 0;
  pointer-events: none;
  transition: opacity 140ms ease;
  z-index: 10;
}

.definition-info:hover::after,
.definition-info:focus-visible::after {
  opacity: 1;
}

.stat-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.stat-card {
  padding: 16px 18px;
  border-radius: 20px;
  background: var(--panel-strong);
  border: 1px solid rgba(132, 90, 66, 0.12);
}

.stat-value {
  display: block;
  font-family: "Cormorant Garamond", serif;
  font-size: 2.1rem;
  font-weight: 700;
  line-height: 1;
  margin-bottom: 6px;
}

.ghost-button {
  width: 100%;
  margin-top: 10px;
  padding: 13px 16px;
  border: 1px solid rgba(102, 63, 47, 0.14);
  border-radius: 999px;
  background: rgba(255, 252, 248, 0.9);
  color: var(--text);
  font: inherit;
  cursor: pointer;
  transition: transform 160ms ease, background 160ms ease, border-color 160ms ease;
}

.ghost-button:hover {
  transform: translateY(-1px);
  background: rgba(255, 247, 238, 1);
  border-color: rgba(102, 63, 47, 0.28);
}

.ghost-button.is-active {
  background: linear-gradient(135deg, rgba(190, 106, 122, 0.16), rgba(185, 138, 61, 0.18));
  border-color: rgba(102, 63, 47, 0.32);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.5);
}

.mode-switch {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.mode-switch .ghost-button,
.action-switch .ghost-button {
  margin-top: 0;
}

.filter-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 10px;
}

.filter-row .ghost-button {
  margin-top: 0;
  flex: 1;
}

.filter-info {
  flex-shrink: 0;
}

.action-switch {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.action-switch .ghost-button {
  padding: 11px 10px;
  font-size: 0.92rem;
  line-height: 1.15;
  border-radius: 22px;
}

.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.section-header .section-label {
  margin: 0;
}

.inline-action-button {
  padding: 7px 12px;
  border-radius: 999px;
  border: 1px solid rgba(102, 63, 47, 0.14);
  background: rgba(255, 252, 248, 0.94);
  color: var(--text);
  font: inherit;
  font-size: 0.88rem;
  cursor: pointer;
  transition: transform 160ms ease, background 160ms ease, border-color 160ms ease;
  flex-shrink: 0;
}

.inline-action-button:hover {
  transform: translateY(-1px);
  background: rgba(255, 247, 238, 1);
  border-color: rgba(102, 63, 47, 0.28);
}

.profile-card {
  display: grid;
  grid-template-columns: 86px minmax(0, 1fr);
  gap: 16px;
  align-items: center;
  margin-top: 10px;
  padding: 16px;
  border-radius: 22px;
  background: var(--panel-strong);
  border: 1px solid rgba(132, 90, 66, 0.12);
  min-width: 0;
}

.profile-image-wrap {
  width: 86px;
  height: 86px;
  border-radius: 50%;
  overflow: hidden;
  background: linear-gradient(135deg, rgba(244, 220, 179, 0.55), rgba(190, 106, 122, 0.24));
  box-shadow: inset 0 0 0 1px rgba(132, 90, 66, 0.12);
}

.profile-image-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.profile-card.is-overview .profile-image-wrap {
  display: grid;
  place-items: center;
}

.profile-card.is-overview .profile-image-wrap img {
  display: none;
}

.profile-card.is-overview .profile-image-wrap::after {
  content: "ATL";
  font-family: "Cormorant Garamond", serif;
  font-size: 2rem;
  font-weight: 700;
  color: rgba(47, 29, 23, 0.72);
}

.profile-card.is-rankings {
  display: block;
  margin-top: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

.profile-card.is-rankings .profile-image-wrap {
  display: none;
}

.profile-card.is-rankings .profile-copy h2 {
  margin-bottom: 0;
}

.profile-card.is-empty {
  grid-template-columns: 1fr;
}

.profile-card.is-empty .profile-image-wrap {
  display: none;
}

.profile-card.is-detail {
  grid-template-columns: 82px minmax(0, 1fr);
  align-items: center;
  gap: 14px;
}

.profile-card.is-detail .profile-image-wrap {
  width: 82px;
  height: 82px;
}

.profile-card.is-detail .profile-copy h2 {
  margin-bottom: 0;
  font-size: 1.5rem;
  line-height: 0.9;
  overflow-wrap: normal;
  word-break: normal;
}

.profile-copy h2 {
  margin: 0 0 6px;
  font-family: "Cormorant Garamond", serif;
  font-size: 1.85rem;
  line-height: 0.95;
}

.profile-copy p {
  margin: 0;
  font-size: 0.95rem;
  line-height: 1.55;
  color: rgba(47, 29, 23, 0.76);
}

.profile-copy p:empty {
  display: none;
}

.profile-copy {
  min-width: 0;
}

.connection-list {
  margin-top: 10px;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  min-height: 42px;
  color: rgba(47, 29, 23, 0.78);
  line-height: 1.6;
}

.connection-list.is-rankings {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  gap: 14px;
}

.connection-list.is-profile-detail {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  gap: 14px;
  overflow-y: auto;
  padding-right: 6px;
  min-width: 0;
}

.overview-grid {
  display: grid;
  gap: 10px;
  min-width: 0;
}

.overview-row {
  display: grid;
  gap: 5px;
  padding: 11px 13px;
  border-radius: 16px;
  border: 1px solid rgba(102, 63, 47, 0.12);
  background: rgba(255, 252, 248, 0.92);
  min-width: 0;
}

.overview-label {
  font-size: 0.73rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
}

.overview-value {
  color: var(--text);
  line-height: 1.55;
  overflow-wrap: anywhere;
}

.connection-pill {
  padding: 9px 12px;
  border-radius: 999px;
  background: rgba(255, 250, 244, 0.96);
  border: 1px solid rgba(102, 63, 47, 0.12);
  font-size: 0.92rem;
  color: var(--text);
  font: inherit;
  cursor: pointer;
  transition: transform 160ms ease, border-color 160ms ease, background 160ms ease;
}

.connection-pill:hover {
  transform: translateY(-1px);
  background: rgba(255, 246, 237, 1);
  border-color: rgba(102, 63, 47, 0.25);
}

.ranking-sort {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.sort-chip {
  padding: 9px 14px;
  border-radius: 999px;
  border: 1px solid rgba(102, 63, 47, 0.14);
  background: rgba(255, 252, 248, 0.94);
  color: var(--text);
  font: inherit;
  cursor: pointer;
  transition: transform 160ms ease, background 160ms ease, border-color 160ms ease;
}

.sort-chip:hover {
  transform: translateY(-1px);
  background: rgba(255, 247, 238, 1);
  border-color: rgba(102, 63, 47, 0.28);
}

.sort-chip.is-active {
  background: linear-gradient(135deg, rgba(190, 106, 122, 0.16), rgba(185, 138, 61, 0.18));
  border-color: rgba(102, 63, 47, 0.3);
}

.ranking-list {
  display: grid;
  flex: 1;
  min-height: 0;
  gap: 10px;
  overflow-y: auto;
  padding-right: 6px;
  align-content: start;
}

.profile-list-empty {
  padding: 14px 2px;
  color: rgba(47, 29, 23, 0.72);
}

.ranking-row {
  display: grid;
  grid-template-columns: 26px 52px minmax(0, 1fr);
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 18px;
  border: 1px solid rgba(102, 63, 47, 0.12);
  background: rgba(255, 252, 248, 0.92);
  color: var(--text);
  text-align: left;
  font: inherit;
  cursor: pointer;
  transition: transform 160ms ease, background 160ms ease, border-color 160ms ease;
}

.ranking-row:hover {
  transform: translateY(-1px);
  background: rgba(255, 247, 238, 1);
  border-color: rgba(102, 63, 47, 0.24);
}

.ranking-rank {
  font-family: "Cormorant Garamond", serif;
  font-size: 1.35rem;
  font-weight: 700;
  text-align: center;
}

.ranking-image {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  overflow: hidden;
  background: linear-gradient(135deg, rgba(244, 220, 179, 0.55), rgba(190, 106, 122, 0.24));
  box-shadow: inset 0 0 0 1px rgba(132, 90, 66, 0.12);
}

.ranking-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.ranking-copy {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.ranking-name {
  font-weight: 700;
  line-height: 1.1;
}

.ranking-meta {
  font-size: 0.88rem;
  line-height: 1.35;
  color: rgba(47, 29, 23, 0.7);
}

.link-casing {
  stroke: rgba(255, 250, 244, 0.62);
  stroke-linecap: round;
}

.link-casing.is-active {
  stroke: rgba(255, 252, 248, 0.9);
}

.link-casing.is-costar {
  stroke: rgba(244, 233, 226, 0.9);
}

.link-casing.is-costar.is-active {
  stroke: rgba(252, 243, 238, 0.98);
}

.link {
  stroke: rgba(96, 65, 48, 0.38);
  stroke-linecap: round;
}

.link.is-costar {
  stroke: rgba(104, 54, 43, 0.88);
}

.link.is-active {
  stroke: rgba(185, 138, 61, 0.92);
}

.link.is-costar.is-active {
  stroke: rgba(82, 37, 28, 0.98);
}

.link.is-filter-pending {
  stroke: rgba(185, 138, 61, 0.98);
}

.link-casing.is-filter-pending {
  stroke: rgba(255, 252, 248, 0.96);
}

body[data-mode="beef"] .link-casing {
  stroke: rgba(255, 248, 245, 0.6);
}

body[data-mode="beef"] .link-casing.is-active {
  stroke: rgba(255, 247, 245, 0.9);
}

body[data-mode="beef"] .link {
  stroke: rgba(156, 59, 78, 0.42);
}

body[data-mode="beef"] .link.is-active {
  stroke: rgba(156, 59, 78, 0.96);
}

.node-ring {
  fill: rgba(255, 255, 255, 0.92);
  stroke: rgba(102, 63, 47, 0.18);
  stroke-width: 2px;
}

.node-port {
  opacity: 0;
  fill: rgba(126, 79, 59, 0.88);
  stroke: rgba(255, 249, 244, 0.96);
  stroke-width: 1.6px;
  pointer-events: none;
  transition: opacity 140ms ease;
}

.node-port.is-visible {
  opacity: 1;
}

body[data-mode="beef"] .node-port {
  fill: rgba(156, 88, 101, 0.9);
}

.node-portrait {
  pointer-events: none;
}

.node-label {
  font-size: 12px;
  font-weight: 700;
  text-anchor: middle;
  fill: rgba(47, 29, 23, 0.88);
  pointer-events: none;
  opacity: 0;
  transition: opacity 160ms ease;
}

.node-meta {
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  fill: rgba(116, 89, 79, 0.74);
  text-anchor: middle;
  pointer-events: none;
  opacity: 0;
  transition: opacity 160ms ease;
}

.node.is-dimmed {
  opacity: 0.28;
}

.link.is-dimmed,
.link-casing.is-dimmed {
  opacity: 0.12;
}

.node.is-selected .node-ring {
  stroke: var(--gold);
  stroke-width: 4px;
  filter: drop-shadow(0 0 18px rgba(185, 138, 61, 0.3));
}

.node.is-filter-pending .node-ring {
  stroke: rgba(185, 138, 61, 0.96);
  stroke-width: 4px;
  filter: drop-shadow(0 0 18px rgba(185, 138, 61, 0.28));
}

.node.is-selected .node-label,
.node.is-selected .node-meta {
  opacity: 1;
}

.node.is-neighbor .node-ring {
  stroke: var(--rose);
  stroke-width: 3px;
}

.node.is-dimmed .node-ring {
  stroke: rgba(146, 58, 64, 0.72);
  stroke-width: 3px;
}

.node.is-filter-hidden,
.link.is-filter-hidden,
.link-casing.is-filter-hidden {
  display: none;
}

.tooltip {
  position: absolute;
  inset: auto auto 18px 18px;
  max-width: 280px;
  padding: 14px 16px;
  border-radius: 18px;
  background: rgba(49, 29, 24, 0.9);
  color: rgba(255, 247, 240, 0.96);
  box-shadow: 0 16px 30px rgba(49, 29, 24, 0.22);
  pointer-events: none;
}

.tooltip strong {
  display: block;
  font-family: "Cormorant Garamond", serif;
  font-size: 1.4rem;
  line-height: 1;
  margin-bottom: 8px;
}

.tooltip span {
  display: block;
  line-height: 1.55;
  font-size: 0.94rem;
}

@media (max-width: 1220px) {
  .dashboard {
    grid-template-columns: 1fr;
    height: auto;
  }

  .graph-panel {
    order: -1;
    min-height: 70vh;
  }

  .graph-frame {
    min-height: 70vh;
  }

  .stat-grid {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 720px) {
  .page-shell {
    width: min(100vw - 20px, 100%);
    padding-top: 18px;
  }

  .hero {
    padding-inline: 4px;
  }

  .panel-left,
  .panel-right {
    padding: 20px;
  }

  .graph-panel {
    padding: 10px;
  }

  .graph-frame {
    min-height: 62vh;
  }

  .profile-card {
    grid-template-columns: 72px minmax(0, 1fr);
  }

  .profile-image-wrap {
    width: 72px;
    height: 72px;
  }

  .stat-grid {
    grid-template-columns: 1fr;
  }
}
