:root {
  color-scheme: light;
  font-family: "DM Sans", "Noto Sans Bengali", sans-serif;
  color: #17324d;
  background: #f3f7fa;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
  --ink: #17324d;
  --muted: #53697b;
  --line: #e4ebf1;
  --navy: #102a43;
  --teal: #14776e;
  --coral: #da6556;
  --gold: #e2a83b;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background:
    radial-gradient(ellipse at 92% 5%, rgba(37, 169, 157, 0.09), transparent 27rem),
    #f3f7fa;
}

button,
a {
  font: inherit;
}

button {
  cursor: pointer;
}

:focus-visible {
  outline: 3px solid #087b74;
  outline-offset: 3px;
}

.app-shell {
  min-height: 100vh;
}

.topbar {
  min-height: 72px;
  padding: 0 clamp(20px, 5vw, 76px);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(255, 255, 255, 0.94);
  border-bottom: 1px solid var(--line);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 11px;
  color: var(--navy);
  font-size: 15px;
  font-weight: 700;
  letter-spacing: -0.02em;
  text-decoration: none;
}

.brand-mark {
  display: grid;
  width: 32px;
  height: 32px;
  place-items: center;
  border-radius: 10px;
  color: white;
  background: var(--teal);
  font-size: 18px;
}

.topbar-actions,
.language-switch {
  display: flex;
  align-items: center;
}

.topbar-actions {
  gap: 23px;
}

.language-switch {
  padding: 3px;
  gap: 2px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: #f7f9fb;
}

.language-button {
  min-width: 43px;
  min-height: 30px;
  padding: 4px 8px;
  border: 0;
  border-radius: 6px;
  color: var(--muted);
  background: transparent;
  font-size: 12px;
  font-weight: 700;
}

.language-button.is-active {
  color: var(--navy);
  background: white;
  box-shadow: 0 1px 4px rgba(16, 42, 67, 0.13);
}

.help-link {
  color: #526a80;
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
}

.help-link:hover {
  color: var(--teal);
}

.page-content {
  width: min(1440px, 100%);
  margin: 0 auto;
  padding: 52px clamp(20px, 5vw, 76px) 25px;
}

.intro {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 28px;
  margin-bottom: 29px;
}

.eyebrow {
  margin: 0 0 8px;
  color: #5f7486;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.15em;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 8px;
  color: var(--navy);
  font-size: clamp(30px, 3.4vw, 43px);
  line-height: 1.12;
  letter-spacing: -0.045em;
}

.intro-copy {
  max-width: 590px;
  margin-bottom: 0;
  color: #5a7183;
  font-size: 14px;
  line-height: 1.7;
}

.import-actions {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 10px;
}

.button {
  min-height: 43px;
  padding: 0 15px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  border: 1px solid transparent;
  border-radius: 9px;
  font-size: 12px;
  font-weight: 700;
  transition: transform 120ms ease, box-shadow 120ms ease;
}

.button:hover {
  transform: translateY(-1px);
}

.button-primary {
  color: #fff;
  background: var(--navy);
  box-shadow: 0 5px 12px rgba(16, 42, 67, 0.14);
}

.button-primary:hover {
  background: #1b405f;
}

.button-primary > span:first-child {
  font-size: 17px;
}

.button-secondary {
  color: #405b73;
  border-color: #dce5ec;
  background: #fff;
}

.button-secondary:hover {
  border-color: #9bb3c7;
}

.workspace {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 310px;
  align-items: start;
  gap: 20px;
}

.map-card,
.info-card,
.message-card {
  border: 1px solid #e5ecf1;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 8px 28px rgba(34, 68, 94, 0.045);
}

.map-card {
  min-width: 0;
  overflow: hidden;
}

.card-heading {
  min-height: 78px;
  padding: 20px 23px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid #edf1f4;
}

.map-toolbar {
  min-height: 57px;
  padding: 9px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 1px solid #edf1f4;
  background: #fbfcfd;
}

.mode-switch {
  padding: 3px;
  display: inline-flex;
  gap: 2px;
  border: 1px solid #e5ecf1;
  border-radius: 9px;
  background: #f4f7f9;
}

.mode-button {
  min-height: 30px;
  padding: 5px 11px;
  border: 0;
  border-radius: 6px;
  color: #52677a;
  background: transparent;
  font-size: 11px;
  font-weight: 700;
  transition: color 180ms ease, background-color 180ms ease, box-shadow 180ms ease;
}

.mode-button:disabled,
.button-reset:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.mode-button.is-active {
  color: #155c58;
  background: #e4f3ef;
  box-shadow: 0 1px 3px rgba(16, 42, 67, 0.1);
}

.button-reset {
  min-height: 33px;
  padding: 0 12px;
  border-color: #e2e9ee;
  color: #62798d;
  background: white;
  font-size: 11px;
}

.card-heading .eyebrow,
.info-card .eyebrow {
  margin-bottom: 5px;
}

h2 {
  margin-bottom: 0;
  color: var(--navy);
  font-size: 17px;
  letter-spacing: -0.025em;
}

.map-count {
  padding: 6px 10px;
  border-radius: 20px;
  color: #567188;
  background: #f2f6f8;
  font-size: 11px;
  font-weight: 700;
}

.map-container {
  min-height: 440px;
  padding: 15px;
  display: grid;
  place-items: center;
  background-image: radial-gradient(#dce6ec 0.8px, transparent 0.8px);
  background-position: 3px 3px;
  background-size: 22px 22px;
}

.map-container svg {
  width: 100%;
  max-height: 580px;
  overflow: visible;
}

.empty-state {
  max-width: 330px;
  padding: 38px 20px;
  color: #8193a2;
  text-align: center;
}

.empty-state p,
.muted-copy {
  margin: 0;
  color: #52677a;
  font-size: 12px;
  line-height: 1.7;
}

.empty-icon {
  width: 46px;
  height: 46px;
  margin: 0 auto 14px;
  display: grid;
  place-items: center;
  border: 1px solid #dbe5eb;
  border-radius: 14px;
  color: var(--teal);
  background: #fff;
  font-size: 26px;
}

.legend {
  min-height: 52px;
  padding: 12px 21px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px 19px;
  border-top: 1px solid #edf1f4;
}

.legend-item {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: #53697b;
  font-size: 10px;
  font-weight: 600;
}

.legend-symbol {
  width: 11px;
  height: 11px;
  display: inline-block;
  border: 2px solid;
  border-radius: 50%;
}

.legend-room {
  border-color: #168b83;
  background: #e6f5f1;
}

.legend-junction {
  border-color: #6385c4;
  border-radius: 2px;
  background: #edf1fc;
  transform: rotate(45deg) scale(0.8);
}

.legend-exit {
  border-color: #da6556;
  border-radius: 3px;
  background: #fff0ed;
}

.legend-blocked {
  border-color: #ba554a;
  background: #ba554a;
}

.legend-closed {
  border-color: #87939c;
  background: #e4e8ec;
}

.legend-blocked-edge {
  width: 16px;
  height: 3px;
  border: 0;
  border-radius: 0;
  background: repeating-linear-gradient(90deg, #c14c46 0 4px, transparent 4px 7px);
}

.side-panel {
  display: grid;
  gap: 14px;
}

.info-card,
.message-card {
  padding: 19px;
}

.info-card h2,
.message-card h2 {
  margin-bottom: 15px;
  font-size: 15px;
}

.details-content {
  color: #405b73;
  font-size: 12px;
}

.detail-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 9px 0;
  border-bottom: 1px solid #edf1f4;
}

.detail-row:last-child {
  border-bottom: 0;
}

.detail-label {
  color: #5f7486;
}

.detail-value {
  color: #344f67;
  font-weight: 700;
  text-align: right;
  overflow-wrap: anywhere;
}

.message-card {
  border-color: #f0e4c9;
  background: #fffdf8;
}

.message-heading {
  display: flex;
  align-items: center;
  gap: 9px;
}

.message-heading h2 {
  margin-bottom: 15px;
}

.message-icon {
  width: 20px;
  height: 20px;
  margin-top: -14px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: #795400;
  background: #f7ebcc;
  font-size: 12px;
  font-weight: 700;
}

.message-list {
  margin: 0;
  padding-left: 18px;
  color: #825e22;
  font-size: 12px;
  line-height: 1.65;
}

.message-list li + li {
  margin-top: 5px;
}

.message-card.has-errors {
  border-color: #efd0ca;
  background: #fff9f7;
}

.message-card.has-errors .message-icon {
  color: #8b3025;
  background: #f9e1dc;
}

.message-card.has-errors .message-list {
  color: #8c4137;
}

.state-list {
  margin: 0;
  padding: 0;
  display: grid;
  gap: 8px;
  list-style: none;
}

.state-list li {
  display: flex;
  justify-content: space-between;
  gap: 9px;
  color: #52677a;
  font-size: 11px;
}

.state-list strong {
  color: #465f75;
  font-weight: 600;
  text-align: right;
  overflow-wrap: anywhere;
}

.page-footer {
  padding: 21px 2px 0;
  color: #5e7284;
  font-size: 11px;
  text-align: center;
}

.visually-hidden {
  width: 1px;
  height: 1px;
  position: absolute;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  clip-path: inset(50%);
}

.route-result {
  min-height: 36px;
}

.route-failure {
  margin: 0;
  padding: 10px 11px;
  border: 1px solid #f1d7d3;
  border-radius: 8px;
  color: #a3483d;
  background: #fff6f4;
  font-size: 12px;
  font-weight: 700;
  line-height: 1.5;
}

.route-path {
  margin: 0 0 12px;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 5px;
  list-style: none;
}

.route-node {
  padding: 5px 7px;
  border: 1px solid #cae8e1;
  border-radius: 6px;
  color: #14776e;
  background: #eff9f6;
  font-size: 11px;
  font-weight: 700;
  animation: route-arrive 180ms ease-out both;
}

.route-node:nth-child(4n + 1) {
  animation-delay: 20ms;
}

.route-arrow {
  color: #5f7486;
  font-size: 12px;
}

.route-summary {
  padding-top: 5px;
  border-top: 1px solid #edf1f4;
}

.route-summary .detail-row {
  padding: 7px 0;
}

.edge-group {
  cursor: default;
}

.edge-group[role="button"] {
  cursor: pointer;
}

.edge-group:focus-visible,
.node-group:focus-visible {
  outline: none;
}

.edge-group:focus-visible .edge-line,
.edge-group:focus-visible .edge-hit-area {
  stroke: #102a43;
  stroke-width: 4;
}

.edge-hit-area {
  fill: none;
  stroke: transparent;
  stroke-width: 18;
  pointer-events: stroke;
  vector-effect: non-scaling-stroke;
}

.edge-line {
  stroke: #b4c5d0;
  stroke-width: 2;
  fill: none;
  pointer-events: none;
  transition: stroke 180ms ease, stroke-width 180ms ease, stroke-dasharray 180ms ease;
  vector-effect: non-scaling-stroke;
}

.edge-group.is-route .edge-line {
  stroke: #11a395;
  stroke-width: 5;
}

.edge-group.is-blocked .edge-line {
  stroke: #c14c46;
  stroke-width: 3;
  stroke-dasharray: 8 6;
}

.edge-group.is-blocked.is-route .edge-line {
  stroke: #c14c46;
}

.map-svg {
  animation: map-arrive 180ms ease-out both;
}

.map-svg .node-group {
  cursor: default;
}

.map-svg .node-group[role="button"] {
  cursor: pointer;
}

.node-group:focus-visible .node-shape {
  stroke: #102a43;
  stroke-width: 4;
}

.node-group > .node-shape,
.node-start-ring {
  transition: fill 180ms ease, stroke 180ms ease, opacity 180ms ease;
}

.node-start-ring {
  fill: none;
  stroke: #102a43;
  stroke-width: 2;
  opacity: 0.28;
  vector-effect: non-scaling-stroke;
}

.node-group.is-start .node-start-ring {
  opacity: 0.72;
}

.node-closed {
  fill: #e4e8ec;
  stroke: #87939c;
}

.node-group.is-blocked .node-shape {
  fill: #f7d9d5;
  stroke: #bc5046;
}

.node-group .node-state-mark {
  pointer-events: none;
}

.node-group.is-closed .node-shape {
  fill: #e4e8ec;
  stroke: #87939c;
}

.node-closed-mark {
  stroke: #687682;
}

.node-group .node-start-marker {
  pointer-events: none;
}

.edge-cost-bg,
.edge-cost {
  pointer-events: none;
}

@keyframes map-arrive {
  from { opacity: 0.75; }
  to { opacity: 1; }
}

@keyframes route-arrive {
  from { opacity: 0.65; transform: translateY(2px); }
  to { opacity: 1; transform: translateY(0); }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

.edge-cost-bg {
  fill: #fff;
  stroke: #e6edf1;
  stroke-width: 1;
  vector-effect: non-scaling-stroke;
}

.edge-cost {
  fill: #52697d;
  font-family: inherit;
  font-size: 12px;
  font-weight: 700;
  text-anchor: middle;
  dominant-baseline: central;
}

.node-label {
  fill: #314e66;
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  text-anchor: middle;
}

.node-room {
  fill: #e6f5f1;
  stroke: #168b83;
}

.node-junction {
  fill: #edf1fc;
  stroke: #6385c4;
}

.node-exit {
  fill: #fff0ed;
  stroke: #da6556;
}

.node-shape {
  stroke-width: 2.5;
  vector-effect: non-scaling-stroke;
}

.node-blocked {
  fill: #f9e3df;
  stroke: #ba554a;
}

.node-closed {
  fill: #f8e6bf;
  stroke: #b97c21;
}

.node-state-mark {
  stroke: #fff;
  stroke-width: 3;
  stroke-linecap: round;
  vector-effect: non-scaling-stroke;
}

@media (max-width: 980px) {
  .intro {
    align-items: stretch;
    flex-direction: column;
  }

  .import-actions {
    align-items: center;
    flex-direction: row;
  }

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

  .side-panel {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .initial-card {
    grid-column: 1 / -1;
  }

  .map-container {
    min-height: 390px;
  }
}

@media (max-width: 760px) {
  .topbar {
    min-height: 64px;
  }

  .topbar-actions {
    gap: 12px;
  }

  .help-link {
    display: none;
  }

  .page-content {
    padding-top: 36px;
  }

  .intro {
    align-items: stretch;
    flex-direction: column;
  }

  .import-actions {
    flex-direction: row;
  }

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

  .side-panel {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .initial-card {
    grid-column: 1 / -1;
  }
}

@media (max-width: 520px) {
  .topbar {
    padding-right: 12px;
    padding-left: 12px;
  }

  .topbar-actions {
    gap: 8px;
  }

  .brand {
    max-width: 170px;
    font-size: 12px;
  }

  .brand-mark {
    flex: 0 0 32px;
  }

  .import-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .map-container {
    min-height: 310px;
    padding: 8px;
  }

  .map-toolbar {
    padding-right: 12px;
    padding-left: 12px;
  }

  .mode-button {
    padding-right: 7px;
    padding-left: 7px;
    font-size: 10px;
  }

  .side-panel {
    grid-template-columns: 1fr;
  }

  .initial-card {
    grid-column: auto;
  }
}
