/* ═══════════════════════════════════════════════
       RESET + DESIGN TOKENS
    ═══════════════════════════════════════════════ */
    *, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

    :focus-visible {
      outline: 2px solid var(--clr-primary);
      outline-offset: 2px;
    }

    :root {
      --clr-bg:         #000003;
      --clr-text:       #FAFAF8;
      --clr-primary:    #274CC0;
      --clr-primary-dk: #3a5fd4;
      --clr-muted:      #686A75;
      --clr-border:     rgba(255,255,255,0.07);
      --clr-surface:    rgba(255,255,255,0.04);
      --clr-ai-bubble:  rgba(255,255,255,0.05);
      --font:           'Plus Jakarta Sans', system-ui, -apple-system, sans-serif;
      --chat-w:         45%;
      --r-sm: 6px; --r-md: 10px; --r-lg: 14px;
      --shadow-sm: 0 1px 3px rgba(0,0,0,0.3), 0 1px 2px rgba(0,0,0,0.2);
      --shadow-md: 0 4px 16px rgba(0,0,0,0.4);
      --t: 0.18s ease;

      /* Semantic aliases */
      --bg-primary:   #000003;
      --bg-secondary: #0A0A10;
      --bg-tertiary:  rgba(255,255,255,0.04);
      --text-primary: #FAFAF8;
      --text-secondary: rgba(250,250,248,0.55);
      --accent:       var(--clr-primary);
      --accent-hover: var(--clr-primary-dk);
      --border:       rgba(255,255,255,0.07);
      --shadow:       rgba(0,0,0,0.3);
      --surface:      rgba(255,255,255,0.04);
    }

    html, body {
      height: 100%;
      font-family: var(--font);
      background: #000003;
      color: #FAFAF8;
      -webkit-font-smoothing: antialiased;
      -moz-osx-font-smoothing: grayscale;
      overflow: hidden;
    }


    /* ═══════════════════════════════════════════════
       AURORA BACKGROUND (animated, on #app)
    ═══════════════════════════════════════════════ */
    @property --aurora-x1 { syntax: '<percentage>'; inherits: false; initial-value: 20%; }
    @property --aurora-x2 { syntax: '<percentage>'; inherits: false; initial-value: 80%; }
    @property --aurora-y1 { syntax: '<percentage>'; inherits: false; initial-value: 15%; }
    @property --aurora-y2 { syntax: '<percentage>'; inherits: false; initial-value: 70%; }

    @keyframes aurora-shift {
      0%   { --aurora-x1: 20%; --aurora-x2: 80%; --aurora-y1: 15%; --aurora-y2: 70%; }
      25%  { --aurora-x1: 60%; --aurora-x2: 30%; --aurora-y1: 30%; --aurora-y2: 20%; }
      50%  { --aurora-x1: 80%; --aurora-x2: 20%; --aurora-y1: 60%; --aurora-y2: 40%; }
      75%  { --aurora-x1: 35%; --aurora-x2: 65%; --aurora-y1: 80%; --aurora-y2: 15%; }
      100% { --aurora-x1: 20%; --aurora-x2: 80%; --aurora-y1: 15%; --aurora-y2: 70%; }
    }

    #app::before {
      content: '';
      position: fixed;
      inset: 0;
      background:
        radial-gradient(ellipse 55% 45% at var(--aurora-x1) var(--aurora-y1), rgba(39,76,192,0.18), transparent 65%),
        radial-gradient(ellipse 50% 40% at var(--aurora-x2) var(--aurora-y2), rgba(99,102,241,0.12), transparent 60%),
        radial-gradient(ellipse 40% 35% at 50% 50%, rgba(8,145,178,0.08), transparent 55%),
        #000003;
      animation: aurora-shift 15s ease-in-out infinite;
      z-index: 0;
      pointer-events: none;
    }

    /* Dot-grid texture */
    #app::after {
      content: '';
      position: fixed;
      inset: 0;
      background-image: repeating-radial-gradient(circle at 0 0, rgba(255,255,255,0.02) 1px, transparent 1px);
      background-size: 28px 28px;
      z-index: 0;
      pointer-events: none;
    }

    #chat-panel {
      position: relative;
    }
    #chat-panel > * {
      position: relative;
      z-index: 1;
    }

    @media (prefers-reduced-motion: reduce) {
      #app::before { animation: none; }
    }
    /* Dark scrollbar */
    ::-webkit-scrollbar { width: 4px; }
    ::-webkit-scrollbar-track { background: transparent; }
    ::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.1); border-radius: 2px; }
    ::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,0.2); }

    /* ═══════════════════════════════════════════════
       APP SHELL
    ═══════════════════════════════════════════════ */
    #app {
      display: flex;
      justify-content: center;
      height: 100dvh;
      position: relative;
    }

    /* ═══════════════════════════════════════════════
       FULL-SCREEN INTAKE MODE
    ═══════════════════════════════════════════════ */
    body.intake-active #chat-panel {
      max-width: 100%;
      padding: 0;
    }
    body.intake-active .chat-header {
      display: none;
    }

    /* ═══════════════════════════════════════════════
       CHAT PANEL — centered, full-screen
    ═══════════════════════════════════════════════ */
    #chat-panel {
      width: 100%;
      max-width: 680px;
      display: flex;
      flex-direction: column;
      background: transparent;
      position: relative;
      z-index: 2;
      transition: max-width 0.5s cubic-bezier(0.4, 0, 0.2, 1);
    }

    /* Header */
    .chat-header {
      height: 56px;
      padding: 0 18px;
      display: flex;
      align-items: center;
      justify-content: space-between;
      border-bottom: 1px solid var(--clr-border);
      flex-shrink: 0;
    }

    .chat-logo {
      display: flex;
      align-items: center;
      gap: 7px;
      font-size: 14px;
      font-weight: 500;
      letter-spacing: -0.01em;
      user-select: none;
    }

    .chat-logo-mark {
      width: 24px;
      height: 24px;
      background: var(--clr-primary);
      border-radius: 7px;
      display: flex;
      align-items: center;
      justify-content: center;
      flex-shrink: 0;
    }

    .chat-restart {
      width: 32px;
      height: 32px;
      border-radius: var(--r-sm);
      border: 1px solid var(--clr-border);
      background: transparent;
      cursor: pointer;
      display: flex;
      align-items: center;
      justify-content: center;
      color: var(--clr-muted);
      flex-shrink: 0;
      transition: all var(--t);
    }
    .chat-restart:hover {
      background: rgba(255,255,255,0.08);
      border-color: rgba(255,255,255,0.2);
      color: var(--clr-text);
    }

    /* Messages */
    .chat-messages {
      flex: 1;
      overflow-y: auto;
      padding: 20px 16px 10px;
      display: flex;
      flex-direction: column;
      gap: 2px;
      scroll-behavior: smooth;
      scroll-padding-bottom: 80px;
    }
    .chat-messages::-webkit-scrollbar { width: 3px; }
    .chat-messages::-webkit-scrollbar-track { background: transparent; }
    .chat-messages::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.15); border-radius: 2px; }

    /* ── Message rows ── */
    .msg {
      display: flex;
      align-items: flex-end;
      gap: 8px;
      animation: msg-in 0.22s cubic-bezier(0.22,1,0.36,1) both;
    }
    .msg--user { flex-direction: row-reverse; }
    .msg + .msg { margin-top: 2px; }
    .msg--ai + .msg--user,
    .msg--user + .msg--ai { margin-top: 12px; }

    @keyframes msg-in {
      from { opacity: 0; transform: translateY(8px); }
      to   { opacity: 1; transform: translateY(0); }
    }

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

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

    @keyframes scaleIn {
      from { transform: scale(0.96); opacity: 0; }
      to   { transform: scale(1);    opacity: 1; }
    }

    /* ── Avatar ── */
    .msg__avatar {
      width: 28px;
      height: 28px;
      border-radius: 50%;
      background: var(--clr-primary);
      color: #fff;
      font-size: 11px;
      font-weight: 700;
      letter-spacing: 0;
      display: flex;
      align-items: center;
      justify-content: center;
      flex-shrink: 0;
      margin-bottom: 1px;
    }
    .msg__avatar--hidden { visibility: hidden; }

    /* ── Bubble ── */
    .msg__body {
      max-width: calc(100% - 80px);
      padding: 9px 13px;
      font-size: 13.5px;
      line-height: 1.55;
      letter-spacing: -0.01em;
      word-break: break-word;
    }
    .msg--ai  .msg__body {
      background: transparent;
      color: var(--clr-text);
      border-radius: 4px 14px 14px 14px;
    }
    .msg--user .msg__body {
      background: rgba(255,255,255,0.08);
      color: #fff;
      border-radius: 14px 4px 14px 14px;
    }

    /* ── Streaming cursor ── */
    .msg--ai.msg--streaming .msg__body::after {
      content: '|';
      animation: blink 0.7s step-end infinite;
      color: var(--clr-muted);
      margin-left: 1px;
    }
    @keyframes blink { 50% { opacity: 0; } }

    /* ── Typing indicator ── */
    .typing-dots {
      display: flex;
      align-items: center;
      gap: 4px;
      padding: 5px 2px;
    }
    .typing-dots span {
      display: block;
      width: 7px;
      height: 7px;
      border-radius: 50%;
      background: var(--clr-muted);
    }
    .typing-dots span:nth-child(1) { animation-delay:   0ms; }
    .typing-dots span:nth-child(2) { animation-delay: 160ms; }
    .typing-dots span:nth-child(3) { animation-delay: 320ms; }

    @keyframes dot-bounce {
      0%, 60%, 100% { transform: translateY(0);    opacity: 0.45; }
      30%            { transform: translateY(-5px); opacity: 1;    }
    }

    /* ── Chips ── */
    .chips-row {
      display: flex;
      flex-wrap: wrap;
      gap: 6px;
      padding: 6px 0 2px 36px;
      animation: msg-in 0.22s cubic-bezier(0.22,1,0.36,1) 0.1s both;
    }

    .chip {
      padding: 6px 13px;
      border-radius: 100px;
      border: 1px solid var(--clr-border);
      background: var(--clr-bg);
      color: var(--clr-text);
      font-family: var(--font);
      font-size: 13px;
      font-weight: 600;
      cursor: pointer;
      white-space: nowrap;
      animation: chip-in 0.22s cubic-bezier(0.22,1,0.36,1) both;
      transition: border-color var(--t), color var(--t), background var(--t);
    }
    .chip:nth-child(1) { animation-delay:   0ms; }
    .chip:nth-child(2) { animation-delay:  50ms; }
    .chip:nth-child(3) { animation-delay: 100ms; }
    .chip:nth-child(4) { animation-delay: 150ms; }
    .chip:hover {
      border-color: var(--clr-primary);
      color: var(--clr-primary);
      background: rgba(39,76,192,0.05);
    }
    .chip--other { color: var(--clr-muted); border-style: dashed; }

    @keyframes chips-exit {
      from { transform: scale(1); opacity: 1; }
      to   { transform: scale(0.92); opacity: 0; }
    }
    .chips-row--exit {
      animation: chips-exit 0.15s ease-in forwards;
      pointer-events: none;
    }

    /* ── Palette picker ── */
    .palette-row {
      display: flex;
      gap: 10px;
      flex-wrap: wrap;
      padding: 8px 0 2px 36px;
      animation: msg-in 0.22s cubic-bezier(0.22,1,0.36,1) 0.1s both;
    }
    .palette-card {
      display: flex;
      flex-direction: column;
      align-items: center;
      gap: 8px;
      padding: 12px 16px;
      border-radius: 12px;
      border: 1.5px solid var(--clr-border);
      background: var(--clr-surface, var(--clr-bg));
      cursor: pointer;
      transition: border-color 0.2s, transform 0.15s;
      animation: chip-in 0.22s cubic-bezier(0.22,1,0.36,1) both;
      font-family: var(--font);
      min-width: 100px;
    }
    .palette-card:nth-child(1) { animation-delay:   0ms; }
    .palette-card:nth-child(2) { animation-delay:  80ms; }
    .palette-card:nth-child(3) { animation-delay: 160ms; }
    .palette-card:nth-child(4) { animation-delay: 240ms; }
    .palette-card:nth-child(5) { animation-delay: 320ms; }
    .palette-card:hover {
      border-color: var(--clr-primary);
      transform: translateY(-2px);
    }
    .palette-swatches {
      display: flex;
      gap: 5px;
    }
    .palette-dot {
      width: 28px;
      height: 28px;
      border-radius: 50%;
      border: 1px solid rgba(255,255,255,0.08);
      box-shadow: 0 1px 3px rgba(0,0,0,0.15);
      flex-shrink: 0;
    }
    .palette-name {
      font-size: 12px;
      color: var(--clr-text);
      font-weight: 600;
      white-space: nowrap;
      text-align: center;
    }
    .palette-card--custom {
      border-style: dashed;
      justify-content: center;
      min-height: 60px;
    }
    .palette-card--custom .palette-name {
      color: var(--clr-muted);
      font-size: 13px;
    }

    /* ── System message ── */
    .msg--system {
      display: flex;
      justify-content: center;
      margin: 6px 0;
      animation: msg-in 0.2s ease both;
    }
    .msg--system span {
      padding: 3px 10px;
      border-radius: 100px;
      background: var(--clr-surface);
      border: 1px solid var(--clr-border);
      color: var(--clr-muted);
      font-size: 11.5px;
      font-weight: 500;
    }

    /* ── Input bar (premium floating style) ── */
    .chat-input-bar {
      padding: 10px 10px 10px 16px;
      margin: 0 16px 20px;
      margin-bottom: calc(20px + env(safe-area-inset-bottom));
      display: flex;
      align-items: flex-end;
      gap: 6px;
      background: rgba(255,255,255,0.05);
      backdrop-filter: blur(16px);
      -webkit-backdrop-filter: blur(16px);
      border: 1px solid rgba(255,255,255,0.08);
      border-radius: 20px;
      box-shadow: 0 4px 24px rgba(0,0,0,0.3);
      flex-shrink: 0;
    }

    .input-btn {
      width: 34px;
      height: 34px;
      border-radius: 50%;
      border: 1px solid var(--clr-border);
      background: transparent;
      cursor: pointer;
      display: flex;
      align-items: center;
      justify-content: center;
      color: var(--clr-muted);
      flex-shrink: 0;
      transition: all var(--t), opacity 150ms;
    }
    .input-btn:hover { background: rgba(255,255,255,0.08); color: var(--clr-text); opacity: 0.7; }

    .input-btn--send {
      border: none;
      background: var(--clr-primary);
      color: #fff;
      transition: background var(--t), transform 0.12s ease, box-shadow var(--t), opacity 0s;
    }
    .input-btn--send:hover {
      background: var(--clr-primary-dk);
      box-shadow: 0 2px 10px rgba(39,76,192,0.3);
      transform: scale(1.05);
      opacity: 1;
    }
    .input-btn--send:active { transform: scale(0.95); }
    .input-btn--send:disabled { background: rgba(255,255,255,0.12); cursor: not-allowed; transform: none; box-shadow: none; }

    .input-field { flex: 1; }

    #chat-input {
      display: block;
      width: 100%;
      min-height: 34px;
      max-height: 120px;
      padding: 7px 0;
      border: none;
      border-radius: 0;
      font-family: var(--font);
      font-size: 14px;
      line-height: 1.5;
      color: var(--clr-text);
      background: transparent;
      resize: none;
      outline: none;
      overflow-y: auto;
    }
    #chat-input:focus {
      border-color: transparent;
      box-shadow: none;
    }
    #chat-input::placeholder { color: rgba(250,250,248,0.3); }

    /* ═══════════════════════════════════════════════
       PREVIEW PANEL — 55%
    ═══════════════════════════════════════════════ */
    #preview-panel {
      flex: 1;
      display: none;
      flex-direction: column;
      background: #0A0A10;
      overflow: hidden;
      box-shadow: -1px 0 0 var(--border);
    }

    /* Toolbar */
    .preview-toolbar {
      height: 56px;
      border-bottom: 1px solid var(--clr-border);
      background: #000003;
      display: none;
      align-items: center;
      justify-content: center;
      flex-shrink: 0;
    }

    .view-toggle {
      display: flex;
      background: rgba(255,255,255,0.04);
      border: 1px solid var(--clr-border);
      border-radius: var(--r-sm);
      padding: 2px;
      gap: 2px;
    }

    .view-btn {
      display: flex;
      align-items: center;
      gap: 5px;
      padding: 5px 12px;
      border-radius: 4px;
      border: none;
      background: transparent;
      font-family: var(--font);
      font-size: 12.5px;
      font-weight: 500;
      color: var(--clr-muted);
      cursor: pointer;
      transition: all var(--t);
    }
    .view-btn.active {
      background: var(--accent);
      color: #fff;
      box-shadow: var(--shadow-sm);
    }
    .view-btn svg { opacity: 0.55; transition: opacity var(--t); }
    .view-btn.active svg { opacity: 1; }

    .viewport-width-indicator {
      font-size: 11px;
      font-weight: 500;
      color: var(--clr-muted);
      opacity: 0.5;
      font-family: var(--font-mono, 'SF Mono', 'Fira Code', monospace);
      margin-left: 8px;
      letter-spacing: 0.02em;
    }

    /* Scale area */
    #preview-scale-area {
      flex: 1;
      overflow: hidden;
      display: flex;
      justify-content: center;
      align-items: flex-start;
      padding-top: 20px;
    }

    #preview-scale-wrapper {
      transform-origin: top center;
      flex-shrink: 0;
    }

    /* Preview frame — wraps chrome bar + site DOM for unified shadow */
    #preview-frame {
      border-radius: 8px 8px 0 0;
      overflow: hidden;
      box-shadow: 0 8px 48px rgba(0,0,0,0.14), 0 2px 8px rgba(0,0,0,0.06);
    }

    /* Mock browser chrome bar (P4) */
    .browser-chrome {
      height: 28px;
      background: #1A1A24;
      display: flex;
      align-items: center;
      padding: 0 10px;
      gap: 8px;
      border-bottom: 1px solid rgba(255,255,255,0.08);
    }
    .bc-dots { display: flex; gap: 5px; align-items: center; }
    .bc-dot  { width: 10px; height: 10px; border-radius: 50%; }
    .bc-dot--red    { background: #FF5F57; }
    .bc-dot--yellow { background: #FFBD2E; }
    .bc-dot--green  { background: #28CA41; }
    .bc-url {
      flex: 1;
      background: rgba(255,255,255,0.06);
      border-radius: 4px;
      height: 16px;
      font-size: 10px;
      color: rgba(250,250,248,0.4);
      display: flex;
      align-items: center;
      justify-content: center;
      font-family: var(--font);
      border: 1px solid rgba(255,255,255,0.08);
    }

    /* Preview root — the 1440px (or 390px) site DOM */
    #preview-root {
      width: 1440px;
      background: #ffffff;
      overflow: hidden;
    }
    #preview-root.mobile-view { width: 390px; }
    #preview-root.tablet-view  { width: 768px; }

    /* ═══════════════════════════════════════════════
       SKELETON SHIMMER
    ═══════════════════════════════════════════════ */
    @keyframes shimmer {
      0%   { background-position: -200% 0; }
      100% { background-position:  200% 0; }
    }

    /* Light shimmer (white sections) */
    .sk {
      background: linear-gradient(90deg, #e0e0e0 25%, #f0f0f0 50%, #e0e0e0 75%);
      background-size: 200% 100%;
      border-radius: 4px;
    }

    /* Dark shimmer (footer) */
    .sk-dk {
      background: linear-gradient(90deg,
        rgba(255,255,255,0.07) 25%,
        rgba(255,255,255,0.15) 50%,
        rgba(255,255,255,0.07) 75%);
      background-size: 200% 100%;
      border-radius: 4px;
    }

    /* ── Header ── */
    .sk-header {
      height: 72px;
      padding: 0 80px;
      display: flex;
      align-items: center;
      justify-content: space-between;
      border-bottom: 1px solid #F3F4F6;
      background: #fff;
    }
    .sk-hdr-logo  { width: 120px; height: 28px; }
    .sk-hdr-nav   { display: flex; gap: 24px; align-items: center; }
    .sk-hdr-link  { width: 54px;  height: 14px; }
    .sk-hdr-cta   { width: 100px; height: 36px; border-radius: 8px; }

    /* ── Hero ── */
    .sk-hero {
      min-height: 480px;
      padding: 96px 80px;
      background: #F7F8FA;
      display: flex;
      flex-direction: column;
      justify-content: center;
      gap: 16px;
    }
    .sk-hero-eye  { width: 96px;  height: 13px; }
    .sk-hero-h1   { width: 560px; height: 60px; border-radius: 5px; }
    .sk-hero-h1b  { width: 380px; height: 60px; border-radius: 5px; }
    .sk-hero-sub  { width: 360px; height: 17px; margin-top: 8px; }
    .sk-hero-sub2 { width: 280px; height: 17px; }
    .sk-hero-btns { display: flex; gap: 12px; margin-top: 12px; }
    .sk-hero-btn  { width: 144px; height: 48px; border-radius: 10px; }
    .sk-hero-btn2 { width: 120px; height: 48px; border-radius: 10px; opacity: 0.45; }

    /* ── About ── */
    .sk-about {
      display: grid;
      grid-template-columns: 1fr 1fr;
      gap: 80px;
      padding: 80px 80px;
      align-items: center;
      background: #fff;
    }
    .sk-about-text { display: flex; flex-direction: column; gap: 14px; }
    .sk-abt-lbl  { width: 72px;  height: 12px; }
    .sk-abt-h2   { width: 100%;  height: 40px; border-radius: 5px; }
    .sk-abt-h2b  { width: 72%;   height: 40px; border-radius: 5px; }
    .sk-abt-p    { width: 100%;  height: 14px; }
    .sk-abt-p2   { width: 88%;   height: 14px; }
    .sk-abt-p3   { width: 76%;   height: 14px; }
    .sk-abt-img  { aspect-ratio: 4/3; border-radius: 10px; }

    /* ── Services ── */
    .sk-services {
      padding: 80px 80px;
      background: #F9FAFB;
    }
    .sk-svc-hd   { display: flex; flex-direction: column; align-items: center; gap: 12px; margin-bottom: 48px; }
    .sk-svc-h2   { width: 260px; height: 40px; border-radius: 5px; }
    .sk-svc-sub  { width: 360px; height: 15px; }
    .sk-svc-grid { display: grid; grid-template-columns: repeat(3,1fr); gap: 24px; }
    .sk-card {
      background: #fff;
      border-radius: 12px;
      padding: 28px;
      display: flex;
      flex-direction: column;
      gap: 12px;
      box-shadow: 0 1px 4px rgba(0,0,0,0.05);
    }
    .sk-card-icon { width: 44px; height: 44px; border-radius: 10px; }
    .sk-card-name { width: 110px; height: 19px; border-radius: 3px; }
    .sk-card-d    { width: 100%;  height: 13px; border-radius: 3px; }
    .sk-card-d2   { width: 84%;   height: 13px; border-radius: 3px; }
    .sk-card-d3   { width: 92%;   height: 13px; border-radius: 3px; }

    /* ── Team ── */
    .sk-team {
      padding: 80px 80px;
      background: #fff;
    }
    .sk-team-hd   { display: flex; flex-direction: column; align-items: center; gap: 12px; margin-bottom: 48px; }
    .sk-tm-h2     { width: 220px; height: 40px; border-radius: 5px; }
    .sk-tm-sub    { width: 320px; height: 15px; }
    .sk-team-grid { display: grid; grid-template-columns: repeat(3,1fr); gap: 28px; }
    .sk-team-card { display: flex; flex-direction: column; align-items: center; gap: 12px; }
    .sk-tm-photo  { width: 100%; aspect-ratio: 1/1; border-radius: 12px; }
    .sk-tm-name   { width: 100px; height: 16px; border-radius: 3px; }
    .sk-tm-title  { width: 140px; height: 13px; border-radius: 3px; }

    /* ── Contact ── */
    .sk-contact {
      display: grid;
      grid-template-columns: 1fr 1fr;
      gap: 80px;
      padding: 80px 80px;
      background: #fff;
    }
    .sk-cnt-info  { display: flex; flex-direction: column; gap: 16px; }
    .sk-cnt-h2    { width: 200px; height: 36px; border-radius: 5px; }
    .sk-cnt-line  { width: 100%;  height: 14px; }
    .sk-cnt-line2 { width: 72%;   height: 14px; }
    .sk-cnt-form  { display: flex; flex-direction: column; gap: 12px; }
    .sk-frm-fld   { width: 100%;  height: 44px; border-radius: 8px; }
    .sk-frm-area  { width: 100%;  height: 100px; border-radius: 8px; }
    .sk-frm-btn   { width: 140px; height: 44px; border-radius: 8px; }

    /* ── Footer ── */
    .sk-footer {
      background: #1F2937;
      padding: 56px 80px 48px;
    }
    .sk-ftr-grid { display: grid; grid-template-columns: 2fr 1fr 1fr 1fr; gap: 40px; }
    .sk-ftr-col  { display: flex; flex-direction: column; gap: 12px; }
    .sk-ftr-logo { width: 96px;  height: 20px; }
    .sk-ftr-tag  { width: 80%;   height: 13px; }
    .sk-ftr-tag2 { width: 56%;   height: 13px; }
    .sk-ftr-hd   { width: 72px;  height: 14px; margin-bottom: 4px; }
    .sk-ftr-lk   { width: 100%;  height: 12px; }
    .sk-ftr-lk2  { width: 80%;   height: 12px; }
    .sk-ftr-lk3  { width: 64%;   height: 12px; }

    /* ═══════════════════════════════════════════════
       MOBILE FAB
    ═══════════════════════════════════════════════ */
    #mobile-fab {
      display: none;
      position: fixed;
      bottom: calc(20px + env(safe-area-inset-bottom));
      right: 20px;
      width: 48px;
      height: 48px;
      border-radius: 50%;
      border: none;
      background: var(--clr-primary);
      color: #fff;
      cursor: pointer;
      box-shadow: 0 4px 20px rgba(39,76,192,0.38), 0 2px 8px rgba(0,0,0,0.12);
      align-items: center;
      justify-content: center;
      z-index: 100;
      transition: transform var(--t);
    }
    #mobile-fab:active { transform: scale(0.91); }

    /* ═══════════════════════════════════════════════
       RESPONSIVE — mobile < 900px
    ═══════════════════════════════════════════════ */
    @media (max-width: 899px) {
      :root { --chat-w: 100%; }
      #chat-panel { max-width: 100%; padding: 0 4px; }
      #preview-panel { display: none; }
      #mobile-fab { display: none; } /* hidden until Phase 2 */

      /* Mobile preview overlay — toggled via body.preview-open class in Phase 2 */
      body.site-generated #mobile-fab { display: flex; }
      body.preview-open #chat-panel { display: none; }
      body.preview-open #preview-panel {
        display: flex !important;
        position: fixed;
        inset: 0;
        z-index: 50;
        flex-direction: column;
        background: #0A0A10;
        overflow: auto;
      }
    }

    /* ── Error bubble ── */
    .msg--error {
      display: flex;
      justify-content: center;
      margin: 8px 0;
      animation: msg-in 0.22s cubic-bezier(0.22,1,0.36,1) both;
    }
    .msg--error p {
      padding: 9px 14px;
      border-radius: var(--r-md);
      background: rgba(153,27,27,0.15);
      border: 1px solid rgba(254,202,202,0.2);
      color: #FCA5A5;
      font-size: 13.5px;
      line-height: 1.5;
    }
    .msg--error button {
      margin-left: 8px;
      background: none;
      border: none;
      color: var(--clr-primary);
      font-family: var(--font);
      font-size: 13.5px;
      font-weight: 600;
      cursor: pointer;
      padding: 0;
    }
    .msg--error button:hover { text-decoration: underline; }

    /* ── Confidence bar ── */
    #confidence-bar-wrap {
      height: 3px;
      background: rgba(255,255,255,0.05);
      flex-shrink: 0;
      overflow: hidden;
    }

    #confidence-bar {
      height: 100%;
      width: 0%;
      background: rgba(255,255,255,0.2);
      transition: width 0.8s cubic-bezier(0.4, 0, 0.2, 1), background-color 0.6s ease;
    }

    /* Color thresholds set via JS */
    #confidence-bar[data-level="mid"]  { background: var(--clr-primary); }
    #confidence-bar[data-level="high"] { background: #22C55E; }

    /* ── Summary card ── */
    .msg--summary-card {
      margin: 16px 0 8px;
      animation: summary-in 0.3s cubic-bezier(0.22,1,0.36,1) both;
    }

    @keyframes summary-in {
      from { opacity: 0; transform: translateY(8px); }
      to   { opacity: 1; transform: translateY(0); }
    }

    .summary-card {
      background: rgba(255,255,255,0.04);
      border: 1px solid rgba(255,255,255,0.07);
      border-radius: 16px;
      padding: 24px;
      width: 100%;
    }

    .summary-header {
      display: flex;
      align-items: center;
      gap: 10px;
      margin-bottom: 16px;
      flex-wrap: wrap;
    }

    .summary-header h3 {
      font-size: 20px;
      font-weight: 600;
      color: var(--clr-text);
      margin: 0;
      line-height: 1.2;
    }

    .summary-industry {
      display: inline-flex;
      align-items: center;
      padding: 4px 12px;
      background: var(--clr-primary);
      color: #fff;
      font-size: 12px;
      font-weight: 500;
      border-radius: 12px;
      white-space: nowrap;
    }

    .summary-fields {
      display: grid;
      grid-template-columns: 1fr 1fr;
      gap: 12px 16px;
      margin-bottom: 20px;
    }

    @media (max-width: 899px) {
      .summary-fields { grid-template-columns: 1fr; }
    }

    .summary-field {
      display: flex;
      flex-direction: column;
      gap: 2px;
    }

    .summary-field.summary-field--wide {
      grid-column: 1 / -1;
    }

    .summary-pills {
      display: flex;
      flex-wrap: wrap;
      gap: 6px;
      margin-top: 4px;
    }

    .summary-pill {
      display: inline-flex;
      align-items: center;
      padding: 3px 10px;
      background: rgba(255,255,255,0.07);
      border: 1px solid rgba(255,255,255,0.12);
      border-radius: 20px;
      font-size: 12px;
      color: var(--clr-text);
      font-weight: 500;
    }

    .field-label {
      font-size: 12px;
      color: var(--clr-muted);
      font-weight: 500;
      text-transform: uppercase;
      letter-spacing: 0.04em;
    }

    .field-value {
      font-size: 14px;
      color: var(--clr-text);
      line-height: 1.5;
    }

    .field-value ul {
      margin: 0;
      padding: 0;
      list-style: none;
      display: flex;
      flex-direction: column;
      gap: 2px;
    }

    .field-value ul li::before {
      content: '· ';
      color: var(--clr-muted);
    }

    .summary-actions {
      display: flex;
      gap: 10px;
      flex-wrap: wrap;
    }

    .btn-build {
      flex: 1;
      min-width: 140px;
      padding: 14px 28px;
      background: var(--clr-primary);
      color: #fff;
      border: none;
      border-radius: 12px;
      font-family: var(--font);
      font-size: 16px;
      font-weight: 600;
      cursor: pointer;
      transition: background var(--t), box-shadow var(--t);
    }
    .btn-build:hover {
      background: var(--clr-primary-dk);
      box-shadow: 0 2px 10px rgba(39,76,192,0.3);
    }

    .btn-more {
      flex: 1;
      min-width: 140px;
      padding: 14px 28px;
      background: transparent;
      color: var(--clr-primary);
      border: 1px solid var(--clr-primary);
      border-radius: 12px;
      font-family: var(--font);
      font-size: 16px;
      font-weight: 600;
      cursor: pointer;
      transition: background var(--t);
    }
    .btn-more:hover { background: rgba(39,76,192,0.05); }

    /* Input disabled state when in READY phase */
    #chat-input:disabled {
      background: rgba(255,255,255,0.02);
      color: rgba(250,250,248,0.3);
      cursor: not-allowed;
    }

    /* ═══════════════════════════════════════════════
       PREVIEW POPULATED SECTIONS (pvw-*)
       Replaces skeleton classes when section activates
    ═══════════════════════════════════════════════ */

    /* ── Header ── */
    .pvw-section--header {
      height: 80px;
      padding: 0 80px;
      display: flex;
      align-items: center;
      background: #fff;
      border-bottom: 1px solid #F3F4F6;
      gap: 0;
    }
    .pvw-logo {
      font-size: 20px;
      font-weight: 700;
      letter-spacing: -0.02em;
      color: #000003;
      flex: 1;
    }
    .pvw-nav {
      display: flex;
      gap: 32px;
      margin-right: 40px;
    }
    .pvw-nav span {
      font-size: 14px;
      color: #4B5563;
      cursor: pointer;
      white-space: nowrap;
    }
    .pvw-btn-sm {
      padding: 9px 20px;
      background: #274CC0;
      color: #fff;
      font-size: 13px;
      font-weight: 600;
      border-radius: 8px;
      cursor: pointer;
      white-space: nowrap;
      flex-shrink: 0;
    }

    /* ── Hero ── */
    .pvw-section--hero {
      min-height: 480px;
      padding: 96px 80px;
      background: linear-gradient(135deg, #F0F4FF 0%, #E8EEFF 100%);
      display: flex;
      flex-direction: column;
      justify-content: center;
    }
    .pvw-hero-eye {
      display: block;
      font-size: 12px;
      font-weight: 700;
      text-transform: uppercase;
      letter-spacing: 0.08em;
      color: #274CC0;
      margin-bottom: 12px;
    }
    .pvw-hero-h1 {
      font-size: 48px;
      font-weight: 700;
      line-height: 1.15;
      letter-spacing: -0.03em;
      color: #000003;
      max-width: 720px;
      margin-bottom: 20px;
    }
    .pvw-hero-sub {
      font-size: 18px;
      color: #4B5563;
      max-width: 560px;
      line-height: 1.6;
      margin-bottom: 32px;
    }
    .pvw-hero-btns {
      display: flex;
      gap: 12px;
      align-items: center;
    }
    .pvw-btn-primary {
      padding: 14px 28px;
      background: #274CC0;
      color: #fff;
      font-size: 15px;
      font-weight: 600;
      border-radius: 10px;
      cursor: pointer;
      display: inline-block;
    }
    .pvw-btn-ghost {
      padding: 13px 28px;
      border: 1.5px solid #D1D5DB;
      color: #374151;
      font-size: 15px;
      font-weight: 500;
      border-radius: 10px;
      cursor: pointer;
      display: inline-block;
    }

    /* ── Shared typography ── */
    .pvw-section-label {
      font-size: 11px;
      font-weight: 700;
      text-transform: uppercase;
      letter-spacing: 0.08em;
      color: #274CC0;
      margin-bottom: 10px;
    }
    .pvw-section-h2 {
      font-size: 36px;
      font-weight: 700;
      letter-spacing: -0.02em;
      color: #000003;
      line-height: 1.2;
      margin-bottom: 16px;
    }
    .pvw-body-text {
      font-size: 15px;
      color: #4B5563;
      line-height: 1.7;
    }

    /* ── About ── */
    .pvw-section--about {
      display: grid;
      grid-template-columns: 1fr 1fr;
      gap: 80px;
      padding: 80px;
      align-items: center;
      background: #fff;
    }
    .pvw-about-text { display: flex; flex-direction: column; }
    .pvw-about-img {
      aspect-ratio: 4/3;
      background: #F3F4F6;
      border-radius: 12px;
    }

    /* ── Services ── */
    .pvw-section--services {
      padding: 80px;
      background: #F9FAFB;
    }
    .pvw-services-hd {
      text-align: center;
      margin-bottom: 48px;
    }
    .pvw-services-hd .pvw-section-h2 { margin-bottom: 0; }
    .pvw-cards-grid {
      display: grid;
      grid-template-columns: repeat(3, 1fr);
      gap: 24px;
    }
    .pvw-card {
      background: #fff;
      border-radius: 12px;
      padding: 28px;
      border: 1px solid #F3F4F6;
      box-shadow: 0 1px 4px rgba(0,0,0,0.05);
    }
    .pvw-card-icon {
      width: 44px;
      height: 44px;
      background: rgba(39,76,192,0.1);
      border-radius: 10px;
      margin-bottom: 14px;
    }
    .pvw-card-title {
      font-size: 17px;
      font-weight: 600;
      color: #000003;
      margin-bottom: 8px;
    }
    .pvw-card-desc {
      font-size: 13.5px;
      color: #4B5563;
      line-height: 1.6;
    }
    .pvw-card-price {
      font-size: 14px;
      font-weight: 600;
      color: #274CC0;
      margin-top: 10px;
    }

    /* ── Team ── */
    .pvw-section--team {
      padding: 80px;
      background: #fff;
    }
    .pvw-team-grid {
      display: grid;
      grid-template-columns: repeat(3, 1fr);
      gap: 28px;
    }
    .pvw-team-card { text-align: center; }
    .pvw-team-photo {
      width: 100%;
      aspect-ratio: 1/1;
      background: #F0F2F5;
      border-radius: 12px;
      margin-bottom: 12px;
    }
    .pvw-team-name {
      font-size: 16px;
      font-weight: 600;
      color: #000003;
      margin-bottom: 4px;
    }
    .pvw-team-role {
      font-size: 13px;
      color: #6B7280;
    }

    /* ── Contact ── */
    .pvw-section--contact {
      display: grid;
      grid-template-columns: 1fr 1fr;
      gap: 80px;
      padding: 80px;
      background: #fff;
    }
    .pvw-section--contact .pvw-section-h2 { margin-bottom: 24px; }
    .pvw-contact-info { display: flex; flex-direction: column; }
    .pvw-contact-row {
      display: flex;
      flex-direction: column;
      gap: 3px;
      padding: 14px 0;
      border-bottom: 1px solid #F3F4F6;
    }
    .pvw-contact-label {
      font-size: 11px;
      text-transform: uppercase;
      letter-spacing: 0.06em;
      color: #9CA3AF;
      font-weight: 600;
    }
    .pvw-contact-row span:last-child {
      font-size: 14px;
      color: #000003;
    }
    .pvw-contact-form {
      display: flex;
      flex-direction: column;
      gap: 12px;
    }
    .pvw-form-field {
      height: 44px;
      background: #F9FAFB;
      border: 1px solid #E5E7EB;
      border-radius: 8px;
    }
    .pvw-form-area {
      height: 100px;
      background: #F9FAFB;
      border: 1px solid #E5E7EB;
      border-radius: 8px;
    }
    .pvw-form-btn {
      padding: 12px 24px;
      background: #274CC0;
      color: #fff;
      font-size: 14px;
      font-weight: 600;
      border-radius: 8px;
      display: inline-block;
      align-self: flex-start;
      cursor: pointer;
    }

    /* ── Footer ── */
    .pvw-section--footer {
      background: #1F2937;
      padding: 48px 80px;
    }
    .pvw-footer-inner {
      display: flex;
      flex-direction: column;
      gap: 20px;
    }
    .pvw-footer-brand {
      display: flex;
      align-items: center;
      gap: 24px;
    }
    .pvw-footer-logo {
      font-size: 18px;
      font-weight: 700;
      letter-spacing: -0.02em;
      color: #fff;
    }
    .pvw-footer-socials { display: flex; gap: 16px; }
    .pvw-social {
      font-size: 13px;
      color: #9CA3AF;
      cursor: pointer;
    }
    .pvw-footer-copy {
      font-size: 13px;
      color: #6B7280;
    }

    /* ── Unsplash image credits ── */
    .unsplash-credit a { color: inherit; text-decoration: underline; }
    .unsplash-credit a:hover { opacity: 0.8; }
    [data-preview-section="hero"] { transition: background-image 0.5s ease; min-height: 400px; }



    /* ── Mobile preview close button ── */
    .mobile-preview-close {
      display: none;
      position: absolute;
      top: 12px;
      right: 12px;
      width: 32px;
      height: 32px;
      border-radius: 50%;
      border: 1px solid var(--border);
      background: var(--bg-primary);
      color: var(--text-secondary);
      font-size: 18px;
      line-height: 1;
      cursor: pointer;
      align-items: center;
      justify-content: center;
      z-index: 10;
    }

    /* ═══════════════════════════════════════════════
       RESPONSIVE — 767px and below (phones)
    ═══════════════════════════════════════════════ */

    /* ── Build button — done/coming-soon state ── */
    .btn-build--done {
      background: #10B981 !important;
      cursor: default;
      opacity: 0.92;
      animation: pulse-done 1.4s ease infinite;
    }
    @keyframes pulse-done {
      0%, 100% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.4); }
      50%       { box-shadow: 0 0 0 8px rgba(16, 185, 129, 0); }
    }

    /* ── Download HTML button — appears in preview toolbar after generation ── */
    .btn-download-html {
      display: inline-flex;
      align-items: center;
      gap: 6px;
      padding: 6px 14px;
      background: #10B981;
      color: #fff;
      border: none;
      border-radius: 8px;
      font-family: var(--font);
      font-size: 12px;
      font-weight: 600;
      cursor: pointer;
      margin-left: auto;
      transition: background var(--t), box-shadow var(--t);
    }
    .btn-download-html:hover {
      background: #059669;
      box-shadow: 0 2px 8px rgba(16,185,129,0.4);
    }

    @media (max-width: 767px) {
      /* Show mobile close button inside preview panel */
      .mobile-preview-close { display: flex; }

      /* Summary card: stack buttons vertically */
      .summary-actions {
        flex-direction: column;
      }
      .btn-build,
      .btn-more {
        min-width: 0;
        width: 100%;
      }

      /* Chips: allow horizontal scroll on very narrow screens */
      .chips-row {
        flex-wrap: wrap;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
      }

      /* Chat input stays at bottom naturally (already flex column) */
      .chat-input-bar {
        position: sticky;
        bottom: 0;
      }

      /* Summary fields: single column */
      .summary-fields {
        grid-template-columns: 1fr;
      }
    }

    /* Mobile view overrides — applied when user clicks Mobile toggle button */
    /* NOTE: These are intentionally outside @media so they apply on desktop too */
    #preview-root.mobile-view .pvw-section--header {
      padding: 0 20px;
    }
    #preview-root.mobile-view .pvw-nav {
      display: none;
    }
    #preview-root.mobile-view .pvw-section--hero {
      padding: 48px 24px;
      min-height: 320px;
    }
    #preview-root.mobile-view .pvw-hero-h1 {
      font-size: 28px;
    }
    #preview-root.mobile-view .pvw-hero-sub {
      font-size: 15px;
    }
    #preview-root.mobile-view .pvw-btn-primary,
    #preview-root.mobile-view .pvw-btn-ghost {
      padding: 10px 18px;
      font-size: 13px;
    }
    #preview-root.mobile-view .pvw-section--about {
      flex-direction: column;
      display: flex;
      padding: 48px 24px;
      gap: 24px;
    }
    #preview-root.mobile-view .pvw-about-img {
      width: 100%;
      height: 200px;
      aspect-ratio: unset;
    }
    #preview-root.mobile-view .pvw-cards-grid {
      grid-template-columns: 1fr;
    }
    #preview-root.mobile-view .pvw-section--services {
      padding: 48px 24px;
    }
    #preview-root.mobile-view .pvw-section--contact {
      flex-direction: column;
      display: flex;
      padding: 48px 24px;
      gap: 32px;
    }
    #preview-root.mobile-view .pvw-section--team {
      padding: 48px 24px;
    }
    #preview-root.mobile-view .pvw-section--footer {
      padding: 32px 24px;
    }
    #preview-root.mobile-view .pvw-footer-inner {
      flex-direction: column;
      text-align: center;
    }
    #preview-root.mobile-view .pvw-logo {
      font-size: 16px;
    }
    #preview-root.mobile-view .pvw-section-h2 {
      font-size: 24px;
    }
    #preview-root.mobile-view .pvw-body-text {
      font-size: 14px;
    }
    #preview-root.mobile-view [data-preview-section] {
      padding-left: 24px;
      padding-right: 24px;
    }

    /* ── Multi-select chip states ─────────────────────────────── */
    .chip--selected {
      background: var(--clr-primary);
      border-color: var(--clr-primary);
      color: #fff;
    }
    .chip--selected:hover {
      background: var(--clr-primary-dk);
      border-color: var(--clr-primary-dk);
      color: #fff;
    }
    .chip--done {
      background: #22C55E !important;
      color: #fff !important;
      font-weight: 700;
      padding: 10px 24px;
      border: none !important;
      border-radius: 20px;
      font-size: 14px;
      letter-spacing: 0.02em;
    }
    .chip--done:hover {
      background: #16A34A !important;
      border-color: #16A34A !important;
    }

    /* ── Fade-in for instant messages ─────────────────────────── */
    @keyframes msg-fade-in {
      from { opacity: 0; transform: translateY(4px); }
      to   { opacity: 1; transform: translateY(0); }
    }
    .msg--fade-in {
      animation: msg-fade-in 0.3s ease both;
    }

    /* ── Dark preview theme ── */
    #preview-root.preview-dark { background: #0a0a0a; }
    #preview-root.preview-dark .pvw-section--header { background: #0a0a0a; border-bottom-color: rgba(255,255,255,0.1); }
    #preview-root.preview-dark .pvw-logo,
    #preview-root.preview-dark .pvw-hero-h1,
    #preview-root.preview-dark .pvw-section-h2,
    #preview-root.preview-dark .pvw-card-title,
    #preview-root.preview-dark .pvw-team-name { color: #FAFAF8; }
    #preview-root.preview-dark .pvw-nav span,
    #preview-root.preview-dark .pvw-hero-sub,
    #preview-root.preview-dark .pvw-body-text,
    #preview-root.preview-dark .pvw-card-desc,
    #preview-root.preview-dark .pvw-team-role,
    #preview-root.preview-dark .pvw-footer-copy,
    #preview-root.preview-dark .pvw-contact-label { color: rgba(250,250,248,0.6); }
    #preview-root.preview-dark .pvw-section--hero { background: linear-gradient(135deg, #0d1117 0%, #161b22 100%); }
    #preview-root.preview-dark .pvw-section--about,
    #preview-root.preview-dark .pvw-section--services,
    #preview-root.preview-dark .pvw-section--team,
    #preview-root.preview-dark .pvw-section--contact { background: #0a0a0a; }
    #preview-root.preview-dark .pvw-card { background: #161b22; border-color: rgba(255,255,255,0.08); }
    #preview-root.preview-dark .pvw-section--footer { background: #050505; }
    #preview-root.preview-dark .pvw-contact-row { border-color: rgba(255,255,255,0.08); }
    #preview-root.preview-dark .pvw-contact-row span:last-child { color: #FAFAF8; }
    #preview-root.preview-dark .pvw-btn-sm { background: #FAFAF8; color: #0a0a0a; }
    #preview-root.preview-dark .pvw-hero-eye { color: #6B8AFF; }

    /* Dark skeleton shimmer */
    #preview-root.preview-dark .sk {
      background: linear-gradient(90deg, #1a1a2e 25%, #252540 50%, #1a1a2e 75%);
      background-size: 200% 100%;
    }
    #preview-root.preview-dark .sk-dk {
      background: linear-gradient(90deg, #151520 25%, #1e1e30 50%, #151520 75%);
      background-size: 200% 100%;
    }

/* ── Avatar lightning bolt SVG ── */
.msg__avatar svg {
  display: block;
  margin: auto;
}
.msg__avatar {
  display: flex;
  align-items: center;
  justify-content: center;
  color: #ffffff;
}

/* ═══════════════════════════════════════════════
   SKYLRK PREMIUM VISUAL LAYER
   Glass morphism, texture, ambient glows
   — additive only, no layout changes —
═══════════════════════════════════════════════ */

/* 1. RGB version of accent for rgba() use */
:root {
  --accent-rgb: 39, 76, 192;
}

/* 2. Film grain texture overlay */
body::after {
  content: '';
  position: fixed;
  inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)' opacity='0.03'/%3E%3C/svg%3E");
  pointer-events: none;
  z-index: 9999;
}

/* 3. AI message bubbles — frosted glass */
.msg--ai .msg__body {
  background: rgba(255, 255, 255, 0.04);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 4px 14px 14px 14px;
  line-height: 1.6;
}

/* 4. User message bubbles — accent glow depth */
.msg--user .msg__body {
  box-shadow: 0 2px 12px rgba(var(--accent-rgb), 0.18);
  line-height: 1.6;
}

/* 5. Chat input bar — frosted glass */
.chat-input-bar {
  background: rgba(255, 255, 255, 0.03);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-top: 1px solid rgba(255, 255, 255, 0.06);
}

/* 6. Chips — pill-shaped frosted glass */
.chip {
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.04);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  transition: all 0.2s ease;
}
.chip:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.15);
  color: var(--clr-text);
}
.chip--selected {
  background: rgba(var(--accent-rgb), 0.15);
  border-color: var(--accent);
}

/* 7. Summary card — premium glass card */
.summary-card {
  background: rgba(255, 255, 255, 0.03);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 16px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
}

/* 8. Confidence bar — gradient glow at high level */
#confidence-bar[data-level="high"] {
  box-shadow: 0 0 8px rgba(34, 197, 94, 0.4);
}
#confidence-bar[data-level="mid"] {
  box-shadow: 0 0 6px rgba(var(--accent-rgb), 0.3);
}

/* 9. AI avatar — soft ambient glow */
.msg__avatar {
  box-shadow: 0 0 10px rgba(var(--accent-rgb), 0.25);
}

/* ═══════════════════════════════════════════════
   TYPING INDICATOR — PILL CONTAINER
   Applied only to the typing indicator row so regular
   AI bubbles keep their own bubble style.
═══════════════════════════════════════════════ */
#_typing_row .msg__body {
  background: rgba(255, 255, 255, 0.06);
  border-radius: 16px;
  padding: 12px 18px;
}

/* ═══════════════════════════════════════════════
   PHASE 2: SITE GENERATED
   When the generated site is ready, transition to split view.
═══════════════════════════════════════════════ */
body.site-generated #chat-panel {
  max-width: 380px;
  border-right: 1px solid var(--clr-border);
  background: var(--clr-bg);
}

body.site-generated #preview-panel {
  display: flex;
}

body.site-generated .preview-toolbar {
  display: flex;
}

body.site-generated #mobile-fab {
  display: flex;
}

/* On mobile in Phase 2, re-enable the toggle */
@media (max-width: 899px) {
  body.site-generated #chat-panel { max-width: 100%; }
}

/* ═══════════════════════════════════════════════
   REDUCED-MOTION GUARD
   All animations are opt-in: only run when the user
   has NOT expressed a preference for reduced motion.
═══════════════════════════════════════════════ */
@media (prefers-reduced-motion: no-preference) {
  /* Skeleton shimmer — light */
  .sk {
    animation: shimmer 2s ease-in-out infinite;
  }

  /* Skeleton shimmer — dark */
  .sk-dk {
    animation: shimmer 2s ease-in-out infinite;
  }

  /* Typing indicator dots — sequential bounce */
  .typing-dots span {
    animation: dot-bounce 1.2s ease infinite;
  }
}

/* ═══════════════════════════════════════════════
   EDIT PANEL — Phase 2 sidebar
   Replaces chat messages + input bar after site generation
═══════════════════════════════════════════════ */

#edit-panel {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  overflow: hidden;
  animation: editPanelIn 0.35s cubic-bezier(0.4, 0, 0.2, 1) both;
}

/* ── Chat-in-preview: AI edit input ── */
.edit-chat-section {
  padding: 12px 16px 8px;
  border-bottom: 1px solid var(--clr-border);
  flex-shrink: 0;
}

.edit-chat-messages {
  max-height: 180px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 8px;
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,0.1) transparent;
}

.edit-chat-messages:empty { display: none; }

.edit-chat-msg {
  font-size: 12.5px;
  line-height: 1.45;
  padding: 6px 10px;
  border-radius: 10px;
  max-width: 90%;
  word-break: break-word;
}

.edit-chat-msg--user {
  background: var(--accent);
  color: #fff;
  align-self: flex-end;
  border-radius: 10px 10px 2px 10px;
}

.edit-chat-msg--assistant {
  background: rgba(255,255,255,0.06);
  color: rgba(255,255,255,0.85);
  align-self: flex-start;
  border-radius: 10px 10px 10px 2px;
}

.edit-chat-msg--system {
  font-size: 11.5px;
  color: var(--clr-muted);
  align-self: center;
  padding: 2px 0;
  background: none;
}

.edit-chat-input-wrap {
  display: flex;
  gap: 6px;
  align-items: center;
}

.edit-chat-input {
  flex: 1;
  background: rgba(255,255,255,0.05);
  border: 1px solid var(--clr-border);
  border-radius: 8px;
  padding: 8px 12px;
  font-size: 13px;
  font-family: var(--font);
  color: #fafafa;
  outline: none;
  transition: border-color 0.2s;
}

.edit-chat-input:focus {
  border-color: var(--accent);
}

.edit-chat-input::placeholder {
  color: rgba(255,255,255,0.25);
}

.edit-chat-send {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  border: none;
  background: var(--accent);
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: opacity 0.15s;
}

.edit-chat-send:hover { opacity: 0.85; }
.edit-chat-send:disabled { opacity: 0.4; cursor: not-allowed; }

@keyframes editPanelIn {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: none; }
}

.edit-panel-inner {
  flex: 1;
  overflow-y: auto;
  padding: 8px 0 4px;
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,0.1) transparent;
}

/* ── Edit Sections ── */
.edit-section {
  border-bottom: 1px solid var(--clr-border);
}

.edit-section:last-child {
  border-bottom: none;
}

.edit-section-hdr {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 11px 16px;
  background: none;
  border: none;
  color: var(--clr-text);
  font: 600 12px/1 var(--font);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  cursor: pointer;
  transition: background var(--t);
  text-align: left;
}

.edit-section-hdr:hover {
  background: var(--clr-surface);
}

.edit-section-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 6px;
  background: rgba(255,255,255,0.06);
  color: rgba(250,250,248,0.7);
  flex-shrink: 0;
}

.edit-section-chevron {
  margin-left: auto;
  color: rgba(250,250,248,0.35);
  transition: transform 0.2s ease;
  flex-shrink: 0;
}

.edit-section-hdr[aria-expanded="false"] .edit-section-chevron {
  transform: rotate(-90deg);
}

.edit-section-body {
  padding: 0 16px 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  overflow: hidden;
  transition: opacity 0.2s ease, max-height 0.25s ease;
  max-height: 600px;
  opacity: 1;
}

.edit-section-body.collapsed {
  max-height: 0;
  opacity: 0;
  padding-bottom: 0;
  pointer-events: none;
}

/* ── Color Controls ── */
.color-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.color-label {
  font: 400 12px/1 var(--font);
  color: rgba(250,250,248,0.6);
}

.color-swatch-wrap {
  display: flex;
  align-items: center;
  cursor: pointer;
  position: relative;
}

.color-swatch {
  display: block;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 2px solid rgba(255,255,255,0.15);
  transition: transform 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
  box-shadow: 0 2px 8px rgba(0,0,0,0.4);
}

.color-swatch-wrap:hover .color-swatch {
  transform: scale(1.1);
  border-color: rgba(255,255,255,0.35);
  box-shadow: 0 4px 14px rgba(0,0,0,0.5);
}

.color-input-hidden {
  position: absolute;
  width: 0;
  height: 0;
  opacity: 0;
  pointer-events: none;
}

/* ── Font Select ── */
.edit-field-label {
  font: 400 11px/1 var(--font);
  color: rgba(250,250,248,0.45);
  letter-spacing: 0.03em;
  margin-bottom: -4px;
}

.font-select-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.font-select {
  width: 100%;
  appearance: none;
  background: rgba(255,255,255,0.05);
  border: 1px solid var(--clr-border);
  border-radius: var(--r-sm);
  color: var(--clr-text);
  font: 400 13px/1 var(--font);
  padding: 9px 32px 9px 11px;
  cursor: pointer;
  transition: border-color var(--t), background var(--t);
  outline: none;
  -webkit-appearance: none;
}

.font-select:hover,
.font-select:focus {
  background: rgba(255,255,255,0.08);
  border-color: rgba(255,255,255,0.18);
}

.font-select option {
  background: #1a1a2e;
  color: #FAFAF8;
}

.font-select-arrow {
  position: absolute;
  right: 10px;
  color: rgba(250,250,248,0.4);
  pointer-events: none;
  flex-shrink: 0;
}

/* ── Hero Type Buttons ── */
.hero-type-group {
  display: flex;
  gap: 6px;
}

.hero-type-btn {
  flex: 1;
  padding: 7px 4px;
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--clr-border);
  border-radius: var(--r-sm);
  color: rgba(250,250,248,0.55);
  font: 400 11px/1 var(--font);
  cursor: pointer;
  transition: background var(--t), border-color var(--t), color var(--t);
  white-space: nowrap;
}

.hero-type-btn:hover {
  background: rgba(255,255,255,0.08);
  color: rgba(250,250,248,0.85);
}

.hero-type-btn.active {
  background: rgba(39,76,192,0.25);
  border-color: rgba(39,76,192,0.5);
  color: #FAFAF8;
}

/* ── Dark Mode Toggle ── */
.toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.toggle-label {
  font: 400 12px/1 var(--font);
  color: rgba(250,250,248,0.6);
}

.edit-toggle {
  position: relative;
  display: inline-flex;
  align-items: center;
  cursor: pointer;
}

.edit-toggle input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.edit-toggle-track {
  width: 38px;
  height: 22px;
  background: rgba(255,255,255,0.1);
  border-radius: 11px;
  position: relative;
  transition: background 0.2s ease;
  border: 1px solid rgba(255,255,255,0.1);
}

.edit-toggle input:checked ~ .edit-toggle-track {
  background: var(--clr-primary);
  border-color: var(--clr-primary);
}

.edit-toggle-thumb {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 16px;
  height: 16px;
  background: rgba(250,250,248,0.9);
  border-radius: 50%;
  transition: transform 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 1px 4px rgba(0,0,0,0.4);
}

.edit-toggle input:checked ~ .edit-toggle-track .edit-toggle-thumb {
  transform: translateX(16px);
}

.edit-toggle:focus-within .edit-toggle-track {
  box-shadow: 0 0 0 2px rgba(39,76,192,0.4);
}

/* ── Content Text Inputs ── */
.edit-field-input {
  width: 100%;
  background: rgba(255,255,255,0.05);
  border: 1px solid var(--clr-border);
  border-radius: var(--r-sm);
  color: var(--clr-text);
  font: 400 13px/1.4 var(--font);
  padding: 9px 11px;
  outline: none;
  transition: border-color var(--t), background var(--t);
}

.edit-field-input:hover {
  background: rgba(255,255,255,0.07);
  border-color: rgba(255,255,255,0.14);
}

.edit-field-input:focus {
  background: rgba(255,255,255,0.07);
  border-color: rgba(39,76,192,0.6);
  box-shadow: 0 0 0 2px rgba(39,76,192,0.15);
}

.edit-field-input::placeholder {
  color: rgba(250,250,248,0.25);
}

/* ── Footer: Publish + Regenerate ── */
.edit-panel-footer {
  display: flex;
  gap: 8px;
  padding: 12px 16px 16px;
  border-top: 1px solid var(--clr-border);
  background: rgba(0,0,3,0.6);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  flex-shrink: 0;
}

.btn-regenerate {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 14px;
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: var(--r-md);
  color: rgba(250,250,248,0.7);
  font: 500 13px/1 var(--font);
  cursor: pointer;
  white-space: nowrap;
  transition: background var(--t), color var(--t), border-color var(--t);
  flex-shrink: 0;
}

.btn-regenerate:hover {
  background: rgba(255,255,255,0.1);
  color: var(--clr-text);
  border-color: rgba(255,255,255,0.2);
}

.btn-publish {
  flex: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 11px 16px;
  background: linear-gradient(135deg, var(--clr-primary) 0%, var(--clr-primary-dk) 100%);
  border: none;
  border-radius: var(--r-md);
  color: #FFFFFF;
  font: 600 13px/1 var(--font);
  cursor: pointer;
  white-space: nowrap;
  transition: opacity var(--t), transform 0.12s ease, box-shadow var(--t);
  box-shadow: 0 4px 16px rgba(39,76,192,0.35);
  letter-spacing: 0.01em;
}

.btn-publish:hover {
  opacity: 0.9;
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(39,76,192,0.45);
}

.btn-publish:active {
  transform: translateY(0);
}

.btn-publish--done {
  background: linear-gradient(135deg, #16a34a, #15803d) !important;
  box-shadow: 0 4px 16px rgba(22,163,74,0.35) !important;
}

/* ── Phase 2: hide chat input bar and messages when edit panel active ──
   These are hidden via JS (inline style) but scoped here too for safety. ── */
body.site-generated .chat-input-bar,
body.site-generated #confidence-bar-wrap {
  display: none;
}

/* ── Mobile: bottom sheet in Phase 2 ── */
@media (max-width: 899px) {
  body.site-generated #chat-panel {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 200;
    max-width: 100% !important;
    height: auto;
    max-height: 65dvh;
    border-top: 1px solid var(--clr-border);
    border-radius: 18px 18px 0 0;
    background: rgba(10,10,16,0.96);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    box-shadow: 0 -8px 40px rgba(0,0,0,0.6);
    transform: translateY(100%);
    transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1);
    overflow: hidden;
  }

  body.site-generated.edit-open #chat-panel {
    transform: translateY(0);
  }

  body.site-generated #chat-panel .chat-header {
    border-radius: 18px 18px 0 0;
    cursor: grab;
  }

  /* Drag handle pill */
  body.site-generated #chat-panel .chat-header::before {
    content: '';
    display: block;
    width: 36px;
    height: 4px;
    background: rgba(255,255,255,0.2);
    border-radius: 2px;
    margin: 0 auto 8px;
  }

  #edit-panel {
    max-height: calc(65dvh - 56px);
  }
}

/* ══════════════════════════════════════════════════════════
   VOICE MODE — Integrated (Stitch-inspired)
══════════════════════════════════════════════════════════ */

/* ── Mic button in input bar ── */
.voice-btn {
  color: rgba(250,250,248,0.45);
  transition: color 0.2s ease, background 0.2s ease, transform 0.15s ease;
  position: relative;
}

.voice-btn:hover {
  color: rgba(250,250,248,0.85);
}

.voice-btn--active {
  color: #63b3ed;
  animation: voice-pulse 2s ease-in-out infinite;
}

.voice-btn--active::after {
  content: '';
  position: absolute;
  inset: -3px;
  border-radius: 50%;
  border: 2px solid rgba(99, 179, 237, 0.3);
  animation: voice-ring 2s ease-in-out infinite;
}

@keyframes voice-pulse {
  0%, 100% { transform: scale(1); }
  50%      { transform: scale(1.08); }
}

@keyframes voice-ring {
  0%, 100% { opacity: 0.3; transform: scale(1); }
  50%      { opacity: 0.6; transform: scale(1.15); }
}

/* ── Voice indicator next to logo ── */
.voice-indicator {
  display: none;
  align-items: center;
  gap: 8px;
  margin-left: 10px;
}

.voice-indicator--active {
  display: inline-flex;
}

.voice-indicator__canvas {
  width: 48px;
  height: 20px;
  vertical-align: middle;
}

.voice-indicator__label {
  font: 400 11px/1 var(--font);
  color: rgba(250,250,248,0.5);
  white-space: nowrap;
  transition: color 0.3s ease;
}

.voice-indicator--listening .voice-indicator__label {
  color: rgba(250,250,248,0.7);
}

.voice-indicator--speaking .voice-indicator__label {
  color: rgba(99, 179, 237, 0.9);
}

.voice-indicator--thinking .voice-indicator__label {
  color: rgba(250,250,248,0.4);
  animation: voice-think-pulse 1.2s ease-in-out infinite;
}

@keyframes voice-think-pulse {
  0%, 100% { opacity: 0.4; }
  50%      { opacity: 0.8; }
}

/* ── Voice mode active: keep all inputs visible, highlight mic ── */
body.voice-mode-active .chat-input-bar {
  border-color: rgba(99, 179, 237, 0.25);
}

body.voice-mode-active .voice-btn {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: rgba(99, 179, 237, 0.12);
  border: 1px solid rgba(99, 179, 237, 0.25);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

body.voice-mode-active .voice-btn svg {
  width: 20px;
  height: 20px;
}

body.voice-mode-active .voice-btn:hover {
  background: rgba(99, 179, 237, 0.2);
  border-color: rgba(99, 179, 237, 0.4);
}

/* ── Voice transcript bubbles — subtle styling difference ── */
body.voice-mode-active .msg--user .msg__body {
  background: rgba(99, 179, 237, 0.08);
  border-color: rgba(99, 179, 237, 0.15);
}

body.voice-mode-active .msg--ai .msg__body {
  border-left: 2px solid rgba(99, 179, 237, 0.2);
}

/* ── Mobile adjustments ── */
@media (max-width: 899px) {
  body.voice-mode-active .chat-input-bar {
    padding: 12px 16px 20px;
  }

  body.voice-mode-active .voice-btn {
    width: 56px;
    height: 56px;
  }

  body.voice-mode-active .voice-btn svg {
    width: 24px;
    height: 24px;
  }
}
