/* ==============================================================
   CYBER:X 전용 추가 스타일
   레이아웃/패널/버튼/타이포는 styles.css 의 기존 구성을 그대로 쓰고,
   여기에는 기존에 없던 기능 요소만 정의한다.
   QR 로 각자 휴대폰에서 접속하므로 모바일을 1순위로 잡는다.
   ============================================================== */

/* display 를 지정한 요소에도 hidden 속성이 먹도록 한다 */
[hidden] { display: none !important; }

/* 한국어는 기본 규칙으로 두면 어절 한가운데서 줄이 끊긴다.
   keep-all 로 어절을 지키고, 긴 영문/토큰만 따로 끊는다. */
.auth-copy, .auth-card, .cx-mobilebar, .footer {
  word-break: keep-all;
  overflow-wrap: break-word;
}

.cx-dim { color: #86a5c6; font-weight: 400; }

/* 좌측 상단 배너 = 홈으로 */
.nav-home { text-decoration: none; border-radius: 12px; padding: 4px 8px; margin-left: -8px;
  transition: background 0.2s ease; }
.nav-home:hover { background: rgba(255, 255, 255, 0.07); }
.nav-home:active { background: rgba(255, 255, 255, 0.12); }
.cx-warn { color: #ffc9c9; }
.cx-hi { color: #8fd3ff; }

/* ---------- 배치 (좌: 설명·결과 + 상세 / 우: 입력) ----------
   왼쪽 두 패널을 한 열로 묶어야 오른쪽 카드가 길어져도 사이에 빈 공간이 생기지 않는다. */
.cx-col { display: flex; flex-direction: column; gap: 18px; min-width: 0; }
.cx-detail { border-radius: 26px; padding: 28px 30px; }
.auth-shell .auth-card { align-self: flex-start; position: sticky; top: 84px; }

/* ---------- 단계 표시 (auth-kicker 톤 재사용) ---------- */
.cx-steps { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 24px; }
.cx-step {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 7px 12px; border-radius: 999px;
  font-size: 0.76rem; font-weight: 700; letter-spacing: 0.02em;
  color: #7f9bbf; background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.07); transition: 0.3s ease;
}
.cx-step b { display: grid; place-items: center; width: 18px; height: 18px; flex: none;
  border-radius: 50%; background: rgba(255, 255, 255, 0.1); font-size: 0.68rem; }
.cx-step.active { color: #8fd3ff; background: rgba(0, 120, 255, 0.18); border-color: rgba(110, 188, 255, 0.35); }
.cx-step.active b { background: linear-gradient(90deg, #0078ff, #00c0ff); color: #fff; }
.cx-step.done { color: #6ee7a8; border-color: rgba(56, 248, 176, 0.3); }
.cx-step.done b { background: rgba(56, 248, 176, 0.85); color: #04301f; }

/* ---------- 해독 시간 ---------- */
.cx-result { margin-top: 26px; padding: 22px 20px 18px; border-radius: 18px;
  background: rgba(255, 255, 255, 0.04); border: 1px solid rgba(255, 255, 255, 0.07); text-align: center; }
.cx-result-label { font-size: 0.84rem; color: #a8bfdc; }
.cx-time { margin: 8px 0 4px; font-size: clamp(2.1rem, 6vw, 3.6rem); font-weight: 800; line-height: 1.1;
  color: #ff6b6b; text-shadow: 0 0 26px rgba(255, 80, 80, 0.3); transition: color 0.3s; }
.cx-time.lv1 { color: #ffa94d; text-shadow: 0 0 26px rgba(255, 160, 60, 0.28); }
.cx-time.lv2 { color: #ffd43b; text-shadow: 0 0 26px rgba(255, 210, 60, 0.28); }
.cx-time.lv3 { color: #a9e34b; text-shadow: 0 0 26px rgba(170, 225, 75, 0.28); }
.cx-time.lv4 { color: #38f8b0; text-shadow: 0 0 30px rgba(56, 248, 176, 0.42); }
.cx-verdict { font-size: 0.92rem; color: #b8cde7; line-height: 1.6; min-height: 1.5em; }

/* 성공 / 실패 판정 */
.cx-stamp { display: inline-flex; align-items: center; gap: 8px; margin-top: 14px;
  padding: 9px 22px; border-radius: 999px; font-size: 1.02rem; font-weight: 800; letter-spacing: 0.04em;
  border: 2px solid; transition: 0.3s ease; }
.cx-stamp.fail { color: #ff8787; border-color: rgba(255, 107, 107, 0.6); background: rgba(255, 80, 80, 0.1); }
.cx-stamp.pass { color: #38f8b0; border-color: rgba(56, 248, 176, 0.65); background: rgba(56, 248, 176, 0.12);
  box-shadow: 0 0 24px rgba(56, 248, 176, 0.25); animation: cxPop 0.45s cubic-bezier(0.22, 1, 0.36, 1); }
.cx-stamp.idle { color: #86a5c6; border-color: rgba(255, 255, 255, 0.14); background: rgba(255, 255, 255, 0.03); }
.cx-goal { margin-top: 9px; font-size: 0.79rem; color: #86a5c6; }

@keyframes cxPop { from { transform: scale(0.95); opacity: 0; } to { transform: scale(1); opacity: 1; } }

/* 게이지 */
.cx-gauge { position: relative; height: 12px; margin: 20px 0 7px; border-radius: 999px;
  background: rgba(255, 255, 255, 0.07); }
.cx-gauge-fill { height: 100%; width: 0; border-radius: 999px;
  background: linear-gradient(90deg, #ff6b6b, #ffd43b 55%, #38f8b0);
  transition: width 0.45s cubic-bezier(0.22, 1, 0.36, 1); }
.cx-gauge-goal { position: absolute; right: 0; top: -5px; width: 3px; height: 22px; border-radius: 2px;
  background: #38f8b0; box-shadow: 0 0 10px rgba(56, 248, 176, 0.75); }
.cx-gauge-scale { position: relative; height: 1.2em; font-size: 0.71rem; color: #86a5c6; }
.cx-gauge-scale span { position: absolute; top: 0; white-space: nowrap; transform: translateX(-50%); }
.cx-gauge-scale span:first-child { transform: none; }
.cx-gauge-scale span:last-child { transform: translateX(-100%); }

/* 해커 대입 연출 */
.cx-crack { display: flex; justify-content: space-between; align-items: center; gap: 12px;
  margin-top: 16px; padding: 10px 13px; border-radius: 12px;
  background: rgba(0, 0, 0, 0.32); border: 1px solid rgba(255, 255, 255, 0.06);
  font-family: 'SFMono-Regular', Consolas, 'Courier New', monospace; font-size: 0.83rem; }
.cx-crack .try { color: #ff8787; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cx-crack .rate { color: #7f9bbf; font-size: 0.75rem; white-space: nowrap; }

/* ---------- 문자 분해 ---------- */
.cx-breakdown { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }
.cx-seg { padding: 7px 10px 5px; border-radius: 10px; text-align: center; min-width: 0; }
.cx-seg-token { font-family: 'SFMono-Regular', Consolas, 'Courier New', monospace;
  font-size: 1rem; letter-spacing: 0.04em; word-break: break-all; }
.cx-seg-tag { margin-top: 2px; font-size: 0.66rem; opacity: 0.85; }
.cx-seg.weak { background: rgba(255, 80, 80, 0.15); border: 1px solid rgba(255, 107, 107, 0.45); color: #ffc9c9; }
.cx-seg.mid  { background: rgba(255, 200, 60, 0.13); border: 1px solid rgba(255, 212, 59, 0.4); color: #ffe8a3; }
.cx-seg.ok   { background: rgba(56, 248, 176, 0.11); border: 1px solid rgba(56, 248, 176, 0.35); color: #b6f2d8; }

/* ---------- auth-points 변형 ---------- */
.auth-points li.is-weak { background: rgba(255, 80, 80, 0.08); border-color: rgba(255, 107, 107, 0.28); }
.auth-points li.is-ok { background: rgba(56, 248, 176, 0.08); border-color: rgba(56, 248, 176, 0.28); }
.auth-points li .pt-head { display: flex; gap: 9px; align-items: baseline;
  font-weight: 700; color: #eaf3ff; font-size: 0.92rem; line-height: 1.5; }
.auth-points li.is-weak .pt-head { color: #ffc9c9; }
.auth-points li.is-ok .pt-head { color: #b6f2d8; }
.auth-points li .pt-desc { margin-top: 5px; font-size: 0.82rem; color: #b8cde7; line-height: 1.65; }
.auth-points.tight { margin-top: 14px; }
.cx-guide-head { margin-top: 26px; }

/* ---------- 입력 ---------- */
.cx-inputwrap { position: relative; }
.cx-inputwrap input { padding-right: 52px; font-size: 1.1rem; letter-spacing: 0.05em;
  font-family: 'SFMono-Regular', Consolas, 'Courier New', monospace; }
.cx-inputwrap input::placeholder { font-size: 0.9rem; letter-spacing: normal;
  font-family: 'Noto Sans KR', 'Segoe UI', sans-serif; }
.cx-eye { position: absolute; right: 6px; top: 50%; transform: translateY(-50%);
  background: none; border: none; cursor: pointer; font-size: 1.1rem;
  width: 40px; height: 40px; display: grid; place-items: center; border-radius: 10px; }
.cx-eye:hover { background: rgba(255, 255, 255, 0.07); }

/* 버튼 두 개를 나란히 (제출하기와 위계를 구분한다) */
.cx-btnpair { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 8px; }
.cx-btnpair .btn { padding: 11px 10px; text-align: center; font-size: 0.9rem; }
.btn.primary[disabled], .btn.outline[disabled] {
  opacity: 0.45; cursor: not-allowed; box-shadow: none; filter: grayscale(0.3); }

/* ---------- 안내 문구 ---------- */
.cx-consent { display: flex; gap: 9px; align-items: flex-start; margin-top: 6px;
  font-size: 0.82rem; color: #b8cde7; line-height: 1.6; cursor: pointer; }
.cx-consent input { width: 18px; height: 18px; flex: none; margin-top: 2px; accent-color: #0078ff; cursor: pointer; }
.cx-consent strong { color: #9fd0ff; }
.cx-formmsg { margin-top: 4px; font-size: 0.82rem; line-height: 1.6; color: #ffc9c9; }
.cx-formmsg.info { color: #ffe8a3; }
.cx-who { display: block; margin-bottom: 6px; font-weight: 700; color: #8fd3ff; }
.cx-count { padding: 6px 12px; border-radius: 999px; font-size: 0.8rem; font-weight: 700; white-space: nowrap;
  color: #8fd3ff; background: rgba(0, 120, 255, 0.18); border: 1px solid rgba(110, 188, 255, 0.25); }
.cx-note { margin-top: 22px; font-size: 0.76rem; color: #86a5c6; line-height: 1.75; }
.cx-note strong { color: #7ec7ff; font-weight: 700; }
.cx-offline { display: block; margin-bottom: 10px; padding: 9px 12px; border-radius: 10px;
  font-size: 0.8rem; line-height: 1.6; font-weight: 400; color: #ffe8a3;
  background: rgba(255, 200, 60, 0.1); border: 1px solid rgba(255, 212, 59, 0.3); }

/* ---------- 다음 한 걸음 ---------- */
.cx-next { margin-top: 2px; padding: 10px 13px; border-radius: 11px; font-size: 0.84rem; line-height: 1.6;
  background: rgba(255, 200, 60, 0.1); border: 1px solid rgba(255, 212, 59, 0.32); color: #ffe8a3; }
.cx-next.done { background: rgba(56, 248, 176, 0.1); border-color: rgba(56, 248, 176, 0.32); color: #b6f2d8; }
.cx-next b { color: #fff; }

/* ---------- 만드는 방법 ---------- */
.cx-how { margin-top: 14px; padding: 16px 16px 14px; border-radius: 14px;
  background: rgba(255, 255, 255, 0.04); border: 1px solid rgba(255, 255, 255, 0.08); }
.cx-how-title { font-size: 0.88rem; font-weight: 700; color: #9fd0ff; margin-bottom: 10px; line-height: 1.5; }
.cx-how-steps { margin: 0 0 0 18px; display: grid; gap: 8px; font-size: 0.83rem; color: #c9d6ea; line-height: 1.65; }
.cx-how-steps em { color: #dcecff; font-style: normal; }
.cx-how-steps code { font-family: 'SFMono-Regular', Consolas, 'Courier New', monospace;
  font-size: 0.88rem; padding: 2px 7px; border-radius: 6px; color: #b6f2d8; word-break: break-all;
  background: rgba(56, 248, 176, 0.12); border: 1px solid rgba(56, 248, 176, 0.25); }
.cx-how-warn { margin-top: 11px; font-size: 0.78rem; color: #ffc9c9; line-height: 1.6; }

/* ---------- 제출 완료 ---------- */
.cx-done { margin-top: 18px; padding: 22px 20px; border-radius: 18px; text-align: center;
  animation: cxPop 0.45s cubic-bezier(0.22, 1, 0.36, 1); }
.cx-done.pass { background: linear-gradient(135deg, rgba(56, 248, 176, 0.16), rgba(0, 140, 255, 0.13));
  border: 1px solid rgba(56, 248, 176, 0.45); }
.cx-done.fail { background: rgba(255, 80, 80, 0.09); border: 1px solid rgba(255, 107, 107, 0.35); }
.cx-done-stamp { font-size: 1.2rem; font-weight: 800; }
.cx-done.pass .cx-done-stamp { color: #38f8b0; }
.cx-done.fail .cx-done-stamp { color: #ff8787; }
.cx-done-time { margin-top: 6px; font-size: 1rem; font-weight: 700; color: #eaf3ff; }
.cx-done-desc { margin-top: 10px; font-size: 0.84rem; line-height: 1.7; color: #c9d6ea; }
.cx-done-warn { margin-top: 10px; font-size: 0.8rem; color: #ffe8a3; }

/* ---------- 휴대폰 하단 고정 바 ---------- */
.cx-mobilebar { display: none; }

/* ---------- 운영 현황 화면 ---------- */
.cx-keyline { display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  margin-top: 18px; font-size: 0.84rem; color: #86a5c6; }
.cx-linkbtn { background: none; border: none; padding: 0; cursor: pointer;
  color: #7ec7ff; font-weight: 700; font-size: 0.84rem; font-family: inherit; text-decoration: underline; }
.cx-linkbtn:hover { color: #a8dcff; }
.cx-summary { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 26px; }
.cx-stat { flex: 1 1 150px; display: flex; align-items: baseline; gap: 8px;
  padding: 16px 18px; border-radius: 14px;
  background: rgba(255, 255, 255, 0.04); border: 1px solid rgba(255, 255, 255, 0.07); }
.cx-stat-label { font-size: 0.8rem; color: #86a5c6; }
.cx-stat b { margin-left: auto; font-size: 1.7rem; color: #8fd3ff; font-variant-numeric: tabular-nums; }
.cx-stat-unit { font-size: 0.82rem; color: #86a5c6; }
.cx-btnrow { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }

.cx-tablewrap { margin-top: 18px; overflow-x: auto; border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.07); }
.cx-table { width: 100%; border-collapse: collapse; font-size: 0.86rem; min-width: 700px; }
.cx-table th, .cx-table td { padding: 11px 14px; text-align: left; white-space: nowrap;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06); }
.cx-table th { background: rgba(255, 255, 255, 0.05); color: #9fd0ff; font-weight: 700; font-size: 0.8rem; }
.cx-table td { color: #c9d6ea; font-variant-numeric: tabular-nums; }
.cx-table tbody tr:last-child td { border-bottom: none; }
.cx-table tbody tr:hover td { background: rgba(255, 255, 255, 0.03); }
.cx-table td.is-pass { color: #6ee7a8; }

/* ---------- 기록 파기 ---------- */
.btn.outline.cx-danger { border-color: rgba(255, 107, 107, 0.5); color: #ffc9c9; }
.btn.outline.cx-danger:hover { background: rgba(255, 80, 80, 0.16); box-shadow: 0 10px 24px rgba(255, 80, 80, 0.18); }
.btn.outline.cx-danger[disabled] { opacity: 0.4; cursor: not-allowed; border-color: rgba(255, 255, 255, 0.14);
  color: #86a5c6; background: rgba(255, 255, 255, 0.03); box-shadow: none; }
.cx-purge { margin-top: 16px; padding: 18px; border-radius: 16px;
  background: rgba(255, 80, 80, 0.08); border: 1px solid rgba(255, 107, 107, 0.35); }
.cx-purge-title { font-size: 0.95rem; font-weight: 700; color: #ffc9c9; }
.cx-purge-desc { margin-top: 7px; font-size: 0.83rem; color: #c9d6ea; line-height: 1.7; }
.cx-purge-desc strong { color: #ffe8a3; }
.cx-purge-row { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 13px; }
.cx-purge-row input { flex: 1 1 160px; padding: 11px 14px; border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.12); background: rgba(0, 8, 22, 0.6);
  color: #edf5ff; font-size: 0.92rem; outline: none; }
.cx-purge-row input:focus { border-color: rgba(255, 107, 107, 0.7); }
.cx-purge-row .btn { flex: 0 0 auto; padding: 10px 18px; }

/* ==============================================================
   휴대폰 (QR 접속 주 경로)
   ============================================================== */
@media (max-width: 768px) {
  /* 휴대폰에서는 묶음을 풀어 설명·결과 → 입력 → 상세 순서로 세운다 */
  .cx-col { display: contents; }
  .auth-copy { order: 1; }
  .auth-card { order: 2; }
  .cx-detail { order: 3; padding: 24px 20px; }

  /* 입력하는 동안 결과와 제출 버튼이 화면에서 사라지지 않게 한다 */
  .cx-mobilebar {
    display: flex; align-items: center; gap: 12px;
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 1200;
    padding: 10px 14px calc(10px + env(safe-area-inset-bottom));
    background: rgba(6, 14, 30, 0.96); backdrop-filter: blur(12px);
    border-top: 1px solid rgba(120, 190, 255, 0.18);
    box-shadow: 0 -8px 28px rgba(0, 0, 0, 0.45);
  }
  .cx-mb-info { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
  .cx-mb-time { font-size: 1.15rem; font-weight: 800; line-height: 1.2; color: #ff6b6b;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .cx-mb-time.lv1 { color: #ffa94d; } .cx-mb-time.lv2 { color: #ffd43b; }
  .cx-mb-time.lv3 { color: #a9e34b; } .cx-mb-time.lv4 { color: #38f8b0; }
  .cx-mb-stamp { font-size: 0.72rem; font-weight: 700; letter-spacing: 0.04em; }
  .cx-mb-stamp.idle { color: #86a5c6; }
  .cx-mb-stamp.fail { color: #ff8787; }
  .cx-mb-stamp.pass { color: #38f8b0; }
  .cx-mobilebar .btn.primary { flex: 0 0 auto; margin-top: 0; padding: 12px 22px; font-size: 0.95rem; }

  /* 하단 바에 가려지지 않도록 */
  .footer { padding-bottom: calc(84px + env(safe-area-inset-bottom)); }

  /* 카드 안의 제출 버튼은 하단 바와 중복이라 감춘다 */
  #submitBtn { display: none; }

  .auth-shell { padding: 18px 14px 32px; }
  .auth-copy h1 { font-size: 1.65rem; }
  .cx-result { padding: 18px 14px 16px; }
  .cx-steps { gap: 6px; }
  .cx-step { font-size: 0.72rem; padding: 6px 10px; }
  .cx-gauge-scale { font-size: 0.66rem; }
  .cx-crack .rate { display: none; }
  .cx-btnpair .btn { padding: 12px 8px; }
  .navbar { gap: 8px; }
  .nav-left .title { font-size: 0.9rem; }
  .cx-count { font-size: 0.72rem; padding: 5px 9px; }
  /* iOS 는 16px 미만 입력창에서 화면을 확대해 버린다 */
  .auth-form input, .cx-purge-row input { font-size: 16px; }
  .cx-inputwrap input { font-size: 16px; }
}

@media (max-width: 380px) {
  .nav-left .title { display: none; }
  .cx-mb-time { font-size: 1rem; }
  .cx-mobilebar .btn.primary { padding: 11px 16px; font-size: 0.9rem; }
}

@media (prefers-reduced-motion: reduce) {
  .cx-gauge-fill, .cx-stamp, .cx-done, .cx-step { transition: none; animation: none; }
}
