@layer base, layout, components, responsive, spatial;

@layer base {
  :root {
    color-scheme: light;
    --ink: #202833;
    --muted: #59636e;
    --brand: #3e4095;
    --brand-dark: #2c2e71;
    --brand-soft: #eeeff9;
    --red: #e41f35;
    --surface: #ffffff;
    --page: #f6f5f0;
    --line: #e1e4e6;
    --line-strong: #b9c1ca;
    --success: #17543c;
    --success-bg: #edf7f0;
    --warn: #65470a;
    --warn-bg: #fff5df;
    --error: #a11e2d;
    --error-bg: #fff1f2;
    --radius: 16px;
    --shadow: 0 12px 50px #24333d0d;
    font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    font-synthesis: none;
  }
  * { box-sizing: border-box; }
  body { margin: 0; background: var(--page); color: var(--ink); font-size: 16px; line-height: 1.6; }
  button, input, textarea, select { font: inherit; }
  button, a, input, textarea, select { -webkit-tap-highlight-color: transparent; }
  button { cursor: pointer; color: inherit; }
  button:disabled { cursor: not-allowed; opacity: .55; }
  a { color: var(--brand-dark); text-underline-offset: 4px; }
  img { max-width: 100%; }
  h1, h2, h3, p { margin: 0; }
  h1, h2, h3 { line-height: 1.25; }
  h1 { font-size: 30px; letter-spacing: -.7px; }
  h2 { font-size: 24px; letter-spacing: -.5px; }
  h3 { font-size: 18px; letter-spacing: -.2px; }
  label { display: block; font-size: 15px; font-weight: 650; }
  input:not([type=checkbox]):not([type=radio]):not([type=file]), textarea, select {
    width: 100%; min-height: 48px; border: 1px solid var(--line-strong); border-radius: 12px;
    background: #fff; color: var(--ink); padding: 11px 13px; font-size: 16px;
  }
  input::placeholder, textarea::placeholder { color: #68727d; opacity: 1; }
  input[type=checkbox], input[type=radio] { accent-color: var(--brand); width: 21px; height: 21px; min-width: 21px; margin: 2px 0 0; }
  button:focus-visible, a:focus-visible, input:focus-visible, textarea:focus-visible, select:focus-visible, summary:focus-visible, [tabindex]:focus-visible {
    outline: 3px solid var(--brand); outline-offset: 3px;
  }
  button svg { pointer-events: none; }
  [hidden] { display: none !important; }
  .sr-only { position: absolute !important; width: 1px !important; height: 1px !important; padding: 0 !important; margin: -1px !important; overflow: hidden !important; clip: rect(0,0,0,0) !important; white-space: nowrap !important; border: 0 !important; }
  .skip-link { position: fixed; top: 8px; left: 12px; z-index: 100; background: #fff; border: 2px solid var(--brand); padding: 10px 16px; transform: translateY(-150%); }
  .skip-link:focus { transform: translateY(0); }
  .icon { display: inline-block; width: 22px; height: 22px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; vertical-align: middle; }
  .icon.small { width: 18px; height: 18px; }
  .small-text { font-size: 14px; line-height: 1.6; color: var(--muted); }
  .eyebrow, .overline { font-size: 13px; font-weight: 700; letter-spacing: .8px; color: var(--brand); line-height: 1.5; }
  .optional { font-weight: 400; font-size: 14px; color: var(--muted); }
  .full-width { width: 100%; }
  .noscript-notice { position: fixed; inset: auto 10px 10px; padding: 18px; background: var(--error-bg); border: 1px solid var(--error); z-index: 100; }
}

@layer spatial {
  .lion-companion { overflow: hidden; background: radial-gradient(ellipse at 24% 68%, #2c6687 0, #192d50 39%, #121a32 78%); border-bottom: 1px solid #61d8dd55; }
  .lion-companion::before { content: ""; position: absolute; inset: 43% -20% -60%; pointer-events: none; background-image: linear-gradient(#80dfeb16 1px, transparent 1px), linear-gradient(90deg, #80dfeb16 1px, transparent 1px); background-size: 36px 36px; transform: perspective(190px) rotateX(46deg); }
  .lion-companion::after { content: ""; position: absolute; pointer-events: none; left: 10%; bottom: 15%; width: 40%; height: 14%; border: 1px solid #7ce5ed70; border-radius: 50%; box-shadow: 0 0 24px #4fe7fa2b, inset 0 0 20px #66d4ef13; }
  .lion-stage { z-index: 1; top: 32px; }
  .greeting-screen .lion-stage { overflow: visible; contain: layout; }
  .greeting-screen .lion-stage::before {
    content: ""; position: absolute; z-index: 0; pointer-events: none;
    left: 7%; right: 8%; top: 23%; bottom: -4%; border: 1px solid #a8f3f4a8; border-radius: 28px 28px 12px 12px;
    background: radial-gradient(circle at 52% 34%, #9ff7f33b, #265e8550 42%, #0d1835d9 78%);
    box-shadow: 0 0 0 5px #66d9ef12, 0 0 34px #54e2ef3d, inset 0 0 32px #8deef327;
    transform: perspective(430px) rotateY(-5deg) rotateX(1deg);
  }
  .greeting-screen .lion-stage::after {
    content: ""; position: absolute; z-index: 3; pointer-events: none;
    left: 2%; right: 1%; bottom: -2px; height: 21%; border-top: 1px solid #c4ffffb5;
    background: linear-gradient(180deg, #9ff7fa16, #4ac3df34 38%, #09142bbb 92%);
    clip-path: polygon(4% 0, 96% 0, 100% 100%, 0 100%);
    box-shadow: 0 -9px 22px #75e8ed28, inset 0 1px #ffffff78;
    transform: perspective(320px) rotateX(58deg); transform-origin: bottom;
  }
  .greeting-screen #lion-canvas-mount { z-index: 2; }
  .greeting-screen #lion-canvas-mount canvas { filter: drop-shadow(0 10px 8px #040a1990); }
  .companion-topline { position: absolute; z-index: 3; top: 0; left: 15px; right: 15px; height: 36px; display: flex; align-items: center; gap: 8px; font-size: 13px; line-height: 1.2; color: #deedf6; letter-spacing: .1px; }
  .signal-orb { flex: none; width: 7px; height: 7px; border-radius: 50%; background: #88edf2; box-shadow: 0 0 10px #77dceaa0; }
  .lion-companion[data-mode="thinking"][data-motion="playing"] .signal-orb { animation: signal-breathe 1.2s ease-in-out infinite; }
  .lion-companion[data-mode="typing"][data-motion="playing"] .signal-orb { animation: signal-breathe .9s ease-in-out infinite; }
  .lion-companion[data-mode="listening"] .signal-orb { background: #bfbcff; box-shadow: 0 0 12px #c0bbff; }
  .lion-companion[data-mode="success"] .signal-orb { background: #a2e9bc; }
  .lion-companion[data-mode="safety"] { background: linear-gradient(125deg, #222c40, #2e2630); border-bottom-color: #dcb994; }
  .lion-companion[data-mode="safety"] .signal-orb { background: #f8cb91; box-shadow: none; }
  .lion-companion[data-mode="safety"]::after { border-color: #cfb39250; box-shadow: none; }
  .mascot-greeting { z-index: 2; top: 57%; --bubble-line: #e9f1ff; box-shadow: 0 12px 25px #030b242e; }
  .mascot-greeting p { overflow-wrap: anywhere; }
  .greeting-screen:not(.compact-viewport):not(.keyboard-open) .lion-companion { height: auto; min-height: 244px; display: grid; grid-template-columns: 48% minmax(0, 1fr); align-items: center; }
  .greeting-screen:not(.compact-viewport):not(.keyboard-open) .mascot-greeting { position: relative; grid-column: 2; left: auto; right: auto; top: auto; transform: none; margin: 44px 12px 16px 0; }
  .greeting-screen.named-greeting .mascot-greeting strong { font-size: 20px; line-height: 1.25; }
  .greeting-screen.named-greeting .mascot-greeting p { font-size: 18px; }
  .greeting-screen.long-greeting:not(.compact-viewport):not(.keyboard-open) .lion-companion { display: block; min-height: 0; padding: 125px 14px 16px; }
  .greeting-screen.long-greeting:not(.compact-viewport):not(.keyboard-open) .lion-stage { left: 20%; right: 20%; top: 29px; height: 105px; }
  .greeting-screen.long-greeting:not(.compact-viewport):not(.keyboard-open) .mascot-greeting { margin: 0; padding: 13px 17px; }
  .greeting-screen.long-greeting .greeting-voice { display: none; }
  .greeting-screen.long-greeting .mascot-greeting strong { font-size: 18px; }
  .greeting-screen.long-greeting .mascot-greeting p { font-size: 17px; }
  .compact-viewport.long-greeting .mascot-greeting strong, .keyboard-open.long-greeting .mascot-greeting strong { display: none; }
  .greeting-screen:not(.compact-viewport):not(.keyboard-open) .lion-companion[data-renderer="unavailable"] { display: block; min-height: 0; padding: 40px 16px 16px; }
  .greeting-screen:not(.compact-viewport):not(.keyboard-open) .lion-companion[data-renderer="unavailable"] .mascot-greeting { margin: 0; left: auto; right: auto; }
  .greeting-screen .choice-button:first-child { background: linear-gradient(110deg, #343682, #4649a4); border-color: #3e4095; color: #fff; box-shadow: 0 4px 13px #3e40951b; }
  .greeting-screen .choice-button:first-child .icon { color: #b8e8ee; }
  .greeting-screen .choice-button:first-child:hover { background: #303275; }
  .greeting-screen .choice-button:last-child:nth-child(odd) { flex-basis: 100%; }
  .message-illustration { border: 1px solid #e5e9ef; padding: 5px 5px 8px; border-radius: 16px; background: #fcfdfd; }
  .message-illustration figcaption { padding: 0 8px; }
  .reply-progress { position: relative; padding: 10px 14px; width: fit-content; max-width: calc(100% - 8px); margin-left: max(8px, calc((100% - 680px) / 2 + 8px)); margin-right: auto; color: #3f4676; }
  .pending-message { opacity: .85; }
  /* A readable side-on tablet pose replaces the model strip during this short gesture. */
  .customer-page .lion-companion[data-mode="typing"][data-renderer="3d"] { display: block; height: 176px; min-height: 0; }
  .lion-companion[data-mode="typing"][data-renderer="3d"] .lion-stage { display: block; top: 0; left: auto; right: max(0px, calc((100% - 440px) / 2)); width: 70%; max-width: 320px; height: 100%; }
  .lion-companion[data-mode="typing"][data-renderer="3d"] .companion-topline { display: none; }
  .lion-companion[data-mode="typing"][data-renderer="3d"]::after { display: none; }
  .lion-companion[data-mode="typing"][data-renderer="3d"]::before { opacity: .2; }
  .lion-companion[data-mode="typing"][data-renderer="3d"] + .product-strip { display: none; }
  .mascot-status { position: absolute; z-index: 2; top: 50%; left: max(12px, calc((100% - 440px) / 2 + 16px)); transform: translateY(-50%); width: clamp(88px, 30%, 140px); padding: 15px 12px; display: flex; flex-direction: column; align-items: center; gap: 12px; color: var(--brand); font-size: 20px; line-height: 1.2; font-weight: 700; border-radius: 21px 21px 5px 21px; }
  .mascot-status::before { left: auto; right: -8px; top: calc(50% - 8px); border-left: 0; border-bottom: 0; border-top: 1px solid var(--bubble-line); border-right: 1px solid var(--bubble-line); }
  /* Keep one accessible progress status; only its visual duplicate is clipped. */
  .lion-companion[data-mode="typing"][data-renderer="3d"] ~ .conversation-scroll .reply-progress { position: absolute; width: 1px; height: 1px; min-height: 0; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); border: 0; }
  .customer-page.compact-viewport .lion-companion[data-mode="typing"][data-renderer="3d"],
  .customer-page.keyboard-open .lion-companion[data-mode="typing"][data-renderer="3d"] { height: 136px; }
  .customer-page.short-viewport .lion-companion[data-mode="typing"][data-renderer="3d"] { height: 112px; }
  .customer-page.short-viewport .mascot-status { padding: 12px; font-size: 18px; gap: 9px; }
  .lion-companion[data-cue="waiting"] .mascot-status { font-size: 16px; line-height: 1.4; font-weight: 600; }
  .customer-page .lion-companion[data-cue="waiting"][data-renderer="3d"]:not([data-mode="typing"]) { display: block; height: 144px; min-height: 0; }
  .lion-companion[data-cue="waiting"][data-renderer="3d"]:not([data-mode="typing"]) .lion-stage { display: block; top: 0; left: 50%; right: 0; width: 50%; height: 100%; }
  .lion-companion[data-cue="waiting"][data-renderer="3d"] .companion-topline { display: none; }
  .lion-companion[data-cue="waiting"][data-renderer="3d"]:not([data-mode="typing"]) .mascot-status { left: auto; right: 52%; width: calc(48% - 16px); max-width: 240px; padding: 12px 16px; }
  .customer-page.compact-viewport .lion-companion[data-cue="waiting"][data-renderer="3d"]:not([data-mode="typing"]),
  .customer-page.keyboard-open .lion-companion[data-cue="waiting"][data-renderer="3d"]:not([data-mode="typing"]) { height: 88px; }
  .customer-page.short-viewport .lion-companion[data-cue="waiting"][data-renderer="3d"]:not([data-mode="typing"]) { height: 72px; }
  .customer-page.short-viewport .lion-companion[data-cue="waiting"] .mascot-status { padding: 8px 12px; font-size: 13px; }
  /* Text clouds remain available while the renderer loads or cannot run. */
  .lion-companion:not([data-renderer="3d"])[data-cue="typing"],
  .lion-companion:not([data-renderer="3d"])[data-cue="waiting"] { display: block; height: 80px; }
  .lion-companion:not([data-renderer="3d"]) .mascot-status { left: 16px; right: 16px; width: auto; max-width: none; flex-direction: row; justify-content: center; padding: 12px; }
  .lion-companion:not([data-renderer="3d"]) .mascot-status::before,
  .lion-companion:not([data-renderer="3d"])[data-cue="typing"] .companion-topline,
  .lion-companion:not([data-renderer="3d"])[data-cue="waiting"] .companion-topline { display: none; }
  .lion-companion:not([data-renderer="3d"])[data-cue="typing"] ~ .conversation-scroll .reply-progress { position: absolute; width: 1px; height: 1px; min-height: 0; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); border: 0; }
  @keyframes signal-breathe { 50% { box-shadow: 0 0 2px #77dcea; opacity: .6; } }
  @media (max-width: 760px) {
    .mascot-greeting { left: 43%; right: 12px; padding: 16px 13px; }
    .mascot-greeting strong { font-size: 22px; }
    .greeting-screen .lion-stage { left: 0; right: 42%; top: 18px; bottom: -10px; }
  }
  .customer-page.keyboard-open .companion-topline, .customer-page.compact-viewport .companion-topline { display: none; }
  .customer-page.keyboard-open .lion-stage, .customer-page.compact-viewport .lion-stage { top: 0; }
  .customer-page.keyboard-open .mascot-greeting { top: auto; left: auto; right: auto; transform: none; }
  .customer-page.compact-viewport .mascot-greeting { top: 50%; }
  .customer-page.short-viewport .mascot-greeting { left: 16px; right: 16px; }
  .greeting-screen .lion-companion[data-renderer="unavailable"] .mascot-greeting { top: 60%; }
  @media (prefers-reduced-motion: reduce) { .signal-orb { animation: none !important; } }
  @media (forced-colors: active) {
    .companion-topline { color: CanvasText; }
    .speech-bubble { --bubble-fill: Canvas; --bubble-line: CanvasText; color: CanvasText; box-shadow: none; }
    .greeting-screen .choice-button:first-child { background: Canvas; color: CanvasText; border-color: CanvasText; }
  }
}

@layer layout {
  .customer-page {
    position: fixed; top: var(--viewport-top, 0px); left: 0; right: 0;
    height: 100vh; height: var(--app-height, 100dvh); min-height: 0; overflow: hidden;
    display: flex; flex-direction: column; overscroll-behavior: none;
    padding: 16px 24px; background: #eeefeb;
  }
  .site-header, .service-layout, .site-footer { width: min(100%, 840px); margin-left: auto; margin-right: auto; }
  .site-header {
    display: flex; align-items: center; justify-content: space-between; gap: 16px;
    flex: none; min-height: 72px; padding: 5px 24px; border: 1px solid var(--line);
    border-bottom: 0; border-radius: 22px 22px 0 0; background: #fff;
  }
  .brand-link { display: inline-flex; align-items: center; line-height: 0; flex: none; min-height: 44px; }
  .brand-logo { width: 117px; height: auto; }
  .header-actions { display: flex; align-items: center; justify-content: flex-end; gap: 8px; min-width: 0; }
  .connection-status { font-size: 13px; line-height: 1.4; color: var(--muted); text-align: right; max-width: 200px; }
  .connection-status { overflow-wrap: anywhere; }
  .connection-status[data-ready="true"]::before { content: ""; display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: #368562; margin-right: 7px; vertical-align: 1px; }
  .pilot-badge { display: inline-flex; align-items: center; justify-content: center; padding: 4px 9px; border: 1px solid #c7c8e4; border-radius: 100px; background: var(--brand-soft); color: var(--brand-dark); font-size: 13px; font-weight: 650; }
  .service-layout { display: flex; flex: 1; min-height: 0; }
  .chat-panel { display: flex; flex-direction: column; flex: 1; min-width: 0; min-height: 0; background: var(--surface); border-left: 1px solid var(--line); border-right: 1px solid var(--line); overflow: hidden; }
  .lion-companion { position: relative; flex: none; width: 100%; height: 166px; background: var(--page); }
  .lion-stage { position: absolute; inset: 0; overflow: hidden; isolation: isolate; background: transparent; contain: layout paint; }
  #lion-canvas-mount { position: absolute; inset: 0; width: 100%; height: 100%; }
  #lion-canvas-mount { z-index: 1; }
  #lion-canvas-mount canvas { display: block; width: 100%; height: 100%; pointer-events: none; }
  .lion-companion[data-renderer="unavailable"] { display: none; }
  .greeting-screen .lion-companion { height: 260px; }
  .greeting-screen .lion-stage { right: 49%; top: 19px; bottom: -9px; }
  .mascot-greeting { position: absolute; left: 45%; right: 25px; top: 50%; transform: translateY(-50%); padding: 21px 23px; }
  .mascot-greeting p { position: relative; font-size: 22px; line-height: 1.4; }
  .mascot-greeting strong { display: block; font-size: 27px; letter-spacing: -.6px; color: var(--brand); margin-bottom: 7px; }
  .mascot-greeting span { display: block; }
  .greeting-voice { margin: 8px 0 -8px -8px; font-size: 13px; }
  .greeting-voice span { display: inline; }
  .greeting-screen .lion-companion[data-renderer="unavailable"] { display: block; height: 175px; }
  .greeting-screen .lion-companion[data-renderer="unavailable"] .lion-stage { display: none; }
  .greeting-screen .lion-companion[data-renderer="unavailable"] .mascot-greeting { left: 20px; right: 20px; }
  .greeting-screen .messages { min-height: 0; }
  .greeting-screen .conversation-scroll { padding-top: 8px; background: #fff; }
  .greeting-screen .choice-list { margin-top: 16px; }
  .site-footer { display: flex; align-items: center; justify-content: center; flex: none; padding: 0 20px max(3px, env(safe-area-inset-bottom)); border: 1px solid var(--line); border-top: 0; border-radius: 0 0 22px 22px; background: #fff; }
  .footer-links { display: flex; align-items: center; gap: 15px; font-size: 13px; color: #6d7680; }
  .footer-links a { display: inline-flex; align-items: center; justify-content: center; min-height: 44px; color: #59636e; text-decoration: none; }
  .footer-links a:hover { text-decoration: underline; }
  .footer-links button { min-height: 44px; border: 0; background: transparent; padding: 4px 0; color: #59636e; font-size: 13px; }
  .footer-links button:hover { text-decoration: underline; }
}

@layer components {
  .primary-button, .secondary-button, .text-button, .icon-button, .send-button {
    display: inline-flex; align-items: center; justify-content: center; gap: 9px; min-height: 44px;
    font-weight: 650; transition: background-color .15s, color .15s, border-color .15s;
  }
  .primary-button { background: var(--brand); color: #fff; border: 1px solid var(--brand); padding: 11px 17px; border-radius: 12px; font-size: 16px; }
  .primary-button:hover:not(:disabled) { background: var(--brand-dark); border-color: var(--brand-dark); }
  .secondary-button { background: #fff; border: 1px solid var(--line-strong); padding: 10px 16px; border-radius: 12px; font-size: 16px; }
  .secondary-button:hover:not(:disabled) { background: var(--brand-soft); border-color: #b5b6d3; }
  .text-button { background: transparent; border: 0; color: var(--brand); padding: 6px 8px; font-size: 14px; border-radius: 9px; }
  .text-button:hover:not(:disabled) { background: var(--brand-soft); }
  .icon-button { border: 1px solid transparent; background: transparent; padding: 10px; border-radius: 12px; min-width: 44px; color: var(--muted); }
  .icon-button:hover:not(:disabled) { background: var(--brand-soft); color: var(--brand); }
  .product-strip { display: flex; gap: 10px; align-items: center; justify-content: space-between; flex: none; min-height: 56px; padding: 5px 22px; border-top: 1px solid #e5e6df; border-bottom: 1px solid var(--line); background: #fbfcfc; }
  .product-strip-copy { min-width: 0; display: flex; align-items: center; gap: 9px; }
  .product-strip-copy > .icon { width: 18px; height: 18px; color: #748077; }
  .product-strip-copy strong { font-size: 14px; font-weight: 600; line-height: 1.45; overflow-wrap: anywhere; }
  .product-strip .text-button { flex: none; white-space: nowrap; }
  .conversation-scroll { position: relative; flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: 24px 36px 22px; scroll-padding: 20px; scrollbar-width: thin; scrollbar-color: #bec5c9 transparent; background: #f8f9fc; }
  .messages { display: flex; flex-direction: column; gap: 23px; min-height: 48px; }
  .messages, .choice-list, .ticket-receipt, .reply-progress { width: 100%; max-width: 680px; margin-left: auto; margin-right: auto; }
  .message { max-width: 100%; min-width: 0; overflow-wrap: anywhere; }
  .speech-bubble { --bubble-fill: #fff; --bubble-line: #dfe5ef; background: var(--bubble-fill); border: 1px solid var(--bubble-line); border-radius: 23px 23px 23px 5px; color: var(--ink); box-shadow: 0 4px 16px #20284908; }
  .speech-bubble::before { content: ""; position: absolute; left: -8px; top: 25px; width: 16px; height: 16px; background: var(--bubble-fill); border-left: 1px solid var(--bubble-line); border-bottom: 1px solid var(--bubble-line); transform: rotate(45deg); border-radius: 0 0 0 3px; pointer-events: none; }
  .mascot-greeting.speech-bubble::before { left: -10px; top: auto; bottom: 24px; width: 20px; height: 20px; }
  .message-author { display: block; color: var(--brand-dark); font-size: 13px; font-weight: 700; line-height: 1.4; margin-bottom: 7px; }
  .message-text { font-size: 17px; line-height: 1.65; white-space: pre-wrap; }
  .message.assistant { position: relative; align-self: flex-start; max-width: calc(100% - 8px); margin-left: 8px; padding: 17px 20px; }
  .message-illustration { margin: 13px 0 2px; max-width: 420px; }
  .message-illustration img { display: block; width: 100%; height: auto; border-radius: 14px; }
  .message-illustration figcaption { font-size: 13px; line-height: 1.5; color: var(--muted); margin-top: 7px; }
  .message.user { align-self: flex-end; max-width: 88%; padding: 11px 16px; border-radius: 18px 18px 4px 18px; background: var(--brand-soft); color: #303368; }
  .message.user .message-author { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
  .message.user .message-text { font-size: 16px; line-height: 1.6; }
  .choice-list { display: flex; flex-wrap: wrap; gap: 9px; margin-top: 20px; }
  .choice-list:empty { display: none; }
  .choice-button { display: flex; align-items: center; justify-content: space-between; gap: 14px; min-height: 49px; flex: 1 1 calc(50% - 9px); text-align: left; border: 1px solid #cbd1d8; background: #fff; padding: 11px 15px; border-radius: 13px; color: #323776; font-size: 16px; font-weight: 600; line-height: 1.45; }
  .choice-button > span { min-width: 0; overflow-wrap: anywhere; }
  .choice-button:hover:not(:disabled) { border-color: var(--brand); background: var(--brand-soft); }
  .choice-button .icon { color: #73769e; }
  .reply-progress { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 14px; margin-top: 20px; }
  .reply-progress.speech-bubble::before { left: -6px; top: 13px; width: 12px; height: 12px; }
  .typing-dots { display: flex; flex: none; gap: 5px; }
  .typing-dots i { width: 6px; height: 6px; border-radius: 50%; background: var(--brand); animation: dot-pulse 1.2s infinite ease-in-out; }
  .typing-dots i:nth-child(2) { animation-delay: .15s; }
  .typing-dots i:nth-child(3) { animation-delay: .3s; }
  @keyframes dot-pulse { 0%,70%,100% { opacity: .35; transform: translateY(0); } 35% { opacity: 1; transform: translateY(-3px); } }
  .skeleton-line { height: 14px; width: 240px; max-width: 100%; border-radius: 6px; background: #e8ebed; margin-bottom: 12px; animation: skeleton-pulse 1.5s infinite alternate; }
  .skeleton-line.short { width: 170px; }
  @keyframes skeleton-pulse { from { opacity: .5; } to { opacity: 1; } }
  .composer { flex: none; padding: 12px 24px 0; background: #fff; }
  .composer-input { display: flex; align-items: flex-end; gap: 4px; padding: 5px; border: 1px solid #b7bfc9; border-radius: 17px; background: #fff; box-shadow: 0 2px 9px #20283305; }
  .composer-input:focus-within { border-color: var(--brand); box-shadow: 0 0 0 2px #3e409514; }
  .composer-input textarea { resize: none; min-width: 0; min-height: 44px; max-height: 112px; line-height: 1.5; border: 0; background: transparent; padding: 10px 5px; font-size: 16px; border-radius: 7px; }
  .composer-input textarea:focus-visible { outline: 2px solid var(--brand); outline-offset: -2px; }
  .photo-shortcut { width: 44px; height: 44px; flex: none; color: #606a74; }
  .send-button { width: 44px; min-height: 44px; height: 44px; flex: none; border: 0; border-radius: 12px; background: var(--brand); color: #fff; }
  .send-button:hover:not(:disabled) { background: var(--brand-dark); }
  .send-button:disabled { background: #e6e8ee; color: #747f8f; opacity: 1; }
  .notice { display: flex; gap: 10px; padding: 13px 15px; border: 1px solid #d5d7e6; border-radius: 12px; background: var(--brand-soft); color: var(--brand-dark); font-size: 14px; line-height: 1.6; }
  .notice strong { display: block; font-size: 15px; margin-bottom: 3px; }
  .notice.error { background: var(--error-bg); border-color: #e9bec4; color: var(--error); display: block; }
  .notice .icon { margin-top: 2px; width: 19px; height: 19px; }
  .notice p { min-width: 0; overflow-wrap: anywhere; }
  .chat-error { flex: none; margin: 7px 24px 0; }
  .chat-error .text-button { margin-left: -8px; color: var(--error); }
  .ticket-receipt { display: flex; gap: 13px; padding: 17px; margin-top: 22px; border: 1px solid #b7d7c2; background: var(--success-bg); border-radius: 14px; color: var(--success); }
  .ticket-receipt .icon { margin-top: 2px; }
  .ticket-receipt h2 { font-size: 16px; font-weight: 600; margin-bottom: 6px; }
  .ticket-receipt strong { font-size: 20px; letter-spacing: .2px; overflow-wrap: anywhere; }
  .ticket-receipt p { font-size: 14px; margin-top: 4px; }
  .app-dialog { position: fixed; left: 0; right: 0; top: calc(var(--viewport-top, 0px) + var(--app-height, 100dvh) / 2); bottom: auto; width: min(620px, calc(100% - 32px)); max-height: min(780px, calc(var(--app-height, 100dvh) - 32px)); margin: 0 auto; transform: translateY(-50%); padding: 24px; border: 1px solid var(--line); border-radius: 22px; background: var(--surface); color: var(--ink); box-shadow: 0 20px 80px #18222e38; overflow-y: auto; overscroll-behavior: contain; }
  .app-dialog::backdrop { background: #18222e70; backdrop-filter: blur(4px); }
  .dialog-header { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
  .dialog-header > .icon-button { flex: none; }
  .dialog-description { font-size: 16px; line-height: 1.55; color: var(--muted); margin-bottom: 20px; }
  .dialog-actions { display: flex; align-items: center; justify-content: flex-end; gap: 10px; margin-top: 18px; }
  .dialog-actions .primary-button { min-width: 130px; }
  .product-dialog { padding: 0; overflow: hidden; }
  .product-dialog[open] { display: flex; flex-direction: column; }
  .product-dialog .dialog-header { flex: none; margin: 0; padding: 13px 18px; border-bottom: 1px solid var(--line); }
  .dialog-body { flex: 1; min-height: 80px; padding: 18px; overflow-y: auto; overscroll-behavior: contain; }
  .dialog-footer { flex: none; padding: 0 18px 18px; border-top: 1px solid var(--line); background: #fff; }
  .dialog-footer .check-row { margin: 13px 0 3px; }
  .dialog-footer .dialog-actions { margin-top: 8px; }
  .search-field { display: flex; align-items: center; gap: 8px; border: 1px solid var(--line-strong); border-radius: 12px; padding: 0 12px; margin-top: 7px; }
  .search-field > .icon { color: var(--muted); width: 20px; height: 20px; }
  .search-field input:not([type=checkbox]) { border: 0; padding: 11px 0; background: transparent; min-width: 0; }
  .search-field input:focus-visible { outline-offset: 0; }
  .picker-status { margin: 11px 0; min-height: 21px; }
  .product-results { display: flex; flex-direction: column; gap: 9px; padding: 3px; }
  .product-option { display: flex; align-items: flex-start; gap: 12px; border: 1px solid var(--line); padding: 14px 12px; border-radius: 12px; font-weight: 400; cursor: pointer; background: #fff; }
  .product-option:hover { border-color: #b6bdc6; }
  .product-option:has(input:checked) { border-color: var(--brand); background: var(--brand-soft); }
  .product-option-copy { display: flex; flex-direction: column; min-width: 0; gap: 5px; overflow-wrap: anywhere; }
  .product-option-copy strong { font-size: 16px; line-height: 1.5; }
  .product-option-copy > span { font-size: 14px; line-height: 1.5; color: var(--muted); }
  .check-row { display: flex; align-items: flex-start; gap: 11px; min-height: 44px; font-size: 15px; line-height: 1.55; font-weight: 450; cursor: pointer; margin: 19px 0; }
  .check-row > span { padding-top: 0; }
  .photo-controls { display: flex; gap: 9px; flex-wrap: wrap; }
  .photo-controls > button { flex: 1; }
  .file-note { margin: 10px 0 15px; }
  .photo-preview { border: 1px solid var(--line); border-radius: 13px; overflow: hidden; margin: 10px 0 18px; background: #f1f3f5; }
  .photo-preview > img { display: block; width: 100%; height: 220px; object-fit: contain; }
  .photo-preview-caption { display: flex; align-items: center; gap: 10px; justify-content: space-between; padding: 4px 12px; background: #fff; }
  .photo-preview-caption > span { min-width: 0; font-size: 14px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .photo-preview-caption button { flex: none; }
  .photo-progress { margin: 15px 0; }
  .photo-dialog .notice.error { margin: 14px 0; }
  .photo-result { border-top: 1px solid var(--line); padding-top: 22px; margin-top: 22px; }
  .photo-result > h3 { margin-bottom: 7px; }
  .extraction-list { display: grid; grid-template-columns: 95px minmax(0,1fr); gap: 9px 13px; padding: 15px; background: var(--page); border-radius: 12px; font-size: 15px; margin: 15px 0; }
  .extraction-list dt { font-weight: 650; color: var(--muted); }
  .extraction-list dd { margin: 0; overflow-wrap: anywhere; white-space: pre-wrap; }
  .uncertainties { padding-left: 20px; margin: 0 0 16px; font-size: 15px; color: var(--warn); line-height: 1.6; }
  .uncertainties:empty { display: none; }
  .photo-result .product-picker { margin: 20px 0; }
  .photo-result #confirmed-code { margin-top: 7px; letter-spacing: .7px; font-family: ui-monospace, SFMono-Regular, Consolas, monospace; }
  .photo-result #code-note { margin-top: 6px; }
  .photo-manual-option { display: flex; align-items: center; justify-content: center; margin-top: 18px; padding-top: 12px; border-top: 1px solid var(--line); }
  .photo-result:focus { outline: none; }
}

@layer responsive {
  .greeting-screen .messages { min-height: 0; }
  .greeting-screen .conversation-scroll { padding-top: 8px; background: #fff; }
  .greeting-screen .choice-list { margin-top: 16px; }
  @media (max-width: 760px) {
    .customer-page { padding: 0; background: #fff; }
    .site-header { min-height: 65px; padding: max(3px, env(safe-area-inset-top)) 14px 3px; border: 0; border-radius: 0; }
    .brand-logo { width: 109px; }
    .header-actions { gap: 4px; }
    .connection-status { max-width: 165px; }
    .chat-panel { border: 0; }
    .lion-companion { height: 134px; }
    .greeting-screen .lion-companion { height: 244px; }
    .greeting-screen .lion-stage { left: 0; right: 42%; top: 18px; bottom: -10px; }
    .mascot-greeting { left: 48%; right: 12px; padding: 18px 15px; }
    .mascot-greeting p { font-size: 19px; }
    .mascot-greeting strong { font-size: 23px; }
    .product-strip { padding: 4px 13px 4px 17px; min-height: 54px; }
    .product-strip-copy { gap: 7px; }
    .product-strip-copy > .icon { display: none; }
    .product-strip-copy strong { font-size: 14px; }
    .conversation-scroll { padding: 21px 20px 18px; }
    .message-text { font-size: 17px; line-height: 1.65; }
    .message.assistant { padding: 15px 16px; }
    .message.user { padding: 10px 14px; }
    .messages { gap: 21px; }
    .choice-button { flex-basis: calc(50% - 9px); padding: 11px 12px; gap: 9px; }
    .choice-button .icon { width: 16px; height: 16px; }
    .composer { padding: 10px 13px 0; }
    .chat-error { margin: 7px 13px 0; }
    .site-footer { border: 0; border-radius: 0; }
    .footer-links { gap: 14px; }
    .app-dialog { width: calc(100% - 20px); max-height: calc(var(--app-height, 100dvh) - 20px); border-radius: 19px; padding: 18px; }
    .product-dialog { padding: 0; }
    .dialog-header h2 { font-size: 22px; }
    .dialog-description { font-size: 16px; margin-bottom: 17px; }
    .photo-controls { gap: 8px; }
    .photo-controls > button { padding: 10px 11px; }
    .photo-preview > img { height: 180px; }
    .extraction-list { grid-template-columns: 83px minmax(0,1fr); padding: 13px; }
  }
  @media (max-width: 370px) {
    .site-header { padding-left: 12px; padding-right: 10px; }
    .brand-logo { width: 102px; }
    .connection-status { max-width: 139px; }
    .conversation-scroll { padding-left: 17px; padding-right: 17px; }
    .choice-button { flex-basis: 100%; }
    .greeting-screen .lion-stage { right: 44%; }
    .mascot-greeting { left: 47%; right: 10px; padding-left: 12px; padding-right: 12px; }
    .dialog-body { padding: 15px; }
    .dialog-footer { padding-left: 15px; padding-right: 15px; }
    .photo-controls { flex-direction: column; }
  }
  .customer-page.keyboard-open .site-footer { display: none; }
  .customer-page.keyboard-open .lion-companion { height: 72px; }
  .customer-page.keyboard-open .mascot-greeting { position: relative; left: auto; right: auto; top: auto; transform: none; padding: 10px 20px; box-shadow: none; }
  .customer-page.keyboard-open .mascot-greeting::before, .customer-page.keyboard-open .greeting-voice { display: none; }
  .customer-page.keyboard-open .mascot-greeting p { font-size: 17px; }
  .customer-page.keyboard-open .mascot-greeting strong { font-size: 18px; margin: 0; }
  .customer-page.keyboard-open.greeting-screen .lion-stage { display: none; }
  .customer-page.keyboard-open .composer { padding-top: 7px; padding-bottom: 8px; }
  .customer-page.compact-viewport { padding-top: 0; padding-bottom: 0; }
  .customer-page.compact-viewport .site-header { min-height: 50px; padding-top: 0; padding-bottom: 0; }
  .customer-page.compact-viewport .brand-logo { width: 89px; }
  .customer-page.compact-viewport .lion-companion { height: 72px; }
  .customer-page.compact-viewport.greeting-screen .lion-companion { height: 118px; }
  .customer-page.compact-viewport .mascot-greeting p { font-size: 16px; }
  .customer-page.compact-viewport .mascot-greeting strong { font-size: 19px; margin: 0; }
  .customer-page.compact-viewport .greeting-voice { display: none; }
  .customer-page.short-viewport.greeting-screen .lion-companion { display: block; height: 72px; }
  .customer-page.short-viewport.greeting-screen .lion-stage { display: none; }
  .customer-page.short-viewport .mascot-greeting { left: 16px; right: 16px; padding: 8px 15px; }
  .customer-page.compact-viewport .site-footer { display: none; }
  .customer-page.compact-viewport .composer { padding-bottom: 8px; }
  .customer-page.compact-viewport .product-strip { min-height: 48px; padding-top: 0; padding-bottom: 0; }
  .customer-page.compact-viewport .conversation-scroll { padding-top: 14px; padding-bottom: 14px; }
  .customer-page.compact-viewport .composer-input textarea { max-height: 76px; }
  .customer-page.short-viewport .lion-companion { display: none; }
  .customer-page.short-viewport .composer-input textarea { max-height: 52px; }
  @media (max-height: 430px) {
    .customer-page .lion-companion { height: 56px; }
    .customer-page .site-header { min-height: 48px; padding-top: 0; padding-bottom: 0; }
    .customer-page .brand-logo { width: 84px; }
    .customer-page .site-footer { display: none; }
    .customer-page .composer { padding-top: 6px; padding-bottom: 8px; }
  }
  @media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
    .greeting-screen #lion-canvas-mount canvas { filter: none; }
  }
  @media (forced-colors: active) {
    button, input, textarea, select, .chat-panel, .message.user, .notice, .product-option { border: 1px solid CanvasText; }
    .pilot-badge { border: 1px solid CanvasText; }
    .lion-stage { forced-color-adjust: none; }
  }
}
