/* =========================================================
   랩(/lab) 전용 스타일 — 리워드 트래픽 미션 화면 (어두운 테마 사이트용)
   탭비트(밝은 테마) 원본을 바탕으로, 흰 바탕을 쓰던 곳을 사이트 색 변수로 바꿨습니다.
   포인트 색은 사이트마다 이름이 달라서(--brand / --gold) 둘 다 받습니다.
   styles.css 의 토큰(--surface, --line, --text …)을 그대로 씁니다. 다른 페이지에는 안 읽힙니다.
   ========================================================= */

.lab {
  --lab-accent: var(--brand, var(--gold, #f0b90b));
  --lab-line:   var(--brand-line, var(--gold-line, rgba(240, 185, 11, 0.35)));
  --lab-dim:    var(--brand-dim, var(--gold-dim, rgba(240, 185, 11, 0.14)));
  max-width: 560px;
  margin-inline: auto;
  padding: clamp(32px, 5vw, 48px) clamp(20px, 4vw, 40px);
  border: 1px solid var(--lab-line);
  border-radius: var(--radius-lg);
  background: linear-gradient(150deg, var(--lab-dim), transparent 60%), var(--surface);
  text-align: center;
}
.lab h1 { font-size: clamp(22px, 3.2vw, 30px); margin-bottom: 12px; }
.lab h1 em { font-style: normal; color: var(--lab-accent); }
.lab > .lab__panel > p { color: var(--text-2); }
.lab__panel { display: none; }
.lab[data-stage="gate"]    .lab__panel[data-panel="gate"],
.lab[data-stage="captcha"] .lab__panel[data-panel="captcha"],
.lab[data-stage="wait"]    .lab__panel[data-panel="wait"],
.lab[data-stage="answer"]  .lab__panel[data-panel="answer"] { display: block; }
.lab__panel--static { display: block; }
.lab__note { margin-top: 20px; font-size: 13px; color: var(--text-3); }
.lab .btn-row--center { justify-content: center; }
.lab .sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }

/* ---- 1. 사람 확인 ----
   글자 그림(canvas)은 흰 바탕에 그리므로, 그 테두리 상자만은 어두운 테마에서도 흰색으로 둡니다. */
.captcha {
  position: relative;
  display: inline-block;
  margin-top: 22px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #ffffff;
  overflow: hidden;
}
.captcha__canvas { display: block; width: 280px; max-width: 100%; height: auto; }
.captcha__refresh {
  position: absolute; right: 6px; top: 6px;
  width: 30px; height: 30px;
  border: 1px solid #d9dde3; border-radius: 8px;
  background: #ffffff; color: #464c55;
  font-size: 18px; line-height: 1; cursor: pointer;
}
.captcha__refresh:hover { color: #111418; border-color: #9aa1ab; }
.captcha__form { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; margin-top: 16px; }
.captcha__input {
  width: 180px; padding: 12px 14px;
  border: 1px solid var(--line); border-radius: 10px;
  font: 600 20px/1.2 var(--mono);
  letter-spacing: 0.22em; text-transform: uppercase; text-align: center;
  color: var(--text); background: var(--bg-2);
}
.captcha__input::placeholder { color: var(--text-3); letter-spacing: 0.05em; }
.captcha__input:focus { outline: 2px solid var(--lab-accent); outline-offset: 1px; border-color: var(--lab-accent); }
.captcha__msg { min-height: 22px; margin-top: 12px; font-size: 14px; color: var(--down); }
.captcha__msg.is-ok { color: var(--up); }
.captcha.is-shake { animation: lab-shake 0.35s; }
@keyframes lab-shake { 0%, 100% { transform: translateX(0); } 25% { transform: translateX(-6px); } 75% { transform: translateX(6px); } }

/* ---- 2. 대기 ---- */
.timer { margin-top: 26px; }
.timer__ring { position: relative; width: 168px; height: 168px; margin-inline: auto; }
.timer__ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.timer__track { fill: none; stroke: var(--line); stroke-width: 8; }
.timer__bar {
  fill: none; stroke: var(--lab-accent); stroke-width: 8; stroke-linecap: round;
  stroke-dasharray: 339.3;           /* 2πr, r=54 */
  stroke-dashoffset: 0;
  transition: stroke-dashoffset 0.9s linear;
}
.timer__num {
  position: absolute; inset: 0;
  display: grid; place-items: center;
  font: 800 clamp(34px, 6vw, 42px)/1 var(--mono);
  font-variant-numeric: tabular-nums;
  color: var(--text);
}
.timer__state { margin-top: 14px; min-height: 22px; font-size: 14px; color: var(--text-3); }
.timer.is-paused .timer__bar { stroke: var(--text-3); }
.timer.is-paused .timer__state { color: var(--down); font-weight: 600; }

/* ---- 3. 정답 ---- */
.answer {
  display: flex; align-items: center; justify-content: center; gap: 12px; flex-wrap: wrap;
  margin-top: 24px;
}
.answer__code {
  display: inline-block;
  padding: 14px 26px;
  border: 2px dashed var(--lab-accent); border-radius: 12px;
  background: var(--bg-2);
  font: 800 clamp(30px, 6vw, 40px)/1.1 var(--mono);
  letter-spacing: 0.18em;
  color: var(--text);
  user-select: all;
}
.answer__copy.is-done { color: var(--up); border-color: var(--up); }

@media (max-width: 480px) {
  .captcha__form { flex-direction: column; align-items: stretch; }
  .captcha__input { width: 100%; }
}
