/* ---------------------------------------------------------------------------
   Sensei — trainer styles. Loaded after styles.css and leans on its
   variables and board classes; everything here is the school around the
   board: the owl, the speech bubble, lesson chrome, and teaching highlights.
--------------------------------------------------------------------------- */

/* The masthead wants the page's full width; the school itself stays a
   narrow centred column beneath it. */
.sensei-col {
  max-width: 560px;
  margin: 0 auto;
}

.sensei-blurb {
  margin: 6px 0 0;
  max-width: 52ch;
  color: var(--muted);
}

/* ----- the owl and his bubble ---------------------------------------------- */
.bubble-row {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 16px;
}

.owl-slot {
  flex: 0 0 64px;
  width: 64px;
  height: 64px;
}

.owl {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: #f0ead9;
  border: 2px solid var(--ink);
  box-shadow: var(--shadow);
  overflow: hidden;
}

/* mood plumbing: exactly one eye set shows */
.owl .eyes-happy,
.owl .eyes-stern {
  display: none;
}
.owl.mood-happy .eyes-open,
.owl.mood-proud .eyes-open {
  display: none;
}
.owl.mood-happy .eyes-happy,
.owl.mood-proud .eyes-happy {
  display: block;
}
.owl.mood-stern .eyes-open {
  display: none;
}
.owl.mood-stern .eyes-stern {
  display: block;
}
.owl .brows {
  transition: transform 0.25s ease;
  transform-origin: 50px 40px;
}
.owl.mood-alarmed .brows {
  transform: translateY(-6px);
}
.owl.mood-stern .brows {
  transform: translateY(3px);
}
.owl.mood-alarmed .pupils circle {
  r: 2.6;
}
.owl.mood-thinking .pupils {
  transform: translate(-2.5px, -3px);
}

.bubble {
  position: relative;
  flex: 1;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: var(--shadow);
  padding: 12px 16px;
}

.bubble::before {
  content: "";
  position: absolute;
  left: -7px;
  top: 24px;
  width: 12px;
  height: 12px;
  background: var(--card);
  border-left: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  transform: rotate(45deg);
}

.bubble-name {
  display: block;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 1.2px;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 4px;
}

.bubble p {
  margin: 0;
  font-size: 15px;
  line-height: 1.45;
  animation: bubble-in 0.18s ease;
}

@keyframes bubble-in {
  from {
    opacity: 0;
    transform: translateY(3px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

.bubble-actions {
  display: flex;
  gap: 8px;
  margin-top: 10px;
}

.bubble-actions:empty {
  display: none;
}

.bubble-actions .btn {
  flex: 0 1 auto;
  padding: 7px 14px;
  font-size: 13px;
  border-radius: 8px;
}

/* ----- home: rank ----------------------------------------------------------- */
.rank-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: var(--shadow);
  padding: 12px 16px;
  margin-bottom: 16px;
}

.rank-label {
  display: block;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 1.2px;
  text-transform: uppercase;
  color: var(--muted);
}

.rank-name {
  font-family: Georgia, "Times New Roman", Times, serif;
  font-size: 17px;
  font-weight: 700;
}

.rank-progress {
  display: flex;
  align-items: center;
  gap: 10px;
}

.rank-bar {
  width: 110px;
  height: 8px;
  border-radius: 999px;
  background: var(--bg);
  border: 1px solid var(--line);
  overflow: hidden;
}

.rank-fill {
  height: 100%;
  background: var(--ink);
  border-radius: 999px;
  transition: width 0.4s ease;
}

.rank-count {
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  white-space: nowrap;
}

/* ----- home: track cards ---------------------------------------------------- */
.track-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: var(--shadow);
  padding: 16px 18px;
  margin-bottom: 14px;
}

.track-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 2px;
}

.track-head h2 {
  font-family: Georgia, "Times New Roman", Times, serif;
  font-size: 20px;
  margin: 0;
}

.track-progress {
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
}

.track-blurb {
  margin: 0 0 6px;
  font-size: 13px;
  color: var(--muted);
}

.track-guide {
  display: inline-block;
  margin-bottom: 10px;
  font-size: 13px;
  font-weight: 600;
  color: var(--accent);
  text-decoration: none;
}

.track-guide:hover {
  text-decoration: underline;
}

.lesson-row {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  text-align: left;
  appearance: none;
  background: transparent;
  border: none;
  border-top: 1px solid var(--line);
  padding: 9px 2px;
  cursor: pointer;
  font: inherit;
  color: var(--ink);
}

.lesson-row:hover .lesson-name {
  color: var(--accent);
}

.lesson-check {
  flex: 0 0 22px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 1.5px solid var(--grid-line);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  color: transparent;
}

.lesson-row.done .lesson-check {
  border-color: #188038;
  background: #e6f4ea;
  color: #188038;
}

.lesson-name {
  font-weight: 600;
  font-size: 14px;
}

.lesson-deck {
  display: block;
  font-size: 12px;
  color: var(--muted);
  font-weight: 400;
}

/* ----- home: practice card -------------------------------------------------- */
.practice-card {
  background: var(--ink);
  color: var(--accent-ink);
  border-radius: 12px;
  box-shadow: var(--shadow);
  padding: 18px;
  margin-top: 18px;
}

.practice-copy h2 {
  font-family: Georgia, "Times New Roman", Times, serif;
  font-size: 20px;
  margin: 0 0 4px;
  color: var(--accent-ink);
}

.practice-copy p {
  margin: 0 0 12px;
  font-size: 13px;
  opacity: 0.85;
}

.practice-card .btn.primary {
  background: var(--accent-ink);
  color: var(--ink);
  border-color: var(--accent-ink);
  width: 100%;
}

/* ----- lesson chrome --------------------------------------------------------- */
.lesson-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 14px;
}

.link-btn {
  appearance: none;
  background: none;
  border: none;
  padding: 0;
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  color: var(--accent);
  cursor: pointer;
  white-space: nowrap;
}

.link-btn:hover {
  text-decoration: underline;
}

.lesson-title {
  font-family: Georgia, "Times New Roman", Times, serif;
  font-weight: 700;
  font-size: 16px;
  text-align: center;
  flex: 1;
}

.lesson-dots {
  display: flex;
  gap: 4px;
  justify-content: flex-end;
}

.lesson-dots span {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--grid-line);
}

.lesson-dots span.on {
  background: var(--ink);
}

.lesson-dots span.now {
  background: var(--accent);
}

/* ----- the board frame and teaching marks ----------------------------------- */
.board-frame {
  position: relative;
  background: var(--card);
  border-radius: 14px;
  box-shadow: var(--shadow);
  padding: 12px;
  margin-bottom: 14px;
}

/* a house under discussion */
.board .cell.m-house {
  background: #fdf6dd;
}

/* the solved cells doing the arguing */
.board .cell.m-cause {
  background: #d9ecdb;
  box-shadow: inset 0 0 0 2px #188038;
  z-index: 1;
}

/* the target cell(s) */
.board .cell.m-focus {
  background: #fceecb;
  box-shadow: inset 0 0 0 2px #b7791f;
  z-index: 1;
  animation: focus-pulse 1.4s ease-in-out infinite;
}

@keyframes focus-pulse {
  0%,
  100% {
    box-shadow: inset 0 0 0 2px #b7791f;
  }
  50% {
    box-shadow: inset 0 0 0 3px #b7791f;
  }
}

/* a just-confirmed placement */
.board .cell.m-good {
  animation: good-flash 0.7s ease;
}

@keyframes good-flash {
  0% {
    background: #ceead6;
  }
  100% {
    background: transparent;
  }
}

/* a wrong tap */
.board .cell.m-shake {
  animation: cell-shake 0.3s ease;
}

@keyframes cell-shake {
  0%,
  100% {
    transform: none;
  }
  25% {
    transform: translateX(-3px);
  }
  75% {
    transform: translateX(3px);
  }
}

/* struck-out ghost candidates: "this can no longer live here" */
.cell .ghosts {
  display: flex;
  gap: 2px;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
}

.cell .ghosts span {
  font-size: clamp(9px, 2.4vw, 14px);
  font-weight: 700;
  color: #c5221f;
  text-decoration: line-through;
  opacity: 0.85;
}

/* wrong (vs the answer key) entries in practice */
.board .cell.m-wrong {
  color: #c5221f;
  background: #fbd5d1;
}

/* jigsaw/killer variants keep their own backgrounds unless marked */
.board.jigsaw .cell.m-house {
  background: #fdf6dd;
}
.board.jigsaw .cell.m-cause {
  background: #d9ecdb;
}
.board.jigsaw .cell.m-focus {
  background: #fceecb;
}

/* The site stylesheet washes a selected/hovered cage (.cage-mate) at higher
   specificity than the teaching marks, so re-assert the Sensei's washes on
   killer boards — a lesson's highlights must out-shout the hover. */
.board.killer .cell.m-house {
  background: #fdf6dd;
}
.board.killer .cell.m-cause {
  background: #d9ecdb;
}
.board.killer .cell.m-focus {
  background: #fceecb;
}
.board.killer .cell.m-wrong {
  color: #c5221f;
  background: #fbd5d1;
}

/* Ghost candidates clear the cage sum, as pencil marks do on the front page */
.board.killer .cell.sum-cell .ghosts {
  padding-top: clamp(11px, 2.8vw, 14px);
}

/* ----- the stamp ------------------------------------------------------------- */
.stamp {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}

/* display:flex above would defeat the hidden attribute's display:none */
.stamp[hidden] {
  display: none;
}

.stamp span {
  font-family: Georgia, "Times New Roman", Times, serif;
  font-size: 44px;
  font-weight: 700;
  line-height: 1.05;
  text-align: center;
  letter-spacing: 2px;
  color: #b3382e;
  border: 5px solid #b3382e;
  border-radius: 10px;
  padding: 10px 22px;
  transform: rotate(-14deg);
  background: rgba(255, 255, 255, 0.82);
  animation: stamp-in 0.35s cubic-bezier(0.2, 1.6, 0.45, 1);
}

@keyframes stamp-in {
  from {
    transform: rotate(-14deg) scale(2.2);
    opacity: 0;
  }
  to {
    transform: rotate(-14deg) scale(1);
    opacity: 1;
  }
}

.stamp-solved span {
  color: #1e7c3a;
  border-color: #1e7c3a;
}

/* ----- interaction area ------------------------------------------------------ */
.interact {
  min-height: 56px;
}

.interact .next-row {
  display: flex;
  justify-content: flex-end;
}

.interact .btn {
  padding: 11px 22px;
}

.interact .hint-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  margin-top: 10px;
}

.interact .hint-row .link-btn {
  color: var(--muted);
}

.mini-pad {
  display: grid;
  grid-template-columns: repeat(9, 1fr);
  gap: 6px;
}

.mini-pad .pad-btn {
  padding: 10px 0;
  font-size: 16px;
}

.mini-pad .pad-btn.dead {
  opacity: 0.35;
  pointer-events: none;
}

.choice-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.choice-btn {
  appearance: none;
  text-align: left;
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  color: var(--ink);
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 10px;
  box-shadow: var(--shadow);
  padding: 11px 14px;
  cursor: pointer;
  transition: border-color 0.12s;
}

.choice-btn:hover {
  border-color: var(--ink);
}

.choice-btn.right {
  border-color: #188038;
  background: #e6f4ea;
}

.choice-btn.wrong {
  border-color: #c5221f;
  background: #fdecea;
  animation: cell-shake 0.3s ease;
}

.choice-btn:disabled {
  cursor: default;
}

/* ----- practice desk --------------------------------------------------------- */
.sensei-picker {
  margin-bottom: 12px;
}

.practice-stats {
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  white-space: nowrap;
}

.mini-note {
  font-size: 13px;
  color: var(--muted);
  font-weight: 500;
}

#practiceGame .pad {
  margin-top: 10px;
}

#practiceGame .actions {
  margin-top: 14px;
}

/* keep the notes mini-grid readable on top of teaching washes */
.cell .notes {
  position: relative;
  z-index: 0;
}

/* ----- small screens --------------------------------------------------------- */
@media (max-width: 480px) {
  .owl-slot,
  .owl {
    width: 52px;
    height: 52px;
  }

  .owl-slot {
    flex-basis: 52px;
  }

  .bubble p {
    font-size: 14px;
  }

  .stamp span {
    font-size: 34px;
  }

  .rank-bar {
    width: 70px;
  }
}
