@charset "UTF-8";

/* ==========================================================================
   画风之间 · STYLE PATH EXPLORER
   Design System: Inspired by "Letters" (Refero Design System Specs)
   Palette: Obsidian (#070709), Paper White (#FFFFFF), Cloud Gray (#F5F5F5),
            Sky Gradient Hero & Sky Tint Shadow (#D7E6F5),
            Surgical Blue (#2597D0) micro-accents.
   Typography: Humanist Geometric Sans with tight negative tracking.
   Geometries: 18px-22px rounded cards, 100px pill buttons & tags.
   ========================================================================== */

/* Use local font fallbacks so first paint needs no external font service. */

:root {
  color-scheme: light;

  /* Neutrals & Monochromes (99% Monochrome System) */
  --obsidian: #070709;          /* Primary text, filled CTA pills, dark UI surfaces */
  --ink: #151515;               /* Headings, strong dividers */
  --charcoal: #60606C;          /* Body text, secondary copy, muted borders */
  --slate: #8B8B8B;             /* Tertiary text, placeholders, inactive states */
  --cloud-gray: #F5F5F5;        /* Secondary card surfaces, tag backgrounds */
  --cloud-subtle: #F9FAFB;      /* Ultra subtle surface wash */
  --paper-white: #FFFFFF;       /* Pure white canvas, card surfaces, button text */

  /* Atmospheric & Functional Accents */
  --sky-tint: #D7E6F5;          /* Card shadow tint & soft atmospheric glow */
  --sky-subtle: #EBF3FA;        /* Ambient highlight tint */
  --surgical-blue: #2597D0;     /* Single chromatic punctuation: icons, active dots */
  --surgical-blue-glow: rgba(37, 151, 208, 0.16);
  --red-fav: #E11D48;           /* Heart accent */

  /* Hairlines & Rules */
  --line-hairline: rgba(7, 7, 9, 0.07);
  --line-light: rgba(7, 7, 9, 0.12);
  --line-strong: rgba(7, 7, 9, 0.22);
  --line-dark: #070709;

  /* Typography */
  --font-display: "Inter Tight", "Open Runde", -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  --font-body: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;

  /* Shapes & Radii (Letters Signature Language) */
  --radius-icon: 8px;
  --radius-input: 12px;
  --radius-frame: 14px;
  --radius-card: 18px;
  --radius-vitrine: 22px;
  --radius-dialog: 22px;
  --radius-pill: 9999px;

  /* Atmospheric Elevations */
  --shadow-card: 0 8px 24px -4px rgba(215, 230, 245, 0.55), 0 1px 3px rgba(7, 7, 9, 0.03);
  --shadow-card-hover: 0 16px 36px -8px rgba(215, 230, 245, 0.85), 0 3px 8px rgba(7, 7, 9, 0.05);
  --shadow-vitrine: 0 20px 48px -10px rgba(16, 55, 132, 0.06), 0 4px 14px -2px rgba(16, 55, 132, 0.03);
  --shadow-pill-cta: 0 2px 4px rgba(7, 7, 9, 0.12), 0 6px 16px -2px rgba(7, 7, 9, 0.16);
  --shadow-dialog: 0 28px 72px -12px rgba(16, 55, 132, 0.14), 0 12px 32px -4px rgba(7, 7, 9, 0.08);

  /* Animations */
  --ease-calm: cubic-bezier(0.16, 1, 0.3, 1);
  --transition-fast: 0.15s var(--ease-calm);
  --transition-normal: 0.26s var(--ease-calm);
}

/* ==========================================================================
   Base Reset & Global Styles
   ========================================================================== */

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
  background-color: var(--paper-white);
  color: var(--obsidian);
}

body {
  margin: 0;
  background: var(--paper-white);
  color: var(--obsidian);
  font: 14px/1.6 var(--font-body);
  letter-spacing: -0.01em;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

button, input, select, textarea {
  font: inherit;
  color: inherit;
}

button {
  border: 0;
  background: none;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.35;
}

a {
  color: inherit;
  text-decoration: none;
}

button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
summary:focus-visible {
  outline: 2px solid var(--surgical-blue);
  outline-offset: 2px;
}

[hidden] {
  display: none !important;
}

/* ==========================================================================
   Header Navigation (Minimalist Clean Masthead)
   ========================================================================== */

.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(255, 255, 255, 0.88);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--line-hairline);
  transition: border-color var(--transition-fast);
}

.topbar-inner {
  max-width: 1240px;
  height: 64px;
  padding: 0 24px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
}

.brand-symbol {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-icon);
  background: var(--cloud-gray);
  border: 1px solid var(--line-hairline);
  display: grid;
  place-items: center;
  color: var(--surgical-blue);
  transition: transform var(--transition-fast), background var(--transition-fast);
}

.brand:hover .brand-symbol {
  background: var(--sky-tint);
  transform: scale(1.04);
}

.brand-symbol svg {
  display: block;
}

.brand-title {
  font-family: var(--font-display);
  font-size: 16px;
  font-weight: 600;
  letter-spacing: -0.025em;
  color: var(--obsidian);
}

.brand-sub {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.8px;
  color: var(--slate);
  padding: 2px 7px;
  background: var(--cloud-gray);
  border-radius: var(--radius-pill);
}

.top-nav {
  display: flex;
  align-items: center;
  gap: 8px;
}

.top-nav button,
.top-nav a {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  height: 34px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--line-hairline);
  background: var(--paper-white);
  color: var(--charcoal);
  font-size: 13px;
  font-weight: 500;
  letter-spacing: -0.01em;
  transition: all var(--transition-fast);
}

.top-nav button:hover,
.top-nav a:hover {
  background: var(--cloud-gray);
  color: var(--obsidian);
  border-color: var(--line-light);
}

.nav-count {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--slate);
  background: var(--cloud-gray);
  padding: 1px 6px;
  border-radius: var(--radius-pill);
}

.top-nav button:hover .nav-count {
  background: var(--paper-white);
  color: var(--obsidian);
}

/* ==========================================================================
   Hero Section (Open-Sky Morning Atmospheric Band)
   Letters Signature: Calming atmospheric wash from soft sky blue to white.
   Symmetrical, center-aligned, clean typography.
   ========================================================================== */

/* ==========================================================================
   Hero Section (Open-Sky Morning Atmospheric Band with Specimen Fan)
   Letters Signature: Calming atmospheric wash from soft sky blue to white,
   with concave/convex fan of art specimens expanding downwards.
   ========================================================================== */

.intro {
  position: relative;
  background: linear-gradient(180deg, #9ABFDA 0%, #C4D9EC 34%, #E9F1F8 68%, #FFFFFF 100%);
  padding: 56px 24px 0;
  text-align: center;
  border-bottom: 1px solid var(--line-hairline);
  overflow: hidden;
}

.intro-inner {
  max-width: 980px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.hero-title {
  font-family: var(--font-display);
  font-size: clamp(48px, 7vw, 76px);
  font-weight: 600;
  line-height: 0.95;
  letter-spacing: -0.04em;
  color: var(--obsidian);
  margin-bottom: 16px;
  text-wrap: balance;
}

.hero-subtitle {
  font-size: clamp(16px, 2.2vw, 20px);
  font-weight: 500;
  letter-spacing: -0.02em;
  color: var(--ink);
  margin-bottom: 14px;
  text-wrap: balance;
}

.lede {
  font-size: 14px;
  line-height: 1.7;
  color: var(--charcoal);
  max-width: 620px;
  margin: 0 auto 10px;
  text-wrap: balance;
}

/* ==========================================================================
   Hero Specimen Fan (Dynamic 7-11 Card Journey Showcase)
   Letters-inspired pure art deck without badges, text or twitching
   ========================================================================== */

.hero-fan {
  position: relative;
  width: 100%;
  max-width: 860px;
  height: 220px;
  margin: 32px auto 0;
  display: flex;
  justify-content: center;
  align-items: flex-end;
  user-select: none;
}

.fan-card {
  position: absolute;
  bottom: 0;
  width: 124px;
  height: 158px;
  background: var(--paper-white);
  border: 1px solid rgba(7, 7, 9, 0.08);
  border-radius: 16px;
  padding: 5px;
  box-shadow: 0 8px 22px -6px rgba(16, 55, 132, 0.09), 0 2px 6px rgba(7, 7, 9, 0.03);
  display: flex;
  flex-direction: column;
  transform-origin: 50% 120%;
  cursor: pointer;
  z-index: var(--z, 1);
  transform: translate(var(--tx, 0px), calc(var(--ty, 0px) + var(--hover-y, 0px))) rotate(var(--rot, 0deg));
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1),
              box-shadow 0.3s cubic-bezier(0.16, 1, 0.3, 1),
              border-color 0.25s ease;
  will-change: transform;
}

/* 优雅浮现交互：保持原生角度，无抖动、无闪烁、无层级冲突 */
.fan-card:hover {
  --hover-y: -14px;
  z-index: 50 !important;
  border-color: rgba(37, 151, 208, 0.45);
  box-shadow: 0 20px 42px -6px rgba(37, 151, 208, 0.22), 0 6px 14px rgba(7, 7, 9, 0.06);
}

.fan-card-mount {
  width: 100%;
  height: 100%;
  border-radius: 12px;
  overflow: hidden;
  background: var(--cloud-gray);
  pointer-events: none;
}

.fan-card-mount img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  pointer-events: none;
}

.hero-fade-overlay {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 32px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0) 0%, rgba(255, 255, 255, 0.75) 60%, #FFFFFF 100%);
  pointer-events: none;
  z-index: 15;
}

/* 响应式扇台自适应缩放（保持整体比例与相对层叠） */
@media (max-width: 820px) {
  .hero-fan {
    transform: scale(0.85);
    transform-origin: 50% 100%;
    margin-top: 18px;
    height: 195px;
  }
}

@media (max-width: 540px) {
  .hero-fan {
    transform: scale(0.7);
    transform-origin: 50% 100%;
    margin-top: 10px;
    height: 165px;
  }
}

/* ==========================================================================
   Main Layout & Content Containers
   ========================================================================== */

main {
  max-width: 1240px;
  margin: 0 auto;
  padding: 48px 24px 80px;
}

/* ==========================================================================
   Stage Vitrine Section (流变路径展台)
   Letters Signature: 18px-22px rounded floating cards on atmospheric shadows
   ========================================================================== */

.journey {
  margin-bottom: 64px;
  scroll-margin-top: 80px;
}

.journey-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  margin-bottom: 18px;
  gap: 16px;
  flex-wrap: wrap;
}

.journey-title-meta {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.curatorial-label {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 1px;
  color: var(--slate);
  text-transform: uppercase;
  font-weight: 600;
}

.journey-header h2 {
  font-family: var(--font-display);
  font-size: 26px;
  font-weight: 600;
  letter-spacing: -0.03em;
  color: var(--ink);
  line-height: 1.1;
}

.route-counter {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--charcoal);
  background: var(--cloud-gray);
  border: 1px solid var(--line-hairline);
  padding: 3px 10px;
  border-radius: var(--radius-pill);
}

.journey-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.random-pair-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 18px;
  border-radius: var(--radius-pill);
  background: var(--obsidian);
  color: var(--paper-white);
  font-size: 13px;
  font-weight: 500;
  box-shadow: var(--shadow-pill-cta);
  transition: all var(--transition-fast);
}

.random-pair-btn:hover:not(:disabled) {
  background: #1C1C21;
  transform: translateY(-1px);
}

.share-trigger-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 18px;
  border-radius: var(--radius-pill);
  background: var(--paper-white);
  border: 1px solid var(--line-light);
  color: var(--obsidian);
  font-size: 13px;
  font-weight: 500;
  box-shadow: 0 1px 2px rgba(7, 7, 9, 0.04);
  transition: all var(--transition-fast);
}

.share-trigger-btn:hover:not(:disabled) {
  background: var(--cloud-gray);
  border-color: var(--line-strong);
}

/* Floating Vitrine Box */
.stage-vitrine {
  background: var(--paper-white);
  border: 1px solid var(--line-hairline);
  border-radius: var(--radius-vitrine);
  box-shadow: var(--shadow-vitrine);
  padding: 36px 36px 32px;
  position: relative;
  overflow: hidden;
}

/* Endpoint Selection Bar */
.endpoint-bar {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 20px;
  margin-bottom: 32px;
}

.endpoint-card {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 14px 18px;
  background: var(--cloud-subtle);
  border: 1px solid var(--line-hairline);
  border-radius: var(--radius-card);
  text-align: left;
  transition: all var(--transition-fast);
  cursor: pointer;
}

.endpoint-card:hover {
  background: var(--cloud-gray);
  border-color: var(--line-light);
}

.endpoint-card.picking {
  border-color: var(--surgical-blue);
  background: var(--sky-subtle);
  box-shadow: 0 0 0 2px var(--surgical-blue), 0 8px 20px -4px var(--surgical-blue-glow);
}

.endpoint-mount {
  width: 52px;
  height: 52px;
  border-radius: var(--radius-frame);
  background: var(--paper-white);
  border: 1px solid var(--line-hairline);
  display: grid;
  place-items: center;
  overflow: hidden;
  flex-shrink: 0;
  box-shadow: 0 1px 3px rgba(7, 7, 9, 0.04);
}

.endpoint-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.endpoint-empty-tip {
  font-size: 11px;
  color: var(--slate);
  text-align: center;
  padding: 4px;
}

.endpoint-info-block {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}

.endpoint-role {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.8px;
  color: var(--slate);
  text-transform: uppercase;
  font-weight: 500;
}

.endpoint-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--obsidian);
  letter-spacing: -0.015em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Axis & Swap Button */
.bridge-axis {
  display: flex;
  align-items: center;
  gap: 12px;
}

.axis-line {
  width: 28px;
  height: 1px;
  background: var(--line-light);
}

.swap-action-btn {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: var(--paper-white);
  border: 1px solid var(--line-light);
  color: var(--charcoal);
  display: grid;
  place-items: center;
  box-shadow: 0 1px 3px rgba(7, 7, 9, 0.05);
  transition: all var(--transition-fast);
}

.swap-action-btn:hover {
  background: var(--cloud-gray);
  color: var(--obsidian);
  border-color: var(--line-strong);
  transform: rotate(180deg);
}

/* Horizontal Route Rail (Darkroom Clothesline / 暗房晾衣绳相片展台) */
.route-rail-container {
  position: relative;
  overflow-x: auto;
  padding: 24px 0 28px;
  scrollbar-width: thin;
  scrollbar-color: var(--line-light) transparent;
  perspective: 1200px;
}

.route-rail-container::-webkit-scrollbar {
  height: 6px;
}

.route-rail-container::-webkit-scrollbar-track {
  background: transparent;
}

.route-rail-container::-webkit-scrollbar-thumb {
  background: var(--line-light);
  border-radius: var(--radius-pill);
}

.route {
  position: relative;
  display: flex;
  align-items: flex-start;
  gap: 24px;
  min-height: 275px;
  width: max-content;
  min-width: 100%;
  justify-content: center;
  padding: 38px 36px 24px;
}

.route.long-route {
  justify-content: flex-start;
}

/* 贯穿全幅的暗房高张力风干钢丝/晾衣绳 */
.route::before {
  content: "";
  position: absolute;
  top: 38px;
  left: 16px;
  right: 16px;
  height: 2px;
  background: linear-gradient(90deg,
    rgba(140, 148, 160, 0.2) 0%,
    rgba(100, 110, 125, 0.6) 4%,
    rgba(100, 110, 125, 0.6) 96%,
    rgba(140, 148, 160, 0.2) 100%
  );
  box-shadow: 0 1px 2px rgba(7, 7, 9, 0.1);
  z-index: 2;
  pointer-events: none;
}

/* 左右两端固定锚栓 */
.route::after {
  content: "";
  position: absolute;
  top: 35px;
  left: 12px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #5A6270;
  box-shadow: calc(100% - 24px) 0 0 #5A6270, 0 1px 3px rgba(7, 7, 9, 0.25);
  z-index: 3;
  pointer-events: none;
}

.route .loading,
.route .empty {
  font-size: 14px;
  color: var(--charcoal);
  padding: 40px 0;
  text-align: center;
  width: 100%;
}

.route .empty.error {
  color: var(--slate);
}

/* 挂在晾衣线上的相片卡片（暗房风干相纸风格） */
.route-item {
  position: relative;
  width: 154px;
  background: #FFFFFF;
  border: 1px solid rgba(7, 7, 9, 0.08);
  border-radius: 3px;
  padding: 8px 8px 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex-shrink: 0;
  cursor: pointer;
  transform-origin: 50% 0px;
  transform: rotate(var(--rest-rot, 0deg));
  box-shadow: 0 8px 20px -4px rgba(7, 7, 9, 0.08), 0 2px 6px rgba(7, 7, 9, 0.03);
  transition: transform 0.5s cubic-bezier(0.2, 0.8, 0.25, 1),
              box-shadow 0.5s cubic-bezier(0.2, 0.8, 0.25, 1),
              border-color 0.3s ease;
  z-index: 4;
  will-change: transform;
  transform-style: preserve-3d;
}

/* 顶部暗房夹（夹在晾衣线上） */
.photo-clip {
  position: absolute;
  top: -16px;
  left: 50%;
  transform: translateX(-50%);
  width: 16px;
  height: 32px;
  z-index: 10;
  pointer-events: none;
  filter: drop-shadow(0 2px 3px rgba(7, 7, 9, 0.18));
}

.photo-clip svg {
  display: block;
  width: 100%;
  height: 100%;
}

/* 鼠标划过相片：随风飘荡，左下角或右下角慢慢略微翘起 */
.route-item.curl-left,
.route-item:not(.curl-right):nth-child(odd):hover {
  transform: perspective(750px) rotateX(13deg) rotateY(16deg) rotateZ(-3deg) translateY(-4px) !important;
  box-shadow: 16px 24px 38px -6px rgba(16, 55, 132, 0.16), 4px 10px 18px rgba(7, 7, 9, 0.06);
  border-color: rgba(37, 151, 208, 0.4);
  z-index: 20;
}

.route-item.curl-right,
.route-item:not(.curl-left):nth-child(even):hover {
  transform: perspective(750px) rotateX(13deg) rotateY(-16deg) rotateZ(3deg) translateY(-4px) !important;
  box-shadow: -16px 24px 38px -6px rgba(16, 55, 132, 0.16), -4px 10px 18px rgba(7, 7, 9, 0.06);
  border-color: rgba(37, 151, 208, 0.4);
  z-index: 20;
}

/* 翘起时纸张微弱漫反射高光 */
.route-item::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 3px;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.4s ease;
  z-index: 8;
}

.route-item.curl-left::after,
.route-item:not(.curl-right):nth-child(odd):hover::after {
  opacity: 1;
  background: linear-gradient(45deg, rgba(255, 255, 255, 0.32) 0%, rgba(255, 255, 255, 0.06) 40%, transparent 70%);
}

.route-item.curl-right::after,
.route-item:not(.curl-left):nth-child(even):hover::after {
  opacity: 1;
  background: linear-gradient(135deg, transparent 30%, rgba(255, 255, 255, 0.06) 60%, rgba(255, 255, 255, 0.32) 100%);
}

.route-portrait {
  width: 100%;
  aspect-ratio: 1;
  border-radius: 2px;
  overflow: hidden;
  background: var(--cloud-gray);
  position: relative;
  border: 1px solid rgba(7, 7, 9, 0.04);
}

.route-portrait img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.4s ease;
}

.route-item:hover .route-portrait img {
  transform: scale(1.03);
}

/* 相纸底部微型信息区 */
.route-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1px;
}

.route-tag-group {
  display: flex;
  align-items: center;
  gap: 5px;
}

.route-step-tag {
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: 600;
  color: var(--slate);
  background: var(--cloud-gray);
  padding: 1px 6px;
  border-radius: var(--radius-pill);
  letter-spacing: 0.4px;
}

.route-step-tag.is-endpoint {
  background: var(--obsidian);
  color: #FFFFFF;
}

.route-id-tag {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--slate);
  font-weight: 500;
}

.fav-btn {
  font-size: 13px;
  line-height: 1;
  color: var(--slate);
  padding: 2px;
  transition: color var(--transition-fast), transform var(--transition-fast);
}

.fav-btn:hover {
  color: var(--red-fav);
  transform: scale(1.15);
}

.fav-btn.saved {
  color: var(--red-fav);
}

.route-name {
  font-size: 11px;
  font-weight: 500;
  color: var(--obsidian);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  padding: 0 1px;
  line-height: 1.3;
}

/* Vitrine Footer */
.journey-footer {
  margin-top: 24px;
  padding-top: 20px;
  border-top: 1px solid var(--line-hairline);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  flex-wrap: wrap;
}

.curatorial-disclaimer p {
  font-size: 12px;
  color: var(--slate);
  line-height: 1.5;
}

.featured-routes-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.routes-label {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.8px;
  color: var(--slate);
  text-transform: uppercase;
  font-weight: 600;
}

.examples {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.examples button {
  padding: 5px 13px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--line-light);
  background: var(--paper-white);
  color: var(--charcoal);
  font-size: 12px;
  font-weight: 500;
  transition: all var(--transition-fast);
}

.examples button:hover {
  background: var(--cloud-gray);
  color: var(--obsidian);
  border-color: var(--line-strong);
}

.examples button.active {
  background: var(--obsidian);
  color: var(--paper-white);
  border-color: var(--obsidian);
  box-shadow: 0 2px 6px rgba(7, 7, 9, 0.15);
}

/* ==========================================================================
   Library Section (画风编目)
   ========================================================================== */

.library {
  padding-top: 20px;
}

.library-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  margin-bottom: 24px;
  gap: 20px;
  flex-wrap: wrap;
}

.library-title-group h2 {
  font-family: var(--font-display);
  font-size: 28px;
  font-weight: 600;
  letter-spacing: -0.03em;
  color: var(--ink);
  line-height: 1.1;
  margin: 4px 0 6px;
}

.library-intro {
  font-size: 13px;
  color: var(--charcoal);
  line-height: 1.5;
}

.selection-notice {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 8px 16px;
  border-radius: var(--radius-pill);
  background: var(--sky-subtle);
  border: 1px solid var(--surgical-blue);
  color: var(--obsidian);
  font-size: 13px;
  font-weight: 500;
}

.notice-indicator {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--surgical-blue);
  animation: pulse 1.6s infinite ease-in-out;
}

@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.4; transform: scale(0.85); }
}

.selection-notice button {
  font-size: 12px;
  color: var(--surgical-blue);
  font-weight: 600;
  text-decoration: underline;
  padding: 0 4px;
}

/* Filter Controls Bar */
.filterbar {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 28px;
  flex-wrap: wrap;
}

.search-box {
  position: relative;
  flex: 1;
  min-width: 240px;
}

.search-symbol {
  position: absolute;
  left: 16px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--surgical-blue);
  font-size: 15px;
  pointer-events: none;
}

.search-box input {
  width: 100%;
  height: 42px;
  padding: 0 16px 0 40px;
  border-radius: var(--radius-pill);
  background: var(--paper-white);
  border: 1px solid var(--line-light);
  font-size: 13px;
  color: var(--obsidian);
  box-shadow: 0 1px 2px rgba(7, 7, 9, 0.03);
  transition: all var(--transition-fast);
}

.search-box input:focus {
  border-color: var(--obsidian);
  box-shadow: 0 0 0 2px var(--surgical-blue-glow);
  outline: none;
}

.category-box select {
  height: 42px;
  padding: 0 32px 0 16px;
  border-radius: var(--radius-pill);
  background: var(--paper-white);
  border: 1px solid var(--line-light);
  font-size: 13px;
  color: var(--charcoal);
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg width='10' height='6' viewBox='0 0 10 6' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1L5 5L9 1' stroke='%238B8B8B' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  box-shadow: 0 1px 2px rgba(7, 7, 9, 0.03);
  transition: all var(--transition-fast);
}

.category-box select:focus {
  border-color: var(--obsidian);
  outline: none;
}

#filter-favorites {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 42px;
  padding: 0 18px;
  border-radius: var(--radius-pill);
  background: var(--paper-white);
  border: 1px solid var(--line-light);
  color: var(--charcoal);
  font-size: 13px;
  font-weight: 500;
  box-shadow: 0 1px 2px rgba(7, 7, 9, 0.03);
  transition: all var(--transition-fast);
}

#filter-favorites:hover {
  background: var(--cloud-gray);
  color: var(--obsidian);
}

#filter-favorites[aria-pressed=true] {
  background: #FFF1F2;
  border-color: #FDA4AF;
  color: var(--red-fav);
}

.archive-counter {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--slate);
  padding: 4px 10px;
  border-radius: var(--radius-pill);
  background: var(--cloud-gray);
  margin-left: auto;
}

/* Style Catalog Grid */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
  gap: 18px;
}

.style-card {
  background: var(--paper-white);
  border: 1px solid var(--line-hairline);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-card);
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  transition: transform var(--transition-fast), box-shadow var(--transition-fast), border-color var(--transition-fast);
}

.style-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-card-hover);
  border-color: var(--line-light);
}

.style-card.selected {
  border-color: var(--surgical-blue);
  box-shadow: 0 0 0 2px var(--surgical-blue), 0 8px 24px -4px var(--surgical-blue-glow);
}

.card-image {
  width: 100%;
  aspect-ratio: 1;
  border-radius: var(--radius-frame);
  overflow: hidden;
  background: var(--cloud-gray);
  position: relative;
  cursor: pointer;
}

.card-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform var(--transition-fast);
}

.card-image:hover img {
  transform: scale(1.05);
}

.card-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 2px;
}

.card-id {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--slate);
  font-weight: 500;
}

.card-name {
  font-size: 13px;
  font-weight: 500;
  color: var(--obsidian);
  line-height: 1.35;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  padding: 0 2px 2px;
}

/* Empty Catalog State */
.empty {
  text-align: center;
  padding: 60px 20px;
  background: var(--cloud-subtle);
  border: 1px solid var(--line-hairline);
  border-radius: var(--radius-card);
  margin-top: 16px;
}

.empty p {
  font-size: 15px;
  font-weight: 500;
  color: var(--obsidian);
  margin-bottom: 6px;
}

.empty small {
  font-size: 13px;
  color: var(--slate);
}

/* Catalog Bottom Action (返回流变路径) */
.catalog-bottom-action {
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 56px 0 24px;
  margin-top: 40px;
  border-top: 1px solid var(--line-hairline);
}

.bottom-journey-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 28px;
  font-size: 14px;
  font-weight: 600;
  color: var(--paper-white);
  background: var(--obsidian);
  border: 1px solid var(--obsidian);
  border-radius: var(--radius-pill);
  box-shadow: 0 4px 14px rgba(7, 7, 9, 0.12);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.bottom-journey-btn:hover {
  background: var(--surgical-blue);
  border-color: var(--surgical-blue);
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(37, 151, 208, 0.28);
}

/* Floating Return Pill (页面下滚时右下角吸附提示) */
.floating-back-journey {
  position: fixed;
  bottom: 28px;
  right: 28px;
  z-index: 45;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  font-size: 13px;
  font-weight: 600;
  color: var(--paper-white);
  background: rgba(7, 7, 9, 0.9);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: var(--radius-pill);
  box-shadow: 0 6px 20px rgba(7, 7, 9, 0.24);
  cursor: pointer;
  transition: all var(--transition-fast);
  opacity: 0;
  pointer-events: none;
  transform: translateY(12px);
}

.floating-back-journey.visible {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}

.floating-back-journey:hover {
  background: var(--surgical-blue);
  border-color: var(--surgical-blue);
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(37, 151, 208, 0.38);
}

/* ==========================================================================
   Detail Modal (Dual Specimen & Flawless Scrolling Architecture)
   Letters Signature: 20px rounded dialog, independent scrolling columns,
   crisp dual specimen comparison, pill segmented controls.
   ========================================================================== */

/* Crucial: completely hide dialogs when not open to prevent rogue overlays */
dialog:not([open]) {
  display: none !important;
}

dialog[open] {
  display: flex !important;
}

dialog {
  color: var(--obsidian);
  background: var(--paper-white);
  border: 1px solid var(--line-light);
  border-radius: var(--radius-dialog);
  box-shadow: var(--shadow-dialog);
  padding: 0;
  max-width: min(1040px, 94vw);
  width: 1040px;
  max-height: 92vh;
  height: min(860px, 92vh);
  margin: auto;
  overflow: hidden;
  flex-direction: column;
}

dialog::backdrop {
  background: rgba(7, 7, 9, 0.42);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

/* Fixed Modal Header */
.detail-modal-header {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 28px;
  border-bottom: 1px solid var(--line-hairline);
  background: var(--paper-white);
  gap: 16px;
}

.detail-header-left {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  flex: 1;
}

.detail-number-tag {
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.5px;
  color: var(--surgical-blue);
  font-weight: 600;
  background: var(--sky-subtle);
  padding: 4px 10px;
  border-radius: var(--radius-pill);
  flex-shrink: 0;
  white-space: nowrap;
}

.detail-title {
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--obsidian);
  margin: 0;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.detail-header-right {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.save-button {
  font-size: 13px;
  font-weight: 500;
  border: 1px solid var(--line-light);
  padding: 6px 16px;
  border-radius: var(--radius-pill);
  background: var(--paper-white);
  color: var(--charcoal);
  transition: all var(--transition-fast);
  white-space: nowrap;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
}

.save-button:hover {
  background: var(--cloud-gray);
  color: var(--obsidian);
}

.save-button[aria-pressed=true] {
  color: var(--red-fav);
  border-color: #FDA4AF;
  background: #FFF1F2;
}

.close-button {
  width: 34px;
  height: 34px;
  font-size: 14px;
  color: var(--charcoal);
  border-radius: 50%;
  background: var(--cloud-gray);
  border: 1px solid var(--line-hairline);
  display: grid;
  place-items: center;
  line-height: 1;
  transition: all var(--transition-fast);
}

.close-button:hover {
  background: var(--obsidian);
  color: var(--paper-white);
}

.detail-modal-footer {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  padding: 12px 28px;
  background: var(--paper-white);
  border-top: 1px solid var(--line-hairline);
  box-shadow: 0 -2px 8px rgba(7, 7, 9, 0.02);
}

.modal-footer-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 18px;
  font-size: 13px;
  font-weight: 500;
  border-radius: var(--radius-pill);
  background: var(--obsidian);
  color: var(--paper-white);
  border: 1px solid var(--obsidian);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.modal-footer-btn:hover {
  background: var(--charcoal);
  border-color: var(--charcoal);
  transform: translateY(-1px);
}

/* Modal Body: Two Independent Smooth-Scrolling Columns */
.detail-modal-body {
  flex: 1;
  min-height: 0; /* CRITICAL for flex children overflow-y to work */
  display: grid;
  grid-template-columns: 460px 1fr;
  overflow: hidden;
}

/* Left Column: Dual Artworks Comparison */
.detail-visual {
  height: 100%;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  padding: 24px 28px 40px;
  background: var(--cloud-subtle);
  border-right: 1px solid var(--line-hairline);
}

.dual-specimen-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 22px;
}

.specimen-card {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.specimen-frame {
  width: 100%;
  aspect-ratio: 1;
  padding: 6px;
  background: var(--paper-white);
  border: 1px solid var(--line-hairline);
  border-radius: var(--radius-frame);
  box-shadow: 0 2px 8px rgba(7, 7, 9, 0.04);
}

.specimen-frame img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
  border-radius: calc(var(--radius-frame) - 4px);
  background: var(--cloud-gray);
}

.specimen-meta {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.specimen-tag {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.5px;
  color: var(--obsidian);
  font-weight: 600;
}

.specimen-desc {
  font-size: 11px;
  color: var(--slate);
  line-height: 1.4;
}

.specimen-actions {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.endpoint-assign-buttons {
  display: flex;
  gap: 10px;
}

.endpoint-assign-buttons button {
  flex: 1;
  padding: 9px 14px;
  font-size: 13px;
  font-weight: 500;
  border: 1px solid var(--line-light);
  background: var(--paper-white);
  border-radius: var(--radius-pill);
  color: var(--obsidian);
  box-shadow: 0 1px 2px rgba(7, 7, 9, 0.03);
  transition: all var(--transition-fast);
}

.endpoint-assign-buttons button:hover {
  background: var(--obsidian);
  color: var(--paper-white);
  border-color: var(--obsidian);
}

.reference-download-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 2px;
  font-size: 12px;
}

.reference-download-bar a {
  color: var(--charcoal);
  border-bottom: 1px solid var(--line-light);
  padding-bottom: 1px;
  transition: color var(--transition-fast);
}

.reference-download-bar a:hover {
  color: var(--obsidian);
  border-color: var(--obsidian);
}

.reference-download-bar button {
  font-size: 12px;
  color: var(--slate);
  transition: color var(--transition-fast);
}

.reference-download-bar button:hover {
  color: var(--obsidian);
}

.reference-instruction {
  font-size: 12px;
  color: var(--charcoal);
  line-height: 1.6;
  background: var(--paper-white);
  border: 1px solid var(--line-hairline);
  border-radius: var(--radius-input);
  padding: 12px 14px;
}

/* Right Column: Curatorial Dossier & Prompt Workshop */
.detail-content {
  height: 100%;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  padding: 24px 32px 50px;
  background: var(--paper-white);
}

.dossier-block {
  margin-bottom: 22px;
}

.dossier-author {
  font-size: 13px;
  font-weight: 500;
  color: var(--ink);
  margin-bottom: 10px;
}

.traits-box {
  background: var(--cloud-subtle);
  border: 1px solid var(--line-hairline);
  border-radius: var(--radius-input);
  padding: 12px 16px;
}

.traits-label {
  display: block;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.8px;
  color: var(--slate);
  margin-bottom: 4px;
  text-transform: uppercase;
  font-weight: 600;
}

.traits {
  font-size: 13px;
  color: var(--charcoal);
  line-height: 1.7;
  max-height: 84px;
  overflow-y: auto;
}

/* Prompt Studio */
.prompt-studio {
  border-top: 1px solid var(--line-hairline);
  padding-top: 20px;
}

.studio-header h3 {
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 600;
  letter-spacing: -0.02em;
  margin-bottom: 4px;
  color: var(--obsidian);
}

.studio-desc {
  font-size: 12px;
  color: var(--slate);
  margin-bottom: 16px;
}

.field-group {
  display: block;
  margin-bottom: 14px;
}

.field-title {
  display: block;
  font-size: 12px;
  font-weight: 500;
  color: var(--ink);
  margin-bottom: 6px;
}

.field-group input {
  width: 100%;
  border: 1px solid var(--line-light);
  background: var(--cloud-subtle);
  border-radius: var(--radius-input);
  padding: 10px 14px;
  font-size: 13px;
  color: var(--obsidian);
  transition: all var(--transition-fast);
}

.field-group input:focus {
  background: var(--paper-white);
  border-color: var(--obsidian);
  box-shadow: 0 0 0 2px var(--surgical-blue-glow);
  outline: none;
}

.constraints-accordion {
  font-size: 12px;
  color: var(--charcoal);
  margin-bottom: 16px;
  background: var(--cloud-subtle);
  border: 1px solid var(--line-hairline);
  border-radius: var(--radius-input);
  padding: 10px 14px;
}

.constraints-accordion summary {
  cursor: pointer;
  color: var(--charcoal);
  font-weight: 500;
  user-select: none;
}

.constraints-accordion summary:hover {
  color: var(--obsidian);
}

.constraints-content {
  padding-top: 12px;
}

.prompt-language-bar {
  margin-bottom: 10px;
}

/* Letters Pill Segmented Control */
.prompt-tabs {
  display: inline-flex;
  padding: 3px;
  background: var(--cloud-gray);
  border-radius: var(--radius-pill);
  gap: 3px;
}

.prompt-tabs button {
  font-size: 12px;
  font-weight: 500;
  color: var(--charcoal);
  padding: 5px 14px;
  border-radius: var(--radius-pill);
  transition: all var(--transition-fast);
}

.prompt-tabs button:hover {
  color: var(--obsidian);
}

.prompt-tabs button[aria-selected=true] {
  background: var(--paper-white);
  color: var(--obsidian);
  font-weight: 600;
  box-shadow: 0 1px 3px rgba(7, 7, 9, 0.08);
}

.prompt-code-wrap {
  margin-bottom: 10px;
}

textarea {
  display: block;
  width: 100%;
  resize: vertical;
  min-height: 100px;
  background: var(--cloud-subtle);
  border: 1px solid var(--line-light);
  color: var(--obsidian);
  padding: 12px 14px;
  font: 12px/1.7 var(--font-mono);
  border-radius: var(--radius-input);
  transition: all var(--transition-fast);
}

textarea:focus {
  background: var(--paper-white);
  border-color: var(--obsidian);
  box-shadow: 0 0 0 2px var(--surgical-blue-glow);
  outline: none;
}

.prompt-note {
  font-size: 11px;
  color: var(--slate);
  margin-bottom: 16px;
  line-height: 1.5;
}

.prompt-button-row {
  display: flex;
  gap: 10px;
  margin-bottom: 14px;
}

.primary-btn {
  padding: 10px 22px;
  border-radius: var(--radius-pill);
  background: var(--obsidian);
  color: var(--paper-white);
  font-size: 13px;
  font-weight: 500;
  box-shadow: var(--shadow-pill-cta);
  transition: all var(--transition-fast);
}

.primary-btn:hover {
  background: #1C1C21;
  transform: translateY(-1px);
}

.secondary-btn {
  padding: 10px 20px;
  border-radius: var(--radius-pill);
  background: var(--paper-white);
  border: 1px solid var(--line-light);
  color: var(--obsidian);
  font-size: 13px;
  font-weight: 500;
  box-shadow: 0 1px 2px rgba(7, 7, 9, 0.03);
  transition: all var(--transition-fast);
}

.secondary-btn:hover {
  background: var(--cloud-gray);
  border-color: var(--line-strong);
}

.source-note {
  font-size: 11px;
  color: var(--slate);
  line-height: 1.5;
}

.source-note a {
  color: var(--charcoal);
  text-decoration: underline;
}

/* ==========================================================================
   Share Dialog Modal
   ========================================================================== */

#share-dialog {
  max-width: 520px;
  width: 90vw;
  height: auto;
  border-radius: var(--radius-dialog);
  padding: 28px;
}

.share-dialog-card {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.share-dialog-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.share-dialog-top h2 {
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 600;
  letter-spacing: -0.025em;
  color: var(--obsidian);
}

.share-desc {
  font-size: 13px;
  color: var(--charcoal);
  line-height: 1.6;
}

.share-field {
  display: flex;
  gap: 8px;
}

.share-field input {
  flex: 1;
  height: 42px;
  padding: 0 14px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--line-light);
  background: var(--cloud-subtle);
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--obsidian);
}

/* ==========================================================================
   Footer Section
   ========================================================================== */

.site-footer {
  border-top: 1px solid var(--line-hairline);
  background: var(--paper-white);
  padding: 40px 24px;
}

.footer-inner {
  max-width: 1240px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 32px;
  flex-wrap: wrap;
}

.footer-meta strong {
  display: block;
  font-family: var(--font-display);
  font-size: 14px;
  font-weight: 600;
  color: var(--obsidian);
  margin-bottom: 6px;
}

.footer-meta p {
  font-size: 12px;
  color: var(--slate);
  max-width: 920px;
  line-height: 1.6;
}

.footer-meta a {
  color: var(--charcoal);
  text-decoration: underline;
}

.footer-links {
  display: flex;
  gap: 18px;
  font-size: 12px;
  color: var(--charcoal);
}

.footer-links a:hover {
  color: var(--obsidian);
  text-decoration: underline;
}

/* ==========================================================================
   Toast Notification
   ========================================================================== */

.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: var(--obsidian);
  color: var(--paper-white);
  padding: 10px 20px;
  border-radius: var(--radius-pill);
  font-size: 13px;
  font-weight: 500;
  box-shadow: 0 8px 24px rgba(7, 7, 9, 0.2);
  opacity: 0;
  pointer-events: none;
  transition: all var(--transition-fast);
  z-index: 100;
}

.toast.visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ==========================================================================
   Responsive Adaptations
   ========================================================================== */

@media (max-width: 900px) {
  .detail-modal-body {
    display: block;
    overflow-y: auto;
    overscroll-behavior-y: contain;
  }

  .detail-visual {
    overflow: visible;
    height: auto;
    border-right: none;
    border-bottom: 1px solid var(--line-hairline);
    padding: 20px;
  }

  .detail-content {
    overflow: visible;
    height: auto;
    padding: 20px;
  }

  .endpoint-bar {
    grid-template-columns: minmax(0, 1fr);
    gap: 12px;
  }

  .bridge-axis {
    justify-content: center;
  }

  .axis-line {
    width: 48px;
  }

  .stage-vitrine {
    padding: 24px 20px;
  }
}

@media (max-width: 640px) {
  .topbar-inner {
    padding: 0 16px;
  }

  .brand-sub {
    display: none;
  }

  .intro {
    padding: 48px 16px 40px;
  }

  main {
    padding: 32px 16px 60px;
  }

  .endpoint-card, .endpoint-info-block { min-width: 0; }
  .category-box { max-width: 100%; min-width: 0; }
  .category-box select { width: 100%; max-width: 100%; }
  .search-box { min-width: 0; flex-basis: 100%; }
  .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }

  #detail {
    width: calc(100vw - 16px);
    max-width: none;
    height: 96vh;
    height: 96dvh;
    max-height: 96vh;
    max-height: 96dvh;
    border-radius: 16px;
  }

  .detail-modal-header {
    padding: 10px 12px;
    gap: 8px;
    align-items: flex-start;
  }

  .detail-header-left {
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
  }

  .detail-number-tag {
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    font-size: 10px;
  }

  .detail-title {
    font-size: 14px;
    line-height: 1.35;
    white-space: normal;
    overflow-wrap: anywhere;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
  }

  .detail-header-right { gap: 6px; }
  .detail-header-right button { min-height: 44px; }
  .detail-header-right .save-button { padding: 6px 10px; }
  .detail-header-right .close-button { width: 44px; }

  .detail-visual, .detail-content { padding: 12px; }
  .dual-specimen-grid {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 10px;
    margin-bottom: 12px;
  }
  .specimen-card { min-width: 0; }
  .specimen-frame { padding: 4px; }
  .specimen-desc { font-size: 10px; }
  .specimen-actions { gap: 6px; }
  .endpoint-assign-buttons button,
  .reference-download-bar a,
  .reference-download-bar button { min-height: 44px; }
  .reference-download-bar a,
  .reference-download-bar button { display: inline-flex; align-items: center; }
  .detail-modal-footer { padding: 8px 12px max(8px, env(safe-area-inset-bottom)); }
  .modal-footer-btn { min-height: 44px; }
  #detail input, #detail select, #detail textarea { font-size: 16px; }
}

/* A modal owns scrolling while open, including on touch devices. */
html:has(dialog[open]) {
  overflow: hidden;
}

/* Keep both complete artworks visible on short landscape screens too. */
@media (max-width: 900px) and (max-height: 500px) {
  .specimen-frame { max-width: min(100%, 32dvh); margin-inline: auto; }
  .specimen-meta { align-items: center; text-align: center; }
}
