/* ════════════════════════════════
   퀴즈퀴즈 공통 스타일
════════════════════════════════ */
:root {
  --bg:        #0d0d1a;
  --surface:   #13132a;
  --surface2:  #1a1a35;
  --border:    #2a2a50;
  --primary:   #6c63ff;
  --primary-d: #5549e0;
  --primary-l: #9d97ff;
  --accent:    #43e97b;
  --warn:      #ff6584;
  --yellow:    #ffd166;
  --text:      #e8e8ff;
  --muted:     #7878aa;
  --radius:    14px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.6;
  font-size: 15px;
}

/* ── 공통 버튼 ── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  padding: 12px 22px;
  border: none; border-radius: 10px;
  font-family: inherit; font-size: 14px; font-weight: 700;
  cursor: pointer; transition: opacity .15s, transform .15s;
  text-decoration: none;
  white-space: nowrap;
}
.btn:hover:not(:disabled) { opacity: .88; transform: translateY(-1px); }
.btn:active:not(:disabled) { transform: scale(.97); }
.btn:disabled { opacity: .35; cursor: not-allowed; }
.btn-primary  { background: linear-gradient(135deg, var(--primary), var(--primary-l)); color: #fff; }
.btn-accent   { background: linear-gradient(135deg, var(--accent), #38d9a9); color: #0a1a10; }
.btn-danger   { background: linear-gradient(135deg, var(--warn), #ff9a8b); color: #fff; }
.btn-ghost    { background: transparent; border: 1.5px solid var(--border); color: var(--muted); }
.btn-ghost:hover:not(:disabled) { border-color: var(--primary-l); color: var(--text); opacity: 1; }
.btn-full     { width: 100%; }
.btn-sm       { padding: 8px 14px; font-size: 12px; }
.btn-lg       { padding: 15px 28px; font-size: 16px; }

/* ── 카드 ── */
.card {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px;
}

/* ── 인풋 ── */
.input-group { margin-bottom: 16px; }
.input-group label { display: block; font-size: 12px; font-weight: 700; color: var(--muted); margin-bottom: 6px; letter-spacing: .5px; }
.input-field {
  width: 100%;
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: 10px;
  padding: 12px 14px;
  color: var(--text);
  font-family: inherit; font-size: 14px;
  transition: border-color .15s;
  outline: none;
}
.input-field:focus { border-color: var(--primary); }
.input-field::placeholder { color: var(--muted); }

/* ── 배지 ── */
.badge {
  display: inline-block;
  font-size: 11px; font-weight: 700;
  padding: 2px 10px; border-radius: 99px;
}
.badge-primary { background: rgba(108,99,255,.2); color: var(--primary-l); }
.badge-accent  { background: rgba(67,233,123,.15); color: var(--accent); }
.badge-warn    { background: rgba(255,101,132,.15); color: var(--warn); }
.badge-yellow  { background: rgba(255,209,102,.15); color: var(--yellow); }

/* ── 헤더 ── */
.topbar {
  position: sticky; top: 0; z-index: 100;
  background: rgba(13,13,26,.92);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 14px;
  padding: 0 24px; height: 58px;
}
.topbar-logo {
  font-size: 18px; font-weight: 900;
  background: linear-gradient(135deg, var(--primary-l), var(--accent));
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
  background-clip: text;
  text-decoration: none;
  margin-right: auto;
}
.topbar-user { display: flex; align-items: center; gap: 10px; font-size: 13px; }
.topbar-avatar {
  width: 32px; height: 32px; border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--primary-l));
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 700; color: #fff;
  flex-shrink: 0;
}
.topbar-nick { font-weight: 700; }
.topbar-level { color: var(--primary-l); font-weight: 700; font-size: 12px; }

/* ── 페이지 래퍼 ── */
.page { max-width: 900px; margin: 0 auto; padding: 32px 20px 80px; }
.page-sm { max-width: 480px; margin: 0 auto; padding: 60px 20px; }
.page-center { display: flex; flex-direction: column; align-items: center; text-align: center; }

/* ── 섹션 타이틀 ── */
.section-title {
  font-size: 18px; font-weight: 900; margin-bottom: 16px;
  display: flex; align-items: center; gap: 8px;
}

/* ── 토스트 ── */
#toast-container {
  position: fixed; bottom: 28px; left: 50%;
  transform: translateX(-50%);
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  z-index: 9999; pointer-events: none;
}
.toast-msg {
  background: #fff; color: #111;
  padding: 10px 22px; border-radius: 99px;
  font-size: 13px; font-weight: 700;
  box-shadow: 0 6px 24px rgba(0,0,0,.4);
  animation: toastIn .25s ease forwards;
  white-space: nowrap;
}
.toast-msg.out { animation: toastOut .25s ease forwards; }
@keyframes toastIn  { from { opacity:0; transform:translateY(16px); } to { opacity:1; transform:translateY(0); } }
@keyframes toastOut { from { opacity:1; transform:translateY(0); } to { opacity:0; transform:translateY(-10px); } }

/* ── 로딩 스피너 ── */
.spinner {
  width: 40px; height: 40px; border-radius: 50%;
  border: 3px solid var(--border);
  border-top-color: var(--primary);
  animation: spin .7s linear infinite;
  margin: 40px auto;
}
@keyframes spin { to { transform: rotate(360deg); } }

.loading-overlay {
  position: fixed; inset: 0;
  background: rgba(13,13,26,.85);
  display: flex; align-items: center; justify-content: center;
  z-index: 9998;
}

/* ── 모달 ── */
.modal-bg {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.6);
  display: flex; align-items: center; justify-content: center;
  z-index: 500; padding: 20px;
}
.modal {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 28px;
  width: 100%; max-width: 460px;
  animation: modalIn .2s ease;
}
@keyframes modalIn { from { opacity:0; transform:scale(.95) translateY(10px); } to { opacity:1; transform:none; } }
.modal-title { font-size: 17px; font-weight: 900; margin-bottom: 20px; }
.modal-footer { display: flex; gap: 10px; margin-top: 20px; }

/* ── 구분선 ── */
.divider { border: none; border-top: 1px solid var(--border); margin: 20px 0; }

/* ── 텍스트 유틸 ── */
.text-muted   { color: var(--muted); }
.text-primary { color: var(--primary-l); }
.text-accent  { color: var(--accent); }
.text-warn    { color: var(--warn); }
.text-yellow  { color: var(--yellow); }
.fw-bold      { font-weight: 700; }
.fw-black     { font-weight: 900; }
.text-sm      { font-size: 12px; }
.text-lg      { font-size: 18px; }
.text-xl      { font-size: 24px; }
.mt-8  { margin-top: 8px; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }
.mb-8  { margin-bottom: 8px; }
.mb-16 { margin-bottom: 16px; }

/* ── 빈 상태 ── */
.empty-state { text-align: center; padding: 48px 20px; color: var(--muted); }
.empty-state .emo { font-size: 48px; margin-bottom: 12px; }
.empty-state p { font-size: 14px; }

/* ── 반응형 ── */
@media (max-width: 600px) {
  .page { padding: 20px 14px 70px; }
  .topbar { padding: 0 14px; }
  .hide-mobile { display: none !important; }
}
