/* Device frames (laptop, phone, tablet) and the hero's replica of the PWA
   session page. The replica follows pwa/src/features/session/guided: header
   (back with unread badge, agent avatar, title, coloured status), the primary
   key row and the compose row (attach · field · send button). */

/* ---------- laptop terminal ---------- */
.laptop {
  border-radius: 14px;
  overflow: hidden;
  background: var(--d-term);
  box-shadow: var(--shadow-device);
  border: 1px solid rgba(11, 14, 19, 0.5);
}

.laptop-bar,
.md-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 12px;
  background: #161b23;
  font-family: var(--mono);
  color: var(--d-faint);
}

.laptop-bar {
  height: 34px;
  border-bottom: 1px solid var(--d-line);
  font-size: 12px;
}

.laptop-bar span:last-child {
  flex: 1;
  text-align: center;
  margin-right: 42px;
}

.dots {
  display: inline-flex;
  gap: 6px;
}

.dots i {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #3a414c;
}

.laptop-bar .dots i:nth-child(1) {
  background: #ff5f57;
}

.laptop-bar .dots i:nth-child(2) {
  background: #febc2e;
}

.laptop-bar .dots i:nth-child(3) {
  background: #28c840;
}

.tty {
  padding: 20px 24px 26px;
  min-height: 336px;
  font: 14px/1.75 var(--mono);
  color: var(--d-term-ink);
  display: grid;
  align-content: start;
}

.tty .dim,
.ptty .dim {
  color: var(--d-faint);
}

.tty .acc,
.ptty .acc {
  color: var(--d-accent);
}

.tty .ok,
.ptty .ok {
  color: var(--d-ok);
}

.tty .bad,
.ptty .bad {
  color: #ff8080;
}

.tty .hl,
.md-line.hl {
  animation: flash 1.4s var(--ease);
  border-radius: 4px;
}

@keyframes flash {
  0% {
    background: rgba(110, 168, 254, 0.28);
  }

  100% {
    background: transparent;
  }
}

.q {
  margin: 6px 0;
  padding: 8px 10px;
  border-left: 2px solid var(--d-warn);
  background: rgba(255, 178, 36, 0.06);
}

.q .sel {
  color: var(--d-warn);
}

.cur {
  display: inline-block;
  width: 0.6em;
  height: 1.1em;
  vertical-align: -3px;
  background: var(--d-term-ink);
  animation: blink 1s steps(1) infinite;
}

@keyframes blink {
  50% {
    opacity: 0;
  }
}

/* Staged lines keep their space: they always follow the static output, so
   revealing them never reflows the terminal or anything below it. */
.js [data-s] {
  transition: opacity 0.35s var(--ease);
}

.js [data-s].off {
  visibility: hidden;
  opacity: 0;
  transition: none;
}

/* ---------- phone ---------- */
.phone {
  position: relative;
  width: 280px;
  max-width: 100%;
  border-radius: 46px;
  padding: 10px;
  background: #0c0f14;
  box-shadow: var(--shadow-device), inset 0 0 0 1.5px #2a303a;
}

.phone-screen {
  position: relative;
  width: 100%;
  height: 100%;
  border-radius: 37px;
  overflow: hidden;
  background: var(--d-bg);
  display: flex;
  flex-direction: column;
}

.statusbar {
  position: relative;
  flex: none;
  display: flex;
  justify-content: space-between;
  align-items: center;
  height: 40px;
  padding: 4px 26px 0;
  font-size: 13px;
  font-weight: 600;
  color: var(--d-ink);
}

.statusbar::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 10px;
  translate: -50% 0;
  width: 88px;
  height: 26px;
  border-radius: 14px;
  background: #000;
}

.homebar {
  flex: none;
  height: 20px;
  display: grid;
  place-items: center;
}

.homebar::after {
  content: "";
  width: 104px;
  height: 4px;
  border-radius: 3px;
  background: rgba(233, 237, 243, 0.55);
}

/* ---------- session page replica ---------- */
.gp-head {
  flex: none;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 10px 8px 6px;
  border-bottom: 1px solid var(--d-line);
  color: var(--d-ink);
}

.gp-back {
  position: relative;
  display: grid;
  place-items: center;
}

.gp-back .back {
  width: 22px;
  height: 22px;
}

.gp-badge {
  position: absolute;
  top: -5px;
  right: -5px;
  min-width: 13px;
  height: 13px;
  padding: 0 3px;
  border-radius: 7px;
  background: var(--d-warn);
  color: #1a1100;
  font: 700 8.5px/13px var(--sans);
  font-style: normal;
  text-align: center;
}

.gp-av {
  position: relative;
  flex: none;
  width: 24px;
  height: 24px;
  border-radius: 7px;
  display: grid;
  place-items: center;
  background: var(--d-surface-2);
}

.gp-av svg {
  width: 14px;
  height: 14px;
}

.gp-title {
  display: grid;
  line-height: 1.25;
  min-width: 0;
}

.gp-title b {
  font-size: 13.5px;
  font-weight: 600;
}

.gp-title small {
  display: block;
  font-size: 10px;
  color: var(--d-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.st {
  color: var(--d-accent);
  font-weight: 600;
}

.st.wait {
  color: var(--d-warn);
}

.st.done {
  color: var(--d-ok);
}

.sd {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--d-accent);
  transition: background 0.3s;
}

.sd.wait {
  background: var(--d-warn);
}

.sd.done {
  background: var(--d-ok);
}

.gp-av .sd {
  position: absolute;
  right: -2px;
  bottom: -2px;
  box-shadow: 0 0 0 2px var(--d-bg);
}

.gp-tools {
  margin-left: auto;
  display: flex;
  gap: 12px;
  align-items: center;
}

.gp-tools svg {
  width: 16px;
  height: 16px;
}

.ptty {
  flex: 1;
  min-height: 0;
  overflow: hidden;
  padding: 10px 12px;
  font: 10.4px/1.7 var(--mono);
  color: var(--d-term-ink);
  background: var(--d-term);
  display: flex;
  flex-direction: column;
}

.pad {
  flex: none;
  background: var(--d-dock);
  border-top: 1px solid var(--d-line);
  padding: 8px 8px 0;
}

.pad-grip {
  width: 30px;
  height: 3px;
  border-radius: 2px;
  background: rgba(233, 237, 243, 0.2);
  margin: 0 auto 7px;
}

.keys {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
}

.k {
  height: 30px;
  border-radius: 8px;
  background: var(--d-surface-2);
  display: grid;
  place-items: center;
  font: 600 10px var(--mono);
  color: var(--d-ink);
}

.k svg {
  width: 12px;
  height: 12px;
}

.compose {
  display: flex;
  gap: 5px;
  padding: 7px 0 4px;
  align-items: stretch;
}

.clip {
  flex: none;
  width: 30px;
  border-radius: 10px;
  border: 1px solid rgba(233, 237, 243, 0.14);
  display: grid;
  place-items: center;
  color: var(--d-muted);
}

.clip svg {
  width: 14px;
  height: 14px;
}

.field {
  flex: 1;
  min-width: 0;
  height: 34px;
  border-radius: 10px;
  border: 1px solid rgba(233, 237, 243, 0.14);
  padding: 0 8px;
  font-size: 9px;
  line-height: 32px;
  color: var(--d-ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.field.ph {
  color: var(--d-faint);
}

/* Same three states as the PWA send button (session-stop.ts sendKind):
   a draft sends, an empty field stops a working agent, otherwise Enter. */
.act {
  flex: none;
  width: 34px;
  border-radius: 10px;
  border: 1px solid rgba(233, 237, 243, 0.17);
  background: var(--d-surface-2);
  color: var(--d-ink);
  display: grid;
  place-items: center;
  font-size: 11px;
  font-weight: 700;
  transition: transform 0.15s, box-shadow 0.2s;
}

.act svg {
  width: 15px;
  height: 15px;
}

.act .a-send,
.act .a-stop,
.act[data-kind="send"] svg,
.act[data-kind="stop"] svg {
  display: none;
}

.act[data-kind="send"] {
  width: 42px;
  background: var(--d-accent);
  border-color: transparent;
  color: var(--d-accent-ink);
}

.act[data-kind="send"] .a-send {
  display: block;
}

.act[data-kind="stop"] {
  width: 48px;
  background: transparent;
  border-color: rgba(255, 107, 94, 0.6);
  color: #ff6b5e;
}

.act[data-kind="stop"] .a-stop {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.act .a-stop i {
  width: 7px;
  height: 7px;
  border-radius: 1.5px;
  background: currentColor;
}

.act.hit {
  transform: scale(0.9);
  box-shadow: 0 0 0 5px rgba(110, 168, 254, 0.3);
}

/* ---------- tablet (landscape) ---------- */
.tablet {
  position: relative;
  max-width: 1040px;
  width: 100%;
  margin-inline: auto;
  padding: 16px;
  border-radius: 40px;
  background: #0c0f14;
  box-shadow: var(--shadow-device), inset 0 0 0 1.5px #2a303a;
}

.tablet::before {
  content: "";
  position: absolute;
  left: 7px;
  top: 50%;
  width: 5px;
  height: 5px;
  margin-top: -2.5px;
  border-radius: 50%;
  background: #1d232c;
}

.tablet-screen {
  border-radius: 26px;
  overflow: hidden;
  background: var(--d-bg);
  aspect-ratio: 1180 / 820;
}

.tablet-screen img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: top left;
}

@media (max-width: 760px) {
  .tablet {
    padding: 8px;
    border-radius: 22px;
  }

  .tablet-screen {
    border-radius: 15px;
  }
}
