/* Per-app explorer */

.explorer-page {
  background: #ece9e1;
}

.explorer-main {
  padding-block: 62px 90px;
}

.explorer-header {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 40px;
  margin-bottom: 32px;
}

.explorer-header h1 {
  margin-bottom: 14px;
  font-size: clamp(3.2rem, 6vw, 5.8rem);
}

.explorer-intro {
  max-width: 750px;
  margin: 0;
  color: var(--muted);
  font-size: 1.05rem;
}

.plan-picker,
.map-entity-picker {
  display: grid;
  min-width: 210px;
  gap: 6px;
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.plan-picker select,
.filter-row select,
.map-entity-picker select {
  min-height: 44px;
  padding: 0 35px 0 12px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--paper-raised);
  color: var(--ink);
  font-size: 0.8rem;
  font-weight: 650;
  letter-spacing: normal;
  text-transform: none;
}

.explorer-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 30px;
}

.newcomer-guide {
  display: grid;
  margin-bottom: 24px;
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--blue-soft);
  grid-template-columns: minmax(260px, 0.8fr) minmax(0, 1.2fr);
  gap: 32px;
}

.newcomer-guide h2 {
  margin-bottom: 10px;
  font-family: inherit;
  font-size: 1.25rem;
  font-weight: 750;
  letter-spacing: -0.015em;
}

.newcomer-guide p:last-child {
  margin: 0;
  color: var(--muted);
  font-size: 0.82rem;
}

.newcomer-guide ol {
  display: grid;
  margin: 0;
  padding: 0;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  list-style: none;
}

.newcomer-guide li {
  min-height: 94px;
  padding: 12px 16px;
  border-left: 1px solid rgb(66 110 126 / 28%);
}

.newcomer-guide li span,
.newcomer-guide li strong,
.newcomer-guide li small {
  display: block;
}

.newcomer-guide li span {
  margin-bottom: 8px;
  color: var(--blue);
  font-size: 0.62rem;
  font-weight: 850;
}

.newcomer-guide li strong {
  font-size: 0.82rem;
}

.newcomer-guide li small {
  margin-top: 3px;
  color: var(--muted);
  font-size: 0.7rem;
  line-height: 1.35;
}

.summary-chip {
  display: inline-flex;
  min-height: 34px;
  align-items: center;
  gap: 7px;
  padding: 6px 11px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgb(251 250 246 / 55%);
  color: var(--muted);
  font-size: 0.72rem;
}

.summary-chip strong {
  color: var(--ink);
  font-size: 0.8rem;
}

.explorer-tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 16px;
  padding: 5px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #dfddd6;
}

.explorer-tabs button {
  min-height: 44px;
  flex: 1;
  padding: 8px 14px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 750;
}

.explorer-tabs button[aria-selected="true"] {
  background: var(--paper-raised);
  box-shadow: 0 2px 10px rgb(23 35 31 / 8%);
  color: var(--ink);
}

.tab-panel {
  min-height: 720px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--paper-raised);
  box-shadow: 0 12px 38px rgb(23 35 31 / 7%);
  overflow: hidden;
}

.subject-workbench {
  display: grid;
  min-height: 760px;
  grid-template-columns: minmax(300px, 0.33fr) minmax(0, 0.67fr);
}

.subject-index {
  display: flex;
  min-height: 0;
  flex-direction: column;
  border-right: 1px solid var(--line);
  background: #e9e6de;
}

.filter-stack {
  display: grid;
  gap: 10px;
  padding: 20px;
  border-bottom: 1px solid var(--line);
}

.search-field {
  position: relative;
  display: block;
}

.search-field svg {
  position: absolute;
  top: 13px;
  left: 12px;
  width: 18px;
  height: 18px;
  fill: none;
  stroke: var(--muted);
  stroke-linecap: round;
  stroke-width: 1.8;
}

.search-field input {
  width: 100%;
  min-height: 44px;
  padding: 9px 12px 9px 38px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--paper-raised);
  font-size: 0.8rem;
}

.search-field input::placeholder {
  color: #8c958f;
}

.filter-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.filter-row select {
  width: 100%;
  min-height: 44px;
  font-size: 0.72rem;
}

.index-count {
  padding: 12px 20px;
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 750;
}

.subject-list {
  max-height: 644px;
  flex: 1;
  padding: 8px;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-color: var(--line-strong) transparent;
  scrollbar-width: thin;
}

.subject-list-empty {
  padding: 30px 16px;
  color: var(--muted);
  font-size: 0.82rem;
  text-align: center;
}

.subject-list-heading {
  position: sticky;
  z-index: 1;
  top: -8px;
  margin: 0;
  padding: 13px 10px 7px;
  background: #e9e6de;
  color: var(--muted);
  font-size: 0.62rem;
  font-weight: 850;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.subject-button {
  display: grid;
  width: 100%;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 10px;
  padding: 11px 10px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  text-align: left;
}

.subject-button:hover,
.subject-button[aria-current="true"] {
  background: var(--paper-raised);
}

.subject-button[aria-current="true"] {
  box-shadow: 0 4px 14px rgb(23 35 31 / 7%);
}

.subject-button-copy {
  min-width: 0;
}

.subject-button-copy strong,
.subject-button-copy small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.subject-button-copy strong {
  font-size: 0.76rem;
}

.subject-button-copy small {
  color: var(--muted);
  font-size: 0.64rem;
}

.subject-kind-short {
  color: var(--muted);
  font-size: 0.58rem;
  font-weight: 750;
  text-transform: uppercase;
}

.subject-detail {
  min-width: 0;
  padding: clamp(30px, 5vw, 62px);
}

.detail-breadcrumb {
  margin-bottom: 34px;
  color: var(--muted);
  font: 0.7rem/1.5 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  overflow-wrap: anywhere;
}

.detail-header {
  margin-bottom: 32px;
}

.detail-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 16px;
}

.kind-badge {
  background: var(--ink);
  color: white;
}

.choice-badge {
  background: #ece5f2;
  color: #675270;
}

.detail-header h2 {
  margin-bottom: 8px;
  font-size: clamp(2rem, 4vw, 3.5rem);
  overflow-wrap: anywhere;
}

.detail-id {
  color: var(--muted);
  font: 0.78rem/1.5 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

.detail-orientation {
  display: grid;
  margin-bottom: 18px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.detail-orientation section {
  min-height: 145px;
  padding: 20px;
  border-radius: 12px;
  background: var(--blue-soft);
}

.detail-orientation section:first-child {
  background: var(--green-soft);
}

.detail-orientation p {
  margin: 0;
  color: var(--ink);
  font-size: 0.88rem;
}

.rails-output-list {
  display: grid;
  margin: 12px 0 0;
  padding-left: 18px;
  color: var(--ink);
  font-size: 0.78rem;
  gap: 7px;
}

.detail-orientation code {
  padding: 0.08em 0.28em;
  border-radius: 4px;
  background: rgb(255 255 255 / 62%);
  font-size: 0.9em;
}

.detail-grid {
  display: grid;
  margin-bottom: 32px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.detail-card {
  min-height: 125px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 12px;
}

.detail-card-label {
  display: block;
  margin-bottom: 16px;
  color: var(--muted);
  font-size: 0.62rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.detail-card strong {
  display: block;
  font-size: 0.9rem;
  overflow-wrap: anywhere;
}

.realization-summary {
  margin: 0 0 10px;
  color: var(--ink);
  font-size: 0.82rem;
}

.reference-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.reference-list button {
  min-height: 32px;
  padding: 5px 8px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--paper);
  font: 0.65rem/1.4 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

.reference-list button:hover {
  border-color: var(--blue);
  color: var(--blue);
}

.detail-json-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 10px;
}

.detail-json-heading h3 {
  margin: 0;
  font-size: 0.75rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.detail-json-heading button {
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--blue);
  font-size: 0.7rem;
  font-weight: 750;
  text-decoration: underline;
  text-underline-offset: 4px;
}

.detail-json {
  max-height: 380px;
  margin-bottom: 30px;
}

.question-composer {
  padding: 22px;
  border: 1px solid #d7bca8;
  border-radius: 14px;
  background: #f5e7dc;
}

.question-composer h3 {
  margin-bottom: 6px;
}

.question-composer > p {
  margin-bottom: 14px;
  color: #725f54;
  font-size: 0.78rem;
}

.question-composer textarea {
  width: 100%;
  min-height: 94px;
  margin-bottom: 12px;
  padding: 12px;
  border: 1px solid #d7bca8;
  border-radius: 9px;
  background: var(--paper-raised);
  font-size: 0.82rem;
  line-height: 1.5;
  resize: vertical;
}

.question-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.map-toolbar,
.raw-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 30px;
  padding: 28px 30px;
  border-bottom: 1px solid var(--line);
}

.map-toolbar h2,
.raw-heading h2 {
  margin-bottom: 5px;
  font-family: inherit;
  font-size: 1.35rem;
  font-weight: 750;
  letter-spacing: -0.01em;
}

.map-toolbar p:last-child,
.raw-heading p {
  margin-bottom: 0;
  color: var(--muted);
  font-size: 0.78rem;
}

.map-controls,
.map-actions {
  display: flex;
  align-items: end;
  gap: 8px;
}

.map-controls {
  flex-wrap: wrap;
  justify-content: end;
}

.map-actions {
  flex-wrap: wrap;
}

.map-entity-picker {
  min-width: 170px;
  gap: 4px;
  font-size: 0.58rem;
}

.map-entity-picker select {
  min-height: 44px;
  padding: 0 32px 0 10px;
  border-radius: 8px;
  font-size: 0.7rem;
}

.map-zoom {
  min-width: 38px;
  padding-inline: 10px;
  font-size: 1rem;
}

.map-layout {
  display: grid;
  min-height: 640px;
  grid-template-columns: minmax(0, 1fr) 280px;
}

.relationship-map {
  position: relative;
  min-width: 0;
  min-height: 640px;
  background:
    linear-gradient(rgb(23 35 31 / 3%) 1px, transparent 1px),
    linear-gradient(90deg, rgb(23 35 31 / 3%) 1px, transparent 1px),
    #f4f2ec;
  background-size: 24px 24px;
  overflow: hidden;
  touch-action: none;
}

.entity-card {
  width: 310px;
  border: 1px solid #aebbb3;
  border-radius: 11px;
  background: var(--paper-raised);
  box-shadow: 0 9px 24px rgb(23 35 31 / 14%);
  overflow: hidden;
  pointer-events: none;
  transition: border-color 140ms ease, box-shadow 140ms ease, opacity 140ms ease;
  user-select: none;
}

.entity-card.selected {
  border-color: var(--coral);
  box-shadow: 0 0 0 3px rgb(215 95 67 / 22%), 0 12px 28px rgb(23 35 31 / 18%);
}

.entity-card.muted {
  opacity: 0.18;
}

.entity-card button {
  color: inherit;
  font: inherit;
}

.entity-card-header {
  display: flex;
  width: 100%;
  min-height: 64px;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 13px;
  border: 0;
  border-bottom: 1px solid #b9c5be;
  background: #dfeaed;
  text-align: left;
}

.entity-card-header:hover,
.entity-card-header.selected {
  background: #cfe0e4;
}

.entity-card-header strong,
.entity-card-header code {
  display: block;
}

.entity-card-header strong {
  margin-bottom: 2px;
  font-size: 0.9rem;
  line-height: 1.2;
}

.entity-card-header code {
  color: #526861;
  font-size: 0.59rem;
}

.entity-card-section + .entity-card-section {
  border-top: 1px solid var(--line);
}

.entity-card-section h4 {
  display: flex;
  min-height: 29px;
  align-items: center;
  justify-content: space-between;
  margin: 0;
  padding: 6px 11px;
  background: #edebe4;
  color: #65716b;
  font-size: 0.58rem;
  font-weight: 850;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.entity-card-section h4 span {
  font-variant-numeric: tabular-nums;
}

.entity-card-empty {
  margin: 0;
  padding: 10px 12px;
  color: #7d8882;
  font-size: 0.65rem;
  font-style: italic;
}

.semantic-row {
  position: relative;
  display: grid;
  width: 100%;
  min-height: 49px;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  padding: 7px 10px;
  border: 0;
  border-top: 1px solid #e5e5de;
  background: var(--paper-raised);
  text-align: left;
}

.entity-card-section h4 + .semantic-row {
  border-top: 0;
}

.semantic-row:hover,
.semantic-row.selected {
  background: #fff4ed;
}

.semantic-row.selected {
  box-shadow: inset 3px 0 var(--coral);
}

.reference-row {
  background: #f1f7f3;
}

.reference-row::after {
  position: absolute;
  top: 50%;
  right: -4px;
  width: 8px;
  height: 8px;
  border: 2px solid var(--paper-raised);
  border-radius: 50%;
  background: var(--green);
  content: "";
  transform: translateY(-50%);
}

.semantic-row-main,
.semantic-row-main strong,
.semantic-row-main small {
  display: block;
  min-width: 0;
}

.semantic-row-main strong {
  overflow: hidden;
  font-size: 0.7rem;
  line-height: 1.25;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.semantic-row-main small {
  margin-top: 2px;
  color: var(--muted);
  font-size: 0.56rem;
  line-height: 1.3;
}

.semantic-row-badges {
  display: flex;
  max-width: 118px;
  flex-wrap: wrap;
  justify-content: end;
  gap: 3px;
}

.erd-decision {
  display: inline-flex;
  min-height: 18px;
  align-items: center;
  padding: 2px 5px;
  border-radius: 999px;
  font-size: 0.49rem;
  font-weight: 800;
  line-height: 1.15;
}

.erd-decision {
  max-width: 100px;
  background: #ece5f2;
  color: #675270;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.map-inspector {
  padding: 24px;
  border-left: 1px solid var(--line);
  background: #e9e6de;
  overflow-wrap: anywhere;
}

.map-inspector h3 {
  margin: 10px 0 4px;
}

.map-inspector p {
  color: var(--muted);
  font-size: 0.78rem;
}

.map-inspector .button {
  width: 100%;
  margin-top: 14px;
}

.map-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 20px;
  padding: 14px 24px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.67rem;
}

.map-legend span {
  display: inline-flex;
  align-items: center;
  gap: 7px;
}

.legend-field,
.legend-reference {
  width: 10px;
  height: 10px;
  border-radius: 2px;
}

.legend-field {
  border: 1px solid var(--line-strong);
  background: var(--paper-raised);
}

.legend-reference {
  background: var(--green);
}

.map-gesture-hint {
  margin-left: auto;
}

.raw-location {
  max-width: 420px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  overflow-wrap: anywhere;
  text-align: right;
}

.raw-editor {
  height: 700px;
}

.raw-editor > .loading-message,
.raw-editor > .editor-error {
  padding: 30px;
}

.raw-editor .jse-main {
  border: 0;
}

.explorer-footer {
  width: var(--guide-content);
}

.visually-hidden {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  border: 0 !important;
  margin: -1px !important;
  clip: rect(0, 0, 0, 0) !important;
  overflow: hidden !important;
  white-space: nowrap !important;
}
