:root {
  --wr7-blue: #073b93;
  --wr7-blue-800: #06347f;
  --wr7-blue-900: #05285f;
  --wr7-blue-950: #031a3f;
  --wr7-blue-soft: #eaf1ff;
  --wr7-yellow: #ffc51b;
  --wr7-yellow-deep: #efb500;
  --ink: #0d1c31;
  --muted: #68788e;
  --surface: #ffffff;
  --surface-soft: #f5f8fc;
  --line: #dce5f1;
  --success: #15845f;
  --danger: #b42318;
  --shadow: 0 28px 90px rgba(1, 22, 55, .25);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; }
html, body { min-height: 100%; }
html { background: var(--wr7-blue-950); }
body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
  color: var(--ink);
  background: linear-gradient(145deg, #05285f 0%, #073b93 48%, #031a3f 100%);
  overflow: hidden;
}
button, input, textarea { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
button { color: inherit; }

.page-stage { position: fixed; inset: 0; pointer-events: none; overflow: hidden; }
.stage-orb { position: absolute; border-radius: 999px; filter: blur(1px); }
.stage-orb-a { width: 420px; height: 420px; left: -120px; top: -120px; background: rgba(255,197,27,.12); }
.stage-orb-b { width: 540px; height: 540px; right: -180px; bottom: -200px; background: rgba(61,132,246,.22); }
.stage-grid { position: absolute; inset: 0; opacity: .08; background-image: linear-gradient(rgba(255,255,255,.2) 1px,transparent 1px),linear-gradient(90deg,rgba(255,255,255,.2) 1px,transparent 1px); background-size: 46px 46px; mask-image: radial-gradient(circle at 50% 50%,#000,transparent 78%); }

.app-shell {
  position: relative;
  z-index: 2;
  width: min(790px, calc(100% - 32px));
  height: min(900px, calc(100dvh - 34px));
  margin: 17px auto;
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr) auto auto;
  overflow: hidden;
  background: rgba(255,255,255,.99);
  border: 1px solid rgba(255,255,255,.34);
  border-radius: 30px;
  box-shadow: var(--shadow);
}

.bot-header { min-height: 82px; padding: 13px 18px; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--line); background: rgba(255,255,255,.96); backdrop-filter: blur(16px); }
.brand-lockup { display: flex; align-items: center; gap: 12px; min-width: 0; }
.brand-logo-wrap { width: 58px; height: 58px; flex: 0 0 58px; border-radius: 16px; display: grid; place-items: center; overflow: hidden; border: 1px solid #e7edf6; background: #fff; }
.brand-logo { width: 100%; height: 100%; object-fit: contain; padding: 4px; }
.brand-meta { min-width: 0; display: grid; gap: 4px; }
.brand-meta strong { font-size: 17px; color: var(--wr7-blue-900); letter-spacing: -.015em; }
.brand-meta span { color: var(--muted); font-size: 12px; display: flex; align-items: center; gap: 7px; }
.status-dot { width: 8px; height: 8px; border-radius: 50%; background: #1ba673; box-shadow: 0 0 0 4px rgba(27,166,115,.12); }
.restart-button { width: 42px; height: 42px; flex: 0 0 42px; border-radius: 14px; border: 1px solid var(--line); background: #fff; color: var(--wr7-blue); display: grid; place-items: center; cursor: pointer; transition: transform .18s ease,border-color .18s ease,background .18s ease; }
.restart-button:hover { transform: translateY(-1px); border-color: #b5c7e1; background: #f8fbff; }
.restart-button svg { width: 19px; height: 19px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

.progress-area { padding: 11px 18px 10px; background: #fff; }
.progress-copy { display: flex; justify-content: space-between; gap: 16px; font-size: 11px; font-weight: 750; color: #66768c; margin-bottom: 7px; }
.progress-track { height: 5px; overflow: hidden; border-radius: 999px; background: #e9eff7; }
.progress-bar { width: 0%; height: 100%; border-radius: inherit; background: linear-gradient(90deg,var(--wr7-yellow),#ffdc63); transition: width .38s cubic-bezier(.22,.8,.32,1); }

.conversation { min-height: 0; overflow-y: auto; scroll-behavior: smooth; background: linear-gradient(rgba(246,248,252,.94),rgba(246,248,252,.94)), radial-gradient(circle at 25% 22%,rgba(7,59,147,.05) 0 2px,transparent 2px 100%); background-size: auto, 29px 29px; scrollbar-width: thin; scrollbar-color: #c5d3e6 transparent; }
.conversation-inner { width: 100%; padding: 25px 22px 36px; display: flex; flex-direction: column; gap: 12px; }
.message-row { display: flex; align-items: flex-end; gap: 9px; animation: messageIn .28s ease both; }
.message-row.user { justify-content: flex-end; }
.message-avatar { width: 34px; height: 34px; flex: 0 0 34px; border-radius: 11px; overflow: hidden; border: 1px solid #d9e3f0; background: #fff; display: grid; place-items: center; box-shadow: 0 6px 16px rgba(7,59,147,.12); }
.message-avatar img { width: 100%; height: 100%; object-fit: contain; padding: 2px; }
.message-bubble { max-width: min(83%,560px); padding: 12px 15px; border-radius: 8px 20px 20px 20px; background: #fff; border: 1px solid #e0e8f2; box-shadow: 0 8px 24px rgba(20,47,86,.055); color: #17263d; font-size: 15px; line-height: 1.48; }
.message-row.user .message-bubble { color: #fff; background: var(--wr7-blue); border-color: var(--wr7-blue); border-radius: 20px 8px 20px 20px; box-shadow: 0 8px 22px rgba(7,59,147,.17); }
.message-bubble strong { font-weight: 800; }
.message-bubble small { display: block; margin-top: 7px; color: #73839a; font-size: 11px; line-height: 1.45; }
.message-row.user .message-bubble small { color: rgba(255,255,255,.74); }
.typing-bubble { display: inline-flex; align-items: center; gap: 5px; min-width: 64px; }
.typing-dot { width: 7px; height: 7px; border-radius: 50%; background: #94a4ba; animation: typing 1.1s infinite ease-in-out; }
.typing-dot:nth-child(2) { animation-delay: .12s; }
.typing-dot:nth-child(3) { animation-delay: .24s; }

.social-proof-wrap { margin-left: 43px; width: min(640px,calc(100% - 43px)); animation: messageIn .3s ease both; }
.project-strip { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(205px, 1fr); gap: 10px; overflow-x: auto; padding: 1px 1px 9px; scroll-snap-type: x proximity; scrollbar-width: thin; }
.project-card { appearance: none; padding: 0; text-align: left; cursor: zoom-in; scroll-snap-align: start; overflow: hidden; border: 1px solid #dfe7f1; border-radius: 17px; background: #fff; box-shadow: 0 10px 24px rgba(24,51,88,.07); transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease; }
.project-card:hover { transform: translateY(-2px); border-color: #b8cbe3; box-shadow: 0 14px 30px rgba(24,51,88,.12); }
.project-card:focus-visible { outline: 3px solid rgba(255,197,27,.8); outline-offset: 3px; }
.project-image-wrap { position: relative; display: block; overflow: hidden; }
.project-card img { width: 100%; height: 132px; object-fit: cover; display: block; background: #dce4ee; transition: transform .28s ease; }
.project-card:hover img { transform: scale(1.035); }
.project-open-hint { position: absolute; right: 8px; bottom: 8px; display: inline-flex; align-items: center; min-height: 27px; padding: 0 9px; border-radius: 999px; background: rgba(5,24,52,.82); color: #fff; font-size: 10px; font-weight: 850; letter-spacing: .01em; backdrop-filter: blur(5px); }
.project-card-body { display: block; padding: 10px 11px 12px; }
.project-card small { display: block; color: var(--wr7-blue); font-size: 10px; font-weight: 850; text-transform: uppercase; letter-spacing: .05em; margin-bottom: 3px; }
.project-card strong { display: block; color: #12233b; font-size: 13px; line-height: 1.3; }
.proof-note { margin-top: 3px; color: #6d7d91; font-size: 11px; line-height: 1.45; }


body.project-viewer-open { overflow: hidden; }
.project-viewer[hidden] { display: none !important; }
.project-viewer { position: fixed; inset: 0; z-index: 1000; display: grid; place-items: center; padding: 22px; opacity: 0; transition: opacity .18s ease; }
.project-viewer.open { opacity: 1; }
.project-viewer-backdrop { position: absolute; inset: 0; background: rgba(3,16,36,.91); backdrop-filter: blur(7px); }
.project-viewer-panel { position: relative; z-index: 1; width: min(1040px,94vw); max-height: 92dvh; border: 1px solid rgba(255,255,255,.14); border-radius: 24px; background: #07172e; box-shadow: 0 32px 90px rgba(0,0,0,.48); overflow: hidden; }
.project-viewer-figure { margin: 0; display: grid; grid-template-rows: minmax(0,1fr) auto; max-height: 92dvh; }
.project-viewer-image-wrap { min-height: 260px; max-height: 76dvh; background: #030b17; display: grid; place-items: center; }
.project-viewer-image-wrap img { width: 100%; height: 100%; max-height: 76dvh; object-fit: contain; display: block; }
.project-viewer-caption { padding: 15px 70px 17px 20px; background: linear-gradient(180deg,#0a1d39,#07172e); color: #fff; }
.project-viewer-caption small { display: block; margin-bottom: 3px; color: var(--wr7-yellow); font-size: 10px; font-weight: 900; letter-spacing: .08em; text-transform: uppercase; }
.project-viewer-caption strong { display: block; font-size: 16px; line-height: 1.3; }
.project-viewer-caption span { display: block; margin-top: 4px; color: #9fb1c8; font-size: 11px; }
.project-viewer-close,.project-viewer-nav { position: absolute; z-index: 4; border: 1px solid rgba(255,255,255,.18); background: rgba(5,20,45,.75); color: #fff; cursor: pointer; backdrop-filter: blur(8px); display: grid; place-items: center; transition: background .15s ease, transform .15s ease; }
.project-viewer-close:hover,.project-viewer-nav:hover { background: rgba(7,59,147,.92); }
.project-viewer-close { top: 13px; right: 13px; width: 42px; height: 42px; border-radius: 14px; font-size: 26px; line-height: 1; }
.project-viewer-nav { top: 50%; width: 45px; height: 58px; border-radius: 14px; transform: translateY(-50%); font-size: 34px; line-height: 1; }
.project-viewer-nav:hover { transform: translateY(-50%) scale(1.03); }
.project-viewer-prev { left: 13px; }
.project-viewer-next { right: 13px; }
.project-viewer-count { position: absolute; right: 20px; bottom: 18px; z-index: 4; color: #95a9c3; font-size: 11px; font-weight: 800; }

.composer { padding: 14px 18px calc(14px + var(--safe-bottom)); border-top: 1px solid var(--line); background: #fff; }
.composer-card { display: grid; gap: 10px; animation: composerIn .23s ease both; }
.choice-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 9px; }
.choice-grid.single { grid-template-columns: 1fr; }
.choice-button { min-height: 50px; padding: 11px 14px; border: 1px solid #cedbea; border-radius: 15px; background: #fff; color: #123360; text-align: left; font-weight: 760; font-size: 13px; cursor: pointer; transition: transform .16s ease,box-shadow .16s ease,border-color .16s ease,background .16s ease; }
.choice-button:hover { transform: translateY(-1px); border-color: #86a7d4; background: #f7faff; box-shadow: 0 8px 18px rgba(7,59,147,.07); }
.choice-button:active { transform: translateY(0); }
.choice-caption { display: block; margin-top: 3px; color: #75869e; font-size: 11px; font-weight: 550; }
.text-composer { display: flex; align-items: flex-end; gap: 9px; }
.input-shell { flex: 1; border: 1px solid #cbd8e8; border-radius: 16px; background: #f9fbfe; transition: border-color .18s,box-shadow .18s,background .18s; }
.input-shell:focus-within { border-color: #6d96d0; background: #fff; box-shadow: 0 0 0 4px rgba(7,59,147,.08); }
.text-input,.text-area { width: 100%; border: 0; outline: 0; background: transparent; color: var(--ink); padding: 14px 15px; font-size: 15px; }
.text-area { min-height: 88px; max-height: 150px; resize: vertical; line-height: 1.42; }
.text-input::placeholder,.text-area::placeholder { color: #99a6b8; }
.send-button { width: 50px; height: 50px; flex: 0 0 50px; border: 0; border-radius: 16px; display: grid; place-items: center; background: var(--wr7-yellow); color: #062965; cursor: pointer; box-shadow: 0 9px 22px rgba(255,197,27,.24); transition: transform .16s,background .16s; }
.send-button:hover { transform: translateY(-1px); background: var(--wr7-yellow-deep); }
.send-button svg { width: 21px; height: 21px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.help-text { color: #75859a; font-size: 11px; line-height: 1.45; }
.skip-button { justify-self: start; border: 0; background: transparent; color: var(--wr7-blue); font-size: 12px; font-weight: 750; padding: 3px 0; cursor: pointer; }
.primary-action { min-height: 51px; border: 0; border-radius: 15px; background: var(--wr7-yellow); color: #062965; font-weight: 900; cursor: pointer; box-shadow: 0 9px 20px rgba(255,197,27,.22); }
.primary-action:disabled { cursor: not-allowed; opacity: .45; box-shadow: none; }
.consent-box { display: grid; grid-template-columns: auto 1fr; gap: 10px; align-items: start; border: 1px solid #dde6f1; border-radius: 15px; padding: 12px; background: #f9fbfe; }
.consent-box input { width: 18px; height: 18px; accent-color: var(--wr7-blue); margin-top: 1px; }
.consent-box label { color: #52637a; font-size: 12px; line-height: 1.48; }
.consent-box a { color: var(--wr7-blue); font-weight: 750; }
.error-note { color: var(--danger); font-size: 12px; line-height: 1.45; }

.final-card { margin: 8px 0 18px 43px; width: min(620px,calc(100% - 43px)); border: 1px solid #d9e7df; background: linear-gradient(180deg,#fff,#f8fcfa); border-radius: 22px; padding: 20px; box-shadow: 0 14px 36px rgba(26,82,59,.08); animation: messageIn .32s ease both; }
.final-card .check { width: 43px; height: 43px; border-radius: 14px; display: grid; place-items: center; background: #e5f6ef; color: var(--success); font-size: 23px; font-weight: 900; margin-bottom: 12px; }
.final-card h2 { margin: 0 0 8px; color: #12233b; font-size: 21px; line-height: 1.2; }
.final-card p { margin: 0; color: #65758a; font-size: 13px; line-height: 1.55; }
.final-card-actions { display: flex; flex-wrap: wrap; gap: 9px; margin-top: 15px; }
.final-card-actions a,.debug-button { min-height: 44px; border-radius: 13px; padding: 0 14px; display: inline-flex; align-items: center; justify-content: center; text-decoration: none; font-weight: 850; font-size: 12px; }
.final-card-actions a { color: #fff; background: var(--wr7-blue); }
.debug-button { border: 1px solid #cfdcea; color: var(--wr7-blue); background: #fff; cursor: pointer; }
.debug-panel { display: none; margin: 12px 0 0; border-radius: 13px; padding: 12px; background: #07172e; color: #d9e8ff; font-size: 10px; line-height: 1.45; max-height: 260px; overflow: auto; white-space: pre-wrap; }
.debug-panel.open { display: block; }
.environment-badge { padding: 6px 12px calc(6px + var(--safe-bottom)); text-align: center; color: #7c5d00; background: #fff6cf; border-top: 1px solid #f4df89; font-size: 10px; font-weight: 750; }

@keyframes typing { 0%,60%,100% { transform: translateY(0); opacity: .55; } 30% { transform: translateY(-4px); opacity: 1; } }
@keyframes messageIn { from { opacity: 0; transform: translateY(7px) scale(.99); } to { opacity: 1; transform: none; } }
@keyframes composerIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

@media (max-width: 760px) {
  body { background: #f5f8fc; }
  .page-stage { display: none; }
  .app-shell { width: 100%; height: 100dvh; margin: 0; border-radius: 0; border: 0; box-shadow: none; }
  .bot-header { min-height: 70px; padding: 9px 13px; }
  .brand-logo-wrap { width: 49px; height: 49px; flex-basis: 49px; border-radius: 13px; }
  .brand-meta strong { font-size: 15px; }
  .brand-meta span { font-size: 11px; }
  .restart-button { width: 39px; height: 39px; border-radius: 12px; }
  .progress-area { padding: 9px 13px 8px; }
  .conversation-inner { padding: 19px 13px 28px; gap: 10px; }
  .message-row { gap: 7px; }
  .message-avatar { width: 29px; height: 29px; flex-basis: 29px; border-radius: 9px; }
  .message-bubble { max-width: 86%; font-size: 14px; padding: 11px 13px; }
  .social-proof-wrap { margin-left: 36px; width: calc(100% - 36px); }
  .project-strip { grid-auto-columns: 76%; }
  .project-card img { height: 124px; }
  .project-open-hint { min-height: 25px; padding: 0 8px; font-size: 9px; }
  .project-viewer { padding: 0; }
  .project-viewer-panel { width: 100vw; max-height: 100dvh; height: 100dvh; border: 0; border-radius: 0; display: grid; align-items: center; background: #030b17; }
  .project-viewer-figure { max-height: 100dvh; }
  .project-viewer-image-wrap { min-height: 0; max-height: calc(100dvh - 112px); }
  .project-viewer-image-wrap img { max-height: calc(100dvh - 112px); }
  .project-viewer-caption { min-height: 112px; padding: 14px 58px 16px 15px; }
  .project-viewer-close { top: calc(10px + env(safe-area-inset-top)); right: 10px; }
  .project-viewer-nav { width: 40px; height: 52px; border-radius: 12px; }
  .project-viewer-prev { left: 8px; }
  .project-viewer-next { right: 8px; }
  .project-viewer-count { right: 14px; bottom: calc(17px + env(safe-area-inset-bottom)); }
  .composer { padding: 11px 12px calc(11px + var(--safe-bottom)); }
  .choice-grid { grid-template-columns: 1fr; gap: 8px; max-height: 36vh; overflow-y: auto; }
  .choice-button { min-height: 47px; }
  .text-input,.text-area { font-size: 16px; }
  .final-card { margin-left: 36px; width: calc(100% - 36px); padding: 17px; }
}

@media (max-width: 390px) {
  .brand-meta span { max-width: 175px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .project-strip { grid-auto-columns: 83%; }
}
