:root {
  --bg: #0d1018;
  --bg-glow-1: #1d4ed8;
  --bg-glow-2: #16a34a;
  --card: #151a24;
  --card-line: #232b39;
  --slot: #1b2130;
  --text: #e8ecf3;
  --text-dim: #98a2b3;
  --text-faint: #6b7686;
  --ok: #22c55e;
  --ok-soft: rgba(34, 197, 94, 0.14);
  --ok-line: rgba(34, 197, 94, 0.4);
  --discord: #5865f2;
  --discord-hover: #4752c4;
  --danger: #f87171;
  --danger-soft: rgba(248, 113, 113, 0.12);
  --radius: 16px;
}

* { box-sizing: border-box; }

/* hidden 속성이 아래 display 규칙에 밀리지 않도록 */
[hidden] { display: none !important; }

html, body { height: 100%; }

body {
  margin: 0;
  padding: 24px 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg);
  color: var(--text);
  font-family: Pretendard, -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Malgun Gothic', sans-serif;
  -webkit-font-smoothing: antialiased;
}

/* 배경의 은은한 빛 */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  z-index: -1;
  background:
    radial-gradient(60vw 50vh at 20% -10%, color-mix(in srgb, var(--bg-glow-1) 22%, transparent), transparent 70%),
    radial-gradient(50vw 45vh at 100% 110%, color-mix(in srgb, var(--bg-glow-2) 16%, transparent), transparent 70%);
}

/* ---------------------------------------------------------------- 카드 */

.card {
  width: 100%;
  max-width: 440px;
  background: var(--card);
  border: 1px solid var(--card-line);
  border-radius: 22px;
  padding: 32px 28px 20px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.45);
  animation: rise 0.4s cubic-bezier(0.2, 0.8, 0.3, 1) both;
}

@keyframes rise {
  from { opacity: 0; transform: translateY(12px); }
}

.card-head { text-align: center; margin-bottom: 22px; }

.logo {
  width: 46px;
  height: 46px;
  margin: 0 auto 12px;
  display: grid;
  place-items: center;
  border-radius: 13px;
  background: var(--ok-soft);
  border: 1px solid var(--ok-line);
  color: var(--ok);
}
.logo svg { width: 24px; height: 24px; }

.card-head h1 { margin: 0; font-size: 22px; font-weight: 700; letter-spacing: -0.01em; }
.sub { margin: 6px 0 0; font-size: 13.5px; color: var(--text-dim); }

/* ---------------------------------------------------------------- 알림 */

.alert {
  margin-bottom: 18px;
  padding: 12px 14px;
  border-radius: 11px;
  background: var(--danger-soft);
  border: 1px solid rgba(248, 113, 113, 0.32);
  color: #fca5a5;
  font-size: 13.5px;
  line-height: 1.5;
}

/* ---------------------------------------------------------------- 단계 칸 */

.slot {
  background: var(--slot);
  border: 1px solid var(--card-line);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 12px;
  transition: border-color 0.25s, opacity 0.25s;
}

.slot.locked { opacity: 0.5; }
.slot.cleared { border-color: var(--ok-line); }

.slot-label {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-faint);
  letter-spacing: 0.02em;
}

.step-no {
  display: grid;
  place-items: center;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #2b3444;
  color: var(--text-dim);
  font-size: 11px;
  font-weight: 700;
}
.slot.cleared .step-no { background: var(--ok); color: #06210f; }

/* ---------------------------------------------------------------- 버튼 */

.btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  padding: 13px 16px;
  border: 0;
  border-radius: 11px;
  font: inherit;
  font-size: 15px;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  transition: background 0.18s, transform 0.12s, box-shadow 0.18s;
}
.btn:active { transform: translateY(1px); }

.btn[aria-disabled='true'] {
  pointer-events: none;
  opacity: 0.42;
  filter: saturate(0.5);
}

.btn-ms { background: #ffffff; color: #1a1a1a; }
.btn-ms:hover { background: #ececec; }
.ms-logo { width: 17px; height: 17px; flex: none; }

.btn-discord { background: var(--discord); color: #fff; }
.btn-discord:hover { background: var(--discord-hover); box-shadow: 0 6px 18px rgba(88, 101, 242, 0.3); }
.dc-logo { width: 20px; height: 15px; flex: none; }

.hint { margin: 9px 0 0; font-size: 12px; color: var(--text-faint); text-align: center; }

/* ---------------------------------------------------------------- 프로필 카드 */

.profile {
  display: flex;
  align-items: center;
  gap: 14px;
  animation: rise 0.35s cubic-bezier(0.2, 0.8, 0.3, 1) both;
}

.avatar {
  width: 72px;
  height: 72px;
  flex: none;
  border-radius: 12px;
  background: #0f131b;
  border: 1px solid var(--card-line);
  object-fit: contain;
  image-rendering: pixelated;
  padding: 4px;
}

.profile-text { min-width: 0; flex: 1; }

.nickname {
  font-size: 19px;
  font-weight: 700;
  letter-spacing: -0.01em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.uuid {
  margin-top: 3px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 10.5px;
  color: var(--text-faint);
  word-break: break-all;
  line-height: 1.35;
}

.badge-ok {
  flex: none;
  align-self: flex-start;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 6px 11px;
  border-radius: 999px;
  background: var(--ok-soft);
  border: 1px solid var(--ok-line);
  color: var(--ok);
  font-size: 12.5px;
  font-weight: 700;
  white-space: nowrap;
}
.badge-ok svg { width: 12px; height: 12px; }

/* ---------------------------------------------------------------- Turnstile */

.turnstile-wrap { display: flex; justify-content: center; min-height: 66px; align-items: center; }
#turnstile { display: flex; justify-content: center; }

.ts-done {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 9px 16px;
  border-radius: 999px;
  background: var(--ok-soft);
  border: 1px solid var(--ok-line);
  color: var(--ok);
  font-size: 13.5px;
  font-weight: 600;
}
.ts-done svg { width: 14px; height: 14px; }

/* ---------------------------------------------------------------- 완료 화면 */

.done { text-align: center; padding: 8px 0 4px; animation: rise 0.45s cubic-bezier(0.2, 0.8, 0.3, 1) both; }

.done-mark {
  width: 64px;
  height: 64px;
  margin: 0 auto 18px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--ok-soft);
  border: 2px solid var(--ok);
  color: var(--ok);
  animation: pop 0.5s cubic-bezier(0.2, 1.3, 0.4, 1) both 0.1s;
}
.done-mark svg { width: 32px; height: 32px; }

@keyframes pop {
  from { transform: scale(0.5); opacity: 0; }
}

.done h2 { margin: 0 0 8px; font-size: 19px; font-weight: 700; line-height: 1.5; }

.role-chip {
  display: inline-block;
  padding: 1px 9px;
  border-radius: 7px;
  background: var(--ok-soft);
  border: 1px solid var(--ok-line);
  color: var(--ok);
}

.done-sub { margin: 0 0 22px; font-size: 13.5px; color: var(--text-dim); }

/* ---------------------------------------------------------------- 푸터 */

.card-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid var(--card-line);
  font-size: 12px;
  color: var(--text-faint);
}

.link-btn {
  background: none;
  border: 0;
  padding: 0;
  font: inherit;
  color: var(--text-faint);
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
}
.link-btn:hover { color: var(--text-dim); }

@media (max-width: 420px) {
  .card { padding: 26px 20px 16px; }
  .profile { gap: 11px; }
  .avatar { width: 60px; height: 60px; }
  .nickname { font-size: 17px; }
}
