@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600&family=Noto+Serif+JP:wght@300;400;500;600;700&display=swap');

/* ==========================================================================
   DIGITAL DOJO - PREMIUM CSS
   ========================================================================== */

:root {
  /* Colors - Core Theme */
  --color-bg-base: #0a0a0f;
  --color-bg-card: #12121a;
  --color-bg-card-hover: #1a1a24;
  --color-bg-overlay: rgba(10, 10, 15, 0.85);
  
  /* Colors - Accents */
  --color-accent-gold: #ffca28;
  --color-accent-gold-glow: rgba(255, 202, 40, 0.3);
  --color-accent-crimson: #ff5252;
  --color-accent-crimson-glow: rgba(255, 82, 82, 0.3);
  --color-accent-teal: #4db6ac;
  --color-accent-teal-glow: rgba(77, 182, 172, 0.3);
  
  /* Colors - Text */
  --color-text-main: #ffffff;
  --color-text-muted: #c8c6c0;
  --color-text-dark: #0a0a0f;
  
  /* Typography */
  --font-heading: 'Noto Serif JP', serif;
  --font-body: 'Inter', sans-serif;
  
  /* Spacing */
  --space-xs: 0.25rem;
  --space-sm: 0.5rem;
  --space-md: 1rem;
  --space-lg: 2rem;
  --space-xl: 4rem;
  --space-xxl: 8rem;
  
  /* Radii */
  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-lg: 16px;
  --radius-pill: 9999px;
  
  /* Z-index */
  --z-behind: -1;
  --z-normal: 1;
  --z-overlay: 10;
  --z-modal: 100;
  --z-toast: 1000;
  
  /* Transitions */
  --transition-fast: 0.15s ease-out;
  --transition-normal: 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
  --transition-slow: 0.6s cubic-bezier(0.25, 0.8, 0.25, 1);
  
  /* Shadows */
  --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.1);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.3);
  --shadow-lg: 0 12px 24px rgba(0, 0, 0, 0.5);
  --shadow-glow-gold: 0 0 20px var(--color-accent-gold-glow);
  --shadow-glow-teal: 0 0 20px var(--color-accent-teal-glow);
  --shadow-glow-crimson: 0 0 20px var(--color-accent-crimson-glow);
}

/* ==========================================================================
   RESET & GLOBAL STYLES
   ========================================================================== */

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

html {
  font-size: 16px;
  scroll-behavior: smooth;
}

body {
  background-color: var(--color-bg-base);
  color: var(--color-text-main);
  font-family: var(--font-body);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}

/* Custom Scrollbar */
::-webkit-scrollbar {
  width: 8px;
}

::-webkit-scrollbar-track {
  background: var(--color-bg-base);
}

::-webkit-scrollbar-thumb {
  background: #2a2a35;
  border-radius: var(--radius-pill);
}

::-webkit-scrollbar-thumb:hover {
  background: var(--color-accent-gold);
}

/* Typography Elements */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-heading);
  font-weight: 400;
  line-height: 1.2;
  letter-spacing: 0.02em;
  margin-bottom: var(--space-md);
}

h1 { font-size: clamp(2.5rem, 5vw, 4.5rem); }
h2 { font-size: clamp(2rem, 4vw, 3.5rem); }
h3 { font-size: clamp(1.5rem, 3vw, 2.5rem); }
h4 { font-size: clamp(1.25rem, 2vw, 1.75rem); }

p {
  margin-bottom: var(--space-md);
  color: var(--color-text-muted);
}

a {
  color: var(--color-accent-gold);
  text-decoration: none;
  transition: color var(--transition-fast);
}

a:hover {
  color: #fce8a1;
}

/* ==========================================================================
   LAYOUT & CONTAINERS
   ========================================================================== */

.container {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 var(--space-md);
}

.section {
  padding: var(--space-xxl) 0;
  position: relative;
}

.section-divider {
  height: 1px;
  width: 100%;
  background: linear-gradient(90deg, transparent, rgba(212, 168, 83, 0.2), transparent);
  margin: var(--space-xl) 0;
}

/* ==========================================================================
   COMPONENTS
   ========================================================================== */

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.75rem 1.5rem;
  min-height: 48px;
  font-family: var(--font-body);
  font-weight: 500;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  font-size: 0.875rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--transition-normal);
  border: none;
  background: none;
  position: relative;
  overflow: hidden;
  z-index: 1;
}

.btn-primary {
  color: var(--color-accent-gold);
  border: 1px solid var(--color-accent-gold);
}

.btn-primary::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: var(--color-accent-gold);
  z-index: -1;
  transform: scaleX(0);
  transform-origin: right;
  transition: transform var(--transition-normal);
}

.btn-primary:hover {
  color: var(--color-bg-base);
  box-shadow: var(--shadow-glow-gold);
}

.btn-primary:hover::before {
  transform: scaleX(1);
  transform-origin: left;
}

.btn-secondary {
  background-color: var(--color-accent-teal);
  color: var(--color-bg-base);
}

.btn-secondary:hover {
  background-color: #5bc0ad;
  box-shadow: var(--shadow-glow-teal);
  transform: translateY(-2px);
}

/* Glassmorphism Cards */
.glass-card {
  background: rgba(255, 255, 255, 0.08);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: var(--radius-md);
  padding: var(--space-lg);
  transition: all var(--transition-normal);
  position: relative;
  overflow: hidden;
}

.glass-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
}

.glass-card:hover {
  transform: translateY(-5px);
  box-shadow: var(--shadow-lg);
  border-color: rgba(212, 168, 83, 0.2);
  background: rgba(255, 255, 255, 0.15);
}

/* Meters / Bars */
.meter-container {
  width: 100%;
  height: 8px;
  background-color: rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-pill);
  overflow: hidden;
  margin-bottom: var(--space-sm);
  position: relative;
}

.meter-fill {
  height: 100%;
  border-radius: var(--radius-pill);
  transition: width var(--transition-slow);
}

.meter-ki .meter-fill {
  background: linear-gradient(90deg, #a67c00, var(--color-accent-gold));
  box-shadow: 0 0 10px var(--color-accent-gold-glow);
}

.meter-kuzushi .meter-fill {
  background: linear-gradient(90deg, #8a2be2, var(--color-accent-crimson));
  box-shadow: 0 0 10px var(--color-accent-crimson-glow);
}

/* ==========================================================================
   PAGE SECTIONS
   ========================================================================== */

/* Hero Section */
.hero {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
  position: relative;
  padding: var(--space-xl) var(--space-md);
}

.hero::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 150px;
  background: linear-gradient(to top, var(--color-bg-base), transparent);
  pointer-events: none;
}

.hero-title {
  position: relative;
  display: inline-block;
  margin-bottom: var(--space-md);
}

.hero-title span {
  display: block;
  font-family: var(--font-heading);
  font-size: clamp(3rem, 8vw, 6rem);
  font-weight: 300;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  background: linear-gradient(to bottom, #ffffff, #a09d96);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  animation: fade-in-up 1.2s ease-out;
}

.hero-subtitle {
  font-family: var(--font-body);
  font-size: clamp(1rem, 2vw, 1.25rem);
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--color-accent-gold);
  margin-bottom: var(--space-xl);
  animation: fade-in-up 1.2s ease-out 0.3s both;
}

.hero-border-box {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 80%;
  height: 80%;
  max-width: 1000px;
  border: 1px solid rgba(255, 255, 255, 0.05);
  pointer-events: none;
}

.hero-border-box::before,
.hero-border-box::after {
  content: '';
  position: absolute;
  width: 30px;
  height: 30px;
  border-color: var(--color-accent-gold);
  border-style: solid;
  transition: all 1s ease;
  animation: pulse-glow 4s infinite alternate;
}

.hero-border-box::before {
  top: -1px;
  left: -1px;
  border-width: 1px 0 0 1px;
}

.hero-border-box::after {
  bottom: -1px;
  right: -1px;
  border-width: 0 1px 1px 0;
}

/* Training Arena */
.training-arena {
  position: relative;
  width: 100%;
  min-height: 60vh;
  background-color: #050508;
  background-image: radial-gradient(circle at center, rgba(30, 30, 45, 0.5) 0%, transparent 70%);
  border-top: 1px solid rgba(255, 255, 255, 0.05);
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.training-arena-overlay {
  position: absolute;
  inset: 0;
  background: var(--color-bg-overlay);
  z-index: var(--z-normal);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.flash-text {
  font-family: var(--font-heading);
  font-size: clamp(4rem, 10vw, 8rem);
  color: var(--color-accent-crimson);
  opacity: 0;
  text-shadow: var(--shadow-glow-crimson);
  transform: scale(0.9);
}

.flash-text.active {
  animation: flash-in 1.5s cubic-bezier(0.1, 1, 0.3, 1) forwards;
}

/* Philosophy Cards Section */
.philosophy-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: var(--space-lg);
  margin-top: var(--space-xl);
}

.philosophy-card {
  text-align: center;
  padding: var(--space-xl) var(--space-lg);
}

.philosophy-icon {
  font-size: 2.5rem;
  color: var(--color-accent-gold);
  margin-bottom: var(--space-md);
  display: inline-block;
}

.philosophy-card:nth-child(1) .philosophy-icon { color: var(--color-accent-gold); }
.philosophy-card:nth-child(2) .philosophy-icon { color: var(--color-accent-teal); }
.philosophy-card:nth-child(3) .philosophy-icon { color: var(--color-accent-crimson); }

.japanese-pattern-bg {
  position: absolute;
  inset: 0;
  opacity: 0.03;
  background-image: url('data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSI0MCIgaGVpZ2h0PSI0MCI+CjxwYXRoIGQ9Ik0yMCAwaDIwdjIwaC0yMHptMCAyMGgyMHYyMGgtMjB6TTAgMGgyMHYyMEgweiIgZmlsbD0iI2ZmZiIvPgo8L3N2Zz4=');
  pointer-events: none;
}

/* Technique Browser */
.technique-filters {
  display: flex;
  gap: var(--space-sm);
  margin-bottom: var(--space-lg);
  flex-wrap: wrap;
  justify-content: center;
}

.filter-btn {
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: var(--color-text-muted);
  padding: 0.5rem 1rem;
  border-radius: var(--radius-pill);
  cursor: pointer;
  transition: all var(--transition-fast);
  font-size: 0.875rem;
}

.filter-btn:hover, .filter-btn.active {
  background: rgba(255, 255, 255, 0.1);
  color: var(--color-text-main);
  border-color: rgba(255, 255, 255, 0.3);
}

.filter-btn[data-filter="juho"].active {
  border-color: var(--color-accent-teal);
  color: var(--color-accent-teal);
}

.filter-btn[data-filter="goho"].active {
  border-color: var(--color-accent-crimson);
  color: var(--color-accent-crimson);
}

.technique-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: var(--space-md);
}

.technique-item {
  position: relative;
}

.technique-img-placeholder {
  width: 100%;
  aspect-ratio: 16/9;
  background: #1a1a24;
  border-radius: var(--radius-sm);
  margin-bottom: var(--space-sm);
  overflow: hidden;
  position: relative;
}

.technique-item:hover .technique-img-placeholder::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, rgba(212, 168, 83, 0.2), transparent);
}

/* ==========================================================================
   NAVIGATION
   ========================================================================== */

#main-nav {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  z-index: var(--z-toast);
  background: rgba(10, 10, 15, 0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  transition: background var(--transition-normal);
}

.nav-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 var(--space-md);
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
}

.nav-logo {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  color: var(--color-text-main);
  text-decoration: none;
}

.logo-kanji {
  font-family: var(--font-heading);
  font-size: 1.5rem;
  color: var(--color-accent-gold);
}

.logo-text {
  font-family: var(--font-body);
  font-size: 0.9rem;
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.nav-links {
  list-style: none;
  display: flex;
  gap: var(--space-lg);
}

.nav-links a {
  color: var(--color-text-muted);
  font-size: 0.85rem;
  font-weight: 500;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  transition: color var(--transition-fast);
  position: relative;
}

.nav-links a::after {
  content: '';
  position: absolute;
  bottom: -4px;
  left: 0;
  width: 0;
  height: 1px;
  background: var(--color-accent-gold);
  transition: width var(--transition-normal);
}

.nav-links a:hover,
.nav-links a.active {
  color: var(--color-accent-gold);
}

.nav-links a:hover::after,
.nav-links a.active::after {
  width: 100%;
}

.nav-toggle {
  display: none;
  flex-direction: column;
  gap: 5px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 5px;
}

.nav-toggle span {
  display: block;
  width: 24px;
  height: 2px;
  background: var(--color-text-main);
  transition: transform var(--transition-fast), opacity var(--transition-fast);
}

.nav-toggle.active span:nth-child(1) {
  transform: rotate(45deg) translate(5px, 5px);
}
.nav-toggle.active span:nth-child(2) {
  opacity: 0;
}
.nav-toggle.active span:nth-child(3) {
  transform: rotate(-45deg) translate(5px, -5px);
}

/* ==========================================================================
   HERO SECTION (matching HTML)
   ========================================================================== */

.hero-section {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
  position: relative;
  padding: var(--space-xxl) var(--space-md);
  overflow: hidden;
}

.hero-section::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 150px;
  background: linear-gradient(to top, var(--color-bg-base), transparent);
  pointer-events: none;
}

#particle-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  pointer-events: none;
}

.hero-content {
  position: relative;
  z-index: 1;
}

.hero-badge {
  font-family: var(--font-heading);
  font-size: 1.1rem;
  color: var(--color-accent-gold);
  letter-spacing: 0.3em;
  margin-bottom: var(--space-lg);
}

.hero-title .title-jp {
  display: block;
  font-family: var(--font-heading);
  font-size: clamp(3rem, 8vw, 6rem);
  font-weight: 700;
  background: linear-gradient(to bottom, #ffffff, var(--color-accent-gold));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  line-height: 1.1;
}

.hero-title .title-en {
  display: block;
  font-family: var(--font-heading);
  font-size: clamp(1.5rem, 3vw, 2.5rem);
  font-weight: 300;
  color: var(--color-text-muted);
  letter-spacing: 0.15em;
  text-transform: uppercase;
  margin-top: var(--space-sm);
}

.hero-subtitle {
  max-width: 600px;
  margin: var(--space-lg) auto;
  font-size: 1.1rem;
  line-height: 1.7;
  color: var(--color-text-muted);
}

.hero-subtitle em {
  color: var(--color-accent-gold);
  font-style: normal;
  font-weight: 500;
}

.hero-principles {
  display: flex;
  gap: var(--space-md);
  justify-content: center;
  flex-wrap: wrap;
  margin-bottom: var(--space-xl);
}

.principle-tag {
  font-family: var(--font-heading);
  font-size: 0.85rem;
  color: var(--color-text-muted);
  padding: 0.4rem 1rem;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-pill);
  letter-spacing: 0.05em;
}

.hero-cta {
  display: flex;
  gap: var(--space-md);
  justify-content: center;
  flex-wrap: wrap;
}

.scroll-indicator {
  position: absolute;
  bottom: var(--space-lg);
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-sm);
  color: var(--color-text-muted);
  font-size: 0.75rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  z-index: 1;
}

.scroll-arrow {
  width: 1px;
  height: 30px;
  background: linear-gradient(to bottom, var(--color-accent-gold), transparent);
  animation: fade-in-up 1.5s ease-in-out infinite;
}

/* ==========================================================================
   SECTION HEADERS
   ========================================================================== */

.section-dark {
  background: #08080d;
}

.section-header {
  text-align: center;
  margin-bottom: var(--space-xl);
}

.section-label {
  display: inline-block;
  font-family: var(--font-heading);
  font-size: 0.85rem;
  color: var(--color-accent-gold);
  letter-spacing: 0.2em;
  text-transform: uppercase;
  margin-bottom: var(--space-sm);
}

.section-description {
  max-width: 600px;
  margin: 0 auto;
  color: var(--color-text-muted);
}

/* ==========================================================================
   PHILOSOPHY CARDS (with 3D flip)
   ========================================================================== */

.philosophy-card {
  perspective: 800px;
  cursor: pointer;
  min-height: 280px;
  position: relative;
  background: rgba(255, 255, 255, 0.08);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: var(--radius-md);
  overflow: hidden;
  transition: transform var(--transition-normal), box-shadow var(--transition-normal);
}

.philosophy-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
}

.philosophy-card .card-front,
.philosophy-card .card-back {
  padding: var(--space-xl) var(--space-lg);
  transition: opacity var(--transition-normal);
}

.philosophy-card .card-back {
  position: absolute;
  inset: 0;
  opacity: 0;
  background: rgba(10, 10, 15, 0.95);
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: var(--space-lg);
}

.philosophy-card.flipped .card-front {
  opacity: 0;
}

.philosophy-card.flipped .card-back {
  opacity: 1;
}

.card-icon {
  font-size: 2.5rem;
  margin-bottom: var(--space-md);
}

.card-kanji {
  font-family: var(--font-heading);
  font-size: 1.8rem;
  color: var(--color-accent-gold);
  margin-bottom: var(--space-xs);
}

.card-romaji {
  font-family: var(--font-body);
  font-size: 0.9rem;
  color: var(--color-text-muted);
  margin-bottom: var(--space-sm);
  font-weight: 400;
}

.card-meaning {
  color: var(--color-text-main);
  font-weight: 500;
}

.card-back p {
  font-size: 0.9rem;
  line-height: 1.6;
  color: var(--color-text-muted);
  margin-bottom: var(--space-md);
}

.card-back strong {
  color: var(--color-accent-gold);
}

.card-mechanic {
  font-size: 0.8rem;
  color: var(--color-accent-teal);
  font-style: italic;
  margin-top: auto;
}

/* ==========================================================================
   COMBAT SYSTEM SECTION
   ========================================================================== */

.combat-overview {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: var(--space-lg);
  margin-bottom: var(--space-xl);
}

.combat-card {
  background: rgba(255, 255, 255, 0.08);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: var(--radius-md);
  padding: var(--space-lg);
}

.meter-demo {
  margin-bottom: var(--space-lg);
}

.meter-label {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  margin-bottom: var(--space-sm);
  font-weight: 500;
}

.meter-icon {
  font-family: var(--font-heading);
  font-size: 1.2rem;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
}

.ki-icon {
  color: var(--color-accent-gold);
  background: rgba(212, 168, 83, 0.1);
}

.kuzushi-icon {
  color: var(--color-accent-crimson);
  background: rgba(196, 68, 68, 0.1);
}

.meter-bar {
  width: 100%;
  height: 10px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-pill);
  overflow: hidden;
  position: relative;
}

.meter-bar.small {
  height: 8px;
}

.ki-fill {
  background: linear-gradient(90deg, #a67c00, var(--color-accent-gold));
  box-shadow: 0 0 8px var(--color-accent-gold-glow);
}

.kuzushi-fill {
  background: linear-gradient(90deg, #8a2a2a, var(--color-accent-crimson));
  box-shadow: 0 0 8px var(--color-accent-crimson-glow);
}

.meter-value {
  font-size: 0.8rem;
  color: var(--color-text-muted);
  margin-top: var(--space-xs);
  display: inline-block;
}

.stat-row {
  display: flex;
  gap: var(--space-md);
  flex-wrap: wrap;
  margin-top: var(--space-md);
}

.stat {
  font-size: 0.8rem;
  color: var(--color-text-muted);
  padding: 0.25rem 0.6rem;
  background: rgba(255, 255, 255, 0.04);
  border-radius: var(--radius-sm);
}

/* Pipeline */
.pipeline {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: var(--radius-md);
  padding: var(--space-xl);
  text-align: center;
}

.pipeline-title {
  margin-bottom: var(--space-lg);
}

.pipeline-stages {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-sm);
  flex-wrap: wrap;
}

.stage {
  text-align: center;
  padding: var(--space-md);
  background: rgba(255, 255, 255, 0.03);
  border-radius: var(--radius-md);
  border: 1px solid rgba(255, 255, 255, 0.05);
  min-width: 100px;
  transition: all var(--transition-normal);
}

.stage:hover {
  border-color: var(--color-accent-gold);
  transform: translateY(-3px);
}

.stage-number {
  font-size: 0.7rem;
  color: var(--color-accent-gold);
  margin-bottom: var(--space-xs);
}

.stage-kanji {
  font-family: var(--font-heading);
  font-size: 1.5rem;
  color: var(--color-text-main);
}

.stage-name {
  font-size: 0.85rem;
  color: var(--color-accent-gold);
  margin-bottom: var(--space-xs);
}

.stage-desc {
  font-size: 0.75rem;
  color: var(--color-text-muted);
}

.stage-window {
  font-size: 0.7rem;
  color: var(--color-accent-teal);
  margin-top: var(--space-xs);
}

.stage-arrow {
  font-size: 1.2rem;
  color: rgba(255, 255, 255, 0.15);
}

.pipeline-note {
  margin-top: var(--space-lg);
  font-size: 0.9rem;
}

/* ==========================================================================
   TRAINING ARENA (full HUD, overlays, flash text, timer)
   ========================================================================== */

.training-arena {
  position: relative;
  width: 100%;
  min-height: 500px;
  background-color: #050508;
  background-image: radial-gradient(circle at center, rgba(30, 30, 45, 0.4) 0%, transparent 70%);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: var(--radius-lg);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.controls-legend {
  position: absolute;
  top: var(--space-md);
  left: var(--space-md);
  z-index: 5;
  font-size: 0.75rem;
}

.controls-legend h4 {
  font-size: 0.7rem;
  color: var(--color-accent-gold);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-bottom: var(--space-xs);
}

.control-keys {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.key-hint {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
  color: var(--color-text-muted);
}

.key-hint kbd {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 3px;
  font-family: var(--font-body);
  font-size: 0.7rem;
  color: var(--color-text-main);
}

/* Arena HUD */
.arena-hud {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding: var(--space-lg);
  padding-top: calc(var(--space-lg) + 8px);
  gap: var(--space-md);
  z-index: 2;
}

.hud-fighter {
  flex: 1;
  max-width: 250px;
}

.hud-label {
  display: block;
  font-size: 0.75rem;
  color: var(--color-accent-gold);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-bottom: var(--space-sm);
}

.hud-opponent .hud-label {
  text-align: right;
}

.hud-meter {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  margin-bottom: var(--space-xs);
}

.hud-meter-label {
  font-size: 0.7rem;
  color: var(--color-text-muted);
  width: 36px;
  flex-shrink: 0;
}

.hud-meter-value {
  font-size: 0.75rem;
  color: var(--color-text-main);
  width: 28px;
  text-align: right;
  flex-shrink: 0;
}

.hud-center {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-sm);
  padding-top: var(--space-sm);
}

.combo-display {
  text-align: center;
  opacity: 0.3;
  transition: opacity var(--transition-fast);
}

.combo-count {
  font-family: var(--font-heading);
  font-size: 2rem;
  color: var(--color-accent-gold);
  display: block;
  line-height: 1;
}

.combo-label {
  font-size: 0.65rem;
  color: var(--color-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

.mushin-badge,
.fudoshin-badge {
  font-family: var(--font-heading);
  font-size: 0.8rem;
  padding: 0.2rem 0.8rem;
  border-radius: var(--radius-pill);
  transition: opacity var(--transition-fast);
}

.mushin-badge {
  color: var(--color-accent-gold);
  background: rgba(212, 168, 83, 0.15);
  border: 1px solid rgba(212, 168, 83, 0.3);
}

.fudoshin-badge {
  color: var(--color-accent-teal);
  background: rgba(74, 158, 142, 0.15);
  border: 1px solid rgba(74, 158, 142, 0.3);
}

/* Flash Area */
.flash-area {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 200px;
  z-index: 2;
}

.flash-japanese {
  font-family: var(--font-heading);
  font-size: clamp(3rem, 8vw, 5rem);
  color: var(--color-text-main);
  text-shadow: 0 0 30px rgba(212, 168, 83, 0.3);
  min-height: 1.2em;
  transition: opacity 0.15s;
}

.flash-romaji {
  font-family: var(--font-body);
  font-size: 1.1rem;
  color: var(--color-text-muted);
  margin-top: var(--space-xs);
  min-height: 1.5em;
}

.flash-hint {
  font-size: 0.8rem;
  color: rgba(255, 255, 255, 0.25);
  margin-top: var(--space-xs);
  min-height: 1.2em;
}

.result-text {
  font-family: var(--font-heading);
  font-size: 1.3rem;
  margin-top: var(--space-md);
  min-height: 1.5em;
}

.reaction-time {
  font-family: var(--font-body);
  font-size: 0.85rem;
  color: var(--color-text-muted);
  min-height: 1.2em;
}

/* Arena Overlays */
.arena-overlay {
  position: absolute;
  inset: 0;
  background: rgba(5, 5, 8, 0.92);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10;
  transition: opacity var(--transition-normal);
}

.overlay-content {
  text-align: center;
  padding: var(--space-xl);
}

.overlay-kanji {
  font-family: var(--font-heading);
  font-size: 4rem;
  color: var(--color-accent-gold);
  margin-bottom: var(--space-md);
}

.overlay-content h3 {
  font-size: 1.5rem;
  margin-bottom: var(--space-md);
}

.overlay-content p {
  max-width: 350px;
  margin: 0 auto var(--space-lg);
}

.btn-large {
  padding: 1rem 2.5rem;
  font-size: 1rem;
}

/* Breathing circle */
.breathing-circle {
  width: 100px;
  height: 100px;
  border-radius: 50%;
  background: radial-gradient(circle, var(--color-accent-teal) 0%, transparent 70%);
  margin: 0 auto var(--space-lg);
  animation: breathing 4s ease-in-out infinite;
}

.chinkon-text {
  font-family: var(--font-heading);
  font-size: 1.5rem;
  color: var(--color-accent-teal);
  letter-spacing: 0.1em;
}

/* Victory overlay */
.victory-content {
  max-width: 400px;
}

.victory-kanji {
  font-family: var(--font-heading);
  font-size: 3.5rem;
  color: var(--color-accent-gold);
  margin-bottom: var(--space-sm);
}

.victory-stars {
  font-size: 2rem;
  margin: var(--space-md) 0;
  letter-spacing: 0.3em;
}

.victory-stats {
  text-align: left;
}

/* Timer bar */
.timer-bar-container {
  width: 100%;
  height: 3px;
  background: rgba(255, 255, 255, 0.05);
  z-index: 5;
}

.timer-bar {
  height: 100%;
  width: 100%;
  background: linear-gradient(90deg, var(--color-accent-crimson), var(--color-accent-gold));
  transition: width 1.5s linear;
}

/* ==========================================================================
   TECHNIQUE BROWSER MODAL
   ========================================================================== */

.tech-filters {
  display: flex;
  gap: var(--space-md);
  justify-content: center;
  flex-wrap: wrap;
  margin-bottom: var(--space-lg);
}

.filter-group {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  flex-wrap: wrap;
}

.filter-label {
  font-size: 0.8rem;
  color: var(--color-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.tech-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: var(--space-md);
}

.tech-modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.8);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: var(--z-modal);
  padding: var(--space-md);
}

.tech-modal-content {
  background: var(--color-bg-card);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-lg);
  padding: var(--space-xl);
  max-width: 550px;
  width: 100%;
  position: relative;
  text-align: center;
}

.modal-close {
  position: absolute;
  top: var(--space-md);
  right: var(--space-md);
  background: none;
  border: none;
  color: var(--color-text-muted);
  font-size: 1.5rem;
  cursor: pointer;
  transition: color var(--transition-fast);
  line-height: 1;
}

.modal-close:hover {
  color: var(--color-accent-crimson);
}

/* ==========================================================================
   THREE PILLARS
   ========================================================================== */

.pillars-display {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: var(--space-lg);
  margin-bottom: var(--space-xl);
}

.pillar {
  background: rgba(255, 255, 255, 0.08);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: var(--radius-md);
  padding: var(--space-xl);
  text-align: center;
  transition: all var(--transition-normal);
}

.pillar:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
}

.pillar[data-pillar="goho"] { border-top: 2px solid var(--color-accent-crimson); }
.pillar[data-pillar="juho"] { border-top: 2px solid var(--color-accent-teal); }
.pillar[data-pillar="seiho"] { border-top: 2px solid #6ab04c; }

.pillar-symbol {
  font-family: var(--font-heading);
  font-size: 3.5rem;
  margin-bottom: var(--space-md);
}

.pillar[data-pillar="goho"] .pillar-symbol { color: var(--color-accent-crimson); }
.pillar[data-pillar="juho"] .pillar-symbol { color: var(--color-accent-teal); }
.pillar[data-pillar="seiho"] .pillar-symbol { color: #6ab04c; }

.pillar-jp {
  font-size: 0.8em;
  color: var(--color-text-muted);
}

.pillar-meaning {
  font-size: 0.9rem;
  color: var(--color-accent-gold);
  margin-bottom: var(--space-md);
}

.pillar-examples {
  list-style: none;
  text-align: left;
  margin-bottom: var(--space-md);
}

.pillar-examples li {
  font-size: 0.85rem;
  color: var(--color-text-muted);
  padding: var(--space-xs) 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.03);
}

.pillar-count {
  font-size: 0.75rem;
  color: var(--color-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* Riki Ai Funi */
.riki-ai-funi {
  text-align: center;
  padding: var(--space-xl) 0;
}

.raf-circle {
  width: 140px;
  height: 140px;
  border-radius: 50%;
  border: 2px solid var(--color-accent-gold);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto var(--space-lg);
  animation: pulse-glow 4s infinite alternate;
}

.raf-kanji {
  font-family: var(--font-heading);
  font-size: 1.4rem;
  color: var(--color-accent-gold);
  letter-spacing: 0.1em;
}

.raf-text {
  max-width: 500px;
  margin: 0 auto;
  font-size: 1rem;
  line-height: 1.7;
}

/* ==========================================================================
   FOOTER
   ========================================================================== */

.footer {
  background: #050508;
  padding: var(--space-xl) 0;
  border-top: 1px solid rgba(255, 255, 255, 0.03);
}

.footer-content {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: var(--space-xl);
  flex-wrap: wrap;
  margin-bottom: var(--space-lg);
}

.footer-kanji {
  font-family: var(--font-heading);
  font-size: 1.3rem;
  color: var(--color-accent-gold);
  display: block;
  margin-bottom: var(--space-sm);
}

.footer-quote blockquote {
  font-family: var(--font-heading);
  font-size: 1rem;
  color: var(--color-text-main);
  border-left: 2px solid var(--color-accent-gold);
  padding-left: var(--space-md);
  margin-bottom: var(--space-sm);
}

.footer-quote cite {
  font-size: 0.8rem;
  color: var(--color-text-muted);
  font-style: normal;
  display: block;
  margin-top: var(--space-xs);
}

.quote-translation {
  font-size: 0.85rem;
  font-style: italic;
  color: var(--color-text-muted);
}

.footer-bottom {
  text-align: center;
  padding-top: var(--space-md);
  border-top: 1px solid rgba(255, 255, 255, 0.03);
}

.footer-bottom p {
  font-size: 0.8rem;
  color: var(--color-text-muted);
}

/* ==========================================================================
   UTILITY CLASSES
   ========================================================================== */

.hidden {
  display: none !important;
}

/* ==========================================================================
   TOUCH CONTROLS (D-pad for Surface Pro / tablets / phones)
   ========================================================================== */

.touch-controls {
  display: none; /* hidden by default, shown via media query */
  flex-direction: column;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-md) var(--space-md) var(--space-lg);
  z-index: 6;
}

.touch-mid-row {
  display: flex;
  gap: var(--space-sm);
}

.touch-zone {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 80px;
  height: 64px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all 0.12s ease-out;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  user-select: none;
  -webkit-user-select: none;
}

.touch-zone-kanji {
  font-family: var(--font-heading);
  font-size: 1.3rem;
  color: var(--color-text-main);
  line-height: 1;
}

.touch-zone-label {
  font-family: var(--font-body);
  font-size: 0.6rem;
  color: var(--color-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-top: 2px;
}

/* Zone-specific accent colors */
.touch-jodan {
  border-color: rgba(212, 168, 83, 0.25);
}
.touch-jodan .touch-zone-kanji { color: var(--color-accent-gold); }

.touch-chudan-l,
.touch-chudan-r {
  border-color: rgba(74, 158, 142, 0.25);
}
.touch-chudan-l .touch-zone-kanji,
.touch-chudan-r .touch-zone-kanji { color: var(--color-accent-teal); }

.touch-gedan {
  border-color: rgba(196, 68, 68, 0.25);
}
.touch-gedan .touch-zone-kanji { color: var(--color-accent-crimson); }

/* Active / pressed state */
.touch-zone:active,
.touch-zone.touch-active {
  transform: scale(0.92);
}

.touch-jodan:active,
.touch-jodan.touch-active {
  background: rgba(212, 168, 83, 0.15);
  border-color: var(--color-accent-gold);
  box-shadow: 0 0 16px var(--color-accent-gold-glow);
}

.touch-chudan-l:active,
.touch-chudan-l.touch-active,
.touch-chudan-r:active,
.touch-chudan-r.touch-active {
  background: rgba(74, 158, 142, 0.15);
  border-color: var(--color-accent-teal);
  box-shadow: 0 0 16px var(--color-accent-teal-glow);
}

.touch-gedan:active,
.touch-gedan.touch-active {
  background: rgba(196, 68, 68, 0.15);
  border-color: var(--color-accent-crimson);
  box-shadow: 0 0 16px var(--color-accent-crimson-glow);
}

/* Show touch controls on touch-capable devices */
@media (pointer: coarse) {
  .touch-controls {
    display: flex;
  }
  .controls-legend {
    display: none;
  }
}

/* Also show on narrow screens (phones always have touch) */
@media (max-width: 1024px) and (hover: none) {
  .touch-controls {
    display: flex;
  }
  .controls-legend {
    display: none;
  }
}

/* ==========================================================================
   STUDY HUB STYLES
   ========================================================================== */

/* Study Hub Tab Bar */
.study-tabs {
  display: flex;
  margin-bottom: var(--space-lg);
  background: rgba(255, 255, 255, 0.03);
  backdrop-filter: blur(15px);
  padding: 10px;
  border-radius: var(--radius-pill);
  border: 1px solid rgba(255, 255, 255, 0.05);
  box-shadow: 0 10px 30px rgba(0,0,0,0.3);
  gap: 10px;
  overflow-x: auto;
}

.study-tab {
  flex: 1;
  background: transparent;
  border: none;
  color: var(--color-text-muted);
  padding: 16px 20px;
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: 0.5px;
  border-radius: var(--radius-pill);
  cursor: pointer;
  transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  white-space: nowrap;
}

.study-tab:hover:not(.active) {
  color: #fff;
  background: rgba(255, 255, 255, 0.05);
  transform: translateY(-2px);
}

.study-tab.active {
  color: #fff;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.1), rgba(255, 255, 255, 0.02));
  box-shadow: inset 0 1px 1px rgba(255, 255, 255, 0.2), 0 5px 15px rgba(0,0,0,0.3);
  border: 1px solid rgba(255, 255, 255, 0.1);
  transform: translateY(-2px);
}

/* Personality Gradients for Study Modes */
.study-tab[data-mode='flashcards'].active {
  background: linear-gradient(135deg, rgba(255, 202, 40, 0.2), rgba(255, 202, 40, 0.05));
  border-color: rgba(255, 202, 40, 0.3);
  box-shadow: inset 0 1px 1px rgba(255, 202, 40, 0.4), 0 8px 20px rgba(255, 202, 40, 0.15);
  color: var(--color-accent-gold);
}

.study-tab[data-mode='counter'].active {
  background: linear-gradient(135deg, rgba(77, 182, 172, 0.2), rgba(77, 182, 172, 0.05));
  border-color: rgba(77, 182, 172, 0.3);
  box-shadow: inset 0 1px 1px rgba(77, 182, 172, 0.4), 0 8px 20px rgba(77, 182, 172, 0.15);
  color: var(--color-accent-teal);
}

.study-tab[data-mode='pipeline'].active {
  background: linear-gradient(135deg, rgba(255, 82, 82, 0.2), rgba(255, 82, 82, 0.05));
  border-color: rgba(255, 82, 82, 0.3);
  box-shadow: inset 0 1px 1px rgba(255, 82, 82, 0.4), 0 8px 20px rgba(255, 82, 82, 0.15);
  color: var(--color-accent-crimson);
}


.study-mode {
  padding: var(--space-lg) 0;
  animation: fadeIn 0.3s ease-in-out;
}

/* Mode 1: Flashcards */
.flashcard-container {
  display: flex;
  justify-content: center;
  perspective: 1000px;
  margin-bottom: var(--space-lg);
}

.flashcard {
  width: 350px;
  height: 220px;
  cursor: pointer;
  transition: transform 0.6s;
  transform-style: preserve-3d;
  position: relative;
}

.flashcard.flipped {
  transform: rotateY(180deg);
}

.flashcard-front, .flashcard-back {
  position: absolute;
  width: 100%;
  height: 100%;
  backface-visibility: hidden;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  border-radius: var(--radius-md);
  padding: var(--space-md);
  text-align: center;
}

.flashcard-front {
  background: var(--color-bg-card);
  border: 1px solid rgba(212, 168, 83, 0.3);
}

.flashcard-back {
  background: var(--color-bg-card-hover);
  border: 1px solid rgba(255, 255, 255, 0.1);
  transform: rotateY(180deg);
}

.fc-japanese {
  font-family: var(--font-heading);
  font-size: 3rem;
  color: var(--color-accent-gold);
}

.fc-hint {
  font-size: 0.85rem;
  color: var(--color-text-muted);
  margin-top: var(--space-md);
}

.fc-grade-buttons {
  display: flex;
  gap: var(--space-sm);
  justify-content: center;
  margin-top: var(--space-md);
}

.grade-again { border-color: var(--color-accent-crimson); color: var(--color-accent-crimson); }
.grade-hard { border-color: #ff9800; color: #ff9800; }
.grade-good { border-color: var(--color-accent-teal); color: var(--color-accent-teal); }
.grade-easy { border-color: var(--color-accent-gold); color: var(--color-accent-gold); }

/* Mode 2: Counter Drill */
.counter-attack-display {
  text-align: center;
  margin-bottom: var(--space-xl);
  min-height: 120px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.cd-attack-japanese {
  font-family: var(--font-heading);
  font-size: 3rem;
  color: var(--color-accent-crimson);
}

.cd-attack-romaji {
  color: var(--color-text-muted);
  margin-top: var(--space-sm);
}

.cd-answers {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-md);
  max-width: 600px;
  margin: 0 auto;
}

.cd-answer-btn {
  background: rgba(255, 255, 255, 0.08);
  backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: var(--radius-md);
  padding: var(--space-md);
  min-height: 48px;
  color: var(--color-text-main);
  cursor: pointer;
  transition: all var(--transition-fast);
  font-size: 1rem;
}

.cd-answer-btn:hover {
  transform: translateY(-2px);
  background: rgba(255, 255, 255, 0.15);
  border-color: rgba(255, 255, 255, 0.3);
}

.cd-answer-btn.correct {
  border-color: var(--color-accent-teal);
  box-shadow: var(--shadow-glow-teal);
  animation: pulse-glow 0.6s ease-out;
}

.cd-answer-btn.wrong {
  border-color: var(--color-accent-crimson);
  box-shadow: var(--shadow-glow-crimson);
  animation: shake 0.4s;
}

.cd-feedback {
  text-align: center;
  margin-top: var(--space-lg);
  min-height: 40px;
}

.cd-threshold-tip {
  color: var(--color-accent-teal);
  font-style: italic;
}

/* Mode 3: Pipeline Builder */
.pipeline-slots {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: center;
  gap: var(--space-sm);
  margin-bottom: var(--space-xl);
  flex-wrap: wrap;
}

.pb-slot {
  min-width: 90px;
  height: 90px;
  border: 2px dashed rgba(255, 255, 255, 0.2);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: var(--space-sm);
  background: rgba(10, 10, 15, 0.5);
  transition: all var(--transition-fast);
}

.pb-slot.filled {
  border: 2px solid var(--color-accent-gold);
  border-style: solid;
}

.pb-slot.correct {
  border-color: var(--color-accent-teal);
  box-shadow: var(--shadow-glow-teal);
}

.pb-slot.wrong {
  border-color: var(--color-accent-crimson);
  animation: shake 0.4s;
}

.pb-arrow {
  color: var(--color-text-muted);
}

.pb-options {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-md);
  max-width: 800px;
  margin: 0 auto;
}

.pb-option {
  background: var(--color-bg-card);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-md);
  padding: var(--space-md);
  text-align: center;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.pb-option:hover {
  background: var(--color-bg-card-hover);
  border-color: var(--color-accent-gold);
}

/* Mode 4: Philosophy Match */
.pm-columns {
  display: flex;
  flex-direction: row;
  gap: var(--space-xl);
  justify-content: center;
}

.pm-column {
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
  flex: 1;
  max-width: 400px;
}

.pm-item {
  background: var(--color-bg-card);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-pill);
  padding: var(--space-md) var(--space-lg);
  text-align: center;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.pm-item:hover {
  background: var(--color-bg-card-hover);
}

.pm-item.selected {
  border-color: var(--color-accent-gold);
  box-shadow: var(--shadow-glow-gold);
}

.pm-item.matched {
  background: var(--color-accent-teal);
  color: var(--color-bg-base);
  opacity: 0.5;
  pointer-events: none;
}

.pm-item.wrong {
  border-color: var(--color-accent-crimson);
  animation: shake 0.4s;
}

/* Mode 5: Belt Checklist */
.belt-tiers {
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
  max-width: 600px;
  margin: 0 auto;
}

.belt-tier-card {
  background: var(--color-bg-card);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-left: 4px solid #fff;
  border-radius: var(--radius-md);
  padding: var(--space-md);
  transition: all var(--transition-fast);
}

.belt-tier-card[data-tier='1'] { border-left-color: #ffffff; }
.belt-tier-card[data-tier='2'] { border-left-color: #f1c40f; }
.belt-tier-card[data-tier='3'] { border-left-color: #e67e22; }
.belt-tier-card[data-tier='4'] { border-left-color: #27ae60; }
.belt-tier-card[data-tier='5'] { border-left-color: #2980b9; }
.belt-tier-card[data-tier='6'] { border-left-color: #000000; color: var(--color-accent-gold); }

.belt-tier-card.locked {
  opacity: 0.5;
  filter: grayscale(100%);
  pointer-events: none;
}

.belt-progress-bar {
  width: 100%;
  height: 6px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-pill);
  margin-top: var(--space-sm);
  overflow: hidden;
}

.belt-progress-bar .meter-fill {
  background: currentColor;
}

.belt-technique-item {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-sm) 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.belt-technique-item.mastered {
  color: var(--color-accent-gold);
}

.belt-technique-item.mastered::before {
  content: '✓';
  color: var(--color-accent-gold);
}

/* Mode 6: Chinkon-gyō */
.chinkon-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 60vh;
}

.chinkon-circle-wrap {
  width: 200px;
  height: 200px;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: var(--space-xl);
}

.chinkon-breath-circle {
  width: 150px;
  height: 150px;
  border-radius: 50%;
  background: radial-gradient(circle, var(--color-accent-teal) 0%, transparent 70%);
  transition: transform 1s ease-in-out;
  opacity: 0.5;
}

.chinkon-breath-circle.inhale {
  transform: scale(2.5);
  transition-duration: 4s;
}

.chinkon-breath-circle.hold {
  transform: scale(2.5);
  box-shadow: var(--shadow-glow-teal);
}

.chinkon-breath-circle.exhale {
  transform: scale(1);
  transition-duration: 6s;
}

.chinkon-phase {
  font-family: var(--font-heading);
  font-size: 2rem;
  margin-bottom: var(--space-md);
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.chinkon-dokun {
  font-style: italic;
  color: var(--color-accent-teal);
  text-align: center;
  max-width: 600px;
  margin-top: var(--space-lg);
}

.chinkon-complete {
  text-align: center;
}

/* Mode 7: Renko Drill */
.renko-display {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 40vh;
  position: relative;
}

.rk-name {
  font-family: var(--font-heading);
  font-size: 4rem;
  margin-bottom: var(--space-lg);
}

.rk-progress-dots {
  display: flex;
  gap: var(--space-sm);
  margin-bottom: var(--space-xl);
}

.rk-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.2);
}

.rk-dot.current {
  border-color: var(--color-accent-gold);
  background: var(--color-accent-gold);
  box-shadow: var(--shadow-glow-gold);
  animation: pulse-glow 1s infinite alternate;
}

.rk-dot.success {
  background: var(--color-accent-teal);
  border-color: var(--color-accent-teal);
}

.rk-dot.fail {
  background: var(--color-accent-crimson);
  border-color: var(--color-accent-crimson);
}

.rk-attack-flash {
  position: absolute;
  font-family: var(--font-heading);
  font-size: 6rem;
  color: var(--color-accent-crimson);
  text-shadow: var(--shadow-glow-crimson);
  opacity: 0;
  pointer-events: none;
}

.rk-touch-controls {
  display: flex;
  gap: var(--space-md);
  justify-content: center;
  margin-top: var(--space-lg);
}

/* Mode 8: Embu Builder */
.embu-workspace {
  display: flex;
  flex-direction: row;
  gap: var(--space-lg);
  align-items: flex-start;
}

.embu-slots {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
}

.embu-pair {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: var(--space-sm);
  background: rgba(255, 255, 255, 0.02);
  padding: var(--space-sm);
  border-radius: var(--radius-md);
}

.embu-slot {
  flex: 1;
  min-height: 60px;
  border: 2px dashed rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: var(--space-sm);
  font-size: 0.9rem;
}

.embu-slot.filled {
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-style: solid;
  background: var(--color-bg-card);
}

.embu-slot.valid {
  border-color: var(--color-accent-teal);
}

.embu-slot.invalid {
  border-color: var(--color-accent-crimson);
}

.embu-palette {
  width: 300px;
  background: var(--color-bg-card);
  border-radius: var(--radius-md);
  padding: var(--space-md);
  max-height: 600px;
  overflow-y: auto;
}

.embu-palette-filters {
  display: flex;
  gap: var(--space-xs);
  margin-bottom: var(--space-md);
  overflow-x: auto;
  padding-bottom: var(--space-xs);
}

.embu-technique-list {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-sm);
}

.embu-tech-card {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-sm);
  padding: var(--space-sm);
  font-size: 0.85rem;
  cursor: grab;
}

.embu-validation {
  margin-top: var(--space-lg);
  background: var(--color-bg-card);
  border-radius: var(--radius-md);
  padding: var(--space-md);
}

.embu-rule {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  margin-bottom: var(--space-xs);
  font-size: 0.9rem;
}

.embu-rule.pass { color: var(--color-accent-teal); }
.embu-rule.fail { color: var(--color-accent-crimson); }

/* Shared Study Styles */
.study-mode-header {
  text-align: center;
  margin-bottom: var(--space-xl);
}

.study-mode-principle {
  font-family: var(--font-heading);
  color: var(--color-accent-gold);
  font-style: italic;
  font-size: 1.2rem;
  margin-bottom: var(--space-sm);
}

.study-stats, .study-progress {
  color: var(--color-text-muted);
  font-size: 0.85rem;
}

.study-celebration {
  animation: pulse-glow 2s ease-out;
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  10%, 30%, 50%, 70%, 90% { transform: translateX(-5px); }
  20%, 40%, 60%, 80% { transform: translateX(5px); }
}

@media (max-width: 768px) {
  .study-tabs {
    flex-wrap: nowrap;
  }
  .pm-columns, .embu-workspace {
    flex-direction: column;
  }
  .embu-palette {
    width: 100%;
  }
  .pipeline-slots {
    overflow-x: auto;
    flex-wrap: nowrap;
    justify-content: flex-start;
  }
  .pb-options {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* ==========================================================================
   ANIMATIONS (KEYFRAMES)
   ========================================================================== */

@keyframes fade-in-up {
  0% {
    opacity: 0;
    transform: translateY(30px);
  }
  100% {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes pulse-glow {
  0% {
    box-shadow: 0 0 5px rgba(212, 168, 83, 0.1);
    border-color: rgba(212, 168, 83, 0.3);
  }
  100% {
    box-shadow: 0 0 20px rgba(212, 168, 83, 0.5);
    border-color: rgba(212, 168, 83, 1);
  }
}

@keyframes flash-in {
  0% {
    opacity: 0;
    transform: scale(0.8);
    filter: blur(10px);
  }
  20% {
    opacity: 1;
    transform: scale(1.1);
    filter: blur(0);
  }
  30% {
    transform: scale(1);
  }
  80% {
    opacity: 1;
    transform: scale(1);
    filter: blur(0);
  }
  100% {
    opacity: 0;
    transform: scale(1.05);
    filter: blur(20px);
  }
}

@keyframes breathing {
  0%, 100% {
    transform: scale(1);
    opacity: 0.3;
  }
  50% {
    transform: scale(2.5);
    opacity: 0.8;
  }
}

@keyframes slide-in-left {
  0% {
    opacity: 0;
    transform: translateX(-50px);
  }
  100% {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes slide-in-right {
  0% {
    opacity: 0;
    transform: translateX(50px);
  }
  100% {
    opacity: 1;
    transform: translateX(0);
  }
}

/* Utility Animation Classes */
.animate-on-scroll {
  opacity: 0;
  transform: translateY(30px);
  transition: opacity 0.8s ease-out, transform 0.8s ease-out;
}

.animate-on-scroll.is-visible {
  opacity: 1;
  transform: translateY(0);
}

/* ==========================================================================
   MEDIA QUERIES
   ========================================================================== */

/* Tablet */
@media (max-width: 768px) {
  :root {
    --space-xxl: 6rem;
    --space-xl: 3rem;
  }
  
  .nav-toggle {
    display: flex;
  }
  
  .nav-links {
    position: absolute;
    top: 64px;
    left: 0;
    right: 0;
    flex-direction: column;
    background: rgba(10, 10, 15, 0.95);
    backdrop-filter: blur(12px);
    padding: var(--space-md);
    gap: var(--space-md);
    display: none;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  }
  
  .nav-links.show {
    display: flex;
  }
  
  .hero-border-box {
    width: 90%;
    height: 90%;
  }
  
  .philosophy-grid {
    grid-template-columns: 1fr;
    gap: var(--space-md);
  }
  
  .technique-grid, .tech-grid {
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  }
  
  .pipeline-stages {
    flex-direction: column;
    gap: var(--space-md);
  }
  
  .stage-arrow {
    transform: rotate(90deg);
  }
  
  .arena-hud {
    flex-direction: column;
    align-items: center;
  }
  
  .hud-fighter {
    max-width: 100%;
    width: 100%;
  }
  
  .controls-legend {
    display: none;
  }
}

/* Mobile */
@media (max-width: 480px) {
  :root {
    --space-xxl: 4rem;
    --space-xl: 2rem;
  }
  
  html {
    font-size: 14px;
  }
  
  .hero-title span {
    font-size: clamp(2.5rem, 10vw, 3.5rem);
  }
  
  .btn {
    width: 100%;
    margin-bottom: var(--space-sm);
  }
  
  .technique-filters {
    flex-direction: column;
    align-items: stretch;
  }
  
  .filter-btn {
    text-align: center;
  }
  
  .breathing-circle-container {
    width: 150px;
    height: 150px;
  }
}

/* Print styles (As requested, not needed, but explicitly removing default print styling if inherited) */
@media print {
  * {
    color: inherit !important;
    background: inherit !important;
    box-shadow: none !important;
  }
}

/* ═══════════════════════════════════════════════════ */
/* DAILY BANNER                                       */
/* ═══════════════════════════════════════════════════ */
.daily-banner {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 9999;
    background: linear-gradient(135deg, #0a0a1a 0%, #1a1a3e 50%, #0d1b2a 100%);
    border-bottom: 2px solid rgba(0, 212, 170, 0.3);
    padding: 0;
    animation: bannerSlideIn 0.5s ease-out;
    box-shadow: 0 4px 20px rgba(0,0,0,0.5);
}
.daily-banner.hidden { display: none; }
@keyframes bannerSlideIn {
    from { transform: translateY(-100%); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}
.daily-banner-content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 16px 24px;
    display: flex;
    align-items: center;
    gap: 24px;
    position: relative;
}
.daily-banner-left { flex: 1; }
.daily-banner-label {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 6px;
    flex-wrap: wrap;
}
.db-day {
    background: rgba(0, 212, 170, 0.15);
    color: #00d4aa;
    padding: 2px 10px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.5px;
}
.db-divider { color: rgba(255,255,255,0.2); font-size: 0.8rem; }
.db-label { color: rgba(255,255,255,0.6); font-size: 0.8rem; text-transform: uppercase; letter-spacing: 1px; }
.db-theme {
    color: #ffd700;
    font-size: 0.75rem;
    font-weight: 600;
    background: rgba(255,215,0,0.1);
    padding: 2px 10px;
    border-radius: 12px;
}
.db-quote-en {
    color: #ffffff;
    font-size: 1.1rem;
    font-weight: 500;
    margin: 4px 0 2px 0;
    line-height: 1.4;
    font-style: italic;
}
.db-quote-jp {
    color: rgba(255,255,255,0.35);
    font-size: 0.85rem;
    margin: 0;
}
.db-quote-romaji {
    color: rgba(0, 212, 170, 0.6);
    font-size: 0.75rem;
    margin: 0;
    font-style: italic;
}
.daily-banner-right {
    display: flex;
    gap: 16px;
    align-items: center;
    flex-shrink: 0;
}
.db-stat {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
}
.db-belt-icon {
    width: 24px;
    height: 8px;
    border-radius: 4px;
    display: block;
}
.db-belt-name {
    font-size: 0.7rem;
    color: rgba(255,255,255,0.7);
    font-weight: 500;
}
.db-stat-num {
    font-size: 1.2rem;
    font-weight: 700;
    color: #00d4aa;
}
.db-stat-label {
    font-size: 0.65rem;
    color: rgba(255,255,255,0.5);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.db-close {
    position: absolute;
    top: 8px;
    right: 12px;
    background: none;
    border: none;
    color: rgba(255,255,255,0.4);
    font-size: 1.1rem;
    cursor: pointer;
    padding: 4px 8px;
    transition: color 0.2s;
}
.db-close:hover { color: #fff; }
@media (max-width: 768px) {
    .daily-banner-content { flex-direction: column; gap: 12px; padding: 12px 16px; }
    .daily-banner-right { gap: 12px; justify-content: center; }
    .db-quote-en { font-size: 0.95rem; }
}

/* ═══════════════════════════════════════════════════ */
/* BELT CEREMONY OVERLAY                              */
/* ═══════════════════════════════════════════════════ */
.belt-ceremony-overlay {
    position: fixed;
    inset: 0;
    z-index: 10000;
    background: rgba(0, 0, 0, 0.85);
    display: flex;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.5s ease;
}
.belt-ceremony-overlay.hidden { display: none; }
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}
.belt-ceremony-card {
    background: linear-gradient(180deg, #1a1a3e 0%, #0a0a1a 100%);
    border: 1px solid rgba(255, 215, 0, 0.3);
    border-radius: 16px;
    padding: 48px 40px;
    max-width: 480px;
    width: 90%;
    text-align: center;
    animation: ceremonySweep 0.8s ease-out;
    box-shadow: 0 0 60px rgba(255, 215, 0, 0.1);
}
@keyframes ceremonySweep {
    from { transform: scale(0.8) translateY(40px); opacity: 0; }
    to { transform: scale(1) translateY(0); opacity: 1; }
}
.bc-header { margin-bottom: 24px; }
.bc-kanji {
    font-size: 2.5rem;
    color: #ffd700;
    display: block;
    margin-bottom: 8px;
    text-shadow: 0 0 20px rgba(255,215,0,0.3);
}
.bc-header h2 {
    color: #ffffff;
    font-size: 1.5rem;
    font-weight: 600;
    margin: 0;
    letter-spacing: 2px;
    text-transform: uppercase;
}
.bc-sash-container {
    display: flex;
    justify-content: center;
    margin: 24px 0;
}
.bc-belt-sash {
    width: 200px;
    height: 18px;
    border-radius: 9px;
    transition: background 1s ease;
    box-shadow: 0 2px 12px rgba(0,0,0,0.3);
}
.bc-belt-name {
    color: #fff;
    font-size: 1.8rem;
    margin: 8px 0 2px 0;
    font-weight: 700;
}
.bc-belt-jp {
    color: rgba(255,255,255,0.4);
    font-size: 1.1rem;
    margin: 0 0 24px 0;
}
.bc-unlock {
    color: #00d4aa;
    font-size: 0.9rem;
    font-weight: 500;
    margin: 0 0 24px 0;
}
.bc-quote-block {
    border-left: 3px solid rgba(255,215,0,0.3);
    padding: 12px 16px;
    margin: 0 0 24px 0;
    text-align: left;
}
.bc-quote-block p {
    color: rgba(255,255,255,0.8);
    font-style: italic;
    font-size: 1rem;
    margin: 0 0 6px 0;
    line-height: 1.5;
}
.bc-quote-block cite {
    color: rgba(255,255,255,0.4);
    font-size: 0.8rem;
}
.bc-continue {
    width: 100%;
    padding: 14px;
    font-size: 1rem;
    letter-spacing: 1px;
    margin-top: 8px;
}

/* ═══════════════════════════════════════════════════ */
/* BELT CHECKLIST ENHANCED                            */
/* ═══════════════════════════════════════════════════ */
.belt-tier-card {
    background: rgba(255,255,255,0.03);
    border-radius: 12px;
    margin-bottom: 16px;
    overflow: hidden;
    transition: all 0.3s ease;
}
.belt-tier-card.current {
    background: rgba(0, 212, 170, 0.05);
    border: 1px solid rgba(0, 212, 170, 0.2);
}
.belt-tier-card.locked {
    opacity: 0.5;
    filter: grayscale(0.5);
}
.belt-tier-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
}
.belt-tier-info {
    display: flex;
    align-items: center;
    gap: 12px;
}
.belt-sash {
    width: 32px;
    height: 10px;
    border-radius: 5px;
    display: inline-block;
    flex-shrink: 0;
}
.belt-tier-info h4 {
    color: #fff;
    margin: 0;
    font-size: 1rem;
    font-weight: 600;
}
.belt-tier-info h4 small {
    font-weight: 400;
}
.belt-tier-sub {
    color: rgba(255,255,255,0.5);
    font-size: 0.75rem;
}
.belt-pct {
    color: #00d4aa;
    font-weight: 700;
    font-size: 1.1rem;
}
.belt-progress-bar {
    height: 4px;
    background: rgba(255,255,255,0.05);
    overflow: hidden;
}
.belt-progress-fill {
    height: 100%;
    border-radius: 2px;
    transition: width 1s ease-out;
}
.belt-tech-list {
    list-style: none;
    padding: 8px 20px 16px;
    margin: 0;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 4px;
}
.belt-tech-list li {
    color: rgba(255,255,255,0.6);
    font-size: 0.8rem;
    padding: 4px 0;
}
.belt-tech-list li.mastered {
    color: #00d4aa;
}
.belt-tech-list li small {
    font-size: 0.7rem;
}
.belt-locked-msg {
    color: rgba(255,255,255,0.3);
    font-size: 0.85rem;
    padding: 8px 20px 16px;
    text-align: center;
    font-style: italic;
}

/* Accessibility */
button:focus-visible, a:focus-visible, input:focus-visible {
  outline: 2px solid var(--color-accent-teal);
  outline-offset: 2px;
}


/* Premium Lesson Alerts & Anchors (Ported from SalesTrainer) */
.lesson-alert {
  padding: 20px;
  background: rgba(77, 182, 172, 0.05);
  border-left: 4px solid var(--color-accent-teal);
  border-radius: 8px;
  margin: var(--space-md) 0;
  box-shadow: var(--shadow-md);
}

.lesson-alert strong {
  color: var(--color-accent-teal);
}

.lesson-anchor {
  padding: 20px;
  background: rgba(255, 202, 40, 0.05);
  border-left: 4px solid var(--color-accent-gold);
  border-radius: 8px;
  margin: var(--space-md) 0;
  box-shadow: var(--shadow-md);
}

.lesson-anchor strong {
  color: var(--color-accent-gold);
}
