﻿/* ==========================================================================
   DesignQuest - Visual Master Academy (Bright & Clean Modern Studio Theme)
   ========================================================================== */

:root {
  /* Surface & Base Colors (Bright & Airy) */
  --bg-dark: #f8fafc;
  --bg-surface: #ffffff;
  --bg-card: rgba(255, 255, 255, 0.88);
  --bg-card-hover: #ffffff;
  --bg-glass: rgba(255, 255, 255, 0.85);
  
  /* Borders & Dividers */
  --border-subtle: rgba(15, 23, 42, 0.08);
  --border-strong: rgba(15, 23, 42, 0.14);
  --border-accent: rgba(99, 102, 241, 0.35);

  /* Primary Brand & Accents */
  --primary: #4f46e5;
  --primary-hover: #4338ca;
  --primary-glow: rgba(79, 70, 229, 0.25);
  
  --cyan: #0284c7;
  --cyan-glow: rgba(2, 132, 199, 0.2);
  --emerald: #059669;
  --amber: #d97706;
  --rose: #e11d48;
  --violet: #7c3aed;

  /* Typography Colors (High Contrast Ink & Slate) */
  --text-main: #0f172a;
  --text-muted: #475569;
  --text-sub: #64748b;
  --text-accent: #4f46e5;

  /* Tier Specific Colors */
  --tier-beginner: #059669;
  --tier-intermediate: #0284c7;
  --tier-advanced: #7c3aed;
  --tier-master: #d97706;

  /* Spacing & Radii */
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 18px;
  --radius-xl: 24px;
  --radius-full: 9999px;

  /* Shadows (Soft & Premium) */
  --shadow-sm: 0 2px 8px rgba(15, 23, 42, 0.05);
  --shadow-md: 0 10px 30px rgba(15, 23, 42, 0.08);
  --shadow-lg: 0 20px 45px rgba(15, 23, 42, 0.12);
  --shadow-glow: 0 0 24px var(--primary-glow);

  --font-sans: 'Pretendard', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-mono: 'Fira Code', monospace;
}

/* Global Reset & Base */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font-sans);
  background-color: var(--bg-dark);
  color: var(--text-main);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background-image: 
    radial-gradient(at 15% 15%, rgba(99, 102, 241, 0.08) 0px, transparent 55%),
    radial-gradient(at 85% 20%, rgba(2, 132, 199, 0.07) 0px, transparent 50%),
    radial-gradient(at 50% 85%, rgba(245, 158, 11, 0.06) 0px, transparent 65%),
    radial-gradient(at 80% 80%, rgba(124, 58, 237, 0.06) 0px, transparent 55%);
  background-attachment: fixed;
  overflow-x: hidden;
}

/* 8px Grid Overlay (Bright adapted) */
.grid-overlay {
  position: fixed;
  inset: 0;
  background-size: 8px 8px;
  background-image: 
    linear-gradient(to right, rgba(79, 70, 229, 0.12) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(79, 70, 229, 0.12) 1px, transparent 1px);
  pointer-events: none;
  z-index: 9999;
}

.hidden {
  display: none !important;
}

/* ==========================================================================
   Header & Player HUD
   ========================================================================== */

.app-header {
  position: sticky;
  top: 0;
  z-index: 100;
  backdrop-filter: blur(16px);
  background: rgba(255, 255, 255, 0.9);
  border-bottom: 1px solid var(--border-subtle);
  box-shadow: var(--shadow-sm);
  padding: 0.75rem 1.5rem;
}

.header-container {
  max-width: 1400px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.brand-icon {
  font-size: 1.75rem;
  background: rgba(79, 70, 229, 0.1);
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-accent);
}

.brand-title {
  display: block;
  font-size: 1.25rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  background: linear-gradient(135deg, #1e1b4b, var(--primary));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.brand-sub {
  display: block;
  font-size: 0.725rem;
  color: var(--text-sub);
  letter-spacing: 0.05em;
  text-transform: uppercase;
  font-weight: 600;
}

/* Player HUD */
.player-hud {
  display: flex;
  align-items: center;
  gap: 1.25rem;
}

.hud-tier-badge {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.35rem 0.85rem;
  background: #ffffff;
  border: 1px solid var(--border-strong);
  box-shadow: 0 2px 6px rgba(0,0,0,0.03);
  border-radius: var(--radius-full);
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-main);
}

.hud-level-wrap {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  background: #ffffff;
  padding: 0.3rem 0.85rem;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-strong);
  box-shadow: 0 2px 6px rgba(0,0,0,0.03);
}

.hud-level-num {
  display: flex;
  align-items: baseline;
  gap: 0.2rem;
}

.lvl-label {
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--text-sub);
}

.lvl-val {
  font-size: 1.15rem;
  font-weight: 800;
  color: var(--primary);
}

.hud-exp-box {
  width: 140px;
}

.hud-exp-info {
  display: flex;
  justify-content: space-between;
  font-size: 0.68rem;
  color: var(--text-muted);
  margin-bottom: 0.25rem;
  font-family: var(--font-mono);
  font-weight: 600;
}

.hud-exp-bar-bg {
  height: 6px;
  background: #e2e8f0;
  border-radius: var(--radius-full);
  overflow: hidden;
}

.hud-exp-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--primary), var(--cyan));
  border-radius: var(--radius-full);
  transition: width 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.hud-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.icon-btn {
  background: #ffffff;
  border: 1px solid var(--border-strong);
  color: var(--text-main);
  padding: 0.5rem 0.75rem;
  border-radius: var(--radius-md);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.9rem;
  box-shadow: 0 2px 6px rgba(0,0,0,0.02);
  transition: all 0.2s ease;
}

.icon-btn:hover {
  background: #f1f5f9;
  border-color: var(--primary);
  transform: translateY(-1px);
}

.icon-btn.danger-hover:hover {
  background: #fff1f2;
  border-color: var(--rose);
}

.badge-count {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--amber);
}

/* ==========================================================================
   Hero Section
   ========================================================================== */

.hero-section {
  padding: 3.5rem 1.5rem 2.5rem;
  text-align: center;
  max-width: 900px;
  margin: 0 auto;
}

.hero-tag {
  display: inline-block;
  padding: 0.35rem 0.9rem;
  background: rgba(79, 70, 229, 0.08);
  border: 1px solid var(--border-accent);
  border-radius: var(--radius-full);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--primary);
  margin-bottom: 1.25rem;
}

.hero-title {
  font-size: clamp(1.8rem, 4vw, 2.75rem);
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.25;
  margin-bottom: 1.25rem;
  color: #0f172a;
}

.gradient-text {
  background: linear-gradient(135deg, #4f46e5, #0284c7, #059669);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.hero-desc {
  font-size: 1.05rem;
  color: var(--text-muted);
  max-width: 720px;
  margin: 0 auto 2rem;
  line-height: 1.7;
}

.hero-stats {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 1rem;
}

.stat-pill {
  padding: 0.5rem 1.25rem;
  background: #ffffff;
  border: 1px solid var(--border-strong);
  box-shadow: var(--shadow-sm);
  border-radius: var(--radius-full);
  font-size: 0.875rem;
  color: var(--text-muted);
}

.stat-num {
  font-weight: 700;
  color: var(--primary);
}

/* ==========================================================================
   Tier Filter Navigation
   ========================================================================== */

.tier-nav {
  position: sticky;
  top: 65px;
  z-index: 90;
  backdrop-filter: blur(12px);
  background: rgba(248, 250, 252, 0.92);
  border-bottom: 1px solid var(--border-subtle);
  padding: 0.5rem 1.5rem;
}

.tier-nav-container {
  max-width: 1400px;
  margin: 0 auto;
  display: flex;
  gap: 0.5rem;
  overflow-x: auto;
  padding-bottom: 0.25rem;
}

.tier-tab {
  background: #ffffff;
  border: 1px solid var(--border-subtle);
  color: var(--text-muted);
  padding: 0.55rem 1.1rem;
  border-radius: var(--radius-md);
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  box-shadow: 0 1px 3px rgba(0,0,0,0.02);
  transition: all 0.2s ease;
}

.tier-tab:hover {
  color: var(--primary);
  border-color: var(--border-accent);
}

.tier-tab.active {
  background: var(--primary);
  border-color: var(--primary);
  color: #ffffff;
  box-shadow: 0 4px 14px var(--primary-glow);
}

/* ==========================================================================
   Quest Grid & Cards
   ========================================================================== */

.main-content {
  flex: 1;
  max-width: 1400px;
  margin: 0 auto;
  padding: 2.5rem 1.5rem 4rem;
  width: 100%;
}

.quest-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(310px, 1fr));
  gap: 1.5rem;
}

.quest-card {
  background: var(--bg-card);
  backdrop-filter: blur(12px);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  cursor: pointer;
  position: relative;
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.quest-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: linear-gradient(90deg, transparent, var(--primary), transparent);
  opacity: 0;
  transition: opacity 0.25s ease;
}

.quest-card:hover {
  transform: translateY(-4px);
  border-color: var(--border-accent);
  background: var(--bg-card-hover);
  box-shadow: var(--shadow-md);
}

.quest-card:hover::before {
  opacity: 1;
}

.quest-card.completed {
  border-color: rgba(5, 150, 105, 0.35);
  background: #ffffff;
}

.quest-card.completed::before {
  opacity: 1;
  background: var(--emerald);
}

.quest-card-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 1rem;
}

.quest-badge-wrap {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.quest-number {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 700;
  padding: 0.2rem 0.5rem;
  border-radius: var(--radius-sm);
  background: #f1f5f9;
  color: var(--primary);
  border: 1px solid #e2e8f0;
}

.quest-tier-pill {
  font-size: 0.7rem;
  font-weight: 700;
  padding: 0.2rem 0.55rem;
  border-radius: var(--radius-full);
}

.tier-pill-beginner {
  background: #ecfdf5;
  color: var(--tier-beginner);
  border: 1px solid #a7f3d0;
}

.tier-pill-intermediate {
  background: #f0f9ff;
  color: var(--tier-intermediate);
  border: 1px solid #bae6fd;
}

.tier-pill-advanced {
  background: #f5f3ff;
  color: var(--tier-advanced);
  border: 1px solid #ddd6fe;
}

.tier-pill-master {
  background: #fffbeb;
  color: var(--tier-master);
  border: 1px solid #fde68a;
}

.quest-status-icon {
  font-size: 1.1rem;
}

.quest-card-title {
  font-size: 1.15rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
  line-height: 1.35;
  color: var(--text-main);
}

.quest-card-desc {
  font-size: 0.875rem;
  color: var(--text-muted);
  margin-bottom: 1.25rem;
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.quest-card-bottom {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-top: 1rem;
  border-top: 1px solid var(--border-subtle);
}

.quest-card-exp {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--primary);
}

.quest-start-btn {
  background: #f8fafc;
  border: 1px solid var(--border-strong);
  color: var(--text-main);
  padding: 0.4rem 0.85rem;
  border-radius: var(--radius-sm);
  font-size: 0.8rem;
  font-weight: 600;
  transition: all 0.2s ease;
}

.quest-card:hover .quest-start-btn {
  background: var(--primary);
  border-color: var(--primary);
  color: #ffffff;
  box-shadow: 0 2px 10px var(--primary-glow);
}

/* ==========================================================================
   Modals & Overlays
   ========================================================================== */

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.45);
  backdrop-filter: blur(8px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  animation: fadeIn 0.2s ease-out;
}

.modal-container {
  background: #ffffff;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg);
  max-width: 1200px;
  width: 100%;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: slideUp 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.small-modal {
  max-width: 680px;
}

.toolkit-modal {
  max-width: 840px;
}

.close-modal-btn {
  background: #f1f5f9;
  border: 1px solid var(--border-subtle);
  color: var(--text-muted);
  width: 34px;
  height: 34px;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  cursor: pointer;
  transition: all 0.2s;
}

.close-modal-btn:hover {
  background: #e2e8f0;
  color: #0f172a;
}

/* ==========================================================================
   Quest Studio (Theory + Challenge Arena)
   ========================================================================== */

.studio-header {
  padding: 1.25rem 2rem;
  background: #f8fafc;
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.studio-header-left {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.quest-tag {
  font-size: 0.75rem;
  font-weight: 700;
  padding: 0.3rem 0.75rem;
  border-radius: var(--radius-full);
  background: rgba(79, 70, 229, 0.1);
  color: var(--primary);
  border: 1px solid var(--border-accent);
}

.studio-title {
  font-size: 1.35rem;
  font-weight: 800;
  color: #0f172a;
}

.studio-header-right {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.quest-exp-reward {
  font-family: var(--font-mono);
  font-size: 0.875rem;
  font-weight: 700;
  color: var(--amber);
  background: #fffbeb;
  padding: 0.3rem 0.75rem;
  border-radius: var(--radius-md);
  border: 1px solid #fde68a;
}

.studio-body {
  display: grid;
  grid-template-columns: 1.15fr 1fr;
  flex: 1;
  overflow: hidden;
}

/* Left Panel: Theory */
.theory-panel {
  padding: 2rem;
  overflow-y: auto;
  border-right: 1px solid var(--border-subtle);
  line-height: 1.7;
  background: #ffffff;
}

.theory-panel h3 {
  font-size: 1.2rem;
  margin-top: 1.5rem;
  margin-bottom: 0.75rem;
  color: var(--primary);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.theory-panel h3:first-child {
  margin-top: 0;
}

.theory-panel p {
  color: var(--text-muted);
  margin-bottom: 1rem;
  font-size: 0.95rem;
}

.theory-callout {
  background: #f8fafc;
  border-left: 4px solid var(--primary);
  padding: 1rem 1.25rem;
  border-radius: var(--radius-sm);
  margin: 1.25rem 0;
  font-size: 0.9rem;
  border: 1px solid var(--border-subtle);
  border-left-width: 4px;
}

.theory-callout strong {
  color: #0f172a;
}

.visual-guide-box {
  background: #f1f5f9;
  border: 1px solid #e2e8f0;
  border-radius: var(--radius-md);
  padding: 1.25rem;
  margin: 1.25rem 0;
}

.visual-guide-box .guide-title {
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--cyan);
  margin-bottom: 0.75rem;
}

/* Right Panel: Challenge */
.challenge-panel {
  background: #f8fafc;
  padding: 2rem;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}

.challenge-card {
  display: flex;
  flex-direction: column;
  flex: 1;
}

.challenge-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.75rem;
}

.challenge-title-wrap {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.challenge-title {
  font-size: 1.15rem;
  font-weight: 700;
  color: #0f172a;
}

.challenge-status-badge {
  font-size: 0.75rem;
  padding: 0.25rem 0.65rem;
  border-radius: var(--radius-full);
  background: #e2e8f0;
  color: var(--text-sub);
  font-weight: 600;
}

.challenge-status-badge.cleared {
  background: #ecfdf5;
  color: var(--emerald);
  font-weight: 700;
  border: 1px solid #a7f3d0;
}

.challenge-instruction {
  font-size: 0.9rem;
  color: var(--text-muted);
  margin-bottom: 1.5rem;
}

.challenge-arena {
  background: #ffffff;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  min-height: 280px;
  position: relative;
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

.challenge-footer {
  margin-top: 1.5rem;
}

.challenge-result {
  padding: 1rem 1.25rem;
  border-radius: var(--radius-md);
  margin-bottom: 1rem;
  font-size: 0.9rem;
  animation: fadeIn 0.2s ease-out;
}

.challenge-result.success {
  background: #ecfdf5;
  border: 1px solid var(--emerald);
  color: #065f46;
}

.challenge-result.error {
  background: #fff1f2;
  border: 1px solid var(--rose);
  color: #9f1239;
}

.challenge-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.75rem;
}

.btn {
  padding: 0.65rem 1.25rem;
  border-radius: var(--radius-md);
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
}

.btn-primary {
  background: var(--primary);
  color: #ffffff;
  box-shadow: 0 2px 10px var(--primary-glow);
}

.btn-primary:hover {
  background: var(--primary-hover);
  transform: translateY(-1px);
}

.btn-secondary {
  background: #ffffff;
  border: 1px solid var(--border-strong);
  color: var(--text-main);
  box-shadow: 0 1px 3px rgba(0,0,0,0.02);
}

.btn-secondary:hover {
  background: #f1f5f9;
  border-color: var(--primary);
}

/* ==========================================================================
   Badges Grid
   ========================================================================== */

.modal-header {
  padding: 1.25rem 1.75rem;
  border-bottom: 1px solid var(--border-subtle);
  background: #f8fafc;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.modal-title-wrap {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  color: #0f172a;
}

.modal-body {
  padding: 1.75rem;
  overflow-y: auto;
  background: #ffffff;
}

.modal-desc {
  font-size: 0.9rem;
  color: var(--text-muted);
  margin-bottom: 1.5rem;
}

.badge-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: 1rem;
}

.badge-item {
  background: #f8fafc;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-md);
  padding: 1rem 0.75rem;
  text-align: center;
  transition: all 0.25s ease;
  position: relative;
}

.badge-item.locked {
  filter: grayscale(1) opacity(0.35);
  background: #f1f5f9;
}

.badge-item.unlocked {
  border-color: #f59e0b;
  background: #fffbeb;
  box-shadow: 0 4px 14px rgba(245, 158, 11, 0.15);
}

.badge-icon {
  font-size: 2.25rem;
  margin-bottom: 0.5rem;
}

.badge-name {
  font-size: 0.8rem;
  font-weight: 700;
  margin-bottom: 0.25rem;
  color: #0f172a;
}

.badge-condition {
  font-size: 0.7rem;
  color: var(--text-sub);
  line-height: 1.3;
}

/* ==========================================================================
   Designer Toolkit
   ========================================================================== */

.toolkit-body {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.tool-tabs {
  display: flex;
  gap: 0.5rem;
  border-bottom: 1px solid var(--border-subtle);
  padding-bottom: 0.75rem;
  overflow-x: auto;
}

.tool-tab {
  background: #ffffff;
  border: 1px solid var(--border-subtle);
  color: var(--text-muted);
  padding: 0.45rem 0.9rem;
  border-radius: var(--radius-md);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}

.tool-tab.active {
  background: var(--primary);
  color: #ffffff;
  border-color: var(--primary);
}

.tool-view {
  min-height: 320px;
}

/* Contrast Tool */
.contrast-tool-wrap {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
}

.contrast-preview {
  border-radius: var(--radius-lg);
  padding: 2rem;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
  border: 1px solid var(--border-strong);
  box-shadow: var(--shadow-sm);
  min-height: 220px;
}

.contrast-score-box {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.ratio-display {
  font-family: var(--font-mono);
  font-size: 2.5rem;
  font-weight: 800;
  color: #0f172a;
}

.compliance-badge {
  display: inline-block;
  padding: 0.25rem 0.75rem;
  border-radius: var(--radius-full);
  font-size: 0.8rem;
  font-weight: 700;
}

.pass {
  background: #ecfdf5;
  color: var(--emerald);
  border: 1px solid #a7f3d0;
}

.fail {
  background: #fff1f2;
  color: var(--rose);
  border: 1px solid #fecdd3;
}

/* ==========================================================================
   Toast & Level Up Overlay
   ========================================================================== */

.toast-container {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  z-index: 2000;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.toast {
  background: #ffffff;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-md);
  padding: 0.85rem 1.25rem;
  box-shadow: var(--shadow-lg);
  font-size: 0.875rem;
  color: #0f172a;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  animation: slideInRight 0.25s ease-out;
}

.levelup-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.6);
  backdrop-filter: blur(12px);
  z-index: 3000;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: fadeIn 0.3s ease-out;
}

.levelup-card {
  background: #ffffff;
  border: 2px solid var(--primary);
  box-shadow: 0 20px 60px rgba(79, 70, 229, 0.2);
  border-radius: var(--radius-xl);
  padding: 3rem 2.5rem;
  text-align: center;
  max-width: 480px;
  width: 90%;
  animation: popIn 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.levelup-sparks {
  font-size: 1.5rem;
  margin-bottom: 0.75rem;
  animation: bounce 1.5s infinite;
}

.levelup-title {
  font-size: 2.25rem;
  font-weight: 900;
  letter-spacing: 0.05em;
  background: linear-gradient(135deg, #d97706, #f59e0b);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  margin-bottom: 0.5rem;
}

.levelup-tier {
  font-size: 1.15rem;
  color: var(--primary);
  font-weight: 700;
}

.levelup-level {
  font-family: var(--font-mono);
  font-size: 3rem;
  font-weight: 900;
  color: #0f172a;
  margin: 0.75rem 0;
}

.levelup-desc {
  font-size: 0.95rem;
  color: var(--text-muted);
  margin-bottom: 2rem;
}

/* ==========================================================================
   Footer
   ========================================================================== */

.app-footer {
  border-top: 1px solid var(--border-subtle);
  background: #ffffff;
  padding: 1.75rem 1.5rem;
  font-size: 0.85rem;
  color: var(--text-sub);
}

.footer-container {
  max-width: 1400px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
}

.footer-brand {
  color: var(--text-main);
  font-weight: 500;
}

.footer-meta {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.footer-link {
  color: var(--primary);
  text-decoration: none;
  font-weight: 600;
}

.footer-link:hover {
  text-decoration: underline;
}

/* ==========================================================================
   Keyframes
   ========================================================================== */

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes slideUp {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes slideInRight {
  from { opacity: 0; transform: translateX(30px); }
  to { opacity: 1; transform: translateX(0); }
}

@keyframes popIn {
  from { opacity: 0; transform: scale(0.85); }
  to { opacity: 1; transform: scale(1); }
}

@keyframes bounce {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-8px); }
}

/* Responsive adjustments */
@media (max-width: 960px) {
  .studio-body {
    grid-template-columns: 1fr;
    overflow-y: auto;
  }
  .theory-panel {
    border-right: none;
    border-bottom: 1px solid var(--border-subtle);
  }
  .header-container {
    flex-direction: column;
    align-items: stretch;
  }
  .player-hud {
    justify-content: space-between;
    flex-wrap: wrap;
  }
  .contrast-tool-wrap {
    grid-template-columns: 1fr;
  }
}
