/*
 * citizen-first-use-shell.css
 * First-use chat-only to split local-demo shell.
 * Local-only; no external assets, analytics, persistence, or network behavior.
 */

:root {
  --first-use-chat-width: 420px;
  --first-use-entry-chat-width: min(650px, calc(100vw - 80px));
  --first-use-motion: 1100ms;
  --first-use-ease: cubic-bezier(0.16, 1, 0.3, 1);
  --first-use-navy: #071b3a;
  --first-use-blue: #0c3975;
  --first-use-teal: #00a58f;
  --first-use-mint: #55dfc8;
  --first-use-coral: #ff7654;
}

.first-use-layout {
  width: 100%;
  flex: 1 1 auto;
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(0, 1fr) var(--first-use-chat-width);
  grid-template-rows: minmax(0, 1fr);
  grid-template-areas: "canvas chat";
  align-items: stretch;
  background: #eaf1f5;
  overflow: hidden;
  position: relative;
  transition: grid-template-columns var(--first-use-motion) var(--first-use-ease);
}

.first-use-layout__spacer {
  display: none;
}

.entry-stage {
  position: absolute;
  inset: 0;
  z-index: 2;
  overflow: hidden;
  color: #fff;
  background:
    radial-gradient(circle at 74% 18%, rgba(85, 223, 200, 0.22), transparent 30%),
    radial-gradient(circle at 15% 85%, rgba(36, 112, 196, 0.28), transparent 34%),
    linear-gradient(118deg, #06162f 0%, #0a2b58 52%, #075f69 100%);
  transition:
    opacity 620ms ease,
    filter 820ms ease,
    transform 1100ms var(--first-use-ease),
    visibility 0s linear 1100ms;
}

.entry-stage::before {
  content: "";
  position: absolute;
  inset: 0;
  opacity: 0.18;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.08) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.08) 1px, transparent 1px);
  background-size: 72px 72px;
  mask-image: linear-gradient(105deg, #000, transparent 68%);
}

.entry-stage::after {
  content: "";
  position: absolute;
  inset: auto -8vw -42vh 30vw;
  height: 88vh;
  border-radius: 50%;
  border: 1px solid rgba(103, 239, 217, 0.24);
  box-shadow:
    0 0 0 80px rgba(73, 210, 190, 0.035),
    0 0 0 180px rgba(73, 210, 190, 0.028),
    0 0 120px rgba(64, 226, 201, 0.16);
}

.entry-stage__aurora {
  position: absolute;
  width: 34vw;
  aspect-ratio: 1;
  border-radius: 50%;
  filter: blur(78px);
  opacity: 0.34;
  animation: firstUseAurora 9s ease-in-out infinite alternate;
}

.entry-stage__aurora--one {
  right: 5vw;
  top: -15vw;
  background: #3cf0cf;
}

.entry-stage__aurora--two {
  left: -12vw;
  bottom: -20vw;
  background: #2e72d4;
  animation-delay: -4s;
}

.entry-stage__building {
  position: absolute;
  right: 0;
  bottom: -9vh;
  width: min(31vw, 420px);
  height: 86vh;
  object-fit: cover;
  object-position: left center;
  opacity: 0.24;
  mix-blend-mode: screen;
  filter: contrast(1.12) saturate(0.7);
}

.entry-stage__brand {
  position: absolute;
  top: clamp(28px, 4vh, 48px);
  left: clamp(38px, 7.8vw, 126px);
  display: flex;
  align-items: center;
  gap: 16px;
}

.entry-stage__brand img {
  display: block;
  width: 216px;
  padding: 0;
  border-radius: 10px;
  background: transparent;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.14);
  opacity: 1;
}

.entry-stage__brand span {
  padding-left: 16px;
  border-left: 1px solid rgba(255, 255, 255, 0.28);
  color: rgba(255, 255, 255, 0.7);
  font-size: 0.76rem;
  font-weight: 700;
  letter-spacing: 0.14em;
}

.entry-stage__copy {
  position: absolute;
  z-index: 2;
  top: clamp(96px, 13vh, 132px);
  left: clamp(38px, 7.8vw, 126px);
  max-width: 630px;
}

.entry-stage__eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--first-use-mint);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.18em;
}

.entry-stage__eyebrow i,
.entry-stage__signal i {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--first-use-mint);
  box-shadow: 0 0 0 0 rgba(85, 223, 200, 0.58);
  animation: firstUseSignal 1.8s ease-out infinite;
}

.entry-stage__copy h1 {
  margin-top: 12px;
  color: #fff;
  font-size: clamp(2.25rem, 4vw, 4.75rem);
  font-weight: 850;
  line-height: 0.98;
  letter-spacing: -0.065em;
  text-shadow: 0 18px 50px rgba(0, 0, 0, 0.22);
}

.entry-stage__copy h1 em {
  color: transparent;
  font-style: normal;
  -webkit-text-stroke: 1px rgba(255, 255, 255, 0.84);
  text-shadow: none;
}

.entry-stage__copy p {
  margin-top: 16px;
  color: rgba(231, 247, 246, 0.76);
  font-size: 1rem;
  line-height: 1.65;
}

.entry-stage__capabilities {
  display: flex;
  gap: 12px;
  align-items: center;
  /* #1114: nudge the FIND/ACT/WRITE row ~10px up so it never touches/overlaps
     the chat panel even on short desktops (1440x760). */
  margin-top: 8px;
  color: rgba(255, 255, 255, 0.62);
  font-size: 0.72rem;
  letter-spacing: 0.08em;
}

.entry-stage__capabilities span {
  color: var(--first-use-mint);
  font-family: ui-monospace, "Cascadia Code", monospace;
  font-size: 0.61rem;
  font-weight: 800;
}

.entry-stage__capabilities b {
  font-weight: 650;
  letter-spacing: -0.02em;
}

.entry-stage__mayor {
  position: absolute;
  z-index: 2;
  top: clamp(165px, 22vh, 218px);
  right: clamp(38px, 7.5vw, 118px);
  width: min(25vw, 360px);
  min-width: 300px;
  transform: rotate(1.5deg);
  filter: drop-shadow(0 36px 58px rgba(0, 0, 0, 0.3));
  animation: firstUseMayorFloat 6s ease-in-out infinite;
}

.entry-stage__mayor > img {
  display: block;
  width: 100%;
  border: 1px solid rgba(255, 255, 255, 0.28);
  border-radius: 22px;
}

.entry-stage__mayor-orbit {
  position: absolute;
  inset: -32px;
  z-index: -1;
  border: 1px solid rgba(85, 223, 200, 0.35);
  border-radius: 32px;
  transform: rotate(-5deg);
}

.entry-stage__mayor figcaption {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin: 13px 4px 0;
  color: rgba(255, 255, 255, 0.82);
  font-size: 0.76rem;
}

.entry-stage__mayor figcaption span {
  color: var(--first-use-mint);
  font-family: ui-monospace, "Cascadia Code", monospace;
  font-size: 0.62rem;
  letter-spacing: 0.12em;
}

.entry-stage__signal {
  position: absolute;
  right: clamp(34px, 6vw, 94px);
  bottom: 34px;
  display: flex;
  align-items: center;
  gap: 10px;
  color: rgba(255, 255, 255, 0.62);
  font-family: ui-monospace, "Cascadia Code", monospace;
  font-size: 0.65rem;
  letter-spacing: 0.16em;
}

.first-use-layout .demo-canvas {
  grid-area: canvas;
  position: relative;
  z-index: 1;
  min-width: 0;
  max-width: none;
  width: 100%;
  opacity: 1;
  visibility: visible;
  pointer-events: none;
  transform-origin: left center;
  transition: opacity 420ms ease;
}
.first-use-layout .demo-canvas .demo-canvas__inner {
  transition: opacity 420ms ease;
}

.first-use-layout .chat-shell {
  grid-area: chat;
  min-width: 0;
  max-width: none;
  width: 100%;
  border-left: 1px solid rgba(12, 57, 117, 0.12);
  box-shadow: 0 18px 50px rgba(39, 57, 75, 0.1);
  z-index: 10;
  will-change: transform;
  transition:
    height var(--first-use-motion) var(--first-use-ease),
    width var(--first-use-motion) var(--first-use-ease),
    border-radius var(--first-use-motion) ease,
    box-shadow var(--first-use-motion) ease,
    background-color 500ms ease,
    opacity 420ms ease;
}

.first-use-layout::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 3;
  pointer-events: none;
  opacity: 0.15;
  background: linear-gradient(120deg, transparent 18%, rgba(255, 255, 255, 0.16) 50%, transparent 68%);
  transform: translateX(-120%);
  animation: firstUseLightSweep 8s ease-in-out infinite 1.4s;
  transition: opacity 520ms ease;
}

body[data-first-use-state="entry"] .first-use-layout {
  grid-template-columns: 1fr 0;
}

body[data-first-use-state="entry"] .demo-canvas {
  grid-area: 1 / 1 / -1 / -1;
  opacity: 0;
  pointer-events: none;
}

body[data-first-use-state="entry"] #demo-canvas[inert],
body[data-first-use-state="transitioning"] #demo-canvas[inert] {
  display: flex !important;
  visibility: visible;
}

body[data-first-use-state="entry"] .chat-shell {
  grid-area: 1 / 1 / -1 / -1;
  place-self: end start;
  margin: 0 0 clamp(36px, 6vh, 68px) clamp(38px, 7.8vw, 126px);
  width: var(--first-use-entry-chat-width);
  height: min(520px, calc(100vh - 300px));
  min-height: 410px;
  display: flex;
  flex-direction: column;
  border: 1px solid rgba(255, 255, 255, 0.58);
  border-radius: 26px;
  background: rgba(255, 255, 255, 0.94);
  box-shadow:
    0 34px 90px rgba(1, 14, 35, 0.38),
    inset 0 1px 0 rgba(255, 255, 255, 0.84);
  backdrop-filter: blur(22px) saturate(1.16);
  animation: firstUseChatArrive 900ms var(--first-use-ease) both;
}

/* #1190: entry chips size to content — do not flex-grow leftover empty space
   under the last chip row. Reclaimed height goes to #chat-thread.
   flex-shrink stays 0 at normal heights so wrapped chips never clip (#1114 768×1024).
   Only very short viewports apply max-height + overflow-y scroll (not flex-shrink). */
body[data-first-use-state="entry"] .chat-thread {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
}

body[data-first-use-state="entry"] .chat-chips {
  flex: 0 0 auto;
  flex-wrap: wrap;
  overflow-y: visible;
  align-content: flex-start;
  min-height: 0;
  max-height: none;
}

/* Short entry shells only (viewport height ≤760px): bound chips rail so
   composer stays fully visible. 768×1024 is NOT short-height — do not apply. */
@media (max-height: 760px) {
  body[data-first-use-state="entry"] .chat-chips {
    /* Keep flex-grow/shrink 0; max-height alone provides the bound. */
    max-height: min(36vh, 220px);
    overflow-y: auto;
  }
}

body[data-first-use-state="entry"] .chat-composer {
  flex-shrink: 0;
}

body[data-first-use-state="entry"] .chat-shell__header {
  padding: 17px 20px;
  background: transparent;
  border-color: rgba(8, 39, 80, 0.1);
}

body[data-first-use-state="entry"] .chat-shell__title {
  color: var(--first-use-navy);
  font-size: 1rem;
  font-weight: 800;
}

body[data-first-use-state="entry"] .chat-shell__badge {
  color: #067566;
  background: rgba(0, 165, 143, 0.1);
}

body[data-first-use-state="entry"] .chat-avatar {
  background: linear-gradient(145deg, var(--first-use-blue), var(--first-use-teal));
  box-shadow: 0 6px 16px rgba(0, 128, 119, 0.2);
}

body[data-first-use-state="entry"] .chat-composer__row {
  border-color: rgba(7, 61, 107, 0.2);
  box-shadow: 0 10px 30px rgba(7, 27, 58, 0.06);
}

body[data-first-use-state="entry"] .chat-composer__send {
  background: linear-gradient(135deg, var(--first-use-coral), #ff9466);
  box-shadow: 0 7px 18px rgba(255, 118, 84, 0.25);
}

body[data-first-use-state="transitioning"] .first-use-layout,
body[data-first-use-state="split"] .first-use-layout {
  grid-template-columns: minmax(0, 1fr) var(--first-use-chat-width);
}

body[data-first-use-state="transitioning"] .chat-shell,
body[data-first-use-state="split"] .chat-shell {
  grid-area: chat;
  align-self: stretch;
  width: var(--first-use-chat-width);
  height: 100vh;
  flex-shrink: 0;
  border-top: 0;
  border-right: 0;
  border-bottom: 0;
  border-radius: 0;
  display: flex;
  flex-direction: column;
}

/* #1142: keep last AI message + decision actions above sticky chips/composer. */
body[data-first-use-state="transitioning"] .chat-thread,
body[data-first-use-state="split"] .chat-thread {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  scroll-padding-bottom: 28px;
  padding-bottom: 20px;
}

body[data-first-use-state="transitioning"] .chat-chips,
body[data-first-use-state="split"] .chat-chips,
body[data-first-use-state="transitioning"] .chat-composer,
body[data-first-use-state="split"] .chat-composer {
  flex-shrink: 0;
}

body[data-first-use-state="transitioning"] .entry-stage,
body[data-first-use-state="split"] .entry-stage {
  opacity: 0;
  visibility: hidden;
  filter: blur(16px);
  transform: scale(1.06);
  pointer-events: none;
}

body[data-first-use-state="transitioning"] .first-use-layout::after,
body[data-first-use-state="split"] .first-use-layout::after {
  opacity: 0;
  animation: none;
}

body[data-first-use-state="transitioning"] .demo-canvas {
  opacity: 1;
  pointer-events: none;
  animation: firstUseCanvasReveal var(--first-use-motion) var(--first-use-ease) both;
}

body[data-first-use-state="split"] .demo-canvas {
  opacity: 1;
  transform: none;
  clip-path: inset(0);
  filter: none;
  pointer-events: auto;
}

.chat-shell__header-main {
  display: flex;
  min-width: 0;
  flex: 1 1 auto;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  gap: 2px;
}

/* #1067: semantic journey status — SR-only, no layout impact.
   Do not use display:none / visibility:hidden / [hidden]. */
.chat-shell__journey-status {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

/* #1121: keep attribution muted and subordinate on narrow first-use shells. */
.chat-shell__attribution {
  font-size: 0.66rem;
}

.chat-shell__disclosure {
  font-size: 0.62rem;
  padding: 5px 12px 8px;
}

/* #1143: draft role labels in chat (non-Korean original + Korean admin draft). */
.chat-draft-label {
  margin: 0 0 6px;
  color: #0c5f8a;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.01em;
}

.chat-draft-body {
  margin: 0;
  white-space: pre-wrap;
  line-height: 1.5;
}

.chat-msg[data-draft-role="original-resident"] .chat-bubble,
.chat-msg[data-draft-role="korean-administrative-draft"] .chat-bubble {
  border: 1px solid #d7e2ef;
  background: #f7fafc;
}

/* #1152: two-stage bilingual draft review cards (chat-owned, editable Stage 1). */
.chat-msg--bilingual-draft {
  width: 100%;
  max-width: 100%;
}

.chat-bilingual-draft {
  width: 100%;
  max-width: min(100%, 34rem);
  border: 1px solid #d7e2ef;
  background: #f7fafc;
  box-sizing: border-box;
}

.chat-bilingual-draft__hint,
.chat-bilingual-draft__safety,
.chat-bilingual-draft__assist {
  margin: 0 0 10px;
  color: #334155;
  font-size: 0.78rem;
  line-height: 1.45;
}

.chat-bilingual-draft__safety {
  margin-top: 10px;
  margin-bottom: 0;
  color: #475569;
  font-size: 0.72rem;
}

.chat-bilingual-draft__unsupported {
  margin: 0 0 10px;
  padding: 8px 10px;
  border-radius: 10px;
  border: 1px solid #f1c40f;
  background: #fffbeb;
  color: #854d0e;
  font-size: 0.76rem;
  line-height: 1.4;
}

.chat-bilingual-draft__fields {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 12px;
}

.chat-bilingual-draft__field label {
  display: block;
  margin-bottom: 4px;
  color: #0f172a;
  font-size: 0.74rem;
  font-weight: 700;
}

.chat-bilingual-draft__input,
.chat-bilingual-draft__textarea {
  width: 100%;
  box-sizing: border-box;
  border: 1px solid #c8d5e6;
  border-radius: 10px;
  background: #fff;
  color: #0f172a;
  font: inherit;
  font-size: 0.84rem;
  line-height: 1.45;
  padding: 8px 10px;
  resize: vertical;
}

.chat-bilingual-draft__textarea {
  min-height: 6.5rem;
  white-space: pre-wrap;
}

.chat-bilingual-draft__input:focus-visible,
.chat-bilingual-draft__textarea:focus-visible {
  outline: 2px solid #0c5f8a;
  outline-offset: 1px;
}

.chat-bilingual-draft__actions {
  margin-top: 4px;
}

.chat-bilingual-draft__compare {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
  margin-bottom: 12px;
}

.chat-bilingual-draft__panel {
  border: 1px solid #d7e2ef;
  border-radius: 12px;
  background: #fff;
  padding: 10px 12px;
  min-width: 0;
}

.chat-bilingual-draft__panel-title {
  margin: 0 0 6px;
  color: #0f172a;
  font-size: 0.84rem;
  font-weight: 700;
  line-height: 1.35;
  word-break: break-word;
}

.chat-bilingual-draft__panel .chat-draft-body {
  color: #1e293b;
  font-size: 0.8rem;
  word-break: break-word;
}

/* Desktop: side-by-side compare when chat shell has width. */
@media (min-width: 900px) {
  .chat-bilingual-draft--compare {
    max-width: min(100%, 40rem);
  }

  .chat-bilingual-draft__compare {
    grid-template-columns: 1fr 1fr;
    align-items: start;
  }
}

@media (prefers-reduced-motion: reduce) {
  .chat-msg--bilingual-draft {
    transition: none;
  }
}

body[data-reduced-motion="true"] .chat-msg--bilingual-draft {
  transition: none;
}

/* #1143: five-language selector (restrained, text-only, no flags). */
.chat-shell__header-tools {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
  flex-shrink: 0;
  min-width: 0;
}

.chat-shell__lang {
  appearance: none;
  -webkit-appearance: none;
  font: inherit;
  font-size: 0.72rem;
  line-height: 1.1;
  color: #0d0d0f;
  background: #ffffff;
  border: 1px solid #c8d5e6;
  border-radius: 14px;
  padding: 5px 22px 5px 10px;
  max-width: 140px;
  min-width: 0;
  cursor: pointer;
  flex-shrink: 0;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'><path d='M1 1l4 4 4-4' fill='none' stroke='%238e8ea0' stroke-width='1.5' stroke-linecap='round'/></svg>");
  background-repeat: no-repeat;
  background-position: right 8px center;
}

.chat-shell__lang:focus-visible {
  outline: 3px solid #8dc7ef;
  outline-offset: 2px;
}

.chat-shell__lang option {
  color: #0d0d0f;
  background: #ffffff;
}

/* Mobile: keep the header row from overflowing — compact the language
   selector so Thai/Vietnamese/Indonesian labels never clip. */
@media (max-width: 480px) {
  .chat-shell__lang {
    font-size: 0.7rem;
    max-width: 118px;
    padding-right: 18px;
  }
  body[data-first-use-state="entry"] .chat-shell__header {
    padding: 12px 14px;
    gap: 6px;
  }
  .chat-shell__header-tools {
    gap: 6px;
  }
}

.chat-shell__header-tools .chat-shell__reset {
  margin-left: 0;
}

.chat-shell__reset {
  margin-left: auto;
  border: 1px solid #c8d5e6;
  border-radius: 14px;
  background: transparent;
  color: #8e8ea0;
  cursor: pointer;
  font: inherit;
  font-size: 0.78rem;
  line-height: 1;
  padding: 6px 12px;
  transition: background 0.15s, border-color 0.15s;
}
.chat-shell__reset:hover {
  background: #f5f5f7;
  border-color: #aab8c2;
}

.chat-shell__reset:focus-visible,
.chat-composer__send:focus-visible,
.chat-composer__input:focus-visible {
  outline: 3px solid #8dc7ef;
  outline-offset: 2px;
}

.chat-shell__reset[hidden] {
  display: none;
}

.chat-composer__hint {
  line-height: 1.45;
}

.chat-composer__privacy-warning {
  margin: 6px 2px 0;
  color: #7c4a17;
  font-size: 0.68rem;
  font-weight: 600;
  line-height: 1.4;
}

/* #1190: composer footer utility — hint left, recommendations toggle right. */
.chat-composer__utility {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 6px 12px;
  margin-top: 6px;
  min-width: 0;
  max-width: 100%;
  box-sizing: border-box;
}

.chat-composer__utility .chat-composer__hint {
  margin: 0;
  flex: 1 1 12rem;
  min-width: 0;
  text-align: left;
}

.chat-composer__utility-mount {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  justify-content: flex-end;
  min-width: 0;
  max-width: 100%;
}

.chat-composer__utility .chat-recommendations-toggle {
  align-self: center;
  margin: 0;
  white-space: nowrap;
}

.chat-shell[data-chat-busy="true"] .chat-composer__send,
.chat-shell[data-chat-busy="true"] .chat-composer__input {
  cursor: progress;
}

.chat-quest-card {
  margin: 10px 12px 0 46px;
  border: 1px solid #d7e1ec;
  border-radius: 6px;
  background: #f8fbff;
  color: #1f2d3d;
  font-size: 0.76rem;
  line-height: 1.45;
  padding: 10px;
}

.chat-quest-card__title {
  margin-bottom: 7px;
  font-weight: 700;
}

.chat-quest-card__row {
  display: grid;
  grid-template-columns: 70px minmax(0, 1fr);
  gap: 8px;
  margin-top: 4px;
}

.chat-quest-card__row span {
  color: #607086;
}

.chat-quest-card__row strong {
  color: #132238;
  font-weight: 650;
  min-width: 0;
  overflow-wrap: anywhere;
}

.chat-quest-card__actions {
  border-top: 1px solid #e2e9f2;
  margin-top: 8px;
  padding-top: 8px;
}

.chat-quest-card__actions-label {
  color: #607086;
  display: block;
  margin-bottom: 5px;
}

.chat-quest-card__action-list {
  display: grid;
  gap: 4px;
  list-style: decimal;
  margin: 0;
  padding-left: 18px;
}

.chat-quest-card__action {
  color: #1f2d3d;
  overflow-wrap: anywhere;
}

.chat-quest-card__row--warning strong {
  color: #a13a1f;
}

@keyframes firstUseAurora {
  from { transform: translate3d(-4%, -3%, 0) scale(0.92); }
  to { transform: translate3d(8%, 7%, 0) scale(1.08); }
}

@keyframes firstUseSignal {
  0% { box-shadow: 0 0 0 0 rgba(85, 223, 200, 0.58); }
  70%, 100% { box-shadow: 0 0 0 11px rgba(85, 223, 200, 0); }
}

@keyframes firstUseMayorFloat {
  0%, 100% { transform: rotate(1.5deg) translateY(0); }
  50% { transform: rotate(-0.3deg) translateY(-12px); }
}

@keyframes firstUseLightSweep {
  0%, 42% { transform: translateX(-120%); }
  62%, 100% { transform: translateX(130%); }
}

@keyframes firstUseChatArrive {
  from { opacity: 0; transform: translateY(28px) scale(0.975); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes firstUseCanvasReveal {
  0% {
    opacity: 0;
    clip-path: inset(2% 8% 2% 92% round 30px);
    transform: translateX(-3.5%) scale(0.965);
    filter: blur(14px) saturate(0.72);
  }
  44% {
    opacity: 0.94;
    clip-path: inset(1% 3% 1% 16% round 20px);
    filter: blur(4px) saturate(0.9);
  }
  100% {
    opacity: 1;
    clip-path: inset(0);
    transform: translateX(0) scale(1);
    filter: blur(0) saturate(1);
  }
}

body.first-use-shell--no-motion .first-use-layout,
body.first-use-shell--no-motion .first-use-layout .demo-canvas,
body.first-use-shell--no-motion .first-use-layout .chat-shell {
  transition: none !important;
}

body.first-use-shell--no-motion .entry-stage,
body.first-use-shell--no-motion .entry-stage *,
body.first-use-shell--no-motion .first-use-layout::after,
body.first-use-shell--no-motion .demo-canvas {
  animation: none !important;
}

@media (max-width: 1180px) {
  .entry-stage__brand,
  .entry-stage__copy {
    left: 48px;
  }

  .entry-stage__copy {
    max-width: 540px;
  }

  .entry-stage__copy h1 {
    font-size: clamp(2.1rem, 5vw, 3.5rem);
  }

  .entry-stage__mayor {
    right: 34px;
    min-width: 270px;
    width: 29vw;
  }

  body[data-first-use-state="entry"] .chat-shell {
    margin-left: 48px;
    width: min(600px, calc(100vw - 390px));
    height: min(560px, calc(100vh - 280px));
  }
}

@media (max-width: 767px) {
  html,
  body {
    max-width: 100%;
    overflow-x: hidden;
  }

  .first-use-layout,
  body[data-first-use-state="transitioning"] .first-use-layout,
  body[data-first-use-state="split"] .first-use-layout {
    display: flex;
    flex-direction: column;
    overflow: visible;
  }

  .first-use-layout .chat-shell {
    order: 1;
    flex: 1 1 auto;
    width: 100%;
    max-width: none;
    min-width: 0;
    height: 100vh;
    height: 100%;
    min-height: 100vh;
    min-height: 100%;
    border-left: 0;
    box-shadow: none;
  }

  .entry-stage__copy,
  .entry-stage__mayor,
  .entry-stage__building,
  .entry-stage__signal {
    display: none;
  }

  body[data-first-use-state="transitioning"] .entry-stage,
  body[data-first-use-state="split"] .entry-stage {
    display: none;
  }

  .entry-stage__brand {
    top: 26px;
    left: 24px;
  }

  .entry-stage__brand img {
    width: 154px;
  }

  body[data-first-use-state="entry"] .first-use-layout {
    grid-template-columns: 1fr 0;
  }

  body[data-first-use-state="entry"] .chat-shell {
    place-self: auto;
    width: calc(100% - 24px);
    height: calc(100vh - 94px);
    min-height: 0;
    margin: 82px 12px 12px;
    border-radius: 22px;
    box-shadow: 0 24px 70px rgba(1, 14, 35, 0.34);
  }

  .first-use-layout .demo-canvas {
    order: 2;
    width: 100%;
    height: auto;
    min-height: 56vh;
    transform: none;
    align-items: flex-start;
    overflow: hidden;
  }

  body[data-first-use-state="entry"] .demo-canvas {
    position: absolute;
    width: 1px;
    height: 1px;
    min-height: 0;
    overflow: hidden;
  }

  body[data-first-use-state="split"] .chat-shell,
  body[data-first-use-state="transitioning"] .chat-shell {
    width: 100%;
    min-width: 0;
    max-width: 100%;
    height: min(58vh, 520px);
    min-height: 360px;
  }

  /* #1152: mobile bilingual draft — stack compare panels; avoid nested x-scroll. */
  .chat-bilingual-draft {
    max-width: 100%;
  }

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

  .chat-bilingual-draft__actions {
    flex-wrap: wrap;
  }

  .chat-bilingual-draft__input,
  .chat-bilingual-draft__textarea {
    font-size: 16px; /* prevent iOS zoom on focus */
  }

}

/* #1114 — 320-class narrow entry: fit all 8 chips + composer without
   internal chip scrolling. Compacts spacing only; does not hide chips,
   change copy, or alter ≥390 layouts. */
@media (max-width: 340px) {
  body[data-first-use-state="entry"] .chat-shell {
    /* Keep shell fully inside 320×568: top brand clearance + bottom margin. */
    margin: 52px 8px 6px;
    width: calc(100% - 16px);
    height: calc(100vh - 58px);
    max-height: calc(100vh - 58px);
    border-radius: 18px;
  }

  body[data-first-use-state="entry"] .chat-shell__header {
    padding: 8px 10px;
  }

  body[data-first-use-state="entry"] .chat-shell__title {
    font-size: 0.9rem;
  }

  /* #1121: keep attribution/disclosure compact on 320×568 without covering composer. */
  body[data-first-use-state="entry"] .chat-shell__attribution {
    font-size: 0.6rem;
    line-height: 1.2;
  }

  body[data-first-use-state="entry"] .chat-shell__disclosure {
    font-size: 0.56rem;
    line-height: 1.25;
    padding: 4px 8px 6px;
  }

  .chat-shell__disclosure {
    font-size: 0.58rem;
    padding: 4px 10px 6px;
  }

  body[data-first-use-state="entry"] .chat-thread {
    flex: 1 1 auto;
    min-height: 0;
    padding: 4px 8px;
    gap: 4px;
  }

  body[data-first-use-state="entry"] .chat-avatar {
    width: 24px;
    height: 24px;
    font-size: 0.7rem;
  }

  body[data-first-use-state="entry"] .chat-bubble {
    padding: 7px 10px;
    font-size: 0.82rem;
    line-height: 1.32;
  }

  /* Size chips to content; do not claim leftover flex space that forces scroll. */
  body[data-first-use-state="entry"] .chat-chips {
    flex: 0 0 auto;
    overflow: visible;
    gap: 4px;
    padding: 4px 8px 8px;
    min-height: 0;
  }

  body[data-first-use-state="entry"] .chat-chip {
    padding: 5px 9px;
    font-size: 0.76rem;
    line-height: 1.2;
    gap: 3px;
    border-radius: 15px;
  }

  body[data-first-use-state="entry"] .chat-chip__icon svg {
    width: 13px;
    height: 13px;
  }

  body[data-first-use-state="entry"] .chat-composer {
    padding-top: 0;
  }

  body[data-first-use-state="entry"] .chat-composer__utility {
    margin-top: 3px;
    gap: 4px 8px;
  }

  body[data-first-use-state="entry"] .chat-composer__hint {
    margin: 0;
    font-size: 0.66rem;
    line-height: 1.2;
  }

  body[data-first-use-state="entry"] .chat-recommendations-toggle {
    font-size: 0.64rem;
  }

  body[data-first-use-state="entry"] .chat-composer__row {
    padding: 0;
  }

  body[data-first-use-state="entry"] .chat-composer__input {
    min-height: 0;
    padding-top: 7px;
    padding-bottom: 7px;
    font-size: 0.86rem;
  }

  body[data-first-use-state="entry"] .chat-composer__send {
    padding: 7px 11px;
    font-size: 0.8rem;
  }

  .entry-stage__brand {
    top: 14px;
    left: 14px;
  }

  .entry-stage__brand img {
    width: 120px;
  }
}

/* #1132: reduced-motion contract — media query covers first paint before JS.
   body[data-reduced-motion] covers runtime OS preference changes (see shell). */
@media (prefers-reduced-motion: reduce) {
  .first-use-layout,
  .first-use-layout .demo-canvas,
  .first-use-layout .chat-shell,
  .entry-stage,
  .chat-decision__button,
  .mobile-surface-tab,
  .chat-shell__reset,
  .chat-chip {
    transition: none !important;
  }

  .entry-stage,
  .entry-stage *,
  .entry-stage__aurora,
  .entry-stage__mayor,
  .entry-stage__signal i,
  .entry-stage__eyebrow i,
  .first-use-layout::after,
  .demo-canvas,
  .chat-msg,
  .chat-msg--confirm-run .chat-bubble--ai,
  .chat-msg--temp .chat-bubble--ai::after,
  .choreo-cursor,
  .choreo-cursor *,
  .choreo-cursor[data-agent-status="moving"] .choreo-cursor__halo,
  .bg-dept-search__btn.executor-search-busy::after,
  .executor-highlight,
  .executor-highlight[data-action-target="complaint-illegal-parking-report"],
  .mayor-open-office-control.executor-highlight {
    animation: none !important;
  }

  .chat-msg,
  .chat-msg--confirm-run .chat-bubble--ai {
    opacity: 1 !important;
    transform: none !important;
  }

  .chat-msg--temp .chat-bubble--ai::after {
    content: none !important;
  }

  .chat-decision__button:hover,
  .chat-decision__button:active {
    transform: none !important;
  }

  .choreo-cursor__arrow {
    transition: none !important;
  }

  .executor-typing {
    transition: none !important;
  }
}

/* #1132: runtime body attribute mirror (shell materializes on load + change). */
body[data-reduced-motion="true"] .first-use-layout,
body[data-reduced-motion="true"] .first-use-layout .demo-canvas,
body[data-reduced-motion="true"] .first-use-layout .chat-shell,
body[data-reduced-motion="true"] .entry-stage,
body[data-reduced-motion="true"] .chat-decision__button,
body[data-reduced-motion="true"] .mobile-surface-tab,
body[data-reduced-motion="true"] .chat-shell__reset,
body[data-reduced-motion="true"] .chat-chip,
body[data-reduced-motion="true"] .choreo-cursor__arrow {
  transition: none !important;
}

body[data-reduced-motion="true"] .entry-stage,
body[data-reduced-motion="true"] .entry-stage *,
body[data-reduced-motion="true"] .entry-stage__aurora,
body[data-reduced-motion="true"] .entry-stage__mayor,
body[data-reduced-motion="true"] .entry-stage__signal i,
body[data-reduced-motion="true"] .entry-stage__eyebrow i,
body[data-reduced-motion="true"] .first-use-layout::after,
body[data-reduced-motion="true"] .demo-canvas,
body[data-reduced-motion="true"] .chat-msg,
body[data-reduced-motion="true"] .chat-msg--confirm-run .chat-bubble--ai,
body[data-reduced-motion="true"] .chat-msg--temp .chat-bubble--ai::after,
body[data-reduced-motion="true"] .choreo-cursor,
body[data-reduced-motion="true"] .choreo-cursor *,
body[data-reduced-motion="true"] .choreo-cursor[data-agent-status="moving"] .choreo-cursor__halo,
body[data-reduced-motion="true"] .bg-dept-search__btn.executor-search-busy::after,
body[data-reduced-motion="true"] .executor-highlight,
body[data-reduced-motion="true"] .executor-highlight[data-action-target="complaint-illegal-parking-report"],
body[data-reduced-motion="true"] .mayor-open-office-control.executor-highlight {
  animation: none !important;
}

body[data-reduced-motion="true"] .chat-msg,
body[data-reduced-motion="true"] .chat-msg--confirm-run .chat-bubble--ai {
  opacity: 1 !important;
  transform: none !important;
}

body[data-reduced-motion="true"] .chat-msg--temp .chat-bubble--ai::after {
  content: none !important;
}

body[data-reduced-motion="true"] .chat-decision__button:hover,
body[data-reduced-motion="true"] .chat-decision__button:active {
  transform: none !important;
}

body[data-reduced-motion="true"] .executor-typing {
  transition: none !important;
}

/* Decision controls used by both independent AI writing journeys. */
.chat-decision {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.chat-decision__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 9px;
}

.chat-decision__button {
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 16px;
  border: 1px solid transparent;
  border-radius: 12px;
  font: inherit;
  font-size: 0.84rem;
  font-weight: 760;
  cursor: pointer;
  transform: translateY(0) scale(1);
  transition: transform 130ms ease, box-shadow 180ms ease, background 180ms ease, border-color 180ms ease, color 180ms ease;
}

.chat-decision__button--primary {
  color: #fff;
  background: linear-gradient(135deg, #ef6a4c, #e34f45);
  box-shadow: 0 7px 16px rgba(227, 79, 69, 0.23);
}

.chat-decision__button--secondary {
  border-color: #d3d9e2;
  color: #3c4b60;
  background: #fff;
}

.chat-decision__button:hover {
  transform: translateY(-2px);
}

.chat-decision__button--primary:hover {
  background: linear-gradient(135deg, #f47555, #d9423b);
  box-shadow: 0 11px 22px rgba(227, 79, 69, 0.3);
}

.chat-decision__button--secondary:hover {
  border-color: #9ca9bb;
  color: #1f314a;
  background: #f7f9fc;
  box-shadow: 0 8px 16px rgba(25, 48, 82, 0.09);
}

.chat-decision__button:active {
  transform: translateY(1px) scale(0.975);
  box-shadow: inset 0 3px 7px rgba(18, 32, 51, 0.2);
}

.chat-decision__button:focus-visible {
  outline: 3px solid rgba(0, 165, 143, 0.44);
  outline-offset: 3px;
}

.chat-decision__button:disabled {
  color: #9aa3af;
  background: #e8ebef;
  box-shadow: none;
  cursor: not-allowed;
}

@media (max-width: 520px) {
  .chat-decision__actions,
  .chat-decision__button {
    width: 100%;
  }
}

@media (prefers-reduced-motion: reduce) {
  .chat-decision__button {
    transition: none !important;
  }
}

.chat-answer-meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
  padding-top: 9px;
  border-top: 1px solid rgba(13, 13, 15, 0.1);
  font-size: 0.72rem;
  line-height: 1.35;
}

.chat-answer-meta__status {
  color: #5c6268;
}

.chat-answer-meta__source {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 3px 8px;
  border: 1px solid rgba(0, 108, 107, 0.22);
  border-radius: 999px;
  color: #006c6b;
  background: rgba(0, 108, 107, 0.07);
  font-weight: 700;
  text-decoration: none;
}

.chat-answer-meta__source:hover,
.chat-answer-meta__source:focus-visible {
  border-color: #006c6b;
  background: rgba(0, 108, 107, 0.13);
}

/* ═══════════════════════════════════════════════════════
   #965: resident-task chips
   ═══════════════════════════════════════════════════════ */
.chat-chips {
  display: flex;
  gap: 8px;
  padding: 12px 16px 8px;
  margin: 0;
  flex-wrap: wrap;
}
.chat-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 8px 14px;
  font-size: 0.82rem;
  font-family: inherit;
  line-height: 1.3;
  color: #0d0d0f;
  background: #fff;
  border: 1px solid #e6e6ea;
  border-radius: 20px;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
  white-space: nowrap;
}
.chat-chip:hover {
  background: #fafafb;
  border-color: #d0d0d5;
}
.chat-chip:focus-visible {
  outline: 3px solid #8dc7ef;
  outline-offset: 2px;
}
.chat-chip--mayor-primary {
  border-color: rgba(0, 165, 143, 0.46);
  background: rgba(0, 165, 143, 0.1);
  color: #075f69;
  font-weight: 600;
}
.chat-chip--mayor-primary:hover {
  background: rgba(0, 165, 143, 0.14);
  border-color: rgba(0, 165, 143, 0.58);
}
.chat-chip--mayor-primary .chat-chip__icon {
  color: #0a7a84;
}
.chat-chip__icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  line-height: 0;
}
.chat-chip__label {
  flex: 0 1 auto;
}

/* #1197: desktop-only single-line for two AI-assisted compact chips.
   Not applied globally / not forced on mobile. */
@media (min-width: 768px) {
  .chat-chip--ai-compact {
    flex: 0 0 auto;
    max-width: none;
    white-space: nowrap;
  }
  .chat-chip--ai-compact .chat-chip__label {
    white-space: nowrap;
    flex: 0 0 auto;
  }
}

.chat-chips[hidden] {
  display: none;
}

/* #1146 / #1190 — Collapsible recommendations (composer utility footer). */
.chat-recommendations-toggle {
  flex-shrink: 0;
  border: 0;
  background: transparent;
  color: #7a8290;
  cursor: pointer;
  font: inherit;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  line-height: 1.2;
  padding: 2px 4px;
  transition: color 120ms ease;
}
.chat-recommendations-toggle:hover {
  color: #0d0d0f;
}
.chat-recommendations-toggle:focus-visible {
  outline: 3px solid #8dc7ef;
  outline-offset: 2px;
  border-radius: 10px;
}

body[data-recommendations-expanded="false"] #chat-chips {
  display: none;
}

@media (max-width: 767px) {
  body[data-first-use-state="split"] .chat-chips,
  body[data-first-use-state="transitioning"] .chat-chips {
    flex: 0 0 auto;
    flex-wrap: nowrap;
    overflow-x: auto;
    overflow-y: hidden;
    overscroll-behavior-x: contain;
    padding: 8px 12px 7px;
    scrollbar-width: thin;
  }

  body[data-first-use-state="split"] .chat-chip,
  body[data-first-use-state="transitioning"] .chat-chip {
    flex: 0 0 auto;
    padding: 7px 12px;
  }
}

/* Fade-in for chat messages */
@keyframes chatFadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}
.chat-msg {
  animation: chatFadeIn 400ms ease both;
}
.chat-msg--confirm-run .chat-bubble--ai {
  animation: chatFadeIn 400ms ease 600ms both;
}

/* AI thinking/searching indicator — temporary chat message styling */
.chat-msg--temp .chat-bubble--ai {
  font-style: italic;
  color: #888;
  background: #f0f4f8;
  border-color: #dde2ec;
}
.chat-msg--temp .chat-bubble--ai::after {
  content: "";
  display: inline-block;
  width: 4px;
  height: 4px;
  margin-left: 4px;
  background: #888;
  border-radius: 50%;
  animation: chatThinkingDot 1.2s ease-in-out infinite;
}
@keyframes chatThinkingDot {
  0%, 20% { opacity: 0; }
  50% { opacity: 1; }
  80%, 100% { opacity: 0; }
}

/* Choreography cursor click ripple — enhanced with smooth expand + fade */
@keyframes choreoClick {
  0% { transform: scale(0.3); opacity: 0.6; }
  40% { transform: scale(1.3); opacity: 0.5; }
  100% { transform: scale(2.2); opacity: 0; }
}

.choreo-cursor {
  display: grid;
  grid-template-columns: 24px auto;
  align-items: start;
  filter: drop-shadow(0 8px 14px rgba(4, 24, 52, 0.28));
}

/* ── Mobile surface switch (Stage A, shell-level only) ─────────────
   Desktop: hidden, never shown. Mobile (≤767px): exposed as a
   tablist that switches the visible surface. The guidance surface reuses
   the canonical #demo-canvas (no DOM clone, no summary card). */
.mobile-surface-switch {
  display: none;
}

/* Hidden attribute always wins, even inside the ≤767px exposure rule. */
.mobile-surface-switch[hidden] {
  display: none !important;
}

@supports (grid) {
  /* Desktop: keep the legacy split grid intact; switch stays hidden. */
  body[data-first-use-state="split"] .mobile-surface-switch,
  body[data-first-use-state="transitioning"] .mobile-surface-switch {
    display: none;
  }
}

@supports (grid) {
  body[data-first-use-state="entry"] .mobile-surface-switch {
    display: none;
  }
}

@media (max-width: 767px) {
  .mobile-surface-switch {
    display: flex;
    align-items: stretch;
    gap: 6px;
    padding: 8px 12px;
    border-bottom: 1px solid rgba(13, 13, 15, 0.1);
    background: #fff;
  }

  .mobile-surface-tab {
    flex: 1 1 0;
    min-height: 40px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0 14px;
    font: inherit;
    font-size: 0.86rem;
    font-weight: 700;
    color: #3c4b60;
    background: #f1f4f8;
    border: 1px solid transparent;
    border-radius: 12px;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s, color 0.15s;
  }

  .mobile-surface-tab:hover {
    background: #e7ecf3;
  }

  .mobile-surface-tab[aria-pressed="true"] {
    color: #0d0d0f;
    background: #fff;
    border-color: #8dc7ef;
    box-shadow: 0 2px 8px rgba(141, 199, 239, 0.32);
  }

  .mobile-surface-tab:focus-visible {
    outline: 3px solid #8dc7ef;
    outline-offset: 2px;
  }

  /* Surface visibility. Conversation: full chat-shell, canvas hidden.
     Guidance (#1174): canvas is primary; the same #chat-shell stays mounted
     as a bottom composer dock so multi-step 예-flow never collapses the
     composer to 0×0. Header/thread/chips hide; no second composer DOM. */
  body[data-mobile-surface="conversation"] .chat-shell {
    display: flex !important;
  }
  body[data-mobile-surface="conversation"][data-first-use-state="split"] #demo-canvas,
  body[data-mobile-surface="conversation"][data-first-use-state="transitioning"] #demo-canvas {
    display: none !important;
  }

  body[data-mobile-surface="guidance"] .chat-shell {
    display: flex !important;
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 20;
    flex: 0 0 auto;
    width: 100%;
    max-width: 100%;
    height: auto !important;
    min-height: 0 !important;
    max-height: none !important;
    border-top: 1px solid rgba(13, 13, 15, 0.1);
    box-shadow: 0 -8px 24px rgba(7, 27, 58, 0.08);
    background: #fff;
  }
  body[data-mobile-surface="guidance"] .chat-shell__header,
  body[data-mobile-surface="guidance"] .chat-shell__journey-status,
  body[data-mobile-surface="guidance"] .chat-thread,
  body[data-mobile-surface="guidance"] .chat-chips,
  body[data-mobile-surface="guidance"] .chat-shell__disclosure {
    display: none !important;
  }
  body[data-mobile-surface="guidance"] .chat-composer {
    display: block;
    flex: 0 0 auto;
    width: 100%;
    min-height: 56px;
    padding: 10px 12px 12px;
    background: #fff;
  }
  body[data-mobile-surface="guidance"] .chat-composer__row {
    display: flex;
    gap: 8px;
    align-items: stretch;
  }
  body[data-mobile-surface="guidance"] .chat-composer__input {
    flex: 1 1 auto;
    min-width: 0;
    min-height: 44px;
  }
  body[data-mobile-surface="guidance"] .chat-composer__send {
    flex: 0 0 auto;
    min-width: 64px;
    min-height: 44px;
  }
  body[data-mobile-surface="guidance"] .chat-composer__utility,
  body[data-mobile-surface="guidance"] .chat-composer__hint {
    display: none;
  }
  body[data-mobile-surface="guidance"][data-first-use-state="split"] #demo-canvas,
  body[data-mobile-surface="guidance"][data-first-use-state="transitioning"] #demo-canvas {
    display: flex !important;
    flex: 1 1 auto;
    order: 2;
    width: 100%;
    min-height: 42vh;
    /* Leave room for the fixed composer dock (#1174). */
    padding-bottom: 96px;
    box-sizing: border-box;
  }
  body[data-mobile-surface="conversation"] #demo-canvas {
    display: none !important;
  }
}

@media (max-width: 767px) {
  body[data-mobile-surface="guidance"] .mobile-surface-switch {
    position: sticky;
    top: 0;
    z-index: 5;
  }
}

/* mobile-surface-tab reduced-motion covered in #1132 global block above */

.choreo-cursor__arrow {
  position: relative;
  z-index: 2;
  grid-column: 1;
  grid-row: 1;
  transition: transform 180ms ease;
}

.choreo-cursor__halo {
  position: absolute;
  z-index: 1;
  top: -7px;
  left: -7px;
  width: 38px;
  height: 38px;
  border: 1px solid rgba(0, 165, 143, 0.46);
  border-radius: 50%;
  opacity: 0;
}

.choreo-cursor__label {
  position: relative;
  z-index: 3;
  grid-column: 2;
  grid-row: 1;
  margin: 15px 0 0 -1px;
  padding: 4px 8px 4px 7px;
  border: 1px solid rgba(255, 255, 255, 0.72);
  border-radius: 4px 10px 10px 10px;
  color: #fff;
  background: linear-gradient(135deg, #0c3975, #008f83);
  box-shadow: 0 6px 14px rgba(4, 24, 52, 0.2);
  font-family: ui-monospace, "Cascadia Code", monospace;
  font-size: 0.58rem;
  font-weight: 900;
  letter-spacing: 0.08em;
  line-height: 1;
  white-space: nowrap;
}

.choreo-cursor[data-agent-status="moving"] .choreo-cursor__halo {
  animation: agentCursorTrail 760ms ease-out infinite;
}

.choreo-cursor[data-agent-status="clicking"] .choreo-cursor__arrow {
  transform: scale(0.8) translate(2px, 2px);
}

.choreo-cursor[data-agent-status="clicking"] .choreo-cursor__label {
  background: linear-gradient(135deg, #ff7654, #f34f4f);
}

.bg-dept-search__input[data-agent-typing="true"] {
  background-image: linear-gradient(90deg, rgba(0, 165, 143, 0.08), rgba(85, 223, 200, 0.02));
  caret-color: #ff7654;
  outline: 3px solid rgba(0, 165, 143, 0.78) !important;
  box-shadow: 0 0 0 6px rgba(0, 165, 143, 0.11), 0 14px 28px rgba(7, 27, 58, 0.08) !important;
}

.bg-dept-search__btn.executor-search-busy {
  position: relative;
  color: transparent !important;
  overflow: hidden;
}

.bg-dept-search__btn.executor-search-busy::after {
  content: "검색 중";
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: #fff;
  background: linear-gradient(110deg, #0c3975 20%, #00a58f 50%, #0c3975 80%);
  background-size: 220% 100%;
  animation: agentSearchSweep 1s linear infinite;
}

@keyframes agentCursorTrail {
  0% { opacity: 0.7; transform: scale(0.55); }
  100% { opacity: 0; transform: scale(1.45); }
}

@keyframes agentSearchSweep {
  from { background-position: 100% 0; }
  to { background-position: -120% 0; }
}

/* choreo-cursor / search-busy reduced-motion covered in #1132 global block above */

/* #1114 — semantic "열린구청장실 바로가기" control.
   Sibling of .entry-stage (aria-hidden) so it stays in the a11y tree.
   Geometry is an explicit non-zero rectangle over the blue button band of
   home-mayor-card.png (345×297). Green "매니페스토 바로가기" stays non-interactive.
   Normal / hover / focus-visible share the same rectangle — no clip-path expansion. */
.mayor-open-office-control {
  --mayor-card-top: clamp(165px, 22vh, 218px);
  --mayor-card-right: clamp(38px, 7.5vw, 118px);
  --mayor-card-w: max(300px, min(25vw, 360px));
  /* Image aspect 345×297; figcaption sits below the image and is not part of the hit band. */
  --mayor-card-h: calc(var(--mayor-card-w) * 297 / 345);
  /* Blue band: ~14%–50% x, ~77%–92% y of the card image. */
  --mayor-blue-left-ratio: 0.14;
  --mayor-blue-right-ratio: 0.50;
  --mayor-blue-top-ratio: 0.77;
  --mayor-blue-bottom-ratio: 0.92;

  position: absolute;
  z-index: 4;
  top: calc(var(--mayor-card-top) + var(--mayor-card-h) * var(--mayor-blue-top-ratio));
  /* Right edge of blue band = card right + (1 - right-ratio) * card width. */
  right: calc(
    var(--mayor-card-right) + var(--mayor-card-w) * (1 - var(--mayor-blue-right-ratio))
  );
  width: calc(
    var(--mayor-card-w) * (var(--mayor-blue-right-ratio) - var(--mayor-blue-left-ratio))
  );
  height: calc(
    var(--mayor-card-h) * (var(--mayor-blue-bottom-ratio) - var(--mayor-blue-top-ratio))
  );
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: transparent;
  font-size: 0;
  line-height: 0;
  overflow: hidden;
  cursor: pointer;
  /* Never use clip-path to define hit area — rectangle geometry is authoritative. */
  clip-path: none;
  -webkit-clip-path: none;
}

.mayor-open-office-control:hover {
  background: transparent;
}

.mayor-open-office-control:focus-visible {
  outline: 3px solid var(--first-use-mint, #55dfc8);
  outline-offset: 2px;
  background: transparent;
}

/* AI cursor target highlight (reuses blue rectangle; does not enlarge hit area). */
.mayor-open-office-control.executor-highlight,
.mayor-open-office-control.is-agent-target {
  outline: 3px solid #3182ce;
  outline-offset: 2px;
  box-shadow: 0 0 8px rgba(49, 130, 206, 0.5);
  background: rgba(47, 111, 237, 0.16);
}

/* Mirror .entry-stage__mayor geometry at the 1180px layout step. */
@media (max-width: 1180px) {
  .mayor-open-office-control {
    --mayor-card-right: 34px;
    --mayor-card-w: max(270px, 29vw);
  }
}

/* Hide when entry is not the active surface. */
body[data-first-use-state="split"] .mayor-open-office-control,
body[data-first-use-state="transitioning"] .mayor-open-office-control {
  display: none;
}

/* Mayor card is hidden on mobile (≤767px); control must also be unreachable. */
@media (max-width: 767px) {
  .mayor-open-office-control {
    display: none;
  }
}


/* ── English MVP Continue reading pill (absolute against chat-thread bottom) ── */
/* Additive only: do not alter existing .chat-shell layout rules. */
.first-use-layout .chat-shell {
  position: relative;
}

.chat-continue-read {
  display: none;
  position: absolute;
  z-index: 12;
  left: 50%;
  transform: translateX(-50%);
  margin: 0;
  padding: 6px 14px;
  border: 1px solid var(--first-use-teal);
  border-radius: 999px;
  background: #fff;
  color: var(--first-use-teal);
  font-size: 13px;
  font-weight: 600;
  line-height: 1.3;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(7, 27, 58, 0.12);
  pointer-events: auto;
  white-space: nowrap;
}

.chat-continue-read:hover {
  background: #fff;
  color: var(--first-use-teal);
}

.chat-continue-read:focus-visible {
  outline: 2px solid var(--first-use-teal);
  outline-offset: 2px;
}
