:root {
  --bg: #0a0f1d;
  --panel-bg: rgba(19, 27, 49, 0.65);
  --panel-border: rgba(255, 255, 255, 0.08);
  --ink: #f0f4f9;
  --muted: #8e9bb0;
  --line: rgba(255, 255, 255, 0.08);
  --accent-blue: #00d2ff;
  --accent-purple: #bd00ff;
  --good: #00ff75;
  --bad: #ff2a5f;
  --focus: #ffb800;
  --glow-blue: rgba(0, 210, 255, 0.25);
  --glow-purple: rgba(189, 0, 255, 0.25);
  --glow-good: rgba(0, 255, 117, 0.25);
  --glow-bad: rgba(255, 42, 95, 0.25);
  --font-family: 'Outfit', 'Noto Sans KR', -apple-system, BlinkMacSystemFont, sans-serif;
}

* {
  box-sizing: border-box;
}

/* Custom Scrollbars */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}
::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.02);
}
::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.15);
  border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.3);
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background-color: var(--bg);
  background-image: 
    linear-gradient(rgba(255, 255, 255, 0.015) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.015) 1px, transparent 1px);
  background-size: 30px 30px;
  font-family: var(--font-family);
  overflow-x: hidden;
}

button, select, input, textarea {
  font-family: inherit;
  font-size: 16px; /* 기본 글자 크기를 크게 설정 */
}

button {
  border: 0;
  background: linear-gradient(135deg, var(--accent-blue), var(--accent-purple));
  color: #fff;
  padding: 16px 28px; /* 높이 고정 대신 여백으로 높이 유동 제어 */
  border-radius: 12px;
  font-weight: 800;
  cursor: pointer;
  box-shadow: 0 0 15px var(--glow-blue);
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  line-height: 1.2;
}

button:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 0 25px rgba(0, 210, 255, 0.5), 0 0 20px rgba(189, 0, 255, 0.3);
}

button:active:not(:disabled) {
  transform: translateY(0);
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.4;
  box-shadow: none;
}

.secondary {
  background: rgba(255, 255, 255, 0.04);
  color: var(--ink);
  border: 1px solid var(--panel-border);
  box-shadow: none;
}

.secondary:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.08);
  border-color: var(--accent-blue);
  box-shadow: 0 0 10px rgba(0, 210, 255, 0.15);
}

.warning-btn {
  border-color: rgba(255, 42, 95, 0.3);
}
.warning-btn:hover:not(:disabled) {
  border-color: var(--bad);
  box-shadow: 0 0 10px var(--glow-bad);
  color: var(--bad);
}

.primary-neon {
  background: var(--good);
  color: #000;
  box-shadow: 0 0 15px var(--glow-good);
}
.primary-neon:hover:not(:disabled) {
  box-shadow: 0 0 25px rgba(0, 255, 117, 0.6);
  background: #2aff95;
}

/* 1. 인트로 이름 입력 화면 */
.intro-screen {
  position: fixed;
  inset: 0;
  background: radial-gradient(circle at center, #0f172a 0%, #020617 100%);
  z-index: 2000;
  display: grid;
  place-items: center;
  padding: 20px;
  transition: opacity 0.6s ease-out, display 0.6s allow-discrete;
}

.intro-screen.fade-out {
  opacity: 0;
  display: none !important;
}

.intro-card {
  width: 100%;
  max-width: 440px;
  background: rgba(15, 23, 42, 0.75);
  border: 1px solid rgba(0, 210, 255, 0.15);
  border-radius: 20px;
  padding: 40px;
  text-align: center;
  backdrop-filter: blur(20px);
  box-shadow: 0 0 40px rgba(0, 210, 255, 0.1), inset 0 0 20px rgba(0, 210, 255, 0.05);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
}

.intro-logo {
  width: 64px;
  height: 64px;
  border-radius: 16px;
  background: linear-gradient(135deg, var(--accent-blue), var(--accent-purple));
  color: #fff;
  font-weight: 900;
  font-size: 28px;
  display: grid;
  place-items: center;
  box-shadow: 0 0 30px var(--glow-blue);
  text-shadow: 0 0 5px rgba(255, 255, 255, 0.4);
}

.matrix-title {
  font-size: 32px;
  font-weight: 900;
  margin: 0;
  background: linear-gradient(90deg, #fff, var(--accent-blue));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  text-shadow: 0 0 15px rgba(0, 210, 255, 0.2);
}

.matrix-subtitle {
  font-size: 14px;
  color: var(--muted);
  margin: 0;
  letter-spacing: 0.5px;
}

.input-group {
  width: 100%;
  position: relative;
}

#userNameInput {
  width: 100%;
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 10px;
  padding: 14px 18px;
  font-size: 16px;
  color: #fff;
  text-align: center;
  transition: all 0.3s ease;
}

#userNameInput:focus {
  outline: none;
  border-color: var(--accent-blue);
  background: rgba(0, 0, 0, 0.6);
  box-shadow: 0 0 20px rgba(0, 210, 255, 0.25);
}

.loading-orbit {
  position: relative;
  width: 76px;
  height: 76px;
  margin: 4px auto 0;
  border-radius: 50%;
  border: 1px solid rgba(125, 230, 255, 0.18);
}

.loading-orbit::before {
  content: "";
  position: absolute;
  inset: 12px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(0, 210, 255, 0.65), rgba(0, 210, 255, 0.08) 58%, transparent 60%);
  animation: loadingPulse 1.4s ease-in-out infinite;
}

.loading-orbit span {
  position: absolute;
  inset: -1px;
  border-radius: 50%;
  border-top: 2px solid rgba(0, 210, 255, 0.92);
  animation: loadingSpin 1.15s linear infinite;
}

.loading-orbit span:nth-child(2) {
  inset: 9px;
  border-top-color: rgba(184, 77, 255, 0.9);
  animation-duration: 1.65s;
  animation-direction: reverse;
}

.loading-orbit span:nth-child(3) {
  inset: 20px;
  border-top-color: rgba(255, 216, 74, 0.9);
  animation-duration: 0.95s;
}

.loading-copy {
  margin: 0;
  color: #cbd7e8;
  font-size: 15px;
  font-weight: 800;
}

@keyframes loadingSpin {
  to {
    transform: rotate(360deg);
  }
}

@keyframes loadingPulse {
  0%, 100% {
    transform: scale(0.82);
    opacity: 0.55;
  }
  50% {
    transform: scale(1);
    opacity: 1;
  }
}

/* 2. 워프 캔버스 */
.warp-canvas {
  position: fixed;
  inset: 0;
  z-index: 1500;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.4s ease;
}

.warp-canvas.active {
  opacity: 1;
}

/* 메인 애플리케이션 기본 레이아웃 (모바일 전용 고정) */
#app {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  background: #090d16;
  opacity: 1;
  transition: opacity 0.8s ease;
}

#app.app-hidden {
  opacity: 0;
  pointer-events: none;
}

/* 사이드바를 하단 네비게이션 바로 변경 */
.sidebar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  top: auto;
  width: 100% !important;
  padding: 10px 0 !important; /* 높이 고정 대신 상하 여백 사용 */
  background: rgba(11, 17, 32, 0.95) !important;
  backdrop-filter: blur(20px) !important;
  border-top: 1px solid rgba(255, 255, 255, 0.08) !important;
  border-right: none !important;
  border-bottom: none !important;
  z-index: 2000;
  box-shadow: 0 -8px 32px rgba(0, 0, 0, 0.5);
  display: flex !important;
  flex-direction: row !important;
  align-items: center;
  justify-content: center;
}

/* 불필요한 데스크톱 요소 숨김 */
.brand, .profile, .sidebar-footer, .leaderboard-panel {
  display: none !important;
}

.tabs {
  width: 100%;
  height: 100%;
  display: flex !important;
  flex-direction: row !important;
  justify-content: space-around;
  align-items: center;
  margin: 0 !important;
  padding: 0 8px !important;
  gap: 0 !important;
  background: transparent !important;
  border: none !important;
  box-shadow: none !important;
  position: static !important;
  backdrop-filter: none !important;
}

.tab {
  flex: 1;
  height: 100%;
  display: flex !important;
  flex-direction: column !important;
  align-items: center !important;
  justify-content: center !important;
  font-size: 13px !important; /* 11px에서 13px로 확대 */
  font-weight: 700 !important;
  color: #94a3b8 !important;
  background: transparent !important;
  border: none !important;
  gap: 4px !important;
  padding: 6px 0 !important;
  transition: color 0.2s ease;
  text-align: center;
}

.tab.active {
  color: #00d2ff !important;
  background: transparent !important;
  box-shadow: none !important;
  position: relative;
}

.tab.active::after {
  content: '';
  position: absolute;
  top: 4px;
  width: 16px;
  height: 3px;
  background: #00d2ff;
  border-radius: 2px;
  box-shadow: 0 0 10px #00d2ff;
}

.tab:hover {
  transform: none;
}

.profile, .filter, .mission-panel, .question-panel, .leaderboard-panel, .achievement-card {
  border: 1px solid var(--panel-border);
  background: var(--panel-bg);
  border-radius: 12px;
  backdrop-filter: blur(16px);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.25);
}

/* Profile Panel */
.profile {
  padding: 16px;
  border-left: 3px solid var(--focus);
}

.level-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-weight: 800;
}

.neon-text {
  color: var(--focus);
  text-shadow: 0 0 8px rgba(255, 184, 0, 0.4);
}

.player-name-glow {
  color: var(--accent-blue);
  text-shadow: 0 0 8px rgba(0, 210, 255, 0.4);
}

.meter {
  height: 10px;
  background: rgba(255, 255, 255, 0.05);
  overflow: hidden;
  border-radius: 999px;
  margin: 12px 0;
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.meter span {
  display: block;
  width: 0;
  height: 100%;
  background: linear-gradient(90deg, var(--focus), #ff8a00);
  border-radius: 999px;
  box-shadow: 0 0 8px rgba(255, 184, 0, 0.5);
  transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* 게이지 레이저 빔 애니메이션 */
.xp-glow, .hp-bar-inner, .shield-bar-inner {
  position: relative;
  overflow: hidden;
}

.xp-glow::after, .hp-bar-inner::after, .shield-bar-inner::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.4), transparent);
  transform: translateX(-100%);
  animation: barShine 3s infinite;
}

@keyframes barShine {
  0% { transform: translateX(-100%); }
  50%, 100% { transform: translateX(100%); }
}

.profile-stats {
  display: grid;
  gap: 8px;
  margin: 0;
}

.profile-stats div {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
}

dt { color: var(--muted); }
dd { margin: 0; font-weight: 700; color: var(--ink); }

/* Virtual Leaderboard Panel */
.leaderboard-panel {
  padding: 16px;
  border-left: 3px solid var(--accent-purple);
}

.leaderboard-panel h3 {
  margin: 0 0 12px;
  font-size: 14px;
  color: var(--accent-purple);
  text-shadow: 0 0 8px rgba(189, 0, 255, 0.3);
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 6px;
}

.rival-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 8px;
}

.rival-item {
  display: grid;
  grid-template-columns: 24px 1fr auto;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  padding: 6px 8px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid transparent;
  transition: all 0.3s ease;
}

.rival-item.user {
  background: rgba(0, 210, 255, 0.08);
  border-color: rgba(0, 210, 255, 0.2);
  font-weight: 700;
}

.rival-rank {
  font-weight: 800;
  text-align: center;
  color: var(--muted);
}

.rival-item:nth-child(1) .rival-rank { color: #ffb800; text-shadow: 0 0 5px rgba(255, 184, 0, 0.5); }
.rival-item:nth-child(2) .rival-rank { color: #cccccc; }
.rival-item:nth-child(3) .rival-rank { color: #cd7f32; }

.rival-name {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.rival-xp {
  font-weight: 700;
  color: var(--muted);
  font-size: 12px;
}

.rival-item.user .rival-xp {
  color: var(--accent-blue);
}

.filter {
  display: flex;
  gap: 16px;
  align-items: center;
  background: rgba(15, 23, 42, 0.4);
  border: 1px solid var(--panel-border);
  border-radius: 12px;
  padding: 10px 16px;
  margin-bottom: 20px;
}

.filter-group {
  display: flex;
  align-items: center;
  gap: 8px;
}

.filter label {
  font-size: 13px;
  color: var(--muted);
  font-weight: 700;
  white-space: nowrap;
}

.filter select {
  min-width: 150px;
  max-width: 250px;
}

select, input, textarea {
  width: 100%;
  border: 1px solid var(--panel-border);
  border-radius: 10px;
  background: rgba(10, 15, 29, 0.8);
  color: var(--ink);
  padding: 12px 16px; /* 높이 고정 대신 여백으로 유동 제어 */
  transition: all 0.2s ease;
  line-height: 1.2;
}

select:focus, input:focus, textarea:focus {
  outline: none;
  border-color: var(--accent-blue);
  box-shadow: 0 0 10px rgba(0, 210, 255, 0.3);
}

/* Sidebar Footer */
.sidebar-footer {
  margin-top: auto;
  padding-top: 10px;
  border-top: 1px solid var(--line);
}

.mute-btn {
  width: 100%;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--panel-border);
  color: var(--muted);
  box-shadow: none;
  min-height: 38px;
}
.mute-btn:hover {
  background: rgba(255, 255, 255, 0.08);
  color: var(--ink);
  box-shadow: none;
}
.mute-btn.muted {
  border-color: rgba(255, 42, 95, 0.2);
  color: var(--bad);
}

/* Main Area (모바일 전용 최적화) */
main {
  flex: 1;
  padding: 20px 16px 100px 16px;
  display: flex;
  flex-direction: column;
  gap: 20px;
  width: 100%;
  max-width: 600px;
  margin: 0 auto;
  box-sizing: border-box;
  overflow-y: auto;
}

.topline {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 0;
  width: 100%;
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--accent-purple);
  font-size: 13px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 1px;
  text-shadow: 0 0 8px rgba(189, 0, 255, 0.2);
}

h1 {
  margin: 0;
  font-size: 32px; /* 26px에서 32px로 확대 */
  font-weight: 800;
  letter-spacing: -0.5px;
}

.actions {
  display: flex;
  gap: 8px;
  width: 100%;
}

.actions button {
  flex: 1;
  padding: 12px !important;
  font-size: 15px !important; /* 13px에서 15px로 확대 */
  justify-content: center;
  height: 48px !important;
}

/* Workspace Views */
.workspace {
  display: none;
}

.workspace.active-view {
  display: flex !important;
  flex-direction: column;
  flex: 1;
  width: 100%;
}

.quiz-container {
  display: flex;
  flex-direction: column;
  gap: 16px;
  width: 100%;
}

/* Boss HUD */
.boss-hud {
  border: 1px solid rgba(255, 42, 95, 0.3);
  background: linear-gradient(135deg, rgba(255, 42, 95, 0.12), rgba(189, 0, 255, 0.08));
  border-radius: 12px;
  padding: 16px;
  display: grid;
  gap: 14px;
  box-shadow: 0 0 20px rgba(255, 42, 95, 0.15);
  animation: pulseGlow 2s infinite alternate;
}

.boss-hud.hidden {
  display: none !important;
}

@keyframes pulseGlow {
  from { box-shadow: 0 0 15px rgba(255, 42, 95, 0.1); }
  to { box-shadow: 0 0 25px rgba(255, 42, 95, 0.25); }
}

.boss-info {
  display: flex;
  align-items: center;
  gap: 16px;
}

.boss-avatar-wrapper {
  width: 50px;
  height: 50px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.3);
  border: 2px solid var(--bad);
  display: grid;
  place-items: center;
  font-size: 28px;
  box-shadow: 0 0 12px var(--glow-bad);
}

.boss-details {
  flex: 1;
  display: grid;
  gap: 6px;
}

.boss-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
}

.boss-title {
  font-size: 11px;
  color: var(--bad);
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

#bossName {
  font-size: 18px;
  font-weight: 900;
}

.boss-hp-container {
  display: flex;
  align-items: center;
  gap: 12px;
}

.hp-bar-outer {
  flex: 1;
  height: 12px;
  background: rgba(0, 0, 0, 0.4);
  border-radius: 6px;
  overflow: hidden;
  border: 1px solid rgba(255, 42, 95, 0.2);
}

.hp-bar-inner {
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, var(--bad), #ff7300);
  border-radius: 6px;
  box-shadow: 0 0 8px var(--glow-bad);
  transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.hp-label {
  font-size: 12px;
  font-weight: 800;
  color: var(--bad);
  min-width: 75px;
  text-align: right;
}

.player-shield-info {
  border-top: 1px solid rgba(255, 255, 255, 0.05);
  padding-top: 10px;
  display: grid;
  gap: 6px;
}

.shield-header {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: var(--accent-blue);
  font-weight: 700;
}

.shield-bar-outer {
  height: 8px;
  background: rgba(0, 0, 0, 0.4);
  border-radius: 999px;
  overflow: hidden;
  border: 1px solid rgba(0, 210, 255, 0.2);
}

.shield-bar-inner {
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, var(--accent-blue), #00ffca);
  border-radius: 999px;
  box-shadow: 0 0 6px var(--glow-blue);
  transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Mode Toggle Container */
.mode-toggle-container {
  display: flex;
  align-items: center;
  gap: 12px;
  background: rgba(255, 255, 255, 0.02);
  padding: 8px 16px;
  border-radius: 10px;
  border: 1px solid var(--panel-border);
  width: fit-content;
}

.mode-toggle-container span {
  font-size: 13px;
  color: var(--muted);
  font-weight: 700;
}

.mode-btn {
  min-height: 30px;
  padding: 0 12px;
  font-size: 13px;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  border: 1px solid transparent;
  box-shadow: none;
}

.mode-btn:hover {
  color: var(--ink);
  background: rgba(255, 255, 255, 0.04);
}

.mode-btn.active {
  background: rgba(0, 210, 255, 0.1);
  border-color: var(--accent-blue);
  color: var(--accent-blue);
  font-weight: 700;
  box-shadow: 0 0 10px rgba(0, 210, 255, 0.15);
}

.mode-btn.boss-btn.active {
  background: rgba(255, 42, 95, 0.12);
  border-color: var(--bad);
  color: var(--bad);
  box-shadow: 0 0 10px rgba(255, 42, 95, 0.2);
}

/* Question Panel */
.question-panel {
  padding: 24px;
  min-height: auto;
  display: flex;
  flex-direction: column;
  border-top: 4px solid var(--accent-blue);
  border-left: none;
  border-radius: 16px;
  background: rgba(15, 22, 42, 0.5);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
  transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

/* 화면 흔들림(피격 효과) 애니메이션 */
.shake {
  animation: shakePanel 0.4s ease-in-out;
}

@keyframes shakePanel {
  0%, 100% { transform: translateX(0); }
  15%, 45%, 75% { transform: translateX(-8px); }
  30%, 60%, 90% { transform: translateX(8px); }
}

.question-panel.correct-flash {
  border-color: var(--good) !important;
  box-shadow: 0 0 30px var(--glow-good);
}

.question-panel.wrong-flash {
  border-color: var(--bad) !important;
  box-shadow: 0 0 30px var(--glow-bad);
}

.question-meta {
  display: flex;
  justify-content: flex-start;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 20px;
}

.question-meta span {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--panel-border);
  border-radius: 999px;
  padding: 4px 12px;
  font-size: 11px;
  font-weight: 700;
  color: var(--muted);
}

.question-meta .difficulty {
  color: #ffca28;
  border-color: rgba(255, 202, 40, 0.2);
  background: rgba(255, 202, 40, 0.05);
}

/* Combo Flame Badge */
.combo-badge {
  background: linear-gradient(135deg, #ff4e00, #ec9f05) !important;
  border: none !important;
  color: #fff !important;
  font-weight: 900 !important;
  font-size: 12px !important;
  box-shadow: 0 0 15px rgba(255, 78, 0, 0.6);
  animation: fireWave 0.5s ease-in-out infinite alternate;
}

.combo-badge.hidden {
  display: none !important;
}

@keyframes fireWave {
  from { transform: scale(1); box-shadow: 0 0 10px rgba(255, 78, 0, 0.5); }
  to { transform: scale(1.08); box-shadow: 0 0 20px rgba(255, 78, 0, 0.8); }
}

#questionText {
  font-size: 26px; /* 22px에서 26px로 확대 */
  line-height: 1.5;
  margin-bottom: 24px;
  font-weight: 700;
  white-space: pre-line; /* 줄바꿈 및 공백 보존 */
  color: #f8fafc;
}

/* Bogi Box (보기 박스) */
.bogi-box {
  border: 1px solid var(--panel-border);
  background: rgba(255, 255, 255, 0.02);
  border-left: 4px solid var(--accent-blue);
  border-radius: 8px;
  padding: 18px 22px;
  margin: 16px 0;
  text-align: left;
  box-shadow: inset 0 0 15px rgba(255, 255, 255, 0.01);
}

.bogi-box.hidden {
  display: none !important;
}

.bogi-title {
  font-family: "Outfit", "Noto Sans KR", sans-serif;
  font-size: 13px;
  font-weight: 800;
  color: var(--accent-blue);
  text-transform: uppercase;
  letter-spacing: 1.5px;
  margin-bottom: 10px;
}

.bogi-content {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.bogi-line {
  font-size: clamp(14px, 1.5vw, 16px);
  font-weight: 400; /* Regular weight for readability */
  color: var(--text-light);
  line-height: 1.6;
}

/* 교과서 실제 그림/도표 캡쳐 영역 스타일 */
.question-image-area {
  margin: 0 auto 24px;
  max-width: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--panel-border);
  border-radius: 10px;
  padding: 12px;
  overflow: hidden;
  box-shadow: inset 0 0 15px rgba(0, 0, 0, 0.2);
}

.question-image-area img {
  width: 100%;
  height: auto;
  max-width: 480px;
  max-height: 260px;
  object-fit: contain;
  border-radius: 6px;
  /* 가독성 증폭 필터 */
  filter: brightness(0.95) contrast(1.08);
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.question-image-area.hidden {
  display: none !important;
}

.choices {
  display: grid;
  gap: 12px;
  margin-top: auto;
}

.choice {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  text-align: left;
  color: #e2e8f0;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  padding: 18px 22px; /* 높이 고정 제거, 상하좌우 충분한 여백 확보 */
  box-shadow: none;
  transition: all 0.2s ease;
  font-size: 20px;
  line-height: 1.4;
}

.choice:hover:not(:disabled) {
  border-color: rgba(0, 210, 255, 0.3);
  color: #fff;
  background: rgba(0, 210, 255, 0.05);
  box-shadow: none;
}

.choice.selected {
  background: rgba(0, 210, 255, 0.12);
  border-color: #00d2ff;
  color: #ffffff;
  font-weight: 700;
  box-shadow: 0 0 15px rgba(0, 210, 255, 0.2);
}

.choice.correct {
  border-color: var(--good);
  background: rgba(0, 255, 117, 0.08);
  color: var(--good);
  font-weight: 700;
  box-shadow: 0 0 15px var(--glow-good);
}

.choice.wrong {
  border-color: var(--bad);
  background: rgba(255, 42, 95, 0.08);
  color: var(--bad);
  font-weight: 700;
  box-shadow: 0 0 15px var(--glow-bad);
}

/* Inputs for text answers */
input#textAnswer, textarea#textAnswer {
  background: rgba(0, 0, 0, 0.2);
  border: 1px solid var(--panel-border);
  color: var(--ink);
  border-radius: 8px;
  padding: 12px 16px;
  font-size: 16px;
  margin-bottom: 20px;
}

input#textAnswer:focus, textarea#textAnswer:focus {
  border-color: var(--accent-blue);
  box-shadow: 0 0 15px var(--glow-blue);
}

.feedback {
  margin-top: 20px;
  border-left: 4px solid var(--accent-blue);
  padding: 16px;
  background: rgba(0, 210, 255, 0.04);
  border-radius: 0 8px 8px 0;
  line-height: 1.6;
}

.feedback strong {
  display: block;
  font-size: 16px;
  margin-bottom: 6px;
}

.feedback.wrong {
  border-left-color: var(--bad);
  background: rgba(255, 42, 95, 0.04);
}

.question-actions {
  display: flex;
  gap: 12px;
  margin-top: 24px;
}

/* Mission Panel */
.mission-panel {
  padding: 20px;
  display: grid;
  gap: 16px;
}

.mission-panel h2 {
  font-size: 16px;
  margin: 0;
  font-weight: 800;
  border-bottom: 1px solid var(--line);
  padding-bottom: 10px;
}

#missionList {
  padding: 0;
  margin: 0;
  list-style: none;
  display: grid;
  gap: 10px;
}

#missionList li {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: rgba(255, 255, 255, 0.02);
  padding: 10px 14px;
  border-radius: 8px;
  border: 1px solid var(--panel-border);
  font-size: 13px;
}

#missionList li strong {
  color: var(--focus);
}

.boss {
  margin-top: 10px;
  display: grid;
  gap: 4px;
  border: 1px solid rgba(255, 184, 0, 0.2);
  background: rgba(255, 184, 0, 0.05);
  border-radius: 8px;
  padding: 14px;
  box-shadow: inset 0 0 10px rgba(255, 184, 0, 0.05);
}

.boss span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.boss strong {
  font-size: 20px;
  color: var(--focus);
  text-shadow: 0 0 5px rgba(255, 184, 0, 0.3);
}

/* Lists and Review View */
.review-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}

.review-head h2 {
  margin: 0;
  font-size: 20px;
}

.badge-neon {
  background: rgba(0, 210, 255, 0.1);
  color: var(--accent-blue);
  padding: 4px 12px;
  border-radius: 999px;
  font-weight: 700;
  font-size: 13px;
  border: 1px solid rgba(0, 210, 255, 0.2);
}

.list {
  display: grid;
  gap: 12px;
}

.item {
  border: 1px solid var(--panel-border);
  background: rgba(255, 255, 255, 0.02);
  border-radius: 10px;
  padding: 18px;
}

.item small {
  color: var(--accent-purple);
  font-weight: 700;
  font-size: 12px;
  text-transform: uppercase;
}

.item p {
  margin: 10px 0 0;
  line-height: 1.5;
}

/* Achievements View */
.achievements-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 16px;
}

.achievement-card {
  padding: 20px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  position: relative;
  overflow: hidden;
  transition: all 0.3s ease;
}

.achievement-card.locked {
  opacity: 0.4;
  filter: grayscale(0.8);
  border-color: rgba(255, 255, 255, 0.04);
}

.achievement-card.unlocked {
  border-color: var(--accent-blue);
  box-shadow: 0 0 15px rgba(0, 210, 255, 0.1);
  background: linear-gradient(180deg, rgba(0, 210, 255, 0.03), rgba(19, 27, 49, 0.65));
}

.achievement-card.unlocked::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 2px;
  background: linear-gradient(90deg, var(--accent-blue), var(--accent-purple));
}

.achievement-icon {
  font-size: 44px;
  filter: drop-shadow(0 0 8px rgba(255, 255, 255, 0.1));
  transition: transform 0.3s ease;
}

.achievement-card.unlocked:hover .achievement-icon {
  transform: scale(1.15) rotate(5deg);
}

.achievement-card.unlocked .achievement-icon {
  filter: drop-shadow(0 0 10px rgba(0, 210, 255, 0.4));
}

.achievement-card h4 {
  margin: 0;
  font-size: 16px;
  font-weight: 800;
}

.achievement-card p {
  margin: 0;
  font-size: 12px;
  color: var(--muted);
  line-height: 1.4;
}

.achievement-status {
  font-size: 11px;
  font-weight: 800;
  padding: 2px 8px;
  border-radius: 4px;
}

.locked .achievement-status {
  background: rgba(255, 255, 255, 0.05);
  color: var(--muted);
}

.unlocked .achievement-status {
  background: rgba(0, 255, 117, 0.1);
  color: var(--good);
}

/* Floating Rewards & CSS Particle System */
#rewardLayer {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 1000;
}

.atom-chip {
  position: absolute;
  left: var(--x);
  top: var(--y);
  transform: translate(-50%, -50%);
  color: #000;
  background: linear-gradient(135deg, var(--good), #2aff95);
  border-radius: 999px;
  padding: 8px 16px;
  font-weight: 900;
  box-shadow: 0 0 20px rgba(0, 255, 117, 0.4);
  font-family: var(--font-family);
  font-size: 18px;
  white-space: nowrap;
  animation: chipAnim 1.2s cubic-bezier(0.25, 1, 0.50, 1) forwards;
}

.atom-chip.wrong-chip {
  background: linear-gradient(135deg, var(--bad), #ff7093);
  color: #fff;
  box-shadow: 0 0 20px rgba(255, 42, 95, 0.4);
  animation: chipAnim 1.2s cubic-bezier(0.25, 1, 0.50, 1) forwards;
}

@keyframes chipAnim {
  from { opacity: 0; transform: translate(-50%, 0) scale(0.7); }
  15% { opacity: 1; transform: translate(-50%, -40px) scale(1.05); }
  30% { transform: translate(-50%, -50px) scale(1); }
  to { opacity: 0; transform: translate(-50%, -120px) scale(0.9); }
}

/* === 콤보 피드백 시스템 === */

/* 상시 콤보 카운터 — 우상단 고정 */
.combo-float {
  position: fixed;
  top: 12px;
  right: 16px;
  z-index: 500;
  padding: 6px 14px;
  border-radius: 999px;
  font-size: 15px;
  font-weight: 800;
  letter-spacing: 0.3px;
  color: #ff9500;
  background: rgba(255, 150, 0, 0.1);
  border: 1px solid rgba(255, 150, 0, 0.25);
  opacity: 0;
  transform: translateY(-8px);
  transition: opacity 0.3s, transform 0.3s, color 0.3s, border-color 0.3s, background 0.3s;
  pointer-events: none;
}

.combo-float.visible {
  opacity: 1;
  transform: translateY(0);
}

.combo-float.hot {
  color: #ff5500;
  background: rgba(255, 85, 0, 0.12);
  border-color: rgba(255, 85, 0, 0.35);
}

.combo-float.fire {
  color: #ff2a2a;
  background: rgba(255, 42, 42, 0.15);
  border-color: rgba(255, 42, 42, 0.4);
  box-shadow: 0 0 16px rgba(255, 42, 42, 0.25);
}

/* 콤보 이정표 / 끊김 스플래시 */
.combo-splash {
  position: fixed;
  top: 40%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0.7);
  z-index: 9999;
  font-size: 28px;
  font-weight: 900;
  color: #fff;
  text-shadow: 0 2px 24px rgba(255, 150, 0, 0.6);
  opacity: 0;
  pointer-events: none;
  white-space: nowrap;
  transition: opacity 0.15s ease-out, transform 0.15s ease-out;
}

.combo-splash.show {
  opacity: 1;
  transform: translate(-50%, -50%) scale(1);
}

.combo-splash.fade {
  opacity: 0;
  transform: translate(-50%, -55%) scale(1.05);
  transition: opacity 0.4s ease-in, transform 0.4s ease-in;
}

.combo-splash.break {
  font-size: 18px;
  color: rgba(255, 255, 255, 0.5);
  text-shadow: none;
}

/* 클릭 시 방출되는 미세 네온 파티클 */
.glowing-particle {
  position: absolute;
  width: var(--particle-size, 8px);
  height: var(--particle-size, 8px);
  border-radius: 50%;
  pointer-events: none;
  background: var(--particle-color, var(--good));
  box-shadow: 0 0 8px var(--particle-color, var(--good));
  transform: translate(-50%, -50%);
  animation: particleFly var(--particle-duration, 0.8s) cubic-bezier(0.1, 0.8, 0.3, 1) forwards;
}

@keyframes particleFly {
  to {
    transform: translate(calc(-50% + var(--dx)), calc(-50% + var(--dy))) scale(0);
    opacity: 0;
  }
}

/* Level Up Modal Dialog */
.levelup-modal {
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(10, 15, 29, 0.95);
  border-radius: 20px;
  padding: 40px;
  width: 450px;
  max-width: 90vw;
  box-shadow: 0 0 40px rgba(0, 210, 255, 0.3), 0 0 30px rgba(189, 0, 255, 0.2);
  color: var(--ink);
  text-align: center;
  overflow: hidden;
  backdrop-filter: blur(20px);
  
  /* Modal centering */
  position: fixed;
  top: 50%;
  left: 50%;
  margin: 0;
  
  /* Modern CSS Entry/Exit Transitions */
  opacity: 0;
  transform: translate(-50%, -60%) scale(0.9);
  transition: 
    opacity 0.35s ease-out,
    transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1),
    display 0.35s allow-discrete,
    overlay 0.35s allow-discrete;
}

.levelup-modal[open] {
  opacity: 1;
  transform: translate(-50%, -50%) scale(1);
  
  @starting-style {
    opacity: 0;
    transform: translate(-50%, -60%) scale(0.9);
  }
}

.levelup-modal::backdrop {
  background-color: rgba(0, 0, 0, 0);
  transition: 
    background-color 0.35s ease-out,
    display 0.35s allow-discrete,
    overlay 0.35s allow-discrete;
}

.levelup-modal[open]::backdrop {
  background-color: rgba(3, 6, 12, 0.85);
  backdrop-filter: blur(5px);
  
  @starting-style {
    background-color: rgba(0, 0, 0, 0);
  }
}

.levelup-content {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
}

.confetti-canvas {
  position: absolute;
  inset: -40px;
  width: calc(100% + 80px);
  height: calc(100% + 80px);
  pointer-events: none;
  z-index: 1;
}

.sparkles {
  font-size: 24px;
  animation: spin 6s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.levelup-modal h2 {
  font-size: 32px;
  font-weight: 900;
  margin: 0;
  background: linear-gradient(90deg, var(--focus), #ff4e00);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  text-shadow: 0 0 15px rgba(255, 184, 0, 0.3);
}

.levelup-subtitle {
  color: var(--muted);
  font-size: 15px;
  margin: 0;
}

.level-badge-large {
  width: 100px;
  height: 100px;
  border-radius: 24px;
  background: linear-gradient(135deg, var(--accent-blue), var(--accent-purple));
  display: grid;
  place-items: center;
  font-size: 32px;
  font-weight: 900;
  box-shadow: 0 0 25px rgba(0, 210, 255, 0.4);
  border: 2px solid rgba(255, 255, 255, 0.2);
  margin: 10px 0;
  animation: float 3s ease-in-out infinite;
}

@keyframes float {
  0%, 100% { transform: translateY(0) rotate(0deg); }
  50% { transform: translateY(-10px) rotate(3deg); }
}

.levelup-reward {
  font-size: 14px;
  line-height: 1.5;
  color: var(--ink);
}

/* Realtime Toast Notifications */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  display: grid;
  gap: 10px;
  z-index: 1010;
  pointer-events: none;
}

.toast {
  pointer-events: none;
  width: 320px;
  background: rgba(10, 15, 29, 0.95);
  border: 1px solid var(--accent-blue);
  border-left: 5px solid var(--accent-blue);
  border-radius: 8px;
  padding: 14px 16px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
  display: flex;
  align-items: center;
  gap: 14px;
  backdrop-filter: blur(10px);
  
  /* Entry/Exit transition */
  opacity: 0;
  transform: translateX(120%);
  transition: 
    opacity 0.3s ease,
    transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275),
    display 0.3s allow-discrete,
    overlay 0.3s allow-discrete;
}

.toast.show {
  opacity: 1;
  transform: translateX(0);
  
  @starting-style {
    opacity: 0;
    transform: translateX(120%);
  }
}

.toast-icon {
  font-size: 30px;
  filter: drop-shadow(0 0 5px rgba(0, 210, 255, 0.3));
}

.toast-content {
  flex: 1;
}

.toast-title {
  margin: 0 0 2px;
  font-size: 14px;
  font-weight: 800;
  color: var(--accent-blue);
}

.toast-desc {
  margin: 0;
  font-size: 12px;
  color: var(--muted);
}

/* === 실수로 삭제된 스타일 복원 === */

/* 불필요 패널 숨김 */
.profile,
.leaderboard-panel,
.mission-panel {
  display: none !important;
}

/* 필터 모바일 최적화 */
.filter {
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  gap: 12px;
  padding: 12px;
  background: rgba(15, 22, 42, 0.6);
  border-radius: 12px;
  width: 100%;
  box-sizing: border-box;
}

.filter-group {
  flex: 1;
  min-width: 120px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
}

.filter label {
  font-size: 12px;
  color: #64748b;
}

.filter select {
  width: 100%;
  min-width: auto;
  max-width: none;
}

/* 오디오 재생 버튼 */
.audio-play-btn {
  background: rgba(0, 210, 255, 0.1);
  border: 1px solid var(--accent-blue);
  color: var(--accent-blue);
  border-radius: 6px;
  padding: 4px 12px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  margin-left: 8px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  vertical-align: middle;
  transition: all 0.2s ease;
  font-family: "Outfit", "Noto Sans KR", sans-serif;
}

.audio-play-btn:hover {
  background: var(--accent-blue);
  color: #0d1117;
  box-shadow: 0 0 12px var(--glow-blue);
  transform: translateY(-1px);
}

.audio-play-btn:active {
  transform: translateY(0);
}

/* 힌트 패널 */
.hint-panel {
  margin: 14px 0 0;
  padding: 14px 16px;
  border: 1px solid rgba(255, 184, 0, 0.35);
  border-radius: 8px;
  background: rgba(255, 184, 0, 0.08);
  color: var(--ink);
}

.hint-panel strong {
  display: block;
  color: #ffca3a;
  font-size: 13px;
  margin-bottom: 6px;
}

.hint-panel p {
  margin: 0;
  color: #dce6f6;
  font-size: 14px;
  line-height: 1.55;
}

/* 음성/텍스트 힌트 버튼 */
.voice-hint-btn,
.text-hint-btn {
  background: rgba(255, 184, 0, 0.08);
  border: 1px solid #ffb800;
  color: #ffb800;
  border-radius: 999px;
  padding: 4px 12px;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  transition: all 0.2s ease;
  font-family: "Outfit", "Noto Sans KR", sans-serif;
  vertical-align: middle;
  margin-left: 8px;
}

.text-hint-btn {
  background: rgba(0, 210, 255, 0.08);
  border-color: var(--accent-blue);
  color: var(--accent-blue);
}

.voice-hint-btn:hover:not(:disabled) {
  background: #ffb800;
  color: #0d1117;
  box-shadow: 0 0 12px rgba(255, 184, 0, 0.5);
  transform: translateY(-1px);
}

.text-hint-btn:hover:not(:disabled) {
  background: var(--accent-blue);
  color: #0d1117;
  box-shadow: 0 0 12px var(--glow-blue);
  transform: translateY(-1px);
}

.voice-hint-btn:active,
.text-hint-btn:active {
  transform: translateY(0);
}

/* 질문 하단 액션 버튼 영역 */
.question-actions {
  display: flex;
  gap: 10px;
  margin-top: 24px;
  width: 100%;
}

.question-actions button {
  flex: 1;
}

#prevBtn {
  flex: 0.8;
}

/* 질문 이미지 모바일 최적화 */
.question-image-area img {
  max-height: 200px;
}

/* 보기 박스 */
.bogi-box {
  padding: 12px 14px;
  margin: 12px 0;
}

.bogi-line {
  font-size: 15px;
}

/* 답변 영역 */
#answerArea {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 20px;
}

/* ═══════════════════════════════════════════════════════
   모바일 앱형 전체 화면 퀴즈 레이아웃
   390×844 기준, 문제+선택지가 주인공
   ═══════════════════════════════════════════════════════ */
@media (max-width: 640px) {

  /* ── 기본 리셋 ── */
  html, body {
    width: 100%;
    min-height: 100dvh;
    overflow-x: hidden;
  }

  /* ── 앱 컨테이너 ── */
  #app {
    display: flex;
    flex-direction: column;
    min-height: 100dvh;
    background: var(--bg);
  }

  /* ── 상단 영역: 큰 제목/필터/모드토글/보스HUD 숨김 ── */
  .filter,
  .mode-toggle-container,
  .boss-hud,
  .brand,
  .profile,
  .sidebar-footer,
  .leaderboard-panel,
  .mission-panel {
    display: none !important;
  }

  /* ── 하단 탭 바: 퀴즈 중 숨김 ── */
  .sidebar {
    display: none !important;
  }

  /* ── main 컨테이너 ── */
  main {
    flex: 1;
    display: flex;
    flex-direction: column;
    width: 100%;
    max-width: 100%;
    margin: 0;
    padding: env(safe-area-inset-top, 12px) 16px env(safe-area-inset-bottom, 12px);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }

  /* ── 워크스페이스 ── */
  .workspace {
    display: none;
  }

  .workspace.active-view {
    display: flex !important;
    flex-direction: column;
    flex: 1;
    width: 100%;
  }

  /* ── 퀴즈 컨테이너 ── */
  .quiz-container {
    display: flex;
    flex-direction: column;
    flex: 1;
    width: 100%;
    gap: 0;
  }

  /* ── 문제 패널: 중첩 카드 느낌 제거, 면적 극대화 ── */
  .question-panel {
    flex: 1;
    display: flex;
    flex-direction: column;
    width: 100%;
    max-width: none;
    margin: 0;
    padding: 16px 0 0;
    background: transparent;
    border: none;
    border-radius: 0;
    box-shadow: none;
    border-top: none;
    border-left: none;
  }

  /* ── 문제 메타 (배지 + 힌트 버튼) ── */
  .question-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 16px;
    align-items: center;
  }

  .question-meta span {
    font-size: 11px;
    padding: 3px 8px;
  }

  /* 힌트 버튼을 메타 줄에 인라인 배치 */
  .question-meta .voice-hint-btn,
  .question-meta .text-hint-btn {
    margin-left: 0;
    font-size: 12px;
    padding: 5px 12px;
  }

  /* ── 문제 텍스트: 주인공 ── */
  #questionText {
    font-size: 26px;
    line-height: 1.35;
    font-weight: 700;
    color: #f8fafc;
    margin-bottom: 20px;
    white-space: pre-line;
    word-break: keep-all;
  }

  /* ── 이미지 영역 ── */
  .question-image-area {
    margin-bottom: 16px;
    padding: 0;
    max-height: 32dvh;
    overflow: hidden;
    border-radius: 12px;
  }

  .question-image-area img {
    width: 100%;
    max-height: 32dvh;
    object-fit: contain;
  }

  .question-image-area.hidden {
    display: none !important;
    height: 0;
    margin: 0;
    padding: 0;
  }

  /* ── 보기 박스 ── */
  .bogi-box {
    padding: 12px 14px;
    margin: 0 0 16px;
    font-size: 15px;
    border-radius: 10px;
  }

  /* ── 선택지 영역 ── */
  #answerArea {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 16px;
  }

  /* ── 선택지 카드: 큰 터치 타겟 ── */
  .choice {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    text-align: left;
    font-size: 20px;
    line-height: 1.4;
    min-height: 64px;
    padding: 16px 20px;
    border-radius: 12px;
    color: #e2e8f0;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: none;
    transition: all 0.15s ease;
  }

  .choice:hover:not(:disabled) {
    background: rgba(0, 210, 255, 0.06);
    border-color: rgba(0, 210, 255, 0.3);
    transform: none;
  }

  .choice.selected {
    background: rgba(0, 210, 255, 0.12);
    border-color: #00d2ff;
    color: #fff;
    font-weight: 700;
    box-shadow: 0 0 12px rgba(0, 210, 255, 0.2);
  }

  /* ── 힌트 패널 ── */
  .hint-panel {
    margin: 0 0 16px;
    padding: 14px 16px;
    font-size: 14px;
    border-radius: 10px;
  }

  /* ── 피드백 ── */
  .feedback {
    margin-bottom: 16px;
    font-size: 15px;
    padding: 14px 16px;
  }

  /* ── 하단 액션 버튼: 인라인 배치, 선택지와 겹치지 않음 ── */
  .question-actions {
    display: flex;
    gap: 10px;
    width: 100%;
    margin-top: auto;
    padding: 16px 0 8px;
  }

  .question-actions button {
    flex: 1;
    padding: 16px 12px;
    font-size: 15px;
    font-weight: 800;
    border-radius: 12px;
    line-height: 1.2;
  }

  #prevBtn {
    flex: 0.7;
  }

  /* ── 단답/서술형 입력 ── */
  #answerArea input,
  #answerArea textarea {
    font-size: 18px;
    padding: 14px 16px;
    border-radius: 10px;
    line-height: 1.4;
  }

  /* ── 콤보 배지 ── */
  .combo-badge {
    font-size: 12px;
    padding: 4px 10px;
  }

  .combo-badge.hidden {
    display: none !important;
  }

  /* ── 오답복습/전체문제/업적 뷰 (퀴즈 외 탭) ── */
  #reviewView,
  #bankView,
  #achievementsView {
    padding: 16px 0;
  }

  .review-head h2 {
    font-size: 22px;
    margin-bottom: 16px;
  }
}

/* ═══════════════════════════════════════════════════════
   Quiz Focus Override
   적용 대상: 로컬 인앱 브라우저, 데스크톱, 모바일 모두.
   대시보드 껍데기를 제거하고 문제 풀이 화면을 앱처럼 크게 보이게 한다.
   ═══════════════════════════════════════════════════════ */
#app {
  align-items: center !important;
  min-height: 100dvh !important;
}

#app main {
  width: min(92vw, 900px) !important;
  max-width: none !important;
  min-height: 100dvh !important;
  margin: 0 auto !important;
  padding: 0 20px !important;
}

.filter,
.mode-toggle-container,
.boss-hud,
.mission-panel,
.leaderboard-panel,
.profile,
.brand,
.sidebar-footer {
  display: none !important;
}

.topline {
  display: flex !important;
  width: 100% !important;
  margin: 0 0 12px !important;
  padding: 12px 52px 0 0 !important;
  box-sizing: border-box !important;
}

.topline > div:first-child {
  display: none !important;
}

.topline .actions {
  display: flex !important;
  width: 100% !important;
  gap: 8px !important;
}

.topline .actions button {
  min-height: 38px !important;
  height: auto !important;
  padding: 8px 10px !important;
  border-radius: 10px !important;
  box-shadow: none !important;
  font-size: 13px !important;
  line-height: 1.2 !important;
}

.nav-toggle {
  position: fixed !important;
  top: 12px !important;
  right: 12px !important;
  z-index: 2200 !important;
  width: 44px !important;
  height: 44px !important;
  min-height: 44px !important;
  padding: 0 !important;
  border-radius: 999px !important;
  border: 1px solid rgba(255, 255, 255, 0.14) !important;
  background: rgba(11, 17, 32, 0.78) !important;
  color: #eaf2ff !important;
  box-shadow: none !important;
  backdrop-filter: blur(14px) !important;
  font-size: 20px !important;
}

.sidebar {
  display: none !important;
}

.sidebar.menu-open {
  position: fixed !important;
  inset: 64px 12px auto 12px !important;
  z-index: 2100 !important;
  display: block !important;
  width: auto !important;
  height: auto !important;
  padding: 10px !important;
  border: 1px solid rgba(255, 255, 255, 0.12) !important;
  border-radius: 14px !important;
  background: rgba(11, 17, 32, 0.96) !important;
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.42) !important;
  backdrop-filter: blur(18px) !important;
}

.sidebar.menu-open .tabs {
  display: grid !important;
  grid-template-columns: 1fr 1fr !important;
  gap: 8px !important;
  width: 100% !important;
  height: auto !important;
  padding: 0 !important;
}

.sidebar.menu-open .tab {
  display: flex !important;
  min-height: 44px !important;
  height: auto !important;
  padding: 10px 12px !important;
  border-radius: 10px !important;
  font-size: 14px !important;
  line-height: 1.25 !important;
  background: rgba(255, 255, 255, 0.04) !important;
  color: #dce6f6 !important;
  border: 1px solid rgba(255, 255, 255, 0.08) !important;
  box-shadow: none !important;
}

.sidebar.menu-open .tab.active {
  color: #06101e !important;
  background: #67e8f9 !important;
  border-color: transparent !important;
}

#quizView.workspace.active-view {
  display: flex !important;
  width: 100% !important;
  min-height: 100dvh !important;
}

.quiz-container {
  width: 100% !important;
  min-height: 100dvh !important;
  gap: 0 !important;
}

#questionPanel.question-panel {
  width: 100% !important;
  min-height: 100dvh !important;
  margin: 0 !important;
  padding: 20px 0 10px !important;
  border: 0 !important;
  border-radius: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
  backdrop-filter: none !important;
}

#questionPanel .question-meta {
  gap: 10px !important;
  margin: 0 0 28px !important;
}

#questionPanel .question-meta span {
  padding: 8px 14px !important;
  font-size: 16px !important;
}

#questionPanel .voice-hint-btn,
#questionPanel .text-hint-btn {
  margin-left: 0 !important;
  min-height: 40px !important;
  padding: 8px 14px !important;
  font-size: 16px !important;
}

#questionText {
  margin: 0 0 28px !important;
  font-size: 36px !important;
  line-height: 1.32 !important;
  font-weight: 900 !important;
  word-break: keep-all !important;
}

#questionPanel:has(.question-image-area:not(.hidden)) #questionText {
  margin-bottom: 16px !important;
  font-size: 28px !important;
  line-height: 1.28 !important;
}

#questionPanel.image-question #imageArea {
  order: 1 !important;
}

#questionPanel.image-question #questionText {
  order: 2 !important;
}

#questionPanel.image-question #bogiArea {
  order: 3 !important;
}

#questionPanel.image-question #answerArea {
  order: 4 !important;
}

#questionPanel.image-question #hintPanel,
#questionPanel.image-question #feedback,
#questionPanel.image-question .question-actions {
  order: 5 !important;
}

#questionPanel:has(.question-image-area:not(.hidden)) .question-image-area {
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  width: calc(100% + 32px) !important;
  max-height: none !important;
  min-height: auto !important;
  margin: 0 -16px 18px !important;
  padding: 0 !important;
  overflow: hidden !important;
  position: relative !important;
  background: rgba(255, 255, 255, 0.035) !important;
}

#questionPanel #imageArea.question-image-area:not(.hidden) {
  width: calc(100vw - 32px) !important;
  max-width: none !important;
  margin-left: 50% !important;
  transform: translateX(-50%) !important;
}

#questionPanel #imageArea.question-image-area.loading::before,
#questionPanel #imageArea.question-image-area.load-failed::before {
  content: "그림 불러오는 중";
  position: absolute;
  inset: 0;
  z-index: 1;
  display: grid;
  place-items: center;
  color: rgba(240, 244, 249, 0.7);
  font-size: 16px;
  font-weight: 800;
}

#questionPanel #imageArea.question-image-area.load-failed::before {
  content: "그림을 불러오지 못했습니다";
  color: rgba(255, 184, 0, 0.9);
}

#questionPanel #imageArea.question-image-area.loading img,
#questionPanel #imageArea.question-image-area.load-failed img {
  opacity: 0;
}

#questionPanel:has(.question-image-area:not(.hidden)) .question-image-area img {
  width: 100% !important;
  height: 100% !important;
  max-height: none !important;
  object-fit: contain !important;
  transform: scale(1.18) !important;
  transform-origin: center center !important;
  transition: opacity 0.16s ease !important;
}

#answerArea {
  display: flex !important;
  flex: 1 1 auto !important;
  flex-direction: column !important;
  gap: 18px !important;
  min-height: 0 !important;
  margin: 0 !important;
}

#answerArea .choices {
  display: flex !important;
  flex: 1 1 auto !important;
  flex-direction: column !important;
  gap: 18px !important;
  margin-top: 0 !important;
  min-height: 0 !important;
}

#answerArea .choice {
  flex: 1 1 0 !important;
  min-height: 104px !important;
  padding: 24px 30px !important;
  border-radius: 14px !important;
  font-size: 34px !important;
  line-height: 1.35 !important;
  font-weight: 900 !important;
  box-shadow: none !important;
}

#questionPanel:not(:has(.question-image-area:not(.hidden))) #answerArea {
  flex: 0 0 auto !important;
  margin-bottom: 0 !important;
}

#questionPanel:not(:has(.question-image-area:not(.hidden))) #answerArea .choices {
  flex: 0 0 auto !important;
  gap: 12px !important;
}

#questionPanel:not(:has(.question-image-area:not(.hidden))) #answerArea .choice {
  flex: 0 0 auto !important;
  min-height: 72px !important;
  padding: 18px 22px !important;
}

#questionPanel .question-actions {
  margin-top: 22px !important;
  padding: 0 0 8px !important;
  gap: 16px !important;
}

#questionPanel .question-actions button {
  min-height: 90px !important;
  padding: 14px 10px !important;
  border-radius: 14px !important;
  font-size: 24px !important;
  font-weight: 900 !important;
}

#prevBtn,
#nextBtn {
  flex: 0.82 !important;
}

@media (max-width: 640px) {
  #app main {
    width: 100% !important;
    max-width: none !important;
    padding: 0 16px !important;
  }

  #questionPanel .question-meta {
    gap: 8px !important;
    margin-bottom: 34px !important;
  }

  #questionPanel .question-meta span,
  #questionPanel .voice-hint-btn,
  #questionPanel .text-hint-btn {
    min-height: auto !important;
    padding: 5px 10px !important;
    font-size: 12px !important;
  }

  #questionText {
    font-size: 26px !important;
  }

  #questionPanel:has(.question-image-area:not(.hidden)) #questionText {
    font-size: 22px !important;
    line-height: 1.28 !important;
  }

  #questionPanel:has(.question-image-area:not(.hidden)) .question-image-area {
    width: calc(100% + 32px) !important;
    margin-left: -16px !important;
    margin-right: -16px !important;
  }

  #answerArea {
    gap: 13px !important;
  }

  #answerArea .choices {
    gap: 13px !important;
  }

  #answerArea .choice {
    flex: 1 1 0 !important;
    min-height: 74px !important;
    padding: 18px 20px !important;
    font-size: 22px !important;
  }

  #questionPanel:not(:has(.question-image-area:not(.hidden))) #answerArea .choices {
    gap: 10px !important;
  }

  #questionPanel:not(:has(.question-image-area:not(.hidden))) #answerArea .choice {
    flex: 0 0 auto !important;
    min-height: 56px !important;
    padding: 14px 18px !important;
    font-size: 20px !important;
  }

  #questionPanel .question-actions button {
    min-height: 70px !important;
    font-size: 17px !important;
  }
}

/* ═══════════════════════════════════════════════════════
   Responsive Quiz Sizing
   기기 높이에 맞춰 문제, 선택지, 버튼이 함께 줄고 늘어나게 한다.
   ═══════════════════════════════════════════════════════ */
@media (max-width: 720px) {
  :root {
    --quiz-page-pad-x: clamp(14px, 4vw, 22px);
    --quiz-top-gap: clamp(8px, 1.4dvh, 14px);
    --quiz-meta-gap: clamp(10px, 2.2dvh, 24px);
    --quiz-question-size: clamp(21px, 3.6dvh, 29px);
    --quiz-question-image-size: clamp(18px, 2.9dvh, 23px);
    --quiz-choice-size: clamp(17px, 2.65dvh, 22px);
    --quiz-choice-min: clamp(50px, 7.8dvh, 72px);
    --quiz-choice-pad-y: clamp(12px, 2dvh, 18px);
    --quiz-choice-gap: clamp(8px, 1.55dvh, 13px);
    --quiz-action-min: clamp(52px, 8dvh, 70px);
    --quiz-action-size: clamp(14px, 2.2dvh, 17px);
    --quiz-action-gap: clamp(8px, 2.3vw, 14px);
  }

  #app main {
    width: 100% !important;
    min-height: 100dvh !important;
    padding-inline: var(--quiz-page-pad-x) !important;
  }

  #quizView.workspace.active-view,
  .quiz-container {
    min-height: auto !important;
  }

  #questionPanel.question-panel {
    min-height: calc(100dvh - 92px) !important;
    padding: var(--quiz-top-gap) 0 calc(8px + env(safe-area-inset-bottom)) !important;
  }

  #questionPanel .question-meta {
    gap: 6px !important;
    margin-bottom: var(--quiz-meta-gap) !important;
  }

  #questionPanel .question-meta span,
  #questionPanel .voice-hint-btn,
  #questionPanel .text-hint-btn {
    padding: 4px 9px !important;
    font-size: clamp(10px, 1.7dvh, 12px) !important;
    line-height: 1.15 !important;
  }

  #questionText {
    margin-bottom: clamp(18px, 3dvh, 28px) !important;
    font-size: var(--quiz-question-size) !important;
    line-height: 1.28 !important;
  }

  #questionPanel:has(.question-image-area:not(.hidden)) #questionText {
    margin-bottom: clamp(10px, 1.8dvh, 16px) !important;
    font-size: var(--quiz-question-image-size) !important;
    line-height: 1.25 !important;
  }

  #answerArea,
  #answerArea .choices {
    gap: var(--quiz-choice-gap) !important;
  }

  #answerArea .choice,
  #questionPanel:not(:has(.question-image-area:not(.hidden))) #answerArea .choice {
    min-height: var(--quiz-choice-min) !important;
    padding: var(--quiz-choice-pad-y) clamp(14px, 4vw, 20px) !important;
    font-size: var(--quiz-choice-size) !important;
    line-height: 1.28 !important;
  }

  #questionPanel .question-actions {
    margin-top: clamp(14px, 2.6dvh, 22px) !important;
    gap: var(--quiz-action-gap) !important;
  }

  #questionPanel .question-actions button {
    min-height: var(--quiz-action-min) !important;
    padding: clamp(10px, 1.8dvh, 14px) 8px !important;
    font-size: var(--quiz-action-size) !important;
    line-height: 1.15 !important;
  }

  #questionPanel:has(.question-image-area:not(.hidden)) .question-image-area {
    min-height: clamp(128px, 23dvh, 220px) !important;
    max-height: clamp(150px, 29dvh, 280px) !important;
    aspect-ratio: 4 / 3 !important;
  }

  #questionPanel:has(.question-image-area:not(.hidden)) .question-image-area img {
    transform: none !important;
  }

  #questionPanel.image-question .bogi-box {
    max-height: clamp(116px, 18dvh, 170px) !important;
    overflow: auto !important;
    margin: clamp(8px, 1.4dvh, 14px) 0 !important;
    padding: clamp(10px, 1.8dvh, 14px) clamp(12px, 3vw, 16px) !important;
  }

  #questionPanel.image-question .bogi-title {
    margin-bottom: 6px !important;
    font-size: clamp(11px, 1.7dvh, 13px) !important;
  }

  #questionPanel.image-question .bogi-content {
    gap: 5px !important;
  }

  #questionPanel.image-question .bogi-line {
    font-size: clamp(13px, 2dvh, 15px) !important;
    line-height: 1.45 !important;
  }
}

@media (max-width: 720px) and (max-height: 720px) {
  :root {
    --quiz-meta-gap: 10px;
    --quiz-question-size: clamp(19px, 3.9dvh, 24px);
    --quiz-question-image-size: clamp(17px, 3.1dvh, 20px);
    --quiz-choice-size: clamp(16px, 2.75dvh, 19px);
    --quiz-choice-min: clamp(44px, 7.2dvh, 58px);
    --quiz-choice-pad-y: clamp(9px, 1.6dvh, 13px);
    --quiz-choice-gap: clamp(7px, 1.3dvh, 10px);
    --quiz-action-min: clamp(46px, 7.2dvh, 58px);
    --quiz-action-size: clamp(13px, 2.2dvh, 15px);
  }

  .topline {
    margin-bottom: 8px !important;
    padding-top: 8px !important;
  }

  .topline .actions button {
    min-height: 34px !important;
    padding-block: 6px !important;
    font-size: 12px !important;
  }

  .nav-toggle {
    width: 38px !important;
    height: 38px !important;
    min-height: 38px !important;
  }

  #questionPanel.question-panel {
    min-height: calc(100dvh - 72px) !important;
  }

  #questionPanel:has(.question-image-area:not(.hidden)) .question-image-area {
    min-height: clamp(116px, 21dvh, 160px) !important;
    max-height: clamp(132px, 25dvh, 178px) !important;
  }

  #questionPanel.image-question .bogi-box {
    max-height: clamp(92px, 16dvh, 116px) !important;
  }
}

/* 넓은 화면에서는 모바일 확대 규칙을 데스크톱 밀도로 되돌린다. */
@media (min-width: 721px) {
  #app main {
    width: min(72vw, 760px) !important;
    min-height: 100dvh !important;
    padding: 16px 0 28px !important;
  }

  .topline {
    margin-bottom: clamp(18px, 3dvh, 32px) !important;
    padding: 0 58px 0 0 !important;
  }

  .topline .actions button {
    min-height: 44px !important;
    padding: 10px 14px !important;
    font-size: 14px !important;
  }

  #quizView.workspace.active-view,
  .quiz-container {
    min-height: auto !important;
  }

  #questionPanel.question-panel {
    min-height: auto !important;
    padding: clamp(12px, 2dvh, 22px) 0 0 !important;
  }

  #questionPanel .question-meta {
    gap: 8px !important;
    margin-bottom: clamp(18px, 3dvh, 28px) !important;
  }

  #questionPanel .question-meta span,
  #questionPanel .voice-hint-btn,
  #questionPanel .text-hint-btn {
    min-height: auto !important;
    padding: 6px 12px !important;
    font-size: 13px !important;
  }

  #questionText {
    margin-bottom: clamp(20px, 3dvh, 30px) !important;
    font-size: clamp(25px, 2vw, 32px) !important;
    line-height: 1.35 !important;
  }

  #questionPanel:has(.question-image-area:not(.hidden)) #questionText {
    font-size: clamp(22px, 1.55vw, 26px) !important;
    line-height: 1.3 !important;
  }

  #answerArea,
  #answerArea .choices {
    gap: clamp(10px, 1.3dvh, 14px) !important;
  }

  #answerArea .choice,
  #questionPanel:not(:has(.question-image-area:not(.hidden))) #answerArea .choice {
    min-height: clamp(56px, 7dvh, 76px) !important;
    padding: 14px 20px !important;
    border-radius: 12px !important;
    font-size: clamp(21px, 1.8vw, 26px) !important;
    line-height: 1.28 !important;
  }

  #questionPanel .question-actions {
    margin-top: clamp(16px, 2.4dvh, 24px) !important;
    gap: 12px !important;
    padding-bottom: 0 !important;
  }

  #questionPanel .question-actions button {
    min-height: 56px !important;
    padding: 12px 10px !important;
    border-radius: 12px !important;
    font-size: 16px !important;
  }

  #questionPanel:has(.question-image-area:not(.hidden)) .question-image-area {
    width: 100% !important;
    max-height: min(36dvh, 330px) !important;
    min-height: 220px !important;
    margin: 0 0 18px !important;
  }

  #questionPanel #imageArea.question-image-area:not(.hidden) {
    width: 100% !important;
    max-width: 100% !important;
    margin-left: 0 !important;
    transform: none !important;
  }

  #questionPanel:has(.question-image-area:not(.hidden)) .question-image-area img {
    transform: none !important;
  }
}
