/* =====================================================================
   AGENT FLEET — each agent task is a ship on the home screen; tap = its terminal
   ===================================================================== */
.fleet { position: absolute; top: 0; right: 0; bottom: 0; left: 0; z-index: 3; pointer-events: none; }
.home.in-biz .fleet { display: none; }
.ship { position: absolute; width: 132px; display: grid; justify-items: center; gap: 2px; pointer-events: auto; transform: translate(-50%, -50%);
  transition: left 1.2s cubic-bezier(.3, .7, .2, 1), top 1.2s cubic-bezier(.3, .7, .2, 1); animation: shipBob 5.5s ease-in-out infinite; animation-delay: calc(var(--d, 0s) * -1); cursor: pointer; }
.ship__svg { width: 104px; height: 56px; overflow: visible; filter: drop-shadow(0 0 10px rgba(236, 30, 121, .45)) drop-shadow(0 6px 10px rgba(0, 0, 0, .6)); }
.ship--flip .ship__svg { transform: scaleX(-1); }
.ship__tag { display: grid; justify-items: center; line-height: 1.15; padding: 3px 9px 4px; border-radius: 9px; background: rgba(8, 4, 12, .62); border: 1px solid rgba(255, 79, 163, .35); backdrop-filter: blur(6px); white-space: nowrap; max-width: 150px; }
.ship__tag b { font: 600 10.5px var(--hud); letter-spacing: .06em; text-transform: uppercase; overflow: hidden; text-overflow: ellipsis; max-width: 140px; }
.ship__tag small { font: 500 10px var(--body); color: rgba(255, 255, 255, .62); }
.ship:hover .ship__tag { border-color: var(--pink2); }
.ship__flame { transform-origin: 22px 32px; opacity: 0; }
.ship__beacon { opacity: 0; }
.ship[data-st="fly"] .ship__flame { opacity: 1; animation: flame .16s ease-in-out infinite alternate; }
.ship[data-st="fly"] { animation: shipBob 5.5s ease-in-out infinite, shipDrift 9s ease-in-out infinite; animation-delay: calc(var(--d, 0s) * -1); }
.ship[data-st="fly"] .ship__tag small { color: #ffd27a; }
.ship[data-st="done"] .ship__beacon { opacity: 1; animation: beacon 1.1s ease-in-out infinite; }
.ship[data-st="done"] .ship__svg { filter: drop-shadow(0 0 16px rgba(255, 79, 163, .9)) drop-shadow(0 6px 10px rgba(0, 0, 0, .6)); }
.ship[data-st="done"] .ship__tag { border-color: var(--pink2); box-shadow: 0 0 14px rgba(236, 30, 121, .5); }
.ship[data-st="done"] .ship__tag small { color: #ff8cc4; font-weight: 700; }
.ship[data-st="wait"] .ship__svg { filter: grayscale(.85) brightness(.75) drop-shadow(0 6px 10px rgba(0, 0, 0, .6)); }
.ship--arrive { animation: shipIn 1.5s cubic-bezier(.2, .8, .2, 1) both !important; }
.ship--leave { animation: shipOut 1.3s cubic-bezier(.6, 0, .9, .4) forwards !important; pointer-events: none; }
@keyframes shipBob { 0%, 100% { margin-top: 0; } 50% { margin-top: -9px; } }
@keyframes shipDrift { 0%, 100% { margin-left: 0; } 50% { margin-left: 14px; } }
@keyframes flame { from { transform: scaleX(.75); } to { transform: scaleX(1.25); } }
@keyframes beacon { 50% { opacity: .15; } }
@keyframes shipIn { from { opacity: 0; transform: translate(-50%, -50%) translateX(-60vw) scale(.4); } to { opacity: 1; transform: translate(-50%, -50%); } }
@keyframes shipOut { to { opacity: 0; transform: translate(-50%, -50%) translate(70vw, -40vh) scale(.3); } }
@media (max-width: 760px) {
  .ship { width: 86px; }
  .ship__svg { width: 64px; height: 35px; }
  .ship__tag { padding: 2px 6px 3px; max-width: 96px; }
  .ship__tag b { font-size: 9px; max-width: 88px; }
  .ship__tag small { font-size: 9px; }
}

/* ship terminal */
.tterm { position: fixed; top: 0; right: 0; bottom: 0; left: 0; z-index: 60; display: grid; place-items: center; padding: 16px; }
.tterm[hidden] { display: none; }
.tterm__back { position: absolute; top: 0; right: 0; bottom: 0; left: 0; background: rgba(3, 1, 6, .72); backdrop-filter: blur(4px); }
.tterm__win { position: relative; grid-template-columns: minmax(0, 1fr); width: min(980px, 100%); height: min(760px, calc(100vh - 32px)); height: min(760px, calc(100dvh - 32px)); display: grid; grid-template-rows: auto minmax(0, 1fr) auto auto;
  background: linear-gradient(180deg, rgba(14, 8, 20, .97), rgba(7, 4, 11, .98)); border: 1px solid rgba(255, 79, 163, .45); border-radius: 14px;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, .04), 0 0 40px rgba(236, 30, 121, .25), 0 30px 80px rgba(0, 0, 0, .7); overflow: hidden; animation: ttIn .35s cubic-bezier(.2, .8, .2, 1); }
@keyframes ttIn { from { opacity: 0; transform: scale(.94) translateY(12px); } }
.tterm__win::after { content: ''; position: absolute; top: 0; right: 0; bottom: 0; left: 0; pointer-events: none; background: repeating-linear-gradient(0deg, rgba(255, 255, 255, .018) 0 1px, transparent 1px 3px); }
.tterm__bar { display: flex; align-items: center; gap: 7px; padding: 10px 12px; border-bottom: 1px solid rgba(255, 79, 163, .25); background: rgba(255, 255, 255, .03); }
.tterm__bar > i { width: 11px; height: 11px; border-radius: 50%; background: #ec1e79; opacity: .85; }
.tterm__bar > i:nth-child(2) { background: #ffb547; }
.tterm__bar > i:nth-child(3) { background: #49d18a; }
.tterm__title { flex: 1; min-width: 0; margin-left: 8px; font: 600 11.5px ui-monospace, 'Cascadia Mono', Consolas, monospace; letter-spacing: .06em; color: rgba(255, 255, 255, .8); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tterm__title em { font-style: normal; margin-left: 8px; padding: 1px 7px; border-radius: 5px; border: 1px solid currentColor; font-size: 10px; text-transform: uppercase; }
.tterm__title em[data-st="fly"] { color: #ffd27a; }
.tterm__title em[data-st="done"] { color: #ff8cc4; }
.tterm__title em[data-st="wait"] { color: #9a93a6; }
.tterm__x { width: 30px; height: 30px; border-radius: 8px; color: rgba(255, 255, 255, .7); }
.tterm__x:hover { background: rgba(255, 255, 255, .08); color: #fff; }
.tterm__screen { overflow-y: auto; padding: 14px 18px 18px; font: 13.5px/1.55 ui-monospace, 'Cascadia Mono', Consolas, monospace; color: #e9e3ef; scrollbar-width: thin; -webkit-user-select: text; user-select: text; }
.tt__sys { color: #49d18a; margin: 2px 0 12px; }
.tt__me { margin: 14px 0 8px; color: #fff; white-space: pre-wrap; }
.tt__me span { color: #ff4fa3; font-weight: 700; }
.tt__ag { margin: 6px 0 12px; padding: 10px 12px; border-left: 2px solid #ff4fa3; background: rgba(255, 255, 255, .025); border-radius: 0 8px 8px 0; }
.tt__ag > span { display: block; color: #8fb8ff; font-weight: 700; margin-bottom: 4px; }
.tt__err { border-left-color: #ff6b6b; }
.tt__ag p { margin: 4px 0; }
.tt__ag h4 { margin: 10px 0 4px; color: #ff8cc4; font-size: 13.5px; }
.tt__ag b { color: #fff; }
.tt__ag code { color: #ffd27a; }
.tt__ag a { color: #8fb8ff; overflow-wrap: anywhere; }
.tt__ag hr { border: 0; border-top: 1px dashed rgba(255, 255, 255, .18); margin: 10px 0; }
.tt__li { padding-left: 14px; text-indent: -14px; margin: 2px 0; }
.tt__tbl { overflow-x: auto; margin: 8px 0; }
.tt__tbl table { border-collapse: collapse; font-size: 12.5px; min-width: 100%; }
.tt__tbl th, .tt__tbl td { border: 1px solid rgba(255, 255, 255, .12); padding: 5px 8px; text-align: left; vertical-align: top; }
.tt__tbl th { color: #ff8cc4; background: rgba(255, 79, 163, .08); }
.tt__log { margin: 8px 0; color: #9ee6b8; font-size: 12.5px; }
.tt__log div { white-space: pre-wrap; overflow-wrap: anywhere; }
.tt__cur { color: #49d18a; animation: beacon 1s steps(1) infinite; }
.tterm__in { display: flex; align-items: center; gap: 8px; padding: 10px 14px; border-top: 1px solid rgba(255, 79, 163, .25); background: rgba(0, 0, 0, .35); }
.tterm__in span { color: #ff4fa3; font: 700 16px ui-monospace, monospace; }
.tterm__in input { flex: 1; min-width: 0; height: 38px; background: transparent; border: 0; outline: 0; color: #fff; font: 14px ui-monospace, 'Cascadia Mono', Consolas, monospace; }
.tterm__in input:disabled { opacity: .45; }
.tterm__in button { height: 34px; padding: 0 14px; border-radius: 8px; border: 1px solid rgba(255, 79, 163, .6); color: #ff8cc4; font: 600 12px var(--hud); }
.tterm__acts { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; padding: 0 14px 12px; background: rgba(0, 0, 0, .35); }
.tterm__acts:empty { display: none; }
.tkopen { display: block; margin-bottom: 6px; }
/* phone: a card from the bottom, top of the screen stays free (tap it to close), never under the notch */
.tterm__grab { display: none; }
@media (max-width: 760px) {
  .tterm { padding: 0; align-items: end; }
  .tterm__win { width: 100%; height: 76vh; height: 76dvh; border-radius: 18px 18px 0 0; border-left: 0; border-right: 0; border-bottom: 0;
    padding-bottom: env(safe-area-inset-bottom); animation: ttUp .3s cubic-bezier(.2, .8, .2, 1); grid-template-rows: auto auto minmax(0, 1fr) auto auto; }
  @keyframes ttUp { from { transform: translateY(100%); } }
  .tterm__grab { display: block; justify-self: center; width: 44px; height: 5px; margin: 8px 0 2px; border-radius: 3px; background: rgba(255, 255, 255, .35); }
  .tterm__bar { padding: 6px 10px 8px; }
  .tterm__bar > i { display: none; }
  .tterm__title { margin-left: 2px; font-size: 10.5px; }
  .tterm__x { width: 40px; height: 40px; font-size: 18px; background: rgba(255, 255, 255, .08); }
  .tterm__screen { padding: 10px 12px; font-size: 12px; }
  .tt__tbl table { font-size: 11px; }
  .tterm__in input { font-size: 16px; } /* 16px = iPhone does not zoom in on focus */
}
.tterm__close { margin-left: auto; }

/* never wider than the screen: long words / tables wrap or scroll inside */
.tterm__win > * { min-width: 0; }
.tterm__screen { overflow-x: hidden; }
.tt__me, .tt__ag p, .tt__li, .tt__log div, .tt__sys { overflow-wrap: anywhere; word-break: break-word; }
.tterm__in input::placeholder { color: rgba(255, 255, 255, .35); }
@media (max-width: 760px) {
  .tterm__in input { font-size: 16px; }
  .tterm__in input::placeholder { font-size: 13px; }
  .tterm__acts { justify-content: space-between; }
  .ship { width: 74px; }
  .ship__svg { width: 54px; height: 29px; }
  .ship__tag { max-width: 76px; padding: 2px 5px; }
  .ship__tag b { font-size: 8.5px; max-width: 68px; letter-spacing: .02em; }
  .ship__tag small { font-size: 8.5px; }
}
