/* ============================================================
   КлецкКнигоИскатель — assets/css/style.css
   Яркий, чистый, детский адаптивный интерфейс
   ============================================================ */

:root {
  --green: #4CAF50;
  --green-dark: #388E3C;
  --yellow: #FFC107;
  --yellow-soft: #FFF8E1;
  --blue: #2196F3;
  --blue-dark: #1565C0;
  --orange: #FF9800;
  --red: #F44336;
  --text: #333;
  --bg: #F1F8E9;
  --card: #ffffff;
  --shadow: 0 6px 20px rgba(0,0,0,0.10);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

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

a { color: var(--blue-dark); text-decoration: none; }
a:hover { text-decoration: underline; }

.container {
  max-width: 1000px;
  margin: 0 auto;
  padding: 16px;
}

/* ---------- Шапка ---------- */
.header {
  background: linear-gradient(135deg, var(--green), var(--blue));
  color: #fff;
  padding: 16px 0;
  box-shadow: var(--shadow);
}
.header .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 1.3rem;
  font-weight: 700;
  color: #fff;
}
.brand:hover { text-decoration: none; }
.brand-icon { font-size: 1.6rem; }
.nav { display: flex; gap: 8px; flex-wrap: wrap; }
.nav a {
  background: rgba(255,255,255,0.18);
  color: #fff;
  padding: 8px 14px;
  border-radius: 20px;
  font-weight: 600;
  transition: background .2s;
}
.nav a:hover { background: rgba(255,255,255,0.32); text-decoration: none; }
.nav a.active { background: var(--yellow); color: var(--text); }

/* ---------- Карточки ---------- */
.card {
  background: var(--card);
  border-radius: 16px;
  box-shadow: var(--shadow);
  padding: 20px;
  margin-bottom: 20px;
}
.card h2 { margin-bottom: 14px; color: var(--green-dark); }
.card h3 { margin-bottom: 10px; color: var(--blue-dark); }

.hero {
  text-align: center;
  padding: 40px 20px;
  background: linear-gradient(135deg, #fffde7, #e8f5e9);
  border-radius: 20px;
  box-shadow: var(--shadow);
  margin-bottom: 24px;
}
.hero h1 { font-size: 2rem; margin-bottom: 10px; color: var(--green-dark); }
.hero p { font-size: 1.1rem; }

/* ---------- Кнопки ---------- */
.btn {
  display: inline-block;
  background: var(--green);
  color: #fff;
  border: none;
  padding: 12px 22px;
  border-radius: 24px;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  text-align: center;
  transition: transform .1s, box-shadow .2s;
  box-shadow: 0 4px 0 var(--green-dark);
}
.btn:hover { filter: brightness(1.05); text-decoration: none; }
.btn:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--green-dark); }
.btn-green { background: var(--green); box-shadow: 0 4px 0 var(--green-dark); }
.btn-blue { background: var(--blue); box-shadow: 0 4px 0 var(--blue-dark); }
.btn-yellow { background: var(--yellow); color: var(--text); box-shadow: 0 4px 0 #d8a300; }
.btn-orange { background: var(--orange); box-shadow: 0 4px 0 #c67600; }
.btn-red { background: var(--red); box-shadow: 0 4px 0 #b71c1c; }
.btn-block { display: block; width: 100%; }
.btn:disabled { opacity: 0.6; cursor: not-allowed; transform: none; }
.btn-disabled { opacity: 0.7 !important; cursor: default !important; }

/* ---------- Формы ---------- */
input[type=text], input[type=password], input[type=number],
select, textarea, input[type=file] {
  width: 100%;
  padding: 12px 14px;
  margin: 8px 0 16px;
  border: 2px solid #cfd8dc;
  border-radius: 10px;
  font-size: 1rem;
  font-family: inherit;
  background: #fff;
}
input:focus, select:focus, textarea:focus, input[type=file]:focus {
  outline: none;
  border-color: var(--green);
  box-shadow: 0 0 0 3px rgba(76,175,80,0.15);
}

/* ---------- Сообщения ---------- */
.alert {
  padding: 12px 16px;
  border-radius: 10px;
  margin: 12px 0;
  font-weight: 600;
}
.alert-success { background: #E8F5E9; color: var(--green-dark); border: 1px solid #a5d6a7; }
.alert-error   { background: #FFEBEE; color: #c62828;               border: 1px solid #ef9a9a; }
.alert-info    { background: #E3F2FD; color: var(--blue-dark);      border: 1px solid #90caf9; }
.alert-warning { background: #FFF8E1; color: #8d6e00;               border: 1px solid #ffe082; }

/* ---------- Таблицы ---------- */
.table {
  width: 100%;
  border-collapse: collapse;
  margin: 12px 0;
}
.table th, .table td {
  padding: 10px 12px;
  text-align: left;
  border-bottom: 1px solid #eee;
  vertical-align: top;
  font-size: 0.95rem;
}
.table th { background: #f5f5f5; color: #555; }

/* ---------- Сетка книг ---------- */
.book-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 20px;
}
.book-card {
  background: var(--card);
  border-radius: 16px;
  box-shadow: var(--shadow);
  padding: 18px;
  border-top: 6px solid var(--green);
  display: flex;
  flex-direction: column;
  position: relative;
  transition: transform .15s, box-shadow .15s;
}
.book-card.is-completed { border-top-color: #F59E0B; }
.book-pick { cursor: pointer; }
.book-pick.is-completed {
  box-shadow: 0 0 0 3px var(--yellow);
}
.book-check {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 22px;
  height: 22px;
  margin: 0;
  accent-color: var(--green);
  z-index: 2;
  cursor: pointer;
}
.book-pick-badge {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--yellow);
  color: var(--text);
  font-weight: 800;
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 3;
  box-shadow: 0 2px 6px rgba(0,0,0,0.2);
}
.book-pick.is-completed .book-pick-badge { display: flex; }
.book-card h3 { font-size: 1.05rem; margin-bottom: 6px; }
.book-meta { color: #777; font-size: 0.85em; margin-bottom: 8px; }
.book-desc { font-size: 0.92rem; margin-bottom: 12px; flex: 1; }
.book-cover {
  width: 100%;
  height: 160px;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--yellow-soft), #e8f5e9);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 3.5rem;
  margin-bottom: 12px;
}
.book-cover-img {
  width: 100%;
  height: 160px;
  object-fit: cover;
  border-radius: 10px;
  margin-bottom: 12px;
  background: linear-gradient(135deg, var(--yellow-soft), #e8f5e9);
}
.book-cover-sm {
  width: 56px;
  height: 80px;
  object-fit: cover;
  border-radius: 8px;
  background: linear-gradient(135deg, var(--yellow-soft), #e8f5e9);
  flex-shrink: 0;
}
.badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 12px;
  font-size: 0.75rem;
  font-weight: 700;
}
.badge-available { background: #E8F5E9; color: var(--green-dark); }
.badge-reserved  { background: #FFE0B2; color: #c67600; }

/* ---------- Викторина ---------- */
.quiz-box { text-align: center; max-width: 640px; margin: 0 auto; }
.quiz-question { font-size: 1.3rem; margin-bottom: 20px; color: var(--blue-dark); }
.quiz-options { display: flex; flex-direction: column; gap: 12px; }
.quiz-option {
  background: #fff;
  border: 3px solid #e0e0e0;
  border-radius: 14px;
  padding: 16px;
  font-size: 1.05rem;
  font-weight: 600;
  cursor: pointer;
  transition: all .15s;
  text-align: left;
}
.quiz-option:hover { border-color: var(--green); background: #f1f8e9; }
.quiz-option.correct { border-color: var(--green); background: #E8F5E9; }
.quiz-option.wrong   { border-color: var(--red); background: #FFEBEE; }
.quiz-progress { color: #888; margin-bottom: 12px; font-weight: 600; }
.quiz-points { font-size: 1rem; color: var(--orange); font-weight: 700; }

/* ---------- Профиль / Паспорт ---------- */
.passport {
  max-width: 560px;
  margin: 0 auto;
  border: 3px solid var(--blue);
  border-radius: 20px;
  overflow: hidden;
}
.passport-head {
  background: var(--blue);
  color: #fff;
  padding: 18px;
  text-align: center;
}
.passport-body { padding: 20px; background: #fff; }
.passport-row {
  display: flex;
  justify-content: space-between;
  padding: 10px 0;
  border-bottom: 1px dashed #ddd;
  font-size: 1.05rem;
}
.passport-row strong { color: var(--blue-dark); }
.level-badge {
  display: inline-block;
  background: linear-gradient(135deg, var(--yellow), var(--orange));
  color: #fff;
  padding: 4px 14px;
  border-radius: 16px;
  font-weight: 700;
}

/* ---------- Кошелёк очков ---------- */
.coin-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--yellow-soft);
  color: var(--orange);
  border: 2px solid var(--yellow);
  padding: 4px 14px;
  border-radius: 20px;
  font-weight: 800;
}

/* ---------- Анимации ---------- */
@keyframes pop {
  0% { transform: scale(0.6); opacity: 0; }
  60% { transform: scale(1.1); }
  100% { transform: scale(1); opacity: 1; }
}
.pop { animation: pop .4s ease; }

@keyframes confetti-fall {
  0% { transform: translateY(-100px) rotate(0); opacity: 1; }
  100% { transform: translateY(600px) rotate(720deg); opacity: 0; }
}
.confetti-piece {
  position: fixed;
  top: 0;
  width: 10px;
  height: 14px;
  pointer-events: none;
  z-index: 9999;
  animation: confetti-fall 2.5s ease-in forwards;
}

/* ---------- Таблица лидеров ---------- */
.ranking-top3 {
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 16px;
  margin-bottom: 24px;
  padding: 20px 0;
  background: linear-gradient(180deg, #fff8e1, #e8f5e9);
  border-radius: 14px;
}
.podium { text-align: center; flex: 1; min-width: 90px; }
.podium-medal { font-size: 2rem; margin-bottom: 6px; }
.podium-avatar {
  width: 56px;
  height: 56px;
  margin: 0 auto 8px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--blue), var(--green));
  color: #fff;
  font-size: 1.6rem;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow);
}
.podium-name { font-weight: 700; font-size: 0.95rem; }
.podium-points { color: var(--orange); font-weight: 800; }
.place-0 .podium-avatar { width: 72px; height: 72px; font-size: 2rem; background: linear-gradient(135deg, #FFD700, #FF8F00); }
.place-1 .podium-avatar { width: 62px; height: 62px; font-size: 1.8rem; background: linear-gradient(135deg, #B0BEC5, #78909C); }
.place-2 .podium-avatar { width: 54px; height: 54px; font-size: 1.5rem; background: linear-gradient(135deg, #D7A26A, #A16E34); }

.me-row {
  background: #FFFDD0;
  border-left: 4px solid var(--yellow);
  font-weight: 600;
}

/* ---------- Нижний колонтитул ---------- */
.footer {
  text-align: center;
  padding: 20px;
  color: #888;
  font-size: 0.9rem;
}

/* ---------- Адаптация под телефоны ---------- */
@media (max-width: 600px) {
  .hero h1 { font-size: 1.6rem; }
  .brand { font-size: 1.1rem; }
  .table th, .table td { padding: 8px; font-size: 0.85rem; }
  .btn { width: 100%; }
  .quiz-question { font-size: 1.1rem; }
}
