/* Shared mockup chrome + structural layout. Each direction (a/b/c.css) skins and positions it. */
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body { background: #2a2826; font-family: system-ui, sans-serif; }
button { font: inherit; cursor: pointer; color: inherit; }
button:disabled { cursor: default; }
textarea { font: inherit; }

/* ---- mockup controls (clearly not part of the design) ---- */
.mock-controls { position: sticky; top: 0; z-index: 100; display: flex; flex-wrap: wrap; gap: 8px 14px; align-items: center; padding: 9px 14px; background: #111; color: #eee; font: 12px/1.2 ui-monospace, Menlo, monospace; border-bottom: 1px solid #333; }
.mock-controls strong { font-weight: 600; margin-right: 4px; }
.mock-controls .seg { display: inline-flex; flex-wrap: wrap; gap: 2px; background: #262626; border-radius: 8px; padding: 2px; }
.mock-controls button { border: 0; background: transparent; color: #ccc; padding: 6px 9px; border-radius: 6px; font: inherit; }
.mock-controls button:hover { background: #3a3a3a; color: #fff; }
.mock-controls button.on { background: #f2f2f2; color: #111; }
.mock-controls .others { margin-left: auto; }
.mock-controls a { color: #9fd0ff; }
.stage { display: grid; place-items: center; padding: 28px 16px 48px; }

/* ---- device frame ---- */
.device { position: relative; overflow: hidden; width: min(1240px, 100%); height: min(780px, calc(100vh - 120px)); min-height: 600px; border-radius: 14px; box-shadow: 0 30px 80px -20px rgba(0,0,0,.6), 0 0 0 1px rgba(255,255,255,.06); display: grid; grid-template-columns: minmax(0, 1fr); grid-template-rows: auto minmax(0, 1fr) auto; }
.device.vp-phone { width: 390px; height: 800px; min-height: 0; border-radius: 44px; box-shadow: 0 30px 80px -20px rgba(0,0,0,.6), 0 0 0 10px #0d0d0d, 0 0 0 11px #3a3a3a; }
.vp-phone .topbar { padding-top: 54px !important; }
.vp-phone::before { content: ''; position: absolute; top: 11px; left: 50%; width: 120px; height: 34px; margin-left: -60px; border-radius: 20px; background: #000; z-index: 60; }
.vp-phone::after { content: ''; position: absolute; bottom: 8px; left: 50%; width: 134px; height: 5px; margin-left: -67px; border-radius: 3px; background: rgba(255,255,255,.55); z-index: 60; pointer-events: none; }

/* ---- top bar ---- */
.topbar { display: flex; align-items: center; gap: 10px; padding: 12px 16px; position: relative; z-index: 5; }
.topbar .ic { width: 44px; height: 44px; display: grid; place-items: center; border: 0; background: transparent; border-radius: 10px; }
.title { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.t-name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.conn { display: inline-flex; align-items: center; gap: 6px; }
.conn i { width: 7px; height: 7px; border-radius: 50%; display: inline-block; }

/* ---- thread ---- */
.thread { overflow: auto; min-height: 0; padding: 8px 20px 20px; scroll-behavior: smooth; }
.greet { display: none; text-align: center; }
.is-empty .greet { display: block; }
.is-empty .msgs { display: none; }
.msgs { max-width: 720px; margin: 0 auto; display: flex; flex-direction: column; gap: 18px; }
.msg p { margin: 0; }
.msg.user { align-self: flex-end; max-width: 85%; }
.msg.user .tag { display: block; }
.m-photos { display: flex; gap: 6px; margin-bottom: 6px; justify-content: flex-end; }
.m-photos .thumb { width: 64px; height: 64px; border-radius: 10px; display: block; }
.work { list-style: none; margin: 0 0 10px; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.caret { display: inline-block; width: 7px; height: 1em; vertical-align: -2px; margin-left: 2px; animation: blink 1s steps(2) infinite; }
@keyframes blink { 50% { opacity: 0; } }
.dots i { display: inline-block; width: 4px; height: 4px; border-radius: 50%; background: currentColor; margin-left: 3px; animation: dot 1.2s infinite; }
.dots i:nth-child(2) { animation-delay: .15s; } .dots i:nth-child(3) { animation-delay: .3s; }
@keyframes dot { 0%, 60%, 100% { opacity: .25; } 30% { opacity: 1; } }

/* ---- dock + composer (structural grid; skins assign areas) ---- */
.dock { position: relative; z-index: 8; padding: 0 16px 16px; }
.composer { position: relative; display: grid; max-width: 760px; margin: 0 auto;
  grid-template-columns: auto minmax(0, 1fr) auto;
  grid-template-areas: "banner banner banner" "attach attach attach" "queue queue queue" "input input input" "plus meta send" "hint hint hint"; }
.composer > * { position: relative; z-index: 1; min-width: 0; }
.card-bg { grid-area: 1 / 1 / 6 / -1; z-index: 0 !important; pointer-events: none; }
.ctx-line { display: none; }
.c-banner { grid-area: banner; display: none; align-items: center; gap: 8px; }
.c-banner.on { display: flex; }
.c-banner > span:nth-child(2) { flex: 1; min-width: 0; }
.b-dot { width: 7px; height: 7px; border-radius: 50%; flex: none; }
.b-ic { display: grid; place-items: center; }
.b-act, .b-x { border: 0; background: transparent; min-height: 32px; }
.c-attach { grid-area: attach; display: none; gap: 10px; overflow-x: auto; }
.c-attach.on { display: flex; }
.att { position: relative; flex: none; width: 60px; height: 60px; margin: 6px 6px 0 0; }
.att .thumb { position: absolute; inset: 0; border-radius: 12px; display: block; }
.att.up .thumb { filter: brightness(.55) saturate(.6); }
.att.bad .thumb { filter: grayscale(1) brightness(.45); }
.spin { position: absolute; left: 50%; top: 50%; width: 20px; height: 20px; margin: -10px; border: 2px solid rgba(255,255,255,.35); border-top-color: #fff; border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.att-bad { position: absolute; inset: 0; display: grid; place-items: center; color: #fff; font-weight: 700; }
.att-x { position: absolute; top: -7px; right: -7px; width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; padding: 0; font-size: 14px; line-height: 1; }
.att-x::after { content: ''; position: absolute; inset: -11px; } /* 44px target */
.c-queue { grid-area: queue; display: none; flex-direction: column; gap: 4px; }
.c-queue.on { display: flex; }
.q { display: flex; gap: 8px; align-items: baseline; min-width: 0; }
.q-t { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.c-input { grid-area: input; display: block; width: 100%; resize: none; border: 0; outline: none; background: transparent; color: inherit; font-size: 16px; line-height: 1.45; max-height: 168px; min-height: 24px; }
.c-plus { grid-area: plus; width: 44px; height: 44px; display: grid; place-items: center; border: 0; background: transparent; }
.c-meta { grid-area: meta; display: flex; align-items: center; gap: 2px; min-width: 0; }
.c-meta button { border: 0; background: transparent; min-height: 44px; display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.m-model { min-width: 0; flex-shrink: 1; overflow: hidden; }
.m-name { overflow: hidden; text-overflow: ellipsis; }
.m-ctx .ring { width: 16px; height: 16px; border-radius: 50%; display: inline-block; }
.c-send { grid-area: send; width: 44px; height: 44px; display: grid; place-items: center; border: 0; background: transparent; padding: 0; position: relative; }
.c-send > * { grid-area: 1 / 1; }
.send-ring { display: none; }
.send-ic { display: grid; place-items: center; }
.c-hint { grid-area: hint; display: none; }
.c-hint.on { display: block; }
.c-hint kbd { font: inherit; }

/* hold-to-queue feedback on the send button */
.c-send.holding .send-ic { animation: hold .5s linear forwards; }
@keyframes hold { to { transform: scale(.82); } }

/* ---- popovers (anchored above the composer) ---- */
.pop { position: absolute; left: 16px; right: 16px; bottom: calc(100% - 8px); max-width: 420px; display: none; z-index: 20; }
.pop.on { display: block; animation: popin .18s cubic-bezier(.2,.8,.2,1); }
@keyframes popin { from { opacity: 0; transform: translateY(6px); } }
.p-head { display: flex; justify-content: space-between; align-items: center; }
.p-list { display: flex; flex-direction: column; }
.p-row { display: flex; align-items: center; gap: 10px; border: 0; background: transparent; min-height: 44px; text-align: left; width: 100%; }
.p-name, .p-path { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.p-check { width: 16px; display: grid; }
.p-seg { display: grid; grid-template-columns: repeat(4, 1fr); }
.p-seg button { border: 0; min-height: 36px; }
.p-bar { height: 6px; border-radius: 3px; overflow: hidden; }
.p-bar span { display: block; height: 100%; }
.p-metrics { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.p-metrics span { display: flex; flex-direction: column; }
.p-btn { border: 0; min-height: 40px; width: 100%; }
.p-x { border: 0; background: transparent; width: 32px; height: 32px; }
.p-empty { margin: 8px 0; }
mark { background: transparent; color: inherit; font-weight: 700; }

/* ---- tray (C only; hidden elsewhere) ---- */
.tray { display: none; }
.scrim { position: absolute; inset: 0; z-index: 25; opacity: 0; pointer-events: none; transition: opacity .25s; }
.tray-open .scrim { opacity: 1; pointer-events: auto; }

/* ---- toast ---- */
.toast { position: absolute; z-index: 40; left: 50%; bottom: calc(100% + 14px); transform: translate(-50%, 10px); opacity: 0; pointer-events: none; transition: .3s cubic-bezier(.2,.8,.2,1); white-space: nowrap; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ---- phone ---- */
.vp-phone .dock { padding: 0 10px 26px; }
.vp-phone .thread { padding: 8px 16px 16px; }
.vp-phone .pop { left: 10px; right: 10px; max-width: none; }

/* ---- real narrow screens: fill the viewport, no bezel ---- */
@media (max-width: 600px) {
  .mock-controls { flex-wrap: nowrap; overflow-x: auto; padding: 8px 10px; gap: 8px; }
  .mock-controls .seg { flex-wrap: nowrap; flex: none; }
  .mock-controls strong, .mock-controls .others { flex: none; }
  .stage { padding: 0; }
  .device, .device.vp-phone { width: 100%; height: calc(100dvh - 47px); border-radius: 0; box-shadow: none; min-height: 0; }
  .device.vp-phone::before, .device.vp-phone::after { display: none; }
  .vp-phone .topbar { padding-top: 10px !important; }
  .vp-phone .dock { padding-bottom: max(12px, env(safe-area-inset-bottom)); }
}

@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; } }
