/*
 * ============================================================================
 * portfolio-play.css — 플레이 레이어 (orbit / constellation / pinball / terminal …)
 * ============================================================================
 *
 * [조절 방법]
 * 1) 아래 :root 의 --orbit-* / --play-* 값만 바꿔도 대부분 톤·세기·길이가 바뀝니다.
 * 2) 개별 셀렉터 주석에 “↑ 키우면 / ↓ 줄이면” 힌트가 있습니다.
 * 3) 유성 개수·발사 타이밍·화면 밖 궤적은 JS(spectacleOrbit / spawnMeteor)입니다.
 *    bold 유성은 화면 밖에서 들어와 반대쪽 밖으로 나간 뒤(키프레임 90%+) 페이드합니다.
 * 4) 히어로 idle 궤도(평소 링)는 index.html 의 .hero-orbit-stage / .orbit-ring 쪽입니다.
 *
 * [빠른 레시피]
 * - 더 과감: --orbit-meteor-size, --orbit-trail-length, --orbit-bloom-alpha ↑
 * - 더 은은: 위 값 ↓ + --orbit-spectacle-sat / --orbit-spectacle-bright ↓
 * - 더 느리게: --orbit-meteor-duration, --orbit-bloom-duration, --orbit-aurora-duration ↑
 * - 색만 바꾸기: --orbit-color-chat / rag / resume
 */

:root {
  /* --- 공통 팔레트 --- */
  --play-ink: #0f172a;
  --play-accent: #38bdf8;   /* HUD·강조 시안 */
  --play-warn: #fbbf24;     /* resume / gold 톤 */
  --play-ok: #34d399;       /* rag / mint 톤 */
  --play-panel: rgba(15, 23, 42, 0.88);
  --play-line: rgba(148, 163, 184, 0.35);

  /* ========== ORBIT 조절 패널 (터미널 `orbit` 쇼) ========== */

  /* 레이어: 히어로 텍스트 앞(3)에 그려야 유성이 보임. 2 이하면 텍스트에 가림 */
  --orbit-fx-z: 3;

  /* 작은 펄스 유성 (이력서/채팅 등 약한 반응) */
  --orbit-meteor-soft-size: 6px;       /* 점 지름 */
  --orbit-meteor-soft-glow: 12px;      /* box-shadow blur */
  --orbit-meteor-soft-duration: 1.1s;  /* 날아가는 시간 */

  /* 볼드 유성 (orbit 커맨드) — JS가 --ms·duration을 개별로 덮어씀 */
  --orbit-meteor-size: 12px;           /* 헤드 기본 크기 (× --ms) */
  --orbit-meteor-duration: 2s;         /* 폴백 통과 시간 — 실제는 JS 1.55~2.6s */
  --orbit-trail-length: 140px;         /* ::before 선명한 꼬리 (× --ms) */
  --orbit-trail-thickness: 2.5px;
  --orbit-trail-soft-length: 100px;    /* ::after 번진 꼬리 */
  --orbit-trail-soft-thickness: 12px;
  --orbit-trail-soft-blur: 6px;        /* ↑ 안개 / ↓ 칼날 */
  --orbit-trail-soft-alpha: 0.5;
  --orbit-meteor-core-glow: 10px;
  --orbit-meteor-color-glow: 22px;
  --orbit-meteor-color-glow-2: 40px;
  --orbit-meteor-color-glow-3: 68px;

  /* 종류별 색 (currentColor + background) */
  --orbit-color-resume: #fbbf24;
  --orbit-color-chat: #38bdf8;
  --orbit-color-chat-hi: #7dd3fc;
  --orbit-color-rag: #34d399;
  --orbit-color-rag-hi: #6ee7b7;
  --orbit-color-warn: #fb7185;

  /* 충격파 링 */
  --orbit-shock-size: 96px;            /* 기본 시작 원 크기 */
  --orbit-shock-hero-size: min(28vmin, 180px); /* 히어로용 시작 크기 */
  --orbit-shock-duration: 1.55s;
  --orbit-shock-expand: 5.8;           /* keyframes 끝 scale — ↑ 더 넓게 퍼짐 */
  --orbit-shock-border: 1.5px;
  --orbit-shock-alpha: 0.75;

  /* 중앙 블룸(화면 전체가 살짝 밝아짐) — 쇼가 길어져 duration ↑ */
  --orbit-bloom-alpha: 0.28;           /* 시안 블룸 세기 — 유성이 주인공이니 살짝 ↓ */
  --orbit-bloom-alpha-gold: 0.22;
  --orbit-bloom-alpha-mint: 0.22;
  --orbit-bloom-width: 55%;
  --orbit-bloom-height: 45%;
  --orbit-bloom-y: 42%;
  --orbit-bloom-duration: 4.2s;

  /* 오로라(원뿔 그라데이션 스윕) */
  --orbit-aurora-duration: 4.4s;
  --orbit-aurora-peak: 0.72;
  --orbit-aurora-rotate: 28deg;
  --orbit-aurora-blur-start: 12px;
  --orbit-aurora-blur-end: 24px;

  /* 쇼 중 궤도 스테이지 */
  --orbit-spectacle-opacity: 0.95;     /* idle(index) 기본 ~0.72 → 쇼 때 이 값 */
  --orbit-spectacle-sat: 1.25;         /* saturate() */
  --orbit-spectacle-bright: 1.08;      /* brightness() */
  --orbit-ring-speed-factor: 0.55;     /* 작을수록 링이 빨리 돎 (duration * factor) */
  --orbit-ring-glow-alpha: 0.55;       /* 쇼 중 링 테두리 밝기 */

  /* 코어(JY) 플레어 */
  --orbit-core-flare-scale: 1.18;
  --orbit-core-flare-duration: 2.8s;

  /* 히어로 카피 위 은은한 광 (is-orbit-show) */
  --orbit-content-glow: 18px;
  --orbit-content-glow-alpha: 0.18;
}

@media (prefers-reduced-motion: reduce) {
  .play-meteor, .play-pinball-ball, .play-split-wipe, .play-toast,
  .play-sse-cursor, .orbit-core.is-pulse, .orbit-core.is-flare,
  .play-shockwave, .play-orbit-aurora, .play-orbit-bloom, .play-orbit-overlay,
  .hero-orbit.is-spectacle-glow::after {
    animation: none !important;
    transition: none !important;
  }
}

/* --- HUD + achievements --- */
.play-hud {
  position: fixed;
  left: 12px;
  bottom: 12px;
  z-index: 90;
  max-width: min(280px, calc(100vw - 24px));
  padding: 10px 12px;
  border-radius: 10px;
  background: var(--play-panel);
  color: #e2e8f0;
  font: 11px/1.45 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  border: 1px solid var(--play-line);
  backdrop-filter: blur(8px);
  opacity: 0.72;
  transition: opacity .2s ease, box-shadow .3s ease;
  pointer-events: none;
}
.play-hud:hover, .play-hud.is-hot { opacity: 1; }
.play-hud.is-gold {
  box-shadow: 0 0 0 1px rgba(251, 191, 36, 0.55), 0 8px 28px rgba(251, 191, 36, 0.18);
}
.play-hud-row { display: flex; justify-content: space-between; gap: 10px; opacity: 0.9; }
.play-hud-row strong { color: var(--play-accent); font-weight: 600; }
.play-hud-ach { margin-top: 6px; color: #94a3b8; }
.play-toast-stack {
  position: fixed;
  right: 16px;
  top: 76px;
  z-index: 95;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}
.play-toast {
  padding: 8px 12px;
  border-radius: 8px;
  background: var(--play-panel);
  color: #f8fafc;
  font: 12px/1.3 ui-monospace, Menlo, Consolas, monospace;
  border: 1px solid rgba(56, 189, 248, 0.45);
  animation: play-toast-in .35s ease;
}
@keyframes play-toast-in {
  from { opacity: 0; transform: translateX(12px); }
  to { opacity: 1; transform: none; }
}

/* --------------------------------------------------------------------------
 * ORBIT FX
 * - .play-orbit-fx : 히어로(.hero-section) 안 절대 레이어. 클릭 가로채지 않음.
 * - z-index 가 content(1)보다 커야 유성·충격파가 글자 앞에 보임.
 * -------------------------------------------------------------------------- */
.play-orbit-fx {
  position: absolute;
  inset: 0;
  z-index: var(--orbit-fx-z); /* 조절: --orbit-fx-z */
  pointer-events: none;
  overflow: hidden;
  opacity: 0;                 /* 평소 숨김 → .is-live 때 1 */
  transition: opacity 0.25s ease;
}
.play-orbit-fx.is-live { opacity: 1; }

/* 쇼 중 이름/CTA 주변에 아주 약한 시안 광 — 과하면 --orbit-content-glow* ↓ */
.hero-section.is-orbit-show .hero-content {
  transition: filter 0.45s ease;
  filter: drop-shadow(
    0 0 var(--orbit-content-glow)
    rgba(14, 165, 233, var(--orbit-content-glow-alpha))
  );
}

/* --- 유성: soft (약한 이벤트) --- */
.play-meteor {
  position: absolute;
  width: var(--orbit-meteor-soft-size);
  height: var(--orbit-meteor-soft-size);
  border-radius: 50%;
  pointer-events: none;
  z-index: 2;
  box-shadow: 0 0 var(--orbit-meteor-soft-glow) currentColor;
  animation: play-meteor-fly var(--orbit-meteor-soft-duration) ease-out forwards;
}
/* 종류 색 — resume=gold, chat=cyan, rag=mint */
.play-meteor[data-kind="resume"] {
  color: var(--orbit-color-resume);
  background: var(--orbit-color-resume);
}
.play-meteor[data-kind="chat"] {
  color: var(--orbit-color-chat-hi);
  background: var(--orbit-color-chat);
}
.play-meteor[data-kind="rag"] {
  color: var(--orbit-color-rag-hi);
  background: var(--orbit-color-rag);
}
.play-meteor[data-kind="warn"] {
  color: var(--orbit-color-warn);
  background: var(--orbit-color-warn);
}

/* --- 유성: bold (orbit 커맨드) ---
 * ::before = 선명한 꼬리 길이/두께
 * ::after  = 번진 헤일로 꼬리
 * 헤드를 더 작게: --orbit-meteor-size
 * 꼬리만 길게: --orbit-trail-length / --orbit-trail-soft-length
 */
.play-meteor.is-bold {
  /* --ms: JS가 넣는 상대 크기 (0.45~1.2). 꼬리·글로우도 같이 스케일 */
  --ms: 1;
  width: calc(var(--orbit-meteor-size) * var(--ms));
  height: calc(var(--orbit-meteor-size) * var(--ms));
  z-index: 5;
  border-radius: 50%;
  background: #fff !important;
  box-shadow:
    0 0 calc(var(--orbit-meteor-core-glow) * var(--ms)) #fff,
    0 0 calc(var(--orbit-meteor-color-glow) * var(--ms)) currentColor,
    0 0 calc(var(--orbit-meteor-color-glow-2) * var(--ms)) currentColor,
    0 0 calc(var(--orbit-meteor-color-glow-3) * var(--ms)) currentColor;
  animation-name: play-meteor-fly-bold;
  animation-duration: var(--orbit-meteor-duration);
  /* linear: 실제 유성처럼 감속 없이. 끝에서만 opacity로 사라짐 */
  animation-timing-function: linear;
  animation-fill-mode: forwards;
}
.play-meteor.is-bold::before {
  content: "";
  position: absolute;
  right: calc(8px * var(--ms));
  top: 50%;
  width: calc(var(--orbit-trail-length) * var(--ms));
  height: calc(var(--orbit-trail-thickness) * var(--ms));
  border-radius: 999px;
  background: linear-gradient(90deg, transparent 0%, currentColor 42%, #fff 100%);
  transform: translateY(-50%);
  opacity: 1;
  filter: blur(0.2px);
}
.play-meteor.is-bold::after {
  content: "";
  position: absolute;
  right: calc(6px * var(--ms));
  top: 50%;
  width: calc(var(--orbit-trail-soft-length) * var(--ms));
  height: calc(var(--orbit-trail-soft-thickness) * var(--ms));
  border-radius: 999px;
  background: linear-gradient(90deg, transparent, currentColor);
  transform: translateY(-50%);
  opacity: var(--orbit-trail-soft-alpha);
  filter: blur(calc(var(--orbit-trail-soft-blur) * var(--ms)));
}

/* soft 유성 경로 — 값은 “얼마나 멀리 튕기는지”. 크게 바꾸면 soft 연출만 변함 */
@keyframes play-meteor-fly {
  0% { opacity: 1; transform: translate(-24px, -48px) scale(0.5); }
  70% { opacity: 1; }
  100% { opacity: 0; transform: translate(28px, 18px) scale(1.1); }
}

/*
 * bold 경로 — JS가 --mx0/1, --my0/1, --rot (화면 밖→밖 좌표).
 * 페이드는 끝 구간만: 이미 화면 밖으로 나간 뒤 opacity↓ → “중간에 사라짐” 방지.
 * 더 일찍 끄려면 90% → 82% 쪽으로.
 */
@keyframes play-meteor-fly-bold {
  0% {
    opacity: 0;
    transform: translate(var(--mx0, 0px), var(--my0, 0px)) scale(1) rotate(var(--rot, -24deg));
  }
  4% { opacity: 1; }
  90% { opacity: 1; }
  100% {
    opacity: 0;
    transform: translate(var(--mx1, 200px), var(--my1, 80px)) scale(1) rotate(var(--rot, -24deg));
  }
}

/* --- 충격파 ---
 * 시작 원 크기: --orbit-shock-size / --orbit-shock-hero-size
 * 퍼지는 양: keyframes 끝 scale = --orbit-shock-expand
 */
.play-shockwave {
  position: absolute;
  top: 50%;
  left: 50%;
  width: var(--orbit-shock-size);
  height: var(--orbit-shock-size);
  margin: calc(var(--orbit-shock-size) / -2) 0 0 calc(var(--orbit-shock-size) / -2);
  border-radius: 50%;
  border: var(--orbit-shock-border) solid rgba(125, 211, 252, var(--orbit-shock-alpha));
  box-shadow:
    0 0 30px rgba(56, 189, 248, 0.35),
    inset 0 0 28px rgba(14, 165, 233, 0.18);
  pointer-events: none;
  z-index: 2;
  animation: play-shockwave var(--orbit-shock-duration) cubic-bezier(0.12, 0.7, 0.2, 1) forwards;
}
.play-shockwave--hero {
  width: var(--orbit-shock-hero-size);
  height: var(--orbit-shock-hero-size);
  margin: calc(var(--orbit-shock-hero-size) / -2) 0 0 calc(var(--orbit-shock-hero-size) / -2);
}
.play-shockwave[data-tone="gold"] {
  border-color: rgba(251, 191, 36, 0.85);
  box-shadow:
    0 0 32px rgba(251, 191, 36, 0.4),
    inset 0 0 22px rgba(251, 191, 36, 0.16);
}
.play-shockwave[data-tone="mint"] {
  border-color: rgba(52, 211, 153, 0.85);
  box-shadow:
    0 0 32px rgba(52, 211, 153, 0.35),
    inset 0 0 22px rgba(52, 211, 153, 0.16);
}
@keyframes play-shockwave {
  0% { opacity: 0.85; transform: scale(0.35); }
  55% { opacity: 0.4; }
  100% { opacity: 0; transform: scale(var(--orbit-shock-expand)); }
}

/* --- 블룸: 화면 중앙이 숨 쉬듯 밝아짐 ---
 * 위치/크기: --orbit-bloom-width/height/y
 * 세기: --orbit-bloom-alpha*
 */
.play-orbit-bloom {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 1;
  background:
    radial-gradient(
      ellipse var(--orbit-bloom-width) var(--orbit-bloom-height) at 50% var(--orbit-bloom-y),
      rgba(56, 189, 248, var(--orbit-bloom-alpha)),
      transparent 70%
    );
  mix-blend-mode: screen; /* 더 탁하게: normal / 더 네온: plus-lighter (지원 브라우저) */
  animation: play-bloom var(--orbit-bloom-duration) ease-out forwards;
}
.play-orbit-bloom[data-tone="gold"] {
  background:
    radial-gradient(
      ellipse var(--orbit-bloom-width) var(--orbit-bloom-height) at 50% var(--orbit-bloom-y),
      rgba(251, 191, 36, var(--orbit-bloom-alpha-gold)),
      transparent 70%
    );
}
.play-orbit-bloom[data-tone="mint"] {
  background:
    radial-gradient(
      ellipse var(--orbit-bloom-width) var(--orbit-bloom-height) at 50% var(--orbit-bloom-y),
      rgba(52, 211, 153, var(--orbit-bloom-alpha-mint)),
      transparent 70%
    );
}
@keyframes play-bloom {
  0% { opacity: 0; transform: scale(0.72); }
  18% { opacity: 1; }
  70% { opacity: 0.85; }
  100% { opacity: 0; transform: scale(1.1); }
}

/* --- 오로라: 천천히 도는 색 부채 ---
 * 각도/색 stop 을 바꾸면 분위기 변화. peak·회전은 변수.
 */
.play-orbit-aurora {
  position: absolute;
  inset: -18%; /* 가장자리 잘림 방지. 키우면 더 넓게 */
  pointer-events: none;
  z-index: 1;
  background:
    conic-gradient(
      from 200deg at 50% 45%,
      transparent 0deg,
      rgba(125, 211, 252, 0.18) 60deg,
      rgba(52, 211, 153, 0.14) 120deg,
      rgba(251, 191, 36, 0.12) 180deg,
      transparent 240deg,
      rgba(56, 189, 248, 0.16) 300deg,
      transparent 360deg
    );
  mix-blend-mode: screen;
  opacity: 0;
  animation: play-aurora var(--orbit-aurora-duration) ease-out forwards;
}
@keyframes play-aurora {
  0% {
    opacity: 0;
    transform: scale(0.9) rotate(0deg);
    filter: blur(var(--orbit-aurora-blur-start));
  }
  16% { opacity: var(--orbit-aurora-peak); }
  72% { opacity: calc(var(--orbit-aurora-peak) * 0.55); }
  100% {
    opacity: 0;
    transform: scale(1.14) rotate(var(--orbit-aurora-rotate));
    filter: blur(var(--orbit-aurora-blur-end));
  }
}

/* --- 코어(JY) --- soft pulse vs orbit flare */
.orbit-core.is-pulse {
  animation: play-core-pulse .7s ease; /* soft 이벤트용 — 짧게 유지 추천 */
}
.orbit-core.is-flare {
  animation: play-core-flare var(--orbit-core-flare-duration) ease;
  z-index: 5;
}
@keyframes play-core-pulse {
  0%, 100% { transform: translate(-50%, -50%) scale(1); }
  40% {
    transform: translate(-50%, -50%) scale(1.1);
    filter: drop-shadow(0 0 14px rgba(56, 189, 248, 0.65));
  }
}
@keyframes play-core-flare {
  0% {
    transform: translate(-50%, -50%) scale(1);
    box-shadow: 0 0 0 rgba(56, 189, 248, 0);
  }
  28% {
    transform: translate(-50%, -50%) scale(var(--orbit-core-flare-scale));
    color: #fff;
    background: rgba(14, 165, 233, 0.5);
    border-color: rgba(255, 255, 255, 0.9);
    box-shadow:
      0 0 28px rgba(125, 211, 252, 0.9),
      0 0 70px rgba(14, 165, 233, 0.5);
  }
  100% {
    transform: translate(-50%, -50%) scale(1);
    box-shadow: 0 0 0 rgba(56, 189, 248, 0);
  }
}

/* 쇼 중 뒤쪽 궤도 링 — HTML 인라인 --duration 에 factor 를 곱해 가속 */
.hero-orbit-stage.is-spectacle {
  opacity: var(--orbit-spectacle-opacity) !important;
  filter: saturate(var(--orbit-spectacle-sat)) brightness(var(--orbit-spectacle-bright));
}
.hero-orbit-stage.is-spectacle .orbit-ring {
  border-color: rgba(186, 230, 253, var(--orbit-ring-glow-alpha));
  box-shadow: 0 0 28px rgba(56, 189, 248, 0.22);
  animation-duration: calc(var(--duration) * var(--orbit-ring-speed-factor)) !important;
}

/* 궤도 뒤 소프트 글로우 디스크 */
.hero-orbit.is-spectacle-glow::after {
  content: "";
  position: absolute;
  inset: 6%; /* ↓ 값(예: 0%)이면 더 크게 번짐 */
  border-radius: 50%;
  background: radial-gradient(circle, rgba(56, 189, 248, 0.2), transparent 70%);
  pointer-events: none;
  animation: play-glow-fade 4.2s ease-out forwards;
}
@keyframes play-glow-fade {
  0% { opacity: 0; transform: scale(0.28); }
  18% { opacity: 1; }
  75% { opacity: 0.55; }
  100% { opacity: 0; transform: scale(1.14); }
}

/* chat 등 히어로 없을 때 임시 풀스크린 무대 */
.play-orbit-overlay {
  position: fixed;
  inset: 0;
  z-index: 96;
  pointer-events: none;
  background: radial-gradient(
    circle at center,
    rgba(2, 6, 23, 0.5),
    rgba(2, 6, 23, 0.12) 50%,
    transparent 72%
  );
  opacity: 0;
  animation: play-overlay-in 2.6s ease forwards; /* 전체 오버레이 수명 */
}
.play-orbit-overlay .play-orbit-fx {
  position: absolute;
  inset: 0;
  opacity: 1;
}
@keyframes play-overlay-in {
  0% { opacity: 0; }
  12% { opacity: 1; }
  78% { opacity: 1; }
  100% { opacity: 0; }
}

/* --- Dual brain morph (KO↔EN 전환 와이프) ---
 * 속도: play-wipe duration / 색: background gradient
 */
.play-split-wipe {
  position: fixed;
  inset: 0;
  z-index: 9999;
  pointer-events: none;
  background: linear-gradient(90deg, #0f172a 0%, #1e3a5f 50%, #0ea5e9 100%);
  transform: translateX(-105%);
}
.play-split-wipe.is-run {
  animation: play-wipe 0.7s ease forwards;
}
@keyframes play-wipe {
  0% { transform: translateX(-105%); }
  45% { transform: translateX(0%); }
  100% { transform: translateX(105%); }
}

/* --- Domain machine --- */
.play-machine {
  margin-top: 0.75rem;
  border: 1px solid var(--line, #d8e0ea);
  border-radius: 12px;
  background: var(--surface-card, #fff);
  overflow: hidden;
}
.play-machine-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 8px 10px;
  border-bottom: 1px solid var(--line, #d8e0ea);
  background: var(--accent-wash, #e8eef6);
}
.play-machine-toolbar button {
  border: 1px solid var(--line, #d8e0ea);
  background: #fff;
  color: var(--ink, #0f172a);
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 12px;
  cursor: pointer;
}
.play-machine-toolbar button.is-on {
  background: var(--accent, #1e3a5f);
  color: #fff;
  border-color: transparent;
}
.play-machine-stage {
  position: relative;
  min-height: 160px;
  padding: 12px;
}
.play-machine-stage img { width: 100%; height: auto; display: block; border-radius: 8px; }
.play-machine-hotspots {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
  gap: 8px;
  margin-top: 10px;
}
.play-hotspot {
  border: 1px dashed var(--line, #d8e0ea);
  border-radius: 8px;
  padding: 8px;
  background: rgba(56, 189, 248, 0.06);
  cursor: pointer;
  text-align: left;
  transition: transform .15s ease, background .15s ease;
}
.play-hotspot:hover, .play-hotspot.is-open {
  transform: translateY(-2px);
  background: rgba(56, 189, 248, 0.16);
}
.play-hotspot strong { display: block; font-size: 12px; margin-bottom: 2px; }
.play-hotspot span { font-size: 11px; color: var(--ink-muted, #5a6a7a); }
.play-machine-drawer {
  display: none;
  padding: 10px 12px 14px;
  border-top: 1px solid var(--line, #d8e0ea);
  font-size: 13px;
  color: var(--ink, #0f172a);
}
.play-machine-drawer.is-open { display: block; }
.play-machine.is-shake { animation: play-shake .4s ease; }
@keyframes play-shake {
  0%,100% { transform: translateX(0); }
  25% { transform: translateX(-4px); }
  75% { transform: translateX(4px); }
}
.play-pipe-row { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.play-pipe {
  border: 1px solid var(--line, #d8e0ea);
  border-radius: 6px;
  padding: 4px 8px;
  font-size: 11px;
  cursor: grab;
  background: #fff;
}
.play-pipe.is-locked { opacity: 0.45; cursor: default; }
.play-pipe-slots {
  display: flex;
  gap: 6px;
  margin-top: 8px;
  flex-wrap: wrap;
}
.play-pipe-slot {
  min-width: 72px;
  min-height: 28px;
  border: 1px dashed var(--accent-soft, #2c5282);
  border-radius: 6px;
  padding: 4px 6px;
  font-size: 11px;
  text-align: center;
  color: var(--ink-muted, #5a6a7a);
}

/* --- Terminal --- */
/* --- Terminal FAB ---
 * fab-stack 안: relative (방명록과 좌표 충돌 방지)
 * 스택 밖 폴백: fixed right/bottom
 * 패널 높이: .play-term height / bottom (데스크탑은 FAB 스택 위로)
 */
.fab-stack .play-term-fab {
  position: relative;
  right: auto;
  bottom: auto;
  width: 48px;
  height: 48px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: rgba(15, 23, 42, 0.72);
  color: #e2e8f0;
  cursor: pointer;
  font: 600 11px/1 ui-monospace, Menlo, Consolas, monospace;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.25);
  backdrop-filter: blur(8px);
}
.play-term-fab {
  position: fixed;
  right: 16px;
  bottom: 16px;
  z-index: 88;
  width: 48px;
  height: 48px;
  border-radius: 999px;
  border: 1px solid var(--play-line);
  background: var(--play-panel);
  color: #e2e8f0;
  cursor: pointer;
  font: 600 11px/1 ui-monospace, Menlo, Consolas, monospace;
  box-shadow: 0 8px 24px rgba(15,23,42,.25);
}
.play-term {
  position: fixed;
  right: 16px;
  bottom: 5.5rem;
  width: min(440px, calc(100vw - 32px));
  height: min(340px, 50vh);
  z-index: 92;
  display: none;
  flex-direction: column;
  border-radius: 12px;
  overflow: hidden;
  background: #020617;
  color: #e2e8f0;
  border: 1px solid rgba(56,189,248,.35);
  box-shadow: 0 18px 50px rgba(2,6,23,.45);
  font: 12px/1.45 ui-monospace, Menlo, Consolas, monospace;
}
.play-term.is-open { display: flex; }
@media (min-width: 721px) {
  .play-term {
    bottom: 18rem; /* fab-stack(테마·챗·방명록·터미널·탑) 위로 */
  }
}
.play-term-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 10px;
  background: #0f172a;
  border-bottom: 1px solid rgba(148,163,184,.25);
}
.play-term-bar button {
  background: transparent;
  border: 0;
  color: #94a3b8;
  cursor: pointer;
}
.play-term-out {
  flex: 1;
  overflow: auto;
  padding: 10px;
  white-space: pre-wrap;
  word-break: break-word;
}
.play-term-out .cmd { color: #38bdf8; }
.play-term-out .ok { color: #34d399; }
.play-term-out .err { color: #fb7185; }
.play-term-form {
  display: flex;
  gap: 6px;
  padding: 8px;
  border-top: 1px solid rgba(148,163,184,.25);
  background: #020617;
}
.play-term-form span { color: #38bdf8; padding-top: 6px; }
.play-term-form input {
  flex: 1;
  background: #0f172a;
  border: 1px solid rgba(148,163,184,.3);
  border-radius: 6px;
  color: #f8fafc;
  padding: 6px 8px;
  font: inherit;
}

/* --- RAG 별자리 ---
 * 캔버스 높이: .play-constellation-canvas height
 * 별 크기: .play-star width/height (클릭 쉬움 ↔ 미니멀)
 * 설명 팁은 캔버스 밖(.play-star-tip) — 별을 가리지 않음
 */
.play-constellation {
  margin: 1rem 0 1.25rem;
  border: 1px solid var(--line, #d8e0ea);
  border-radius: 12px;
  background: radial-gradient(circle at 30% 20%, #1e293b 0%, #020617 70%);
  color: #e2e8f0;
  overflow: hidden;
}
.play-constellation-head {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  padding: 10px 12px;
  border-bottom: 1px solid rgba(148,163,184,.25);
}
.play-constellation-head input {
  flex: 1;
  min-width: 160px;
  border-radius: 8px;
  border: 1px solid rgba(148,163,184,.35);
  background: rgba(15,23,42,.7);
  color: #f8fafc;
  padding: 8px 10px;
  font: inherit;
}
.play-constellation-head button {
  border: 0;
  border-radius: 8px;
  padding: 8px 12px;
  background: #38bdf8;
  color: #0f172a;
  font-weight: 600;
  cursor: pointer;
}
.play-constellation-canvas {
  position: relative;
  height: 220px;
  /* 팁은 캔버스 밖 — 별 클릭 영역과 분리 */
  z-index: 1;
}
.play-star {
  position: absolute;
  width: 14px;
  height: 14px;
  margin: -7px 0 0 -7px;
  border-radius: 50%;
  background: #94a3b8;
  box-shadow: 0 0 10px rgba(148,163,184,.5);
  cursor: pointer;
  transition: transform .2s ease, background .2s ease, box-shadow .2s ease;
  z-index: 2;
  border: 0;
  padding: 0;
}
.play-star.is-hit {
  background: #38bdf8;
  box-shadow: 0 0 16px rgba(56,189,248,.85);
}
.play-star.is-hit:hover,
.play-star.is-hit:focus-visible,
.play-star.is-selected {
  transform: scale(1.45);
  outline: none;
  z-index: 3;
}
.play-star.is-selected {
  box-shadow: 0 0 0 2px #f8fafc, 0 0 18px rgba(56, 189, 248, 0.9);
}
.play-star-tip {
  position: relative;
  margin: 0;
  padding: 10px 12px;
  border-radius: 0;
  background: rgba(2, 6, 23, 0.92);
  border: 0;
  border-top: 1px solid rgba(56, 189, 248, 0.35);
  font-size: 12px;
  max-height: none;
  overflow: visible;
  z-index: 0;
}
.play-star-tip[hidden] { display: none !important; }
.play-constellation-empty {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: #64748b;
  font-size: 13px;
  pointer-events: none;
  z-index: 0;
}

/* --- 요청 핀볼 ---
 * 단계 pill: .play-pin-step / 활성 글로우: .is-on box-shadow
 * 공 이동은 JS가 left/top transition — .play-pinball-ball transition 으로 속도 조절
 */
.play-pinball {
  margin: 0 0 1rem;
  border: 1px solid var(--line, #d8e0ea);
  border-radius: 12px;
  background: linear-gradient(180deg, #0b1220, #111827);
  color: #e2e8f0;
  padding: 10px 12px 12px;
  overflow: hidden;
}
.play-pinball-title {
  font-size: 12px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #94a3b8;
  margin-bottom: 8px;
}
.play-pinball-track {
  position: relative;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}
.play-pin-step {
  position: relative;
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid rgba(148,163,184,.35);
  font-size: 11px;
  color: #cbd5e1;
  background: rgba(15,23,42,.65);
}
.play-pin-step.is-on {
  border-color: #38bdf8;
  color: #e0f2fe;
  box-shadow: 0 0 0 1px rgba(56,189,248,.35), 0 0 18px rgba(56,189,248,.2);
}
.play-pin-step.is-ok {
  border-color: #34d399;
  color: #d1fae5;
}
.play-pin-step.is-fail {
  border-color: #fb7185;
  color: #ffe4e6;
  animation: play-shake .35s ease;
}
.play-pinball-ball {
  position: absolute;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #fbbf24;
  box-shadow: 0 0 12px rgba(251,191,36,.8);
  transition: left .35s ease, top .35s ease;
  pointer-events: none;
  z-index: 2;
}
@media (max-width: 720px) {
  .play-pinball-ball { display: none; }
  .play-hud { display: none; }
  .play-term { bottom: 5.5rem; }
}

/* --- SSE typography --- */
.bubble-bot .bubble-body.play-sse {
  position: relative;
}
.bubble-bot.is-evidence .bubble-body {
  text-shadow: 0 0 0 transparent;
}
.bubble-bot.is-no-evidence .bubble-body {
  filter: contrast(1.05);
}
.play-sse-cursor {
  display: inline-block;
  width: 7px;
  height: 1em;
  margin-left: 2px;
  vertical-align: text-bottom;
  background: #38bdf8;
  animation: play-blink 0.8s steps(1) infinite;
}
@keyframes play-blink {
  50% { opacity: 0; }
}
.bubble-bot.is-glitch .bubble-body {
  animation: play-glitch .45s steps(2) 1;
}
@keyframes play-glitch {
  0% { transform: none; opacity: 1; }
  30% { transform: translateX(2px); opacity: 0.7; }
  60% { transform: translateX(-2px); opacity: 0.85; }
  100% { transform: none; opacity: 1; }
}

/* ============================================================================
 * Dev cursor — 데스크톱(fine pointer)만. 터치·펜은 시스템 커서 유지.
 * 링 크기/색: 아래 width·border-color / 태그 폰트: .play-cursor-tag
 * ============================================================================ */
@media (pointer: fine) and (hover: hover) {
  html.has-dev-cursor,
  html.has-dev-cursor * {
    cursor: none !important;
  }
}

.play-cursor {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 10050;
  width: 0;
  height: 0;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.18s ease;
  mix-blend-mode: normal;
}
.play-cursor.is-on {
  opacity: 1;
}

/* 외곽 링 — 기본 크로스헤어 느낌의 원 */
.play-cursor-ring {
  position: absolute;
  top: 0;
  left: 0;
  width: 26px;
  height: 26px;
  margin: -13px 0 0 -13px;
  border: 1.5px solid rgba(56, 189, 248, 0.7);
  border-radius: 50%;
  box-shadow:
    0 0 0 1px rgba(15, 23, 42, 0.25),
    0 0 12px rgba(56, 189, 248, 0.25);
  transition:
    width 0.18s ease,
    height 0.18s ease,
    margin 0.18s ease,
    border-radius 0.18s ease,
    border-color 0.18s ease,
    background 0.18s ease,
    transform 0.12s ease;
}

/* 터미널 블록 점 — 중심 앵커 */
.play-cursor-dot {
  position: absolute;
  top: 0;
  left: 0;
  width: 5px;
  height: 5px;
  margin: -2.5px 0 0 -2.5px;
  border-radius: 1px;
  background: #38bdf8;
  box-shadow:
    0 0 0 1px rgba(15, 23, 42, 0.35),
    0 0 10px rgba(56, 189, 248, 0.55);
  transition: transform 0.12s ease, opacity 0.12s ease, width 0.15s ease, height 0.15s ease, margin 0.15s ease;
}

/* 호버 시 코드 태그 </> */
.play-cursor-tag {
  position: absolute;
  left: 12px;
  top: -10px;
  padding: 2px 4px;
  border-radius: 3px;
  font-family: ui-monospace, "Cascadia Code", "SF Mono", Menlo, Consolas, monospace;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: -0.04em;
  line-height: 1;
  color: #e0f2fe;
  background: rgba(15, 23, 42, 0.82);
  border: 1px solid rgba(56, 189, 248, 0.45);
  opacity: 0;
  transform: translateY(2px);
  transition: opacity 0.15s ease, transform 0.15s ease;
  white-space: nowrap;
}

.play-cursor.is-hover .play-cursor-ring {
  width: 38px;
  height: 38px;
  margin: -19px 0 0 -19px;
  border-color: rgba(125, 211, 252, 0.95);
  box-shadow:
    0 0 0 1px rgba(15, 23, 42, 0.3),
    0 0 16px rgba(56, 189, 248, 0.4);
}
.play-cursor.is-hover .play-cursor-tag {
  opacity: 1;
  transform: translateY(0);
}
.play-cursor.is-hover .play-cursor-dot {
  transform: scale(1.15);
}

/* 텍스트 입력 — I-beam */
.play-cursor.is-text .play-cursor-ring {
  width: 2px;
  height: 22px;
  margin: -11px 0 0 -1px;
  border-radius: 1px;
  border-color: transparent;
  background: #38bdf8;
  box-shadow: 0 0 8px rgba(56, 189, 248, 0.5);
}
.play-cursor.is-text .play-cursor-dot {
  opacity: 0;
}
.play-cursor.is-text .play-cursor-tag {
  opacity: 0;
}

.play-cursor.is-down .play-cursor-ring {
  transform: scale(0.72);
}
.play-cursor.is-down .play-cursor-dot {
  transform: scale(0.7);
}
