:root {
  --ink: #211c18;
  --paper: #fffaf0;
  --card: #ffffff;
  --orange: #ff6b35;
  --yellow: #ffd166;
  --green: #2a9d8f;
  --purple: #7357d9;
  --muted: #6e655f;
  --line: #e8ded2;
  --shadow: 0 18px 45px rgba(61, 42, 25, .1);
  --font-base: Arial, Helvetica, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html,
body,
button,
input,
textarea,
select {
  font-family: var(--font-base);
}
body {
  margin: 0;
  color: var(--ink);
  background: var(--paper);
  line-height: 1.6;
}
a { color: inherit; }
.site-header {
  position: relative;
  z-index: 20;
  max-width: 1180px;
  margin: auto;
  padding: 22px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}
.brand { font-weight: 900; font-size: 1.4rem; text-decoration: none; letter-spacing: -.04em; }
.brand span {
  display: inline-grid;
  place-items: center;
  width: 36px;
  height: 36px;
  margin-right: 8px;
  border: 2px solid var(--ink);
  border-radius: 50% 45% 48% 42%;
  background: var(--yellow);
  transform: rotate(-7deg);
}
nav { display: flex; flex-wrap: wrap; gap: 18px; }
nav a { color: var(--muted); font-weight: 700; text-decoration: none; }
nav a:hover { color: var(--orange); }
.menu-toggle { display: none; }
.container { width: min(1120px, calc(100% - 32px)); margin: 30px auto 80px; }
.slider {
  position: relative;
  overflow: hidden;
  border: 2px solid var(--ink);
  border-radius: 38px 22px 44px 25px;
  background: var(--ink);
}
.slider-track { position: relative; aspect-ratio: 16 / 6; min-height: 220px; }
.slide {
  position: absolute;
  inset: 0;
  opacity: 0;
  visibility: hidden;
  transition: opacity .55s ease, visibility .55s ease;
}
.slide.active { opacity: 1; visibility: visible; z-index: 1; }
.slide a { display: block; width: 100%; height: 100%; }
.slide img { display: block; width: 100%; height: 100%; object-fit: cover; }
.slider-arrow {
  position: absolute;
  z-index: 3;
  top: 50%;
  width: 48px;
  height: 48px;
  padding: 0;
  border: 2px solid white;
  border-radius: 50%;
  background: rgba(33, 28, 24, .72);
  font-size: 2rem;
  line-height: 1;
  transform: translateY(-50%);
}
.slider-arrow.previous { left: 18px; }
.slider-arrow.next { right: 18px; }
.slider-dots {
  position: absolute;
  z-index: 3;
  left: 50%;
  bottom: 16px;
  display: flex;
  gap: 8px;
  transform: translateX(-50%);
}
.slider-dots button {
  width: 11px;
  height: 11px;
  padding: 0;
  border: 2px solid white;
  border-radius: 50%;
  background: rgba(33, 28, 24, .55);
}
.slider-dots button.active { width: 28px; border-radius: 999px; background: var(--yellow); }
.promo-buttons {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 14px;
  margin: 36px 0 28px;
}
.promo-button {
  min-width: 180px;
  padding: 14px 24px;
  color: var(--button-text);
  border: 2px solid var(--ink);
  border-radius: 14px;
  background: var(--blink-one);
  box-shadow: 4px 4px 0 var(--ink);
  font-size: 1.05rem;
  font-weight: 900;
  line-height: 1.25;
  text-align: center;
  text-decoration: none;
  transition: transform .15s ease, box-shadow .15s ease;
}
.promo-button:hover {
  color: var(--button-text);
  background: var(--blink-two);
  box-shadow: 2px 2px 0 var(--ink);
  transform: translate(2px, 2px);
}
.promo-button.blinking { animation: button-blink 1.2s ease-in-out infinite alternate; }
@keyframes button-blink {
  from { background-color: var(--blink-one); }
  to { background-color: var(--blink-two); }
}
.button-preview {
  display: inline-block;
  padding: 8px 12px;
  border: 1px solid var(--ink);
  border-radius: 8px;
  font-weight: 800;
}
.color-fields { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; }
.color-fields input[type="color"] { min-height: 50px; padding: 5px; cursor: pointer; }
.slide-thumbnail {
  display: block;
  width: 120px;
  height: 58px;
  border-radius: 8px;
  object-fit: cover;
}
.slide-edit-preview {
  display: block;
  width: min(100%, 680px);
  max-height: 280px;
  margin-bottom: 24px;
  border-radius: 14px;
  object-fit: cover;
}
.hero-burst {
  display: grid;
  place-items: center;
  width: 190px;
  height: 190px;
  color: white;
  background: var(--purple);
  border: 3px solid var(--ink);
  border-radius: 52% 48% 43% 57%;
  font: 900 3.4rem/1 var(--font-base);
  transform: rotate(9deg);
}
.eyebrow { color: var(--orange); font-weight: 900; letter-spacing: .12em; text-transform: uppercase; font-size: .78rem; }
.filters { margin: 42px 0 24px; gap: 10px; }
.filters a { padding: 8px 15px; border: 1px solid var(--line); border-radius: 999px; background: white; }
.filters a.active { color: white; background: var(--ink); border-color: var(--ink); }
.joke-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 22px; }
.joke-card, .content-card, .auth-card, .redirect-card, .panel {
  padding: 28px;
  border: 1px solid var(--line);
  border-radius: 22px;
  background: var(--card);
  box-shadow: var(--shadow);
}
.joke-card:nth-child(3n+2) { transform: rotate(.6deg); }
.joke-card:nth-child(3n+3) { transform: rotate(-.5deg); }
.joke-card h2 { margin: 12px 0; line-height: 1.15; }
.joke-card p { font-size: 1.08rem; }
.category { color: var(--green); font-size: .72rem; font-weight: 900; letter-spacing: .09em; text-transform: uppercase; }
button, .button {
  display: inline-flex;
  justify-content: center;
  align-items: center;
  padding: 11px 17px;
  color: white;
  border: 0;
  border-radius: 11px;
  background: var(--ink);
  font: inherit;
  font-weight: 800;
  text-decoration: none;
  cursor: pointer;
}
button:hover, .button:hover { background: var(--orange); }
.share-button { margin-top: 12px; background: var(--purple); }
.single-joke, .content-card, .auth-card, .redirect-card { max-width: 760px; margin: 80px auto; }
.single-joke h1, .content-card h1, .auth-card h1, .redirect-card h1 { font-size: clamp(2.2rem, 5vw, 4rem); line-height: 1; letter-spacing: -.05em; }
.single-joke p { font-size: 1.35rem; }
.legal h2 { margin-top: 32px; }
.destination { padding: 12px; border-radius: 10px; background: #f4efe8; font-family: monospace; overflow-wrap: anywhere; }
.countdown { font-size: 1.15rem; }
.countdown strong { color: var(--orange); font-size: 1.5rem; }
.text-link { display: block; margin-top: 18px; color: var(--muted); }
label { display: grid; gap: 7px; margin: 17px 0; font-weight: 800; }
input, textarea, select {
  width: 100%;
  padding: 12px 13px;
  color: var(--ink);
  border: 1px solid #cfc4b8;
  border-radius: 10px;
  background: white;
  font: inherit;
}
textarea { min-height: 160px; resize: vertical; }
.alert { padding: 12px 15px; margin: 16px 0; border-radius: 10px; font-weight: 700; }
.alert.error { color: #842323; background: #ffe4e4; }
.alert.success { color: #176045; background: #dff7eb; }
.empty { padding: 50px; grid-column: 1 / -1; text-align: center; }
.admin-title { display: flex; align-items: end; justify-content: space-between; gap: 20px; margin-bottom: 25px; }
.admin-title h1 { margin: 0; font-size: 2.5rem; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 18px; margin-bottom: 28px; }
.stat strong { display: block; font-size: 2.4rem; line-height: 1; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; background: white; }
th, td { padding: 13px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: middle; }
th { color: var(--muted); font-size: .77rem; text-transform: uppercase; letter-spacing: .05em; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; }
.actions form { margin: 0; }
.actions button, .small { padding: 7px 10px; font-size: .84rem; }
.danger { background: #a63131; }
.status { display: inline-block; padding: 4px 9px; border-radius: 99px; background: #eee; font-size: .75rem; font-weight: 800; }
.status.on { color: #116342; background: #d9f5e8; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.hint { color: var(--muted); font-size: .9rem; }
footer { padding: 35px 20px; color: var(--muted); border-top: 1px solid var(--line); text-align: center; }
footer p { margin: 5px; }
footer a { margin: 0 7px; }
@media (max-width: 800px) {
  .site-header {
    min-height: 56px;
    padding: 9px 12px;
    align-items: center;
    flex-direction: row;
    gap: 10px;
  }
  .brand { font-size: 1.15rem; }
  .brand span { width: 32px; height: 32px; margin-right: 6px; }
  .menu-toggle {
    display: grid;
    width: 40px;
    height: 40px;
    margin-left: auto;
    padding: 9px;
    place-content: center;
    gap: 5px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: white;
    box-shadow: 0 5px 16px rgba(61, 42, 25, .08);
  }
  .menu-toggle:hover { background: white; }
  .menu-toggle span {
    display: block;
    width: 20px;
    height: 2px;
    border-radius: 99px;
    background: var(--ink);
    transition: transform .22s ease, opacity .18s ease;
  }
  .menu-toggle[aria-expanded="true"] span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
  .menu-toggle[aria-expanded="true"] span:nth-child(2) { opacity: 0; }
  .menu-toggle[aria-expanded="true"] span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }
  .site-header nav {
    position: absolute;
    top: calc(100% + 2px);
    right: 10px;
    left: 10px;
    display: grid;
    gap: 4px;
    max-height: calc(100vh - 72px);
    padding: 8px;
    overflow-y: auto;
    visibility: hidden;
    opacity: 0;
    border: 1px solid var(--line);
    border-radius: 16px;
    background: rgba(255, 255, 255, .98);
    box-shadow: 0 18px 45px rgba(61, 42, 25, .16);
    transform: translateY(-8px) scale(.98);
    transform-origin: top right;
    transition: opacity .2s ease, transform .2s ease, visibility .2s;
  }
  .site-header nav.open {
    visibility: visible;
    opacity: 1;
    transform: translateY(0) scale(1);
  }
  .site-header nav a {
    padding: 9px 11px;
    border-radius: 10px;
    color: var(--ink);
    font-size: .95rem;
  }
  .site-header nav a:hover { color: var(--ink); background: var(--paper); }
  .container { width: min(100% - 20px, 1120px); margin: 10px auto 45px; }
  .slider-track { aspect-ratio: 16 / 9; min-height: 180px; }
  .slider { border-radius: 18px; }
  .slider-arrow { width: 40px; height: 40px; }
  .slider-arrow.previous { left: 10px; }
  .slider-arrow.next { right: 10px; }
  .joke-grid, .stats { grid-template-columns: 1fr; }
  .promo-buttons { align-items: stretch; flex-direction: column; gap: 9px; margin: 18px 0; }
  .promo-button { width: 100%; padding: 11px 16px; }
  .filters { margin: 18px 0 14px; gap: 7px; }
  .filters a { padding: 6px 11px; font-size: .88rem; }
  .joke-grid { gap: 14px; }
  .joke-card, .content-card, .auth-card, .redirect-card, .panel { padding: 18px; border-radius: 16px; }
  .single-joke, .content-card, .auth-card, .redirect-card { margin: 24px auto; }
  .admin-title { margin-bottom: 16px; gap: 10px; }
  .admin-title h1 { font-size: 2rem; }
  .stats { gap: 12px; margin-bottom: 18px; }
  label { margin: 12px 0; }
  footer { padding: 22px 12px; }
  .color-fields { grid-template-columns: 1fr; gap: 0; }
  .form-row { grid-template-columns: 1fr; gap: 0; }
  .admin-title { align-items: flex-start; flex-direction: column; }
}
@media (prefers-reduced-motion: reduce) {
  .promo-button.blinking { animation: none; }
  .slide { transition: none; }
  .menu-toggle span, .site-header nav { transition: none; }
}
