/* Reset and Global Styling */
* {
  margin: 0;
  padding: 0;
  font-family: "Poppins", sans-serif;
  box-sizing: border-box;
}

/* Theme variables */
:root {
  --bg: #0f172a; /* slate-900 */
  --surface: #111827; /* gray-900 */
  --surface-2: #1f2937; /* gray-800 */
  --text: #e5e7eb; /* gray-200 */
  --muted: #9ca3af; /* gray-400 */
  --accent-1: #06b6d4; /* cyan-500 */
  --accent-2: #6366f1; /* indigo-500 */
  --success: #22c55e; /* green-500 */
  --danger: #ef4444; /* red-500 */
  --warning: #f59e0b; /* amber-500 */
  --shadow: rgba(99, 102, 241, 0.35); /* indigo-500 shadow */
}

/* Body Styling */
body {
  background-color: var(--bg);
  color: var(--text);
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
  text-align: center;
  padding: 20px;
}

/* Heading */
h1 {
  margin: 20px 0;
  font-size: 2.2rem;
  color: var(--accent-1);
}
.subtitle {
  color: var(--muted);
  margin-top: 6px;
}
.hero {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}
.searchwrap {
  width: 100%;
  max-width: 720px;
}
.searchbar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border-radius: 12px;
  background: var(--surface);
  border: 1px solid rgba(255, 255, 255, 0.08);
}
.searchbar i {
  color: var(--muted);
}
.search {
  width: 100%;
  background: transparent;
  color: var(--text);
  padding: 6px 6px;
  border-radius: 8px;
  border: none;
  outline: none;
}
.search::placeholder {
  color: var(--muted);
}
/* Chips */
.chiplist {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: center;
  margin-top: 8px;
}
.chip {
  background: var(--surface);
  color: var(--text);
  border: 1px solid rgba(255, 255, 255, 0.08);
  padding: 8px 12px;
  border-radius: 999px;
  cursor: pointer;
  transition: background 0.2s ease, color 0.2s ease, transform 0.2s;
}
.chip:hover {
  transform: translateY(-1px);
}
.chip.is-active {
  background: linear-gradient(135deg, var(--accent-2), var(--accent-1));
  color: #fff;
  border-color: transparent;
}
.timer {
  padding: 10px;
  font-size: 1.1rem;
  margin-bottom: 10px;
  font-weight: bold;
  color: var(--warning);
  text-align: right;
  border-radius: 20px;
}

/* Quiz Counter */
.counter {
  color: var(--muted);
  font-size: 0.95rem;
  margin-bottom: 10px;
}

/* ========== Home Page Styling ========== */
.containerhome {
  display: grid;
  grid-template-columns: repeat(5, minmax(140px, 1fr));
  gap: 24px;
  width: 100%;
  max-width: 1080px;
  padding: 20px;
  transition: all ease 1s;
}

.box1 {
  background-color: var(--surface);
  border-radius: 18px;
  padding: 20px 16px;
  text-align: center;
  cursor: pointer;
  transition: transform 0.25s ease, background-color 0.25s, box-shadow 0.25s;
  box-shadow: 0 4px 8px var(--shadow);
  position: relative;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.06);
  backdrop-filter: saturate(150%) blur(8px);
}

.box1:hover {
  transform: scale(1.1);
  background-color: var(--accent-1);
  box-shadow: 0 4px 12px var(--shadow);
}
/* sheen */
.box1::after {
  content: "";
  position: absolute;
  top: 0;
  left: -150%;
  width: 50%;
  height: 100%;
  background: linear-gradient(
    120deg,
    rgba(255, 255, 255, 0.06),
    rgba(255, 255, 255, 0)
  );
  transform: skewX(-20deg);
  transition: left 0.6s ease;
}
.box1:hover::after {
  left: 150%;
}

.box1 img {
  width: 84px;
  height: 84px;
  border-radius: 14px;
}

.box1 h3 {
  display: none;
}

.box1 h4 {
  color: var(--accent-2);
  margin-top: 10px;
  font-size: 1.25rem;
}

.start-btn {
  margin-top: 10px;
  padding: 8px 12px;
  border-radius: 10px;
  border: none;
  color: #fff;
  background: linear-gradient(135deg, var(--accent-2), var(--accent-1));
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  box-shadow: 0 4px 8px var(--shadow);
}
.start-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 16px var(--shadow);
}

a {
  text-decoration: none;
  color: inherit;
}

/* Responsive Design */
@media (max-width: 1024px) {
  .containerhome {
    grid-template-columns: repeat(4, minmax(140px, 1fr));
  }
}
@media (max-width: 768px) {
  .containerhome {
    grid-template-columns: repeat(3, minmax(120px, 1fr));
  }
}
@media (max-width: 560px) {
  .containerhome {
    grid-template-columns: repeat(2, minmax(120px, 1fr));
  }
}

@media (max-width: 480px) {
  h1 {
    font-size: 1.7rem;
  }
  .box1 img {
    width: 80px;
    height: 80px;
  }
}

/* Quiz progress bar */
.progress {
  width: 100%;
  height: 8px;
  background: var(--surface-2);
  border-radius: 8px;
  overflow: hidden;
  margin: 10px 0 20px;
}

.progress__bar {
  width: 0%;
  height: 100%;
  background: linear-gradient(90deg, var(--accent-2), var(--accent-1));
  transition: width 0.3s ease;
}

/* Confetti animation */
.confetti {
  position: fixed;
  top: -10px;
  width: 8px;
  height: 12px;
  border-radius: 2px;
  animation: confetti-drop 1.2s cubic-bezier(0.2, 0.8, 0.2, 1);
  pointer-events: none;
  z-index: 9999;
}

/* Answer button accessibility states */
.answer-btn {
  outline: none;
}
.answer-btn:focus-visible {
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.5);
}
.answer-btn:disabled {
  opacity: 0.7;
  cursor: not-allowed;
}

@keyframes confetti-drop {
  0% {
    transform: translateY(0) rotate(0deg);
    opacity: 1;
  }
  100% {
    transform: translateY(100vh) rotate(360deg);
    opacity: 0;
  }
}

/* Toast notifications */
.toast {
  position: fixed;
  top: 16px;
  left: 50%;
  transform: translateX(-50%);
  padding: 10px 14px;
  border-radius: 10px;
  color: #fff;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.25);
  z-index: 10000;
  background: var(--surface-2);
  border: 1px solid rgba(255, 255, 255, 0.08);
}
.toast--success {
  background: linear-gradient(135deg, var(--success), #16a34a);
}
.toast--error {
  background: linear-gradient(135deg, var(--danger), #b91c1c);
}

/* Incorrect shake animation */
.answer-btn.shake {
  animation: shake 350ms ease-in-out;
}
@keyframes shake {
  0%,
  100% {
    transform: translateX(0);
  }
  20% {
    transform: translateX(-6px);
  }
  40% {
    transform: translateX(6px);
  }
  60% {
    transform: translateX(-4px);
  }
  80% {
    transform: translateX(4px);
  }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
  * {
    animation: none !important;
    transition: none !important;
  }
}
