/* AdaLogic Learn — beginner path + interactive console */

body.family-safe[data-page="learn"] #container {
  width: min(1180px, 96%);
  max-width: 1180px;
}

body.family-safe[data-page="learn"] #content {
  padding: 0.85rem 1rem 1.75rem;
}

/* Mobile responsive learn page */
@media (max-width: 640px) {
  body.family-safe[data-page="learn"] #container {
    width: 100%;
    margin: 0;
    border-radius: 0;
    border-left: 0;
    border-right: 0;
    padding-bottom: 120px; /* Extra space for floating tab bar + iPhone home bar */
  }

  body.family-safe[data-page="learn"] #content {
    padding: 0.75rem 0.75rem 1rem;
    overflow-x: hidden; /* Prevent horizontal scroll */
  }

  .learn-shell {
    gap: 0.4rem;
  }

  .learn-hero {
    grid-template-columns: 1fr;
    gap: 0.4rem;
    padding: 0.75rem;
    text-align: center;
  }

  .learn-hero h1 {
    font-size: 1.1rem;
    line-height: 1.2;
    margin: 0.4rem 0;
  }

  .learn-hero p {
    font-size: 0.8rem;
    line-height: 1.3;
  }

  .learn-hero img.mascot {
    width: 48px;
    height: 48px;
    margin: 0 auto;
  }

  .learn-stats {
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.3rem;
  }

  .learn-pill {
    font-size: 0.7rem;
    padding: 0.3rem 0.5rem;
    min-height: 28px;
  }

  .learn-pill img {
    width: 12px;
    height: 12px;
  }

  /* Mobile constellation grid */
  .learn-constellation {
    font-size: 0.65rem;
    gap: 0.3rem;
    padding: 0.4rem;
  }

  .learn-cell {
    min-width: 32px;
    min-height: 32px;
    font-size: 0.65rem;
    padding: 0.2rem;
  }

  /* Mobile lesson area */
  .learn-lesson-area {
    padding: 0.6rem;
    font-size: 0.8rem;
    overflow-x: hidden;
  }

  .learn-check {
    min-height: 44px;
    padding: 0.5rem 0.6rem;
    font-size: 0.8rem;
  }

  .learn-input {
    font-size: 16px; /* Prevent iOS zoom */
    padding: 0.4rem;
  }

  /* Mobile constellation buttons */
  .learn-constellation-btn {
    min-height: 36px;
    padding: 0.4rem 0.6rem;
    font-size: 0.75rem;
  }

  /* Fix text overflow */
  .learn-lesson-text {
    word-wrap: break-word;
    overflow-wrap: break-word;
    hyphens: auto;
  }

  .learn-option-label {
    font-size: 0.8rem;
    line-height: 1.2;
  }

  /* Additional mobile fixes */
  .learn-node {
    grid-template-columns: 1rem 28px 1fr;
    padding: 0.35rem 0.4rem;
    gap: 0.3rem;
  }

  .learn-node-num {
    width: 1rem;
    height: 1rem;
    font-size: 0.65rem;
  }

  .learn-node img.icon {
    width: 28px;
    height: 28px;
  }

  .learn-node strong {
    font-size: 0.75rem;
  }

  .learn-node span {
    font-size: 0.65rem;
  }

  .learn-teach {
    padding: 0.6rem;
  }

  .learn-teach h2 {
    font-size: 1rem;
  }

  .learn-teach p,
  .learn-teach li {
    font-size: 0.8rem;
    line-height: 1.3;
  }

  .learn-choice {
    padding: 0.5rem 0.6rem;
    font-size: 0.8rem;
  }

  .type-card-grid {
    grid-template-columns: 1fr;
    gap: 0.4rem;
  }

  .type-card {
    min-height: 100px;
    padding: 0.6rem;
  }

  .type-card strong {
    font-size: 1rem;
  }

  .type-card .type-range {
    font-size: 0.65rem;
  }

  .type-card small {
    font-size: 0.7rem;
  }

  .type-coach {
    grid-template-columns: 50px 1fr;
    padding: 0.4rem 0.5rem;
    gap: 0.5rem;
  }

  .type-coach img {
    width: 50px;
    height: 50px;
  }

  .type-coach p {
    font-size: 0.75rem;
  }

  .finger-counter {
    grid-template-columns: repeat(4, minmax(30px, 1fr));
    gap: 0.25rem;
  }

  .binary-finger {
    min-height: 60px;
    padding: 0.25rem;
  }

  .binary-finger b {
    font-size: 1.2rem;
  }

  .binary-finger span {
    font-size: 0.6rem;
  }

  .paper-sheet {
    padding: 0.6rem 0.8rem 0.8rem 2rem;
    font-size: 0.9rem;
  }

  .paper-sheet code {
    font-size: 1rem;
  }

  .meaning-lab {
    grid-template-columns: 1fr;
  }

  .arithmetic-rules {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  /* Prevent text overflow */
  .learn-teach p,
  .learn-teach li,
  .learn-node strong,
  .learn-node span,
  .type-card .type-range,
  .type-card small {
    word-wrap: break-word;
    overflow-wrap: break-word;
    hyphens: auto;
  }

  /* Landscape mode specific */
  @media (orientation: landscape) {
    body.family-safe[data-page="learn"] #content {
      padding: 0.5rem 0.75rem;
    }

    .learn-hero {
      grid-template-columns: auto 1fr;
      text-align: left;
      padding: 0.5rem 0.75rem;
    }

    .learn-hero img.mascot {
      width: 40px;
      height: 40px;
      margin: 0;
    }

    .learn-hero h1 {
      font-size: 1rem;
    }

    .learn-hero p {
      font-size: 0.75rem;
    }

    .learn-stats {
      gap: 0.25rem;
    }

    .learn-pill {
      font-size: 0.65rem;
      padding: 0.25rem 0.4rem;
    }
  }
}

.learn-shell {
  --learn-ok: #0369a1;
  --learn-warn: #b45309;
  --learn-bad: #be123c;
  --learn-glow: rgba(11, 107, 203, 0.22);
  display: grid;
  gap: 1rem;
}

.learn-hero {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.85rem 1.1rem;
  align-items: center;
  padding: 1rem 1.1rem;
  border-radius: 16px;
  background:
    url("./images/hero-learn.svg") center / cover no-repeat,
    radial-gradient(circle at 90% 10%, rgba(124, 255, 178, 0.18), transparent 40%),
    linear-gradient(135deg, #102a43 0%, #0b6bcb 55%, #084a8c 100%);
  color: #e8f1fb;
  overflow: hidden;
  position: relative;
  animation: learnHeroIn 0.55s ease both;
}

@keyframes learnHeroIn {
  from { opacity: 0; transform: translateY(10px) scale(0.98); }
  to { opacity: 1; transform: none; }
}

.learn-hero img.mascot {
  width: 88px;
  height: 88px;
  filter: drop-shadow(0 8px 16px rgba(0, 0, 0, 0.25));
  animation: learnBob 2.8s ease-in-out infinite;
}

@keyframes learnBob {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-6px); }
}

.learn-hero h1 {
  margin: 0;
  font-size: clamp(1.45rem, 4vw, 2rem);
  font-style: italic;
  letter-spacing: 0.02em;
  color: #fff;
}

.learn-hero p {
  margin: 0.35rem 0 0;
  color: #c9d6e5;
  font-size: 0.95rem;
  max-width: 40rem;
}

.learn-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin-top: 0.7rem;
}

.learn-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.28rem 0.65rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.2);
  font-size: 0.82rem;
  font-weight: 700;
}

.learn-pill img {
  width: 16px;
  height: 16px;
}

.learn-progress-track {
  height: 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.18);
  background-image: url("./images/track-progress.svg");
  background-size: cover;
  background-position: center;
  overflow: hidden;
  margin-top: 0.75rem;
}

.learn-progress-fill {
  height: 100%;
  width: 0%;
  border-radius: inherit;
  background: linear-gradient(90deg, #7dd3fc, #ffd166);
  transition: width 0.45s ease;
}

.learn-layout {
  display: grid;
  grid-template-columns: minmax(180px, 230px) 1fr;
  gap: 1rem;
  align-items: start;
}

.learn-layout[hidden],
.learn-constellation[hidden] {
  display: none !important;
}

.learn-path {
  position: sticky;
  top: 0.5rem;
  padding: 0.85rem;
  border-radius: 14px;
  background: #f7fafc;
  border: 1px solid var(--alb-line);
}

.learn-path h2 {
  margin: 0 0 0.65rem;
  font-size: 0.95rem;
  color: var(--alb-accent-deep);
}

.learn-path-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.45rem;
}

.learn-node {
  display: grid;
  grid-template-columns: 1.6rem 40px 1fr;
  gap: 0.45rem;
  align-items: center;
  width: 100%;
  text-align: left;
  border: 1px solid var(--alb-line);
  background: #fff;
  border-radius: 12px;
  padding: 0.45rem 0.55rem;
  cursor: pointer;
  font: inherit;
  color: var(--alb-ink);
  transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
}

.learn-node-num {
  width: 1.4rem;
  height: 1.4rem;
  border-radius: 999px;
  display: grid;
  place-items: center;
  font-size: 0.72rem;
  font-weight: 800;
  background: #e2e8f0;
  color: #334e68;
}

.learn-node.is-current .learn-node-num {
  background: #0b6bcb;
  color: #fff;
}

.learn-node.is-done .learn-node-num {
  background: #1cb0f6;
  color: #fff;
}

.learn-node:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 6px 14px rgba(16, 42, 67, 0.08);
}

.learn-node.is-current {
  border-color: var(--alb-accent);
  box-shadow: 0 0 0 3px var(--learn-glow);
}

.learn-node.is-done {
  border-color: #7dd3fc;
  background: #f0f9ff;
}

.learn-node:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.learn-node img.icon {
  width: 40px;
  height: 40px;
}

.learn-node strong {
  display: block;
  font-size: 0.88rem;
  color: var(--alb-accent-deep);
}

.learn-node span {
  display: block;
  font-size: 0.75rem;
  color: var(--alb-muted);
}

.learn-stage {
  display: grid;
  gap: 0.85rem;
}

.learn-teach {
  border: 1px solid var(--alb-line);
  border-radius: 14px;
  background: #fff !important;
  color: #102a43 !important;
  padding: 1rem 1.05rem;
  animation: learnCardIn 0.35s ease both;
}

@keyframes learnCardIn {
  from { opacity: 0; transform: translateX(8px); }
  to { opacity: 1; transform: none; }
}

.learn-teach .eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.75rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #0b6bcb !important;
  font-weight: 700;
  margin-bottom: 0.35rem;
}

.learn-teach h2 {
  margin: 0 0 0.5rem;
  font-size: clamp(1.2rem, 3vw, 1.55rem);
  color: #0f1b2d !important;
}

.learn-teach p,
.learn-teach li,
#learnBody p {
  color: #334e68 !important;
  line-height: 1.45;
}

.learn-teach ul {
  margin: 0.4rem 0 0.7rem;
  padding-left: 1.15rem;
}

.learn-tip {
  margin-top: 0.75rem;
  padding: 0.7rem 0.8rem;
  border-radius: 10px;
  background: #eef6ff !important;
  border-left: 4px solid #0b6bcb;
  color: #102a43 !important;
  font-size: 0.92rem;
}

.learn-quiz {
  display: grid;
  gap: 0.45rem;
  margin-top: 0.75rem;
}

.learn-quiz[hidden] {
  display: none !important;
}

.learn-choice {
  text-align: left;
  font: inherit;
  padding: 0.7rem 0.85rem;
  border-radius: 10px;
  border: 1px solid var(--alb-line);
  background: #f8fafc;
  cursor: pointer;
  color: var(--alb-ink);
  transition: background 0.15s ease, border-color 0.15s ease;
}

.learn-choice:hover {
  border-color: var(--alb-accent);
  background: #eef6ff;
}

.learn-choice.is-correct {
  border-color: var(--learn-ok);
  background: #ecfdf5;
}

.learn-choice.is-wrong {
  border-color: var(--learn-bad);
  background: #fff1f2;
  animation: learnShake 0.35s ease;
}

@keyframes learnShake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-4px); }
  75% { transform: translateX(4px); }
}

/* Core types lab — the single replacement for the old PRINT hello lesson */
.learn-type-lab {
  margin-top: 1rem;
}

.learn-type-lab[hidden] {
  display: none !important;
}

.type-station-track {
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0.25rem 0 1.15rem;
}

.type-station-dot {
  flex: 0 0 auto;
  width: 2rem;
  height: 2rem;
  display: grid;
  place-items: center;
  padding: 0;
  border: 2px solid #bfdbfe;
  border-radius: 50%;
  background: #fff;
  color: #64748b;
  font: inherit;
  font-size: 0.78rem;
  font-weight: 800;
  cursor: pointer;
  transition: transform 0.15s ease, background 0.15s ease, box-shadow 0.15s ease;
}

.type-station-dot:not(:disabled):hover {
  transform: scale(1.08);
}

.type-station-dot.is-current {
  border-color: #0b6bcb;
  background: #0b6bcb;
  color: #fff;
  box-shadow: 0 0 0 5px rgba(11, 107, 203, 0.13);
}

.type-station-dot.is-done {
  border-color: #1cb0f6;
  background: #e0f2fe;
  color: #0284c7;
}

.type-station-dot:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.type-station-line {
  width: clamp(1rem, 5vw, 4rem);
  height: 2px;
  background: linear-gradient(90deg, #93c5fd, #dbeafe);
}

.type-station {
  animation: typeStationIn 0.32s ease both;
}

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

.type-kicker {
  margin: 0 0 0.2rem !important;
  color: #0b6bcb !important;
  font-size: 0.75rem;
  font-weight: 800;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}

.type-station h3 {
  margin: 0 0 0.35rem;
  color: #102a43;
  font-size: 1.2rem;
}

.type-station > p {
  margin: 0.25rem 0 0.8rem;
}

.type-card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(145px, 1fr));
  gap: 0.55rem;
  margin: 0.85rem 0;
}

.type-card {
  min-height: 116px;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  position: relative;
  overflow: hidden;
  padding: 0.75rem;
  border: 1px solid #bfdbfe;
  border-radius: 12px;
  background:
    radial-gradient(circle at 100% 0%, rgba(59, 155, 255, 0.16), transparent 48%),
    linear-gradient(145deg, #f8fbff, #eef6ff);
  box-shadow: 0 5px 14px rgba(16, 42, 67, 0.06);
}

.type-card::after {
  content: "01";
  position: absolute;
  right: 0.45rem;
  bottom: -0.15rem;
  color: rgba(11, 107, 203, 0.07);
  font: 800 2.5rem/1 var(--alb-mono);
}

.type-card strong {
  color: #0b6bcb;
  font: 800 1.15rem/1 var(--alb-mono);
}

.type-card .type-range {
  color: #102a43;
  font: 700 0.72rem/1.3 var(--alb-mono);
  word-break: break-word;
}

.type-card small {
  color: #526d86;
  font-size: 0.76rem;
  line-height: 1.3;
}

.type-never {
  margin: 0.9rem 0;
  padding: 0.75rem 0.85rem;
  border: 1px solid #fecdd3;
  border-left: 5px solid #e11d48;
  border-radius: 10px;
  background: #fff1f2;
  color: #881337;
}

.type-never > strong {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  color: #be123c;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-size: 0.78rem;
}

.type-never > strong::before {
  content: "!";
  width: 1.2rem;
  height: 1.2rem;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: #e11d48;
  color: #fff;
}

.type-never ul {
  margin: 0.45rem 0 0 !important;
}

.type-never li,
.type-never p {
  color: #881337 !important;
  font-size: 0.84rem;
}

.type-checkpoint {
  margin-top: 0.9rem;
  padding: 0.85rem;
  border: 1px solid #c7d2fe;
  border-radius: 12px;
  background: #f5f7ff;
}

.type-checkpoint > strong {
  display: block;
  margin-bottom: 0.6rem;
  color: #312e81;
}

.type-choice-grid {
  display: grid;
  gap: 0.45rem;
}

.type-choice {
  width: 100%;
  text-align: left;
  padding: 0.62rem 0.75rem;
  border: 1px solid #cbd5e1;
  border-radius: 9px;
  background: #fff;
  color: #102a43;
  cursor: pointer;
  transition: border-color 0.15s ease, transform 0.15s ease, background 0.15s ease;
}

.type-choice:hover:not(:disabled) {
  transform: translateX(3px);
  border-color: #0b6bcb;
}

.type-choice code {
  color: inherit;
  font-size: 0.84rem;
}

.type-choice.is-correct {
  border-color: #1cb0f6;
  background: #e0f2fe;
  color: #075985;
}

.type-choice.is-wrong {
  border-color: #e11d48;
  background: #fff1f2;
  color: #881337;
  animation: learnShake 0.35s ease;
}

.type-answer {
  min-height: 1.25rem;
  margin: 0.55rem 0 0 !important;
  font-size: 0.82rem;
  font-weight: 700;
}

.type-answer.is-correct { color: #0284c7 !important; }
.type-answer.is-wrong { color: #be123c !important; }

.type-final-checks {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.45rem;
  margin: 0.8rem 0;
}

.type-final-checks span {
  padding: 0.5rem 0.65rem;
  border-radius: 9px;
  background: #ecfdf5;
  border: 1px solid #bae6fd;
  color: #0369a1;
  font: 700 0.78rem/1.3 var(--alb-mono);
}

.type-lesson-art {
  width: 100%;
  max-height: 250px;
  display: block;
  object-fit: contain;
  margin: 0.75rem auto;
  border-radius: 16px;
}

.type-lesson-art.hands {
  max-height: 285px;
}

.type-lesson-art.notebook {
  max-height: 300px;
}

.type-coach {
  display: grid;
  grid-template-columns: 78px 1fr;
  gap: 0.8rem;
  align-items: center;
  margin: 0.75rem 0;
  padding: 0.65rem 0.8rem;
  border: 1px solid #9ddfe0;
  border-radius: 14px;
  background: linear-gradient(120deg, #e9ffff, #f3f9ff);
}

.type-coach img {
  width: 78px;
  height: 78px;
  object-fit: contain;
  object-position: center;
  border-radius: 12px;
}

.type-coach p {
  margin: 0 !important;
  color: #164e63 !important;
  font-size: 0.86rem;
}

.type-coach strong {
  color: #087f8c;
}

.type-simulator {
  margin: 0.9rem 0;
  padding: 0.85rem;
  border: 1px solid #bae6fd;
  border-radius: 14px;
  background: #f0f9ff;
}

.type-switches {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-bottom: 0.7rem;
}

.type-switches button,
.type-lab-action {
  border: 1px solid #78b9ee;
  border-radius: 999px;
  background: #fff;
  color: #07569f;
  padding: 0.46rem 0.8rem;
  font: 800 0.8rem/1 var(--alb-mono);
  cursor: pointer;
  transition: transform 0.15s ease, background 0.15s ease, box-shadow 0.15s ease;
}

.type-switches button:hover,
.type-lab-action:hover {
  transform: translateY(-2px);
}

.type-switches button.is-active {
  border-color: #07569f;
  background: #0b6bcb;
  color: #fff;
  box-shadow: 0 4px 10px rgba(11, 107, 203, 0.25);
}

.type-simulator label {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.55rem;
  color: #17324d;
  font-size: 0.82rem;
  font-weight: 800;
}

.type-simulator input,
.paper-sheet input {
  min-width: 0;
  padding: 0.5rem 0.65rem;
  border: 2px solid #93c5fd;
  border-radius: 9px;
  background: #fff;
  color: #102a43;
  font: 800 0.95rem/1 var(--alb-mono);
}

.type-machine {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) auto;
  gap: 0.65rem;
  align-items: center;
  margin-top: 0.75rem;
  padding: 0.7rem;
  border-radius: 11px;
  background: #fff;
  box-shadow: inset 0 0 0 1px #dbeafe;
}

.type-machine > div:first-child {
  display: grid;
  gap: 0.18rem;
}

.type-machine strong,
.type-machine span,
.type-machine small {
  color: #334e68;
  font-size: 0.76rem;
}

.type-machine strong {
  font-size: 0.9rem;
}

.type-machine strong.fits { color: #0284c7; }
.type-machine strong.overflows { color: #be123c; }

.type-byte-stack {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 0.2rem;
}

.type-byte-stack span {
  display: grid;
  place-items: center;
  width: 35px;
  height: 32px;
  border: 1px solid #07569f;
  border-radius: 6px;
  background: #1685d1;
  color: #fff;
  font: 700 0.58rem/1 var(--alb-mono);
  animation: typeBytePop 0.22s ease both;
  box-shadow: 0 4px 10px rgba(16, 42, 67, .18);
}

@keyframes typeBytePop {
  from { opacity: 0; transform: scale(0.7); }
  to { opacity: 1; transform: scale(1); }
}

.signed-line {
  display: grid;
  grid-template-columns: auto 1fr auto 1fr auto;
  gap: 0.35rem;
  align-items: center;
  margin: 0.75rem 0 0.25rem;
  color: #526d86;
  font-size: 0.67rem;
}

.signed-line i {
  height: 5px;
  border-radius: 5px;
  background: linear-gradient(90deg, #0b6bcb, #8ed7e8);
}

.signed-line i:nth-of-type(2) {
  background: linear-gradient(90deg, #8ed7e8, #18a999);
}

.signed-line b {
  width: 1.6rem;
  height: 1.6rem;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: #17324d;
  color: #fff;
}

.meaning-lab {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.55rem;
  margin: 0.85rem 0;
}

.meaning-lab label {
  display: grid;
  gap: 0.35rem;
  padding: 0.75rem;
  border: 1px solid #c7d2fe;
  border-radius: 12px;
  background: linear-gradient(145deg, #fff, #f5f7ff);
}

.meaning-lab code {
  color: #4338ca;
  font-size: 1.05rem;
  font-weight: 800;
}

.meaning-lab span {
  color: #64748b;
  font-size: 0.72rem;
}

.meaning-lab select {
  width: 100%;
  padding: 0.45rem;
  border: 2px solid #cbd5e1;
  border-radius: 8px;
  background: #fff;
  color: #17324d;
  font-weight: 700;
}

.meaning-lab select.is-correct,
.paper-sheet input.is-correct {
  border-color: #1cb0f6;
  background: #ecfdf5;
}

.meaning-lab select.is-wrong,
.paper-sheet input.is-wrong {
  border-color: #e11d48;
  background: #fff1f2;
}

.type-lab-action {
  border-color: #087f8c;
  background: linear-gradient(180deg, #21c7b7, #087f8c);
  color: #fff;
  font-family: inherit;
}

.type-lab-action[hidden] {
  display: none !important;
}

.finger-counter {
  display: grid;
  grid-template-columns: repeat(8, minmax(42px, 1fr));
  gap: 0.35rem;
  margin: 0.85rem 0;
}

.binary-finger {
  min-height: 82px;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 0.2rem;
  padding: 0.35rem;
  border: 2px solid #93c5fd;
  border-radius: 999px 999px 12px 12px;
  background: #eaf4ff;
  color: #07569f;
  cursor: pointer;
  transition: transform 0.18s ease, background 0.18s ease;
}

.binary-finger b {
  font: 900 1.4rem/1 var(--alb-mono);
}

.binary-finger span {
  font: 700 0.66rem/1 var(--alb-mono);
}

.binary-finger.is-on {
  transform: translateY(-10px);
  border-color: #087f8c;
  background: linear-gradient(#55e0cd, #18a999);
  color: #073b4c;
  box-shadow: 0 9px 14px rgba(8, 127, 140, 0.22);
}

.binary-total {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
  align-items: center;
  margin: 0.7rem 0;
  padding: 0.65rem 0.8rem;
  border-radius: 11px;
  background: #102a43;
  color: #d9f7ff;
}

.binary-total code {
  color: #7dd3fc;
  font-size: 1rem;
}

.binary-total strong {
  min-width: 2.5rem;
  color: #fde047;
  font-size: 1.4rem;
}

.binary-total span:last-child {
  margin-left: auto;
  font-size: 0.76rem;
}

.paper-sheet {
  width: min(100%, 340px);
  display: grid;
  justify-items: end;
  gap: 0.2rem;
  box-sizing: border-box;
  margin: 0.9rem auto;
  padding: 1rem 1.4rem 1.2rem 3.8rem;
  border: 1px solid #bed4e8;
  border-radius: 8px;
  background:
    linear-gradient(90deg, transparent 44px, #fda4af 45px, transparent 46px),
    repeating-linear-gradient(#fff 0, #fff 27px, #cfe3f6 28px);
  box-shadow: 0 8px 18px rgba(16, 42, 67, 0.13);
}

.paper-sheet code {
  color: #17324d;
  font: 900 1.35rem/1.35 var(--alb-mono);
  letter-spacing: 0.22em;
}

.paper-sheet hr {
  width: 100%;
  margin: 0.1rem 0;
  border: 0;
  border-top: 3px solid #17324d;
}

.paper-sheet input {
  width: 8rem;
  text-align: right;
  letter-spacing: 0.18em;
}

.paper-labels {
  width: 9.1rem;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  color: #d97706;
  font: 800 0.66rem/1 var(--alb-mono);
  text-align: center;
}

.carry-steps {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.45rem;
  padding-left: 1.3rem !important;
}

.carry-steps li {
  padding: 0.45rem;
  border-radius: 8px;
  background: #fff7ed;
  color: #9a3412 !important;
  font-size: 0.78rem;
}

.hex-strip {
  display: grid;
  grid-template-columns: repeat(16, minmax(27px, 1fr));
  gap: 0.18rem;
  margin: 0.75rem 0;
}

.hex-strip span {
  display: grid;
  place-items: center;
  min-height: 45px;
  border: 1px solid #99d8cc;
  border-radius: 7px;
  background: #ecfdf5;
}

.hex-strip b {
  color: #087f8c;
  font: 900 0.85rem/1 var(--alb-mono);
}

.hex-strip small {
  color: #526d86;
  font-size: 0.55rem;
}

.hex-paper {
  padding-left: 3.8rem;
}

.type-lesson-chip {
  width: max-content;
  max-width: 100%;
  margin: 0 auto 0.9rem;
  padding: 0.35rem 0.7rem;
  border: 1px solid #7dd3fc;
  border-radius: 999px;
  background: linear-gradient(180deg, #fff, #e0f2fe);
  color: #075985;
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  box-shadow: 0 4px 9px rgba(7, 89, 133, .13);
}

.arithmetic-rules {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.4rem;
  margin: 0.75rem 0;
}

.arithmetic-rules span {
  display: grid;
  place-items: center;
  gap: 0.2rem;
  padding: 0.55rem 0.35rem;
  border: 1px solid #bae6fd;
  border-radius: 10px;
  background: linear-gradient(145deg, #fff, #eef8ff);
  color: #526d86;
  font-size: 0.68rem;
  text-align: center;
  box-shadow: 0 4px 0 #c5dcec;
}

.arithmetic-rules b {
  color: #0b6bcb;
  font: 900 1.25rem/1 var(--alb-mono);
}

.arithmetic-marks {
  display: flex;
  gap: 0.35rem;
  margin: 0.7rem 0;
}

.arithmetic-marks span {
  width: 1.7rem;
  height: 1.7rem;
  display: grid;
  place-items: center;
  border: 2px solid #cbd5e1;
  border-radius: 50%;
  background: #fff;
  color: #64748b;
  font-size: 0.7rem;
  font-weight: 900;
}

.arithmetic-marks span.is-current {
  border-color: #0b6bcb;
  color: #0b6bcb;
  box-shadow: 0 0 0 4px rgba(11,107,203,.12);
}

.arithmetic-marks span.is-done {
  border-color: #1cb0f6;
  background: #e0f2fe;
  color: #0284c7;
}

.arithmetic-history {
  display: grid;
  gap: 0.4rem;
  margin: 0.75rem 0 0 !important;
  padding: 0 !important;
  list-style: none;
}

.arithmetic-history li {
  display: grid;
  grid-template-columns: minmax(145px, auto) 1fr;
  gap: 0.6rem;
  align-items: center;
  padding: 0.55rem 0.65rem;
  border: 1px solid #bae6fd;
  border-radius: 9px;
  background: #f0f9ff;
  animation: typeStationIn .25s ease both;
}

.arithmetic-history code {
  color: #0369a1;
  font-weight: 900;
}

.arithmetic-history span {
  color: #1e3a8a;
  font-size: 0.72rem;
}

.cycle-race {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.65rem;
  align-items: end;
  margin: 1rem 0;
  padding: 1rem;
  border: 1px solid #b6d5ed;
  border-radius: 16px;
  background: linear-gradient(145deg, #f8fcff, #e7f3fb);
  box-shadow: inset 0 0 0 1px #fff, 0 10px 24px rgba(16,42,67,.12);
}

.cycle-race > div {
  display: grid;
  justify-items: center;
  gap: 0.35rem;
}

.cycle-race strong {
  color: #17324d;
  font: 900 0.83rem/1 var(--alb-mono);
}

.cycle-race small {
  color: #64748b;
  font-size: 0.62rem;
  text-align: center;
}

.cycle-block {
  width: 72%;
  display: block;
  position: relative;
  border: 2px solid #07569f;
  border-radius: 8px 8px 4px 4px;
  background: linear-gradient(#55b7ff, #0b6bcb);
  box-shadow: 0 6px 14px rgba(16,42,67,.2);
}

.cycle-block::before {
  content: "";
  position: absolute;
  left: 9px;
  right: 9px;
  top: 9px;
  height: 7px;
  border-radius: 5px;
  background: repeating-linear-gradient(90deg, #fde047 0 7px, transparent 7px 12px);
}

.cycle-block.add { height: 48px; }
.cycle-block.mul { height: 82px; }
.cycle-block.div { height: 145px; }

.optimization-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.55rem;
  margin: 0.85rem 0;
}

.optimization-grid article {
  padding: 0.75rem;
  border: 1px solid #c7d2fe;
  border-radius: 12px;
  background:
    linear-gradient(135deg, rgba(255,255,255,.8), transparent 50%),
    linear-gradient(145deg, #f5f7ff, #e8ecff);
  box-shadow: inset -4px -4px 0 rgba(67,56,202,.06), 0 6px 13px rgba(49,46,129,.1);
}

.optimization-grid b {
  color: #3730a3;
  font-size: 0.8rem;
}

.optimization-grid p {
  margin: 0.35rem 0 0 !important;
  color: #475569 !important;
  font-size: 0.74rem;
}

.optimization-grid code {
  color: #4338ca;
  font-weight: 800;
}

.learn-console {
  border-radius: 14px;
  border: 1px solid #1e3a5f;
  overflow: hidden;
  background: #0f1b2d;
  box-shadow: 0 12px 28px rgba(16, 42, 67, 0.18);
}

.learn-console-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  align-items: center;
  justify-content: space-between;
  padding: 0.55rem 0.75rem;
  background: #16263d;
  background-image: url("./images/bar-chrome.svg");
  background-size: cover;
  background-position: center;
  color: #c9d6e5;
  font-size: 0.82rem;
}

.learn-console-bar .dots span {
  display: inline-block;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  margin-right: 4px;
  background: #64748b;
}
.learn-console-bar .dots span:nth-child(1) { background: #f87171; }
.learn-console-bar .dots span:nth-child(2) { background: #fbbf24; }
.learn-console-bar .dots span:nth-child(3) { background: #38bdf6; }

.learn-console-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.learn-btn {
  font: inherit;
  font-size: 0.85rem;
  font-weight: 700;
  border: 0;
  border-radius: 999px;
  padding: 0.45rem 0.9rem;
  cursor: pointer;
  transition: transform 0.12s ease, filter 0.12s ease;
}

.learn-btn:hover { transform: translateY(-1px); }
.learn-btn:active { transform: translateY(1px); }

.learn-btn-primary {
  background: linear-gradient(180deg, #3b9bff, #0b6bcb);
  color: #fff;
}

.learn-btn-ghost {
  background: rgba(255, 255, 255, 0.08);
  color: #e8f1fb;
  border: 1px solid rgba(255, 255, 255, 0.18);
}

.learn-btn-ok {
  background: linear-gradient(180deg, #38bdf6, #0369a1);
  color: #fff;
}

.learn-editor-wrap {
  display: grid;
  grid-template-columns: 2.4rem 1fr;
  min-height: 220px;
}

.learn-gutter {
  padding: 0.85rem 0.35rem;
  text-align: right;
  color: #64748b;
  font-family: var(--alb-mono);
  font-size: 0.8rem;
  line-height: 1.45;
  user-select: none;
  background: #0b1524;
  border-right: 1px solid #1e3a5f;
}

.learn-editor {
  width: 100%;
  min-height: 220px;
  border: 0;
  resize: vertical;
  padding: 0.85rem 0.9rem;
  background: transparent;
  color: #e8f1fb;
  font-family: var(--alb-mono);
  font-size: 0.9rem;
  line-height: 1.45;
  outline: none;
  tab-size: 4;
}

.learn-output {
  border-top: 1px solid #1e3a5f;
  padding: 0.7rem 0.85rem;
  min-height: 3rem;
  font-family: var(--alb-mono);
  font-size: 0.82rem;
  color: #c9d6e5;
  background: #0b1524;
  white-space: pre-wrap;
}

.learn-output.is-ok { color: #7dd3fc; }
.learn-output.is-bad { color: #fda4af; }

.learn-feedback {
  display: none;
  align-items: center;
  gap: 0.75rem;
  padding: 0.85rem 1rem;
  border-radius: 14px;
  border: 1px solid var(--alb-line);
  background: #fff;
  animation: learnCardIn 0.3s ease both;
}

.learn-feedback.show { display: flex; }
.learn-feedback.ok { border-color: #7dd3fc; background: #f0f9ff; }
.learn-feedback.bad { border-color: #fecdd3; background: #fff1f2; }

.learn-feedback img {
  width: 56px;
  height: 56px;
}

.learn-feedback strong {
  display: block;
  color: var(--alb-accent-deep);
  margin-bottom: 0.2rem;
}

.learn-celebrate {
  position: fixed;
  inset: auto 0 0 0;
  pointer-events: none;
  display: none;
  justify-content: center;
  z-index: 40;
}

.learn-celebrate.show {
  display: flex;
  animation: learnPop 0.9s ease both;
}

@keyframes learnPop {
  0% { opacity: 0; transform: translateY(20px) scale(0.9); }
  30% { opacity: 1; transform: translateY(0) scale(1); }
  100% { opacity: 0; transform: translateY(-30px); }
}

.learn-footer-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  justify-content: space-between;
}

