:root {
  --black: #000000;
  --panel: #0a0a0a;
  --panel-raised: #111111;
  --panel-border: #1f1f1f;
  --white: #ffffff;
  --text: #d4d4d4;
  --muted: #7a7a7a;
  --neon: #00e5ff;
  --neon-soft: rgba(0, 229, 255, 0.08);
  --neon-border: rgba(0, 229, 255, 0.35);
  --code-bg: #050505;
  --copy-pad: clamp(1rem, 2.5vw, 2rem);
  --article-gap: clamp(1rem, 2vw, 1.5rem);
  --rail-width: 280px;
  --sidebar-width: 340px;
  --media-max: 600px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  font-family: "Montserrat", -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--black);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: 4px;
}

.app {
  display: grid;
  grid-template-columns: var(--sidebar-width) 1fr;
  height: 100vh;
  background: var(--black);
  position: relative;
  overflow: hidden;
}

/* —— sidebar —— */
.sidebar {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border-right: 1px solid var(--panel-border);
  background: var(--panel);
  grid-column: 1;
  grid-row: 1;
  z-index: 2;
  transition: transform 0.28s ease, opacity 0.28s ease;
}

.ai-panel {
  grid-column: 1;
  grid-row: 1;
  z-index: 3;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--panel);
  border-right: 1px solid var(--neon-border);
  transform: translateX(100%);
  opacity: 0;
  pointer-events: none;
  transition: transform 0.28s ease, opacity 0.28s ease;
}

.ai-panel-slot {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

body.is-ai-open .sidebar {
  transform: translateX(-100%);
  opacity: 0;
  pointer-events: none;
}

body.is-ai-open .ai-panel {
  transform: translateX(0);
  opacity: 1;
  pointer-events: auto;
}

.sidebar-header {
  padding: 1.15rem 1rem 0.9rem;
  border-bottom: 1px solid var(--panel-border);
}

.brand {
  font-size: 1.35rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1;
  color: var(--white);
  text-transform: lowercase;
  cursor: pointer;
}

.subtitle {
  margin: 0.35rem 0 0.85rem;
  font-size: 0.68rem;
  font-weight: 500;
  letter-spacing: 0.06em;
  color: var(--muted);
}

.tabs {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  margin-bottom: 0.65rem;
  border: 1px solid var(--panel-border);
  border-radius: 4px;
  overflow: hidden;
}

.tab {
  padding: 0.5rem 0.35rem;
  font-family: inherit;
  font-size: 0.65rem;
  font-weight: 600;
  background: var(--black);
  color: var(--muted);
  border: none;
  cursor: pointer;
  transition: color 0.15s, background 0.15s;
}

.tab + .tab { border-left: 1px solid var(--panel-border); }
.tab:hover { color: var(--white); }
.tab.active { color: var(--black); background: var(--neon); }

#search {
  width: 100%;
  padding: 0.55rem 0.7rem;
  border: 1px solid var(--panel-border);
  border-radius: 4px;
  background: var(--black);
  color: var(--white);
  font-family: inherit;
  font-size: 0.78rem;
  margin-bottom: 0.65rem;
}

#search::placeholder { color: var(--muted); }
#search:focus { outline: none; border-color: var(--neon); }

.btn-neon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  padding: 0.55rem 1rem;
  font-family: inherit;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-decoration: none;
  color: var(--neon);
  background: transparent;
  border: 6px solid var(--neon);
  border-radius: 4px;
  cursor: pointer;
  transition:
    color 0.18s ease,
    background 0.18s ease,
    border-color 0.18s ease,
    box-shadow 0.18s ease,
    transform 0.15s ease;
  box-shadow: 0 0 20px rgba(0, 229, 255, 0.1);
  text-shadow: 0 0 14px rgba(0, 229, 255, 0.35);
}

.btn-neon:hover:not(:disabled) {
  color: var(--black);
  background: var(--neon);
  border-color: var(--neon);
  box-shadow: 0 0 28px rgba(0, 229, 255, 0.38);
  text-shadow: none;
}

.btn-neon:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px var(--neon-soft), 0 0 28px rgba(0, 229, 255, 0.35);
}

.btn-neon:disabled {
  opacity: 0.5;
  cursor: wait;
}

.btn-neon--compact {
  width: auto;
  padding: 0.45rem 0.85rem;
  font-size: 0.68rem;
}

.btn-neon--fab {
  border-radius: 999px;
  padding: 0.72rem 1.15rem 0.72rem 0.95rem;
  font-size: 0.78rem;
}

.btn-neon--fab.is-active {
  color: var(--black);
  background: var(--neon);
  box-shadow: 0 0 32px rgba(0, 229, 255, 0.42);
}

.btn-neon--sm {
  border-width: 3px;
  padding: 0.42rem 0.72rem;
  font-size: 0.62rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  box-shadow: none;
}

.btn-neon--pill {
  border-radius: 999px;
}

.btn-hire {
  width: 100%;
}

.btn-hire--compact {
  width: auto;
}

.nav-tree {
  overflow-y: auto;
  padding: 0.25rem 0 1rem;
  flex: 1;
}

.nav-skeleton {
  padding: 0.5rem 0.65rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.nav-skeleton span {
  display: block;
  height: 0.55rem;
  background: linear-gradient(90deg, #111 25%, #1a1a1a 50%, #111 75%);
  background-size: 200% 100%;
  animation: shimmer 1.2s infinite;
}

@keyframes shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

.nav-section-title {
  padding: 0.4rem 0.5rem;
  font-size: 0.6rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--muted);
  text-align: left;
}

.nav-section {
  padding: 0;
}

.nav-folder {
  margin: 0;
  border-radius: 0;
}

.nav-folder summary {
  cursor: pointer;
  padding: 0.38rem 0.5rem;
  font-size: 0.74rem;
  font-weight: 600;
  color: var(--white);
  list-style: none;
  text-align: left;
}

.nav-folder summary::-webkit-details-marker { display: none; }
.nav-folder summary::before {
  content: "›";
  color: var(--neon);
  font-weight: 700;
  display: inline-block;
  width: 1rem;
  transition: transform 0.15s ease;
}
.nav-folder[open] summary::before {
  transform: rotate(90deg);
  content: "›";
}

.nav-folder--topic summary {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 0.35rem;
}

.folder-label {
  flex: 1;
  text-align: left;
}

.nav-folder--topic[open] {
  background: #141414;
  padding-bottom: 0.2rem;
}

.nav-folder[open] summary {
  color: var(--white);
}

.folder-count {
  font-size: 0.58rem;
  font-weight: 600;
  color: var(--muted);
  background: var(--black);
  border: 1px solid var(--panel-border);
  padding: 0.06rem 0.3rem;
  border-radius: 3px;
  margin-left: auto;
}

.folder-desc {
  margin: 0 0 0.35rem;
  padding: 0 0.5rem 0 1.5rem;
  font-size: 0.64rem;
  line-height: 1.4;
  color: var(--muted);
  text-align: left;
}

.nav-link {
  display: block;
  padding: 0.32rem 0.5rem 0.32rem 1.5rem;
  margin: 0;
  font-size: 0.72rem;
  font-weight: 500;
  color: var(--muted);
  text-decoration: none;
  border-left: 2px solid transparent;
  border-radius: 0;
  text-align: left;
  transition: color 0.12s, background 0.12s, border-color 0.12s;
}

.nav-folder--topic[open] .nav-link {
  background: #181818;
}

.nav-link:hover {
  color: var(--white);
  background: #1f1f1f;
}

.nav-link.active,
.nav-link.active.guide,
.nav-link.active.hub {
  color: var(--neon);
  border-left-color: var(--neon);
  background: rgba(0, 229, 255, 0.08);
  font-weight: 600;
}

.nav-link.guide { color: #bdbdbd; font-weight: 500; }

.nav-link.hub {
  color: var(--neon);
  font-weight: 700;
  border-left-color: transparent;
}
.hidden { display: none !important; }

/* —— main —— */
.main {
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  background: var(--black);
  position: relative;
  padding-bottom: 5.5rem;
}

body.is-chat-home .main {
  overflow: hidden;
  padding-bottom: 0;
  background:
    radial-gradient(ellipse 120% 70% at 50% -15%, rgba(0, 229, 255, 0.14), transparent 52%),
    radial-gradient(ellipse 55% 45% at 100% 100%, rgba(0, 229, 255, 0.08), transparent 50%),
    radial-gradient(ellipse 40% 35% at 0% 80%, rgba(0, 229, 255, 0.05), transparent 45%),
    var(--black);
}

body.is-chat-designs .main {
  overflow: hidden;
  padding-bottom: 0;
}

body.is-chat-designs .main-top {
  display: none;
}

body.is-chat-designs .content {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
  padding: 0;
}

body.is-chat-home .main-top {
  display: none;
}

body.is-chat-home .content {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
  padding: 0;
}

.manual-home {
  display: flex;
  justify-content: center;
  width: 100%;
  padding: clamp(0.5rem, 1.5vw, 1rem) 0 2rem;
}

body.is-chat-home .manual-home {
  flex: 1;
  min-height: 0;
  height: 100%;
  padding: 0;
  flex-direction: column;
  align-items: stretch;
  overflow: hidden;
  max-width: none;
  margin: 0;
}

.manual-home.hidden { display: none; }

.designs-home {
  display: none;
  width: 100%;
  height: 100%;
  min-height: 0;
}

.designs-home:not(.hidden) {
  display: grid;
  grid-template-columns: minmax(300px, 34%) minmax(0, 1fr);
  min-height: 0;
}

.chat-designs-slot {
  min-height: 0;
  border-right: 1px solid var(--panel-border);
  display: flex;
  flex-direction: column;
}

.designs-gallery {
  min-height: 0;
  overflow-y: auto;
  padding: clamp(1.25rem, 3vw, 2.5rem);
  background:
    radial-gradient(ellipse 80% 50% at 100% 0%, rgba(0, 229, 255, 0.04), transparent 55%),
    var(--black);
}

.designs-gallery-head {
  margin-bottom: 1.25rem;
  max-width: 52rem;
}

.designs-gallery-eyebrow,
.designs-gallery-head h2,
.designs-gallery-intro {
  margin: 0;
}

.designs-gallery-eyebrow {
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--neon);
  margin-bottom: 0.4rem;
}

.designs-gallery-head h2 {
  font-size: clamp(1.35rem, 2.4vw, 1.85rem);
  font-weight: 700;
  color: var(--white);
  letter-spacing: -0.03em;
  margin-bottom: 0.55rem;
}

.designs-gallery-intro {
  font-size: 0.88rem;
  line-height: 1.7;
  color: var(--muted);
  margin-bottom: 1rem;
}

.designs-filter {
  width: min(100%, 320px);
  padding: 0.6rem 0.75rem;
  border: 1px solid var(--panel-border);
  border-radius: 4px;
  background: var(--panel);
  color: var(--white);
  font-family: inherit;
  font-size: 0.8rem;
}

.designs-filter:focus {
  outline: none;
  border-color: var(--neon);
}

.designs-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 220px), 1fr));
  gap: 1rem;
}

.designs-footnote {
  margin: 1.25rem 0 0;
  max-width: 42rem;
  font-size: 0.72rem;
  line-height: 1.6;
  color: var(--muted);
}

.nav-section--designs .nav-designs-note {
  margin: 0 0 0.75rem;
  padding: 0 0.15rem;
  font-size: 0.72rem;
  line-height: 1.55;
  color: var(--muted);
}

.template-card.is-filtered-out {
  display: none;
}

.template-card-media--swatch {
  display: flex;
  align-items: center;
  justify-content: center;
  background:
    radial-gradient(circle at 30% 20%, color-mix(in srgb, var(--template-accent, var(--neon)) 35%, transparent), transparent 55%),
    linear-gradient(145deg, #141414 0%, #050505 100%);
}

.template-thumb-grid {
  position: absolute;
  inset: 12% 10%;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 2px;
  background:
    linear-gradient(to right, rgba(255,255,255,0.06) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(255,255,255,0.06) 1px, transparent 1px);
  background-size: 22% 100%, 100% 33%;
  opacity: 0.85;
}

.template-thumb-mark {
  position: relative;
  z-index: 1;
  font-size: clamp(1.6rem, 4vw, 2.2rem);
  font-weight: 800;
  letter-spacing: -0.04em;
  color: color-mix(in srgb, var(--template-accent, var(--neon)) 70%, white);
}

.template-card--design {
  min-height: 100%;
}

.template-card--design .template-card-body {
  padding: 1rem 1rem 1.1rem;
}

.template-card--design .template-card-desc {
  font-size: 0.74rem;
  line-height: 1.6;
}

/* —— chat: designs split column —— */
body.is-chat-designs .chat-root--designs {
  flex: 1;
  min-height: 0;
  display: flex;
}

body.is-chat-designs .chat-root--designs .chat-shell {
  flex: 1;
  min-height: 0;
  max-height: none;
  height: 100%;
  border-radius: 0;
  border: 0;
  box-shadow: none;
  display: flex;
  flex-direction: column;
}

body.is-chat-designs .chat-root--designs .chat-head {
  padding: 1rem 1.1rem;
  flex-shrink: 0;
}

body.is-chat-designs .chat-root--designs .chat-title {
  font-size: 1.05rem;
}

body.is-chat-designs .chat-root--designs .chat-lead--home {
  font-size: 0.78rem;
  line-height: 1.55;
  max-width: none;
}

body.is-chat-designs .chat-root--designs .chat-head-actions {
  display: flex;
}

body.is-chat-designs .chat-root--designs .chat-body {
  flex: 1;
  min-height: 0;
}

body.is-chat-designs .chat-root--designs .chat-layout {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
}

body.is-chat-designs .chat-root--designs .chat-main {
  flex: 1;
  min-height: 0;
}

body.is-chat-designs .chat-root--designs .chat-compose {
  flex-shrink: 0;
  border-top: 1px solid var(--panel-border);
  padding: 0 1rem 0.5rem;
}

body.is-chat-designs .chat-root--designs .chat-form {
  padding: 0.65rem 0;
  border-top: 0;
  background: transparent;
}

body.is-chat-designs .chat-root--designs .chat-log {
  flex: 1;
  min-height: 0;
  max-height: none;
  overflow-y: auto;
  padding: 0.85rem 1rem;
}

body.is-chat-designs .chat-compose-quick,
body.is-chat-designs .chat-side-note,
.chat-root--dock .chat-compose-quick,
.chat-root--dock .chat-side-note {
  display: none;
}

body.is-chat-designs .chat-root--designs .chat-toggle--dock {
  display: none;
}

.chat-home-slot {
  width: 100%;
  max-width: min(920px, 100%);
  margin: 0 auto;
}

body.is-chat-home .chat-home-slot {
  max-width: none;
  margin: 0;
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.chat-dock-slot {
  position: fixed;
  z-index: 100;
  left: calc(min(300px, 28vw) + 12px);
  bottom: 12px;
  width: min(380px, calc(100vw - min(300px, 28vw) - 24px));
  pointer-events: none;
}

.chat-dock-slot:not(.hidden) {
  pointer-events: auto;
}

.chat-dock-slot.hidden { display: none; }

.chat-root {
  width: 100%;
}

body.is-chat-home .chat-root--home {
  flex: 1;
  min-height: 0;
  height: 100%;
  display: flex;
  flex-direction: column;
}

.chat-root--home .chat-shell {
  min-height: 0;
  max-height: none;
  overflow: hidden;
  box-shadow: none;
  background: var(--black);
}

body.is-chat-home .chat-root--home .chat-shell {
  flex: 1;
  min-height: 0;
  height: 100%;
  border-radius: 0;
  border: 0;
  border-top: 3px solid var(--neon-border);
  border-bottom: 3px solid var(--neon-border);
  box-shadow:
    inset 0 0 100px rgba(0, 229, 255, 0.05),
    0 0 48px rgba(0, 229, 255, 0.1);
}

.chat-root--home .chat-head {
  padding: 0.85rem clamp(1rem, 2.5vw, 2rem);
  flex-shrink: 0;
  border-bottom: 1px solid var(--panel-border);
}

body.is-chat-home .chat-root--home .chat-head {
  padding: 0.75rem clamp(1rem, 2.5vw, 2rem);
  border-bottom-color: var(--neon-border);
  background: linear-gradient(180deg, rgba(0, 229, 255, 0.1) 0%, rgba(0, 229, 255, 0.02) 55%, transparent 100%);
}

body.is-chat-home .chat-root--home .chat-title {
  font-size: clamp(1.15rem, 2vw, 1.45rem);
  margin: 0;
  color: var(--white);
  text-shadow: 0 0 24px rgba(0, 229, 255, 0.2);
}

body.is-chat-home .chat-root--home .chat-lead--home {
  display: none;
}

body.is-chat-home .chat-root--home .chat-eyebrow {
  font-size: 0.62rem;
  margin-bottom: 0.25rem;
  color: var(--neon);
  text-shadow: 0 0 18px rgba(0, 229, 255, 0.45);
}

body.is-chat-home .chat-root--home .chat-head-actions {
  display: none;
}

body.is-chat-home .chat-root--home .chat-body {
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

body.is-chat-home .chat-root--home .chat-layout {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
}

body.is-chat-home .chat-root--home .chat-main {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.chat-root--home .chat-log {
  min-height: 0;
  max-height: none;
}

body.is-chat-home .chat-root--home .chat-log {
  flex: 1;
  min-height: 0;
  max-height: none;
  overflow-y: auto;
  padding: clamp(0.85rem, 2vw, 1.25rem) clamp(1rem, 2.5vw, 2rem);
  gap: 0.85rem;
}

body.is-chat-home .chat-root--home .chat-bubble {
  max-width: min(92%, 820px);
  padding: 1rem 1.15rem;
  font-size: 0.86rem;
  line-height: 1.85;
}

body.is-chat-home .chat-root--home .chat-bubble--user {
  font-size: 0.82rem;
  line-height: 1.75;
}

body.is-chat-home .chat-root--home .chat-bubble--assistant p {
  margin: 0 0 0.7rem;
}

body.is-chat-home .chat-root--home .chat-bubble--assistant p:last-child {
  margin-bottom: 0;
}

body.is-chat-home .chat-root--home .chat-bubble--assistant .chat-answer-title {
  font-size: clamp(1.35rem, 2.5vw, 1.7rem);
  font-weight: 700;
  line-height: 1.3;
  color: var(--white);
  margin-bottom: 0.95rem;
}

body.is-chat-home .chat-root--home .chat-bubble--assistant .chat-answer-title strong {
  font-weight: inherit;
  color: inherit;
}

body.is-chat-home .chat-root--home .chat-turn--assistant {
  max-width: min(100%, 900px);
}

body.is-chat-home .chat-root--home .chat-compose {
  flex-shrink: 0;
  border-top: 2px solid var(--neon-border);
  background: linear-gradient(180deg, rgba(0, 229, 255, 0.04) 0%, rgba(0, 0, 0, 0.98) 38%);
  padding: 0 clamp(1rem, 2.5vw, 2rem) 0.65rem;
  box-shadow: 0 -12px 40px rgba(0, 229, 255, 0.08);
}

body.is-chat-home .chat-root--home .chat-compose-quick {
  padding: 0.65rem 0 0.35rem;
}

body.is-chat-home .chat-root--home .chat-compose-quick .rail-label {
  margin: 0 0 0.45rem;
  font-size: 0.58rem;
}

body.is-chat-home .chat-root--home .chat-form {
  padding: 0.55rem 0 0.65rem;
  border-top: 0;
  background: transparent;
}

body.is-chat-home .chat-root--home .chat-form input {
  padding: 0.9rem 1rem;
  font-size: 0.92rem;
  border-color: var(--neon-border);
  background: rgba(0, 0, 0, 0.65);
}

body.is-chat-home .chat-root--home .chat-compose-quick .rail-label,
body.is-chat-home .chat-root--home .rail-label {
  color: var(--neon);
  text-shadow: 0 0 12px rgba(0, 229, 255, 0.25);
}

body.is-chat-home .chat-root--home .chat-form button {
  padding: 0.9rem 1.15rem;
  font-size: 0.78rem;
}

body.is-chat-home .chat-root--home .chat-sources {
  padding: 0.35rem 0 0;
}

body.is-chat-home .chat-root--home .chat-source {
  font-size: 0.72rem;
  padding: 0.45rem 0.7rem;
}

body.is-chat-home .chat-root--home .chat-quick {
  flex-direction: row;
  flex-wrap: wrap;
  gap: 0.45rem;
}

body.is-chat-home .chat-root--home .chat-chip {
  font-size: 0.74rem;
  padding: 0.5rem 0.75rem;
}

body.is-chat-home .chat-root--home .chat-side-note {
  margin: 0;
  padding: 0 0 0.55rem;
  font-size: 0.68rem;
  color: var(--muted);
}

body.is-chat-home .chat-root--home .rail-label {
  font-size: 0.68rem;
  margin-bottom: 0.55rem;
}

body.is-chat-home .chat-root--home .chat-think-sub {
  font-size: 0.85rem;
}

body.is-chat-home .chat-root--home .chat-figure img {
  max-height: 280px;
}

/* —— template gallery (home) —— */
.template-gallery {
  width: 100%;
  max-width: min(1100px, 100%);
  margin: 0 auto;
  padding: clamp(1rem, 2.5vw, 1.5rem);
}

body.is-chat-home .template-gallery {
  flex-shrink: 0;
  border-radius: 0;
  border-left: 0;
  border-right: 0;
  border-bottom: 0;
  margin-top: 0;
}

.manual-home.hidden .template-gallery {
  display: none;
}

.template-gallery-head {
  margin-bottom: 1rem;
}

.template-gallery-eyebrow {
  margin: 0 0 0.35rem;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--neon);
}

.template-gallery-head h2 {
  margin: 0 0 0.45rem;
  font-size: clamp(1.15rem, 2vw, 1.45rem);
  font-weight: 700;
  color: var(--white);
  letter-spacing: -0.02em;
}

.template-gallery-intro {
  margin: 0;
  max-width: 42rem;
  font-size: 0.82rem;
  line-height: 1.65;
  color: var(--muted);
}

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

.template-card {
  display: flex;
  flex-direction: column;
  min-height: 100%;
  text-decoration: none;
  color: inherit;
  background: var(--black);
  border: 1px solid var(--panel-border);
  border-radius: 4px;
  overflow: hidden;
  transition: border-color 0.15s, box-shadow 0.15s, transform 0.15s;
}

.template-card:hover {
  border-color: var(--neon-border);
  box-shadow: 0 0 0 1px var(--neon-border), 0 12px 32px rgba(0, 0, 0, 0.35);
  transform: translateY(-2px);
}

.template-card-media {
  position: relative;
  aspect-ratio: 16 / 10;
  background: linear-gradient(145deg, #121212 0%, #050505 100%);
  overflow: hidden;
}

.template-card-media img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.template-card--text .template-card-body {
  padding-top: 1rem;
}

.template-card-media img.is-hidden {
  display: none;
}

.template-card-body {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  padding: 0.85rem 0.9rem 0.95rem;
}

.template-card-name {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--white);
}

.template-card-tagline {
  font-size: 0.68rem;
  font-weight: 600;
  color: var(--neon);
}

.template-card-desc {
  font-size: 0.72rem;
  line-height: 1.55;
  color: var(--muted);
  margin-bottom: 0.35rem;
}

.template-card-cta {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-top: auto;
  width: fit-content;
  pointer-events: none;
}

.template-card:hover .template-card-cta.btn-neon {
  color: var(--black);
  background: var(--neon);
  border-color: var(--neon);
  box-shadow: 0 0 28px rgba(0, 229, 255, 0.38);
  text-shadow: none;
}

.template-gallery-error {
  margin: 0;
  font-size: 0.78rem;
  color: #ffb4b4;
}

.chat-root--home .chat-toggle--dock {
  display: none;
}

.chat-root--home .chat-lead--home {
  display: none;
}

.chat-root--dock {
  max-height: min(460px, 58vh);
}

.chat-root--dock .chat-shell {
  display: flex;
  flex-direction: column;
  max-height: min(460px, 58vh);
  overflow: hidden;
  box-shadow: 0 0 0 1px var(--neon-border), 0 16px 48px rgba(0, 0, 0, 0.55);
  background: linear-gradient(180deg, #0d0d0d 0%, #050505 100%);
}

.chat-root--dock .chat-head {
  padding: 0.65rem 0.75rem;
  align-items: center;
}

.chat-root--dock .chat-title {
  font-size: 0.82rem;
  margin: 0;
}

.chat-root--dock .chat-lead--home,
.chat-root--dock .chat-compose-quick,
.chat-root--dock .chat-side-note {
  display: none;
}

.chat-root--dock .chat-layout {
  display: flex;
  flex-direction: column;
}

.chat-root--dock .chat-log {
  min-height: 140px;
  max-height: 240px;
}

.chat-root--dock .chat-form {
  padding: 0.55rem 0.75rem 0.65rem;
}

.chat-root--dock .chat-status {
  padding: 0 0.75rem 0.55rem;
  font-size: 0.55rem;
}

.chat-root--dock .chat-sources {
  padding: 0 0.75rem 0.45rem;
}

.chat-root--dock.is-collapsed {
  max-height: none;
}

.chat-root--dock.is-collapsed .chat-body {
  display: none;
}

.chat-layout {
  display: flex;
  flex-direction: column;
  gap: 0;
  min-height: 0;
  flex: 1;
}

.chat-compose {
  flex-shrink: 0;
}

.chat-compose-quick .rail-label {
  margin: 0 0 0.35rem;
  font-size: 0.58rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--muted);
  text-transform: uppercase;
}

.chat-main {
  display: flex;
  flex-direction: column;
  min-height: 0;
  min-width: 0;
}

.chat-body {
  display: flex;
  flex-direction: column;
  min-height: 0;
  flex: 1;
}

.chat-shell {
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.main-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.65rem var(--copy-pad);
  border-bottom: 1px solid var(--panel-border);
  background: var(--black);
  flex-shrink: 0;
}

.main-top-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-shrink: 0;
}

.main-top-label {
  margin: 0;
  font-size: 0.65rem;
  font-weight: 600;
  color: var(--muted);
}

.content {
  margin: 0;
  padding: var(--copy-pad);
  max-width: none;
  width: 100%;
  flex: 1;
  position: relative;
  background: var(--black);
}

.content.is-loading { opacity: 0.55; pointer-events: none; }

.content-loader {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.65);
  z-index: 20;
}

.content-loader.hidden { display: none; }

.loader-ring {
  width: 32px;
  height: 32px;
  border: 2px solid var(--panel-border);
  border-top-color: var(--neon);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

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

.page-body { animation: fadeIn 0.2s ease; width: 100%; }

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

/* —— welcome —— */
.welcome { width: 100%; }

.welcome-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr);
  gap: var(--article-gap);
  align-items: start;
}

.welcome-layout--single { grid-template-columns: 1fr; max-width: 720px; }

.welcome-hero {
  padding: clamp(1.5rem, 3vw, 2.25rem);
}

.welcome-topics {
  padding: clamp(1.25rem, 2.5vw, 1.75rem);
}

.welcome-eyebrow {
  margin: 0 0 0.6rem;
  font-size: 0.68rem;
  font-weight: 600;
  color: var(--neon);
  letter-spacing: 0.06em;
}

.welcome h1,
.welcome-inner h1 {
  margin: 0 0 0.85rem;
  font-size: clamp(1.5rem, 3vw, 2rem);
  font-weight: 700;
  color: var(--white);
  letter-spacing: -0.03em;
  line-height: 1.15;
}

.welcome-lead {
  margin: 0;
  font-size: 0.92rem;
  line-height: 1.6;
  color: #999;
}

.welcome-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.6rem;
}

.welcome-card {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  padding: 0.85rem 0.9rem;
  background: var(--black);
  border: 1px solid var(--panel-border);
  border-radius: 4px;
  text-decoration: none;
  transition: border-color 0.15s, background 0.15s;
}

.welcome-card:hover {
  border-color: var(--neon-border);
  background: var(--neon-soft);
}

.welcome-card-title {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--white);
}

.welcome-card-desc {
  font-size: 0.65rem;
  color: var(--muted);
  line-height: 1.35;
}

.welcome-card--solo { margin-top: 1rem; }

.welcome-card--wide { grid-column: 1 / -1; }

.welcome-grid--topics {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.welcome-ordered {
  margin: 0;
  padding: 0;
  list-style: none;
  counter-reset: topic;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.welcome-ordered li {
  counter-increment: topic;
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
}

.welcome-ordered li::before {
  content: counter(topic);
  flex-shrink: 0;
  width: 1.25rem;
  font-size: 0.62rem;
  font-weight: 700;
  color: var(--neon);
  text-align: right;
}

.welcome-ordered a {
  display: block;
  flex: 1;
  padding: 0.45rem 0.65rem;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--white);
  text-decoration: none;
  background: var(--black);
  border: 1px solid var(--panel-border);
  border-radius: 4px;
  transition: border-color 0.15s, background 0.15s;
}

.welcome-ordered a:hover {
  border-color: var(--neon-border);
  background: var(--neon-soft);
  color: var(--neon);
}

@media (min-width: 700px) {
  .welcome-grid--topics {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

.rail-label {
  margin: 0 0 0.65rem;
  font-size: 0.6rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--muted);
}

/* —— article hero —— */
.article-hero {
  margin-bottom: var(--article-gap);
  padding: clamp(1.25rem, 2.5vw, 1.75rem);
  border-left: 3px solid var(--neon);
}

.article-hero-inner {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 1rem 1.5rem;
  align-items: end;
}

.article-eyebrow {
  margin: 0 0 0.45rem;
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--neon);
}

.article-title {
  margin: 0;
  font-size: clamp(1.35rem, 2.5vw, 2rem);
  font-weight: 700;
  line-height: 1.15;
  letter-spacing: -0.03em;
  color: var(--white);
}

.article-meta {
  font-size: 0.65rem;
  font-weight: 600;
  color: var(--muted);
  white-space: nowrap;
}

.article-meta a { color: var(--neon); text-decoration: none; }
.article-meta a:hover { text-decoration: underline; }

/* —— two-column article layout —— */
.article-copy { width: 100%; padding-bottom: 2rem; }

.article-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) var(--rail-width);
  gap: var(--article-gap);
  align-items: start;
}

.article-main {
  display: flex;
  flex-direction: column;
  gap: var(--article-gap);
  min-width: 0;
}

.article-rail {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  position: sticky;
  top: 0;
}

.rail-panel {
  padding: 0.85rem 0.9rem;
}

.rail-panel--accent {
  border-color: var(--neon-border);
  background: var(--neon-soft);
}

.rail-toc {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.rail-toc a {
  display: block;
  font-size: 0.72rem;
  font-weight: 500;
  color: var(--text);
  text-decoration: none;
  line-height: 1.35;
  padding: 0.2rem 0;
  border-bottom: 1px solid transparent;
}

.rail-toc a:hover { color: var(--neon); }

.rail-tip {
  margin: 0;
  font-size: 0.72rem;
  line-height: 1.5;
  color: #aaa;
}

/* —— learning panels —— */
.learn-intro,
.learn-section {
  padding: clamp(1rem, 2vw, 1.35rem);
}

.learn-section {
  scroll-margin-top: 1rem;
}

.learn-section > h2 {
  margin: 0 0 0.85rem;
  padding-bottom: 0.65rem;
  border-bottom: 1px solid var(--panel-border);
}

.learn-section > h3.learn-subhead,
.learn-section > h4.learn-subhead {
  margin: 0 0 0.75rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--panel-border);
}

.learn-section-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(0, 0.95fr);
  gap: clamp(1rem, 2.5vw, 1.75rem);
  align-items: center;
  margin-top: 0.85rem;
  min-height: min(100%, 420px);
}

.learn-section-grid--stripe {
  padding: clamp(0.65rem, 1.5vw, 0.85rem);
  border-radius: 6px;
  background:
    linear-gradient(135deg, rgba(0, 229, 255, 0.035) 0%, transparent 55%),
    rgba(255, 255, 255, 0.015);
}

.learn-section-grid--media-left {
  grid-template-columns: minmax(0, 0.95fr) minmax(0, 1.05fr);
}

.learn-section-grid:first-child,
.learn-section > h2 + .learn-section-grid {
  margin-top: 0;
}

.learn-section > h3.learn-subhead + .learn-section-grid,
.learn-section > h4.learn-subhead + .learn-section-grid {
  margin-top: 0;
}

.learn-section-grid + .learn-section-grid {
  margin-top: clamp(1.1rem, 2vw, 1.5rem);
}

.learn-section-copy {
  min-width: 0;
  align-self: stretch;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 0.65rem;
  padding: clamp(0.85rem, 1.8vw, 1.35rem) clamp(0.85rem, 1.8vw, 1.25rem);
  border-left: 2px solid var(--neon-border);
  background: linear-gradient(90deg, rgba(0, 229, 255, 0.05) 0%, transparent 72%);
  border-radius: 0 4px 4px 0;
}

.learn-section-grid--media-left .learn-section-copy {
  border-left: 0;
  border-right: 2px solid var(--neon-border);
  background: linear-gradient(270deg, rgba(0, 229, 255, 0.05) 0%, transparent 72%);
  border-radius: 4px 0 0 4px;
}

.learn-section-grid--stripe .learn-section-copy {
  border-left-color: rgba(255, 255, 255, 0.35);
  background: linear-gradient(90deg, rgba(255, 255, 255, 0.04) 0%, transparent 72%);
}

.learn-section-grid--stripe.learn-section-grid--media-left .learn-section-copy {
  border-right-color: rgba(255, 255, 255, 0.35);
  background: linear-gradient(270deg, rgba(255, 255, 255, 0.04) 0%, transparent 72%);
}

.learn-section-copy > :first-child {
  margin-top: 0;
}

.learn-section-copy > :last-child {
  margin-bottom: 0;
}

.learn-section-copy p,
.learn-section-copy li {
  font-size: 0.84rem;
  line-height: 1.75;
}

.learn-section-copy p:first-of-type {
  font-size: 0.9rem;
  color: #e8e8e8;
}

.learn-section-copy ul,
.learn-section-copy ol {
  margin: 0;
  padding-left: 1.15rem;
}

.learn-section-copy li + li {
  margin-top: 0.35rem;
}

.learn-section-copy strong {
  color: var(--white);
  font-weight: 600;
}

.learn-section-media {
  min-width: 0;
  align-self: stretch;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 0.75rem;
}

.learn-section-media > figure.article-media,
.learn-section-media > .embed-video,
.learn-section-media > video,
.learn-section-media > img {
  width: 100%;
  border-radius: 6px;
  overflow: hidden;
  border: 1px solid var(--neon-border);
  box-shadow:
    0 0 0 1px rgba(0, 229, 255, 0.08),
    0 18px 48px rgba(0, 0, 0, 0.45),
    0 0 32px rgba(0, 229, 255, 0.06);
  transform: translateY(0);
  transition: transform 0.25s ease, box-shadow 0.25s ease;
}

.learn-section-grid--stripe .learn-section-media > figure.article-media,
.learn-section-grid--stripe .learn-section-media > .embed-video,
.learn-section-grid--stripe .learn-section-media > video,
.learn-section-grid--stripe .learn-section-media > img {
  transform: translateY(-2px);
}

.learn-section-media > .embed-video {
  aspect-ratio: 16 / 9;
  position: relative;
  background: var(--black);
}

.learn-section-media > .embed-video iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
  display: block;
}

/* centered media when alone in a panel (no side-by-side grid) */
.learn-intro > figure.article-media,
.learn-intro > .embed-video,
.learn-intro > video,
.learn-intro > img,
.learn-section > figure.article-media,
.learn-section > .embed-video,
.learn-section > video,
.learn-section > img,
.media-stack {
  max-width: var(--media-max);
  width: 100%;
  margin-left: auto;
  margin-right: auto;
}

.learn-section-media figure.article-media,
.learn-section-media .embed-video,
.learn-section-media video,
.learn-section-media img {
  max-width: 100%;
  width: 100%;
  margin: 0;
}

.learn-section-full {
  margin-top: 0.85rem;
}

.learn-section-full:first-child {
  margin-top: 0;
}

.learn-section-full > figure.article-media,
.learn-section-full > .embed-video,
.learn-section-full > video,
.learn-section-full > img {
  max-width: var(--media-max);
  width: 100%;
  margin-left: auto;
  margin-right: auto;
}

.learn-callout {
  margin: 0 0 1rem;
  padding: 0.85rem 1rem;
  border-left: 3px solid var(--neon);
  background: var(--neon-soft);
  border-radius: 0 4px 4px 0;
  color: #ccc;
}

.learn-callout--note {
  border-left-color: var(--white);
  background: var(--panel-raised);
}

.learn-callout p { margin: 0; }

.learn-table-panel {
  padding: 0;
  overflow: hidden;
}

.learn-table-panel table { margin: 0; }

/* —— prose —— */
.prose h1 { display: none; }

.prose h2 {
  margin: 0 0 0.75rem;
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--white);
  letter-spacing: -0.02em;
}

.prose h3 {
  margin: 1.25rem 0 0.5rem;
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--neon);
}

.prose h4 {
  margin: 1rem 0 0.4rem;
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--white);
}

.prose p, .prose li {
  line-height: 1.65;
  color: #bdbdbd;
  font-size: 0.88rem;
}

.prose p { margin: 0 0 0.85rem; }
.prose p:last-child { margin-bottom: 0; }

.prose ul, .prose ol {
  padding-left: 0;
  margin: 0 0 0.85rem;
  list-style: none;
}

.prose li {
  margin-bottom: 0.45rem;
  padding-left: 0.85rem;
  border-left: 2px solid var(--panel-border);
}
.prose strong { color: var(--white); font-weight: 600; }

.prose a {
  color: var(--neon);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.prose a:hover { color: var(--white); }

.prose code {
  background: var(--code-bg);
  border: 1px solid var(--panel-border);
  padding: 0.1rem 0.3rem;
  font-size: 0.82em;
  color: var(--neon);
  border-radius: 3px;
}

.prose pre {
  background: var(--code-bg);
  border: 1px solid var(--panel-border);
  padding: 0.85rem 1rem;
  overflow-x: auto;
  margin: 0 0 0.85rem;
  border-radius: 4px;
}

.prose pre code { background: none; border: none; padding: 0; color: var(--text); }

.prose table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.8rem;
}

.prose th, .prose td {
  border: 1px solid var(--panel-border);
  padding: 0.5rem 0.6rem;
  text-align: left;
  vertical-align: top;
}

.prose th {
  background: var(--panel-raised);
  color: var(--white);
  font-weight: 600;
  font-size: 0.68rem;
}

/* —— media in panels —— */
.learn-section-media figure.article-media,
.learn-section-media .embed-video,
.learn-intro > figure.article-media,
.learn-intro > .embed-video,
.learn-section > figure.article-media,
.learn-section > .embed-video,
.prose figure.article-media,
.prose .embed-video {
  border-radius: 4px;
  overflow: hidden;
  border: 1px solid var(--panel-border);
}

.prose figure.article-media {
  margin: 0 auto 0.85rem;
  background: var(--panel-raised);
}

.prose figure.article-media img {
  display: block;
  width: 100%;
  height: auto;
  margin: 0;
  background: var(--black);
}

.prose figure.article-media figcaption {
  padding: 0.5rem 0.65rem;
  font-size: 0.65rem;
  color: var(--muted);
}

.prose .embed-video {
  margin: 0 auto 0.85rem;
  background: var(--black);
  aspect-ratio: 16 / 9;
  position: relative;
}

.prose .embed-video iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: none;
  display: block;
}

.prose video,
.prose img:not(figure img) {
  display: block;
  max-width: var(--media-max);
  width: 100%;
  margin: 0 auto 0.85rem;
  border-radius: 4px;
  border: 1px solid var(--panel-border);
}

.hint { color: var(--muted); font-size: 0.82rem; }

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

/* —— chat —— */
.chat-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.65rem;
  border-bottom: 1px solid var(--panel-border);
  background: rgba(0, 0, 0, 0.45);
  cursor: default;
}

.chat-head-main { min-width: 0; }

.chat-head-actions {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  flex-shrink: 0;
  padding-top: 0.15rem;
}

.chat-title-compact {
  margin: 0;
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--white);
}

.chat-toggle {
  width: 1.6rem;
  height: 1.6rem;
  padding: 0;
  border: 1px solid var(--panel-border);
  border-radius: 3px;
  background: var(--black);
  color: var(--neon);
  font: inherit;
  font-size: 1rem;
  line-height: 1;
  cursor: pointer;
}

.chat-toggle:hover {
  border-color: var(--neon-border);
  background: var(--neon-soft);
}

.chat-eyebrow {
  margin: 0 0 0.35rem;
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  color: var(--neon);
  text-shadow: 0 0 12px rgba(0, 229, 255, 0.45);
}

.chat-title {
  margin: 0;
  font-size: clamp(1.2rem, 2vw, 1.6rem);
  font-weight: 700;
  color: var(--white);
  letter-spacing: -0.03em;
}

.chat-lead {
  margin: 0.45rem 0 0;
  font-size: 0.78rem;
  line-height: 1.5;
  color: var(--muted);
}

.chat-lead--home {
  display: none;
  max-width: 36rem;
}

.chat-head-meta {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.35rem;
  text-align: right;
}

.chat-scope {
  font-size: 0.62rem;
  font-weight: 600;
  color: var(--white);
}

.chat-status {
  font-size: 0.58rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: var(--muted);
}

.chat-status--warn { color: #ffb4b4; }

.chat-log {
  flex: 1;
  min-height: 220px;
  overflow: auto;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  padding: 0.9rem 1rem;
  scrollbar-width: thin;
}

.chat-bubble {
  max-width: 88%;
  padding: 0.75rem 0.9rem;
  border-radius: 4px;
  font-size: 0.82rem;
  line-height: 1.55;
  word-break: break-word;
}

.chat-bubble--user {
  align-self: flex-end;
  background: var(--neon-soft);
  border: 1px solid var(--neon-border);
  color: #eaffff;
}

.chat-bubble--assistant {
  align-self: flex-start;
  background: var(--panel-raised);
  border: 1px solid var(--panel-border);
  color: var(--text);
}

.chat-bubble--assistant p {
  margin: 0 0 0.55rem;
}

.chat-bubble--assistant p:last-child {
  margin-bottom: 0;
}

.chat-bubble--assistant .chat-answer-title {
  font-size: 1.05rem;
  font-weight: 700;
  line-height: 1.35;
  color: var(--white);
  margin-bottom: 0.65rem;
}

.chat-turn--assistant {
  align-self: flex-start;
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  max-width: min(100%, 720px);
}

.chat-turn--assistant .chat-bubble {
  max-width: 100%;
}

.chat-media.hidden { display: none; }

.chat-media-label {
  margin: 0 0 0.4rem;
  font-size: 0.58rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--neon);
}

.chat-media-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 0.55rem;
}

.chat-figure {
  margin: 0;
  border: 1px solid var(--neon-border);
  border-radius: 4px;
  overflow: hidden;
  background: var(--black);
  box-shadow: 0 0 16px rgba(0, 229, 255, 0.08);
  animation: chatMediaIn 0.45s ease-out both;
  display: flex;
  flex-direction: column;
}

.chat-figure img {
  display: block;
  width: 100%;
  height: auto;
  max-height: 220px;
  object-fit: contain;
  background: var(--black);
}

.chat-figure-link {
  align-self: stretch;
  margin: 0.5rem 0.55rem 0.55rem;
  width: calc(100% - 1.1rem);
}

@keyframes chatMediaIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

.chat-bubble--error {
  border-color: rgba(255, 120, 120, 0.45);
  color: #ffd6d6;
}

.chat-bubble--fade-in {
  animation: chatAnswerIn 0.4s ease-out both;
}

@keyframes chatAnswerIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

.chat-bubble--typing .chat-cursor-inline {
  display: inline-block;
  width: 7px;
  height: 12px;
  margin-left: 3px;
  background: var(--neon);
  vertical-align: -2px;
  animation: chatCursor 0.9s steps(1, end) infinite;
}

.chat-inline-link {
  color: var(--neon);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.chat-inline-link:hover { color: var(--white); }

.chat-bubble.hidden { display: none; }

.chat-thinking {
  display: none;
  padding: 0;
  margin-top: 0.35rem;
  max-width: min(100%, 420px);
  align-self: flex-start;
}

.chat-thinking.is-active { display: block; }

.chat-think-panel {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.65rem 0.8rem;
  border: 1px solid var(--neon-border);
  border-radius: 4px;
  background: rgba(0, 0, 0, 0.45);
}

.chat-viewfinder {
  position: relative;
  flex-shrink: 0;
  width: 52px;
  height: 38px;
}

.chat-viewfinder-corner {
  position: absolute;
  width: 11px;
  height: 11px;
  border: 2px solid var(--neon);
  opacity: 0.9;
}

.chat-viewfinder-corner--tl { top: 0; left: 0; border-right: 0; border-bottom: 0; }
.chat-viewfinder-corner--tr { top: 0; right: 0; border-left: 0; border-bottom: 0; }
.chat-viewfinder-corner--bl { bottom: 0; left: 0; border-right: 0; border-top: 0; }
.chat-viewfinder-corner--br { bottom: 0; right: 0; border-left: 0; border-top: 0; }

.chat-focus-ring {
  position: absolute;
  inset: 9px 12px;
  border: 1px solid rgba(0, 229, 255, 0.45);
  border-radius: 50%;
  animation: chatFocusPulse 1.8s ease-in-out infinite;
}

.chat-shutter-dot {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 5px;
  height: 5px;
  margin: -2.5px 0 0 -2.5px;
  border-radius: 50%;
  background: var(--neon);
  box-shadow: 0 0 10px rgba(0, 229, 255, 0.65);
  animation: chatShutterBlink 1.8s ease-in-out infinite;
}

.chat-think-sub {
  margin: 0;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.03em;
  color: #9de8f2;
}

.chat-cursor {
  display: inline-block;
  width: 7px;
  height: 12px;
  margin-left: 4px;
  background: var(--neon);
  vertical-align: -2px;
  animation: chatCursor 0.9s steps(1, end) infinite;
  box-shadow: 0 0 10px rgba(0, 229, 255, 0.65);
}

.chat-form {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.55rem;
  padding: 0.85rem 1rem 1rem;
  border-top: 1px solid var(--panel-border);
  background: rgba(0, 0, 0, 0.35);
}

.chat-form input {
  min-width: 0;
  padding: 0.75rem 0.85rem;
  border: 1px solid var(--panel-border);
  border-radius: 4px;
  background: var(--black);
  color: var(--white);
  font: inherit;
  font-size: 0.82rem;
}

.chat-form input:focus {
  outline: none;
  border-color: var(--neon);
  box-shadow: 0 0 0 3px var(--neon-soft);
}

.chat-form button[type="submit"],
.chat-form .btn-neon {
  min-width: 5.5rem;
}

.chat-form button:disabled {
  opacity: 0.5;
  cursor: wait;
}

.chat-sources {
  padding: 0 1rem 0.85rem;
}

.chat-sources.hidden { display: none; }

.chat-sources-label {
  margin: 0 0 0.45rem;
  font-size: 0.58rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--muted);
}

.chat-source-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.chat-source {
  text-align: left;
}

.chat-side {
  padding: 0.9rem;
  align-self: stretch;
  border-left: 1px solid var(--panel-border);
  background: rgba(0, 0, 0, 0.25);
}

.chat-root--dock .chat-side {
  display: none;
}

.chat-quick {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.chat-chip {
  text-align: left;
  line-height: 1.4;
}

.chat-side-note {
  margin: 0.85rem 0 0;
  font-size: 0.65rem;
  line-height: 1.5;
  color: var(--muted);
}

@keyframes chatCursor {
  0%, 48% { opacity: 1; }
  49%, 100% { opacity: 0; }
}

@keyframes chatDots {
  0%, 100% { opacity: 0.25; }
  50% { opacity: 1; }
}

@keyframes chatFocusPulse {
  0%, 100% { transform: scale(0.9); opacity: 0.45; }
  50% { transform: scale(1); opacity: 1; }
}

@keyframes chatShutterBlink {
  0%, 100% { opacity: 0.35; transform: scale(0.85); }
  50% { opacity: 1; transform: scale(1); }
}

/* —— AI panel + FAB —— */
.chat-root--panel {
  flex: 1;
  min-height: 0;
  height: 100%;
  display: flex;
  flex-direction: column;
}

.chat-root--panel .chat-shell {
  flex: 1;
  min-height: 0;
  height: 100%;
  border: 0;
  border-radius: 0;
  box-shadow: none;
  display: flex;
  flex-direction: column;
}

.chat-root--panel .chat-head {
  flex-shrink: 0;
  padding: 0.85rem 1rem;
}

.chat-root--panel .chat-title {
  font-size: 1rem;
}

.chat-root--panel .chat-lead--home {
  display: none;
}

.chat-root--panel .chat-body {
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

.chat-root--panel .chat-layout,
.chat-root--panel .chat-main {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.chat-root--panel .chat-log {
  flex: 1;
  min-height: 0;
  max-height: none;
  overflow-y: auto;
  padding: 0.85rem 1rem;
}

.chat-root--panel .chat-compose {
  flex-shrink: 0;
  border-top: 1px solid var(--panel-border);
  padding: 0 1rem 0.65rem;
  background: rgba(0, 0, 0, 0.35);
}

.chat-root--panel .chat-form {
  padding: 0.55rem 0 0.65rem;
  border-top: 0;
  background: transparent;
}

.chat-root--panel .chat-compose-quick {
  padding-top: 0.55rem;
}

.chat-root--panel .chat-quick {
  flex-direction: row;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.chat-close {
  width: 1.6rem;
  height: 1.6rem;
  padding: 0;
  border: 1px solid var(--panel-border);
  border-radius: 3px;
  background: var(--black);
  color: var(--neon);
  font: inherit;
  font-size: 1.1rem;
  line-height: 1;
  cursor: pointer;
}

.chat-close:hover {
  border-color: var(--neon-border);
  background: var(--neon-soft);
}

.ai-fab {
  position: fixed;
  left: calc(var(--sidebar-width) + 1.25rem);
  right: auto;
  bottom: 1.25rem;
  z-index: 120;
}

body.is-ai-open .ai-fab {
  left: 1.25rem;
}

body.is-chat-home .ai-fab {
  display: none;
}

.ai-fab.btn-neon:hover:not(:disabled) {
  transform: translateY(-1px);
}
.manual-home {
  width: 100%;
  max-width: 920px;
  margin: 0 auto;
}

.welcome-home {
  padding: clamp(1.5rem, 3vw, 2.25rem);
  border-color: var(--neon-border);
  box-shadow: 0 0 40px rgba(0, 229, 255, 0.08);
  background:
    radial-gradient(ellipse 90% 60% at 0% 0%, rgba(0, 229, 255, 0.1), transparent 55%),
    var(--panel);
}

.welcome-home-eyebrow {
  margin: 0 0 0.5rem;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--neon);
}

.welcome-home-title {
  margin: 0 0 0.75rem;
  font-size: clamp(1.45rem, 3vw, 2rem);
  font-weight: 700;
  color: var(--white);
  letter-spacing: -0.03em;
  line-height: 1.15;
  text-shadow: 0 0 28px rgba(0, 229, 255, 0.15);
}

.welcome-home-lead {
  margin: 0 0 1.25rem;
  font-size: 0.92rem;
  line-height: 1.65;
  color: #a8a8a8;
  max-width: 42rem;
}

.welcome-home-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 0.65rem;
  margin-bottom: 1rem;
}

.welcome-home-card {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  padding: 0.85rem 0.95rem;
  text-decoration: none;
  background: rgba(0, 0, 0, 0.55);
  border: 3px solid var(--neon-border);
  border-radius: 4px;
  transition: border-color 0.15s, background 0.15s, transform 0.15s, box-shadow 0.15s;
  box-shadow: 0 0 16px rgba(0, 229, 255, 0.06);
}

.welcome-home-card:hover {
  border-color: var(--neon);
  background: var(--neon-soft);
  transform: translateY(-1px);
  box-shadow: 0 0 24px rgba(0, 229, 255, 0.18);
}

.welcome-home-card-title {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--neon);
  text-shadow: 0 0 12px rgba(0, 229, 255, 0.2);
}

.welcome-home-card-desc {
  font-size: 0.68rem;
  line-height: 1.45;
  color: var(--muted);
}

.welcome-home-foot {
  margin: 0;
  font-size: 0.78rem;
  color: var(--muted);
}

.welcome-home-foot a {
  color: var(--neon);
  text-decoration: none;
}

.welcome-home-foot a:hover {
  text-decoration: underline;
}

/* —— designs full width (no inline chat) —— */
.designs-home:not(.hidden) {
  display: block;
  width: 100%;
  min-height: 0;
}

.designs-home:not(.hidden) .designs-gallery {
  min-height: calc(100vh - 4.5rem);
}

body.is-home-view .main,
body.is-designs-view .main,
body.is-article-view .main {
  overflow-y: auto;
  padding-bottom: 5rem;
}

body.is-chat-home.is-home-view .main {
  overflow: hidden;
  padding-bottom: 0;
}

body.is-chat-home .welcome-home--below-chat {
  display: none;
}

body.is-home-view .content,
body.is-designs-view .content,
body.is-article-view .content {
  padding: var(--copy-pad);
}

.nav-link.hub {
  color: var(--neon);
  font-weight: 700;
}

.nav-link.guide {
  color: #bdbdbd;
}

/* —— responsive —— */
@media (max-width: 1024px) {
  .article-layout {
    grid-template-columns: 1fr;
  }

  .article-rail {
    position: static;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 0.65rem;
  }

  .learn-section-grid {
    grid-template-columns: 1fr;
    min-height: 0;
    align-items: stretch;
  }

  .learn-section-grid--media-left {
    grid-template-columns: 1fr;
  }

  .learn-section-copy {
    border-right: 0;
    border-left: 2px solid var(--neon-border);
    border-radius: 0 4px 4px 0;
  }

  .learn-section-grid--media-left .learn-section-copy {
    border-left: 2px solid var(--neon-border);
    border-right: 0;
    border-radius: 0 4px 4px 0;
  }

  .learn-section-media {
    order: -1;
  }

  .learn-section-grid--media-left .learn-section-media {
    order: -1;
  }

  .welcome-layout {
    grid-template-columns: 1fr;
  }

  .chat-layout {
    grid-template-columns: 1fr;
  }

  .chat-shell {
    min-height: 62vh;
    max-height: none;
  }

  .chat-side {
    position: static;
  }

  .designs-home:not(.hidden) {
    grid-template-columns: 1fr;
    grid-template-rows: minmax(280px, 38vh) minmax(0, 1fr);
  }

  .chat-designs-slot {
    border-right: 0;
    border-bottom: 1px solid var(--panel-border);
  }
}

@media (max-width: 900px) {
  .app { grid-template-columns: 1fr; }
  .sidebar { max-height: 42vh; }
  .ai-panel {
    position: fixed;
    inset: 0 auto 0 0;
    width: min(100vw, 360px);
    max-width: 100%;
    z-index: 200;
  }
  body.is-ai-open .sidebar { display: none; }
  .content { padding: 0.85rem; }
  .main-top-actions { gap: 0.35rem; }
  .btn-neon--compact { padding: 0.4rem 0.65rem; font-size: 0.62rem; border-width: 4px; }
  .welcome-grid { grid-template-columns: 1fr; }
  .article-hero-inner { grid-template-columns: 1fr; }

  .chat-layout {
    grid-template-columns: 1fr;
  }

  .chat-side--home {
    border-left: 0;
    border-top: 1px solid var(--panel-border);
  }

  .chat-dock-slot {
    left: 12px;
    width: calc(100vw - 24px);
  }

  .ai-fab {
    left: 1.25rem;
  }

  body.is-ai-open .ai-fab {
    left: 1.25rem;
  }
}

@media (min-width: 1400px) {
  :root {
    --rail-width: 280px;
  }
}
