/* ==========================================================================
   Lumina Academy - Quiet Premium Modern Core Stylesheet
   SaaS-Grade Aesthetics: Vibrant Hero Map, Full-Width Gradient Headers,
   Quiet Distraction-Free Text & Outcome Cards, Zero Noise
   ========================================================================== */

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

:root {
  /* Color Palette - Quiet Focus Theme */
  --bg-primary: #f8fafc;
  --text-primary: #0f172a;
  --text-secondary: #334155;
  --text-muted: #64748b;
  --border-muted: #e2e8f0;
  
  --primary: #4f46e5;
  --primary-glow: rgba(79, 70, 229, 0.08);
  --primary-hover: #4338ca;
  
  --success: #10b981;
  --success-glow: rgba(16, 185, 129, 0.05);
  --success-border: #a7f3d0;
  --success-text: #065f46;
  
  --danger: #ef4444;
  --danger-glow: rgba(239, 68, 68, 0.05);
  --danger-border: #fecaca;
  --danger-text: #991b1b;
  
  --warning: #f59e0b;
  --warning-bg: #fffbeb;
  --warning-border: #fde68a;
  --warning-text: #92400e;

  --terminal-bg: #090d16;
  --terminal-border: #1e293b;
  --terminal-header: #111726;
  --terminal-cursor: #38bdf8;
  --terminal-cmd: #ffffff;
  
  --card-bg: #ffffff;
  --card-border: 1px solid #e2e8f0;
  --card-shadow: 0 4px 20px -2px rgba(15, 23, 42, 0.02), 0 1px 3px rgba(0, 0, 0, 0.01);
  --card-hover-shadow: 0 10px 30px -10px rgba(79, 70, 229, 0.06), 0 1px 4px rgba(79, 70, 229, 0.02);
}

/* ==========================================================================
   1. Base & Layout
   ========================================================================== */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: 'Inter', 'Noto Sans JP', sans-serif;
  background: transparent;
  color: var(--text-primary);
  line-height: 1.6;
  font-size: 14.5px;
  -webkit-font-smoothing: antialiased;
  padding: 8px;
  zoom: 1.5; /* Global zoom 150% for standard modern display comfort */
}

/* Scrollbar styling */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 99px;
}
::-webkit-scrollbar-thumb:hover {
  background: #94a3b8;
}

.lesson-container {
  width: 100%;
  max-width: 100%;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 20px;
  animation: fadeIn 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

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

/* ==========================================================================
   2. Hero Banner & Tree Map (Vibrant Glassmorphism restored)
   ========================================================================== */
.hero-banner {
  background: linear-gradient(135deg, #2563eb 0%, #7c3aed 100%);
  color: white;
  border-radius: 24px;
  padding: 30px 24px;
  box-shadow: 0 15px 35px rgba(37, 99, 235, 0.2);
  position: relative;
  overflow: hidden;
}

.hero-banner::before {
  content: '';
  position: absolute;
  top: -30%;
  right: -10%;
  width: 250px;
  height: 250px;
  background: radial-gradient(circle, rgba(255,255,255,0.18) 0%, transparent 60%);
  border-radius: 50%;
  pointer-events: none;
}

.hero-tag {
  display: inline-block;
  background: rgba(255, 255, 255, 0.16);
  border: 1px solid rgba(255, 255, 255, 0.25);
  padding: 4px 12px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  margin-bottom: 12px;
  letter-spacing: 0.5px;
  color: #ffffff;
}

.hero-banner h1 {
  font-size: 26px;
  font-weight: 800;
  line-height: 1.3;
  margin-bottom: 6px;
  letter-spacing: -0.5px;
  color: #ffffff;
}

.hero-banner p {
  font-size: 13.5px;
  opacity: 0.9;
  font-weight: 400;
  color: #f1f5f9;
}

/* Learning Tree Map Breadcrumb-Containment Style */
.tree-map {
  margin-top: 18px;
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 14px;
  padding: 14px;
  backdrop-filter: blur(8px);
}

.tree-title {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: rgba(255, 255, 255, 0.75);
  margin-bottom: 8px;
  font-weight: 700;
}

.tree-breadcrumb {
  font-size: 12px;
  font-weight: 700;
  color: #ffffff;
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.tree-flow {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.tree-node {
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.15);
  padding: 5px 12px;
  border-radius: 8px;
  font-size: 11px;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.9);
  text-decoration: none;
  transition: all 0.2s ease;
}

.tree-node:hover {
  background: rgba(255, 255, 255, 0.2);
  color: #ffffff;
}

.tree-node.active {
  background: #ffffff;
  color: #4f46e5;
  box-shadow: 0 4px 12px rgba(255, 255, 255, 0.3);
  font-weight: 700;
  border-color: #ffffff;
}

.tree-arrow {
  color: rgba(255, 255, 255, 0.4);
  font-weight: bold;
  font-size: 11px;
}

/* ==========================================================================
   3. Cards & Section Headers (Vibrant Full-Width Gradient Headers)
   ========================================================================== */
.lesson-card {
  background: var(--card-bg);
  border: var(--card-border);
  border-radius: 16px;
  padding: 20px;
  box-shadow: var(--card-shadow);
  transition: all 0.25s ease;
  position: relative;
  overflow: hidden; /* Vital to clip the top-radius of full-width titles */
}

.lesson-card:hover {
  box-shadow: var(--card-hover-shadow);
}

/* Full-Width Gradient Section Header Capsule Band */
.card-title {
  display: flex;
  align-items: center;
  justify-content: center; /* Center weighted alignment */
  background: linear-gradient(135deg, #2563eb 0%, #7c3aed 100%); /* Same as Map */
  color: #ffffff;
  padding: 12px 20px;
  margin: -20px -20px 16px -20px; /* Flushes perfectly to top and side borders */
  border-radius: 15px 15px 0 0;
  font-size: 14px;
  font-weight: 900; /* Extra bold centering */
  letter-spacing: 0.5px;
  box-shadow: 0 4px 15px rgba(37, 99, 235, 0.12);
  text-align: center;
}

.instruction-text {
  font-size: 13.5px;
  color: var(--text-secondary);
  margin-bottom: 12px;
}

/* Specific styling for the top mastery index card */
.mastery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 14px;
  margin-top: 10px;
}

.mastery-box {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 14px;
}

.mastery-box-title {
  font-weight: 700;
  font-size: 13px;
  color: var(--primary);
  margin-bottom: 8px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.mastery-box-desc {
  font-size: 12.5px;
  color: var(--text-secondary);
  line-height: 1.5;
}

/* ==========================================================================
   4. Simulated Terminals & Micro-Learning Hints
   ========================================================================== */
.mac-terminal {
  background: var(--terminal-bg);
  border: 1px solid var(--terminal-border);
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
  margin: 14px 0;
  font-family: 'Fira Code', monospace;
  font-size: 12.5px;
}

.terminal-header {
  background: var(--terminal-header);
  padding: 8px 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid rgba(255, 255, 255, 0.03);
}

.terminal-buttons {
  display: flex;
  gap: 5px;
}

.terminal-btn {
  width: 9px;
  height: 9px;
  border-radius: 50%;
}
.terminal-btn.close { background: #ef4444; opacity: 0.6; }
.terminal-btn.minimize { background: #f59e0b; opacity: 0.6; }
.terminal-btn.maximize { background: #10b981; opacity: 0.6; }

.terminal-title {
  color: #475569;
  font-size: 10px;
  font-weight: 600;
  margin-right: 28px;
}

/* Crisp pure-white CLI text layout */
.terminal-body {
  padding: 14px;
  color: #ffffff; /* Crisp white */
  line-height: 1.6;
}

.terminal-line {
  margin-bottom: 10px;
}

.terminal-input-row {
  display: flex;
  align-items: flex-start;
  white-space: pre-wrap;
}

.t-prompt {
  color: #ffffff;
  user-select: none;
  margin-right: 8px;
}

.t-command {
  color: var(--terminal-cmd);
  font-weight: 600;
}

.t-blink {
  display: inline-block;
  width: 5px;
  height: 12px;
  background: var(--terminal-cursor);
  margin-left: 2px;
  animation: blink 1s infinite steps(2, start);
  vertical-align: middle;
}

@keyframes blink {
  to { visibility: hidden; }
}

/* Output Cards (Quiet 3px Left-Border Style) */
.output-success, .output-error, .output-neutral {
  margin-top: 12px;
  padding: 12px 14px;
  border-radius: 8px;
  font-size: 13px;
  background: #ffffff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.output-success {
  border: 1px solid var(--border-muted);
  border-left: 3px solid var(--success);
}
.output-error {
  border: 1px solid var(--border-muted);
  border-left: 3px solid var(--danger);
}
.output-neutral {
  border: 1px solid var(--border-muted);
  border-left: 3px solid var(--text-muted);
}

.output-title {
  font-weight: 700;
  margin-bottom: 4px;
  font-size: 12.5px;
  color: var(--text-primary);
}

.output-code {
  font-family: 'Fira Code', monospace;
  font-size: 11.5px;
  margin-top: 6px;
  background: #f8fafc;
  border: 1px solid var(--border-muted);
  padding: 6px 10px;
  border-radius: 6px;
  white-space: pre-wrap;
  color: var(--text-secondary);
}

/* ==========================================================================
   5. Interactive Checkpoint: Mental Model MCQ Quiz (4 Options)
   ========================================================================== */
.quiz-container {
  margin-top: 14px;
  border-top: 1px solid var(--border-muted);
  padding-top: 14px;
}

.quiz-question {
  font-weight: 700;
  font-size: 13.5px;
  color: var(--text-primary);
  margin-bottom: 10px;
}

.quiz-options {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
}

.quiz-option {
  display: flex;
  align-items: center;
  gap: 10px;
  background: #f8fafc;
  border: 1px solid var(--border-muted);
  padding: 10px 12px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 13px;
  transition: all 0.2s ease;
  user-select: none;
}

.quiz-option:hover {
  background: #f1f5f9;
  border-color: #cbd5e1;
}

.quiz-option input[type="radio"] {
  accent-color: var(--primary);
  width: 15px;
  height: 15px;
}

.quiz-option.correct {
  background: var(--success-glow);
  border-color: var(--success);
  color: var(--success-text);
  font-weight: 600;
}

.quiz-option.wrong {
  background: var(--danger-glow);
  border-color: var(--danger);
  color: var(--danger-text);
}

.quiz-feedback {
  margin-top: 10px;
  font-size: 12.5px;
  font-weight: 600;
  padding: 8px 10px;
  border-radius: 6px;
  display: none;
}
.quiz-feedback.success-msg {
  display: block;
  background: var(--success-glow);
  color: var(--success-text);
  border: 1px solid var(--success-border);
}
.quiz-feedback.error-msg {
  display: block;
  background: var(--danger-glow);
  color: var(--danger-text);
  border: 1px solid var(--danger-border);
}

/* ==========================================================================
   6. Interactive Locking Mechanisms (Predict First)
   ========================================================================== */
.step-locked {
  filter: blur(1.5px) grayscale(50%);
  opacity: 0.55;
  pointer-events: none;
  position: relative;
  transition: all 0.4s ease;
}

.step-locked::before {
  content: '🔒 解放条件未達成 (理解テストクリア 又は 前段階の予測を確定してください)';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: #1e293b;
  color: #f8fafc;
  padding: 6px 14px;
  border-radius: 99px;
  font-size: 11px;
  font-weight: 700;
  z-index: 10;
  box-shadow: 0 4px 12px rgba(15, 23, 42, 0.15);
  pointer-events: auto;
}

.step-unlocked {
  filter: none;
  opacity: 1;
  pointer-events: auto;
}

/* Reflection Box (Quiet Design) */
.reflection-box {
  background: #f8fafc;
  border: 1px solid var(--border-muted);
  border-radius: 12px;
  padding: 14px;
  margin-top: 12px;
}

.reflection-title {
  font-weight: 700;
  color: var(--text-primary);
  font-size: 13px;
  margin-bottom: 8px;
}

textarea.reflection-input {
  width: 100%;
  min-height: 70px;
  border: 1px solid var(--border-muted);
  background: #ffffff;
  border-radius: 8px;
  padding: 8px 10px;
  font-family: inherit;
  font-size: 13px;
  color: var(--text-primary);
  resize: vertical;
  outline: none;
  transition: border-color 0.2s ease;
}

textarea.reflection-input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-glow);
}

.action-btn {
  background: #1e293b;
  color: white;
  border: none;
  border-radius: 8px;
  padding: 8px 14px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  margin-top: 8px;
  transition: all 0.15s ease;
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.action-btn:hover {
  background: var(--text-primary);
}

.action-btn.edit-mode {
  background: #ffffff;
  color: var(--text-primary);
  border: 1px solid var(--text-muted);
}
.action-btn.edit-mode:hover {
  background: #f1f5f9;
}

.action-btn:disabled {
  background: var(--border-muted);
  color: var(--text-muted);
  cursor: not-allowed;
}

/* ==========================================================================
   7. Interactive Tooltip Dictionary System (Quiet Dot Underline)
   ========================================================================== */
.cmd-tooltip {
  cursor: help;
  border-bottom: 1.5px dotted var(--text-muted);
  font-family: 'Fira Code', monospace;
  font-weight: 700;
  padding: 0 2px;
  color: var(--text-primary);
  transition: all 0.15s ease;
  user-select: none;
}

.cmd-tooltip:hover {
  background: var(--primary-glow);
  color: var(--primary);
  border-bottom-color: var(--primary);
  border-bottom-style: solid;
}

/* Tooltip Popup Card */
.tooltip-card {
  position: absolute;
  z-index: 9999;
  width: 300px;
  max-height: 85vh;
  overflow-y: auto;
  background: white;
  border: 1px solid var(--border-muted);
  box-shadow: 0 8px 20px -4px rgba(15, 23, 42, 0.08);
  border-radius: 12px;
  padding: 14px;
  font-family: 'Inter', 'Noto Sans JP', sans-serif;
  color: var(--text-primary);
  text-align: left;
  line-height: 1.5;
  animation: tooltipFadeIn 0.15s cubic-bezier(0.16, 1, 0.3, 1);
  pointer-events: auto;
}

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

.tooltip-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border-muted);
  padding-bottom: 6px;
  margin-bottom: 6px;
}

.tooltip-title {
  font-family: 'Fira Code', monospace;
  font-size: 14px;
  font-weight: 700;
  color: var(--primary);
}

.tooltip-tag {
  background: #f1f5f9;
  color: var(--text-muted);
  font-size: 9px;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 4px;
}

.tooltip-desc {
  font-size: 12px;
  font-weight: 500;
  margin-bottom: 6px;
  color: var(--text-secondary);
}

.tooltip-eg {
  background: #f8fafc;
  border: 1px solid var(--border-muted);
  border-radius: 6px;
  padding: 6px 8px;
  margin-bottom: 8px;
}

.tooltip-eg div {
  font-family: 'Fira Code', monospace;
  font-size: 10.5px;
}
.tooltip-eg .t-eg-cmd { color: #b45309; font-weight: 600; }
.tooltip-eg .t-eg-out { color: var(--text-muted); margin-top: 1px; }

.tooltip-warning {
  background: #fffbeb;
  border-left: 2px solid #f59e0b;
  padding: 4px 6px;
  font-size: 10.5px;
  border-radius: 4px;
  color: #92400e;
}

.tooltip-doc-btn {
  display: block;
  text-align: center;
  background: #f1f5f9;
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 10px;
  font-weight: 600;
  padding: 5px 0;
  border-radius: 4px;
  margin-top: 6px;
  transition: all 0.2s ease;
}

.tooltip-doc-btn:hover {
  background: #e2e8f0;
  color: var(--text-primary);
}

/* ==========================================================================
   8. Specialized Step-Checkbox System (Unified in Dedicated Card)
   ========================================================================== */
.mission-checkbox {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  font-weight: 600;
  font-size: 13px;
  cursor: pointer;
  color: var(--text-secondary);
  user-select: none;
  transition: all 0.15s ease;
  background: #f8fafc;
  border: 1px solid var(--border-muted);
  border-radius: 10px;
  margin-bottom: 8px;
}

.mission-checkbox:hover {
  color: var(--text-primary);
  background: #f1f5f9;
  border-color: #cbd5e1;
}

.mission-checkbox input[type="checkbox"] {
  width: 15px;
  height: 15px;
  border-radius: 4px;
  border: 2px solid var(--text-muted);
  cursor: pointer;
  accent-color: var(--success);
}

.mission-checkbox.completed {
  color: var(--text-muted);
  text-decoration: line-through;
  background: var(--success-glow);
  border-color: var(--success-border);
}

/* Paper Notebook Mockup Container */
.paper-notebook {
  background-color: #ffffff;
  background-image: linear-gradient(#f1f5f9 1px, transparent 1px);
  background-size: 100% 22px;
  border: 1px solid #cbd5e1;
  border-radius: 12px;
  padding: 18px 20px;
  position: relative;
}

.paper-notebook::before {
  content: '';
  position: absolute;
  top: 0;
  left: 14px;
  width: 1px;
  height: 100%;
  background: #fca5a5;
  opacity: 0.6;
}

.notebook-header {
  font-family: 'Noto Sans JP', sans-serif;
  font-weight: 800;
  color: var(--primary);
  font-size: 13.5px;
  margin-bottom: 16px;
  letter-spacing: 0.5px;
}

.notebook-content {
  padding-left: 8px;
  line-height: 22px;
  font-size: 12.5px;
  color: var(--text-secondary);
  font-weight: 500;
}

.notebook-content ul {
  list-style-type: square;
  padding-left: 14px;
}

.notebook-content li {
  margin-bottom: 4px;
}

/* Embedded Status Badge Indicator (aligned at bottom inside notebook) */
.ready-badge-container {
  display: none !important;
  margin-top: 16px;
  border-top: 1px dashed #cbd5e1;
  padding-top: 14px;
  text-align: center;
}

.ready-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: var(--text-muted);
  color: white;
  padding: 4px 10px;
  border-radius: 99px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  margin-bottom: 6px;
}

.ready-badge.completed {
  background: var(--success);
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.2);
}

.ready-text {
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 500;
  line-height: 1.5;
}

/* Responsive adjustments */
@media (max-width: 640px) {
  .hero-banner {
    padding: 20px 16px;
  }
  .hero-banner h1 {
    font-size: 20px;
  }
  .lesson-card {
    padding: 14px;
  }
}

/* Discovery Cards flat-panel grids */
.discovery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 16px;
  margin-top: 14px;
}

/* Static Encyclopedia Discovery Cards */
.discovery-card {
  background: #ffffff;
  border: 1px solid var(--border-muted);
  border-radius: 12px;
  padding: 16px;
  font-family: 'Inter', 'Noto Sans JP', sans-serif;
  color: var(--text-primary);
  text-align: left;
  line-height: 1.5;
  transition: all 0.25s ease;
  box-shadow: 0 1px 3px rgba(0,0,0,0.02);
}

.discovery-card:hover {
  box-shadow: 0 10px 25px -5px rgba(79, 70, 229, 0.08);
  border-color: #cbd5e1;
  transform: translateY(-2px);
}

.discovery-card .tooltip-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border-muted);
  padding-bottom: 6px;
  margin-bottom: 8px;
}

.discovery-card .tooltip-title {
  font-family: 'Fira Code', monospace;
  font-size: 15px;
  font-weight: 700;
  color: var(--primary);
}

.discovery-card .tooltip-tag {
  background: #f1f5f9;
  color: var(--text-muted);
  font-size: 9px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 4px;
}

.discovery-card .tooltip-desc {
  font-size: 12.5px;
  font-weight: 500;
  margin-bottom: 8px;
  color: var(--text-secondary);
}

.discovery-card .tooltip-eg {
  background: #f8fafc;
  border: 1px solid var(--border-muted);
  border-radius: 6px;
  padding: 6px 8px;
  margin-bottom: 8px;
}

.discovery-card .tooltip-eg div {
  font-family: 'Fira Code', monospace;
  font-size: 10.5px;
}
.discovery-card .t-eg-cmd { color: #b45309; font-weight: 600; }
.discovery-card .t-eg-out { color: var(--text-muted); margin-top: 1px; }

.discovery-card .tooltip-warning {
  background: #fffbeb;
  border-left: 2px solid #f59e0b;
  padding: 6px 8px;
  font-size: 10.5px;
  border-radius: 4px;
  color: #92400e;
  line-height: 1.4;
  margin-bottom: 8px;
}

.discovery-card .tooltip-doc-btn {
  display: block;
  text-align: center;
  background: #f1f5f9;
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 10px;
  font-weight: 600;
  padding: 5px 0;
  border-radius: 4px;
  margin-top: 8px;
  transition: all 0.2s ease;
}

.discovery-card .tooltip-doc-btn:hover {
  background: #e2e8f0;
  color: var(--text-primary);
}

/* 🏆 Hide command category badges (Built-in Command, Standard Tool etc.) to reduce noise */
.tooltip-tag {
  display: none !important;
}
