/* Final UI pass: shared rhythm, responsive behavior and touch-safe controls. */
:root {
  --ui-ink: #183348;
  --ui-muted: #607080;
  --ui-blue: #174e75;
  --ui-coral: #c46e4e;
  --ui-bg: #f3f6f8;
  --ui-surface: #fff;
  --ui-line: #dde5eb;
  --ui-soft: #edf3f6;
  --ui-radius: 16px;
  --ui-shadow: 0 8px 26px rgba(24, 51, 72, .07);
}

html { overflow-x: hidden; scroll-behavior: smooth; }
body {
  min-width: 320px;
  overflow-x: hidden;
  color: var(--ui-ink);
  background: var(--ui-bg);
  font-family: "Microsoft YaHei UI", "PingFang SC", system-ui, sans-serif;
}

img, svg, video, canvas { max-width: 100%; }
.main, .content, .panel, .field, .workspace > *, .result-card,
.home-hero-copy, .home-storyboard, .promo-page, .dh-layout > * { min-width: 0; }
h1, h2, h3, p, a, button, label, td, th, small, strong { overflow-wrap: anywhere; }
h1, h2, h3 { text-wrap: balance; }
a, button { touch-action: manipulation; }
button, .primary, .home-primary, .home-secondary, .nav, .skill-function,
.choice, .scenario-card, .industry-card, .promo-script-card { transition: background-color .18s ease, border-color .18s ease, color .18s ease, box-shadow .18s ease, transform .18s ease; }

/* Desktop: leave generous reading width while keeping the workspace anchored. */
@media (min-width: 701px) {
  .content { max-width: 1440px; padding: 38px clamp(28px, 4vw, 56px) 76px; }
  .topbar { position: sticky; top: 0; z-index: 12; min-height: 70px; backdrop-filter: blur(12px); }
  .panel { border-radius: var(--ui-radius); box-shadow: var(--ui-shadow); }
  .workspace { gap: clamp(20px, 2.2vw, 32px); }
  .industry-heading { max-width: 1060px; }
  .industry-heading h1 { max-width: 22ch; }
  .industry-heading .subtitle { max-width: 72ch; }
  .quick-upload { min-height: 190px; }
  .skill-function { min-height: 82px; }
  .result-card { min-height: 220px; }
}

/* Shared controls use one visible rhythm across all workflow steps. */
.panel { border-color: var(--ui-line); }
.section-title { align-items: flex-start; }
.section-title h2 { line-height: 1.35; }
.field { gap: 8px; }
.field > span { line-height: 1.45; }
input, select, textarea { min-height: 44px; }
textarea { min-height: 104px; }
button, .primary { min-height: 44px; }
.primary { background: var(--ui-blue); border-color: var(--ui-blue); }
.primary:hover:not(:disabled) { background: #103b5b; border-color: #103b5b; }
.quick-upload:focus-within, .skill-function:focus-visible, .choice:focus-visible,
.scenario-card:focus-visible { outline: 3px solid #86b8d7; outline-offset: 3px; }
.notice, .info { max-width: 100%; overflow-wrap: anywhere; }
.steps { scrollbar-width: thin; }
.table-scroll { max-width: 100%; overflow-x: auto; overscroll-behavior-x: contain; }
.shots { min-width: 620px; }
.error-inline {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px 14px;
  align-items: center;
  border: 1px solid #e4b9ae;
  color: #8f342a;
  background: #fff6f3;
  padding: 14px 16px;
  border-radius: 12px;
  line-height: 1.6;
}
.error-inline strong { min-width: 0; }
.error-inline code { grid-column: 1 / -1; font-size: 12px; color: #a14e43; overflow-wrap: anywhere; }
.error-inline button { min-height: 44px; color: #8f342a; border-color: #e4b9ae; background: #fff; }
.error-inline button:hover { border-color: #b86b5d; background: #fffaf8; }
.analysis-section textarea { min-height: 132px; }

/* Home page: keep the storyboard expressive, but give copy and actions a stable edge. */
.home-page { width: 100%; overflow: hidden; }
.home-hero-copy, .home-section-heading { max-width: 760px; }
.home-actions { align-items: center; }
.home-primary { min-height: 52px; }
.home-storyboard { min-width: 0; }
.home-scene-caption small { overflow-wrap: anywhere; }
.home-direction-grid > a, .home-process li { min-width: 0; }

/* Creator, account and admin pages share the same safe-area bottom navigation. */
@media (max-width: 700px) {
  html { scroll-behavior: auto; }
  body { padding-bottom: calc(78px + env(safe-area-inset-bottom)); }
  .shell { display: block; min-height: 100dvh; }
  .main { width: 100%; }
  .topbar { min-height: 60px; padding: 10px 16px; gap: 10px; }
  .topbar .workspace-crumb { max-width: 48%; line-height: 1.45; }
  .topbar .header-links { max-width: 52%; gap: 8px; line-height: 1.45; }
  .content { padding: 24px 16px calc(106px + env(safe-area-inset-bottom)); }
  .panel { padding: 18px; margin-bottom: 16px; border-radius: 16px; }
  .panel.compact { padding: 16px; }
  h1 { font-size: clamp(26px, 7.5vw, 34px); line-height: 1.3; letter-spacing: -.035em; }
  h2 { font-size: 20px; line-height: 1.4; }
  h3 { font-size: 16px; line-height: 1.45; }
  p { line-height: 1.75; }
  .subtitle { font-size: 15px; line-height: 1.75; }
  .industry-heading { margin: 4px 0 24px; padding-left: 14px; }
  .industry-heading h1 { font-size: clamp(27px, 8vw, 34px); }
  .industry-heading .subtitle { margin-bottom: 0; }
  .workspace { display: flex; flex-direction: column; gap: 0; }
  .workspace > aside { width: 100%; }
  .form-grid, .result-list, .settings-grid { grid-template-columns: 1fr; }
  .field.wide, .form-grid .wide { grid-column: auto; }
  .section-title { gap: 10px; flex-wrap: wrap; }
  .section-title h2 { font-size: 18px; margin-bottom: 0; }
  .number { flex: 0 0 26px; }
  .quick-upload { min-height: 168px; padding: 18px; }
  .skill-function { min-height: 72px; padding: 15px 13px; gap: 11px; }
  .skill-function strong { font-size: 15px; }
  .skill-function small { font-size: 13px; line-height: 1.55; }
  .market-row { align-items: stretch; flex-direction: column; gap: 10px; }
  .market-label { font-size: 14px; }
  .market-switch { width: 100%; }
  .market-switch button { flex: 1; }
  .actions { align-items: stretch; flex-direction: column; gap: 10px; }
  .actions > *, .actions .field, .actions button, .actions .primary { width: 100%; max-width: none; }
  .actions small { line-height: 1.6; }
  .steps { gap: 8px; margin: 18px 0 22px; padding-bottom: 5px; }
  .step { flex: 0 0 118px; min-width: 118px; padding: 10px 8px; font-size: 12px; }
  .choice, .scenario-card { width: 100%; min-height: 48px; padding: 14px; }
  .choice p, .scenario-card p { font-size: 14px; line-height: 1.65; }
  .checks { gap: 8px; }
  .checks label { min-height: 44px; padding: 10px; }
  .kv { table-layout: fixed; }
  .kv th, .kv td { padding: 11px 8px; font-size: 13px; }
  .kv th { width: 31%; }
  .shots { min-width: 620px; }
  .admin-table { min-width: 720px; }
  .asset-grid { grid-template-columns: 1fr; }
  .asset-actions { width: 100%; }
  .asset-actions button, .asset-download { min-height: 44px; flex: 1 1 auto; }
  .admin-modal { width: calc(100% - 20px); max-height: calc(100dvh - 34px); }
  .error-inline { grid-template-columns: 1fr; }
  .error-inline button { width: 100%; }

  /* Bottom nav is deliberately quiet; the active state carries the hierarchy. */
  .sidebar:not(.admin-nav) { height: calc(72px + env(safe-area-inset-bottom)); padding: 5px 4px calc(5px + env(safe-area-inset-bottom)); }
  .sidebar:not(.admin-nav) .nav { min-height: 54px; padding: 8px 3px; gap: 5px; font-size: 11px !important; line-height: 1.2; }
  .sidebar:not(.admin-nav) .nav svg { width: 20px; height: 20px; }
  .sidebar:not(.admin-nav) .nav.active { background: #f9e8df; color: #873924; box-shadow: inset 0 3px #c46e4e; }
  .sidebar.admin-nav { height: calc(66px + env(safe-area-inset-bottom)); padding-bottom: env(safe-area-inset-bottom); }
  .sidebar.admin-nav .nav { min-height: 54px; padding: 14px 11px; }

  /* Home nav remains a compact header instead of becoming a second bottom bar. */
  .shell:has(.home-page) { padding-bottom: 0; }
  .shell:has(.home-page) .sidebar { position: relative; height: 68px; padding: 0 16px; }
  .shell:has(.home-page) .sidebar .nav[href="#create"] { min-height: 44px; }
  .shell:has(.home-page) .sidebar .nav[href="/account"] { min-height: 44px; }
  .shell:has(.home-page) .content { padding-bottom: 0; }
  .home-hero { padding: 38px 20px 52px; gap: 34px; }
  .home-hero h1 { max-width: 13ch; font-size: clamp(36px, 10vw, 49px); line-height: 1.2; }
  .home-lead { max-width: 34ch; font-size: 16px !important; line-height: 1.75 !important; }
  .home-actions { align-items: stretch; flex-direction: column; gap: 10px; }
  .home-primary { width: 100%; }
  .home-secondary { justify-content: center; min-height: 44px; }
  .home-storyboard { width: 100%; }
  .home-scene-caption strong, .home-scene-caption small { white-space: normal; }
  .home-process, .home-directions { padding: 46px 20px 52px; }
  .home-process li { min-height: 76px; }
  .home-direction-grid > a { min-height: 0; padding: 21px; }
  .home-case { margin-inline: 0; }
}

@media (max-width: 420px) {
  .content { padding-inline: 13px; }
  .panel { padding: 16px; }
  .topbar { padding-inline: 13px; }
  .topbar .workspace-crumb { max-width: 43%; }
  .topbar .header-links { max-width: 57%; }
  .industry-heading { padding-left: 11px; }
  .home-hero { padding-inline: 16px; }
  .home-process, .home-directions { padding-inline: 16px; }
  .home-scene-grid { gap: 6px; }
  .home-scene-caption { padding-inline: 6px; }
  .home-scene-caption strong { font-size: 11px; }
  .home-scene-caption small { font-size: 9px; }
  .field > span { font-size: 14px; }
  .skill-function { padding-inline: 10px; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}

/* YXF-20261016-007: page groups and isolated entity demonstrations. */
.section-navigation{display:flex;align-items:center;flex-wrap:wrap;gap:8px;max-width:1440px;margin:0 auto;padding:18px clamp(16px,4vw,56px) 0;color:var(--ui-muted)}
.section-navigation a{display:inline-flex;align-items:center;gap:6px;min-height:44px;padding:8px 14px;border-radius:8px;color:var(--ui-ink)}
.section-navigation a[aria-current="page"]{background:#e4eeed;color:#174f53;font-weight:700;box-shadow:inset 0 -2px #176266}
.section-navigation small,.demo-badge{display:inline-block;padding:3px 7px;border-radius:5px;background:#e8efee;color:#345b60;font-size:12px;line-height:1.5}
.architecture-entry-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:20px;margin:28px 0}
.architecture-entry-grid .entry-card{display:flex;flex-direction:column;align-items:flex-start;padding:28px;border:1px solid var(--ui-line);border-radius:12px;background:var(--ui-surface);color:var(--ui-ink);min-width:0}
.architecture-entry-grid .entry-card h2{margin:18px 0 10px;font-size:26px}
.architecture-entry-grid .entry-card p{color:var(--ui-muted);max-width:35em}
.architecture-entry-grid .entry-card strong{margin-top:auto;min-height:44px;display:flex;align-items:center;color:#174f53}
.architecture-entry-grid .entry-card:hover{border-color:#658d90;background:#f7fbfa}
.legacy-growth-entries{margin:28px 0;padding:18px 0;border-top:1px solid var(--ui-line);border-bottom:1px solid var(--ui-line)}
.legacy-growth-entries summary{cursor:pointer;min-height:44px;padding:10px 0}
.legacy-growth-entries .track-links{display:flex;gap:12px;flex-wrap:wrap}
.legacy-growth-entries .track-links a{min-height:44px;padding:10px}
.entity-demo-notice{padding:16px 20px;border-left:4px solid #176266;background:#e9f2f1;color:#254b50;line-height:1.7}
.entity-demo-layout{display:grid;grid-template-columns:minmax(0,1fr) minmax(0,1fr);gap:24px;align-items:start;margin-top:28px}
.entity-demo-layout>*{min-width:0}
.entity-demo-scenes,.entity-demo-actions{display:flex;flex-wrap:wrap;gap:12px;margin:20px 0}
.entity-demo-scenes button[aria-pressed="true"]{background:#e9f2f1;border-color:#176266;color:#174f53;box-shadow:inset 0 -2px #176266}
.entity-demo-actions button:disabled{opacity:1;cursor:not-allowed;background:#edf0f1;color:#596a73;border-color:#ccd7db}
.entity-demo-preview h2{margin-top:16px}
.entity-demo-shots{list-style:none;display:grid;gap:0;margin:20px 0;padding:0;border-top:1px solid var(--ui-line)}
.entity-demo-shots li{display:grid;grid-template-columns:52px 1fr;gap:16px;padding:18px 0;border-bottom:1px solid var(--ui-line);line-height:1.6}
.entity-demo-shots strong{color:#174f53}
#entity-demo-preview-copy{white-space:pre-wrap;overflow-wrap:anywhere}
#entity-demo-status{font-size:13px;color:#345b60}
.shell:has(.home-page) .architecture-home-grid{grid-template-columns:repeat(3,minmax(0,1fr))}
.shell .architecture-sidebar .nav.business-nav-link{display:flex!important;min-height:44px;white-space:normal}
.shell .architecture-sidebar .workspace-nav{display:flex}
.shell:has(.home-page) .architecture-sidebar{height:auto;min-height:78px;flex-wrap:wrap;gap:10px 20px;padding-top:12px;padding-bottom:12px}
.shell:has(.home-page) .architecture-sidebar .workspace-nav{display:none!important}
.shell:has(.home-page) .architecture-sidebar .workspace-nav-settings{display:flex!important}
.shell:has(.home-page) .architecture-sidebar .business-nav-link{font-size:14px!important;padding:8px!important}
.mv-nav-links .business-nav-link{display:inline-flex;align-items:center;min-height:44px;padding:8px;margin:0;font-size:14px}
.mv-nav-links .business-nav-link.active{color:#174f53;background:#e9f2f1;box-shadow:inset 0 -2px #176266}
.mv-main>.section-navigation{padding:0 0 24px}
@media(min-width:701px){.architecture-sidebar{overflow-y:auto}.architecture-sidebar .nav-label{margin-top:16px}.shell:not(:has(.home-page)) .architecture-sidebar .brand.brand-stacked{margin-bottom:10px}}
@media(max-width:1100px){.entity-demo-layout{grid-template-columns:1fr}}
@media(max-width:700px){
 .shell:has(.home-page) .architecture-home-grid,.architecture-entry-grid{grid-template-columns:1fr}
 .architecture-entry-grid .entry-card{padding:24px}
 .section-navigation{padding:12px 16px 0;gap:4px}
 .section-navigation a{padding:8px 10px}
 .shell:not(:has(.home-page)) .architecture-sidebar .workspace-nav-assets,.shell:not(:has(.home-page)) .architecture-sidebar .workspace-nav-flow{display:none!important}
 .shell:not(:has(.home-page)) .architecture-sidebar .nav.business-nav-link,.shell:not(:has(.home-page)) .architecture-sidebar .workspace-nav-works,.shell:not(:has(.home-page)) .architecture-sidebar .workspace-nav-settings{display:flex!important;flex:1 1 0;min-width:0;min-height:54px;padding:5px 2px;white-space:normal;font-size:11px!important;line-height:1.35;text-align:center}
 .shell:not(:has(.home-page)) .architecture-sidebar .business-nav-link span{max-width:5em}
 .shell:has(.home-page) .architecture-sidebar{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:4px 6px;padding:10px 12px;height:auto!important}
 .shell:has(.home-page) .architecture-sidebar .brand{grid-column:1/3;grid-row:1}
 .shell:has(.home-page) .architecture-sidebar .workspace-nav-settings{grid-column:3;grid-row:1;min-width:0;font-size:12px!important;padding:8px!important}
 .shell:has(.home-page) .architecture-sidebar .business-nav-link{display:flex!important;grid-row:2;justify-content:center;align-items:center;text-align:center;font-size:12px!important;margin:0;min-width:0;line-height:1.4}
 .entity-demo-layout{gap:0}.entity-demo-scenes button,.entity-demo-actions button{flex:1 1 auto}
 .mv-nav{align-items:flex-start}.mv-nav-links{display:flex;flex-wrap:wrap;gap:6px;justify-content:flex-start}
 .mv-nav-links .business-nav-link{font-size:12px;padding:8px 6px}
}
