:root {
  --bg: #ffffff;
  --surface: #ffffff;
  --surface-soft: #f5f6fa;
  --dark: #121316;
  --dark-border: rgba(255, 255, 255, 0.14);
  --cobalt: #1b14ff;
  --cobalt-hover: #140ec9;
  --cobalt-tint: #eef0ff;
  --yellow: #ffe600;
  --yellow-hover: #ffd600;
  --text: #111111;
  --body: #6b7280;
  --border: #e5e7eb;
  --success-bg: #dcfce7;
  --success-text: #15803d;
  --danger-bg: #fee2e2;
  --danger-text: #b91c1c;
  --radius-xl: 22px;
  --radius: 16px;
  --radius-sm: 12px;
  --pill: 9999px;
  --muted: #6b7280;
}

.btn:disabled,
.btn[disabled] {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none;
}

/* Teacher studio tab bar & card grids */
.filters {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
}

/* Footer used on play / about / privacy pages */
.academy-footer {
  border-top: 1px solid var(--border);
  padding: 24px 0 32px;
  color: var(--body);
  font-size: 0.85rem;
}

.footer-bottom {
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
}

.footer-bottom a {
  color: var(--body) !important;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Roboto", system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.55;
}

a {
  color: var(--cobalt);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

.container {
  max-width: 1140px;
  margin: 0 auto;
  padding: 0 20px;
}

/* ---------- Electric Blue Navbar ---------- */
.navbar {
  background: var(--cobalt);
  color: #ffffff;
  position: sticky;
  top: 0;
  z-index: 30;
}

.nav-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 14px 0;
  flex-wrap: wrap;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 800;
  font-size: 1.1rem;
  color: #ffffff;
  text-decoration: none !important;
}

.brand-mark {
  width: 32px;
  height: 32px;
  border-radius: 10px;
  background: var(--yellow);
  color: var(--text);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.95rem;
  font-weight: 800;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 24px;
  flex-wrap: wrap;
}

.nav-links a {
  color: rgba(255, 255, 255, 0.88);
  font-weight: 500;
  font-size: 0.93rem;
}

.nav-links a:hover,
.nav-links a.active {
  color: #ffffff;
  font-weight: 700;
  text-decoration: none;
}

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

/* ---------- Pill Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 20px;
  border-radius: var(--pill);
  border: 1px solid transparent;
  font-weight: 600;
  font-size: 0.9rem;
  cursor: pointer;
  transition: 0.16s ease;
  background: var(--cobalt);
  color: #ffffff;
  text-decoration: none !important;
}

.btn:hover {
  background: var(--cobalt-hover);
}

.btn-dark {
  background: var(--dark);
  color: #ffffff;
}

.btn-dark:hover {
  background: #27272a;
}

.btn-white {
  background: #ffffff;
  color: var(--text);
}

.btn-white:hover {
  background: var(--surface-soft);
}

.btn-yellow {
  background: var(--yellow);
  color: var(--text);
}

.btn-yellow:hover {
  background: var(--yellow-hover);
}

.btn-outline {
  background: var(--surface);
  color: var(--text);
  border-color: var(--border);
}

.btn-outline:hover {
  background: var(--surface-soft);
}

.btn-sm {
  padding: 8px 16px;
  font-size: 0.84rem;
}

.btn-danger {
  background: var(--danger-text);
  color: #ffffff;
}

.circle-action {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--yellow);
  color: var(--text);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 1rem;
  flex-shrink: 0;
  text-decoration: none !important;
}

.circle-action:hover {
  background: var(--yellow-hover);
}

/* ---------- Compact Hero Banner ---------- */
.hero-wrap {
  padding: 20px 0 8px;
}

.hero-banner {
  background: radial-gradient(circle at 85% 20%, rgba(27, 20, 255, 0.45), transparent 55%),
              linear-gradient(135deg, #121316 0%, #1e2030 100%);
  color: #ffffff;
  border-radius: var(--radius-xl);
  padding: 36px 36px;
}

.hero-banner h1 {
  margin: 0 0 18px;
  font-size: clamp(1.75rem, 3.2vw, 2.4rem);
  font-weight: 800;
  line-height: 1.18;
}

.topic-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin-top: 22px;
}

.topic-pill {
  background: #ffffff;
  color: var(--text);
  padding: 7px 14px;
  border-radius: var(--pill);
  font-size: 0.84rem;
  font-weight: 600;
  text-decoration: none !important;
  transition: 0.15s ease;
}

.topic-pill:hover {
  background: var(--yellow);
}

/* ---------- Sections & Cards ---------- */
.section {
  padding: 36px 0;
}

.section-title {
  margin: 0 0 20px;
  font-size: 1.6rem;
  font-weight: 800;
}

.filters-bar {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 22px;
}

input, select, textarea {
  font: inherit;
  font-size: 0.92rem;
  padding: 10px 16px;
  border: 1px solid var(--border);
  border-radius: var(--pill);
  background: var(--surface-soft);
  color: var(--text);
}

textarea {
  border-radius: var(--radius);
}

input:focus, select:focus, textarea:focus {
  outline: 2px solid rgba(27, 20, 255, 0.2);
  border-color: var(--cobalt);
  background: #ffffff;
}

.grid-2 {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 18px;
}

.card {
  background: var(--surface-soft);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 14px;
  transition: transform 0.15s ease, background 0.15s ease;
}

.card:hover {
  transform: translateY(-2px);
  background: #ffffff;
}

.card-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.card h3, .card h4 {
  margin: 0 0 6px;
  font-size: 1.08rem;
  font-weight: 700;
}

.card p {
  margin: 0;
  color: var(--body);
  font-size: 0.9rem;
}

.badges {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 8px;
}

.badge {
  font-size: 0.75rem;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: var(--pill);
  background: var(--cobalt-tint);
  color: var(--cobalt);
}

.badge-yellow {
  background: var(--yellow);
  color: var(--text);
}

/* ---------- AdSense & Footer ---------- */
.ad-slot {
  margin: 20px 0;
  padding: 16px;
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  text-align: center;
  color: var(--body);
  background: var(--surface-soft);
  font-size: 0.85rem;
}

.site-footer {
  padding: 24px 0 32px;
  border-top: 1px solid var(--border);
  color: var(--body);
  font-size: 0.85rem;
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
}

/* ---------- Modal & Player ---------- */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(18, 19, 22, 0.55);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 50;
}

.modal-backdrop.open {
  display: flex;
}

.modal {
  background: var(--surface);
  border-radius: var(--radius-xl);
  max-width: 780px;
  width: 100%;
  max-height: 88vh;
  overflow-y: auto;
  padding: 26px;
}

.pres-viewer {
  margin-top: 20px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--dark);
  user-select: none;
  -webkit-user-select: none;
}

.pres-frame {
  width: 100%;
  aspect-ratio: 16 / 9;
  border: none;
  display: block;
}

.pres-slide-stage {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--dark);
}

.pres-slide-stage img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  pointer-events: none;
  -webkit-user-drag: none;
  user-select: none;
}

.pres-controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  background: var(--surface-soft);
  border-top: 1px solid var(--border);
  font-size: 0.88rem;
  font-weight: 600;
}

.play-box {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 26px;
  margin: 24px 0;
}

.timeline-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-soft);
  margin-bottom: 10px;
}

.quiz-option {
  display: block;
  width: 100%;
  text-align: left;
  padding: 12px 16px;
  margin-bottom: 8px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-soft);
  cursor: pointer;
  font: inherit;
}

.quiz-option.selected {
  border-color: var(--cobalt);
  background: var(--cobalt-tint);
  font-weight: 600;
  color: var(--cobalt);
}

.map-board {
  position: relative;
  width: 100%;
  height: 380px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: radial-gradient(circle at 30% 30%, #eef0ff, #dbeafe);
  overflow: hidden;
  margin-bottom: 16px;
}

.map-pin {
  position: absolute;
  transform: translate(-50%, -50%);
  width: 28px;
  height: 28px;
  padding: 0;
  border-radius: 50%;
  background: var(--cobalt);
  color: #fff;
  border: 2px solid #fff;
  font: 700 0.8rem/1 "Roboto", sans-serif;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.25);
  z-index: 2;
}

.map-pin.visited {
  background: #16a34a;
}

.map-label {
  position: absolute;
  transform: translate(-50%, 18px);
  padding: 3px 8px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.95);
  color: var(--text);
  font-size: 0.76rem;
  font-weight: 700;
  white-space: nowrap;
  max-width: 160px;
  overflow: hidden;
  text-overflow: ellipsis;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.2);
  pointer-events: none;
  z-index: 1;
}

.map-label.empty {
  color: var(--body);
  font-weight: 500;
  font-style: italic;
}

.map-pin.active {
  background: var(--yellow);
  color: var(--text);
  transform: translate(-50%, -50%) scale(1.15);
}

.status-msg {
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  margin-top: 12px;
  font-weight: 500;
  font-size: 0.9rem;
}

.status-ok {
  background: var(--success-bg);
  color: var(--success-text);
}

.status-err {
  background: var(--danger-bg);
  color: var(--danger-text);
}

/* ---------- Wordwall Template Picker & Game Styles ---------- */
.template-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 10px;
  margin-bottom: 18px;
}

.template-card {
  background: var(--surface-soft);
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px;
  cursor: pointer;
  text-align: left;
  transition: 0.15s ease;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.template-card:hover {
  border-color: var(--cobalt);
  background: #ffffff;
}

.template-card.active {
  border-color: var(--cobalt);
  background: var(--cobalt-tint);
}

.template-icon {
  font-size: 1.4rem;
}

.template-name {
  font-weight: 700;
  font-size: 0.9rem;
  color: var(--text);
}

.template-hint {
  font-size: 0.76rem;
  color: var(--body);
}

.play-hud {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  padding: 10px 14px;
  background: var(--surface-soft);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  margin-bottom: 18px;
  font-weight: 600;
  font-size: 0.9rem;
}

.match-board {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.match-card {
  padding: 12px 14px;
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  cursor: pointer;
  font-weight: 500;
  text-align: center;
  margin-bottom: 8px;
  transition: 0.15s ease;
}

.match-card.selected {
  border-color: var(--cobalt);
  background: var(--cobalt-tint);
}

.match-card.matched {
  border-color: #16a34a;
  background: var(--success-bg);
  color: var(--success-text);
  cursor: default;
}

.match-card.wrong {
  border-color: var(--danger-text);
  background: var(--danger-bg);
}

.boxes-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 12px;
}

.mystery-box {
  aspect-ratio: 1 / 1;
  border-radius: var(--radius);
  border: 2px solid var(--cobalt);
  background: var(--cobalt);
  color: #ffffff;
  font-size: 1.8rem;
  font-weight: 800;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 12px;
  cursor: pointer;
  text-align: center;
  transition: 0.18s ease;
}

.mystery-box:hover {
  transform: translateY(-2px);
}

.mystery-box.opened {
  background: var(--yellow);
  border-color: var(--yellow-hover);
  color: var(--text);
  font-size: 0.92rem;
  font-weight: 600;
  cursor: default;
}

.wheel-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
}

.wheel-pointer {
  width: 0;
  height: 0;
  border-left: 12px solid transparent;
  border-right: 12px solid transparent;
  border-top: 20px solid var(--text);
  margin-bottom: -10px;
  z-index: 2;
}

.blank-slot {
  display: inline-block;
  min-width: 90px;
  padding: 2px 10px;
  margin: 0 4px;
  border-bottom: 2px solid var(--cobalt);
  background: var(--cobalt-tint);
  border-radius: 6px;
  font-weight: 700;
  color: var(--cobalt);
  cursor: pointer;
  text-align: center;
}

.word-bank {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 16px;
}

.quiz-progress {
  height: 8px;
  border-radius: var(--pill);
  background: var(--surface-soft);
  border: 1px solid var(--border);
  overflow: hidden;
  margin-bottom: 16px;
}

.quiz-progress-bar {
  height: 100%;
  background: var(--cobalt);
  transition: width 0.25s ease;
}

.quiz-tiles {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-top: 14px;
}

.quiz-tile {
  padding: 16px;
  border-radius: var(--radius);
  border: 2px solid var(--border);
  background: var(--surface-soft);
  font: inherit;
  font-weight: 600;
  font-size: 0.96rem;
  text-align: left;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 12px;
  transition: 0.15s ease;
}

.quiz-tile:hover {
  border-color: var(--cobalt);
  background: var(--cobalt-tint);
}

.quiz-tile.correct {
  border-color: #16a34a;
  background: var(--success-bg);
  color: var(--success-text);
}

.quiz-tile.wrong {
  border-color: var(--danger-text);
  background: var(--danger-bg);
  color: var(--danger-text);
}

.quiz-letter {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  background: var(--cobalt);
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  flex-shrink: 0;
}

.baamboozle-reveal {
  margin-top: 18px;
  padding: 20px;
  border-radius: var(--radius);
  border: 2px solid var(--cobalt);
  background: var(--surface-soft);
}

@media (max-width: 760px) {
  .hero-banner {
    padding: 26px 20px;
  }
  .match-board,
  .quiz-tiles {
    grid-template-columns: 1fr;
  }
}
