:root {
  color-scheme: light;
  --bg: #f4f6f9;
  --surface: #ffffff;
  --surface-subtle: #f8fafc;
  --surface-strong: #eef2f7;
  --text: #121826;
  --text-muted: #647084;
  --border: #dfe4eb;
  --border-strong: #cbd3de;
  --navy: #08245c;
  --blue: #1264e8;
  --blue-soft: #e9f1ff;
  --green: #13a368;
  --shadow: 0 10px 30px rgba(25, 35, 55, 0.08);
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 18px;
  font-family: Inter, Pretendard, "Noto Sans KR", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  background: var(--bg);
}

body {
  min-width: 760px;
  min-height: 100vh;
  margin: 0;
  color: var(--text);
  background: var(--bg);
}

button,
a {
  font: inherit;
}

button {
  color: inherit;
}

a {
  color: inherit;
  text-decoration: none;
}

svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
}

.icon-sprite {
  position: absolute;
  width: 0;
  height: 0;
  overflow: hidden;
}

.app-header {
  position: sticky;
  z-index: 30;
  top: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 68px;
  padding: 0 28px;
  color: #fff;
  background: #071a3a;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  color: #fff;
  background: var(--blue);
  border-radius: 9px;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.brand strong,
.brand small {
  display: block;
}

.brand strong {
  font-size: 14px;
  line-height: 1.3;
}

.brand small {
  margin-top: 2px;
  color: #91a4c4;
  font-size: 10px;
  letter-spacing: 0.05em;
}

.view-tabs {
  display: flex;
  align-self: stretch;
  gap: 6px;
}

.view-tab {
  position: relative;
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 0 14px;
  color: #9fafc9;
  font-size: 13px;
  font-weight: 650;
}

.view-tab::after {
  position: absolute;
  right: 14px;
  bottom: 0;
  left: 14px;
  height: 2px;
  background: #4a8cff;
  border-radius: 2px 2px 0 0;
  content: "";
  opacity: 0;
}

.view-tab:hover,
.view-tab.is-active {
  color: #fff;
}

.view-tab.is-active::after {
  opacity: 1;
}

main {
  width: 100%;
}

.gallery-view {
  max-width: 1480px;
  margin: 0 auto;
  padding: 52px 36px 72px;
}

.gallery-heading,
.compare-summary {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 28px;
}

.gallery-heading {
  margin-bottom: 34px;
}

.gallery-heading-actions {
  display: flex;
  align-items: center;
  gap: 18px;
  padding-bottom: 3px;
}

.heading-buttons {
  display: flex;
  align-items: center;
  gap: 8px;
}

.concept-guide-button {
  color: var(--text-muted);
  background: transparent;
}

.eyebrow {
  margin: 0 0 9px;
  color: var(--blue);
  font-size: 11px;
  font-weight: 750;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}

h1 {
  margin: 0;
  font-size: clamp(26px, 2.2vw, 36px);
  line-height: 1.2;
  letter-spacing: -0.035em;
}

.gallery-heading p:not(.eyebrow) {
  margin: 10px 0 0;
  color: var(--text-muted);
  font-size: 14px;
}

.result-count {
  display: flex;
  align-items: baseline;
  gap: 7px;
  min-width: max-content;
  padding-bottom: 4px;
  color: var(--text-muted);
  font-size: 12px;
}

.result-count strong {
  color: var(--text);
  font-size: 28px;
  line-height: 1;
}

.gallery-groups {
  display: grid;
  gap: 38px;
}

.gallery-group {
  padding-top: 22px;
  border-top: 1px solid var(--border-strong);
}

.gallery-group-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 16px;
}

.concept-identity {
  display: flex;
  align-items: center;
  gap: 12px;
}

.concept-key {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  color: var(--blue);
  background: var(--blue-soft);
  border: 1px solid #cfe0ff;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 800;
}

.concept-identity h2 {
  margin: 0;
  font-size: 16px;
  letter-spacing: -0.015em;
}

.concept-identity p {
  margin: 3px 0 0;
  color: var(--text-muted);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 10px;
}

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

.result-card {
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: 0 2px 9px rgba(31, 42, 65, 0.035);
  transition: border-color 150ms ease, box-shadow 150ms ease, transform 150ms ease;
}

.result-card:hover {
  border-color: #b9c7dc;
  box-shadow: var(--shadow);
  transform: translateY(-2px);
}

/* 썸네일은 hero + lifecycle 다이어그램까지 잘라 둔 1440x1620 이미지를 그대로 쓴다. */
.thumbnail-viewport {
  position: relative;
  display: block;
  aspect-ratio: 1440 / 1620;
  overflow: hidden;
  background: #e8edf4;
}

.thumbnail-viewport img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: top;
  transition: transform 300ms ease;
}

/* Hover 시 dim + 시안 식별자(A-claude 등) 노출 */
.thumbnail-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 20px;
  background: rgba(9, 20, 43, 0.74);
  opacity: 0;
  text-align: center;
  transition: opacity 180ms ease;
}

.result-card:hover .thumbnail-overlay,
.thumbnail-viewport:focus-visible .thumbnail-overlay {
  opacity: 1;
}

.result-card:hover .thumbnail-viewport img {
  transform: scale(1.015);
}

.overlay-key {
  color: #fff;
  font-size: 26px;
  font-weight: 700;
  letter-spacing: -0.01em;
  line-height: 1.15;
}

.overlay-name {
  color: rgba(255, 255, 255, 0.82);
  font-size: 13px;
}

.overlay-open {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 10px;
  padding: 7px 14px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.16);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.34);
  color: #fff;
  font-size: 12px;
  font-weight: 600;
}

.overlay-open svg {
  width: 13px;
  height: 13px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* 터치 기기에는 hover가 없으므로 식별자를 항상 보여준다. */
@media (hover: none) {
  .thumbnail-overlay {
    top: auto;
    padding: 26px 16px 12px;
    background: linear-gradient(to top, rgba(9, 20, 43, 0.78), transparent);
    opacity: 1;
  }

  .overlay-key {
    font-size: 18px;
  }

  .overlay-open {
    display: none;
  }
}

.tool-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 58px;
  height: 25px;
  padding: 0 9px;
  color: #344054;
  background: #f0f3f7;
  border: 1px solid #d9dfe8;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 750;
}

.tool-badge[data-tool="codex"] {
  color: #075c40;
  background: #e9f8f1;
  border-color: #c5eadb;
}

.button,
.icon-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  height: 34px;
  padding: 0 12px;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 12px;
  font-weight: 650;
  white-space: nowrap;
  transition: background 120ms ease, border-color 120ms ease, color 120ms ease;
}

.button:hover,
.icon-button:hover {
  color: var(--blue);
  background: var(--blue-soft);
  border-color: #b7d0ff;
}

.button-primary {
  color: #fff;
  background: var(--blue);
  border-color: var(--blue);
}

.button-primary:hover {
  color: #fff;
  background: #0757cc;
  border-color: #0757cc;
}

.button-secondary {
  background: var(--surface);
}

.button-quiet {
  height: 30px;
  padding: 0 9px;
  background: transparent;
  border-color: transparent;
  color: var(--text-muted);
  font-size: 11px;
}

.button-quiet:hover {
  background: var(--surface-strong);
  border-color: transparent;
}

.compare-view {
  min-height: calc(100vh - 68px);
}

.compare-controls {
  position: sticky;
  z-index: 25;
  top: 68px;
  display: flex;
  align-items: center;
  gap: 22px;
  min-height: 66px;
  padding: 10px 26px;
  background: rgba(255, 255, 255, 0.96);
  border-bottom: 1px solid var(--border);
  box-shadow: 0 5px 18px rgba(25, 35, 55, 0.035);
  backdrop-filter: blur(12px);
}

.control-block {
  display: flex;
  align-items: center;
  gap: 10px;
}

.control-label {
  color: var(--text-muted);
  font-size: 10px;
  font-weight: 750;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  white-space: nowrap;
}

.segmented {
  display: flex;
  gap: 2px;
  padding: 3px;
  background: #eef1f5;
  border-radius: 9px;
}

.segmented button {
  min-width: 52px;
  height: 29px;
  padding: 0 10px;
  background: transparent;
  border: 0;
  border-radius: 7px;
  cursor: pointer;
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 700;
}

.segmented button:hover {
  color: var(--text);
}

.segmented button.is-active {
  color: var(--text);
  background: #fff;
  box-shadow: 0 1px 4px rgba(30, 40, 60, 0.14);
}

.control-divider {
  width: 1px;
  height: 28px;
  background: var(--border);
}

.control-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
}

.toggle-control {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 34px;
  padding: 0 11px;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 11px;
  font-weight: 650;
}

.toggle-control strong {
  min-width: 18px;
  color: var(--blue);
  font-size: 10px;
}

.toggle-track {
  display: flex;
  align-items: center;
  width: 28px;
  height: 16px;
  padding: 2px;
  background: var(--blue);
  border-radius: 999px;
  transition: background 120ms ease;
}

.toggle-thumb {
  width: 12px;
  height: 12px;
  margin-left: 12px;
  background: #fff;
  border-radius: 50%;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.22);
  transition: margin 120ms ease;
}

.toggle-control[aria-checked="false"] .toggle-track {
  background: #aab3c0;
}

.toggle-control[aria-checked="false"] .toggle-thumb {
  margin-left: 0;
}

.toggle-control[aria-checked="false"] strong {
  color: var(--text-muted);
}

.compare-summary {
  padding: 22px 26px 17px;
}

.compare-summary h1 {
  font-size: 20px;
}

.compare-summary .eyebrow {
  margin-bottom: 6px;
}

.compare-note {
  margin: 0;
  color: var(--text-muted);
  font-size: 11px;
}

.compare-panels {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 12px;
  padding: 0 12px 16px;
}

.viewer-panel {
  min-width: 0;
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-md);
  box-shadow: 0 4px 12px rgba(25, 35, 55, 0.05);
}

.viewer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  height: 52px;
  padding: 0 11px 0 14px;
  border-bottom: 1px solid var(--border);
}

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

.viewer-identity strong,
.viewer-identity small {
  display: block;
}

.viewer-identity strong {
  overflow: hidden;
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.viewer-identity small {
  margin-top: 2px;
  color: var(--text-muted);
  font-size: 9px;
}

.viewer-actions {
  display: flex;
  align-items: center;
  gap: 2px;
}

.viewer-stage {
  position: relative;
  height: max(540px, calc(100vh - 294px));
  overflow: hidden;
  background-color: #e4e8ef;
  background-image:
    linear-gradient(45deg, rgba(255, 255, 255, 0.44) 25%, transparent 25%),
    linear-gradient(-45deg, rgba(255, 255, 255, 0.44) 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, rgba(255, 255, 255, 0.44) 75%),
    linear-gradient(-45deg, transparent 75%, rgba(255, 255, 255, 0.44) 75%);
  background-position: 0 0, 0 6px, 6px -6px, -6px 0;
  background-size: 12px 12px;
}

.viewer-canvas {
  position: absolute;
  top: 0;
  left: 0;
  transform-origin: top left;
}

.viewer-canvas iframe {
  display: block;
  background: #fff;
  border: 0;
}

.viewer-loading {
  position: absolute;
  top: 50%;
  left: 50%;
  padding: 8px 10px;
  color: var(--text-muted);
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 10px;
  transform: translate(-50%, -50%);
  transition: opacity 150ms ease;
}

.viewer-panel.is-loaded .viewer-loading {
  opacity: 0;
  pointer-events: none;
}

.viewer-footer {
  display: flex;
  align-items: center;
  height: 29px;
  padding: 0 13px;
  color: var(--text-muted);
  background: var(--surface-subtle);
  border-top: 1px solid var(--border);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 9px;
}

.status-dot {
  width: 6px;
  height: 6px;
  margin-right: 6px;
  background: var(--green);
  border-radius: 50%;
}

.viewer-scale {
  margin-left: auto;
}

.full-dialog {
  width: calc(100vw - 32px);
  max-width: none;
  height: calc(100vh - 32px);
  max-height: none;
  padding: 0;
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: 14px;
  box-shadow: 0 22px 80px rgba(3, 12, 30, 0.28);
}

.full-dialog::backdrop {
  background: rgba(5, 14, 31, 0.72);
  backdrop-filter: blur(4px);
}

.full-dialog-shell {
  display: grid;
  grid-template-rows: 56px minmax(0, 1fr);
  height: 100%;
}

.full-dialog-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 0 13px 0 17px;
  border-bottom: 1px solid var(--border);
}

.full-dialog-header > div {
  display: flex;
  align-items: center;
  gap: 10px;
}

.full-dialog-header strong {
  font-size: 13px;
}

.full-dialog-actions {
  display: flex;
  align-items: center;
}

.icon-button {
  width: 34px;
  padding: 0;
}

.full-dialog-content {
  position: relative;
  min-height: 0;
  overflow: hidden;
  background: #dfe4eb;
}

.full-dialog-content .viewer-canvas {
  left: 50%;
}

.guide-dialog {
  width: min(980px, calc(100vw - 40px));
  max-width: none;
  max-height: calc(100vh - 40px);
  padding: 0;
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: 16px;
  box-shadow: 0 22px 80px rgba(3, 12, 30, 0.28);
}

.guide-dialog::backdrop {
  background: rgba(5, 14, 31, 0.64);
  backdrop-filter: blur(4px);
}

.guide-dialog-shell {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  max-height: calc(100vh - 40px);
}

.guide-dialog-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 23px 26px 20px;
  border-bottom: 1px solid var(--border);
}

.guide-dialog-header .eyebrow {
  margin-bottom: 5px;
}

.guide-dialog-header h2 {
  margin: 0;
  font-size: 21px;
  line-height: 1.25;
  letter-spacing: -0.025em;
}

.guide-dialog-body {
  min-height: 0;
  padding: 22px 26px 26px;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.guide-intro {
  margin: 0 0 22px;
  color: var(--text-muted);
  font-size: 13px;
  line-height: 1.65;
}

.guide-concepts {
  border-top: 1px solid var(--border-strong);
}

.guide-concept {
  display: grid;
  grid-template-columns: 205px minmax(0, 1fr);
  gap: 28px;
  padding: 24px 0;
  border-bottom: 1px solid var(--border);
}

.guide-concept-identity {
  display: flex;
  align-items: flex-start;
  gap: 12px;
}

.guide-concept-key {
  display: grid;
  flex: 0 0 auto;
  place-items: center;
  width: 34px;
  height: 34px;
  color: var(--blue);
  background: var(--blue-soft);
  border: 1px solid #cfe0ff;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 800;
}

.guide-concept-identity h3 {
  margin: 1px 0 8px;
  font-size: 14px;
  line-height: 1.35;
  letter-spacing: -0.01em;
}

.guide-tag {
  display: inline-flex;
  align-items: center;
  height: 22px;
  padding: 0 8px;
  color: #46546a;
  background: var(--surface-strong);
  border: 1px solid var(--border);
  border-radius: 999px;
  font-size: 9px;
  font-weight: 750;
  letter-spacing: 0.025em;
}

.guide-keywords {
  margin: 1px 0 8px;
  color: var(--blue);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 10px;
  font-weight: 650;
  letter-spacing: 0.012em;
}

.guide-description {
  max-width: 690px;
  margin: 0 0 14px;
  color: #39465a;
  font-size: 12px;
  line-height: 1.65;
}

.guide-features {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 7px 20px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.guide-features li {
  position: relative;
  padding-left: 12px;
  color: var(--text-muted);
  font-size: 11px;
  line-height: 1.5;
}

.guide-features li::before {
  position: absolute;
  top: 0.62em;
  left: 0;
  width: 4px;
  height: 4px;
  background: #93a2b8;
  border-radius: 50%;
  content: "";
}

.guide-footer-line {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-top: 16px;
  padding-top: 13px;
  border-top: 1px dashed var(--border);
}

.guide-one-line,
.guide-references {
  margin: 0;
  font-size: 10px;
  line-height: 1.5;
}

.guide-one-line {
  color: var(--text);
  font-weight: 700;
}

.guide-references {
  color: var(--text-muted);
  text-align: right;
}

.guide-references span {
  margin-right: 5px;
  color: #8793a5;
  font-size: 8px;
  font-weight: 750;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}

.guide-summary {
  display: flex;
  align-items: center;
  gap: 24px;
  margin-top: 20px;
  padding: 15px 17px;
  background: #f4f7fb;
  border: 1px solid var(--border);
  border-radius: 11px;
}

.guide-summary > strong {
  flex: 0 0 auto;
  color: var(--text-muted);
  font-size: 9px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.guide-summary > div {
  display: grid;
  flex: 1;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.guide-summary span {
  color: #3d4a5f;
  font-size: 11px;
}

.guide-summary b {
  display: inline-grid;
  place-items: center;
  width: 21px;
  height: 21px;
  margin-right: 6px;
  color: var(--blue);
  background: #fff;
  border: 1px solid #cedcf1;
  border-radius: 6px;
  font-size: 9px;
}

@media (max-width: 1040px) {
  .compare-controls {
    gap: 12px;
    padding-right: 16px;
    padding-left: 16px;
  }

  .control-label,
  .toggle-control > span + span {
    display: none;
  }

  .gallery-view {
    padding-right: 24px;
    padding-left: 24px;
  }

  .guide-concept {
    grid-template-columns: 180px minmax(0, 1fr);
    gap: 20px;
  }

  .overlay-key {
    font-size: 21px;
  }
}

@media (max-width: 820px) {
  .app-header {
    padding: 0 18px;
  }

  .brand small {
    display: none;
  }

  .gallery-view {
    padding-right: 18px;
    padding-left: 18px;
  }

  .gallery-heading-actions {
    align-items: flex-end;
    flex-direction: column-reverse;
    gap: 10px;
  }

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

  .guide-concept {
    grid-template-columns: 1fr;
    gap: 15px;
  }

  .guide-features {
    grid-template-columns: 1fr;
  }

  .guide-footer-line,
  .guide-summary {
    align-items: flex-start;
    flex-direction: column;
  }

  .guide-references {
    text-align: left;
  }
}

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