/* ── lesson.css — shared styles for all tutorial day pages ── */
@import url('https://fonts.googleapis.com/css2?family=Baloo+2:wght@400;600;800&family=Nunito:wght@400;700;900&display=swap');

:root {
  --bg:      #0D1B2A;
  --card-bg: #15263A;
  --deep:    #0A1520;
  --white:   #FFFFFF;
  --yellow:  #FFD700;
  --orange:  #FF6B00;
  --red:     #E02020;
  --blue:    #1565C0;
  --green:   #2E7D32;
  --grey:    #4A5568;
  --accent:  #FFD700;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: 'Nunito', sans-serif; background: var(--bg); color: #fff; min-height: 100vh; overflow-x: hidden; }

/* ── Starfield ── */
.starfield { position: fixed; inset: 0; pointer-events: none; z-index: 0; overflow: hidden; }
.star {
  position: absolute; background: #fff; border-radius: 50%;
  animation: twinkle var(--dur, 3s) var(--delay, 0s) ease-in-out infinite alternate;
}
@keyframes twinkle {
  from { opacity: var(--lo, .2); transform: scale(1); }
  to   { opacity: var(--hi, .8); transform: scale(1.4); }
}

.page { position: relative; z-index: 1; max-width: 860px; margin: 0 auto; padding: 40px 20px 70px; }

/* ── Tutorial nav ── */
.tutorial-nav {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 32px; flex-wrap: wrap; gap: 10px;
}
.tutorial-nav a {
  font-family: 'Baloo 2', cursive; font-weight: 800; font-size: .82rem;
  padding: 7px 16px; border-radius: 999px; text-decoration: none;
  display: inline-flex; align-items: center; gap: 6px;
  transition: transform .15s;
}
.tutorial-nav a:hover { transform: translateY(-2px); }
.tnav-back { background: rgba(255,255,255,.08); color: rgba(255,255,255,.7); border: 1px solid rgba(255,255,255,.12); }
.tnav-prev { background: rgba(255,255,255,.06); color: rgba(255,255,255,.5); border: 1px solid rgba(255,255,255,.08); }
.tnav-next { background: linear-gradient(135deg, var(--blue), #42a5f5); color: #fff; }
.tnav-disabled { opacity: .3; pointer-events: none; }

/* ── Header ── */
.header { text-align: center; margin-bottom: 36px; animation: fadeDown .7s ease both; }
.badge-row { display: flex; justify-content: center; gap: 10px; margin-bottom: 14px; flex-wrap: wrap; }
.badge {
  display: inline-block;
  font-family: 'Baloo 2', cursive; font-weight: 800; font-size: .8rem;
  letter-spacing: .1em; text-transform: uppercase;
  padding: 5px 16px; border-radius: 999px; color: #000;
}
.badge-step { background: linear-gradient(135deg, var(--blue), #42a5f5); color: #fff; }
.badge-theme { background: linear-gradient(135deg, var(--white), #e0e0e0); }
h1 {
  font-family: 'Baloo 2', cursive; font-weight: 800;
  font-size: clamp(2.2rem, 6vw, 3.6rem); line-height: 1.05;
  background: linear-gradient(135deg, #fff 0%, #a8d8ff 40%, var(--yellow) 100%);
  -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text;
  margin-bottom: 8px;
}
.subtitle { font-size: 1.1rem; color: rgba(255,255,255,.6); font-weight: 600; }

/* ── Spinning CSS cube (hero decoration) ── */
.cube-hero { display: flex; justify-content: center; margin-bottom: 38px; animation: fadeUp .7s .1s ease both; }
.cube3d {
  width: 120px; height: 120px;
  transform-style: preserve-3d;
  transform: rotateX(-25deg) rotateY(30deg);
  animation: rotateCube 12s linear infinite;
}
@keyframes rotateCube { from { transform: rotateX(-25deg) rotateY(0deg); } to { transform: rotateX(-25deg) rotateY(360deg); } }
.face { position: absolute; width: 120px; height: 120px; display: grid; grid-template-columns: repeat(3,1fr); gap: 4px; padding: 4px; border-radius: 5px; }
.face-front  { transform: translateZ(60px);  background: rgba(0,0,0,.35); }
.face-back   { transform: rotateY(180deg) translateZ(60px); background: rgba(0,0,0,.35); }
.face-right  { transform: rotateY(90deg)  translateZ(60px); background: rgba(0,0,0,.35); }
.face-left   { transform: rotateY(-90deg) translateZ(60px); background: rgba(0,0,0,.35); }
.face-top    { transform: rotateX(90deg)  translateZ(60px); background: rgba(0,0,0,.35); }
.face-bottom { transform: rotateX(-90deg) translateZ(60px); background: rgba(0,0,0,.35); }
.cell { border-radius: 3px; }

/* ── Mission box ── */
.mission {
  background: linear-gradient(135deg, #1E3A5A, #162B42);
  border: 2px solid rgba(255,215,0,.35);
  border-radius: 20px; padding: 24px 28px; margin-bottom: 38px;
  animation: fadeUp .7s .2s ease both; position: relative; overflow: hidden;
}
.mission h2 { font-family: 'Baloo 2', cursive; font-size: 1.35rem; color: var(--yellow); margin-bottom: 6px; }
.mission p  { color: rgba(255,255,255,.82); font-size: 1.04rem; line-height: 1.55; }

/* ── Demo section (optional, used by day-2) ── */
.wr-title {
  font-family: 'Baloo 2', cursive; font-size: 1.45rem; color: #a8d8ff;
  margin-bottom: 18px; display: flex; align-items: center; gap: 10px;
  animation: fadeUp .7s .28s ease both;
}
.wr-grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: 20px;
  margin-bottom: 40px; animation: fadeUp .7s .32s ease both;
}
@media (max-width: 540px) { .wr-grid { grid-template-columns: 1fr; } }
.wr-card {
  background: var(--card-bg); border-radius: 18px; padding: 22px 20px 18px;
  display: flex; flex-direction: column; align-items: center; gap: 14px;
  border: 2px solid transparent;
}
.wr-card.algo { border-color: rgba(255,215,0,.45); }
.wr-verdict { font-family: 'Baloo 2', cursive; font-size: 1.5rem; }
.wr-card.algo .wr-verdict { color: var(--yellow); }
.wr-caption { font-size: .95rem; text-align: center; line-height: 1.45; color: rgba(255,255,255,.75); font-weight: 700; }

/* ── Move chips / RubikPlayer UI ── */
.algo-moves { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; margin-bottom: 10px; }
.move-chip {
  background: linear-gradient(135deg, var(--blue), #42a5f5);
  color: #fff; font-family: 'Baloo 2', cursive; font-weight: 800; font-size: 1.0rem;
  padding: 8px 18px; border-radius: 999px; letter-spacing: .05em;
  transition: transform .15s, box-shadow .15s, opacity .15s;
}
.move-chip.chip-active {
  transform: scale(1.22);
  box-shadow: 0 0 0 3px #fff, 0 0 18px 4px rgba(255,255,255,.55);
  animation: chipPulse .5s ease-in-out infinite alternate;
}
.move-chip.chip-done { opacity: .35; }
@keyframes chipPulse {
  from { box-shadow: 0 0 0 3px #fff, 0 0 12px 2px rgba(255,255,255,.4); }
  to   { box-shadow: 0 0 0 3px #fff, 0 0 24px 8px rgba(255,255,255,.7); }
}
.move-chip.orange { background: linear-gradient(135deg, var(--orange), #ffa040); }
.move-chip.green  { background: linear-gradient(135deg, var(--green),  #66bb6a); }
.move-chip.yellow { background: linear-gradient(135deg, var(--yellow), #ffe84a); color: #000; }
.move-chip.red    { background: linear-gradient(135deg, var(--orange), #f80606); color: #000; }

.player-controls { display: flex; gap: 8px; justify-content: center; margin-top: 10px; flex-wrap: wrap; }
.player-btn {
  font-family: 'Baloo 2', cursive; font-weight: 800; font-size: .82rem;
  padding: 7px 14px; border-radius: 999px; border: none; cursor: pointer;
  letter-spacing: .04em; transition: transform .15s, box-shadow .15s;
  display: inline-flex; align-items: center; gap: 5px; white-space: nowrap;
}
.player-btn:hover { transform: translateY(-2px); }
.player-btn:active { transform: scale(.95); }
.btn-step { background: linear-gradient(135deg, var(--orange), #ffa040); color: #fff; box-shadow: 0 4px 12px rgba(255,107,0,.35); }
.btn-loop { background: linear-gradient(135deg, #6a1b9a, #ab47bc); color: #fff; box-shadow: 0 4px 12px rgba(106,27,154,.4); }

/* ── Key rules ── */
.rule-box {
  background: linear-gradient(135deg, rgba(255,215,0,.1), rgba(255,215,0,.05));
  border: 2px solid rgba(255,215,0,.5);
  border-radius: 18px; padding: 22px 26px; margin-bottom: 40px;
  animation: fadeUp .7s .45s ease both;
}
.rule-box h3 { font-family: 'Baloo 2', cursive; color: var(--yellow); font-size: 1.2rem; margin-bottom: 12px; }
.rule-item {
  display: flex; align-items: flex-start; gap: 12px;
  padding: 10px 0; border-bottom: 1px solid rgba(255,255,255,.08);
  font-size: 1.0rem; color: rgba(255,255,255,.85); font-weight: 700; line-height: 1.4;
}
.rule-item:last-child { border-bottom: none; }
.rule-icon { font-size: 1.4rem; flex-shrink: 0; margin-top: 1px; }

/* ── Numbered step cards ── */
.steps-title {
  font-family: 'Baloo 2', cursive; font-size: 1.45rem; color: var(--yellow);
  margin-bottom: 18px; display: flex; align-items: center; gap: 10px;
  animation: fadeUp .7s .5s ease both;
}
.steps { display: flex; flex-direction: column; gap: 14px; margin-bottom: 40px; }
.step-card {
  background: var(--card-bg); border-radius: 16px; padding: 18px 22px;
  display: flex; align-items: flex-start; gap: 16px;
  border-left: 5px solid transparent; animation: fadeUp .6s ease both;
}
.step-card:nth-child(1) { animation-delay: .52s; border-color: var(--blue); }
.step-card:nth-child(2) { animation-delay: .57s; border-color: var(--orange); }
.step-card:nth-child(3) { animation-delay: .62s; border-color: var(--green); }
.step-card:nth-child(4) { animation-delay: .67s; border-color: var(--yellow); }
.step-card:nth-child(5) { animation-delay: .72s; border-color: var(--red); }
.step-num {
  flex-shrink: 0; width: 40px; height: 40px; border-radius: 12px;
  font-family: 'Baloo 2', cursive; font-weight: 800; font-size: 1.1rem;
  color: #000; display: flex; align-items: center; justify-content: center;
}
.step-body { flex: 1; }
.step-body strong { font-family: 'Baloo 2', cursive; font-size: 1.1rem; display: block; margin-bottom: 4px; color: #fff; }
.step-body p { font-size: .98rem; color: rgba(255,255,255,.75); line-height: 1.5; font-weight: 600; }
.step-illus { display: flex; justify-content: center; width: 100%; margin-top: 12px; }
.step-marker {
  position: absolute; width: 20px; height: 20px; border-radius: 50%;
  background: rgba(255,255,255,.25); border: 2.5px solid #fff;
  animation: cornerPing 1.1s ease-in-out infinite;
  pointer-events: none; transform: translate(-50%,-50%);
}
@keyframes cornerPing {
  0%   { transform: translate(-50%,-50%) scale(1);   opacity: 1; }
  70%  { transform: translate(-50%,-50%) scale(2.2); opacity: 0; }
  100% { transform: translate(-50%,-50%) scale(1);   opacity: 0; }
}

/* ── Q&A flip cards ── */
.qa-title {
  font-family: 'Baloo 2', cursive; font-size: 1.45rem; color: var(--yellow);
  margin-bottom: 18px; display: flex; align-items: center; gap: 10px;
  animation: fadeUp .7s .78s ease both;
}
.questions { display: flex; flex-direction: column; gap: 12px; }
.q-card {
  background: var(--card-bg); border-radius: 16px; border: 2px solid transparent;
  overflow: hidden; cursor: pointer;
  transition: transform .2s, border-color .2s, box-shadow .2s;
  animation: fadeUp .6s ease both;
}
.q-card:hover { transform: translateY(-3px); box-shadow: 0 12px 32px rgba(0,0,0,.5); }
.q-card.open  { border-color: var(--accent); }
.q-card:nth-child(1){animation-delay:.80s}
.q-card:nth-child(2){animation-delay:.86s}
.q-card:nth-child(3){animation-delay:.92s}
.q-card:nth-child(4){animation-delay:.98s}
.q-card:nth-child(5){animation-delay:1.04s}
.q-header { display: flex; align-items: center; gap: 14px; padding: 17px 20px; }
.q-num {
  flex-shrink: 0; width: 34px; height: 34px; border-radius: 10px;
  font-family: 'Baloo 2', cursive; font-weight: 800; font-size: .95rem;
  color: #000; display: flex; align-items: center; justify-content: center;
}
.q-text  { flex: 1; font-size: 1.02rem; font-weight: 700; line-height: 1.35; }
.q-arrow { font-size: 1.1rem; transition: transform .25s; color: rgba(255,255,255,.35); }
.q-card.open .q-arrow { transform: rotate(90deg); color: var(--yellow); }
.q-answer {
  max-height: 0; overflow: hidden; transition: max-height .4s ease, padding .3s ease;
  padding: 0 20px; font-size: 1.0rem; color: rgba(255,255,255,.83); font-weight: 600; line-height: 1.5;
}
.q-card.open .q-answer { max-height: 180px; padding: 4px 20px 18px; }
.q-answer .aha {
  display: inline-block;
  background: rgba(255,215,0,.12); border-left: 3px solid var(--yellow);
  padding: 8px 14px; border-radius: 0 10px 10px 0; margin-top: 4px;
}

/* ── Progress bar ── */
.progress-wrap { margin-top: 34px; animation: fadeUp .7s 1.1s ease both; }
.progress-label { display: flex; justify-content: space-between; font-size: .88rem; color: rgba(255,255,255,.5); margin-bottom: 7px; font-weight: 700; }
.progress-bar-bg { height: 12px; background: rgba(255,255,255,.1); border-radius: 999px; overflow: hidden; }
.progress-bar-fill { height: 100%; background: linear-gradient(90deg, var(--blue), var(--green), var(--yellow)); border-radius: 999px; width: 0%; transition: width .5s ease; }
.progress-win { text-align: center; margin-top: 14px; font-family: 'Baloo 2', cursive; font-size: 1.4rem; color: var(--yellow); opacity: 0; transition: opacity .5s; }
.progress-win.show { opacity: 1; }

/* ── Footer ── */
.footer { text-align: center; margin-top: 50px; color: rgba(255,255,255,.28); font-size: .84rem; animation: fadeUp .7s 1.2s ease both; }
.footer strong { color: var(--yellow); }

/* ── Keyframes ── */
@keyframes fadeDown { from { opacity:0; transform:translateY(-22px); } to { opacity:1; transform:translateY(0); } }
@keyframes fadeUp   { from { opacity:0; transform:translateY(20px);  } to { opacity:1; transform:translateY(0); } }
