/* =====================================================================
   guide.css — Craig's panel, the award cards and the Operator Card's fit
   (round 39c). Loads last in app/index.html, so it refines app.css and
   game.css without editing them.

   1. Craig (app/guide/index.js): a real close target, suggestion chips that
      are easy to hit, answer "doors" (buttons in a reply, not jumps), and on
      a phone a sheet that sits above the phone bar.
   2. Award cards (app/game.js award()): a compact glass card in the top
      right corner. Never a takeover, never blocks the tool under it, a
      visible close, a quiet timer line that pauses while you read, still
      under reduced motion.
   3. Operator Card (lib/card.js): the card is a size container, so the
      stat row and the name fit any width the card is given.
   ===================================================================== */

/* ---------- 1. Craig ---------- */
.guide:focus { outline: none; }
/* One column that never grows past the panel: a long label can't push the panel's contents sideways. */
.guide, body.game .guide { grid-template-columns: minmax(0, 1fr); }
.guide > * { min-width: 0; }
.guide__head { gap: 10px; }
.guide__eye { min-width: 0; }
.guide__eye > span:last-child { min-width: 0; }
.guide__eye .label { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.guide__right { flex: none; }
.guide__close {
  display: inline-grid; place-items: center; width: 36px; height: 36px; padding: 0; border-radius: 10px; cursor: pointer;
  font: inherit; font-size: 1.35rem; line-height: 1; color: #fff;
  background: rgba(255, 255, 255, 0.06); border: 1px solid rgba(144, 195, 255, 0.28);
  transition: background 150ms var(--ease-out), border-color 150ms var(--ease-out);
}
.guide__close:hover { background: rgba(56, 165, 255, 0.18); border-color: rgba(56, 165, 255, 0.7); }
.guide__context span { overflow-wrap: anywhere; }

/* Suggestions: one per line, a full-width target at least 44px tall, an arrow that says "ask this". */
.guide__openers { gap: 8px; }
.guide__opener {
  display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 44px; padding: 0.6rem 0.85rem;
  border-radius: 12px; background: rgba(20, 103, 239, 0.12); border-color: rgba(144, 195, 255, 0.22); color: #fff; font-weight: 600;
}
.guide__opener::after { content: "›"; flex: none; color: var(--hu-blue-400, #38a5ff); font-size: 1.15rem; line-height: 1; }
.guide__opener:hover, .guide__opener:focus-visible { background: rgba(20, 103, 239, 0.24); border-color: rgba(56, 165, 255, 0.75); }

/* An answer's doors: small buttons under the reply. */
.guide__acts { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.guide__act {
  display: inline-flex; align-items: center; min-height: 36px; padding: 0 12px; border-radius: 999px;
  font-size: 0.8rem; font-weight: 700; color: #fff; text-decoration: none;
  background: var(--action, #1a6cf5); border: 1px solid rgba(255, 255, 255, 0.18);
  transition: background 150ms var(--ease-out), transform 150ms var(--ease-out);
}
.guide__act:hover { background: #2a7bff; transform: translateY(-1px); }
.guide__act > span { margin-left: 4px; }
.guide__act + .guide__act { background: rgba(255, 255, 255, 0.06); border-color: rgba(144, 195, 255, 0.35); }
.guide__act + .guide__act:hover { background: rgba(56, 165, 255, 0.18); }
.guide__msg { overflow-wrap: anywhere; }

/* Phone: a sheet above the phone bar, full width less the gutter; big targets; 16px field so iOS doesn't zoom. */
@media (max-width: 760px) {
  body.game .guide, .guide {
    left: 8px; right: 8px; width: auto;
    bottom: calc(72px + env(safe-area-inset-bottom, 0px) + 8px);
    height: min(calc(100dvh - 72px - env(safe-area-inset-bottom, 0px) - 84px), 640px);
    border-radius: 18px;
  }
  .guide__close { width: 44px; height: 44px; }
  .guide__tool { min-height: 36px; }
  .guide__input { font-size: 16px; min-height: 44px; }
  .guide__act { min-height: 40px; }
}
@media (prefers-reduced-motion: reduce) { .guide__act:hover { transform: none; } }

/* ---------- 2. Award cards ---------- */
/* Bottom right, a gap above the dock (desktop) or the phone nav (--dock-h is whichever bar is there), growing upward:
   at the top right a "Patch earned" card covered the tool headers (defects-r40 H1). */
.rewards {
  position: fixed; z-index: 76; bottom: calc(var(--dock-h, 118px) + env(safe-area-inset-bottom, 0px) + 12px); right: 22px;
  width: min(360px, calc(100vw - 32px)); display: grid; gap: 10px; pointer-events: none;
}
.reward {
  position: relative; pointer-events: auto; overflow: hidden;
  display: grid; grid-template-columns: 56px minmax(0, 1fr) auto; gap: 14px; align-items: center;
  padding: 14px 10px 16px 14px; border-radius: 16px; color: #fff;
  background: linear-gradient(160deg, rgba(20, 103, 239, 0.22), rgba(5, 15, 37, 0.9) 55%);
  border: 1px solid rgba(144, 195, 255, 0.4); backdrop-filter: blur(18px); -webkit-backdrop-filter: blur(18px);
  box-shadow: 0 24px 60px -24px rgba(0, 0, 0, 0.9), inset 0 1px 0 rgba(255, 255, 255, 0.08);
  animation: reward-in 320ms var(--ease-out, ease-out) both;
}
.reward.is-leaving { animation: reward-out 220ms ease-in both; }
.reward__mark { display: grid; place-items: center; width: 56px; height: 56px; }
.reward__mark .patch { gap: 0; }
.reward__mark .patch__ring { width: 52px; height: 52px; }
.reward__mark .patch__mark { width: 22px; height: 22px; }
.reward__mark .patch__name { display: none; }
.reward__rank {
  display: grid; place-items: center; width: 52px; height: 52px; border-radius: 50%;
  font-size: 1.35rem; font-weight: 800; color: #fff; letter-spacing: 0.02em;
  background: radial-gradient(circle at 50% 35%, rgba(56, 165, 255, 0.45), rgba(20, 103, 239, 0.15) 70%);
  box-shadow: inset 0 0 0 1.5px rgba(56, 165, 255, 0.85), 0 0 18px rgba(56, 165, 255, 0.35);
}
.reward__gear { width: 56px; height: 56px; object-fit: contain; filter: drop-shadow(0 0 10px rgba(56, 165, 255, 0.55)); }
.reward__text { display: grid; gap: 2px; min-width: 0; }
.reward__label { font-family: var(--font-mono); font-size: var(--t-3xs, 0.6875rem); font-weight: 700; letter-spacing: 0.14em; text-transform: uppercase; color: var(--hu-blue-400, #38a5ff); }
.reward__title { font-size: 1.05rem; line-height: 1.2; color: #fff; overflow-wrap: anywhere; }
.reward__line { font-size: 0.85rem; line-height: 1.35; color: rgba(234, 245, 255, 0.78); }
.reward__link { justify-self: start; margin-top: 4px; font-size: 0.78rem; font-weight: 700; color: #fff; text-decoration: none; border-bottom: 1px solid rgba(56, 165, 255, 0.6); }
.reward__link:hover { border-bottom-color: #fff; }
.reward__close {
  align-self: start; display: grid; place-items: center; width: 32px; height: 32px; padding: 0; margin: -4px -2px 0 0; cursor: pointer;
  font: inherit; font-size: 1.2rem; line-height: 1; color: rgba(255, 255, 255, 0.8);
  background: transparent; border: 1px solid transparent; border-radius: 9px;
}
.reward__close:hover { color: #fff; background: rgba(255, 255, 255, 0.08); border-color: rgba(144, 195, 255, 0.3); }
/* The timer: a hairline that runs out; it waits while the card is hovered or focused. */
.reward__time { position: absolute; left: 14px; right: 14px; bottom: 6px; height: 2px; border-radius: 2px; background: rgba(56, 165, 255, 0.75); transform-origin: left; animation: reward-time var(--stay, 5000ms) linear both; }
.reward.is-paused .reward__time { animation-play-state: paused; }
@keyframes reward-in { from { opacity: 0; transform: translateY(8px) scale(0.98); } to { opacity: 1; transform: none; } }
@keyframes reward-out { to { opacity: 0; transform: translateX(16px); } }
@keyframes reward-time { from { transform: scaleX(1); } to { transform: scaleX(0); } }
@media (max-width: 760px) {
  .rewards { left: 12px; right: 12px; width: auto; bottom: calc(var(--dock-h, 72px) + env(safe-area-inset-bottom, 0px) + 8px); }
  .reward { grid-template-columns: 48px minmax(0, 1fr) auto; gap: 12px; }
  .reward__mark, .reward__gear { width: 48px; height: 48px; }
  .reward__mark .patch__ring, .reward__rank { width: 46px; height: 46px; }
  .reward__close { width: 44px; height: 44px; margin: -10px -6px 0 0; }
}
@media (prefers-reduced-motion: reduce) {
  .reward, .reward.is-leaving { animation: none; }
  .reward__time { display: none; }
}

/* ---------- 3. Operator Card ---------- */
.opcard { container-type: inline-size; }
.opcard__name { font-size: clamp(1.5rem, 12.5cqi, 2.9rem); overflow-wrap: anywhere; }
.opcard__stats { grid-template-columns: repeat(var(--n, 4), minmax(0, 1fr)); column-gap: clamp(4px, 2cqi, 10px); }
.opcard__stats b { font-size: clamp(1.15rem, 7.4cqi, 1.9rem); }
.opcard__stats span { font-size: clamp(0.54rem, 2.5cqi, 0.7rem); letter-spacing: 0.06em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
/* Not room for icon beside number beside caption: number over caption, icon above. */
@container (max-width: 460px) {
  .opcard__stats li { grid-template-columns: minmax(0, 1fr); justify-items: start; }
  .opcard__stats img { grid-row: auto; width: 24px; height: 24px; }
}
/* The smallest cards: two by two. */
@container (max-width: 300px) {
  .opcard__stats { grid-template-columns: repeat(2, minmax(0, 1fr)); row-gap: 8px; }
  .opcard__stats span { font-size: 0.6rem; }
}
