/**
 * Pixel UI Components - Authentic Retro Style
 * NES, SNES, PS1 - True to hardware limitations
 * No gradients, no soft shadows, pixel-perfect borders
 */

/* ============================================
   PIXEL PANEL - Classic JRPG Window
   Inspired by FF6, Dragon Quest, Chrono Trigger
   ============================================ */

.pixel-panel {
  background: var(--panel-bg);
  position: relative;
  padding: var(--panel-padding);
  image-rendering: pixelated;
  image-rendering: crisp-edges;

  /* Classic 4-layer JRPG border - outer to inner */
  border: 4px solid var(--window-frame);
  outline: 4px solid var(--window-outer);
  outline-offset: -4px;
  box-shadow:
    /* Inner highlight (top-left) */
    inset 4px 4px 0 var(--window-highlight),
    /* Inner shadow (bottom-right) */
    inset -4px -4px 0 var(--window-shadow),
    /* Drop shadow */
    8px 8px 0 #000000;
}

/* Corner decorations - FF6 style dots */
.pixel-panel::before,
.pixel-panel::after {
  content: "";
  position: absolute;
  width: 8px;
  height: 8px;
  background: var(--window-highlight);
}

.pixel-panel::before {
  top: 4px;
  left: 4px;
}

.pixel-panel::after {
  bottom: 4px;
  right: 4px;
  background: var(--window-shadow);
}

/* Interactive panel - simple offset on hover */
.pixel-panel-interactive {
  transition: transform var(--transition-instant);
}

.pixel-panel-interactive:hover {
  transform: translate(-2px, -2px);
}

.pixel-panel-interactive:active {
  transform: translate(2px, 2px);
}

/* Panel with title bar - classic RPG menu header */
.pixel-panel-titled {
  padding-top: calc(var(--panel-padding) + 2rem);
}

.pixel-panel-title {
  position: absolute;
  top: 8px;
  left: 16px;
  padding: 4px 12px;
  background: var(--bg-darkest);
  border: 2px solid var(--window-frame);
  font-family: var(--font-pixel);
  font-size: var(--font-size-sm);
  color: var(--text-highlight);
  text-transform: uppercase;
  letter-spacing: 2px;
  text-shadow: 2px 2px 0 #000000;
  z-index: 1;
}

/* ============================================
   PIXEL BUTTONS - Classic SNES/PS1 style
   Hard edges, no gradients, clear states
   ============================================ */

.pixel-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-sm);
  padding: 8px 16px;
  font-family: var(--font-pixel);
  font-size: var(--font-size-sm);
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-primary);
  cursor: pointer;
  position: relative;
  image-rendering: pixelated;
  
  /* Classic beveled button look */
  background: var(--bg-light);
  border: 4px solid var(--bg-lighter);
  border-right-color: var(--bg-darkest);
  border-bottom-color: var(--bg-darkest);
  box-shadow: 
    inset -2px -2px 0 var(--bg-dark),
    inset 2px 2px 0 var(--bg-lighter);
}

/* Selection cursor indicator */
.pixel-btn::before {
  content: "";
  position: absolute;
  left: -20px;
  top: 50%;
  transform: translateY(-50%);
  width: 0;
  height: 0;
  border-top: 6px solid transparent;
  border-bottom: 6px solid transparent;
  border-left: 8px solid var(--text-highlight);
  opacity: 0;
  transition: opacity var(--transition-instant);
}

.pixel-btn:hover::before,
.pixel-btn:focus::before {
  opacity: 1;
}

.pixel-btn:hover {
  background: var(--bg-lighter);
  color: var(--text-highlight);
}

.pixel-btn:active {
  /* Pressed state - invert the bevel */
  border-color: var(--bg-darkest);
  border-right-color: var(--bg-lighter);
  border-bottom-color: var(--bg-lighter);
  box-shadow: 
    inset 2px 2px 0 var(--bg-dark),
    inset -2px -2px 0 var(--bg-lighter);
  padding: 10px 14px 6px 18px;
}

.pixel-btn:disabled {
  color: var(--text-disabled);
  cursor: not-allowed;
  background: var(--bg-dark);
}

.pixel-btn:disabled::before {
  display: none;
}

/* Primary button (action) - solid color, classic RPG */
.pixel-btn-primary {
  background: var(--accent-primary);
  border-color: var(--accent-primary-light);
  border-right-color: var(--accent-primary-dark);
  border-bottom-color: var(--accent-primary-dark);
  color: #ffffff;
  text-shadow: 2px 2px 0 #000000;
  box-shadow: 
    inset -2px -2px 0 var(--accent-primary-dark),
    inset 2px 2px 0 var(--accent-primary-light);
}

.pixel-btn-primary:hover {
  background: var(--accent-primary-light);
}

.pixel-btn-primary:active {
  background: var(--accent-primary-dark);
}

/* Success button - heal/confirm green */
.pixel-btn-success {
  background: var(--accent-success);
  border-color: var(--accent-success-light);
  border-right-color: var(--accent-success-dark);
  border-bottom-color: var(--accent-success-dark);
  color: #ffffff;
  text-shadow: 2px 2px 0 #000000;
  box-shadow: 
    inset -2px -2px 0 var(--accent-success-dark),
    inset 2px 2px 0 var(--accent-success-light);
}

.pixel-btn-success:hover {
  background: var(--accent-success-light);
}

/* Secondary button - gold/coin colored */
.pixel-btn-secondary {
  background: var(--accent-secondary);
  border-color: var(--accent-secondary-light);
  border-right-color: var(--accent-secondary-dark);
  border-bottom-color: var(--accent-secondary-dark);
  color: #000000;
  text-shadow: none;
  box-shadow: 
    inset -2px -2px 0 var(--accent-secondary-dark),
    inset 2px 2px 0 var(--accent-secondary-light);
}

.pixel-btn-secondary:hover {
  background: var(--accent-secondary-light);
}

/* Ghost button - subtle but visible affordance */
.pixel-btn-ghost {
  background: var(--bg-dark);
  border: 2px solid var(--bg-medium);
  color: var(--text-secondary);
  box-shadow: none;
  padding: 8px 16px;
}

.pixel-btn-ghost:hover {
  background: var(--bg-medium);
  border-color: var(--window-frame);
  color: var(--text-highlight);
}

.pixel-btn-ghost:active {
  background: var(--bg-darkest);
  border-color: var(--bg-dark);
}

/* Large button */
.pixel-btn-lg {
  padding: var(--space-md) var(--space-xl);
  font-size: var(--font-size-md);
}

/* Icon button */
.pixel-btn-icon {
  padding: var(--space-sm);
  min-width: 40px;
  min-height: 40px;
}

/* ============================================
   PIXEL INPUTS - Inset retro text field
   ============================================ */

.pixel-input {
  width: 100%;
  padding: 8px 12px;
  font-family: var(--font-ui);
  font-size: var(--font-size-md);
  background: #000000;
  color: var(--text-primary);
  
  /* Inset border effect */
  border: 4px solid var(--bg-dark);
  border-top-color: var(--bg-darkest);
  border-left-color: var(--bg-darkest);
  box-shadow: 
    inset 2px 2px 0 #000000;
}

.pixel-input:hover {
  border-color: var(--bg-medium);
  border-top-color: var(--bg-dark);
  border-left-color: var(--bg-dark);
}

.pixel-input:focus {
  outline: none;
  border-color: var(--accent-info);
  background: #080818;
}

.pixel-input::placeholder {
  color: var(--text-muted);
}

/* Japanese text input (larger) */
.pixel-input-jp {
  font-family: var(--font-japanese);
  font-size: var(--font-size-jp-sm);
  padding: 12px 16px;
  text-align: center;
  letter-spacing: 4px;
}

/* ============================================
   PIXEL CARDS (Flashcards) - Classic JRPG window
   ============================================ */

.pixel-card {
  width: var(--card-width);
  height: var(--card-height);
  perspective: 1000px;
  cursor: pointer;
}

.pixel-card-inner {
  position: relative;
  width: 100%;
  height: 100%;
  transition: transform var(--transition-smooth);
  transform-style: preserve-3d;
}

.pixel-card.flipped .pixel-card-inner {
  transform: rotateY(180deg);
}

.pixel-card-front,
.pixel-card-back {
  position: absolute;
  width: 100%;
  height: 100%;
  backface-visibility: hidden;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--space-lg);
  
  /* Classic window style */
  background: var(--panel-bg);
  border: 4px solid var(--window-frame);
  outline: 4px solid var(--window-outer);
  outline-offset: -4px;
  box-shadow:
    inset 4px 4px 0 var(--window-highlight),
    inset -4px -4px 0 var(--window-shadow),
    8px 8px 0 #000000;
}

.pixel-card-back {
  transform: rotateY(180deg);
  /* Slightly different color to indicate back */
  background: var(--bg-medium);
}

.pixel-card-japanese {
  font-family: var(--font-japanese);
  font-size: var(--font-size-jp-xl);
  color: var(--text-japanese);
  text-shadow: 4px 4px 0 #000000;
}

.pixel-card-reading {
  font-family: var(--font-japanese);
  font-size: var(--font-size-jp-md);
  color: var(--text-secondary);
  margin-top: var(--space-sm);
  text-shadow: 2px 2px 0 #000000;
}

.pixel-card-meaning {
  font-family: var(--font-ui);
  font-size: var(--font-size-xl);
  color: var(--text-primary);
  margin-top: var(--space-md);
  text-shadow: 2px 2px 0 #000000;
}

/* Card states */
.pixel-card.correct {
  animation: card-correct 0.5s ease;
}

.pixel-card.incorrect {
  animation: card-shake 0.5s ease;
}

@keyframes card-correct {
  0%,
  100% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.05);
    box-shadow: var(--glow-success);
  }
}

@keyframes card-shake {
  0%,
  100% {
    transform: translateX(0);
  }
  20%,
  60% {
    transform: translateX(-10px);
  }
  40%,
  80% {
    transform: translateX(10px);
  }
}

/* ============================================
   PROGRESS BARS - Classic segmented HP/MP style
   ============================================ */

.pixel-progress {
  height: 20px;
  background: #000000;
  border: 4px solid var(--bg-dark);
  border-top-color: var(--bg-darkest);
  border-left-color: var(--bg-darkest);
  position: relative;
  overflow: hidden;
  box-shadow: inset 2px 2px 0 #000000;
}

.pixel-progress-bar {
  height: 100%;
  background: var(--xp-bar);
  position: relative;
  transition: width 100ms steps(10);
  
  /* Classic highlight stripe */
  box-shadow: inset 0 4px 0 rgba(255, 255, 255, 0.3);
}

/* No animations - keep it retro */
.pixel-progress-bar::before,
.pixel-progress-bar::after {
  display: none;
}

/* Segmented progress bar - true to SNES/PS1 */
.pixel-progress-segmented {
  display: flex;
  gap: 2px;
  padding: 2px;
  background: #000000;
  border: 4px solid var(--bg-dark);
  border-top-color: var(--bg-darkest);
  border-left-color: var(--bg-darkest);
}

.pixel-progress-segment {
  flex: 1;
  height: 12px;
  background: var(--bg-darkest);
  border: 2px solid #000000;
}

.pixel-progress-segment.filled {
  background: var(--xp-bar);
  box-shadow: inset 0 2px 0 rgba(255, 255, 255, 0.4);
}

/* HP style - green */
.pixel-progress-hp .pixel-progress-bar,
.pixel-progress-hp .pixel-progress-segment.filled {
  background: var(--accent-success);
}

/* MP style - blue/purple */
.pixel-progress-mp .pixel-progress-bar,
.pixel-progress-mp .pixel-progress-segment.filled {
  background: var(--accent-mp);
}

/* EXP style - yellow */
.pixel-progress-exp .pixel-progress-bar,
.pixel-progress-exp .pixel-progress-segment.filled {
  background: var(--accent-exp);
}

/* XP Bar with level - Classic RPG status */
.xp-bar-container {
  display: flex;
  align-items: center;
  gap: var(--space-md);
}

.xp-bar-level {
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-darkest);
  font-family: var(--font-pixel);
  font-size: var(--font-size-lg);
  color: var(--text-highlight);
  text-shadow: 2px 2px 0 #000000;
  position: relative;
  
  /* Inset border */
  border: 4px solid var(--bg-medium);
  border-top-color: var(--bg-darkest);
  border-left-color: var(--bg-darkest);
}

.xp-bar-level::before {
  content: "LV";
  position: absolute;
  top: -12px;
  left: 50%;
  transform: translateX(-50%);
  font-size: var(--font-size-xs);
  color: var(--text-secondary);
  text-shadow: 1px 1px 0 #000000;
}

.xp-bar-wrapper {
  flex: 1;
}

.xp-bar-label {
  display: flex;
  justify-content: space-between;
  font-family: var(--font-pixel);
  font-size: var(--font-size-xs);
  color: var(--text-secondary);
  margin-bottom: 4px;
  text-shadow: 1px 1px 0 #000000;
}

/* ============================================
   BADGES & ICONS - 16-bit style
   ============================================ */

.pixel-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 8px;
  font-family: var(--font-pixel);
  font-size: var(--font-size-xs);
  background: var(--bg-light);
  border: 2px solid var(--bg-lighter);
  border-right-color: var(--bg-dark);
  border-bottom-color: var(--bg-dark);
  color: var(--text-secondary);
  text-shadow: 1px 1px 0 #000000;
}

.pixel-badge-primary {
  background: var(--accent-primary);
  border-color: var(--accent-primary-light);
  border-right-color: var(--accent-primary-dark);
  border-bottom-color: var(--accent-primary-dark);
  color: #ffffff;
}

.pixel-badge-success {
  background: var(--accent-success);
  border-color: var(--accent-success-light);
  border-right-color: var(--accent-success-dark);
  border-bottom-color: var(--accent-success-dark);
  color: #ffffff;
}

.pixel-badge-gold {
  background: var(--accent-secondary);
  border-color: var(--accent-secondary-light);
  border-right-color: var(--accent-secondary-dark);
  border-bottom-color: var(--accent-secondary-dark);
  color: #000000;
  text-shadow: none;
}

/* Coin display - Classic RPG gold counter */
.coin-display {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-pixel);
  font-size: var(--font-size-md);
  color: var(--coin-color);
  text-shadow: 2px 2px 0 #000000;
}

.coin-icon {
  width: 16px;
  height: 16px;
  background: var(--accent-secondary);
  border: 2px solid var(--accent-secondary-dark);
  /* Pixel-art octagon approximation instead of circle */
  clip-path: polygon(
    30% 0%, 70% 0%, 100% 30%, 100% 70%, 
    70% 100%, 30% 100%, 0% 70%, 0% 30%
  );
  box-shadow: 
    inset 2px 2px 0 var(--accent-secondary-light);
  /* No animations - retro static */
}

/* Streak flame - simple */
.streak-display {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-pixel);
  font-size: var(--font-size-md);
  color: var(--accent-secondary);
  text-shadow: 2px 2px 0 #000000;
}

/* ============================================
   MASTERY INDICATORS - Classic stat dots
   ============================================ */

.mastery-dots {
  display: flex;
  gap: 4px;
}

.mastery-dot {
  width: 12px;
  height: 12px;
  background: var(--mastery-0);
  border: 2px solid #000000;
  /* No rounded corners, no shadows - pure pixel */
}

.mastery-dot.level-1 {
  background: var(--mastery-1);
}

.mastery-dot.level-2 {
  background: var(--mastery-2);
}

.mastery-dot.level-3 {
  background: var(--mastery-3);
}

.mastery-dot.level-4 {
  background: var(--mastery-4);
}

.mastery-dot.level-5 {
  background: var(--mastery-5);
  /* Blinking animation for max level - classic RPG style */
  animation: blink-dot 0.5s steps(1) infinite;
}

@keyframes blink-dot {
  0%, 70% { background: var(--mastery-5); }
  71%, 100% { background: var(--mastery-4); }
}

/* ============================================
   NOTIFICATIONS & TOASTS
   ============================================ */

.pixel-notification {
  position: fixed;
  bottom: var(--space-xl);
  right: var(--space-xl);
  padding: var(--space-md) var(--space-lg);
  background: var(--panel-bg);
  border: var(--border-width) solid var(--panel-border-inner);
  box-shadow: var(--shadow-panel);
  z-index: var(--z-notification);
  animation: notification-in 0.3s ease;
}

.pixel-notification-success {
  border-color: var(--accent-success);
}

.pixel-notification-error {
  border-color: var(--accent-error);
}

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

/* ============================================
   AVATAR FRAMES - Classic character portrait
   ============================================ */

.pixel-avatar {
  width: 64px;
  height: 64px;
  background: #000000;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  overflow: hidden;
  
  /* Double border - classic RPG portrait frame */
  border: 4px solid var(--window-frame);
  outline: 4px solid #000000;
  outline-offset: -4px;
  box-shadow:
    inset 2px 2px 0 var(--window-highlight),
    inset -2px -2px 0 var(--window-shadow),
    4px 4px 0 #000000;
}

.pixel-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
}

.pixel-avatar-lg {
  width: 96px;
  height: 96px;
}

.pixel-avatar-xl {
  width: 128px;
  height: 128px;
}

/* ============================================
   DECORATIVE ELEMENTS
   ============================================ */

/* Corner decorations (FF6 style) */
.pixel-corners::before,
.pixel-corners::after {
  content: "";
  position: absolute;
  width: 12px;
  height: 12px;
  background: var(--panel-border-highlight);
}

.pixel-corners::before {
  top: -2px;
  left: -2px;
  border-right: 4px solid transparent;
  border-bottom: 4px solid transparent;
}

.pixel-corners::after {
  bottom: -2px;
  right: -2px;
  border-left: 4px solid transparent;
  border-top: 4px solid transparent;
}

/* Separator line */
.pixel-separator {
  height: 4px;
  background: linear-gradient(
    90deg,
    transparent 0%,
    var(--border-medium) 20%,
    var(--border-light) 50%,
    var(--border-medium) 80%,
    transparent 100%
  );
  margin: var(--space-md) 0;
}

/* Glowing text (for important items) */
.pixel-glow {
  text-shadow:
    0 0 5px currentColor,
    0 0 10px currentColor,
    0 0 20px currentColor;
}

/* Scanline overlay for extra retro feel */
.scanlines::after {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: repeating-linear-gradient(
    0deg,
    rgba(0, 0, 0, 0.1) 0px,
    rgba(0, 0, 0, 0.1) 1px,
    transparent 1px,
    transparent 2px
  );
  pointer-events: none;
}

/* ============================================
   AUDIO BUTTON - Retro square/beveled style
   ============================================ */

.audio-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  background: var(--bg-light);
  cursor: pointer;
  color: var(--text-primary);
  font-size: var(--font-size-lg);
  
  /* Classic beveled button - no rounded corners */
  border: 4px solid var(--bg-lighter);
  border-right-color: var(--bg-darkest);
  border-bottom-color: var(--bg-darkest);
  box-shadow: 
    inset -2px -2px 0 var(--bg-dark),
    inset 2px 2px 0 var(--bg-lighter);
}

.audio-btn:hover {
  background: var(--bg-lighter);
  color: var(--text-highlight);
}

.audio-btn:active {
  /* Pressed state - invert the bevel */
  border-color: var(--bg-darkest);
  border-right-color: var(--bg-lighter);
  border-bottom-color: var(--bg-lighter);
  box-shadow: 
    inset 2px 2px 0 var(--bg-dark),
    inset -2px -2px 0 var(--bg-lighter);
}

.audio-btn-lg {
  width: 48px;
  height: 48px;
  font-size: var(--font-size-xl);
}

.audio-btn-sm {
  width: 32px;
  height: 32px;
  font-size: var(--font-size-md);
}

.audio-btn-inline {
  width: 32px;
  height: 32px;
  font-size: var(--font-size-md);
  vertical-align: middle;
  margin-left: var(--space-sm);
}

.audio-btn.playing {
  background: var(--accent-success-dark);
  border-color: var(--accent-success);
  border-right-color: var(--accent-success-dark);
  border-bottom-color: var(--accent-success-dark);
  color: #ffffff;
  animation: blink-playing 0.5s steps(1) infinite;
}

@keyframes blink-playing {
  0%, 70% { opacity: 1; }
  71%, 100% { opacity: 0.7; }
}

/* ============================================
   SESSION COMPLETE STATS
   ============================================ */

.session-stats {
  display: flex;
  justify-content: center;
  gap: var(--space-xl);
  padding: var(--space-lg) 0;
}

.session-stat {
  text-align: center;
  min-width: 80px;
}

.session-stat-value {
  font-family: var(--font-pixel);
  font-size: var(--font-size-2xl);
  color: var(--text-highlight);
  text-shadow: 2px 2px 0 var(--border-dark);
}

.session-stat-label {
  font-size: var(--font-size-sm);
  color: var(--text-secondary);
  margin-top: var(--space-xs);
  text-transform: uppercase;
  letter-spacing: 1px;
}

/* ============================================
   STUDY HEADER
   ============================================ */

.study-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  max-width: 600px;
  margin-bottom: var(--space-lg);
  gap: var(--space-md);
}

.study-title {
  font-family: var(--font-pixel);
  font-size: var(--font-size-md);
  color: var(--text-highlight);
  text-shadow: 2px 2px 0 var(--border-dark);
}

.study-progress-info {
  font-family: var(--font-pixel);
  font-size: var(--font-size-sm);
  color: var(--text-secondary);
}

.study-hint {
  font-size: var(--font-size-sm);
  color: var(--text-muted);
  margin-top: var(--space-md);
  text-align: center;
}

/* ============================================
   FOCUS STATES (Keyboard Navigation)
   ============================================ */

.pixel-btn:focus-visible,
.pixel-input:focus-visible,
.action-card:focus-visible,
.nav-link:focus-visible,
.audio-btn:focus-visible {
  outline: 3px solid var(--accent-info);
  outline-offset: 2px;
  box-shadow: 0 0 0 6px rgba(0, 255, 245, 0.2);
}

/* ============================================
   QUIZ OPTION ENHANCEMENTS
   JRPG-style with number badges and cursor
   ============================================ */

/* Quiz option with number badge */
.quiz-option {
  position: relative;
}

/* Add number badges for keyboard hints */
.quiz-option::before {
  content: attr(data-key);
  position: absolute;
  top: -8px;
  left: -8px;
  width: 24px;
  height: 24px;
  background: linear-gradient(
    180deg,
    var(--bg-lighter) 0%,
    var(--bg-medium) 100%
  );
  border: 2px solid var(--border-light);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-pixel);
  font-size: var(--font-size-xs);
  color: var(--text-highlight);
  box-shadow: 1px 1px 0 var(--border-dark);
  z-index: 1;
}

/* Focus state with JRPG cursor */
.quiz-option:focus-visible {
  outline: none;
  border-color: var(--text-highlight);
  box-shadow:
    inset 2px 2px 0 var(--panel-border-highlight),
    inset -2px -2px 0 var(--border-dark),
    0 0 0 3px var(--text-highlight),
    5px 5px 0 var(--border-dark);
}

/* Pulsing arrow cursor for focused option */
.quiz-option:focus-visible::after {
  content: "\25B6";
  position: absolute;
  left: -32px;
  top: 50%;
  transform: translateY(-50%);
  font-size: var(--font-size-md);
  color: var(--text-highlight);
  animation: cursor-bounce 0.6s ease-in-out infinite;
}

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

/* ============================================
   FLASHCARD FLIP ENHANCEMENTS
   ============================================ */

/* Card with flip affordance - icon on front */

.pixel-card-front::after {
  content: "\1F504";
  position: absolute;
  bottom: var(--space-md);
  right: var(--space-md);
  font-size: var(--font-size-md);
  opacity: 0.5;
  animation: flip-hint 2s ease-in-out infinite;
}

@keyframes flip-hint {
  0%,
  100% {
    opacity: 0.3;
    transform: scale(1);
  }
  50% {
    opacity: 0.7;
    transform: scale(1.15);
  }
}

/* Card hover/active states - maintain consistent shadow to prevent visual movement */
.pixel-card:hover .pixel-card-inner,
.pixel-card:active .pixel-card-inner {
  box-shadow:
    0 0 0 2px var(--accent-info),
    6px 6px 0 var(--border-dark);
}

.pixel-card:hover,
.pixel-card:active {
  cursor: pointer;
}

/* Enhanced hint text - styled as a prompt */
.study-hint-box {
  font-family: var(--font-pixel);
  font-size: var(--font-size-sm);
  color: var(--text-secondary);
  padding: var(--space-sm) var(--space-lg);
  background: var(--bg-dark);
  border: 2px solid var(--border-medium);
  animation: hint-pulse 1.5s ease-in-out infinite;
}

@keyframes hint-pulse {
  0%,
  100% {
    border-color: var(--border-medium);
  }
  50% {
    border-color: var(--accent-info);
  }
}

/* ============================================
   URGENT ACTION CARD (Reviews Due)
   ============================================ */

.action-card-urgent {
  position: relative;
  border-color: var(--accent-primary) !important;
  animation: urgent-glow 2s ease-in-out infinite;
}

.action-card-urgent::before {
  content: "";
  position: absolute;
  inset: -4px;
  background: linear-gradient(
    45deg,
    var(--accent-primary) 0%,
    var(--accent-secondary) 50%,
    var(--accent-primary) 100%
  );
  background-size: 200% 200%;
  animation: gradient-shift 3s ease-in-out infinite;
  z-index: -1;
  opacity: 0.25;
}

@keyframes urgent-glow {
  0%,
  100% {
    box-shadow:
      4px 4px 0 var(--border-dark),
      0 0 10px rgba(233, 69, 96, 0.3);
  }
  50% {
    box-shadow:
      4px 4px 0 var(--border-dark),
      0 0 20px rgba(233, 69, 96, 0.5);
  }
}

@keyframes gradient-shift {
  0%,
  100% {
    background-position: 0% 50%;
  }
  50% {
    background-position: 100% 50%;
  }
}

/* Exclamation badge for urgent items */
.action-card-urgent .action-card-icon {
  position: relative;
}

.action-card-urgent .action-card-badge {
  position: absolute;
  top: -4px;
  right: -8px;
  width: 20px;
  height: 20px;
  background: var(--accent-error);
  border: 2px solid var(--border-dark);
  border-radius: 50%;
  font-family: var(--font-pixel);
  font-size: var(--font-size-xs);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: badge-bounce 0.5s ease-in-out infinite;
}

@keyframes badge-bounce {
  0%,
  100% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.15);
  }
}

/* ============================================
   AUDIO BUTTON ICON STATES - Retro style
   ============================================ */

.audio-btn {
  position: relative;
}

/* Hide default icon, show playing icon when active */
.audio-btn .audio-btn-icon {
  display: block;
}
.audio-btn .audio-btn-playing {
  display: none;
}
.audio-btn.playing .audio-btn-icon {
  display: none;
}
.audio-btn.playing .audio-btn-playing {
  display: block;
}

/* No sound wave animations - keep it retro */

/* ============================================
   SESSION COMPLETE CELEBRATION
   ============================================ */

.modal.session-complete {
  animation: victory-appear 0.5s ease-out;
}

@keyframes victory-appear {
  0% {
    transform: scale(0.5) rotateX(20deg);
    opacity: 0;
  }
  50% {
    transform: scale(1.05) rotateX(-5deg);
  }
  100% {
    transform: scale(1) rotateX(0);
    opacity: 1;
  }
}

/* Victory header with shine effect */
.modal.session-complete .modal-header {
  background: linear-gradient(
    90deg,
    var(--bg-lighter) 0%,
    var(--coin-color) 45%,
    var(--text-highlight) 50%,
    var(--coin-color) 55%,
    var(--bg-lighter) 100%
  );
  background-size: 200% 100%;
  animation: victory-shine 2s ease-in-out infinite;
}

@keyframes victory-shine {
  0%,
  100% {
    background-position: 200% 0;
  }
  50% {
    background-position: -200% 0;
  }
}

/* XP stat special emphasis */
.session-stat.stat-xp .session-stat-value {
  color: var(--accent-primary);
  animation: xp-glow 1s ease-in-out infinite;
}

@keyframes xp-glow {
  0%,
  100% {
    text-shadow:
      2px 2px 0 var(--border-dark),
      0 0 5px var(--accent-primary);
  }
  50% {
    text-shadow:
      2px 2px 0 var(--border-dark),
      0 0 15px var(--accent-primary);
  }
}

/* Victory stars container */
.victory-stars {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 80px;
  overflow: hidden;
  pointer-events: none;
}

.victory-star {
  position: absolute;
  font-size: 24px;
  animation: star-fall 1.5s ease-out forwards;
}

@keyframes star-fall {
  0% {
    transform: translateY(-20px) rotate(0deg) scale(0);
    opacity: 0;
  }
  20% {
    opacity: 1;
    transform: translateY(0) rotate(180deg) scale(1);
  }
  100% {
    transform: translateY(40px) rotate(360deg) scale(0.5);
    opacity: 0;
  }
}

/* ============================================
   EXAMPLE SENTENCE DISPLAY
   ============================================ */

/* Example sentence on card back */
.pixel-card-example {
  margin-top: var(--space-md);
  width: 100%;
}

.pixel-card-example .example-sentence {
  padding: var(--space-sm) var(--space-md);
  background: var(--bg-darkest);
  border-left: 3px solid var(--accent-info);
  text-align: left;
}

.pixel-card-example .example-sentence-ja {
  font-family: var(--font-japanese);
  font-size: var(--font-size-md);
  color: var(--text-japanese);
  margin-bottom: 2px;
}

.pixel-card-example .example-sentence-reading {
  font-family: var(--font-japanese);
  font-size: var(--font-size-sm);
  color: var(--text-secondary);
  margin-bottom: 2px;
}

.pixel-card-example .example-sentence-en {
  font-size: var(--font-size-xs);
  color: var(--text-muted);
  font-style: italic;
}

/* Larger card size for vocabulary with examples */
.pixel-card.has-example {
  height: auto;
  min-height: var(--card-height);
}

.pixel-card.has-example .pixel-card-back {
  padding: var(--space-md);
}

/* Standalone example sentence (for detail views) */
.example-sentence {
  margin-top: var(--space-lg);
  padding: var(--space-md);
  background: var(--bg-darkest);
  border-left: 3px solid var(--accent-info);
}

.example-sentence-ja {
  font-family: var(--font-japanese);
  font-size: var(--font-size-jp-sm);
  color: var(--text-japanese);
  margin-bottom: var(--space-xs);
}

.example-sentence-reading {
  font-family: var(--font-japanese);
  font-size: var(--font-size-md);
  color: var(--text-secondary);
  margin-bottom: var(--space-xs);
}

.example-sentence-en {
  font-size: var(--font-size-sm);
  color: var(--text-muted);
  font-style: italic;
}
