:root {
  color-scheme: light;
  --bg: #eef2ea;
  --surface: #ffffff;
  --soft: #fbfaf3;
  --ink: #14231d;
  --muted: #62726c;
  --line: #d8dfd5;
  --accent: #0c6f63;
  --accent-dark: #06483f;
  --gold: #c99a3d;
  --gold-soft: #f4dfae;
  --emerald-black: #052f2a;
  --rose: #be4b68;
  --blue: #2563eb;
  --green: #15803d;
  --violet: #7c3aed;
  --shadow: 0 18px 55px rgba(5, 47, 42, 0.14);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background:
    linear-gradient(45deg, rgba(12, 111, 99, 0.035) 25%, transparent 25%),
    linear-gradient(-45deg, rgba(12, 111, 99, 0.035) 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, rgba(201, 154, 61, 0.04) 75%),
    linear-gradient(-45deg, transparent 75%, rgba(201, 154, 61, 0.04) 75%),
    var(--bg);
  background-position: 0 0, 0 14px, 14px -14px, -14px 0;
  background-size: 28px 28px;
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  overflow: hidden;
}

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.46;
}

.app-shell {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  gap: 8px;
  height: 100vh;
  padding: 10px;
  overflow: hidden;
}

.topbar {
  position: relative;
  z-index: 1000;
  display: grid;
  grid-template-columns: minmax(260px, 0.8fr) minmax(420px, 1.2fr);
  gap: 12px;
  align-items: stretch;
  max-width: 1720px;
  width: 100%;
  min-height: 0;
  margin: 0 auto;
  overflow: visible;
  padding: 10px 12px;
  border: 1px solid rgba(244, 223, 174, 0.42);
  border-radius: 8px;
  background:
    radial-gradient(circle at 12% 16%, rgba(244, 223, 174, 0.18), transparent 24%),
    radial-gradient(circle at 78% 6%, rgba(24, 139, 121, 0.42), transparent 27%),
    linear-gradient(135deg, #063b35 0%, #075448 52%, #052f2a 100%);
  box-shadow: 0 22px 60px rgba(5, 47, 42, 0.24);
}

.topbar::before {
  content: "";
  position: absolute;
  inset: 0;
  opacity: 0.17;
  border-radius: inherit;
  background:
    repeating-conic-gradient(from 45deg, transparent 0 25%, rgba(244, 223, 174, 0.55) 0 50%) 0 0 / 46px 46px,
    linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.18), transparent);
  mask-image: linear-gradient(90deg, rgba(0, 0, 0, 0.85), transparent 75%);
  pointer-events: none;
}

.topbar::after {
  content: "";
  position: absolute;
  left: 12px;
  right: 12px;
  bottom: 0;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--gold), var(--gold-soft), var(--gold), transparent);
  opacity: 0.92;
}

.topbar > * {
  position: relative;
  z-index: 1001;
}

.topbar h1 {
  max-width: 900px;
  margin: 0;
  color: #fffaf0;
  font-size: 22px;
  font-weight: 860;
  line-height: 1.05;
  text-wrap: balance;
}

.intro {
  max-width: 920px;
  margin: 4px 0 0;
  color: rgba(255, 250, 240, 0.78);
  font-size: 12px;
  line-height: 1.35;
}

.topbar .eyebrow {
  display: inline-flex;
  width: auto;
  margin-bottom: 5px;
  padding: 4px 8px;
  border: 1px solid rgba(244, 223, 174, 0.42);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  color: var(--gold-soft);
  backdrop-filter: blur(10px);
}

.progress-card,
.top-search {
  padding: 8px;
  border: 1px solid rgba(244, 223, 174, 0.38);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.1);
}

.top-search {
  position: relative;
  z-index: 1100;
  align-self: stretch;
  display: grid;
  align-content: stretch;
  gap: 10px;
  padding: 8px;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.18), rgba(255, 255, 255, 0.08)),
    radial-gradient(circle at 96% 14%, rgba(244, 223, 174, 0.24), transparent 34%);
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.08),
    0 16px 42px rgba(2, 24, 21, 0.22);
  backdrop-filter: blur(16px);
}

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

.top-search label {
  color: var(--gold-soft);
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
}

.top-search p {
  margin: 2px 0 0;
  color: rgba(255, 250, 240, 0.68);
  font-size: 11px;
  line-height: 1.3;
}

.search-status {
  flex: 0 0 auto;
  min-width: 108px;
  padding: 6px 8px;
  border: 1px solid rgba(244, 223, 174, 0.3);
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.11);
}

.search-status span {
  display: block;
  color: var(--gold-soft);
  font-size: 10px;
  font-weight: 900;
  text-transform: uppercase;
}

.search-status strong {
  display: block;
  margin-top: 2px;
  overflow: hidden;
  color: #fffaf0;
  font-size: 12px;
  line-height: 1.2;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.top-search input {
  width: 100%;
  min-height: 40px;
  padding: 8px 12px;
  border: 1px solid rgba(244, 223, 174, 0.48);
  border-radius: 8px;
  outline: 0;
  background: rgba(255, 255, 255, 0.96);
  color: var(--ink);
  font-size: 14px;
  font-weight: 650;
  box-shadow: 0 12px 32px rgba(2, 24, 21, 0.22);
}

.top-search input:focus {
  border-color: var(--gold-soft);
  box-shadow:
    0 0 0 4px rgba(244, 223, 174, 0.2),
    0 12px 32px rgba(2, 24, 21, 0.22);
}

.quick-results {
  position: absolute;
  top: calc(100% - 2px);
  left: 8px;
  right: 8px;
  z-index: 3000;
  display: none;
  max-height: 320px;
  overflow: auto;
  border: 1px solid #c8d8d4;
  border-radius: 8px;
  background:
    linear-gradient(180deg, #ffffff 0%, #fbfaf3 100%);
  box-shadow: 0 28px 80px rgba(5, 47, 42, 0.32);
  isolation: isolate;
}

.quick-results.active {
  display: grid;
}

.quick-results button {
  display: grid;
  gap: 5px;
  padding: 12px;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: transparent;
  color: var(--ink);
  text-align: left;
}

.quick-results button:hover {
  background: #e9f5f2;
}

.quick-results strong {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.quick-results em {
  flex: 0 0 auto;
  padding: 4px 7px;
  border-radius: 999px;
  background: var(--accent);
  color: #ffffff;
  font-size: 11px;
  font-style: normal;
  font-weight: 900;
}

.quick-results span {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.progress-card span,
.eyebrow,
.mini-heading {
  display: block;
  margin: 0 0 7px;
  color: var(--accent-dark);
  font-size: 12px;
  font-weight: 850;
  letter-spacing: 0;
  text-transform: uppercase;
}

.progress-card strong {
  display: block;
  font-size: 18px;
  line-height: 1.2;
}

.workspace {
  position: relative;
  display: grid;
  grid-template-columns: 300px minmax(0, 1fr) 420px;
  grid-template-rows: minmax(0, 1fr);
  max-width: 1720px;
  width: 100%;
  height: 100%;
  min-height: 0;
  margin: 0 auto;
  overflow: hidden;
  border: 1px solid rgba(12, 111, 99, 0.18);
  border-radius: 8px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.94), rgba(251, 250, 243, 0.98));
  box-shadow: var(--shadow);
}

.journey-panel,
.study-panel {
  min-height: 0;
  height: 100%;
  padding: 12px;
  overflow-y: auto;
  overflow-x: hidden;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.84), rgba(251, 250, 243, 0.98));
  overscroll-behavior: contain;
}

.journey-panel {
  border-right: 1px solid rgba(12, 111, 99, 0.16);
  background: linear-gradient(180deg, #ffffff 0%, #f7fbf8 52%, #fbfaf3 100%);
}

.study-panel {
  position: relative;
  border-left: 1px solid rgba(12, 111, 99, 0.16);
}

.study-panel.open {
  transform: none;
}

.panel-heading h2,
.study-panel h2,
.map-toolbar h2 {
  margin: 0;
  line-height: 1.12;
}

.panel-heading h2 {
  font-size: 18px;
  letter-spacing: 0;
}

.rail-tabs,
.study-tabs {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 5px;
  margin-top: 10px;
  padding: 5px;
  border: 1px solid rgba(12, 111, 99, 0.14);
  border-radius: 8px;
  background: #edf3ef;
}

.rail-tab,
.study-tab {
  min-height: 34px;
  padding: 6px 7px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  font-size: 12px;
  font-weight: 850;
}

.rail-tab.active,
.study-tab.active {
  background: #ffffff;
  color: var(--accent-dark);
  box-shadow: 0 6px 16px rgba(5, 47, 42, 0.1);
}

.rail-pane,
.study-tab-panel {
  display: none;
}

.rail-pane.active,
.study-tab-panel.active {
  display: block;
}

.start-actions {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 7px;
  margin-top: 10px;
}

.start-card {
  position: relative;
  display: grid;
  grid-template-columns: 22px minmax(0, 1fr);
  gap: 2px 8px;
  width: 100%;
  padding: 9px;
  border: 1px solid rgba(12, 111, 99, 0.14);
  border-radius: 8px;
  background: linear-gradient(135deg, #ffffff, #fbfaf3);
  color: var(--ink);
  text-align: left;
}

.start-card span {
  grid-row: 1 / 3;
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border-radius: 999px;
  background: linear-gradient(135deg, #e6f3ef, #fff3cf);
  color: var(--accent-dark);
  font-size: 11px;
  font-weight: 900;
}

.start-card strong {
  font-size: 12px;
  line-height: 1.25;
}

.start-card small {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.34;
  display: none;
}

.start-card.active small,
.start-card:hover small {
  display: block;
}

.start-card.active {
  border-color: rgba(201, 154, 61, 0.55);
  background: linear-gradient(135deg, #e9f5f2, #fff8e5);
  box-shadow: inset 4px 0 0 var(--gold), 0 10px 26px rgba(5, 47, 42, 0.08);
}

.section-divider {
  margin-top: 11px;
  padding-top: 10px;
  border-top: 1px solid var(--line);
}

.section-divider .start-card {
  margin-top: 8px;
}

.journey-list {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 7px;
  margin-top: 8px;
}

.category-tabs {
  display: flex;
  gap: 6px;
  margin-top: 12px;
  overflow-x: auto;
  padding: 2px 2px 6px;
  scrollbar-width: thin;
}

.category-tab {
  flex: 0 0 auto;
  min-height: 30px;
  padding: 6px 9px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--muted);
  font-size: 12px;
  font-weight: 850;
  white-space: nowrap;
}

.category-tab.active {
  border-color: rgba(201, 154, 61, 0.55);
  background: linear-gradient(135deg, #e9f5f2, #fff8e5);
  color: var(--accent-dark);
}

.journey-card,
.node-result,
.nearby-list button {
  width: 100%;
  border: 1px solid rgba(12, 111, 99, 0.14);
  border-radius: 8px;
  background: linear-gradient(135deg, #ffffff, #fbfaf3);
  color: var(--ink);
  text-align: left;
}

.journey-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 4px;
  padding: 10px;
}

.journey-card span,
.node-result span,
.nearby-list span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
}

.journey-card strong,
.node-result strong {
  font-size: 13px;
  line-height: 1.25;
}

.journey-card small {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.35;
}

.journey-card.active,
.node-result.active {
  border-color: rgba(201, 154, 61, 0.55);
  background: linear-gradient(135deg, #e9f5f2, #fff8e5);
  box-shadow: inset 4px 0 0 var(--gold), 0 10px 24px rgba(5, 47, 42, 0.08);
}

.node-list {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 7px;
  margin-top: 12px;
}

.node-result {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 4px;
  padding: 9px 10px;
}

.area-summary {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 5px;
  padding: 10px;
  border: 1px solid rgba(12, 111, 99, 0.18);
  border-radius: 8px;
  background: linear-gradient(135deg, #e9f5f2, #fff8e5);
}

.area-summary strong {
  font-size: 13px;
}

.area-summary span {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.map-panel {
  position: relative;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(251, 250, 243, 0.98)),
    #ffffff;
}

.menu-button,
.mobile-nav-scrim,
.mobile-tab-bar,
.nav-close-button {
  display: none;
}

.panel-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.map-toolbar {
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin: 10px;
  padding: 9px 11px;
  border: 1px solid rgba(12, 111, 99, 0.16);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(10px);
}

.map-panel.clean-map .edge-label,
.map-panel.clean-map .map-label.hidden-label {
  display: none;
}

.map-panel.clean-map .path-strip {
  display: none;
}

.map-toolbar h2 {
  font-size: 16px;
}

.visual-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 0;
}

.visual-tab {
  min-height: 32px;
  padding: 6px 10px;
  border: 1px solid rgba(12, 111, 99, 0.16);
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.84);
  color: var(--muted);
  font-size: 12px;
  font-weight: 850;
}

.visual-tab.active {
  border-color: rgba(201, 154, 61, 0.56);
  background: linear-gradient(135deg, #e9f5f2, #fff8e5);
  color: var(--accent-dark);
}

.toolbar-actions {
  display: flex;
  flex-wrap: nowrap;
  gap: 8px;
  justify-content: flex-end;
  flex: 0 0 auto;
}

.toolbar-actions button {
  min-height: 32px;
  padding: 6px 9px;
  border: 1px solid rgba(12, 111, 99, 0.18);
  border-radius: 7px;
  background: var(--surface);
  color: var(--ink);
  font-weight: 750;
}

.toolbar-actions select {
  min-height: 32px;
  max-width: 92px;
  padding: 5px 7px;
  border: 1px solid rgba(12, 111, 99, 0.18);
  border-radius: 7px;
  background: var(--surface);
  color: var(--ink);
  font-size: 12px;
  font-weight: 750;
}

.main-study-content {
  min-height: 0;
  overflow-y: auto;
  padding: 26px clamp(18px, 4vw, 58px) 42px;
  scroll-behavior: smooth;
}

.main-study-content > * {
  max-width: 880px;
  margin-left: auto;
  margin-right: auto;
}

.main-study-content h1 {
  margin: 8px auto 12px;
  color: var(--ink);
  font-size: clamp(30px, 4vw, 54px);
  line-height: 1.04;
  letter-spacing: 0;
  text-wrap: balance;
}

.content-kicker {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin-top: 2px;
}

.content-kicker span,
.content-kicker strong {
  padding: 6px 9px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 900;
}

.content-kicker span {
  background: #e9f5f2;
  color: var(--accent-dark);
}

.content-kicker strong {
  background: #fff8e5;
  color: #70480b;
}

.main-study-content .lead {
  margin-top: 0;
  color: #263d35;
  font-size: 18px;
  line-height: 1.62;
}

.content-panel .map-toolbar {
  position: sticky;
  top: 0;
  margin: 0;
  border-width: 0 0 1px;
  border-radius: 0;
  box-shadow: 0 10px 28px rgba(5, 47, 42, 0.08);
}

#nextStep {
  border-color: var(--accent);
  background: var(--accent);
  color: #ffffff;
}

#graph {
  display: none;
  width: 100%;
  height: 100%;
  min-height: 0;
  overflow: hidden;
  cursor: grab;
  touch-action: none;
  transition: opacity 140ms ease;
}

#graph:active {
  cursor: grabbing;
}

.map-dismiss-layer {
  fill: transparent;
  pointer-events: all;
}

.edge {
  stroke: #9ca8a1;
  stroke-width: 0.42;
  opacity: 0.5;
  vector-effect: non-scaling-stroke;
}

.quiet-edge {
  opacity: 0.18;
}

.path-edge {
  stroke: var(--gold);
  stroke-width: 0.7;
  opacity: 0.88;
}

.selected-edge {
  stroke: var(--accent-dark);
  stroke-width: 0.85;
  opacity: 0.9;
  stroke-dasharray: 1.8 1.1;
  animation: flowLine 1.8s linear infinite;
}

.overview-edge {
  stroke: rgba(98, 114, 108, 0.36);
  stroke-width: 0.26;
  opacity: 0.18;
  stroke-dasharray: none;
  animation: none;
}

.map-panel.clean-map .selected-edge {
  stroke: rgba(98, 114, 108, 0.36);
  stroke-width: 0.26;
  opacity: 0.18;
  stroke-dasharray: none;
  animation: none;
}

.edge-label {
  display: none;
  fill: #17211d;
  font-size: 1.65px;
  font-weight: 850;
  paint-order: stroke;
  stroke: #ffffff;
  stroke-width: 0.7px;
  stroke-linejoin: round;
  opacity: 0.82;
}

.signal-dot {
  display: none;
  filter: drop-shadow(0 0 4px rgba(201, 154, 61, 0.8));
  opacity: 0.92;
}

.map-node {
  cursor: pointer;
  transition: opacity 160ms ease, filter 160ms ease;
  outline: none;
}

.node-hit-area {
  pointer-events: all;
}

.map-node:focus-visible {
  filter: brightness(1.08);
}

.map-node:hover circle {
  transform: scale(1.06);
}

.map-node circle {
  stroke: transparent;
  stroke-width: 0;
  filter: drop-shadow(0 2px 3px rgba(23, 33, 29, 0.18));
  transform-box: fill-box;
  transform-origin: center;
}

.map-node.selected circle {
  stroke: transparent;
  stroke-width: 0;
  filter: drop-shadow(0 0 7px rgba(12, 111, 99, 0.58));
}

.map-node.selected .map-label {
  font-size: 2.25px;
}

.map-node.in-path circle {
  filter: drop-shadow(0 0 5px rgba(15, 118, 110, 0.42));
  animation: softBreathe 3.2s ease-in-out infinite;
}

.map-node.dimmed {
  opacity: 0.11;
}

.map-label {
  pointer-events: all;
  paint-order: stroke;
  stroke: #ffffff;
  stroke-linejoin: round;
}

.map-label {
  fill: #17211d;
  font-size: 1.85px;
  font-weight: 850;
  stroke-width: 0.56px;
}

.hidden-label {
  opacity: 0;
  pointer-events: none;
}

.map-node:hover .hidden-label {
  opacity: 1;
}

.path-strip {
  display: none;
  gap: 9px;
  overflow-x: auto;
  overflow-y: hidden;
  padding: 8px 10px 10px;
  border-top: 1px solid rgba(12, 111, 99, 0.16);
  background: linear-gradient(90deg, rgba(255, 248, 229, 0.92), rgba(233, 245, 242, 0.92));
  overscroll-behavior-x: contain;
}

.path-strip.collapsed {
  max-height: 50px;
}

.path-step {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 32px;
  padding: 6px 10px;
  border: 1px solid rgba(12, 111, 99, 0.16);
  border-radius: 999px;
  background: var(--surface);
  color: var(--ink);
  white-space: nowrap;
  font-weight: 800;
}

.path-step span {
  display: grid;
  place-items: center;
  min-width: 22px;
  height: 22px;
  padding: 0 6px;
  border-radius: 999px;
  background: #edf3ef;
  color: var(--accent-dark);
  font-size: 12px;
}

.path-step.active {
  border-color: rgba(201, 154, 61, 0.6);
  background: #fff8e5;
}

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

.study-panel h2 {
  font-size: 25px;
}

.study-tabs {
  position: sticky;
  top: 38px;
  z-index: 2;
  margin: 14px 0;
  background: #edf3ef;
}

.study-tab-panel {
  padding-bottom: 8px;
}

.study-close {
  position: sticky;
  top: 0;
  z-index: 2;
  float: right;
  width: 34px;
  height: 34px;
  margin: -4px -4px 8px 10px;
  border: 1px solid rgba(12, 111, 99, 0.18);
  border-radius: 999px;
  background: #ffffff;
  color: var(--accent-dark);
  font-size: 20px;
  font-weight: 850;
  line-height: 1;
  box-shadow: 0 8px 24px rgba(5, 47, 42, 0.12);
}

.arabic {
  margin: 12px 0;
  color: var(--accent-dark);
  font-size: 30px;
  line-height: 1.25;
}

.lead,
.study-panel p {
  color: var(--muted);
  line-height: 1.58;
}

.lead {
  color: #31413b;
  font-size: 16px;
}

.lesson-section,
.connection-explainer,
.journey-takeaway {
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

.lesson-section h3,
.connection-explainer h3,
.journey-takeaway h3 {
  margin: 0 0 8px;
  font-size: 15px;
}

.commentary-section h3 {
  color: var(--muted);
  font-size: 12px;
  font-weight: 850;
  letter-spacing: 0;
  text-transform: uppercase;
}

.lesson-section ul {
  margin: 0;
  padding-left: 19px;
  color: var(--muted);
  line-height: 1.52;
}

.lesson-section li + li {
  margin-top: 7px;
}

.connection-explainer {
  padding: 14px;
  border: 1px solid #c8d8d4;
  border-radius: 8px;
  background: #e9f5f2;
}

.surah-context {
  margin-top: 16px;
  padding: 14px;
  border: 1px solid #c8d8d4;
  border-radius: 8px;
  background: #e9f5f2;
}

.surah-context h3 {
  margin: 0 0 8px;
  font-size: 15px;
}

.surah-context p {
  margin: 0;
}

.quran-text-panel {
  margin-top: 16px;
  padding: 14px;
  border: 1px solid rgba(201, 154, 61, 0.45);
  border-radius: 8px;
  background:
    linear-gradient(135deg, #fffaf0, #f7fbf8);
  box-shadow: inset 4px 0 0 var(--gold);
}

.quran-text-panel h3 {
  margin: 0 0 8px;
  color: var(--accent-dark);
  font-size: 15px;
}

.quran-text-panel p {
  color: #263d35;
}

.hadith-panel {
  margin-top: 16px;
  padding: 14px;
  border: 1px solid rgba(201, 154, 61, 0.38);
  border-radius: 8px;
  background: linear-gradient(135deg, #fffaf0, #ffffff);
  box-shadow: inset 4px 0 0 #a16207;
}

.hadith-panel h3 {
  margin: 0 0 8px;
  color: #70480b;
  font-size: 15px;
}

.hadith-list {
  display: grid;
  gap: 9px;
  max-height: 520px;
  overflow: auto;
  padding-right: 4px;
}

.hadith-button {
  display: grid;
  gap: 6px;
  width: 100%;
  padding: 11px;
  border: 1px solid rgba(138, 90, 16, 0.2);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.84);
  color: var(--ink);
  text-align: left;
}

.hadith-button:hover {
  border-color: #a16207;
  background: #ffffff;
}

.hadith-button em {
  color: #8a5a10;
  font-size: 12px;
  font-style: normal;
  font-weight: 850;
}

.hadith-button span {
  color: #263d35;
  font-size: 13px;
  line-height: 1.46;
}

.hadith-button small,
.nearby-list small {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.38;
}

.source-links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 10px 0;
}

.source-links a {
  padding: 7px 9px;
  border: 1px solid rgba(138, 90, 16, 0.22);
  border-radius: 999px;
  background: #ffffff;
  color: #70480b;
  font-size: 12px;
  font-weight: 850;
  text-decoration: none;
}

.source-links a:hover {
  border-color: #a16207;
}

.ayah-ref,
.preview-note {
  color: var(--muted) !important;
  font-size: 12px;
  font-weight: 800;
}

.verse-list {
  display: grid;
  gap: 8px;
  max-height: 360px;
  overflow: auto;
  padding-right: 4px;
}

.topic-verses {
  max-height: 420px;
}

.compact-source {
  box-shadow: none;
}

.compact-verses {
  max-height: 230px;
}

.verse-button {
  display: grid;
  gap: 6px;
  width: 100%;
  padding: 10px;
  border: 1px solid rgba(12, 111, 99, 0.16);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.78);
  color: var(--ink);
  text-align: left;
}

.verse-button:hover {
  border-color: var(--accent);
  background: #ffffff;
}

.verse-button span {
  color: #263d35;
  font-size: 13px;
  line-height: 1.45;
}

.reference-section {
  padding: 12px;
  border: 1px solid rgba(12, 111, 99, 0.14);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.68);
}

.mini-reference-list {
  display: grid;
  gap: 7px;
  margin-top: 10px;
}

.mini-reference-list .verse-button {
  padding: 9px;
}

.verse-list p {
  margin: 0;
  line-height: 1.55;
}

.verse-list strong {
  color: var(--accent-dark);
}

.connection-explainer p {
  margin: 8px 0 0;
}

.tag-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 16px 0;
}

.tag {
  padding: 6px 8px;
  border-radius: 999px;
  background: #edf3ef;
  color: #31413b;
  font-size: 12px;
  font-weight: 800;
}

.md-link {
  display: inline-flex;
  margin-top: 4px;
  color: var(--accent-dark);
  font-weight: 850;
  text-decoration: none;
}

.nearby-list {
  display: grid;
  gap: 9px;
}

.nearby-list button {
  display: grid;
  gap: 5px;
  padding: 11px;
}

.nearby-list button:hover,
.journey-card:hover,
.node-result:hover,
.path-step:hover,
.toolbar-actions button:hover,
.start-card:hover,
.category-tab:hover {
  border-color: var(--accent);
}

.journey-takeaway {
  padding: 14px;
  border: 1px solid #ead8b9;
  border-radius: 8px;
  background: #fff7e8;
}

.learning-dossier {
  display: grid;
  gap: 12px;
  padding: 14px;
  border: 1px solid rgba(12, 111, 99, 0.18);
  border-radius: 8px;
  background: linear-gradient(135deg, #f7fbf8, #fffaf0);
}

.dossier-block {
  display: grid;
  gap: 8px;
}

.dossier-block > strong {
  color: var(--accent-dark);
  font-size: 13px;
  text-transform: uppercase;
}

.guide-link {
  display: grid;
  gap: 5px;
  width: 100%;
  padding: 10px;
  border: 1px solid rgba(12, 111, 99, 0.16);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.8);
  color: var(--ink);
  text-align: left;
}

.guide-link:hover {
  border-color: var(--accent);
  background: #ffffff;
}

.guide-link span {
  font-weight: 850;
}

.guide-link small,
.source-note {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.selected-guide {
  padding: 14px;
  border: 1px solid rgba(201, 154, 61, 0.48);
  border-radius: 8px;
  background: linear-gradient(135deg, #fff8e5, #f7fbf8);
  box-shadow: inset 4px 0 0 var(--gold);
}

.source-confidence {
  display: grid;
  gap: 8px;
  padding: 12px;
  border: 1px solid rgba(12, 111, 99, 0.12);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.72);
}

.source-confidence p {
  display: grid;
  gap: 3px;
  margin: 0;
}

.source-confidence strong {
  color: var(--accent-dark);
  font-size: 13px;
}

.source-confidence span {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.42;
}

.next-steps .nearby-list button:first-child {
  border-color: rgba(201, 154, 61, 0.5);
  background: #fff8e5;
}

@media (max-width: 1240px) {
  .workspace {
    grid-template-columns: 270px minmax(0, 1fr) 360px;
  }

  .study-panel {
    padding: 12px;
  }
}

@media (max-width: 820px) {
  body {
    overflow: auto;
  }

  .app-shell {
    display: block;
    height: auto;
    min-height: 100vh;
    padding: 8px;
    padding-bottom: calc(64px + env(safe-area-inset-bottom, 0px));
    overflow: visible;
  }

  .topbar {
    grid-template-columns: 1fr;
    gap: 6px;
    min-height: 0;
    margin-bottom: 8px;
    padding: 9px;
    z-index: 20;
  }

  .topbar h1 {
    font-size: 17px;
  }

  .intro {
    display: none;
  }

  .top-search {
    padding: 12px;
  }

  .search-heading {
    align-items: flex-start;
    flex-direction: column;
  }

  .search-status {
    width: 100%;
  }

  .workspace {
    display: grid;
    grid-template-columns: 1fr;
    grid-template-rows: auto auto auto;
    height: auto;
    overflow: visible;
    max-width: none;
    margin: 0;
  }

  .mobile-nav-scrim {
    position: fixed;
    inset: 0;
    z-index: 24;
    display: none;
    background: rgba(5, 47, 42, 0.32);
  }

  body.nav-open .mobile-nav-scrim {
    display: block;
  }

  .map-panel {
    order: 2;
    min-height: 0;
  }

  .study-panel {
    position: relative;
    inset: auto;
    order: 3;
    width: auto;
    height: auto;
    max-height: none;
    padding: 14px;
    overflow-y: auto;
    border-top: 1px solid var(--line);
    border-left: 0;
    transform: none;
  }

  .journey-panel {
    position: fixed;
    inset: 0;
    z-index: 25;
    order: initial;
    width: 100%;
    height: 100%;
    max-height: none;
    padding: 14px;
    padding-bottom: calc(78px + env(safe-area-inset-bottom, 0px));
    overflow-y: auto;
    border: 0;
    box-shadow: none;
    transform: translateX(-100%);
    transition: transform 180ms ease;
  }

  .journey-panel .panel-heading {
    position: sticky;
    top: -14px;
    z-index: 2;
    margin: -14px -14px 10px;
    padding: 14px 14px 12px;
    border-bottom: 1px solid rgba(12, 111, 99, 0.12);
    background: rgba(255, 255, 255, 0.96);
    backdrop-filter: blur(12px);
  }

  .journey-panel .panel-heading h2 {
    font-size: 22px;
  }

  .nav-close-button {
    display: flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    width: 36px;
    height: 36px;
    border: 0;
    border-radius: 999px;
    background: #eaf2ee;
    color: var(--accent-dark);
    font-size: 16px;
    font-weight: 900;
  }

  .journey-panel .rail-tabs {
    display: none;
  }

  .rail-tab {
    min-height: 42px;
    font-size: 13px;
  }

  .mobile-tab-bar {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 40;
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    background: #ffffff;
    border-top: 1px solid rgba(12, 111, 99, 0.16);
    box-shadow: 0 -10px 26px rgba(5, 47, 42, 0.12);
    padding-bottom: env(safe-area-inset-bottom, 0px);
  }

  .mobile-tab {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    min-height: 58px;
    border: 0;
    background: transparent;
    color: var(--muted);
    font-size: 11px;
    font-weight: 800;
  }

  .mobile-tab-icon {
    font-size: 18px;
    line-height: 1;
  }

  .mobile-tab.active {
    color: var(--accent-dark);
  }

  .category-tabs {
    margin-left: 0;
    padding-left: 1px;
  }

  .start-card,
  .journey-card,
  .node-result {
    border-color: rgba(12, 111, 99, 0.16);
  }

  .start-card {
    min-height: 46px;
  }

  .start-card small {
    display: block;
  }

  body.nav-open .journey-panel {
    transform: translateX(0);
  }

  .map-panel {
    border-top: 1px solid var(--line);
  }

  .map-toolbar {
    align-items: flex-start;
    flex-direction: column;
    margin: 10px;
    padding: 10px;
    gap: 10px;
  }

  .map-toolbar h2 {
    font-size: 14px;
  }

  .toolbar-actions button {
    min-height: 32px;
    padding: 6px 8px;
    font-size: 12px;
  }

  .main-study-content {
    padding: 20px 14px 28px;
  }

  .main-study-content h1 {
    font-size: 34px;
  }

}

@keyframes flowLine {
  from {
    stroke-dashoffset: 0;
  }

  to {
    stroke-dashoffset: -5.8;
  }
}

@keyframes focusPulse {
  0%,
  100% {
    transform: scale(1);
    filter: drop-shadow(0 0 3px rgba(15, 118, 110, 0.35));
  }

  50% {
    transform: scale(1.12);
    filter: drop-shadow(0 0 8px rgba(15, 118, 110, 0.65));
  }
}

@keyframes softBreathe {
  0%,
  100% {
    transform: scale(1);
  }

  50% {
    transform: scale(1.045);
  }
}
