:root {
  --bg: #050608;
  --bg-alt: #0b1015;
  --accent: #e4b35b;
  --accent-soft: rgba(228, 179, 91, 0.18);
  --text-main: #f5f0e6;
  --text-muted: #b5a99a;
  --danger: #d45b5b;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: radial-gradient(circle at top, #141c2a 0, #050608 50%);
  color: var(--text-main);
  min-height: 100vh;
  display: flex;
  justify-content: center;
  padding: 1.5rem;
}

.app {
  max-width: 1100px;
  width: 100%;
  background: linear-gradient(145deg, #06090e, #0d131c);
  border-radius: 24px;
  box-shadow:
    0 0 40px rgba(0, 0, 0, 0.8),
    0 0 60px rgba(0, 0, 0, 0.9);
  border: 1px solid rgba(255, 255, 255, 0.05);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.9s ease, transform 0.9s ease;
}

.app.app-visible {
  opacity: 1;
  transform: translateY(0);
}

header {
  padding: 1.75rem 2rem 1.25rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  background: radial-gradient(circle at top, #172031 0, #06090e 55%);
}

header h1 {
  font-size: 1.9rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  margin-bottom: 0.35rem;
}

header p {
  font-size: 0.95rem;
  color: var(--text-muted);
  max-width: 52rem;
  line-height: 1.5;
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  color: var(--accent);
  border-radius: 999px;
  border: 1px solid rgba(228, 179, 91, 0.55);
  padding: 0.25rem 0.8rem;
  margin-bottom: 0.85rem;
  background: radial-gradient(circle at top, rgba(228, 179, 91, 0.2), transparent);
}

.pill span.icon {
  font-size: 0.95rem;
}

/* Enter button */
.enter-btn {
  margin-top: 0.9rem;
  padding: 0.5rem 1.4rem;
  border-radius: 999px;
  border: 1px solid rgba(228, 179, 91, 0.8);
  background: radial-gradient(circle at top, rgba(228, 179, 91, 0.45), rgba(10, 6, 3, 0.95));
  color: #1a1307;
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  cursor: pointer;
  box-shadow: 0 0 18px rgba(228, 179, 91, 0.8);
  transition: transform 0.16s ease, box-shadow 0.16s ease, filter 0.16s ease;
}

.enter-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 0 24px rgba(228, 179, 91, 1);
  filter: brightness(1.1);
}

main {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(0, 1.2fr);
  gap: 0;
  min-height: 480px;
}

/* LEFT: vertical map */
.map-panel {
  position: relative;
  padding: 1.5rem 1.5rem 2rem;
  border-right: 1px solid rgba(255, 255, 255, 0.06);
  background:
    radial-gradient(circle at top, rgba(82, 117, 201, 0.2), transparent 60%),
    radial-gradient(circle at bottom, rgba(190, 101, 66, 0.25), transparent 60%),
    var(--bg-alt);
  overflow: hidden;
}

.map-title {
  font-size: 0.9rem;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  color: var(--text-muted);
  margin-bottom: 0.4rem;
}

.map-sub {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 1.1rem;
}

.world-tree {
  position: absolute;
  inset: 0.5rem 1.5rem 1.5rem;
  pointer-events: none;
  opacity: 0.35;
  background:
    linear-gradient(to bottom, rgba(228, 179, 91, 0.12), transparent 32%, transparent 68%, rgba(228, 179, 91, 0.18)),
    radial-gradient(circle at top, rgba(202, 236, 255, 0.25), transparent 60%);
  mask-image: linear-gradient(to bottom, transparent 0, black 10%, black 90%, transparent 100%);
}

.path-line {
  position: absolute;
  left: 50%;
  top: 3.5rem;
  bottom: 2.5rem;
  width: 2px;
  transform: translateX(-50%);
  background: linear-gradient(
    to bottom,
    rgba(228, 179, 91, 0.1),
    rgba(228, 179, 91, 0.75),
    rgba(228, 179, 91, 0.1)
  );
  box-shadow: 0 0 18px rgba(228, 179, 91, 0.6);
}

.node-list {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  margin-top: 0.5rem;
}

.node {
  position: relative;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.35rem 0.35rem 0.35rem 0;
  cursor: pointer;
  border-radius: 999px;
  transition: background 0.18s ease, transform 0.18s ease, box-shadow 0.18s ease;
  background: transparent;
}

.node-badge {
  position: relative;
  width: 15px;
  height: 15px;
  border-radius: 999px;
  background: radial-gradient(circle at 30% 20%, #fff 0, #f6e3b7 18%, #e4b35b 55%, #8d4a2a 100%);
  box-shadow:
    0 0 16px rgba(228, 179, 91, 0.9),
    0 0 24px rgba(0, 0, 0, 1);
  flex-shrink: 0;
}

.node-connector {
  position: absolute;
  left: 7px;
  width: 1px;
  top: 14px;
  bottom: -3px;
  background: linear-gradient(to bottom, rgba(228, 179, 91, 0.6), transparent);
  opacity: 0.7;
}

.node-labels {
  display: flex;
  flex-direction: column;
  gap: 0.03rem;
}

.node-name {
  font-size: 0.9rem;
}

.node-meta {
  font-size: 0.72rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.11em;
}

.node:hover {
  background: rgba(12, 19, 30, 0.9);
  transform: translateX(2px);
}

.node.active {
  background: rgba(17, 26, 44, 0.97);
  box-shadow: 0 0 18px rgba(228, 179, 91, 0.35);
  transform: translateX(3px);
}

/* subtle “pulse” when selected */
.node.active .node-badge {
  animation: pulse 1.5s ease-in-out infinite;
}

@keyframes pulse {
  0% { box-shadow: 0 0 10px rgba(228, 179, 91, 0.5); }
  50% { box-shadow: 0 0 22px rgba(228, 179, 91, 1); }
  100% { box-shadow: 0 0 10px rgba(228, 179, 91, 0.5); }
}

.legend {
  margin-top: 1.2rem;
  padding: 0.6rem 0.75rem;
  border-radius: 12px;
  background: rgba(3, 5, 8, 0.9);
  border: 1px solid rgba(255, 255, 255, 0.04);
  font-size: 0.8rem;
  color: var(--text-muted);
  line-height: 1.5;
}

/* RIGHT: details */
.detail-panel {
  padding: 1.6rem 1.8rem 2.1rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.detail-tagline {
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  color: var(--accent);
  margin-bottom: 0.1rem;
}

.detail-title {
  font-size: 1.35rem;
  margin-bottom: 0.25rem;
}

.detail-sub {
  font-size: 0.9rem;
  color: var(--text-muted);
  line-height: 1.5;
  margin-bottom: 0.75rem;
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin-bottom: 0.55rem;
}

.chip {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  padding: 0.25rem 0.7rem;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.11);
  background: rgba(4, 7, 10, 0.9);
  color: var(--text-muted);
}

.chip.chip-danger {
  border-color: rgba(212, 91, 91, 0.9);
  color: #f6d7d7;
  background: radial-gradient(circle at top, rgba(212, 91, 91, 0.45), rgba(7, 5, 5, 0.95));
}

.section-label {
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  color: var(--text-muted);
  margin-bottom: 0.25rem;
}

.detail-text {
  font-size: 0.9rem;
  line-height: 1.7;
}

.lords-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-top: 0.25rem;
}

.lord-pill {
  font-size: 0.76rem;
  padding: 0.25rem 0.55rem;
  border-radius: 999px;
  border: 1px solid rgba(228, 179, 91, 0.7);
  background: rgba(20, 15, 7, 0.95);
  white-space: nowrap;
}

.interpretation {
  margin-top: 0.8rem;
  padding: 0.7rem 0.85rem;
  border-radius: 12px;
  background: var(--accent-soft);
  border: 1px solid rgba(228, 179, 91, 0.4);
  font-size: 0.86rem;
  line-height: 1.6;
}

.interpretation strong {
  color: var(--accent);
}

.footer-note {
  margin-top: auto;
  font-size: 0.78rem;
  color: var(--text-muted);
  border-top: 1px dashed rgba(255, 255, 255, 0.1);
  padding-top: 0.6rem;
}

@media (max-width: 900px) {
  main {
    grid-template-columns: 1fr;
  }
  .map-panel {
    border-right: none;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    min-height: 360px;
  }
  .path-line {
    left: 10%;
  }
  .node {
    padding-left: 1.8rem;
  }
  .node-badge {
    margin-left: -0.3rem;
  }
}

@media (max-width: 640px) {
  header {
    padding-inline: 1.25rem;
  }
  .map-panel,
  .detail-panel {
    padding-inline: 1.25rem;
  }
}

.audio-controls {
  margin-top: 0.8rem;
  padding: 0.7rem 0.85rem;
  border-radius: 12px;
  background: rgba(5, 8, 12, 0.95);
  border: 1px solid rgba(255, 255, 255, 0.05);
  font-size: 0.85rem;
}

.audio-controls-title {
  font-size: 0.76rem;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  color: var(--text-muted);
  margin-bottom: 0.4rem;
}

.audio-row {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin-bottom: 0.35rem;
}

.audio-row label {
  width: 70px;
  font-size: 0.8rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.audio-row input[type="range"] {
  flex: 1;
  -webkit-appearance: none;
  appearance: none;
  height: 4px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.15);
  outline: none;
}

.audio-row input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 10px rgba(228, 179, 91, 0.8);
  cursor: pointer;
}

.audio-row input[type="range"]::-moz-range-thumb {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 10px rgba(228, 179, 91, 0.8);
  cursor: pointer;
}

.audio-percentage {
  width: 40px;
  text-align: right;
  font-size: 0.78rem;
  color: var(--text-muted);
}

.detail-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.25rem;
}

.begin-btn {
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  padding: 0.35rem 1.1rem;
  border-radius: 999px;
  border: 1px solid rgba(228, 179, 91, 0.8);
  background: radial-gradient(circle at top, rgba(228, 179, 91, 0.4), rgba(10, 7, 3, 0.98));
  color: #1a1307;
  cursor: pointer;
  white-space: nowrap;
  box-shadow: 0 0 12px rgba(228, 179, 91, 0.7);
  transition: transform 0.12s ease, box-shadow 0.12s ease, filter 0.12s ease;
}

.begin-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 0 18px rgba(228, 179, 91, 1);
  filter: brightness(1.05);
}

.begin-btn:disabled {
  opacity: 0.4;
  cursor: default;
  box-shadow: none;
}

.node.disabled {
  opacity: 0.35;
  cursor: not-allowed;
  box-shadow: none;
  transform: none;
}

.node.disabled:hover {
  background: transparent;
  transform: none;
}

.try-again-btn {
  margin-top: 0.6rem;
  align-self: flex-start;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  padding: 0.35rem 1.1rem;
  border-radius: 999px;
  border: 1px solid rgba(255, 120, 120, 0.9);
  background: radial-gradient(circle at top, rgba(255, 120, 120, 0.4), rgba(25, 5, 5, 0.98));
  color: #ffeaea;
  cursor: pointer;
  white-space: nowrap;
  box-shadow: 0 0 12px rgba(255, 120, 120, 0.7);
  transition: transform 0.12s ease, box-shadow 0.12s ease, filter 0.12s ease;
}

.try-again-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 0 18px rgba(255, 120, 120, 1);
  filter: brightness(1.05);
}

.try-again-btn:disabled {
  opacity: 0.4;
  cursor: default;
  box-shadow: none;
}

