/* ── Loader ──────────────────────────────────────────────────────────────── */
#loader {
  position: fixed;
  inset: 0;
  background: var(--dark);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 9999;
}

.spinner-border {
  border-color: var(--primary) transparent var(--primary) transparent !important;
}

/* ── Design tokens (mirror portfolio) ──────────────────────────────────────── */
:root {
  --primary:  #c4922a;
  --dark:     #0f1117;
  --surface:  #1a1e27;
  --surface2: #22273a;
  --light:    #e8e8e8;
  --muted:    #8a8f9a;
  --border:   rgba(255, 255, 255, 0.08);
  --radius:   10px;
}

/* ── Base ───────────────────────────────────────────────────────────────────── */
body {
  font-family: 'Montserrat', sans-serif;
  background: var(--dark);
  color: var(--light);
  min-height: 100vh;
}

h1, h2, h3, h4, h5, h6 {
  font-family: 'Playfair Display', serif;
  color: var(--light);
}

p { color: var(--light); }

a { color: var(--primary); }
a:hover { color: #e0b060; }

/* ── Swiper overflow wrapper ─────────────────────────────────────────────────── */
.swiper-overflow-wrapper {
  overflow: hidden;
  width: 100%;
  position: relative;
}

/* ── Swiper container — autoHeight ──────────────────────────────────────────── */
.mySwiper {
  overflow: visible !important;
  width: 100%;
}

/* Slides — padding-top makes room for the pagination bar above */
.mySwiper .swiper-slide {
  overflow: visible;
  height: auto;
  background: var(--dark);
  padding: 36px 48px 10px;  /* top: room for progressbar; sides: room for arrows */
  box-sizing: border-box;
}

/* Pagination progressbar — Swiper puts this at top:0 by default, keep it there */
.mySwiper .swiper-pagination {
  top: 0 !important;
  bottom: auto !important;
}

/* ── Navigation arrows ───────────────────────────────────────────────────────── */
.swiper-button-next,
.swiper-button-prev {
  position: absolute !important;
  top: 120px !important;           /* fixed distance from swiper top, below heading */
  transform: none !important;
  z-index: 200 !important;
  color: var(--primary) !important;
  background: rgba(15, 17, 23, 0.7);
  border-radius: 50%;
  width: 36px !important;
  height: 36px !important;
  display: flex !important;
  align-items: center;
  justify-content: center;
  transition: background 0.2s;
}

.swiper-button-next:hover,
.swiper-button-prev:hover {
  background: rgba(196, 146, 42, 0.2);
}

.swiper-button-prev { left: 4px !important; }
.swiper-button-next { right: 4px !important; }

/* Swiper default arrow size override */
.swiper-button-next::after,
.swiper-button-prev::after {
  font-size: 14px !important;
  font-weight: 900;
}

/* Desktop — slightly larger */
@media (min-width: 768px) {
  .swiper-button-next,
  .swiper-button-prev {
    width: 44px !important;
    height: 44px !important;
    top: 140px !important;
  }

  .swiper-button-next::after,
  .swiper-button-prev::after {
    font-size: 18px !important;
  }

  .mySwiper .swiper-slide {
    padding: 10px 64px;
  }
}

/* ── Swiper chrome ──────────────────────────────────────────────────────────── */
.textSwiper {
  background: var(--dark);
  margin: 0;
  padding: 0;
}

.swiper-pagination-progressbar .swiper-pagination-progressbar-fill {
  background: var(--primary) !important;
}

/* ── Bootstrap card overrides ───────────────────────────────────────────────── */
.card {
  background: var(--surface) !important;
  border: 1px solid var(--border) !important;
  color: var(--light) !important;
  border-radius: var(--radius) !important;
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

.card:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
  border-color: var(--primary) !important;
}

.card-text,
.card p,
.card .text-muted {
  color: var(--muted) !important;
}

.card-title { color: var(--light) !important; }

/* Success / completion cards — add bottom padding so they're never clipped */
#card-articulator,
#card-exercises,
#card-twister,
#card-trivia,
#card-bonuses,
[id^="card-"] {
  margin-bottom: 2rem !important;
  padding-bottom: 1.5rem !important;
}

/* Swiper slide needs enough padding at bottom for completion cards */
.swiper-slide {
  padding-bottom: 2rem;
}

/* ── Headings with gold underbar ────────────────────────────────────────────── */
h1 {
  font-size: clamp(1.8rem, 5vw, 2.8rem);
  color: var(--light);
  margin-bottom: 1.5rem;
  text-align: center;
}

h1::after {
  content: '';
  display: block;
  width: 56px;
  height: 3px;
  background: linear-gradient(90deg, var(--primary), #e0b060);
  margin: 8px auto 0; /* auto centers the bar under centered text */
  border-radius: 2px;
}

/* Category headings (slides) — match portfolio section h2 style */
.swiper-slide h2,
.swiper-slide h1 {
  text-align: center;
}

.swiper-slide h2::after,
.swiper-slide h1::after {
  content: '';
  display: block;
  width: 48px;
  height: 3px;
  background: linear-gradient(90deg, var(--primary), #e0b060);
  margin: 8px auto 28px;
  border-radius: 2px;
}

/* Arrows SVG below 'Otwórz lusterko' — tint gold */
img[src*="arrows.svg"] {
  filter: invert(65%) sepia(60%) saturate(600%) hue-rotate(5deg) brightness(95%);
  opacity: 0.85;
}

/* ── Buttons ────────────────────────────────────────────────────────────────── */
.btn-dark,
.btn-dark:not(:disabled):not(.disabled) {
  background: var(--surface2);
  border-color: var(--surface2);
  color: var(--light);
  font-weight: 600;
  transition: background 0.2s, border-color 0.2s, color 0.2s;
}

.btn-dark:hover,
.btn-dark:focus {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}

.btn-success {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
  font-weight: 600;
}

.btn-success:hover {
  background: #a8791f;
  border-color: #a8791f;
}

.btn-secondary {
  background: var(--surface);
  border-color: var(--border);
  color: var(--muted);
  font-weight: 600;
}

.btn-secondary:hover {
  background: var(--surface2);
  border-color: var(--muted);
  color: var(--light);
}

/* ── Forms / inputs ─────────────────────────────────────────────────────────── */
.form-control {
  background: var(--surface);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: var(--light);
  border-radius: 8px;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.form-control::placeholder { color: var(--muted); }

.form-control:focus {
  background: var(--surface);
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(196, 146, 42, 0.18);
  color: var(--light);
  outline: none;
}

/* ── Scroll-to-top button ───────────────────────────────────────────────────── */
#topBtn {
  display: none;
  position: fixed;
  bottom: 20px;
  right: 30px;
  z-index: 99;
  font-size: 18px;
  border: none;
  outline: none;
  background: var(--surface2);
  color: var(--light);
  cursor: pointer;
  padding: 12px 15px;
  border-radius: 8px;
  transition: background 0.2s;
}

#topBtn:hover { background: var(--primary); }

/* ── Carousel ───────────────────────────────────────────────────────────────── */
.carousel-item {
  text-align: center;
  font-size: 1.2rem;
  height: auto;
  line-height: 1.4;
  padding: 10px;
  color: var(--light);
}

/* ── Modal ──────────────────────────────────────────────────────────────────── */
.modal {
  display: none;
  position: fixed;
  z-index: 1;
  left: 0; top: 0;
  width: 100%; height: 100%;
  overflow: auto;
  background: rgba(0, 0, 0, 0.6);
}

.modal-content {
  position: fixed;
  left: 50%; top: 50%;
  transform: translate(-50%, -50%);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 32px 28px;
  width: 80%;
  max-width: 520px;
  text-align: center;
  font-size: 1.25rem;
  color: var(--light);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

.close {
  color: var(--muted);
  float: right;
  font-size: 28px;
  font-weight: bold;
  cursor: pointer;
  transition: color 0.2s;
}

.close:hover,
.close:focus { color: var(--primary); text-decoration: none; }

/* ── Screen dim overlay ─────────────────────────────────────────────────────── */
#screen-dim {
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 100%;
  background: rgba(0, 0, 0, 0.65);
  z-index: 99;
  display: none;
}

/* ── Beaver mascot — tutorial ───────────────────────────────────────────────── */
#beaver-container,
#polish-beaver-container {
  position: fixed;
  z-index: 100;
  cursor: pointer;
}

#beaver-img,
#polish-beaver-img {
  width: 100px;
  height: auto;
  position: absolute;
  filter: drop-shadow(0 4px 12px rgba(0, 0, 0, 0.5));
}

#beaver-speech-bubble,
#polish-beaver-speech-bubble {
  display: block;
  position: absolute;
  background: var(--surface);
  border: 1px solid rgba(196, 146, 42, 0.35);
  padding: 14px 16px;
  border-radius: var(--radius);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
  font-size: 1rem;
  max-width: 300px;
  text-align: center;
  z-index: 101;
  color: var(--light);
}

#close-speech-bubble,
#polish-close-speech-bubble {
  position: absolute;
  top: -10px; right: -10px;
  font-size: 16px;
  background: var(--primary);
  color: #fff;
  width: 22px; height: 22px;
  text-align: center;
  border-radius: 50%;
  cursor: pointer;
  line-height: 22px;
  font-weight: 700;
  transition: background 0.2s;
}

#close-speech-bubble:hover,
#polish-close-speech-bubble:hover { background: #a8791f; }

#beaver-text,
#polish-beaver-text { display: block; color: var(--light); }

#beaver-options { margin-top: 10px; }

/* ── Chat beaver ────────────────────────────────────────────────────────────── */
#chat-beaver-container {
  position: fixed;
  bottom: 20px; right: 20px;
  width: 200px;
  z-index: 1000;
  cursor: move;
  display: flex;
  flex-direction: column;
  align-items: center;
}

#chat-beaver-img {
  width: 100px;
  height: auto;
  position: absolute;
  filter: drop-shadow(0 4px 12px rgba(0, 0, 0, 0.5));
}

#chat-speech-bubble {
  position: absolute;
  bottom: 100%; left: 50%;
  transform: translateX(-50%);
  background: var(--surface);
  border: 1px solid rgba(196, 146, 42, 0.35);
  border-radius: var(--radius);
  padding: 12px;
  max-width: 200px;
  display: flex;
  flex-direction: column;
  align-items: center;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
}

#chat-text {
  margin-bottom: 10px;
  color: var(--light);
  font-size: 0.9rem;
}

#beaver-input-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
  margin-top: 100px;
  z-index: 1002;
  position: relative;
}

#chat-user-input {
  width: 100%;
  padding: 8px 10px;
  font-size: 13px;
  background: var(--dark);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 6px;
  color: var(--light);
  box-sizing: border-box;
}

#chat-user-input:focus {
  border-color: var(--primary);
  outline: none;
  box-shadow: 0 0 0 2px rgba(196, 146, 42, 0.2);
}

#chat-send-button {
  width: 100%;
  padding: 8px;
  font-size: 14px;
  border: none;
  border-radius: 6px;
  background: var(--surface2);
  color: var(--light);
  cursor: pointer;
  margin-top: 5px;
  font-weight: 600;
  transition: background 0.2s;
}

#chat-send-button:hover { background: var(--primary); }

/* ── Exercise / articulator / twister text blocks ───────────────────────────── */
.articulator,
.exercise,
.twister,
.trivia,
.fact {
  background: var(--surface) !important;
  border: 1px solid var(--border) !important;
  color: var(--light) !important;
  border-radius: var(--radius) !important;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.articulator:hover,
.exercise:hover,
.twister:hover,
.trivia:hover,
.fact:hover {
  border-color: rgba(196, 146, 42, 0.4) !important;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
}

/* Bootstrap bg-light override inside dark theme */
.bg-light {
  background: var(--surface) !important;
}

.bg-light.bg-gradient {
  background: var(--surface) !important;
}

/* ── Highlight effect (beacon tutorial) ─────────────────────────────────────── */
.highlight {
  outline: 3px solid rgba(196, 146, 42, 0.85) !important;
  box-shadow: 0 0 20px 6px rgba(196, 146, 42, 0.4) !important;
  z-index: 1000;
  position: relative;
}

a.highlight {
  outline: 3px solid rgba(196, 146, 42, 0.85) !important;
  box-shadow: 0 0 20px 6px rgba(196, 146, 42, 0.4) !important;
}

#slide-arrow-container {
  display: none;
  position: absolute;
  right: 30px; top: 50%;
  transform: translateY(-50%);
  z-index: 999;
}

#slide-specific-arrow {
  font-size: 48px;
  text-shadow: 0 0 10px rgba(196, 146, 42, 0.8);
}

/* ── Video mirror containers ─────────────────────────────────────────────────── */
@media only screen and (max-width: 767px) {
  #video-container-articulators,
  #video-container-exercises,
  #video-container-twisters,
  #video-container-bonuses {
    display: block;
    overflow: hidden;
    width: 100%;
    height: 30vh;
    position: relative;
    border-radius: var(--radius);
    border: 1px solid var(--border);
  }

  #video-preview-articulators,
  #video-preview-exercises,
  #video-preview-twisters,
  #video-preview-bonuses {
    width: 100%;
    height: 100vh;
    position: absolute;
    top: -70vh; left: 0;
    object-fit: cover;
  }
}

/* ── Navbar adjustments for dark base ───────────────────────────────────────── */
.navbar-dark .navbar-nav .nav-link,
.navbar .nav-link {
  color: var(--light);
  transition: color 0.2s;
}

.navbar-dark .navbar-nav .nav-link:hover,
.navbar .nav-link:hover { color: var(--primary); }

/* LingwoŁamki icon — link to /tonguetwister/ */
.navbar-tt-home {
  display: flex;
  align-items: center;
  flex-shrink: 0;
  opacity: 0.85;
  transition: opacity 0.2s;
}

.navbar-tt-home:hover { opacity: 1; }

.tt-logo {
  border-radius: 6px;
  display: block;
}

/* Portfolio home brand — avatar + "Home" text */
.navbar-brand {
  display: flex !important;
  align-items: center !important;
  gap: 8px !important;
  color: var(--light) !important;
  font-family: 'Montserrat', sans-serif !important;
  font-weight: 700 !important;
  font-size: 1rem !important;
  text-decoration: none !important;
  transition: color 0.2s !important;
}

.navbar-brand:hover { color: var(--primary) !important; }

/* Avatar circle — hardcoded in navbar.html */
#navbar-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid rgba(196, 146, 42, 0.5);
  display: block !important;
  flex-shrink: 0;
  transition: border-color 0.2s;
}

.navbar-brand:hover #navbar-avatar { border-color: var(--primary); }

/* Bootstrap table dark override */
.table {
  color: var(--light);
  border-color: var(--border);
}

.table thead th {
  border-color: rgba(196, 146, 42, 0.3);
  color: var(--primary);
}

.table td, .table th {
  border-color: var(--border);
}

/* ── Alert / badge overrides ────────────────────────────────────────────────── */
.badge.bg-secondary  { background: var(--surface2) !important; color: var(--muted); }
.alert-info          { background: rgba(196, 146, 42, 0.1); border-color: rgba(196, 146, 42, 0.3); color: var(--light); }

/* ── Focus ring ─────────────────────────────────────────────────────────────── */
a:focus:not(:focus-visible),
button:focus:not(:focus-visible) { outline: none; }

a:focus-visible,
button:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
  border-radius: 3px;
}