/* ===== RESET & BASE ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg: #0f0f1a;
  --bg2: #1a1a2e;
  --card: #16213e;
  --accent: #7c3aed;
  --accent2: #a855f7;
  --text: #e2e8f0;
  --muted: #94a3b8;
  --radius: 16px;
  --shadow: 0 4px 24px rgba(124,58,237,0.15);
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Segoe UI', system-ui, sans-serif;
  min-height: 100vh;
  line-height: 1.6;
}

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

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

.hidden { display: none !important; }

/* ===== HEADER ===== */
.header {
  background: var(--bg2);
  border-bottom: 1px solid rgba(124,58,237,0.3);
  padding: 16px 0;
  position: sticky;
  top: 0;
  z-index: 10;
}

.header .container {
  display: flex;
  align-items: center;
  gap: 16px;
}

.logo {
  font-size: 1.4rem;
  font-weight: 800;
  background: linear-gradient(135deg, var(--accent2), #60a5fa);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.tagline {
  color: var(--muted);
  font-size: 0.9rem;
}

/* ===== HERO ===== */
.hero {
  text-align: center;
  padding: 60px 0 32px;
}

.hero h1 {
  font-size: clamp(2rem, 5vw, 3.2rem);
  font-weight: 900;
  background: linear-gradient(135deg, #fff 30%, var(--accent2));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 12px;
}

.hero p {
  color: var(--muted);
  font-size: 1.1rem;
}

/* ===== SEARCH ===== */
.search-wrap {
  margin-bottom: 16px;
}

.search-box {
  display: flex;
  align-items: center;
  background: var(--card);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 100px;
  padding: 0 18px;
  gap: 10px;
  transition: border-color 0.2s;
  max-width: 500px;
}

.search-box:focus-within {
  border-color: var(--accent2);
  box-shadow: 0 0 0 3px rgba(168,85,247,0.15);
}

.search-icon {
  font-size: 1rem;
  flex-shrink: 0;
  opacity: 0.5;
}

.search-input {
  flex: 1;
  background: none;
  border: none;
  outline: none;
  color: var(--text);
  font-size: 0.95rem;
  padding: 14px 0;
}

.search-input::placeholder { color: var(--muted); }

.search-clear {
  background: none;
  border: none;
  color: var(--muted);
  font-size: 0.9rem;
  cursor: pointer;
  padding: 4px 6px;
  border-radius: 50%;
  transition: background 0.2s, color 0.2s;
  flex-shrink: 0;
}
.search-clear:hover { background: rgba(255,255,255,0.1); color: #fff; }

/* Подсветка совпадений */
mark {
  background: rgba(168,85,247,0.35);
  color: #fff;
  border-radius: 3px;
  padding: 0 2px;
}

/* Пустой результат поиска */
.search-empty {
  grid-column: 1 / -1;
  text-align: center;
  padding: 60px 20px;
}
.search-empty-icon { font-size: 3rem; margin-bottom: 12px; }
.search-empty-text { font-size: 1.1rem; font-weight: 700; color: #fff; margin-bottom: 6px; }
.search-empty-sub { font-size: 0.9rem; color: var(--muted); }

/* ===== FILTERS ===== */
.filters {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 32px;
}

.filter-btn {
  background: var(--card);
  color: var(--muted);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 100px;
  padding: 8px 18px;
  font-size: 0.9rem;
  cursor: pointer;
  transition: all 0.2s;
}

.filter-btn:hover,
.filter-btn.active {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

/* ===== QUIZ CARDS ===== */
.quizzes {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 20px;
  padding-bottom: 60px;
}

.quiz-card {
  background: var(--card);
  border: 1px solid rgba(255,255,255,0.07);
  border-radius: var(--radius);
  padding: 24px;
  cursor: pointer;
  transition: transform 0.2s, box-shadow 0.2s, border-color 0.2s;
  text-decoration: none;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.quiz-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow);
  border-color: rgba(124,58,237,0.5);
}

.quiz-card-icon {
  font-size: 2.8rem;
  line-height: 1;
}

.quiz-card-tag {
  font-size: 0.75rem;
  color: var(--accent2);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 600;
}

.quiz-card h3 {
  font-size: 1.05rem;
  font-weight: 700;
  color: #fff;
}

.quiz-card p {
  font-size: 0.88rem;
  color: var(--muted);
  flex: 1;
}

.quiz-card-meta {
  font-size: 0.8rem;
  color: var(--muted);
  display: flex;
  gap: 12px;
}

.quiz-card .badge-new {
  background: linear-gradient(135deg, #f59e0b, #ef4444);
  color: #fff;
  font-size: 0.7rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 100px;
  align-self: flex-start;
}

/* ===== QUIZ INTRO ===== */
.quiz-intro {
  max-width: 560px;
  margin: 60px auto;
  text-align: center;
}

.quiz-intro-icon { font-size: 5rem; margin-bottom: 20px; }

.quiz-intro h1 {
  font-size: clamp(1.6rem, 4vw, 2.4rem);
  font-weight: 900;
  margin-bottom: 14px;
  color: #fff;
}

.quiz-intro p {
  color: var(--muted);
  font-size: 1rem;
  margin-bottom: 32px;
}

.btn-start {
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  color: #fff;
  border: none;
  border-radius: 100px;
  padding: 16px 40px;
  font-size: 1.1rem;
  font-weight: 700;
  cursor: pointer;
  transition: opacity 0.2s, transform 0.2s;
  box-shadow: 0 4px 20px rgba(124,58,237,0.4);
}

.btn-start:hover { opacity: 0.9; transform: scale(1.03); }

/* ===== QUIZ QUESTION ===== */
.quiz-question {
  max-width: 680px;
  margin: 40px auto;
}

.progress-wrap {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 32px;
}

.progress-bar {
  flex: 1;
  height: 6px;
  background: rgba(255,255,255,0.1);
  border-radius: 100px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), var(--accent2));
  border-radius: 100px;
  transition: width 0.4s ease;
}

.progress-text {
  font-size: 0.85rem;
  color: var(--muted);
  white-space: nowrap;
}

.question-text {
  font-size: clamp(1.2rem, 3vw, 1.6rem);
  font-weight: 700;
  color: #fff;
  margin-bottom: 24px;
  line-height: 1.4;
}

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

.answer-btn {
  background: var(--card);
  border: 2px solid rgba(255,255,255,0.08);
  border-radius: var(--radius);
  padding: 18px 20px;
  color: var(--text);
  font-size: 0.95rem;
  cursor: pointer;
  text-align: left;
  transition: all 0.2s;
  line-height: 1.4;
}

.answer-btn:hover {
  border-color: var(--accent);
  background: rgba(124,58,237,0.15);
  transform: translateY(-2px);
}

.answer-btn.selected {
  border-color: var(--accent2);
  background: rgba(168,85,247,0.2);
}

/* ===== AD INLINE ===== */
.ad-inline { margin: 0 0 28px; }

.ad-placeholder {
  background: rgba(255,255,255,0.03);
  border: 1px dashed rgba(255,255,255,0.1);
  border-radius: 8px;
  padding: 20px;
  text-align: center;
  color: var(--muted);
  font-size: 0.8rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.ad-bottom {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 8px 20px;
  background: var(--bg2);
  border-top: 1px solid rgba(255,255,255,0.06);
}

.ad-bottom .ad-placeholder { padding: 12px; }

/* ===== RESULT ===== */
.quiz-result {
  max-width: 580px;
  margin: 60px auto;
  text-align: center;
}

.result-label {
  font-size: 0.9rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-bottom: 12px;
}

.result-icon {
  font-size: 6rem;
  margin-bottom: 16px;
  animation: popIn 0.5s cubic-bezier(0.34,1.56,0.64,1) both;
}

@keyframes popIn {
  from { transform: scale(0.5); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

.result-name {
  font-size: clamp(1.8rem, 5vw, 2.8rem);
  font-weight: 900;
  color: #fff;
  margin-bottom: 14px;
}

.result-desc {
  color: var(--muted);
  font-size: 1rem;
  margin-bottom: 32px;
  max-width: 440px;
  margin-left: auto;
  margin-right: auto;
}

.result-actions {
  display: flex;
  gap: 12px;
  justify-content: center;
  flex-wrap: wrap;
  margin-bottom: 32px;
}

.btn-share, .btn-retry, .btn-more {
  border-radius: 100px;
  padding: 12px 24px;
  font-size: 0.95rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s;
  border: none;
}

.btn-share {
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  color: #fff;
  box-shadow: 0 4px 16px rgba(124,58,237,0.35);
}
.btn-share:hover { opacity: 0.9; transform: scale(1.03); }

.btn-retry {
  background: var(--card);
  color: var(--text);
  border: 1px solid rgba(255,255,255,0.1);
}
.btn-retry:hover { border-color: var(--accent2); }

.btn-more {
  background: var(--card);
  color: var(--text);
  border: 1px solid rgba(255,255,255,0.1);
  display: inline-flex;
  align-items: center;
}
.btn-more:hover { border-color: var(--accent2); }

.ad-result {
  margin: 28px 0;
}

/* ===== MORE QUIZZES ===== */
.more-quizzes { margin-top: 20px; }
.more-quizzes h3 { font-size: 1.1rem; margin-bottom: 16px; color: var(--muted); }
.more-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.more-grid .quiz-card { padding: 16px; }
.more-grid .quiz-card-icon { font-size: 2rem; }

/* ===== FOOTER ===== */
.footer {
  background: var(--bg2);
  border-top: 1px solid rgba(255,255,255,0.06);
  padding: 24px 0;
  text-align: center;
  color: var(--muted);
  font-size: 0.85rem;
  margin-bottom: 60px;
}
.footer a { color: var(--accent2); }

/* ===== RESPONSIVE ===== */
@media (max-width: 600px) {
  .answers { grid-template-columns: 1fr; }
  .more-grid { grid-template-columns: 1fr; }
  .result-actions { flex-direction: column; align-items: center; }
}
