@import url('https://fonts.googleapis.com/css2?family=M+PLUS+Rounded+1c:wght@400;700;800;900&family=Noto+Sans+JP:wght@400;700&display=swap');

/* ============================
   CSS Custom Properties
============================ */
:root {
  --color-primary: #5C6BC0;
  --color-secondary: #FFD600;
  --color-success: #00C853;
  --color-error: #FF1744;
  --color-warning: #FF9100;
  --color-bg: #F0F4FF;
  --color-surface: #FFFFFF;
  --color-text: #1A1A3E;
  --color-text-light: #7986CB;
  --color-border: #E8EEFF;

  --ch1-color: #FF5722;
  --ch2-color: #2196F3;
  --ch3-color: #4CAF50;
  --ch4-color: #9C27B0;
  --ch5-color: #FF9800;

  --radius-sm: 10px;
  --radius-md: 18px;
  --radius-lg: 28px;
  --radius-xl: 40px;

  --shadow-sm: 0 4px 12px rgba(92, 107, 192, 0.15);
  --shadow-md: 0 8px 28px rgba(92, 107, 192, 0.22);
  --shadow-lg: 0 16px 48px rgba(92, 107, 192, 0.28);

  --font-main: 'M PLUS Rounded 1c', 'Noto Sans JP', sans-serif;
}

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

html { scroll-behavior: smooth; }

body {
  font-family: var(--font-main);
  background: var(--color-bg);
  color: var(--color-text);
  line-height: 1.7;
  min-height: 100vh;
  font-size: 17px;
}

img { max-width: 100%; display: block; }
a { color: var(--color-primary); text-decoration: none; }

ruby rt { font-size: 0.6em; color: var(--color-text-light); }

/* ============================
   Typography
============================ */
h1, h2, h3, h4 { font-weight: 900; line-height: 1.25; }
p { margin-bottom: 0.8em; }
p:last-child { margin-bottom: 0; }

/* ============================
   Buttons
============================ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 14px 30px;
  font-family: var(--font-main);
  font-size: 17px;
  font-weight: 800;
  border: none;
  border-radius: var(--radius-xl);
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
  text-decoration: none !important;
  user-select: none;
  letter-spacing: 0.02em;
}
.btn:hover:not(:disabled) { transform: translateY(-3px) scale(1.03); box-shadow: var(--shadow-md); }
.btn:active:not(:disabled) { transform: translateY(0) scale(0.98); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }

.btn-primary {
  background: linear-gradient(135deg, #5C6BC0, #3949AB);
  color: white;
  box-shadow: 0 4px 15px rgba(92,107,192,0.4);
}
.btn-secondary {
  background: white;
  color: var(--color-primary);
  border: 3px solid var(--color-primary);
}
.btn-success {
  background: linear-gradient(135deg, #00C853, #00897B);
  color: white;
  box-shadow: 0 4px 15px rgba(0,200,83,0.35);
}
.btn-warning {
  background: linear-gradient(135deg, #FFD600, #FF9100);
  color: #1A1A3E;
  box-shadow: 0 4px 15px rgba(255,214,0,0.4);
}
.btn-lg {
  padding: 18px 40px;
  font-size: 20px;
  border-radius: 50px;
}

/* ============================
   Cards
============================ */
.card {
  background: var(--color-surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  padding: 24px;
  border: 2px solid var(--color-border);
  transition: box-shadow 0.2s ease, transform 0.2s ease;
}
.card:hover { box-shadow: var(--shadow-md); }

/* ============================
   Mascot Bubble
============================ */
.mascot-bubble {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  background: linear-gradient(135deg, #EEF0FF, #E8F5FF);
  border-radius: var(--radius-lg);
  padding: 18px 22px;
  border: 2px solid #C5CAE9;
  margin: 16px 0;
}
.mascot-avatar { font-size: 2.4rem; flex-shrink: 0; line-height: 1; }
.mascot-text { font-size: 15px; line-height: 1.65; }
.mascot-name {
  display: block;
  font-size: 0.72rem;
  color: var(--color-text-light);
  font-weight: 900;
  margin-bottom: 5px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

/* ============================
   Site Header
============================ */
.site-header {
  background: linear-gradient(90deg, #3949AB 0%, #5C6BC0 50%, #7E57C2 100%);
  color: white;
  padding: 0 28px;
  height: 68px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 200;
  box-shadow: 0 4px 20px rgba(57,73,171,0.45);
}
.site-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  color: white;
  text-decoration: none !important;
  font-size: 22px;
  font-weight: 900;
  letter-spacing: -0.01em;
}
.site-logo-icon { font-size: 1.9rem; }

.site-nav { display: flex; align-items: center; gap: 8px; }
.site-nav a {
  color: rgba(255,255,255,0.88);
  font-weight: 800;
  font-size: 14px;
  padding: 7px 15px;
  border-radius: var(--radius-sm);
  transition: background 0.15s, color 0.15s;
}
.site-nav a:hover { background: rgba(255,255,255,0.22); color: white; }

/* ============================
   Container
============================ */
.container { max-width: 960px; margin: 0 auto; padding: 0 20px; }

/* ============================
   Lesson card (top page)
============================ */
.lesson-card {
  background: var(--color-surface);
  border-radius: var(--radius-md);
  padding: 22px;
  border: 3px solid var(--color-border);
  text-decoration: none !important;
  color: var(--color-text);
  transition: transform 0.2s cubic-bezier(.34,1.56,.64,1), box-shadow 0.2s ease, border-color 0.2s ease;
  display: flex;
  flex-direction: column;
  gap: 10px;
  position: relative;
  overflow: hidden;
}
.lesson-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0;
  width: 6px; height: 100%;
  background: var(--ch-color, var(--color-primary));
  border-radius: 0;
}
.lesson-card:hover {
  transform: translateY(-5px) scale(1.02);
  box-shadow: var(--shadow-md);
  border-color: var(--ch-color, var(--color-primary));
}
.lesson-card.completed::after {
  content: '✅';
  position: absolute;
  top: 12px; right: 12px;
  font-size: 1.2rem;
}
.lesson-num { font-size: 13px; color: var(--color-text-light); font-weight: 800; }
.lesson-title { font-size: 15px; font-weight: 800; line-height: 1.45; }
.lesson-meta { display: flex; gap: 6px; flex-wrap: wrap; margin-top: auto; }
.lesson-tag {
  font-size: 12px;
  padding: 3px 10px;
  border-radius: 12px;
  background: var(--color-border);
  color: var(--color-text-light);
  font-weight: 700;
}
.lesson-tag.arduino { background: #E8F5E9; color: #2E7D32; }

/* ============================
   Lesson grid
============================ */
.lesson-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 14px;
}

/* ============================
   Confetti
============================ */
.confetti-piece {
  position: fixed;
  top: -20px;
  animation: confetti-fall linear forwards;
  pointer-events: none;
  z-index: 9999;
}
@keyframes confetti-fall {
  0% { transform: translateY(0) rotate(0deg); opacity: 1; }
  100% { transform: translateY(110vh) rotate(720deg); opacity: 0; }
}

/* ============================
   Responsive
============================ */
@media (max-width: 600px) {
  body { font-size: 15px; }
  .site-header { padding: 0 14px; }
  .container { padding: 0 12px; }
}
