/* CSS DESIGN SYSTEM - LUNARIA MAGIC ACADEMY THEME */

:root {
  /* Mystical Color System */
  --bg-dark: #05020a;
  --bg-darker: #020104;
  --bg-panel: rgba(11, 6, 20, 0.94);
  --border-magic: rgba(212, 175, 55, 0.25); /* Ancient Gold Trim */
  --gold-glowing: #d4af37;
  --text-main: #f3f4f6;
  --text-muted: #8e9cae;
  --primary: #8b5cf6; /* Mana Purple */
  --primary-glow: rgba(139, 92, 246, 0.45);
  --accent: #ffd700; /* Star Gold */
  
  /* Grade S: Archmage (Sun Gold & Astral Indigo) */
  --s-color: #ffd700;
  --s-gradient: linear-gradient(135deg, #ffd700 0%, #7c2d12 40%, #581c87 100%);
  --s-glow: 0 0 25px rgba(255, 215, 0, 0.65), 0 0 12px rgba(139, 92, 246, 0.4);
  --s-bg: rgba(10, 4, 20, 0.96);

  /* Grade A: Battlemage (Ruby Crimson) */
  --a-color: #ef4444;
  --a-gradient: linear-gradient(135deg, #ef4444 0%, #7f1d1d 100%);
  --a-glow: 0 0 20px rgba(239, 68, 68, 0.6);
  --a-bg: rgba(20, 4, 8, 0.96);

  /* Grade B: Conjurer (Sapphire Blue) */
  --b-color: #3b82f6;
  --b-gradient: linear-gradient(135deg, #3b82f6 0%, #1e3a8a 100%);
  --b-glow: 0 0 20px rgba(59, 130, 246, 0.6);
  --b-bg: rgba(4, 8, 22, 0.96);

  /* Grade C: Enchanter (Emerald Green) */
  --c-color: #10b981;
  --c-gradient: linear-gradient(135deg, #10b981 0%, #064e3b 100%);
  --c-glow: 0 0 20px rgba(16, 185, 129, 0.6);
  --c-bg: rgba(4, 18, 10, 0.96);

  /* Grade D: Apprentice (Runic Silver) */
  --d-color: #9ca3af;
  --d-gradient: linear-gradient(135deg, #cbd5e1 0%, #374151 100%);
  --d-glow: 0 0 15px rgba(156, 163, 175, 0.35);
  --d-bg: rgba(10, 11, 15, 0.96);

  /* Grade F: Squib (Ash Clay) */
  --f-color: #b45309;
  --f-gradient: linear-gradient(135deg, #b45309 0%, #451a03 100%);
  --f-glow: 0 0 15px rgba(180, 83, 9, 0.4);
  --f-bg: rgba(14, 8, 6, 0.96);

  /* Typography */
  --font-en: 'Cinzel', serif;
  --font-kr: 'Noto Serif KR', serif;
}

/* Reset & Atmospheric Background */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  user-select: none;
}

body {
  background-color: var(--bg-darker);
  /* Mystical Alchemy Grid Pattern */
  background-image: 
    radial-gradient(rgba(212, 175, 55, 0.015) 1px, transparent 1px),
    radial-gradient(rgba(139, 92, 246, 0.01) 1.5px, transparent 1.5px);
  background-size: 32px 32px;
  background-position: 0 0, 16px 16px;
  color: var(--text-main);
  font-family: var(--font-kr);
  overflow-x: hidden;
  min-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
  position: relative;
}

/* Atmospheric vignette */
body::before {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: radial-gradient(circle, rgba(0,0,0,0) 25%, rgba(2, 1, 6, 0.98) 100%);
  z-index: 1;
  pointer-events: none;
}

/* Custom Magic Scrollbar */
::-webkit-scrollbar {
  width: 6px;
}
::-webkit-scrollbar-track {
  background: var(--bg-darker);
}
::-webkit-scrollbar-thumb {
  background: rgba(212, 175, 55, 0.2);
  border-radius: 3px;
  border: 1px solid rgba(212, 175, 55, 0.05);
}
::-webkit-scrollbar-thumb:hover {
  background: var(--primary);
}

/* Interactive Particle Canvas */
#particleCanvas {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  pointer-events: none;
  opacity: 0.85;
}

/* ==========================================
   SPLASH SCREEN: MAGIC BARRIER (Autoplay Solution)
   ========================================== */

.magic-splash-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: #040108;
  z-index: 9999;
  display: flex;
  justify-content: center;
  align-items: center;
  transition: all 0.9s cubic-bezier(0.16, 1, 0.3, 1);
  overflow: hidden;
}

.magic-splash-overlay.unsealed {
  opacity: 0;
  pointer-events: none;
  transform: scale(1.15);
}

.splash-glow-bg {
  position: absolute;
  width: 600px;
  height: 600px;
  background: radial-gradient(circle, rgba(139, 92, 246, 0.12) 0%, transparent 70%);
  z-index: 1;
  pointer-events: none;
  animation: pulseGlow 6s ease-in-out infinite alternate;
}

@keyframes pulseGlow {
  0% { transform: scale(0.9); opacity: 0.8; }
  100% { transform: scale(1.1); opacity: 1; }
}

.splash-content {
  position: relative;
  z-index: 2;
  text-align: center;
  max-width: 480px;
  padding: 20px;
}

.academy-emblem {
  font-size: 3rem;
  color: var(--gold-glowing);
  margin-bottom: 20px;
  filter: drop-shadow(0 0 15px rgba(212, 175, 55, 0.5));
  animation: floatEmblem 4s ease-in-out infinite;
}

@keyframes floatEmblem {
  0%, 100% { transform: translateY(0) rotate(0deg); }
  50% { transform: translateY(-8px) rotate(5deg); }
}

.splash-subtitle {
  font-family: var(--font-en);
  font-size: 0.8rem;
  letter-spacing: 5px;
  color: var(--gold-glowing);
  margin-bottom: 12px;
  font-weight: 700;
}

.splash-title {
  font-family: var(--font-kr);
  font-size: 2.2rem;
  font-weight: 900;
  margin-bottom: 20px;
  background: linear-gradient(180deg, #ffffff 0%, #b5a2cf 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  text-shadow: 0 0 20px rgba(181, 162, 207, 0.2);
}

.splash-desc {
  font-size: 0.9rem;
  color: var(--text-muted);
  line-height: 1.7;
  margin-bottom: 45px;
}

/* Concentric Spinning Rune Circles */
.seal-container {
  width: 190px;
  height: 190px;
  margin: 0 auto;
  position: relative;
  cursor: pointer;
  display: flex;
  justify-content: center;
  align-items: center;
}

.rune-circle {
  position: absolute;
  border-radius: 50%;
  border: 1.5px dashed rgba(212, 175, 55, 0.3);
}

.rune-circle.ring-outer {
  width: 100%;
  height: 100%;
  border-style: double;
  border-width: 3px;
  border-color: rgba(212, 175, 55, 0.4);
  animation: spinCW 25s linear infinite;
}

.rune-circle.ring-middle {
  width: 82%;
  height: 82%;
  border-style: dashed;
  border-color: rgba(139, 92, 246, 0.4);
  animation: spinCCW 18s linear infinite;
}

.rune-circle.ring-inner {
  width: 64%;
  height: 64%;
  border-style: dotted;
  border-color: rgba(212, 175, 55, 0.5);
  animation: spinCW 12s linear infinite;
}

@keyframes spinCW {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

@keyframes spinCCW {
  from { transform: rotate(360deg); }
  to { transform: rotate(0deg); }
}

.seal-button {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  background: radial-gradient(circle, #2e1065 0%, #0f052d 100%);
  border: 2px solid var(--gold-glowing);
  box-shadow: 
    0 0 25px rgba(139, 92, 246, 0.5),
    inset 0 0 15px rgba(212, 175, 55, 0.3);
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  color: var(--gold-glowing);
  font-size: 1.4rem;
  gap: 4px;
  transition: all 0.4s cubic-bezier(0.25, 0.8, 0.25, 1);
  z-index: 5;
}

.seal-button span {
  font-size: 0.58rem;
  font-weight: 700;
  letter-spacing: 1px;
  font-family: var(--font-kr);
}

.seal-container:hover .seal-button {
  transform: scale(1.1);
  box-shadow: 
    0 0 35px rgba(212, 175, 55, 0.7),
    inset 0 0 20px rgba(139, 92, 246, 0.5);
  color: #fff;
  border-color: #fff;
}

/* ==========================================
   MAIN DASHBOARD APPLICATION CONTAINER
   ========================================== */

.app-container {
  width: 100%;
  max-width: 680px;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  padding: 24px;
  position: relative;
  z-index: 2;
}

/* Header */
.app-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 0 20px 0;
  border-bottom: 1px dashed rgba(212, 175, 55, 0.15);
  margin-bottom: 30px;
}

.logo {
  display: flex;
  align-items: center;
  gap: 12px;
  font-family: var(--font-en);
  font-weight: 700;
  font-size: 1.3rem;
  letter-spacing: 2px;
  color: #fff;
}

.logo-icon {
  color: var(--gold-glowing);
  filter: drop-shadow(0 0 8px rgba(212, 175, 55, 0.4));
}

.highlight {
  color: var(--gold-glowing);
  text-shadow: 0 0 10px rgba(212, 175, 55, 0.3);
}

.header-controls {
  display: flex;
  gap: 10px;
}

.icon-btn {
  background: rgba(11, 6, 20, 0.8);
  border: 1px solid var(--border-magic);
  color: var(--gold-glowing);
  width: 40px;
  height: 40px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  justify-content: center;
  align-items: center;
  font-size: 1rem;
  transition: all 0.25s ease;
  position: relative;
  box-shadow: inset 0 0 8px rgba(212,175,55,0.05);
}

.icon-btn:hover {
  background: rgba(212, 175, 55, 0.15);
  border-color: var(--gold-glowing);
  color: #fff;
  transform: translateY(-1px);
}

.badge {
  position: absolute;
  top: -2px;
  right: -2px;
  background: var(--gold-glowing);
  color: #000;
  font-size: 0.65rem;
  font-weight: 900;
  min-width: 15px;
  height: 15px;
  border-radius: 50%;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 0 3px;
  font-family: var(--font-en);
}

/* Screen Panels (Ancient Stone Slab Grimoire) */
.screen-panel {
  display: none;
  flex-direction: column;
  justify-content: center;
  background: var(--bg-panel);
  border: 1px solid var(--border-magic);
  border-radius: 12px;
  padding: 40px 30px;
  box-shadow: 
    0 20px 50px rgba(0, 0, 0, 0.9),
    inset 0 0 30px rgba(139, 92, 246, 0.05);
  position: relative;
  overflow: hidden;
  animation: slideIn 0.5s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.screen-panel.active {
  display: flex;
}

@keyframes slideIn {
  from {
    opacity: 0;
    transform: translateY(15px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.panel-header {
  text-align: center;
  margin-bottom: 35px;
  position: relative;
}

/* Classical Runic Dividers */
.panel-header::after {
  content: '✥  ✥  ✥';
  display: block;
  font-size: 0.65rem;
  color: var(--border-magic);
  letter-spacing: 6px;
  margin-top: 15px;
  opacity: 0.8;
}

.sub-title {
  font-family: var(--font-en);
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--gold-glowing);
  letter-spacing: 4px;
  display: inline-block;
  margin-bottom: 10px;
}

.main-title {
  font-family: var(--font-kr);
  font-size: 1.85rem;
  font-weight: 900;
  letter-spacing: -0.5px;
  margin-bottom: 10px;
  background: linear-gradient(180deg, #ffffff 0%, #b9b6c0 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.description {
  font-size: 0.88rem;
  color: var(--text-muted);
  line-height: 1.7;
  max-width: 440px;
  margin: 0 auto;
}

/* ==========================================
   BUTTONS (Ancient Metal & Glowing Crystals)
   ========================================== */

.btn {
  font-family: var(--font-kr);
  font-weight: 700;
  font-size: 0.95rem;
  padding: 13px 25px;
  border-radius: 6px;
  cursor: pointer;
  display: inline-flex;
  justify-content: center;
  align-items: center;
  gap: 10px;
  transition: all 0.25s cubic-bezier(0.25, 0.8, 0.25, 1);
  border: none;
  outline: none;
}

.btn-primary {
  background: linear-gradient(135deg, #d4af37 0%, #785a08 100%);
  color: #000;
  border: 1px solid rgba(255, 255, 255, 0.15);
  box-shadow: 0 4px 15px rgba(212, 175, 55, 0.25);
  text-shadow: 0 0 1px rgba(255,255,255,0.2);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(212, 175, 55, 0.5);
  background: linear-gradient(135deg, #f3cd57 0%, #906d0c 100%);
}

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

.btn-secondary {
  background: linear-gradient(135deg, #7c3aed 0%, #3b0764 100%);
  color: #fff;
  border: 1px solid rgba(212, 175, 55, 0.2);
  box-shadow: 0 4px 15px rgba(124, 58, 237, 0.25);
}

.btn-secondary:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(124, 58, 237, 0.5);
  border-color: var(--gold-glowing);
}

.btn-glow {
  position: relative;
  overflow: hidden;
}

.btn-glow::after {
  content: '';
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: linear-gradient(45deg, transparent, rgba(255, 255, 255, 0.15), transparent);
  transform: rotate(45deg);
  animation: shineBtn 5s infinite linear;
}

@keyframes shineBtn {
  0% { transform: translate(-30%, -30%) rotate(45deg); }
  50% { transform: translate(30%, 30%) rotate(45deg); }
  100% { transform: translate(-30%, -30%) rotate(45deg); }
}

.btn-large {
  padding: 15px 30px;
  font-size: 1.05rem;
  width: 100%;
  letter-spacing: 1px;
}

.btn-outline {
  background: rgba(6, 3, 12, 0.7);
  border: 1px solid var(--border-magic);
  color: var(--gold-glowing);
}

.btn-outline:hover {
  background: rgba(212, 175, 55, 0.05);
  color: #fff;
  border-color: var(--gold-glowing);
}

.btn-danger {
  background: rgba(127, 29, 29, 0.2);
  border: 1px solid rgba(239, 68, 68, 0.3);
  color: #f87171;
}

.btn-danger:hover {
  background: rgba(127, 29, 29, 0.4);
  border-color: #ef4444;
}

/* ==========================================
   SCREEN 1: GRADE LOTTERY (Stone Dial Frame)
   ========================================== */

.grade-slot-container {
  width: 180px;
  height: 180px;
  margin: 10px auto 40px auto;
  position: relative;
  background: #030107;
  border: 2px solid var(--border-magic);
  border-radius: 50%; /* Mystical Sphere Shape */
  box-shadow: 
    inset 0 10px 30px rgba(0, 0, 0, 0.95),
    0 0 25px rgba(139, 92, 246, 0.15),
    0 10px 25px rgba(0, 0, 0, 0.6);
  overflow: hidden;
  display: flex;
  justify-content: center;
  align-items: center;
}

.grade-scanner-line {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--gold-glowing), transparent);
  box-shadow: 0 0 10px var(--gold-glowing);
  z-index: 5;
  animation: scanLoop 4s ease-in-out infinite;
}

@keyframes scanLoop {
  0% { top: 8%; }
  50% { top: 92%; }
  100% { top: 8%; }
}

.grade-slot-frame {
  width: 100%;
  height: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
}

.grade-slot-wrapper {
  width: 100%;
  height: 140px;
  overflow: hidden;
  position: relative;
}

.grade-reel {
  display: flex;
  flex-direction: column;
  position: absolute;
  width: 100%;
  left: 0;
  top: 0;
}

.grade-reel.stopping {
  transition: transform 3.5s cubic-bezier(0.1, 0.85, 0.25, 1.01);
}

.grade-item {
  height: 140px;
  width: 100%;
  font-family: var(--font-en);
  font-size: 4.8rem;
  font-weight: 700;
  display: flex;
  justify-content: center;
  align-items: center;
  transform: scale(0.92);
}

.grade-item.item-S { color: var(--s-color); text-shadow: var(--s-glow); }
.grade-item.item-A { color: var(--a-color); text-shadow: var(--a-glow); }
.grade-item.item-B { color: var(--b-color); text-shadow: var(--b-glow); }
.grade-item.item-C { color: var(--c-color); text-shadow: var(--c-glow); }
.grade-item.item-D { color: var(--d-color); text-shadow: var(--d-glow); }
.grade-item.item-F { color: var(--f-color); text-shadow: var(--f-glow); }

/* ==========================================
   SCREEN 2: RUNE SLOT PILLARS (Parchment Slots)
   ========================================== */

.power-slot-machine {
  position: relative;
  background: #030107;
  border: 1px solid var(--border-magic);
  border-radius: 12px;
  padding: 20px 16px;
  margin-bottom: 30px;
  box-shadow: inset 0 10px 40px rgba(0, 0, 0, 0.95);
  overflow: hidden;
}

.slot-glass-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(
    180deg,
    rgba(0, 0, 0, 0.85) 0%,
    transparent 15%,
    transparent 85%,
    rgba(0, 0, 0, 0.85) 100%
  );
  z-index: 5;
  pointer-events: none;
}

.reels-container {
  display: flex;
  gap: 12px;
}

.reel-box {
  flex: 1;
  background: rgba(10, 5, 20, 0.96);
  border: 1px solid rgba(212, 175, 55, 0.15);
  border-radius: 8px;
  padding: 8px 4px;
  display: flex;
  flex-direction: column;
  align-items: center;
  box-shadow: 0 4px 20px rgba(0,0,0,0.8);
}

.reel-box-double {
  flex: 1.6;
}

.reel-header {
  font-family: var(--font-kr);
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--gold-glowing);
  margin-bottom: 8px;
  letter-spacing: 0.5px;
  border-bottom: 1px dashed rgba(212,175,55,0.15);
  width: 100%;
  text-align: center;
  padding-bottom: 6px;
  opacity: 0.8;
}

.reel-viewport {
  height: 110px;
  width: 100%;
  overflow: hidden;
  position: relative;
}

.reel-strip {
  display: flex;
  flex-direction: column;
  position: absolute;
  width: 100%;
  left: 0;
  top: 0;
}

.reel-strip.blur {
  filter: blur(4px) brightness(1.2);
}

.reel-cell {
  height: 110px;
  width: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
  text-align: center;
  font-family: var(--font-kr);
  font-size: 0.85rem;
  font-weight: 500;
  line-height: 1.45;
  padding: 0 8px;
  color: #cbd5e1;
}

/* ==========================================
   SCREEN 3: MAGIC DEGREE CARD & RESULTS
   ========================================== */

.card-display-container {
  perspective: 1200px;
  margin: 10px auto 30px auto;
  width: 100%;
  max-width: 440px;
}

.id-card {
  width: 100%;
  aspect-ratio: 1.58 / 1;
  border-radius: 12px;
  position: relative;
  overflow: hidden;
  padding: 1.5px;
  background: var(--gold-glowing);
  box-shadow: 
    0 25px 50px rgba(0, 0, 0, 0.9),
    0 0 25px var(--card-theme-color, rgba(139, 92, 246, 0.25));
  transition: transform 0.6s cubic-bezier(0.16, 1, 0.3, 1);
  transform-style: preserve-3d;
}

.card-glow-layer {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 1;
  pointer-events: none;
  opacity: 0.15;
  background: radial-gradient(circle, var(--card-theme-color) 0%, transparent 80%);
}

.card-content {
  background: #05020c;
  width: 100%;
  height: 100%;
  border-radius: 11px;
  padding: 16px 20px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  position: relative;
  z-index: 2;
  border: 1px solid rgba(255, 255, 255, 0.02);
}

/* Filigree corners for fantasy certificate look */
.card-content::before {
  content: '';
  position: absolute;
  top: 6px;
  left: 6px;
  width: 10px;
  height: 10px;
  border-top: 1.5px solid var(--card-theme-color, var(--gold-glowing));
  border-left: 1.5px solid var(--card-theme-color, var(--gold-glowing));
  pointer-events: none;
}

.card-content::after {
  content: '';
  position: absolute;
  bottom: 6px;
  right: 6px;
  width: 10px;
  height: 10px;
  border-bottom: 1.5px solid var(--card-theme-color, var(--gold-glowing));
  border-right: 1.5px solid var(--card-theme-color, var(--gold-glowing));
  pointer-events: none;
}

/* Card Header */
.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1.5px solid var(--card-theme-color, rgba(212, 175, 55, 0.2));
  padding-bottom: 6px;
}

.card-org {
  display: flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-kr);
  font-size: 0.72rem;
  font-weight: 800;
  color: var(--text-muted);
  letter-spacing: 0.5px;
}

.card-org i {
  color: var(--card-theme-color, var(--gold-glowing));
}

.card-serial {
  font-family: var(--font-en);
  font-size: 0.65rem;
  font-weight: 700;
  color: #4b5563;
  letter-spacing: 1px;
}

/* Card Body */
.card-body {
  display: flex;
  gap: 16px;
  margin: 8px 0;
  flex: 1;
}

.card-profile-area {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 80px;
}

.avatar-box {
  width: 70px;
  height: 70px;
  background: rgba(0, 0, 0, 0.7);
  border: 1.5px solid var(--card-theme-color, var(--border-magic));
  border-radius: 5px;
  display: flex;
  justify-content: center;
  align-items: center;
  box-shadow: inset 0 2px 10px rgba(0,0,0,0.9);
}

.avatar-emblem {
  font-size: 1.8rem;
  color: var(--card-theme-color, var(--gold-glowing));
  filter: drop-shadow(0 0 8px var(--card-theme-color));
}

.user-meta {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
  margin-top: 6px;
}

.meta-label {
  font-family: var(--font-kr);
  font-size: 0.58rem;
  color: #5b677a;
  font-weight: 700;
  letter-spacing: 0.5px;
}

.meta-value {
  font-size: 0.88rem;
  font-weight: 800;
  color: #fff;
  max-width: 80px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  text-align: center;
}

.meta-grade-badge {
  font-family: var(--font-en);
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--card-theme-color, var(--gold-glowing));
  text-shadow: 0 0 8px var(--card-theme-color);
}

.card-power-details {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 8px;
  background: rgba(0,0,0,0.5);
  border-radius: 6px;
  padding: 8px 12px;
  border: 1px solid rgba(212,175,55,0.06);
}

.power-detail-row {
  display: flex;
  flex-direction: column;
}

.detail-label {
  font-family: var(--font-kr);
  font-size: 0.58rem;
  font-weight: 700;
  color: #5b677a;
  letter-spacing: 0.3px;
  margin-bottom: 2px;
}

.detail-value {
  font-size: 0.78rem;
  font-weight: 500;
  line-height: 1.4;
  color: #e2e8f0;
}

.detail-value.text-glow {
  color: #fff;
}

.detail-value.text-highlight {
  color: var(--card-theme-color, var(--gold-glowing));
  font-weight: 700;
}

.detail-value.text-warning {
  color: #f87171;
}

/* Card Footer */
.card-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-top: 1px dashed rgba(212, 175, 55, 0.15);
  padding-top: 6px;
  font-size: 0.6rem;
  color: #4b5563;
  font-family: var(--font-en);
}

.card-stamp {
  font-weight: 700;
  letter-spacing: 1px;
  color: var(--card-theme-color, var(--gold-glowing));
  opacity: 0.8;
}

/* Controls and Grid Layouts */
.control-actions {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 10px;
}

.result-actions {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-bottom: 20px;
}

.btn-action {
  background: rgba(11, 6, 20, 0.7);
  border: 1px solid var(--border-magic);
  color: var(--gold-glowing);
  font-size: 0.85rem;
  padding: 10px 14px;
}

.btn-action:hover {
  background: rgba(212, 175, 55, 0.1);
  border-color: var(--gold-glowing);
  color: #fff;
}

.navigation-actions {
  display: flex;
  gap: 10px;
}

.navigation-actions .btn {
  flex: 1;
}

/* ==========================================
   ARCHIVE DRAWER (Magic Grimoire Storage)
   ========================================== */

.archive-drawer {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 1000;
  pointer-events: none;
}

.archive-drawer.active {
  pointer-events: auto;
}

.drawer-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(4px);
  opacity: 0;
  transition: opacity 0.4s ease;
}

.archive-drawer.active .drawer-overlay {
  opacity: 1;
}

.drawer-content {
  position: absolute;
  top: 0;
  right: -360px;
  width: 100%;
  max-width: 360px;
  height: 100%;
  background: #07040d;
  border-left: 1px solid var(--border-magic);
  box-shadow: -10px 0 40px rgba(0, 0, 0, 0.95);
  display: flex;
  flex-direction: column;
  padding: 24px;
  transition: right 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.archive-drawer.active .drawer-content {
  right: 0;
}

.drawer-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px dashed var(--border-magic);
  padding-bottom: 14px;
  margin-bottom: 20px;
}

.drawer-header h2 {
  font-family: var(--font-kr);
  font-size: 1.15rem;
  font-weight: 800;
  color: #fff;
  display: flex;
  align-items: center;
  gap: 8px;
}

.drawer-header h2 i {
  color: var(--gold-glowing);
}

.close-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 1.8rem;
  cursor: pointer;
  line-height: 1;
  transition: color 0.2s;
}

.close-btn:hover {
  color: #fff;
}

.drawer-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 20px;
}

.stat-item {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.03);
  padding: 10px;
  border-radius: 6px;
  text-align: center;
}

.stat-num {
  display: block;
  font-size: 1.35rem;
  font-family: var(--font-en);
  font-weight: 700;
  color: #fff;
}

.stat-num.s-text {
  color: var(--s-color);
  text-shadow: 0 0 8px rgba(255, 215, 0, 0.3);
}

.stat-label {
  font-size: 0.65rem;
  color: var(--text-muted);
  font-weight: 700;
}

.drawer-filters {
  display: flex;
  gap: 5px;
  overflow-x: auto;
  padding-bottom: 8px;
  margin-bottom: 16px;
}

.drawer-filters::-webkit-scrollbar {
  height: 3px;
}

.filter-tab {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.04);
  color: var(--text-muted);
  padding: 5px 12px;
  border-radius: 4px;
  font-size: 0.72rem;
  cursor: pointer;
  font-family: var(--font-en);
  font-weight: 700;
  transition: all 0.2s;
  flex-shrink: 0;
}

.filter-tab.active, .filter-tab:hover {
  background: var(--gold-glowing);
  color: #000;
  border-color: var(--gold-glowing);
}

.archive-list-wrapper {
  flex: 1;
  overflow-y: auto;
  margin-bottom: 20px;
  padding-right: 4px;
}

.archive-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.empty-archive {
  text-align: center;
  color: var(--text-muted);
  padding: 60px 10px;
}

.empty-archive i {
  font-size: 2.2rem;
  margin-bottom: 12px;
  opacity: 0.5;
  color: var(--gold-glowing);
}

.empty-archive p {
  font-size: 0.8rem;
  line-height: 1.6;
}

/* Individual Saved Card Item in Grimoire Drawer */
.archive-card {
  background: rgba(255,255,255,0.02);
  border: 1px solid rgba(255,255,255,0.04);
  border-left: 3px solid var(--card-theme-color, var(--primary));
  border-radius: 6px;
  padding: 12px;
  cursor: pointer;
  position: relative;
  transition: all 0.25s;
  box-shadow: 0 4px 10px rgba(0,0,0,0.2);
}

.archive-card:hover {
  background: rgba(255,255,255,0.04);
  border-color: var(--card-theme-color);
  transform: translateY(-1px);
}

.archive-card-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
}

.archive-card-grade {
  font-family: var(--font-en);
  font-size: 0.65rem;
  font-weight: 800;
  color: var(--card-theme-color);
  letter-spacing: 0.5px;
}

.archive-card-name {
  font-size: 0.72rem;
  color: #fff;
  font-weight: 700;
}

.archive-card-text {
  font-size: 0.78rem;
  color: #cbd5e1;
  line-height: 1.4;
  margin-bottom: 6px;
}

.archive-card-side {
  font-size: 0.7rem;
  color: #f87171;
  background: rgba(239, 68, 68, 0.05);
  padding: 3px 6px;
  border-radius: 3px;
  display: inline-block;
  margin-bottom: 6px;
}

.archive-card-date {
  font-size: 0.58rem;
  color: #4b5563;
  font-family: var(--font-en);
}

.archive-card-delete {
  position: absolute;
  top: 10px;
  right: 10px;
  background: transparent;
  border: none;
  color: rgba(239, 68, 68, 0.35);
  cursor: pointer;
  padding: 5px;
  border-radius: 4px;
  transition: all 0.2s;
}

.archive-card-delete:hover {
  color: #ef4444;
  background: rgba(239, 68, 68, 0.1);
}

.drawer-footer {
  border-top: 1px dashed var(--border-magic);
  padding-top: 12px;
}

/* ==========================================
   TOAST NOTIFICATIONS & AUXILIARY
   ========================================== */

.toast-container {
  position: fixed;
  bottom: 25px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 10000;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.toast {
  background: rgba(6, 3, 12, 0.96);
  border: 1.5px solid var(--gold-glowing);
  box-shadow: 
    0 10px 25px rgba(0,0,0,0.8), 
    0 0 15px rgba(212, 175, 55, 0.15);
  color: #fff;
  padding: 10px 20px;
  border-radius: 6px;
  font-size: 0.82rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 8px;
  animation: slideToast 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.2) forwards;
}

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

.toast.toast-fadeOut {
  animation: fadeToastOut 0.25s ease forwards;
}

@keyframes fadeToastOut {
  to { opacity: 0; transform: translateY(-5px) scale(0.95); }
}

.toast-icon {
  color: var(--gold-glowing);
}

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

/* ==========================================
   INTERACTION ENHANCEMENT: GLITCH/SHAKE FEEDBACK
   ========================================== */

@keyframes glitchShake {
  0% { transform: translate(0, 0) skew(0deg); }
  20% { transform: translate(-2px, 1px) skew(-0.5deg); }
  40% { transform: translate(1px, -1px) skew(0.5deg); }
  60% { transform: translate(-1px, 1.5px) skew(0deg); }
  80% { transform: translate(2px, -1px) skew(0.5deg); }
  100% { transform: translate(0, 0) skew(0deg); }
}

.glitch-click {
  animation: glitchShake 0.18s cubic-bezier(.25, .46, .45, .94) both;
}

/* PC/Desktop Layout Scaling Overrides (Enlarged PC Version) */
@media (min-width: 768px) {
  .app-container {
    max-width: 1250px;
    padding: 40px;
  }
  
  .screen-panel {
    padding: 60px 50px;
    border-radius: 16px;
  }

  .main-title {
    font-size: 2.6rem;
    margin-bottom: 16px;
  }

  .description {
    font-size: 1.05rem;
    max-width: 600px;
  }

  .grade-slot-container {
    width: 250px;
    height: 250px;
    margin-bottom: 50px;
  }

  .grade-slot-wrapper {
    height: 200px;
  }

  .grade-item {
    height: 200px;
    font-size: 7rem;
  }

  /* Enlarged Slot Columns */
  .power-slot-machine {
    padding: 30px 24px;
    margin-bottom: 40px;
  }

  .reels-container {
    gap: 20px;
  }

  .reel-box {
    padding: 15px 8px;
    border-radius: 12px;
  }

  .reel-header {
    font-size: 0.95rem;
    padding-bottom: 10px;
    margin-bottom: 12px;
  }

  .reel-viewport {
    height: 165px;
  }

  .reel-cell {
    height: 165px;
    font-size: 1.25rem;
    line-height: 1.5;
    padding: 0 16px;
  }

  /* Enlarged ID Card Scroll */
  .card-display-container {
    max-width: 580px;
    margin: 25px auto 45px auto;
  }

  .id-card {
    border-radius: 16px;
  }

  .card-content {
    padding: 24px 32px;
    border-radius: 15px;
  }

  .card-content::before, .card-content::after {
    width: 16px;
    height: 16px;
    border-width: 2.5px;
  }

  .card-org {
    font-size: 0.85rem;
    gap: 8px;
  }

  .card-serial {
    font-size: 0.78rem;
  }

  .card-body {
    gap: 24px;
    margin: 16px 0;
  }

  .card-profile-area {
    width: 110px;
  }

  .avatar-box {
    width: 95px;
    height: 95px;
    border-radius: 8px;
  }

  .avatar-emblem {
    font-size: 2.5rem;
  }

  .user-meta {
    margin-top: 10px;
  }

  .meta-label {
    font-size: 0.72rem;
  }

  .meta-value {
    font-size: 1.15rem;
    max-width: 110px;
  }

  .meta-grade-badge {
    font-size: 1.8rem;
  }

  .card-power-details {
    padding: 16px 20px;
    border-radius: 10px;
    gap: 12px;
  }

  .detail-label {
    font-size: 0.7rem;
    margin-bottom: 4px;
  }

  .detail-value {
    font-size: 0.95rem;
    line-height: 1.45;
  }

  .detail-value.text-warning {
    font-size: 0.9rem;
  }

  .card-footer {
    font-size: 0.72rem;
    padding-top: 10px;
  }

  .btn-spin-slot {
    font-size: 0.95rem !important;
    padding: 12px 16px !important;
    margin-top: 15px !important;
  }
}

/* Disabled buttons styling */
.btn:disabled {
  background: rgba(255, 255, 255, 0.02) !important;
  border: 1px solid rgba(255, 255, 255, 0.03) !important;
  color: #4b5563 !important;
  cursor: not-allowed;
  box-shadow: none !important;
  transform: none !important;
  opacity: 0.65;
}

.btn-spin-slot {
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.4);
  letter-spacing: 0.5px;
  transition: all 0.2s ease;
  background: rgba(124, 58, 237, 0.1);
  border: 1px solid rgba(139, 92, 246, 0.2);
  color: var(--primary);
}

.btn-spin-slot:hover:not(:disabled) {
  background: linear-gradient(135deg, #8b5cf6 0%, #6d28d9 100%);
  box-shadow: 0 6px 15px rgba(139, 92, 246, 0.35);
  border-color: var(--primary);
  color: #fff;
  transform: translateY(-1px);
}

/* Footer Credits Styles */
.app-footer {
  margin-top: auto;
  padding: 30px 0 10px 0;
  text-align: center;
  font-family: var(--font-en);
  font-size: 0.72rem;
  letter-spacing: 1.5px;
  color: #4b5563;
  border-top: 1px dashed rgba(212, 175, 55, 0.15);
  z-index: 1;
  pointer-events: none; /* Let clicks pass through to navigation buttons underneath */
}

.app-footer a {
  pointer-events: auto; /* Keep composer profile links clickable */
}

.credit-line {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 12px;
  margin-bottom: 6px;
}

.author {
  color: var(--gold-glowing);
  font-weight: 800;
  text-shadow: 0 0 8px rgba(212, 175, 55, 0.2);
}

.composer-link {
  color: var(--primary);
  text-decoration: none;
  font-weight: 800;
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.composer-link:hover {
  color: var(--accent);
  text-shadow: 0 0 10px var(--accent);
}

.link-icon {
  font-size: 0.6rem;
}

.version-tag {
  font-size: 0.6rem;
  color: #374151;
  font-weight: 600;
}

/* ==========================================
   RESPONSIVE DESIGN SYSTEM (MOBILE ADAPTATION)
   ========================================== */

@media (max-width: 480px) {
  .app-container { padding: 10px; }
  .screen-panel { padding: 25px 15px; border-radius: 10px; }
  .main-title { font-size: 1.4rem; }
  
  .reels-container { flex-direction: column; gap: 10px; }
  .reel-box-double { flex: none; }
  .reel-viewport { height: 75px; }
  .reel-cell { height: 75px; font-size: 0.8rem; }
  
  .card-body { flex-direction: column; gap: 10px; align-items: center; }
  .card-profile-area {
    flex-direction: row;
    width: 100%;
    justify-content: space-around;
    border-bottom: 1px dashed rgba(212, 175, 55, 0.15);
    padding-bottom: 6px;
  }
  .avatar-box { width: 55px; height: 55px; }
  .avatar-emblem { font-size: 1.5rem; }
  .user-meta { align-items: flex-start; margin-top: 0; width: auto; }
  .meta-value { text-align: left; }
  
  .id-card { aspect-ratio: auto; height: auto; }
  .card-content { padding: 12px; gap: 8px; }
  .card-power-details { padding: 6px; }
  
  .result-actions { grid-template-columns: 1fr; gap: 6px; }
  .btn-action { flex-direction: row; justify-content: center; align-items: center; padding: 10px; }
}
