:root {
  --green: #58cc02;
  --green-dark: #46a302;
  --blue: #1cb0f6;
  --blue-dark: #1899d6;
  --red: #ff4b4b;
  --red-dark: #ea2b2b;
  --yellow: #ffc800;
  --gray-bg: #f7f7f7;
  --gray-line: #e5e5e5;
  --text: #3c3c3c;
  --text-light: #777;
  --purple: #ce82ff;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  background: var(--gray-bg);
  color: var(--text);
  font-family: 'Vazirmatn', Tahoma, sans-serif;
  min-height: 100%;
}

#app {
  max-width: 480px;
  margin: 0 auto;
  padding: 16px 16px 76px;
  min-height: 100vh;
}

.boot {
  text-align: center;
  padding: 60px 0;
  color: var(--text-light);
}

.boot-mascot {
  display: block;
  width: 96px;
  height: 96px;
  object-fit: contain;
  margin: 0 auto 8px;
  animation: mascotBob 2.8s ease-in-out infinite;
}

a {
  color: inherit;
  text-decoration: none;
}

button {
  font-family: inherit;
  cursor: pointer;
  border: none;
}

/* ---------- Buttons ---------- */
.btn {
  display: block;
  width: 100%;
  padding: 14px 16px;
  border-radius: 16px;
  font-weight: 700;
  font-size: 16px;
  text-align: center;
  border-bottom: 4px solid rgba(0, 0, 0, 0.15);
  transition: transform .05s;
}

.btn:active {
  transform: translateY(2px);
  border-bottom-width: 2px;
}

.btn-green {
  background: var(--green);
  color: #fff;
  border-bottom-color: var(--green-dark);
}

.btn-blue {
  background: var(--blue);
  color: #fff;
  border-bottom-color: var(--blue-dark);
}

.btn-red {
  background: var(--red);
  color: #fff;
  border-bottom-color: var(--red-dark);
}

.btn-outline {
  background: #fff;
  color: var(--blue);
  border: 2px solid var(--gray-line);
  border-bottom-width: 4px;
}

.btn-gray {
  background: #e5e5e5;
  color: #afafaf;
  border-bottom-color: #d3d3d3;
  cursor: not-allowed;
}

.btn-sm {
  padding: 10px 14px;
  font-size: 14px;
  border-radius: 12px;
  width: auto;
  display: inline-block;
}

/* ---------- Cards ---------- */
.card {
  background: #fff;
  border: 2px solid var(--gray-line);
  border-radius: 16px;
  padding: 16px;
  margin-bottom: 14px;
}

.card-clickable:active {
  background: #fafafa;
}

/* ---------- Concept graph (home) ---------- */
/* Full-bleed: breaks out of #app's centered/padded column so the graph
   fills the entire viewport width regardless of where it sits in the DOM. */
.graph-card {
  position: relative;
  left: 50%;
  right: 50%;
  width: 100vw;
  margin-left: -50vw;
  margin-right: -50vw;
  background: #fff;
  border-top: 2px solid var(--gray-line);
  border-bottom: 2px solid var(--gray-line);
  overflow: hidden;
  touch-action: none;
}

/* When the graph is the first thing in #app (no daily-goal card above it),
   cancel #app's own top padding so the graph sits flush under the header
   instead of leaving a blank strip. */
.graph-card.flush-top {
  margin-top: -16px;
}

body {
  overflow-x: hidden;
}

.graph-canvas {
  display: block;
  cursor: grab;
}

.graph-greeting {
  position: absolute;
  top: 14px;
  inset-inline-start: 16px;
  font-size: 18px;
  font-weight: 800;
  color: var(--text);
  pointer-events: none;
  z-index: 2;
}

.graph-tip {
  position: absolute;
  transform: translate(-50%, -100%);
  background: rgba(20, 22, 27, 0.95);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.15);
  padding: 4px 10px;
  border-radius: 8px;
  font-size: 12px;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transition: opacity .1s;
  z-index: 2;
}

.graph-tip.show {
  opacity: 1;
}

.graph-mute-btn {
  position: absolute;
  top: 14px;
  inset-inline-end: 14px;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  line-height: 1;
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.12), 0 0 0 2px rgba(0, 0, 0, 0.05) inset;
  cursor: pointer;
  z-index: 3;
  transition: transform .12s, box-shadow .12s, background .15s;
}

.graph-mute-btn:hover {
  transform: scale(1.08);
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.16), 0 0 0 2px rgba(0, 0, 0, 0.06) inset;
}

.graph-mute-btn:active {
  transform: scale(0.94);
}

.graph-mute-btn.is-muted {
  background: rgba(255, 235, 235, 0.9);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.12), 0 0 0 2px rgba(255, 71, 87, 0.25) inset;
}

.empty-state.small-empty {
  padding: 16px 20px;
  font-size: 14px;
}

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

.row-between {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.col {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.grow {
  flex: 1;
}

.mt8 {
  margin-top: 8px;
}

.mt12 {
  margin-top: 12px;
}

.mt16 {
  margin-top: 16px;
}

.mt24 {
  margin-top: 24px;
}

.mb8 {
  margin-bottom: 8px;
}

.mb12 {
  margin-bottom: 12px;
}

.mb16 {
  margin-bottom: 16px;
}

.center {
  text-align: center;
}

.muted {
  color: var(--text-light);
  font-size: 14px;
}

.small {
  font-size: 13px;
}

h1 {
  font-size: 22px;
  font-weight: 800;
  margin: 4px 0 16px;
}

h2 {
  font-size: 18px;
  font-weight: 700;
  margin: 0 0 8px;
}

h3 {
  font-size: 15px;
  font-weight: 700;
  margin: 0;
}

.stat-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: #fff;
  border: 2px solid var(--gray-line);
  border-radius: 20px;
  padding: 6px 12px;
  font-weight: 700;
  font-size: 14px;
}

.hearts-pill {
  cursor: pointer;
}

.disclosure-btn {
  display: flex;
  width: 100%;
  background: none;
  border: none;
  padding: 0;
  font: inherit;
  color: inherit;
  cursor: pointer;
  text-decoration: none;
}

.disclosure-chevron {
  color: var(--gray-line);
  transition: transform 0.15s ease;
}

.disclosure-btn.open .disclosure-chevron {
  transform: rotate(180deg);
}

#daily-goal-picker.hidden {
  display: none;
}

.plan-option {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  border: 2px solid var(--gray-line);
  border-radius: 14px;
  padding: 12px 14px;
}

.plan-option + .plan-option {
  margin-top: 10px;
}

.topbar {
  position: sticky;
  top: 0;
  background: var(--gray-bg);
  padding: 10px 0;
  z-index: 5;
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 4px;
}

.back-btn {
  background: #fff;
  border: 2px solid var(--gray-line);
  border-radius: 50%;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  flex-shrink: 0;
}

.progress-bar-track {
  background: var(--gray-line);
  border-radius: 10px;
  height: 14px;
  overflow: hidden;
}

.progress-bar-fill {
  background: var(--green);
  height: 100%;
  border-radius: 10px;
  transition: width .3s;
}

/* ---------- Auth ---------- */
.auth-wrap {
  padding-top: 40px;
}

.auth-mascot {
  display: block;
  width: 160px;
  height: 160px;
  object-fit: contain;
  margin: 0 auto 4px;
}

.auth-title {
  text-align: center;
  font-weight: 800;
  font-size: 22px;
  margin-bottom: 24px;
}

input[type=text],
input[type=password] {
  width: 100%;
  padding: 14px;
  border-radius: 14px;
  border: 2px solid var(--gray-line);
  font-size: 16px;
  font-family: inherit;
  margin-bottom: 12px;
  background: #fff;
  color: var(--text);
}

input:focus {
  outline: none;
  border-color: var(--blue);
}

.field-error {
  color: var(--red);
  font-size: 13px;
  margin: -6px 0 10px;
}

/* ---------- Tracks / levels ---------- */
.track-card {
  border-color: var(--gray-line);
}

.level-badge {
  width: 46px;
  height: 46px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  color: #fff;
  font-size: 14px;
  flex-shrink: 0;
}

.unit-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 22px 0 10px;
}

.unit-icon {
  font-size: 26px;
}

.lesson-node {
  display: flex;
  align-items: center;
  gap: 12px;
  background: #fff;
  border: 2px solid var(--gray-line);
  border-radius: 14px;
  padding: 12px 14px;
  margin-bottom: 10px;
}

.lesson-circle {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  color: #fff;
  background: var(--green);
}

.lesson-circle.done {
  background: var(--yellow);
}

/* ---------- Exercise player ---------- */
/* The viewport's vertical space is shared with two things outside #app:
   the sticky .app-header (56px, now a fixed height) above it, and the
   fixed .tabbar below it (which #app reserves 76px of bottom padding
   for, on top of its own 16px top padding = 92px). This wrap's
   min-height must subtract all of that (56 + 92 = 148px), otherwise it
   overshoots the real visible viewport and the check button sits below
   the fold. */
.exercise-wrap {
  display: flex;
  flex-direction: column;
  min-height: calc(100vh - 148px);
  min-height: calc(100dvh - 148px);
}

.hearts-row {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 15px;
  font-weight: 700;
}

.exercise-body {
  flex: 1;
  padding-top: 18px;
}

.prompt-text {
  font-size: 20px;
  font-weight: 700;
  margin-bottom: 18px;
  line-height: 1.8;
}

.play-audio-btn {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: var(--blue);
  color: #fff;
  font-size: 26px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-bottom: 4px solid var(--blue-dark);
  margin-bottom: 20px;
}

.option-btn {
  display: block;
  width: 100%;
  text-align: right;
  padding: 14px 16px;
  border: 2px solid var(--gray-line);
  border-bottom-width: 4px;
  border-radius: 14px;
  background: #fff;
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 10px;
}

.option-btn.selected {
  border-color: var(--blue);
  background: #ddf4ff;
}

.option-btn.correct {
  border-color: var(--green);
  background: #d7ffb8;
  color: var(--green-dark);
}

.option-btn.wrong {
  border-color: var(--red);
  background: #ffdfe0;
  color: var(--red-dark);
}

.image-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  margin-bottom: 20px;
}

.image-option {
  border: 2px solid var(--gray-line);
  border-bottom-width: 4px;
  border-radius: 14px;
  background: #fff;
  padding: 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.image-option img {
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: contain;
  display: block;
}

.image-option span {
  font-size: 14px;
  color: var(--text-light);
  text-align: center;
}

.image-option.selected {
  border-color: var(--blue);
  background: #ddf4ff;
}

.image-option.correct {
  border-color: var(--green);
  background: #d7ffb8;
}

.image-option.wrong {
  border-color: var(--red);
  background: #ffdfe0;
}

.flashcard {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 10px;
  padding: 16px 0 24px;
}

.flashcard-image {
  width: 100%;
  max-width: 260px;
  aspect-ratio: 1 / 1;
  object-fit: contain;
  border-radius: 16px;
  background: #f7f7f7;
  margin-bottom: 8px;
}

.flashcard-image-playable {
  cursor: pointer;
  transition: transform 0.15s ease;
}

.flashcard-image-playable:active {
  transform: scale(0.96);
}

.flashcard-word {
  font-size: 28px;
  font-weight: 800;
}

.flashcard-translation {
  font-size: 17px;
  color: var(--text-light);
}

.wordbank-area {
  min-height: 56px;
  border-bottom: 2px solid var(--gray-line);
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 8px 2px;
  margin-bottom: 20px;
}

.wordbank-pool {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.chip {
  padding: 10px 14px;
  border-radius: 10px;
  border: 2px solid var(--gray-line);
  border-bottom-width: 3px;
  background: #fff;
  font-weight: 600;
  font-size: 15px;
}

.chip.used {
  opacity: .35;
  pointer-events: none;
}

.feedback-bar {
  position: sticky;
  bottom: 0;
  margin: 0 -16px -16px;
  padding: 16px;
  border-top: 2px solid var(--gray-line);
}

.feedback-bar.ok {
  background: #d7ffb8;
  border-color: #b6e88d;
}

.feedback-bar.bad {
  background: #ffdfe0;
  border-color: #ffb3b6;
}

.feedback-title {
  font-weight: 800;
  font-size: 17px;
  margin-bottom: 2px;
}

.feedback-title.ok-text {
  color: var(--green-dark);
}

.feedback-title.bad-text {
  color: var(--red-dark);
}

.feedback-answer {
  font-size: 14px;
  color: var(--text);
  margin-bottom: 10px;
}

/* ---------- Result screens ---------- */
.result-wrap {
  text-align: center;
  padding-top: 40px;
}

.result-emoji {
  font-size: 72px;
  margin-bottom: 8px;
}

.result-mascot {
  width: 170px;
  height: 170px;
  object-fit: contain;
  margin: 0 auto 8px;
  display: block;
}

.result-stat {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: #fff;
  border: 2px solid var(--gray-line);
  border-radius: 14px;
  padding: 14px 18px;
  margin-bottom: 10px;
  font-weight: 700;
}

/* ---------- Media ---------- */
.media-filter {
  display: flex;
  gap: 8px;
  margin-bottom: 14px;
}

.filter-chip {
  padding: 8px 16px;
  border-radius: 20px;
  border: 2px solid var(--gray-line);
  background: #fff;
  font-weight: 700;
  font-size: 14px;
}

.filter-chip.active {
  background: var(--blue);
  border-color: var(--blue-dark);
  color: #fff;
}

.media-thumb {
  width: 100%;
  aspect-ratio: 16/9;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--purple), var(--blue));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 34px;
  color: #fff;
  margin-bottom: 10px;
}

.segment-line {
  padding: 10px 8px;
  border-radius: 10px;
  margin-bottom: 4px;
}

.segment-line.active {
  background: #fff2b8;
}

.segment-target {
  font-weight: 700;
  font-size: 16px;
}

.segment-translation {
  color: var(--text-light);
  font-size: 14px;
  margin-top: 2px;
}

/* ---------- Leaderboard ---------- */
.lb-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 6px;
  border-bottom: 1px solid var(--gray-line);
}

.lb-rank {
  width: 26px;
  font-weight: 800;
  color: var(--text-light);
}

.lb-row.you {
  background: #ddf4ff;
  border-radius: 10px;
}

/* ---------- Tab bar ---------- */
.tabbar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: #fff;
  border-top: 2px solid var(--gray-line);
  display: flex;
  z-index: 10;
  padding-bottom: env(safe-area-inset-bottom);
}

.tabbar.hidden {
  display: none;
}

.tab {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 8px 0 6px;
  font-size: 11px;
  font-weight: 700;
  color: var(--text-light);
}

.tab.active {
  color: var(--blue);
}

.tab-icon {
  font-size: 20px;
}

.toast {
  position: fixed;
  top: 14px;
  left: 50%;
  transform: translateX(-50%) translateY(-60px);
  background: #333;
  color: #fff;
  padding: 10px 18px;
  border-radius: 12px;
  font-size: 14px;
  z-index: 100;
  transition: transform .25s;
  max-width: 90%;
}

.toast.show {
  transform: translateX(-50%) translateY(0);
}

.empty-state {
  text-align: center;
  padding: 40px 20px;
  color: var(--text-light);
}

.empty-emoji {
  font-size: 44px;
  margin-bottom: 10px;
}

.empty-mascot {
  display: block;
  width: 120px;
  height: 120px;
  object-fit: contain;
  margin: 0 auto 10px;
}

hr.sep {
  border: none;
  border-top: 2px solid var(--gray-line);
  margin: 18px 0;
}



/* ===== Brand tokens (Azerbaijani-flag inspired, not Duolingo-green) ===== */
:root {
  --paper: #FAFAF7;
  --ink: #1B2430;
  --teal: #049A8F;
  --teal-dark: #037A71;
  --red: #F2545B;
  --leaf: #4CAF7D;
  --leaf-dark: #3C9C68;
  --gold: #FFB020;
  --purple: #7C5CFC;
  /* kept for existing track badges */
  --text-light: #8B93A1;
}

body {
  background: var(--paper);
  color: var(--ink);
  font-family: "Vazirmatn", sans-serif;
}

/* ===== Header + logo ===== */
.app-header {
  position: sticky;
  top: 0;
  z-index: 20;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  background: var(--paper);
  border-bottom: 2px solid #EEE;
}

.logo {
  font-family: "Vazirmatn", sans-serif;
  font-size: 20px;
  font-weight: 800;
  color: var(--teal-dark);
  text-decoration: none;
  letter-spacing: 1px;
}

.header-stats {
  display: flex;
  gap: 8px;
}

/* ===== Stat pills ===== */
.stat-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 9px;
  border-radius: 999px;
  background: #fff;
  border: 2px solid #E8E8E8;
  font-weight: 700;
  font-size: 12px;
}

.stat-pill.streak-pill {
  cursor: pointer;
  transition: transform .15s ease;
}

.stat-pill.streak-pill:active {
  transform: scale(.92);
}

/* ===== Admin monitoring dashboard ===== */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  margin-bottom: 14px;
}

.stat-tile {
  background: #fff;
  border: 2px solid #E5E5E5;
  border-bottom-width: 5px;
  border-radius: 16px;
  padding: 14px;
  text-align: center;
}

.stat-tile-emoji {
  font-size: 22px;
}

.stat-tile-value {
  font-size: 20px;
  font-weight: 800;
  color: var(--ink);
  margin-top: 2px;
}

.stat-tile-label {
  font-size: 13px;
  color: var(--text-light);
  margin-top: 2px;
}

.monitoring-card-title {
  margin: 0 0 10px;
  font-size: 15px;
}

.dataset-grid {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.dataset-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 6px 0;
  border-bottom: 1px solid var(--gray-line);
}

.dataset-row:last-child {
  border-bottom: none;
}

/* ===== Chunky "3D button" cards (Duolingo's actual trick: an offset
   bottom border you can press, not a soft drop shadow) ===== */
.card {
  background: #fff;
  border: 2px solid #E5E5E5;
  border-bottom-width: 5px;
  border-radius: 16px;
  padding: 16px;
  margin-bottom: 12px;
  transition: transform 0.05s ease, border-bottom-width 0.05s ease;
}

.card-clickable:active {
  transform: translateY(3px);
  border-bottom-width: 2px;
}

.track-card {
  border-color: var(--track-color, var(--teal));
  border-bottom-color: var(--track-color, var(--teal));
}

.level-badge {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  flex-shrink: 0;
}

/* ===== Daily goal progress ===== */
.goal-track {
  height: 12px;
  border-radius: 999px;
  background: #EDEDED;
  overflow: hidden;
  margin-top: 8px;
}

.goal-fill {
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--leaf), var(--leaf-dark));
  transition: width 0.6s ease;
}

.streak-risk-row {
  align-items: center;
  gap: 10px;
  margin-top: 12px;
}

.streak-risk-mascot {
  width: 40px;
  height: 40px;
  object-fit: contain;
  flex-shrink: 0;
}

/* ===== Section headings use the display face too ===== */
h1,
h2 {
  font-family: "Vazirmatn", sans-serif;
  font-weight: 700;
}

h1 {
  font-size: 26px;
}

h2 {
  font-size: 20px;
  color: var(--ink);
}

.mt24 {
  margin-top: 24px;
}

.row {
  display: flex;
  align-items: center;
  gap: 12px;
}

.col {
  display: flex;
  flex-direction: column;
}

.grow {
  flex: 1;
}

.muted {
  color: var(--text-light);
}

.small {
  font-size: 13px;
}

.empty-state {
  text-align: center;
  padding: 40px 20px;
  color: var(--text-light);
}

.empty-emoji {
  font-size: 40px;
  margin-bottom: 8px;
}

/* ===== Bottom tab bar, chunkier ===== */
.tabbar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  display: flex;
  background: #fff;
  border-top: 2px solid #EEE;
  padding: 3px 0 max(3px, env(safe-area-inset-bottom));
  z-index: 20;
}

.tab {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1px;
  padding: 4px 0;
  text-decoration: none;
  color: var(--text-light);
  font-size: 10px;
  font-weight: 600;
}

.tab.active {
  color: var(--teal-dark);
}

.tab-icon {
  font-size: 16px;
}



.avatar-circle {
  width: 84px;
  height: 84px;
  border-radius: 50%;
  border: none;
  font-size: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 8px;
  cursor: pointer;
  transition: transform 0.1s ease;
}

.avatar-circle:active {
  transform: scale(0.94);
}

.link-btn {
  background: none;
  border: none;
  color: var(--teal-dark);
  font-weight: 700;
  font-size: 14px;
  cursor: pointer;
  padding: 4px;
}

.avatar-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  margin-top: 14px;
}

.avatar-grid.hidden {
  display: none;
}

.avatar-option {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 10px 4px;
  border-radius: 14px;
  border: 2px solid transparent;
  cursor: pointer;
  transition: transform 0.1s ease;
}

.avatar-option:active {
  transform: scale(0.95);
}

.avatar-option.selected {
  border-width: 3px;
  box-shadow: 0 0 0 2px #fff inset;
}

.toast {
  position: fixed;
  top: -60px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--ink);
  color: #fff;
  padding: 10px 18px;
  border-radius: 12px;
  font-size: 14px;
  font-weight: 600;
  transition: top 0.3s ease;
  z-index: 50;
}

.toast.show {
  top: 16px;
}







/* ===== Circle path (one circle per unit, each a ring of levels) ===== */
.trail-wrap {
  position: relative;
  padding: 12px 0 40px;
}

#trail-svg {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.node-layer {
  position: relative;
  z-index: 2;
}

.circle-slot {
  position: relative;
  height: 210px;
}

.mascot-decor {
  position: absolute;
  top: -21px;
  width: 150px;
  height: 150px;
  object-fit: contain;
  filter: drop-shadow(0 4px 6px rgba(0, 0, 0, .18));
  animation: mascotBob 2.8s ease-in-out infinite;
  pointer-events: none;
  z-index: 1;
}

@keyframes mascotBob {

  0%,
  100% {
    transform: translateY(0) rotate(var(--mascot-rot, 0deg));
  }

  50% {
    transform: translateY(-10px) rotate(var(--mascot-rot, 0deg));
  }
}

.unit-circle {
  position: absolute;
  top: 12px;
  width: 88px;
  height: 88px;
  border-radius: 50%;
  padding: 6px;
  cursor: pointer;
  transition: transform .05s ease;
}

.unit-circle:active {
  transform: scale(.95);
}

.unit-circle-inner {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  background: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 34px;
  box-shadow: inset 0 -3px 0 rgba(0, 0, 0, .08);
}

.unit-circle.locked {
  cursor: default;
}

.unit-circle.locked .unit-circle-inner {
  color: var(--text-light);
}

.unit-circle.locked.shake {
  animation: nodeShake .35s;
}

@keyframes nodeShake {

  0%,
  100% {
    transform: translateX(0);
  }

  25% {
    transform: translateX(-6px);
  }

  75% {
    transform: translateX(6px);
  }
}

.unit-circle.solved .unit-circle-inner {
  background: #fff7e0;
}

.unit-circle-label {
  position: absolute;
  top: 100px;
  transform: translateX(-50%);
  width: 150px;
  text-align: center;
  font-size: 13px;
  font-weight: 700;
  color: var(--text-light);
}

.exam-slot {
  display: flex;
  flex-direction: column;
  align-items: center;
  position: relative;
  z-index: 2;
}

.exam-slot-top {
  margin-bottom: 16px;
}

.exam-node {
  width: 96px;
  height: 96px;
  border-radius: 50%;
  cursor: pointer;
  background: linear-gradient(160deg, #FFCA5C, var(--gold));
  border: 2px solid #C98600;
  border-bottom-width: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 42px;
  animation: trophyFloat 3s ease-in-out infinite;
  transition: transform .05s ease, border-bottom-width .05s ease;
}

.exam-node:active {
  transform: translateY(4px);
  border-bottom-width: 2px;
}

.exam-node.locked {
  filter: grayscale(1) opacity(.6);
  animation: none;
}

.exam-node.locked.shake {
  animation: nodeShake .35s;
}

@keyframes trophyFloat {

  0%,
  100% {
    transform: translateY(0) rotate(0deg);
  }

  50% {
    transform: translateY(-6px) rotate(-3deg);
  }
}

/* ---- unit click popover — small box anchored next to the clicked circle ---- */
.unit-popover-overlay {
  position: fixed;
  inset: 0;
  background: transparent;
  opacity: 0;
  pointer-events: none;
  transition: opacity .15s ease;
  z-index: 50;
}

.unit-popover-overlay.open {
  opacity: 1;
  pointer-events: auto;
}

.unit-popover {
  position: absolute;
  width: 240px;
  background: var(--paper);
  border-radius: 18px;
  padding: 20px 16px 16px;
  text-align: center;
  box-shadow: 0 10px 34px rgba(27, 36, 48, .28);
  transform: scale(.92);
  transition: transform .15s ease;
}

.unit-popover-overlay.open .unit-popover {
  transform: scale(1);
}

.unit-popover-icon {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  margin: -44px auto 10px;
  background: var(--teal);
  color: #fff;
  font-size: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 4px solid #fff;
}

.unit-popover h2 {
  margin: 0 0 4px;
  font-size: 16px;
}

.unit-popover p.muted {
  margin: 0 0 12px;
  font-size: 13px;
}

.unit-popover .btn {
  padding: 8px 12px;
  font-size: 14px;
}

/* ---- centered modal — for congrats / message-style overlays, room for a gif ---- */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(27, 36, 48, .45);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s ease;
  z-index: 60;
  padding: 20px;
}

.modal-overlay.open {
  opacity: 1;
  pointer-events: auto;
}

.modal-box {
  width: 100%;
  max-width: 380px;
  background: var(--paper);
  border-radius: 24px;
  padding: 28px 24px 24px;
  text-align: center;
  transform: scale(.9);
  opacity: 0;
  transition: transform .25s ease, opacity .25s ease;
}

.modal-overlay.open .modal-box {
  transform: scale(1);
  opacity: 1;
}

.modal-box img,
.modal-box video {
  max-width: 100%;
  border-radius: 16px;
  margin-bottom: 12px;
}

.modal-mascot {
  width: 140px;
  height: 140px;
  object-fit: contain;
  border-radius: 0;
  margin: 0 auto 8px;
}

@media (prefers-reduced-motion: reduce) {

  .unit-circle.locked.shake,
  .exam-node {
    animation: none !important;
  }
}