@import url("https://fonts.googleapis.com/css2?family=IBM+Plex+Sans:wght@400;600;700;800&display=swap");

.uxl-root {
  --uxl-border: #8c959f;
  --uxl-text: #24292f;
  --uxl-muted: #57606a;
  --uxl-bg: #ffffff;
  --uxl-panel: #f6f8fa;
  --uxl-accent: #0969da;
  --uxl-error: #cf222e;
  --uxl-hint: #d00000;

  color: var(--uxl-text);
  font: 14px/1.4 "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  overflow-x: hidden;
}

.uxl-toolbar {
  display: inline-flex;
  gap: 8px;
  margin: 0 0 10px;
  align-items: center;
}

/* Prototype preview block: increase vertical spacing (x3) */
.uxl-proto-preview {
  margin: 30px 0;
}

.uxl-toolbar__btn {
  padding: 6px 10px;
  border: 1px solid var(--uxl-border);
  background: var(--uxl-bg);
  cursor: pointer;
}

.uxl-toolbar__btn:hover {
  border-color: color-mix(in srgb, var(--uxl-accent) 40%, var(--uxl-border));
}

.uxl-toolbar__btn--active,
.uxl-toolbar__btn[aria-pressed="true"] {
  border-color: var(--uxl-accent);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--uxl-accent) 25%, transparent);
}

.uxl-toolbar__ver {
  color: var(--uxl-muted);
  font: 12px/1.2 ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
}

.uxl-footer {
  margin-top: 14px;
}

.uxl-footer__ver {
  color: var(--uxl-muted);
  font: 12px/1.2 ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
}

.uxl-proto-root {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 8px;
}

.uxl-proto-root--fullscreen {
  padding: 0;
  position: fixed;
  inset: 0;
  display: flex;
  align-items: flex-start;
  justify-content: flex-start;
}

.uxl-proto-root--fullscreen .uxl-canvas {
  border: 0;
  border-radius: 0;
  background: transparent;
}

.uxl-proto-frame {
  position: relative;
  width: fit-content;
}

.uxl-proto-root--fullscreen .uxl-proto-frame {
  width: 100%;
  height: 100%;
}

.uxl-proto-back {
  position: absolute;
  top: -42px;
  left: 0;
  padding: 6px 0;
  border: 0;
  background: transparent;
  cursor: pointer;
  color: var(--uxl-muted);
  font: inherit;
  text-decoration: none;
}

.uxl-proto-back:disabled {
  opacity: 0.5;
  cursor: default;
}

.uxl-root * {
  box-sizing: border-box;
  border-radius: 0;
}

.uxl-title {
  font-weight: 700;
  margin: 0 0 10px;
}

.uxl-error {
  border: 1px solid color-mix(in srgb, var(--uxl-error) 50%, var(--uxl-border));
  background: color-mix(in srgb, var(--uxl-error) 6%, var(--uxl-bg));
  padding: 12px;
}

.uxl-error__head {
  font-weight: 700;
  margin-bottom: 6px;
}

.uxl-error__meta {
  color: var(--uxl-muted);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
  white-space: pre-wrap;
}

.uxl-error__line {
  margin-top: 10px;
  padding: 8px 10px;
  border: 1px solid var(--uxl-border);
  background: var(--uxl-panel);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
  white-space: pre;
  overflow: auto;
}

.uxl-error__details {
  margin-top: 10px;
  padding: 8px 10px;
  border: 1px solid var(--uxl-border);
  background: color-mix(in srgb, var(--uxl-panel) 70%, #ffffff);
  color: var(--uxl-muted);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
  font-size: 12px;
  line-height: 16px;
  white-space: pre-wrap;
  overflow: auto;
  max-height: 240px;
}

/* Map */
.uxl-map {
  position: relative;
  margin-bottom: 42px;
  max-width: 100%;
}

.uxl-map-wrap {
  max-width: 100%;
  overflow: hidden;
}

.uxl-map-scale {
  width: fit-content;
  display: inline-block;
}

.uxl-map__title {
  font-weight: 800;
  font-size: 19px;
  line-height: 1.2;
  margin: 0 0 10px;
}

.uxl-map__grid {
  position: relative;
  z-index: 1;
}

.uxl-map__page {
  background: #e2e2e2;
  border: 1px solid var(--uxl-border);
  border-radius: 8px;
  padding: 10px;
  min-height: 48px;
  min-width: 160px;
  width: fit-content;
  position: absolute;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  font-weight: 600;
  white-space: normal;
  max-width: 320px;
}

.uxl-overlay {
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
}

.uxl-overlay path {
  stroke: var(--uxl-muted);
  stroke-width: 2;
  fill: none;
}

.uxl-overlay circle {
  stroke: var(--uxl-muted);
  stroke-width: 2;
  fill: none;
}

/* Map overlay: thinner + arrows (uses currentColor for stroke/arrow fill) */
.uxl-overlay--map {
  color: var(--uxl-muted);
  z-index: 2;
}
.uxl-overlay--map path,
.uxl-overlay--map circle {
  stroke: currentColor;
}
.uxl-overlay--map path {
  stroke-width: 1;
}

/* Hint callouts: dark red, thin */
.uxl-overlay--hints {
  color: var(--uxl-hint);
}
.uxl-overlay--hints path,
.uxl-overlay--hints circle {
  stroke: currentColor;
  stroke-width: 0.75;
  stroke-dasharray: 4 3;
}
.uxl-overlay--hints circle {
  fill: currentColor;
}

/* Pages */
.uxl-pages {
  display: grid;
  gap: 18px;
}

.uxl-page {
  padding-bottom: 6px;
}

.uxl-page__head {
  padding: 8px 0 14px;
  font-weight: 800;
  font-size: 19px;
  line-height: 1.2;
  display: flex;
  align-items: center;
  gap: 10px;
}

.uxl-page__head-title {
  min-width: 0;
}

.uxl-page__link {
  border: 0;
  background: transparent;
  padding: 0;
  cursor: pointer;
  color: var(--uxl-muted);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
}
.uxl-page__link:hover {
  color: var(--uxl-text);
}
.uxl-page__link-ico {
  width: 24px;
  height: 24px;
}

@keyframes uxl-goto-title {
  0% { color: inherit; }
  15% { color: var(--uxl-hint); }
  85% { color: var(--uxl-hint); }
  100% { color: inherit; }
}

@keyframes uxl-goto-canvas {
  0% { border-color: var(--uxl-border); box-shadow: none; }
  15% { border-color: var(--uxl-hint); box-shadow: 0 0 0 2px color-mix(in srgb, var(--uxl-hint) 35%, transparent); }
  85% { border-color: var(--uxl-hint); box-shadow: 0 0 0 2px color-mix(in srgb, var(--uxl-hint) 35%, transparent); }
  100% { border-color: var(--uxl-border); box-shadow: none; }
}

.uxl-map--goto .uxl-map__grid {
  animation: uxl-goto-canvas 2.2s ease-out;
}

.uxl-page--goto .uxl-page__head {
  /* Title: color only (no border/outline) */
  animation: uxl-goto-title 2.2s ease-out;
}

.uxl-page--goto .uxl-canvas {
  /* Canvas: border highlight */
  animation: uxl-goto-canvas 2.2s ease-out;
}

.uxl-page__body {
  display: grid;
  /* Keep hints close to the canvas: do not stretch the left column to full width */
  grid-template-columns: max-content minmax(220px, 320px);
  gap: 10px;
  position: relative;
}

.uxl-canvas-wrap {
  overflow: auto;
  width: fit-content;
  max-width: 100%;
}

.uxl-canvas-scale {
  width: fit-content;
}

.uxl-canvas {
  position: relative;
  /* Window (canvas) */
  background: #e2e2e2;
  border: 1px solid var(--uxl-border);
  border-radius: 8px;
  overflow: auto; /* P scrolls by default; can be overridden to hidden/scroll by inline styles */
}

/* Mobile: fit page render to screen width (avoid horizontal scroll) */
@media (max-width: 900px) {
  .uxl-page__body {
    grid-template-columns: 1fr;
  }
  .uxl-overlay--hints {
    display: none;
  }
  .uxl-canvas-wrap {
    overflow: hidden;
    width: 100%;
    display: flex;
    justify-content: center;
  }
  /* Mobile: show only the page hint, hide element hints and any dots/badges */
  .uxl-hints__item:not(.uxl-hints__item--page) {
    display: none;
  }
  .uxl-hint-dot,
  .uxl-hint-badge,
  .uxl-hint-badges {
    display: none !important;
  }
}

.uxl-hints {
  padding: 0;
  background: transparent;
  min-height: 100px;
}

.uxl-hints__list {
  margin: 0;
  padding-left: 0;
  color: var(--uxl-hint);
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.uxl-hints__item {
  margin: 0;
  line-height: 1.3;
  display: flex;
  /* Align dot with the FIRST line of multi-line hint text */
  align-items: flex-start;
  gap: 8px;
  width: 100%;
  white-space: normal;
}

.uxl-hints__item--page {
  margin-bottom: 14px; /* extra gap between page hint and element hints */
}

.uxl-hints__item--page .uxl-hint-text {
  color: #000000;
}

.uxl-hint-dot {
  width: 5px;
  height: 5px;
  border: 1px solid var(--uxl-hint);
  border-radius: 50%;
  background: var(--uxl-hint);
  flex: 0 0 auto;
  /* Visually center the dot against the first text line (line-height: 1.3) */
  margin-top: 0.45em;
}

.uxl-hint-badge {
  display: none; /* enabled on mobile */
  width: 18px;
  height: 18px;
  border-radius: 999px;
  background: var(--uxl-hint);
  color: #ffffff;
  font: 12px/18px ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
  text-align: center;
  flex: 0 0 auto;
}

.uxl-hint-badges {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 50;
}

.uxl-hint-badge--on-element {
  position: absolute;
  transform: translate(0, -50%);
  box-shadow: 0 0 0 2px color-mix(in srgb, #000000 25%, transparent);
}

.uxl-hint-text {
  color: var(--uxl-hint);
}

/* Rendered elements */
.uxl-node {
  position: absolute;
}

/* Debug: element stroke (does NOT affect layout) */
.uxl-root.uxl-stroke-all .uxl-node {
  outline: 1px solid #00ff00;
  outline-offset: -1px;
}

.uxl-root.uxl-stroke-f .uxl-F {
  outline: 1px solid #00ff00;
  outline-offset: -1px;
}

.uxl-F {
  border: 0;
  background: transparent;
  /* F is a layout container only (invisible), but exists in DOM for crop/scroll behavior. */
}

.uxl-I {
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: 0;
  padding: 0;
}

.uxl-I--action {
  cursor: pointer;
}

.uxl-I__img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: var(--uxl-img-fit, none);
  object-position: center;
}

.uxl-I__icon {
  width: var(--uxl-icon-size, 24px);
  height: var(--uxl-icon-size, 24px);
  flex: 0 0 auto;
}

.uxl-I__broken {
  display: none;
  width: 100%;
  height: 100%;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  color: var(--uxl-muted);
  background: color-mix(in srgb, var(--uxl-panel) 85%, var(--uxl-border));
  border: 1px dashed var(--uxl-border);
  box-sizing: border-box;
}

.uxl-I--broken .uxl-I__img {
  display: none;
}

.uxl-I--broken .uxl-I__broken {
  display: flex;
}

.uxl-T {
  --uxl-table-cell-pad: 0px;
  border: 1px solid var(--uxl-border);
  background: var(--uxl-bg);
}

.uxl-C {
  padding: 0;
  color: var(--uxl-text);
  background: transparent;
  white-space: pre-wrap;
}

.uxl-B {
  padding: 0;
  border: 1px solid var(--uxl-border);
  background: var(--uxl-bg);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  white-space: normal;
}

.uxl-B:hover {
  border-color: color-mix(in srgb, var(--uxl-accent) 40%, var(--uxl-border));
}

.uxl-B__icon {
  width: var(--uxl-icon-size, 14px);
  height: var(--uxl-icon-size, 14px);
  flex: 0 0 auto;
}

.uxl-B__label {
  white-space: pre-wrap;
}

.uxl-S {
  padding: 2px;
  border: 1px solid var(--uxl-border);
  background: color-mix(in srgb, var(--uxl-panel) 92%, var(--uxl-border));
  cursor: pointer;
  display: flex;
  align-items: stretch;
  justify-content: stretch;
  gap: 2px;
  border-radius: 999px;
  overflow: hidden;
}

.uxl-S__seg {
  flex: 1 1 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  color: color-mix(in srgb, var(--uxl-text) 75%, var(--uxl-muted));
  background: transparent;
  user-select: none;
  min-width: 0;
}

.uxl-S__seg--active {
  background: #3a3a3a;
  color: #ffffff;
}

.uxl-S__icon {
  width: 14px;
  height: 14px;
  flex: 0 0 auto;
}

.uxl-S__text {
  font-size: 12px;
  line-height: 14px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.uxl-T table {
  width: 100%;
  height: 100%;
  border-collapse: collapse;
  table-layout: fixed;
  background: var(--uxl-bg);
}

.uxl-T th, .uxl-T td {
  border: 1px solid var(--uxl-border);
  padding: var(--uxl-table-cell-pad, 0px);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.uxl-T th {
  background: color-mix(in srgb, var(--uxl-panel) 88%, var(--uxl-border));
  color: var(--uxl-muted);
  font-weight: 500;
}


