:root {
  --yellow: #FFC93C;
  --yellow-dark: #F0AF00;
  --coral: #FF6B6B;
  --coral-dark: #E8514F;
  --blue: #4EA8DE;
  --mint: #06D6A0;
  --cream: #FFF9EC;
  --ink: #2D2A4A;
  --ink-soft: #5B5779;
  --card-radius: 22px;
  --shadow: 0 10px 24px rgba(45, 42, 74, 0.12);
  font-size: 16px;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: 'Nunito', system-ui, sans-serif;
  color: var(--ink);
  background: var(--cream);
  line-height: 1.55;
}

h1, h2, h3, .logo, .btn-random {
  font-family: 'Baloo 2', 'Nunito', system-ui, sans-serif;
}

.wrap {
  max-width: 1080px;
  margin: 0 auto;
  padding: 0 20px;
}

.skip-link {
  position: absolute;
  left: -999px;
  top: 0;
  background: var(--ink);
  color: #fff;
  padding: 10px 16px;
  border-radius: 0 0 10px 0;
  z-index: 1000;
}
.skip-link:focus { left: 0; }

img { max-width: 100%; display: block; }

/* ===== Header ===== */
.site-header {
  background: #fff;
  border-bottom: 4px solid var(--yellow);
  position: sticky;
  top: 0;
  z-index: 50;
}
.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px;
}
.logo {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 800;
  font-size: 1.5rem;
  color: var(--ink);
  text-decoration: none;
}
.logo-emoji { font-size: 1.8rem; }
.site-nav { display: flex; gap: 22px; }
.site-nav a {
  color: var(--ink-soft);
  text-decoration: none;
  font-weight: 700;
}
.site-nav a:hover { color: var(--coral); }

/* ===== Ad slots ===== */
.ad-slot {
  width: 100%;
  display: flex;
  justify-content: center;
  padding: 14px 20px;
}
.ad-slot-inner {
  width: 100%;
  max-width: 970px;
  min-height: 90px;
  background: repeating-linear-gradient(45deg, #f1eee1, #f1eee1 10px, #e9e5d4 10px, #e9e5d4 20px);
  border: 2px dashed #cfc9ac;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}
.ad-label {
  font-size: 0.75rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #9c9679;
  font-weight: 700;
}
.ad-slot--incontent .ad-slot-inner { min-height: 120px; }

/* ===== Hero ===== */
.hero {
  text-align: center;
  padding: 48px 0 40px;
  position: relative;
  overflow: hidden;
}
.hero-decor {
  font-size: 1.6rem;
  letter-spacing: 40px;
  opacity: 0.55;
  margin-bottom: 6px;
}
.hero h1 {
  font-size: clamp(1.8rem, 4.5vw, 2.8rem);
  margin: 0 0 12px;
  color: var(--ink);
}
.subtitle {
  max-width: 620px;
  margin: 0 auto 30px;
  color: var(--ink-soft);
  font-size: 1.1rem;
}

.btn-random {
  font-size: 1.25rem;
  font-weight: 700;
  color: #fff;
  background: linear-gradient(135deg, var(--coral), var(--coral-dark));
  border: none;
  padding: 20px 38px;
  border-radius: 60px;
  cursor: pointer;
  box-shadow: 0 12px 0 var(--coral-dark), 0 16px 24px rgba(232, 81, 79, 0.35);
  transition: transform 0.12s ease;
}
.btn-random:hover { transform: translateY(-3px) scale(1.02); }
.btn-random:active {
  transform: translateY(6px);
  box-shadow: 0 4px 0 var(--coral-dark), 0 8px 16px rgba(232, 81, 79, 0.35);
}

.joke-card {
  margin: 32px auto 0;
  max-width: 620px;
  background: #fff;
  border-radius: var(--card-radius);
  box-shadow: var(--shadow);
  padding: 30px 28px;
  text-align: left;
  border: 3px solid var(--yellow);
}
.joke-card.pop {
  animation: pop-in 0.32s ease;
}
@keyframes pop-in {
  from { opacity: 0; transform: translateY(14px) scale(0.97); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
.joke-card-tag {
  display: inline-block;
  background: var(--yellow);
  color: var(--ink);
  font-weight: 800;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 5px 12px;
  border-radius: 20px;
  margin-bottom: 14px;
}
.joke-text {
  font-size: 1.15rem;
  font-weight: 600;
  white-space: pre-line;
  margin: 0 0 20px;
}
.joke-card-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.btn-secondary {
  font-family: 'Nunito', sans-serif;
  font-weight: 800;
  font-size: 0.95rem;
  color: var(--ink);
  background: #FFF1CE;
  border: 2px solid var(--yellow);
  padding: 10px 18px;
  border-radius: 40px;
  cursor: pointer;
  transition: background 0.15s ease;
}
.btn-secondary:hover { background: var(--yellow); }

.btn-primary {
  font-family: 'Nunito', sans-serif;
  font-weight: 800;
  font-size: 0.95rem;
  color: #fff;
  background: var(--blue);
  border: none;
  padding: 11px 20px;
  border-radius: 40px;
  cursor: pointer;
}
.btn-primary:hover { filter: brightness(1.08); }

/* ===== Categories ===== */
.section-title {
  text-align: center;
  font-size: 1.6rem;
  margin-bottom: 18px;
}
.categories-section { padding: 30px 0 10px; }
.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: center;
}
.chip {
  font-family: 'Nunito', sans-serif;
  font-weight: 800;
  font-size: 0.95rem;
  padding: 10px 20px;
  border-radius: 40px;
  border: 2px solid var(--blue);
  background: #fff;
  color: var(--blue);
  cursor: pointer;
  transition: all 0.15s ease;
}
.chip:hover { background: #EAF5FD; }
.chip.active {
  background: var(--blue);
  color: #fff;
}

/* ===== Joke grid ===== */
.joke-list-section { padding: 30px 0 50px; }
.joke-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 18px;
  margin-top: 10px;
}
.joke-item {
  background: #fff;
  border-radius: 18px;
  padding: 20px;
  box-shadow: var(--shadow);
  border-top: 6px solid var(--mint);
  display: flex;
  flex-direction: column;
  gap: 12px;
  animation: pop-in 0.25s ease;
}
.joke-item:nth-child(4n+2) { border-top-color: var(--coral); }
.joke-item:nth-child(4n+3) { border-top-color: var(--blue); }
.joke-item:nth-child(4n+4) { border-top-color: var(--yellow-dark); }
.joke-item p {
  margin: 0;
  white-space: pre-line;
  font-weight: 600;
  flex: 1;
}
.joke-item-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
}
.joke-item-cat {
  font-size: 0.7rem;
  font-weight: 800;
  text-transform: uppercase;
  color: var(--ink-soft);
  letter-spacing: 0.04em;
}
.icon-btn {
  background: none;
  border: none;
  font-size: 1.1rem;
  cursor: pointer;
  padding: 4px;
  border-radius: 8px;
}
.icon-btn:hover { background: #f0eee0; }

/* ===== Emoji reakcijos (įvertinimas) ===== */
.joke-reactions {
  display: flex;
  align-items: center;
  gap: 4px;
}
.reaction-btn {
  background: none;
  border: 2px solid transparent;
  border-radius: 10px;
  font-size: 1.15rem;
  line-height: 1;
  padding: 4px 6px;
  cursor: pointer;
  transition: transform 0.12s ease, border-color 0.12s ease, background 0.12s ease;
}
.reaction-btn:hover {
  background: #f0eee0;
  transform: scale(1.12);
}
.reaction-btn.selected {
  border-color: var(--blue);
  background: #EAF5FD;
  transform: scale(1.15);
}
.joke-card-reactions {
  margin-top: 4px;
}
.joke-card-reactions .reaction-btn { font-size: 1.4rem; }

.btn-loadmore {
  display: block;
  width: fit-content;
  margin: 30px auto 0;
  text-decoration: none;
}

.no-results {
  text-align: center;
  color: var(--ink-soft);
  margin-top: 30px;
  font-weight: 700;
}

/* ===== Anekdotų sąrašo puslapio antraštė ===== */
.list-page-header {
  text-align: center;
  padding: 40px 0 10px;
}
.list-page-header h1 {
  font-size: clamp(1.6rem, 4vw, 2.2rem);
  margin-bottom: 8px;
}
.list-page-header p {
  color: var(--ink-soft);
  max-width: 620px;
  margin: 0 auto;
}
.breadcrumbs {
  text-align: center;
  font-size: 0.85rem;
  color: var(--ink-soft);
  margin-top: 14px;
}
.breadcrumbs a { color: var(--blue); text-decoration: none; }

/* ===== Puslapiavimas (pagination) ===== */
.pagination {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin: 40px 0 10px;
}
.pagination a, .pagination span.page-num-current {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 42px;
  height: 42px;
  padding: 0 12px;
  border-radius: 12px;
  font-weight: 800;
  text-decoration: none;
  font-size: 0.95rem;
}
.pagination a.page-num {
  background: #fff;
  border: 2px solid #e9e5d4;
  color: var(--ink);
}
.pagination a.page-num:hover { border-color: var(--blue); color: var(--blue); }
.pagination span.page-num-current {
  background: var(--blue);
  color: #fff;
}
.pagination a.page-nav {
  background: #FFF1CE;
  border: 2px solid var(--yellow);
  color: var(--ink);
  padding: 0 18px;
}
.pagination a.page-nav:hover { background: var(--yellow); }

/* ===== About ===== */
.about-section { padding: 10px 0 50px; }
.about-inner {
  max-width: 700px;
  text-align: center;
}
.about-inner p { color: var(--ink-soft); }

/* ===== Footer ===== */
.site-footer {
  background: var(--ink);
  color: #cfc9e6;
  padding: 26px 0;
}
.footer-inner {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  align-items: center;
  justify-content: space-between;
}
.footer-links {
  display: flex;
  gap: 18px;
  flex-wrap: wrap;
}
.footer-links a, .link-btn {
  color: #cfc9e6;
  text-decoration: none;
  font-weight: 700;
  font-size: 0.9rem;
}
.footer-links a:hover, .link-btn:hover { color: #fff; }
.link-btn {
  background: none;
  border: none;
  cursor: pointer;
  font-family: inherit;
  padding: 0;
}

/* ===== Cookie banner ===== */
.cookie-banner {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  z-index: 200;
  background: #fff;
  border-top: 3px solid var(--yellow);
  box-shadow: 0 -8px 24px rgba(0,0,0,0.12);
  animation: slide-up 0.3s ease;
}
@keyframes slide-up {
  from { transform: translateY(100%); }
  to { transform: translateY(0); }
}
.cookie-banner-inner {
  max-width: 1080px;
  margin: 0 auto;
  padding: 18px 20px;
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  align-items: center;
  justify-content: space-between;
}
.cookie-banner-inner p {
  margin: 0;
  flex: 1 1 320px;
  font-size: 0.92rem;
  color: var(--ink-soft);
}
.cookie-banner-inner a { color: var(--blue); }
.cookie-banner-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

/* ===== Cookie settings modal ===== */
.modal {
  position: fixed;
  inset: 0;
  z-index: 300;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.modal-overlay {
  position: absolute;
  inset: 0;
  background: rgba(45, 42, 74, 0.55);
}
.modal-content {
  position: relative;
  background: #fff;
  border-radius: var(--card-radius);
  padding: 30px;
  max-width: 480px;
  width: 100%;
  max-height: 85vh;
  overflow-y: auto;
  box-shadow: var(--shadow);
}
.modal-content h2 { margin-top: 0; }
.modal-desc { color: var(--ink-soft); font-size: 0.92rem; }
.toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 0;
  border-bottom: 1px solid #eee;
}
.toggle-row span { display: flex; flex-direction: column; gap: 3px; }
.toggle-row small { color: var(--ink-soft); font-weight: 400; }
.toggle-row input[type="checkbox"] {
  width: 22px;
  height: 22px;
  flex-shrink: 0;
  accent-color: var(--blue);
}
.modal-actions {
  display: flex;
  gap: 12px;
  margin-top: 22px;
  flex-wrap: wrap;
}

/* ===== Toast ===== */
.toast {
  position: fixed;
  bottom: 100px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--ink);
  color: #fff;
  padding: 12px 20px;
  border-radius: 40px;
  font-weight: 700;
  font-size: 0.9rem;
  z-index: 400;
  animation: pop-in 0.2s ease;
}

/* ===== Legal pages ===== */
.legal-page {
  max-width: 760px;
  margin: 0 auto;
  padding: 40px 20px 70px;
}
.legal-page h1 { margin-bottom: 6px; }
.legal-page h2 { margin-top: 34px; }
.legal-page p, .legal-page li { color: var(--ink-soft); }
.legal-page a { color: var(--blue); }
.back-link {
  display: inline-block;
  margin-bottom: 20px;
  font-weight: 700;
  color: var(--blue);
  text-decoration: none;
}

@media (max-width: 600px) {
  .site-nav { display: none; }
  .btn-random { width: 100%; padding: 18px; }
  .hero-decor { letter-spacing: 20px; }
}
