/*
 * 경험스택 V2 · 방향 D 화면 (상단 바·사이드바 없이 화면 전체를 쓰는 지도 중심)
 * 기본 요소(.btn · .input · .badge · 토스트 · 대화상자)는 app.css를 그대로 쓴다.
 * 색: 강조는 brand 하나. 점선은 놓는 자리와 빈칸에만.
 * CSP(style-src 'self') 때문에 위치·크기 같은 동적 값은 JS의 CSSOM으로만 넣는다.
 */

/* ── 셸 ─────────────────────────────────────────────────────────────── */
body {
  display: flex;
  flex-direction: column;
  min-height: 100%;
}

.screen {
  position: relative;
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
  outline: none;
}

body[data-view='map'] .screen {
  overflow: hidden;
}

.banner-root {
  flex: none;
}

.boot-view,
.center-view {
  min-height: 100%;
  display: grid;
  place-items: center;
  padding: var(--sp-6);
}

.boot-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--sp-3);
  min-width: min(320px, 90vw);
}

.boot-title {
  font-family: var(--font-display);
  font-size: var(--fs-xl);
}

.btn-lg {
  min-height: 52px;
  padding: 0 28px;
  font-size: var(--fs-lg);
}

.btn-primary {
  box-shadow: var(--shadow-block);
}

.stack-xs {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.space-between {
  justify-content: space-between;
}

.push-right {
  margin-left: auto;
}

.spinner {
  flex: none;
  width: 16px;
  height: 16px;
  border-radius: var(--radius-full);
  border: 3px solid var(--sunken);
  border-top-color: var(--brand);
  animation: v2-spin 0.9s linear infinite;
}

@keyframes v2-spin {
  to {
    transform: rotate(360deg);
  }
}

/* ── 로고 메뉴 · 머리줄 ──────────────────────────────────────────────── */
.logo-menu {
  position: relative;
  flex: none;
}

.logo-btn {
  height: 48px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 10px 0 4px;
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--ink);
  cursor: pointer;
}

.logo-btn:hover {
  background: rgba(26, 29, 35, 0.04);
}

.logo-stacky {
  display: block;
  width: 28px;
  height: 35px;
}

.logo-word {
  font-family: var(--font-display);
  font-size: 22px;
  line-height: 30px;
  white-space: nowrap;
}

.logo-chevron {
  color: var(--muted);
  transition: transform 0.15s;
}

.logo-menu.is-open .logo-chevron {
  transform: rotate(180deg);
}

.logo-pop {
  position: absolute;
  left: 0;
  top: 58px;
  z-index: 60;
  width: min(300px, calc(100vw - 32px));
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-pop);
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.logo-pop-tip {
  position: absolute;
  left: 36px;
  top: -8px;
  width: 14px;
  height: 14px;
  background: var(--surface);
  border-left: 1px solid var(--border);
  border-top: 1px solid var(--border);
  transform: rotate(45deg);
}

.menu-item {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 56px;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  color: var(--ink);
  text-decoration: none;
}

.menu-item:hover,
.menu-item:focus-visible {
  background: var(--ground);
  text-decoration: none;
}

.menu-icon {
  flex: none;
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  background: var(--sunken);
  display: grid;
  place-items: center;
}

.menu-icon.is-accent {
  background: var(--brand-soft);
  color: var(--brand-text);
}

.menu-text {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.menu-title {
  font-size: 15px;
  font-weight: 600;
}

.menu-desc,
.menu-count {
  font-size: var(--fs-xs);
  color: var(--muted);
}

.menu-foot {
  margin: 6px 4px 0;
  padding: 10px 8px 4px;
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.menu-foot-text {
  font-size: var(--fs-xs);
  color: var(--muted);
}

.menu-foot-action {
  align-self: flex-start;
  font-size: var(--fs-xs);
}

.pill-btn {
  box-sizing: border-box;
  flex: none;
  height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 0 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
  background: var(--surface);
  color: var(--ink);
  text-decoration: none;
  font-size: var(--fs-sm);
  font-weight: 600;
  white-space: nowrap;
  box-shadow: var(--shadow-pop);
  cursor: pointer;
}

.pill-btn:hover {
  text-decoration: none;
  background: var(--ground);
}

.page {
  min-height: 100%;
  padding: 20px clamp(12px, 3vw, 32px) 48px;
}

.page-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.page-head-right {
  display: flex;
  gap: 8px;
  align-items: center;
  min-width: 0;
}

/* ── 경험지도 ───────────────────────────────────────────────────────── */
.map-view {
  position: absolute;
  inset: 0;
  overflow: hidden;
  background: var(--ground);
}

.map-stage {
  position: absolute;
  inset: 0;
}

.floatbar {
  position: absolute;
  top: 16px;
  left: 16px;
  right: 16px;
  z-index: 30;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 600px) minmax(0, 1fr);
  align-items: center;
  gap: 12px;
  pointer-events: none;
}

.floatbar > * {
  pointer-events: auto;
}

.fb-left {
  justify-self: start;
}

.fb-center {
  display: flex;
  gap: 10px;
  align-items: center;
  min-width: 0;
}

.fb-right {
  justify-self: end;
}

.searchbox {
  position: relative;
  flex: 1;
  min-width: 0;
  height: 48px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 8px 0 18px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
  box-shadow: var(--shadow-pop);
  color: var(--muted);
}

.searchbox:focus-within {
  border-color: var(--border-strong);
}

.search-input {
  flex: 1;
  min-width: 0;
  border: 0;
  background: transparent;
  font: inherit;
  font-size: 15px;
  color: var(--ink);
  outline: none;
}

.search-input::-webkit-search-cancel-button {
  cursor: pointer;
}

.searchbox-kbd {
  font: inherit;
  font-size: var(--fs-xs);
  background: var(--sunken);
  border-radius: var(--radius-full);
  padding: 4px 10px;
  color: var(--ink);
}

.search-pop {
  position: absolute;
  top: 56px;
  left: 0;
  right: 0;
  max-height: min(60vh, 440px);
  overflow: auto;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-pop);
  padding: 6px;
  z-index: 40;
}

.sr-item {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  column-gap: 10px;
  align-items: baseline;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  color: var(--ink);
  cursor: pointer;
}

.sr-item.is-active,
.sr-item:hover {
  background: var(--ground);
}

.sr-kind {
  font-size: var(--fs-tag);
  font-weight: 700;
  background: var(--sunken);
  border-radius: 6px;
  padding: 2px 8px;
}

.sr-title {
  font-size: var(--fs-sm);
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sr-sub {
  grid-column: 2;
  font-size: var(--fs-xs);
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sr-empty {
  padding: 14px;
  font-size: var(--fs-sm);
  color: var(--muted);
}

.plus-btn {
  flex: none;
  width: 48px;
  height: 48px;
  border: 0;
  border-radius: var(--radius-full);
  background: var(--brand);
  color: var(--on-brand);
  box-shadow: var(--shadow-block);
  display: grid;
  place-items: center;
  cursor: pointer;
}

.plus-btn:hover {
  filter: brightness(0.97);
}

.seg-toggle {
  display: inline-flex;
  padding: 4px;
  gap: 2px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
  box-shadow: var(--shadow-pop);
}

.seg-toggle-btn {
  height: 38px;
  padding: 0 16px;
  border: 0;
  border-radius: var(--radius-full);
  background: transparent;
  font: inherit;
  font-size: var(--fs-sm);
  font-weight: 600;
  color: var(--muted);
  cursor: pointer;
  white-space: nowrap;
}

.seg-toggle-btn[aria-pressed='true'] {
  background: var(--ink);
  color: var(--surface);
}

.map-legend {
  position: absolute;
  left: 16px;
  bottom: 16px;
  z-index: 10;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 14px;
  max-width: min(720px, calc(100% - 140px));
  padding: 10px 14px;
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  font-size: var(--fs-xs);
  color: var(--muted);
}

.lg-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.lg-mark {
  width: 10px;
  height: 10px;
  border-radius: var(--radius-full);
  background: var(--ink);
}

.lg-mark.is-ai {
  background: var(--surface);
  border: 2px solid var(--muted);
}

.lg-mark.is-plan {
  border-radius: 2px;
  background: var(--surface);
  border: 2px solid var(--muted);
}

.lg-mark.is-hub {
  width: 16px;
  height: 16px;
}

.lg-hint {
  color: var(--ink);
}

.map-zoom {
  position: absolute;
  right: 16px;
  bottom: 16px;
  z-index: 10;
  display: flex;
  flex-direction: column;
  gap: 6px;
  transition: right 0.2s;
}

.zoom-btn {
  width: 44px;
  height: 44px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  display: grid;
  place-items: center;
  color: var(--ink);
  cursor: pointer;
}

.zoom-btn:hover {
  background: var(--ground);
}

.upload-pill {
  position: absolute;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%);
  z-index: 25;
  display: flex;
  align-items: center;
  gap: 10px;
  max-width: calc(100% - 32px);
  padding: 10px 16px;
  background: var(--surface);
  border: 1px solid var(--brand);
  border-radius: var(--radius-full);
  box-shadow: var(--shadow-pop);
  font-size: var(--fs-sm);
}

.upload-pill-sub {
  color: var(--muted);
}

.drop-overlay {
  position: absolute;
  inset: 0;
  z-index: 80;
  display: grid;
  place-items: center;
  background: rgba(246, 247, 249, 0.82);
  border: 3px dashed var(--brand);
  border-radius: var(--radius-lg);
  margin: 8px;
  pointer-events: none;
}

.drop-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 28px 32px;
  background: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-pop);
  color: var(--brand-text);
  text-align: center;
}

.drop-card strong {
  font-family: var(--font-display);
  font-size: var(--fs-xl);
  font-weight: 400;
  color: var(--ink);
}

.drop-card span {
  font-size: var(--fs-sm);
  color: var(--muted);
}

/* 점 그래프 */
.dg-root {
  position: absolute;
  inset: 0;
  overflow: hidden;
  touch-action: none;
  cursor: grab;
  user-select: none;
}

.dg-root.is-panning {
  cursor: grabbing;
}

.dg-edges {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: visible;
  pointer-events: none;
}

.dg-edge {
  stroke: var(--border-strong);
  stroke-width: 1.2;
  opacity: 0.4;
  transition: opacity 0.15s;
}

.dg-edge.is-member {
  opacity: 0.22;
}

.dg-edge.is-inferred {
  stroke-dasharray: 4 4;
}

.dg-edge.is-hot {
  stroke: var(--brand);
  stroke-width: 2;
  opacity: 1;
}

.dg-edge.is-member.is-hot {
  stroke: var(--ink);
  opacity: 0.5;
}

.dg-edge.is-dim {
  opacity: 0.08;
}

.dg-dots {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.dg-dot {
  position: absolute;
  left: 0;
  top: 0;
  width: 44px;
  height: 44px;
  margin: -22px 0 0 -22px;
  border: 0;
  padding: 0;
  background: transparent;
  display: grid;
  place-items: center;
  cursor: pointer;
  pointer-events: auto;
  border-radius: var(--radius-full);
  transition: opacity 0.15s;
}

.dg-dot:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: -4px;
}

.dg-mark {
  display: block;
  width: 12px;
  height: 12px;
  border-radius: var(--radius-full);
  background: var(--ink);
  transition: width 0.15s, height 0.15s, box-shadow 0.15s, background-color 0.15s;
}

.dg-node.is-ai .dg-mark {
  background: var(--surface);
  border: 2px solid var(--muted);
}

.dg-node.is-plan .dg-mark {
  border-radius: 3px;
  background: var(--surface);
  border: 2px solid var(--muted);
}

.dg-hub .dg-mark {
  width: 24px;
  height: 24px;
  box-shadow: 0 0 0 4px var(--ground);
}

.dg-dot:hover .dg-mark {
  box-shadow: 0 0 0 6px var(--brand-soft);
}

.dg-dot.is-selected .dg-mark {
  width: 18px;
  height: 18px;
  background: var(--brand);
  border-color: var(--brand);
  box-shadow: 0 0 0 8px var(--brand-soft);
}

.dg-hub.is-selected .dg-mark {
  width: 30px;
  height: 30px;
}

.dg-dot.is-dim,
.dg-label.is-dim {
  opacity: 0.25;
}

.dg-dot.is-flash .dg-mark {
  animation: dg-flash 1.2s ease-out 3;
}

@keyframes dg-flash {
  0% {
    box-shadow: 0 0 0 0 rgba(227, 126, 90, 0.7);
  }
  100% {
    box-shadow: 0 0 0 16px rgba(227, 126, 90, 0);
  }
}

.dg-label {
  position: absolute;
  left: 0;
  top: 0;
  width: 124px;
  margin: 12px 0 0 -62px;
  text-align: center;
  font-size: var(--fs-xs);
  line-height: 18px;
  color: var(--muted);
  pointer-events: none;
  text-shadow: 0 0 3px var(--ground), 0 0 3px var(--ground), 0 0 3px var(--ground);
  transition: opacity 0.15s;
}

.dg-label.is-strong,
.dg-label.is-flash {
  color: var(--ink);
  font-weight: 600;
}

.dg-hub-label {
  width: 180px;
  margin: 18px 0 0 -90px;
  font-size: 15px;
  line-height: 20px;
  font-weight: 700;
  color: var(--ink);
}

.dg-root.is-far .dg-label:not(.dg-hub-label):not(.is-strong):not(.is-flash) {
  display: none;
}

@media (prefers-reduced-motion: reduce) {
  .dg-dot.is-flash .dg-mark {
    animation: none;
    box-shadow: 0 0 0 8px var(--brand-soft);
  }
}

/* 오른쪽 패널 (좁으면 아래 시트) */
.side-panel {
  position: absolute;
  top: 84px;
  right: 16px;
  bottom: 16px;
  z-index: 20;
  width: min(440px, 40vw);
  overflow-y: auto;
  overscroll-behavior: contain;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-pop);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  outline: none;
}

.map-view.has-panel .map-zoom {
  right: calc(min(440px, 40vw) + 32px);
}

.sp-head {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.sp-handle {
  display: none;
  align-self: center;
  width: 40px;
  height: 4px;
  border-radius: var(--radius-full);
  background: var(--border);
}

.sp-head-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.sp-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
  min-width: 0;
}

.sp-badge {
  font-size: var(--fs-xs);
  font-weight: 700;
  background: var(--sunken);
  border-radius: 6px;
  padding: 2px 8px;
}

.sp-back {
  height: 28px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  font: inherit;
  font-size: var(--fs-xs);
  font-weight: 600;
  color: var(--brand-text);
  padding: 0 4px;
  cursor: pointer;
}

.sp-close {
  flex: none;
  width: 36px;
  height: 36px;
  border: 0;
  border-radius: var(--radius-sm);
  background: var(--sunken);
  display: grid;
  place-items: center;
  color: var(--ink);
  cursor: pointer;
}

.sp-title-block {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.sp-title {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: var(--fs-xl);
  line-height: 1.35;
}

.sp-meta {
  font-size: var(--fs-xs);
  color: var(--muted);
}

.sp-note {
  font-size: var(--fs-xs);
  color: var(--brand-text);
}

.sp-hint {
  font-size: var(--fs-xs);
  line-height: 18px;
  color: var(--muted);
  background: var(--sunken);
  border-radius: var(--radius-sm);
  padding: 8px 12px;
}

.sp-statement {
  font-size: 15px;
  line-height: 1.65;
}

.sp-section {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.sp-section-title {
  font-size: var(--fs-sm);
  font-weight: 700;
}

.sp-section-link {
  align-self: flex-start;
  border: 0;
  background: transparent;
  padding: 0;
  font: inherit;
  font-size: var(--fs-sm);
  font-weight: 700;
  color: var(--brand-text);
  cursor: pointer;
}

.sp-rows {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.sp-row,
.sp-file {
  display: flex;
  align-items: baseline;
  gap: 8px;
  width: 100%;
  border: 0;
  border-radius: var(--radius-sm);
  background: var(--ground);
  padding: 8px 12px;
  font: inherit;
  font-size: var(--fs-sm);
  line-height: 20px;
  text-align: left;
  color: var(--ink);
  cursor: pointer;
}

.sp-row:hover,
.sp-file:hover {
  background: var(--sunken);
}

.sp-row.is-current {
  background: var(--brand-soft);
}

.sp-row.is-unused {
  opacity: 0.6;
}

.sp-shape {
  flex: none;
  width: 8px;
  height: 8px;
  border-radius: var(--radius-full);
  background: var(--ink);
  align-self: center;
}

.sp-shape.is-ai {
  background: var(--surface);
  border: 2px solid var(--muted);
}

.sp-shape.is-plan {
  border-radius: 2px;
  background: var(--surface);
  border: 2px solid var(--muted);
}

.sp-row-type {
  flex: none;
  font-size: var(--fs-tag);
  font-weight: 700;
  color: var(--muted);
}

.sp-row-text {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.sp-row-src {
  font-size: var(--fs-tag);
  color: var(--muted);
}

.sp-row-go {
  flex: none;
  font-size: var(--fs-xs);
  color: var(--brand-text);
}

.sp-ext,
.list-ext {
  flex: none;
  font-size: var(--fs-tag);
  font-weight: 700;
}

.sp-quote {
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.sp-quote-src {
  font-size: var(--fs-xs);
  color: var(--muted);
}

.sp-quote-text {
  color: var(--muted);
  font-size: var(--fs-sm);
  line-height: 1.7;
  white-space: pre-wrap;
}

.quote-mark {
  background: var(--brand-soft);
  color: var(--ink);
  border-radius: 4px;
  padding: 1px 2px;
}

.sp-foot {
  margin-top: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding-top: 4px;
}

.sp-foot-text {
  font-size: var(--fs-xs);
  line-height: 18px;
  color: var(--muted);
}

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

.sp-actions > * {
  flex: 1;
}

.sp-edit {
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 14px;
}

.sp-form {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.sp-form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.sp-segs {
  display: flex;
  flex-direction: column;
  gap: 4px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 12px 14px;
}

.sp-seg {
  display: grid;
  grid-template-columns: 64px minmax(0, 1fr);
  gap: 8px;
  font-size: var(--fs-sm);
  line-height: 20px;
  padding: 4px 6px;
  border-radius: 6px;
}

.sp-seg.is-focus {
  background: var(--ground);
  outline: 2px solid var(--brand-soft);
}

.sp-seg-loc {
  font-size: var(--fs-tag);
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
}

.sp-seg-text {
  white-space: pre-wrap;
}

.sp-errors {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: var(--fs-xs);
  color: var(--danger);
}

.sp-loading {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* 목록으로 */
.map-list {
  position: absolute;
  inset: 0;
  overflow-y: auto;
  padding: 96px clamp(12px, 3vw, 32px) 40px;
}

.map-view.has-panel .map-list {
  padding-right: calc(min(440px, 40vw) + 32px);
}

.list-inner {
  max-width: 1100px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.list-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 4px 12px;
}

.list-title {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: var(--fs-2xl);
}

.list-meta,
.list-group-meta {
  font-size: var(--fs-xs);
  color: var(--muted);
}

.list-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.list-group-head {
  display: flex;
  align-items: baseline;
  gap: 8px;
  padding: 0 4px;
}

.list-group-title {
  font-size: var(--fs-md);
}

.list-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
}

.list-row + .list-row {
  border-top: 1px solid var(--border);
}

.list-row.is-open {
  background: var(--ground);
}

.list-row-btn {
  width: 100%;
  border: 0;
  background: transparent;
  padding: 12px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  font: inherit;
  color: var(--ink);
  text-align: left;
  cursor: pointer;
}

.list-ext {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-sm);
  background: var(--sunken);
  display: grid;
  place-items: center;
}

.list-text {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.list-name {
  font-size: 15px;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.list-sub,
.list-count {
  font-size: var(--fs-xs);
  color: var(--muted);
  white-space: nowrap;
}

.list-status {
  flex: none;
  font-size: var(--fs-xs);
  font-weight: 700;
  border-radius: 6px;
  padding: 2px 8px;
  background: var(--sunken);
}

.list-status.is-ok {
  color: var(--success);
  background: var(--success-soft);
}

.list-status.is-bad {
  color: var(--danger);
  background: var(--danger-soft);
}

.list-pieces {
  padding: 0 16px 12px 68px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.list-piece {
  border: 0;
  border-radius: 8px;
  background: transparent;
  padding: 6px 8px;
  font: inherit;
  font-size: var(--fs-sm);
  line-height: 20px;
  text-align: left;
  color: var(--ink);
  cursor: pointer;
}

.list-piece:hover {
  background: var(--surface);
}

.list-piece-sep {
  color: var(--muted);
}

.list-piece-go {
  color: var(--brand-text);
  font-size: var(--fs-xs);
}

/* 비어 있는 지도 */
.map-empty {
  position: absolute;
  inset: 0;
  overflow-y: auto;
  padding: 110px 24px 40px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 24px;
}

.empty-ghosts {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 10px;
  opacity: 0.7;
}

.ghost-slot {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 110px;
  height: 52px;
  border: 1.5px dashed var(--border-strong);
  border-radius: var(--radius-sm);
  font-size: var(--fs-sm);
  font-weight: 600;
  color: var(--muted);
}

.ghost-arrow {
  color: var(--border-strong);
  font-size: 18px;
}

.empty-center {
  max-width: 560px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  text-align: center;
}

.empty-h1 {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: clamp(26px, 3.4vw, 34px);
  line-height: 1.25;
}

.empty-p {
  color: var(--muted);
  line-height: 1.6;
}

.empty-drop {
  width: min(640px, 100%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  padding: 28px 24px;
  border: 2px dashed var(--border-strong);
  border-radius: var(--radius-lg);
  background: var(--surface);
  text-align: center;
}

.empty-drop-note {
  font-size: var(--fs-xs);
  line-height: 18px;
  color: var(--muted);
}

.empty-links {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px 20px;
}

/* ── 온보딩 ─────────────────────────────────────────────────────────── */
.onboard {
  width: 100%;
  max-width: 1280px;
  margin: 0 auto;
  padding: clamp(28px, 6vh, 64px) clamp(16px, 3vw, 32px) 40px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.ob-hero {
  display: flex;
  align-items: center;
  gap: 24px;
  flex-wrap: wrap;
}

.ob-hero-text {
  flex: 1;
  min-width: min(100%, 260px);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.ob-h1 {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: clamp(26px, 3.4vw, 34px);
  line-height: 1.25;
}

.ob-sub {
  color: var(--muted);
}

.ob-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 380px), 1fr));
  gap: 16px;
}

.ob-card {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 20px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
}

.ob-card.is-on {
  border-color: var(--brand);
  box-shadow: var(--shadow-card);
}

.ob-card-main {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  cursor: pointer;
}

.ob-icon,
.conn-icon,
.tile-icon {
  flex: none;
  width: 44px;
  height: 44px;
  border-radius: var(--radius-sm);
  background: var(--sunken);
  display: grid;
  place-items: center;
  color: var(--ink);
}

.ob-text {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.ob-title {
  font-size: 17px;
  line-height: 24px;
}

.ob-how {
  font-size: var(--fs-sm);
  line-height: 20px;
  color: var(--muted);
}

.ob-check {
  flex: none;
  width: 22px;
  height: 22px;
  margin: 2px 0 0;
  accent-color: var(--brand);
}

.ob-badge {
  align-self: flex-start;
  font-size: var(--fs-xs);
  font-weight: 600;
  background: var(--sunken);
  border-radius: var(--radius-full);
  padding: 4px 10px;
}

.ob-ai {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.ob-ai-hint {
  font-size: var(--fs-xs);
  color: var(--muted);
}

.chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.ob-chip {
  height: 36px;
  padding: 0 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
  background: var(--surface);
  font: inherit;
  font-size: var(--fs-sm);
  font-weight: 600;
  color: var(--ink);
  cursor: pointer;
}

.ob-chip.is-on {
  border-color: var(--brand);
  background: var(--brand-soft);
  color: var(--brand-text);
}

.ob-cta,
.ob-done {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  padding: 20px 24px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-card);
}

.ob-done {
  background: var(--brand-soft);
  border-color: transparent;
  box-shadow: none;
}

.ob-cta-text {
  flex: 1;
  min-width: min(100%, 260px);
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.ob-cta-text strong {
  font-size: var(--fs-lg);
}

.ob-cta-text span {
  font-size: var(--fs-sm);
  color: var(--muted);
}

.ob-later {
  font-size: 15px;
  padding: 12px 4px;
}

.ob-foot {
  font-size: var(--fs-xs);
  color: var(--muted);
}

.ob-progress {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.ob-progress-text {
  display: flex;
  justify-content: space-between;
  font-size: var(--fs-sm);
  font-weight: 600;
}

.ob-steps {
  margin: 0;
  padding: 0 20px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
}

.ob-step {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  padding: 20px 0;
}

.ob-step + .ob-step {
  border-top: 1px solid var(--border);
}

.ob-step-icon {
  flex: none;
  width: 32px;
  height: 32px;
  border-radius: var(--radius-full);
  display: grid;
  place-items: center;
  font-weight: 700;
  border: 1.5px dashed var(--border-strong);
}

.ob-step.is-done .ob-step-icon {
  border: 0;
  background: var(--success-soft);
  color: var(--success);
}

.ob-step.is-doing .ob-step-icon {
  border: 4px solid var(--sunken);
  border-top-color: var(--brand);
  border-right-color: var(--brand);
  animation: v2-spin 1.1s linear infinite;
}

.ob-step.is-skip .ob-step-icon,
.ob-step.is-fail .ob-step-icon {
  border-style: solid;
}

.ob-step-body {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.ob-step-title {
  font-size: 17px;
}

.ob-step-detail {
  font-size: var(--fs-sm);
  color: var(--muted);
}

.ob-step-state {
  flex: none;
  font-size: var(--fs-xs);
  font-weight: 600;
  padding-top: 4px;
  color: var(--muted);
}

.ob-step.is-done .ob-step-state {
  color: var(--success);
}

.ob-step.is-doing .ob-step-state,
.ob-step.is-fail .ob-step-state {
  color: var(--brand-text);
}

.ob-run-foot {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.connect-info {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--ground);
}

.copy-row {
  display: grid;
  grid-template-columns: 84px minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
}

.copy-label {
  font-size: var(--fs-xs);
  font-weight: 700;
}

.copy-value {
  font-family: var(--font-mono);
  font-size: var(--fs-xs);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 10px;
  overflow-x: auto;
  white-space: nowrap;
}

.connect-json summary {
  cursor: pointer;
  font-size: var(--fs-xs);
  font-weight: 600;
  color: var(--brand-text);
}

.connect-json .code-block {
  margin: 8px 0;
}

.connect-note {
  font-size: var(--fs-xs);
  line-height: 18px;
  color: var(--muted);
}

/* ── 결과물 만들기 ───────────────────────────────────────────────────── */
.made-menu {
  position: relative;
}

.made-short {
  display: none;
}

.made-pop {
  position: absolute;
  right: 0;
  top: 52px;
  z-index: 50;
  width: min(380px, calc(100vw - 24px));
  max-height: min(60vh, 460px);
  overflow: auto;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-pop);
  padding: 6px;
  display: flex;
  flex-direction: column;
}

.made-item {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  column-gap: 8px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  color: var(--ink);
  text-decoration: none;
}

.made-item:hover {
  background: var(--ground);
  text-decoration: none;
}

.made-item-kind {
  font-size: var(--fs-tag);
  font-weight: 700;
  background: var(--sunken);
  border-radius: 6px;
  padding: 2px 8px;
  align-self: start;
}

.made-item-title {
  font-size: var(--fs-sm);
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.made-item-date {
  grid-column: 2;
  font-size: var(--fs-tag);
  color: var(--muted);
}

.make-pick {
  max-width: 1200px;
  margin: clamp(32px, 12vh, 120px) auto 0;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.make-pick.is-compact {
  margin-top: clamp(16px, 4vh, 40px);
}

.make-intro {
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: center;
  text-align: center;
}

.make-h1 {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: clamp(28px, 4vw, 40px);
  line-height: 1.25;
}

.make-sub {
  color: var(--muted);
}

.make-tiles {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 200px), 1fr));
  gap: 12px;
}

.make-tile {
  position: relative;
  min-height: 150px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
  padding: 18px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface);
  font: inherit;
  color: var(--ink);
  text-align: left;
  cursor: pointer;
}

.make-tile:hover {
  border-color: var(--border-strong);
}

.make-tile.is-on {
  border-color: var(--brand);
  background: var(--brand-soft);
}

.make-pick.is-compact .make-tile {
  min-height: 64px;
  flex-direction: row;
  align-items: center;
  padding: 10px 14px;
}

.make-pick.is-compact .tile-desc,
.make-pick.is-compact .tile-tag {
  display: none;
}

.make-pick.is-compact .tile-icon {
  width: 36px;
  height: 36px;
}

.tile-title {
  font-size: var(--fs-lg);
  font-weight: 700;
}

.tile-desc {
  font-size: var(--fs-sm);
  line-height: 20px;
  color: var(--muted);
}

.tile-tag {
  font-size: var(--fs-tag);
  font-weight: 700;
  color: var(--brand-text);
  background: var(--brand-soft);
  border-radius: var(--radius-full);
  padding: 2px 10px;
}

.tile-icon.is-soft {
  background: var(--surface);
  color: var(--brand-text);
}

.request-bar {
  width: 100%;
  min-height: 64px;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 18px;
  border: 1px solid transparent;
  border-radius: var(--radius-md);
  background: var(--brand-soft);
  font: inherit;
  color: var(--ink);
  text-align: left;
  cursor: pointer;
}

.request-bar.is-on {
  border-color: var(--brand);
}

.request-text {
  flex: 1;
  display: flex;
  flex-direction: column;
}

.request-text span {
  font-size: var(--fs-sm);
  color: var(--muted);
}

.make-pick.is-compact .request-bar {
  min-height: 52px;
}

.make-pick.is-compact .request-text span {
  display: none;
}

.make-panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: clamp(18px, 3vw, 28px);
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.make-panel-head {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.make-panel-title {
  font-size: var(--fs-lg);
}

.make-panel-sub,
.choice-note {
  font-size: var(--fs-sm);
  color: var(--muted);
}

.choice-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 320px), 1fr));
  gap: 12px;
}

.choice-card {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 18px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
}

.choice-card.is-disabled {
  background: var(--ground);
  border-style: dashed;
}

.choice-head {
  display: flex;
  align-items: center;
  gap: 8px;
}

.soon-tag {
  font-size: var(--fs-tag);
  font-weight: 700;
  background: var(--sunken);
  border-radius: var(--radius-full);
  padding: 2px 8px;
  color: var(--muted);
}

.choice-desc {
  font-size: var(--fs-sm);
  line-height: 20px;
  color: var(--muted);
}

.field-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 200px), 1fr));
  gap: 10px 14px;
}

.q-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.q-row {
  display: grid;
  grid-template-columns: 64px minmax(0, 1fr) 110px 40px;
  gap: 8px;
  align-items: start;
}

.q-num {
  padding-top: 10px;
  font-size: var(--fs-sm);
  font-weight: 700;
}

.q-limit-wrap {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: var(--fs-sm);
}

.add-q {
  align-self: flex-start;
}

.slot-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 300px), 1fr));
  gap: 12px;
}

.slot {
  margin: 0;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.slot-title {
  font-size: var(--fs-sm);
  font-weight: 700;
}

.slot-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.slot-item {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
  padding: 6px 8px;
  border-radius: 8px;
  font-size: var(--fs-sm);
  cursor: pointer;
}

.slot-item:hover {
  background: var(--ground);
}

.slot-item input {
  accent-color: var(--brand);
}

.slot-empty {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 14px;
  border: 1.5px dashed var(--border-strong);
  border-radius: var(--radius-sm);
  font-size: var(--fs-sm);
  color: var(--muted);
}

.sent-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.sent-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  background: var(--ground);
  border-radius: var(--radius-sm);
}

.sent-text {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.busy-overlay {
  position: fixed;
  inset: 0;
  z-index: 90;
  display: grid;
  place-items: center;
  background: rgba(246, 247, 249, 0.8);
}

.busy-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 28px 32px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-pop);
  text-align: center;
}

/* 결과 화면 */
.write {
  max-width: 1600px;
  margin: 16px auto 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.back-link {
  align-self: flex-start;
  font-size: var(--fs-sm);
  font-weight: 600;
  color: var(--brand-text);
}

.write-layout {
  display: flex;
  gap: 20px;
  align-items: flex-start;
}

.doc-card {
  flex: 999 1 640px;
  min-width: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: clamp(20px, 3.5vw, 48px);
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.doc-head {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.doc-badge {
  align-self: flex-start;
  font-size: var(--fs-xs);
  font-weight: 700;
  background: var(--sunken);
  border-radius: 6px;
  padding: 2px 8px;
}

.doc-title {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: clamp(24px, 3vw, 32px);
  line-height: 1.3;
}

.doc-meta {
  font-size: var(--fs-xs);
  color: var(--muted);
}

.doc-tools {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.evid-toggle {
  margin-left: auto;
}

.evid-toggle.is-on {
  background: var(--ink);
  color: var(--surface);
}

.q-tabs {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  border-bottom: 1px solid var(--border);
  padding-bottom: 8px;
}

.q-tab {
  padding: 6px 14px;
  border-radius: var(--radius-full);
  font-size: var(--fs-sm);
  font-weight: 600;
  color: var(--muted);
  text-decoration: none;
  background: var(--ground);
}

.q-tab.is-on {
  background: var(--ink);
  color: var(--surface);
}

.doc-body {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.doc-hint {
  font-size: var(--fs-xs);
  line-height: 18px;
  color: var(--muted);
  border-top: 1px solid var(--border);
  padding-top: 12px;
}

.cite,
.cite-sample {
  text-decoration: underline;
  text-decoration-color: var(--brand);
  text-decoration-thickness: 2px;
  text-underline-offset: 4px;
  cursor: pointer;
  border-radius: 3px;
}

.cite:hover,
.cite.is-picked {
  background: var(--brand-soft);
}

.cite:focus-visible,
.gap:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}

.gap,
.gap-sample {
  display: inline-flex;
  align-items: center;
  padding: 0 8px;
  min-height: 26px;
  border: 1.5px dashed var(--border-strong);
  border-radius: 6px;
  font-size: var(--fs-sm);
  font-weight: 600;
  color: var(--muted);
  cursor: pointer;
  vertical-align: baseline;
}

.gap:hover,
.gap.is-picked {
  border-color: var(--brand);
  color: var(--brand-text);
  background: var(--brand-soft);
}

.gap-sample {
  min-height: 0;
  padding: 0 4px;
  font-size: inherit;
}

.warn-box {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 14px 16px;
  border-radius: var(--radius-md);
  background: var(--ground);
}

.warn-title {
  font-size: var(--fs-sm);
}

.warn-items {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.prose {
  max-width: 860px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.prose-q {
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  background: var(--ground);
  font-weight: 600;
}

.prose-p {
  font-size: 16px;
  line-height: 1.9;
}

.prose-li {
  line-height: 1.8;
}

.prose-h {
  font-size: var(--fs-lg);
}

.prose-h3 {
  font-size: var(--fs-md);
}

.prose-count {
  font-size: var(--fs-xs);
  color: var(--muted);
}

.qa {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.qa > .chip {
  align-self: flex-start;
}

.qa-card {
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.qa-q {
  display: flex;
  gap: 10px;
  align-items: baseline;
  font-size: var(--fs-lg);
}

.qa-num {
  flex: none;
  font-size: var(--fs-xs);
  font-weight: 700;
  color: var(--brand-text);
}

.qa-sub {
  font-size: var(--fs-xs);
  font-weight: 700;
  color: var(--muted);
  margin-top: 4px;
}

.qa-points,
.qa-follow {
  display: flex;
  flex-direction: column;
  gap: 6px;
  line-height: 1.75;
}

.qa-points li::before,
.qa-follow li::before {
  content: '• ';
  color: var(--muted);
}

.qa-follow {
  color: var(--muted);
}

/* 표: <table> 대신 CSS 그리드 */
.sheet,
.resume {
  display: flex;
  flex-direction: column;
  gap: 28px;
}

.sheet-sec {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.sheet-head {
  display: flex;
  align-items: baseline;
  gap: 10px;
  flex-wrap: wrap;
}

.sheet-title {
  font-size: var(--fs-lg);
}

.sheet-sub,
.sheet-note {
  font-size: var(--fs-xs);
  color: var(--muted);
}

.tbl-scroll {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
}

.tbl {
  display: grid;
  min-width: 640px;
}

.tbl-acts {
  grid-template-columns: 150px minmax(0, 1fr) minmax(0, 2.2fr);
}

.tbl-story {
  grid-template-columns: 210px repeat(4, minmax(0, 1fr));
  min-width: 860px;
}

.tbl-career {
  grid-template-columns: minmax(0, 1.2fr) 150px minmax(0, 2.4fr);
}

.tbl-acts5 {
  grid-template-columns: 180px minmax(0, 1fr) minmax(0, 0.8fr) 140px minmax(0, 2.2fr);
  min-width: 900px;
}

.tbl-row {
  display: contents;
}

.tbl-cell {
  padding: 12px 14px;
  border-top: 1px solid var(--border);
  font-size: var(--fs-sm);
  line-height: 1.7;
  min-width: 0;
  word-break: keep-all;
}

.tbl-head .tbl-cell {
  border-top: 0;
  background: var(--ground);
  font-size: var(--fs-xs);
  font-weight: 700;
  color: var(--muted);
}

.cell-p + .cell-p {
  margin-top: 6px;
}

.cell-sub {
  display: block;
  margin-top: 4px;
}

.cell-sel {
  display: block;
  margin-top: 8px;
}

.story-item {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.story-n {
  flex: none;
  width: 22px;
  height: 22px;
  border-radius: var(--radius-full);
  background: var(--ink);
  color: var(--surface);
  display: grid;
  place-items: center;
  font-size: var(--fs-tag);
  font-weight: 700;
}

.story-title {
  font-weight: 600;
}

.story-state {
  font-size: var(--fs-tag);
  font-weight: 700;
  border-radius: 6px;
  padding: 1px 8px;
}

.story-state.is-ok {
  color: var(--success);
  background: var(--success-soft);
}

.story-state.is-gap {
  color: var(--muted);
  border: 1.5px dashed var(--border-strong);
}

.extra-row {
  padding: 10px 0;
  border-top: 1px solid var(--border);
}

.res-sec {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.res-h {
  font-size: var(--fs-lg);
  padding-bottom: 6px;
  border-bottom: 2px solid var(--ink);
}

.res-profile {
  display: flex;
  gap: 20px;
  align-items: flex-start;
  flex-wrap: wrap;
}

.res-photo {
  flex: none;
  width: 96px;
  height: 128px;
  border: 1.5px dashed var(--border-strong);
  border-radius: var(--radius-sm);
  display: grid;
  place-items: center;
  font-size: var(--fs-sm);
  color: var(--muted);
}

.res-facts {
  flex: 1;
  min-width: min(100%, 280px);
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr));
  gap: 10px 20px;
}

.res-fact {
  display: flex;
  gap: 12px;
  align-items: baseline;
}

.res-fact dt {
  flex: none;
  width: 64px;
  font-size: var(--fs-xs);
  font-weight: 700;
  color: var(--muted);
}

.res-fact dd {
  font-size: 15px;
}

.res-line {
  line-height: 1.8;
}

.res-empty {
  font-size: var(--fs-sm);
  color: var(--muted);
  padding: 14px;
  border: 1.5px dashed var(--border-strong);
  border-radius: var(--radius-sm);
}

.doc-edit {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.doc-editor {
  min-height: 420px;
  font-family: var(--font-mono);
  font-size: var(--fs-sm);
  line-height: 1.7;
}

/* 근거 · 빈칸 패널 */
.ev-panel {
  flex: 1 1 360px;
  max-width: 440px;
  min-width: 0;
  position: sticky;
  top: 16px;
  max-height: calc(100vh - 32px);
  overflow-y: auto;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-pop);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  outline: none;
}

.ev-head {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.ev-head-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.ev-title {
  font-size: var(--fs-md);
}

.ev-used {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  background: var(--brand-soft);
  font-size: var(--fs-sm);
  line-height: 1.7;
}

.gap-form {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.gap-label,
.gap-mini {
  align-self: flex-start;
  font-size: var(--fs-tag);
  font-weight: 700;
  color: var(--muted);
  border: 1.5px dashed var(--border-strong);
  border-radius: 6px;
  padding: 1px 8px;
}

/* ── 설정 ───────────────────────────────────────────────────────────── */
.set-wrap {
  max-width: 1200px;
  margin: clamp(20px, 4vh, 40px) auto 0;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.set-h1 {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: clamp(28px, 3.5vw, 36px);
  line-height: 1.25;
}

.set-layout {
  display: flex;
  gap: 32px;
  align-items: flex-start;
}

.set-nav {
  flex: none;
  width: 220px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  position: sticky;
  top: 24px;
}

.set-tab {
  display: flex;
  align-items: center;
  gap: 10px;
  height: 44px;
  padding: 0 14px;
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  font: inherit;
  font-size: 15px;
  font-weight: 600;
  color: var(--ink);
  text-align: left;
  white-space: nowrap;
  cursor: pointer;
}

.set-tab:hover {
  background: var(--sunken);
}

.set-tab.is-on {
  background: var(--brand-soft);
  color: var(--brand-text);
}

.set-panel {
  flex: 1 1 560px;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.set-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: clamp(18px, 3vw, 28px);
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.set-card-head {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.set-card-title {
  font-size: var(--fs-lg);
}

.set-card-sub {
  font-size: var(--fs-xs);
  line-height: 18px;
  color: var(--muted);
}

.field-grid-auto {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 240px), 1fr));
  gap: 12px 16px;
}

.key-box {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 0 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--sunken);
  font-family: var(--font-mono);
  font-size: var(--fs-sm);
  word-break: break-all;
}

.conn-list {
  display: flex;
  flex-direction: column;
}

.conn-row {
  border-top: 1px solid var(--border);
}

.conn-head {
  width: 100%;
  min-height: 72px;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 0;
  border: 0;
  background: transparent;
  font: inherit;
  color: var(--ink);
  text-align: left;
  cursor: pointer;
}

.conn-text {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.conn-name-line {
  display: flex;
  align-items: baseline;
  gap: 4px 8px;
  flex-wrap: wrap;
}

.conn-name {
  font-size: var(--fs-md);
  font-weight: 600;
}

.conn-status {
  font-size: var(--fs-xs);
  font-weight: 600;
}

.conn-status.is-ok {
  color: var(--success);
}

.conn-status.is-muted {
  color: var(--muted);
}

.conn-summary {
  font-size: var(--fs-xs);
  line-height: 18px;
  color: var(--muted);
}

.conn-chev {
  flex: none;
  color: var(--muted);
  transition: transform 0.15s;
}

.conn-row.is-open .conn-chev {
  transform: rotate(180deg);
}

.conn-body {
  padding: 0 0 18px 58px;
}

.conn-facts {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 180px), 1fr));
  gap: 12px 16px;
}

.conn-fact {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.conn-fact-k {
  font-size: var(--fs-tag);
  font-weight: 600;
  color: var(--muted);
}

.conn-fact-v {
  font-size: var(--fs-sm);
  overflow-wrap: anywhere;
}

.conn-note,
.conn-foot {
  font-size: var(--fs-xs);
  line-height: 18px;
  color: var(--muted);
}

.conn-foot {
  border-top: 1px solid var(--border);
  padding-top: 12px;
}

.switch-box {
  display: flex;
  flex-direction: column;
  background: var(--ground);
  border-radius: var(--radius-sm);
  padding: 4px 14px;
}

.switch-box-title {
  font-size: var(--fs-tag);
  font-weight: 600;
  color: var(--muted);
  padding-top: 10px;
}

.switch-box-note {
  font-size: var(--fs-tag);
  color: var(--muted);
  padding: 4px 0 10px;
}

.switch-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 0;
}

.switch-row + .switch-row {
  border-top: 1px solid var(--border);
}

.switch-text {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.switch-label {
  font-size: var(--fs-sm);
  font-weight: 600;
}

.switch-desc {
  font-size: var(--fs-xs);
  line-height: 18px;
  color: var(--muted);
}

.switch {
  flex: none;
  width: 48px;
  height: 28px;
  border: 0;
  border-radius: var(--radius-full);
  padding: 3px;
  display: flex;
  justify-content: flex-start;
  background: var(--border-strong);
  cursor: pointer;
}

.switch.is-on {
  justify-content: flex-end;
  background: var(--brand);
}

.switch:disabled {
  cursor: default;
  opacity: 0.75;
}

.switch-knob {
  display: block;
  width: 22px;
  height: 22px;
  border-radius: var(--radius-full);
  background: var(--surface);
  box-shadow: 0 1px 2px rgba(26, 29, 35, 0.24);
}

.issued {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.issued-item {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.add-ai {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
}

.revoked summary {
  cursor: pointer;
  font-size: var(--fs-xs);
  color: var(--muted);
}

.engine-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 260px), 1fr));
  gap: 12px;
}

.engine-card {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface);
  font: inherit;
  color: var(--ink);
  text-align: left;
  cursor: pointer;
}

.engine-card.is-on {
  border-color: var(--brand);
  background: var(--brand-soft);
}

.engine-name {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: var(--fs-md);
}

.engine-dot {
  flex: none;
  width: 18px;
  height: 18px;
  border-radius: var(--radius-full);
  border: 2px solid var(--border-strong);
  background: var(--surface);
}

.engine-card.is-on .engine-dot {
  border: 6px solid var(--brand);
}

.engine-how {
  font-size: var(--fs-sm);
  line-height: 20px;
  color: var(--muted);
}

.pass-box {
  display: flex;
  align-items: flex-end;
  gap: 16px;
  flex-wrap: wrap;
  border-top: 1px solid var(--border);
  padding-top: 16px;
}

.pass-main {
  flex: 1;
  min-width: 220px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.pass-label {
  font-size: var(--fs-sm);
  font-weight: 600;
  color: var(--muted);
}

.pass-value {
  font-family: var(--font-display);
  font-size: 32px;
  line-height: 40px;
  color: var(--brand-text);
}

.pass-sub {
  font-size: var(--fs-xs);
  color: var(--muted);
}

.tip-box {
  background: var(--sunken);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  font-size: var(--fs-sm);
  line-height: 21px;
}

.privacy-note {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  background: var(--ground);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  font-size: var(--fs-sm);
  line-height: 20px;
}

.adv summary {
  cursor: pointer;
  font-size: var(--fs-sm);
  font-weight: 600;
  padding: 6px 0;
}

.adv[open] summary {
  margin-bottom: 10px;
}

.data-row {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  padding-top: 14px;
  border-top: 1px solid var(--border);
}

.set-card-head + .data-row {
  border-top: 0;
  padding-top: 0;
}

.data-text {
  flex: 1;
  min-width: min(100%, 240px);
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.data-text > span {
  font-size: var(--fs-xs);
  line-height: 18px;
  color: var(--muted);
}

.fail-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 2px 12px;
  align-items: center;
  padding: 8px 0;
}

.fail-name {
  font-size: var(--fs-sm);
  font-weight: 600;
}

.fail-why {
  grid-row: 2;
  font-size: var(--fs-xs);
  color: var(--danger);
}

.fail-item > .btn {
  grid-row: 1 / span 2;
  grid-column: 2;
}

.log-list {
  display: flex;
  flex-direction: column;
}

.log-row {
  display: flex;
  align-items: center;
  gap: 4px 12px;
  padding: 10px 0;
  border-top: 1px solid var(--border);
  font-size: var(--fs-sm);
  flex-wrap: wrap;
}

.log-when {
  width: 150px;
  color: var(--muted);
}

.log-who {
  width: 140px;
  font-weight: 600;
}

.log-what {
  flex: 1;
  min-width: 150px;
}

.log-state {
  font-size: var(--fs-xs);
  font-weight: 600;
}

.log-state.is-ok {
  color: var(--success);
}

.log-state.is-bad {
  color: var(--danger);
}

/* ── 좁은 화면 ──────────────────────────────────────────────────────── */
@media (max-width: 759px) {
  .floatbar {
    top: 10px;
    left: 10px;
    right: 10px;
    grid-template-columns: minmax(0, 1fr) auto;
    row-gap: 8px;
  }

  .fb-center {
    grid-column: 1 / -1;
    grid-row: 2;
  }

  .fb-right {
    grid-column: 2;
    grid-row: 1;
  }

  .searchbox-kbd {
    display: none;
  }

  .seg-toggle-btn {
    padding: 0 12px;
  }

  .map-legend {
    display: none;
  }

  .side-panel {
    top: auto;
    left: 0;
    right: 0;
    bottom: 0;
    width: auto;
    max-height: 60%;
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    border-bottom: 0;
    padding: 10px 16px 24px;
  }

  .sp-handle {
    display: block;
  }

  .map-view.has-panel .map-zoom {
    right: 16px;
    bottom: calc(60% + 12px);
  }

  .map-view.has-panel .map-list {
    padding-right: clamp(12px, 3vw, 32px);
    padding-bottom: 62vh;
  }

  .map-list,
  .map-empty {
    padding-top: 128px;
  }

  .list-pieces {
    padding-left: 16px;
  }

  .list-count {
    display: none;
  }

  /* 머리줄: 돌아가기는 ← 아이콘만 남겨 오른쪽 위에 한 줄로 */
  .back-btn {
    width: 44px;
    padding: 0;
  }

  .back-btn .pill-label {
    display: none;
  }

  .made-long {
    display: none;
  }

  .made-short {
    display: inline;
  }

  .made-btn {
    padding: 0 12px;
  }

  .logo-btn {
    gap: 6px;
    padding: 0 2px;
  }

  .q-row {
    grid-template-columns: minmax(0, 1fr) 110px 40px;
  }

  .q-num {
    grid-column: 1 / -1;
    padding-top: 0;
  }

  .write-layout {
    display: block;
  }

  .ev-panel {
    position: fixed;
    top: auto;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 40;
    max-width: none;
    max-height: 72vh;
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    padding: 10px 16px 24px;
  }

  .ev-panel .sp-handle {
    display: block;
  }

  .write.has-panel {
    padding-bottom: 60vh;
  }

  .evid-toggle {
    margin-left: 0;
  }

  .set-layout {
    flex-direction: column;
    gap: 12px;
  }

  .set-nav {
    position: static;
    width: auto;
    flex-direction: row;
    overflow-x: auto;
    margin: 0 calc(-1 * clamp(12px, 3vw, 32px));
    padding: 0 clamp(12px, 3vw, 32px) 4px;
  }

  .set-tab {
    flex: none;
  }

  .set-panel {
    flex: none;
    width: 100%;
  }

  .conn-body {
    padding-left: 0;
  }

  .copy-row {
    grid-template-columns: minmax(0, 1fr) auto;
  }

  .copy-label {
    grid-column: 1 / -1;
  }

  .log-when,
  .log-who {
    width: auto;
  }
}

/* ── 인쇄 · PDF: 결과물만 ───────────────────────────────────────────── */
@media print {
  body {
    display: block;
    height: auto;
    background: #fff;
  }

  .screen {
    overflow: visible;
  }

  .banner-root,
  .page-head,
  .back-link,
  .doc-tools,
  .doc-hint,
  .ev-panel,
  .q-tabs,
  .toast-root,
  .skip-link,
  .cell-sel {
    display: none !important;
  }

  .page {
    padding: 0;
  }

  .doc-card {
    border: 0;
    padding: 0;
  }

  .cite {
    text-decoration: none;
  }

  .gap {
    border-style: solid;
  }

  .tbl-scroll {
    overflow: visible;
  }
}
