@import url('https://fonts.googleapis.com/css2?family=Baloo+2:wght@400;600;700&family=Nunito:wght@400;700;900&display=swap');

:root {
  --bg-1: #f3fff4;
  --bg-2: #e3f5ff;
  --card: #ffffff;
  --ink: #1f2937;
  --accent: #0ea5e9;
  --accent-2: #22c55e;
  --warn: #f59e0b;
  --bad: #ef4444;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: 'Nunito', sans-serif;
  color: var(--ink);
  background: linear-gradient(130deg, var(--bg-1), var(--bg-2));
  overflow-x: hidden;
  padding-top: 72px;
}

.bg-layer {
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image:
    radial-gradient(circle at 10% 20%, rgba(14, 165, 233, 0.1), transparent 30%),
    radial-gradient(circle at 80% 10%, rgba(34, 197, 94, 0.12), transparent 25%),
    radial-gradient(circle at 50% 80%, rgba(245, 158, 11, 0.1), transparent 30%);
}

.game-wrap {
  position: relative;
  z-index: 1;
}

.top-banner {
  min-height: 72px;
  background: rgba(17, 24, 39, 0.92);
  backdrop-filter: blur(10px);
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.18);
}

.brand-logo {
  width: 42px;
  height: 42px;
  object-fit: contain;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.12);
  padding: 4px;
}

.brand-text {
  font-family: 'Baloo 2', cursive;
  font-weight: 700;
  font-size: 2rem;
  letter-spacing: 0.02em;
  color: #fff;
}

.game-title {
  font-family: 'Baloo 2', cursive;
  font-weight: 700;
  font-size: clamp(1.7rem, 4vw, 2.4rem);
  margin-bottom: 0.1rem;
}

.game-subtitle {
  margin: 0;
  opacity: 0.8;
  font-size: 0.96rem;
}

.section-label {
  display: inline-block;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 0.72rem;
  font-weight: 900;
  color: var(--accent);
  margin-bottom: 0.35rem;
}

.card {
  border: 0;
  border-radius: 1rem;
}

.status-bar {
  background: rgba(255, 255, 255, 0.95);
}

.timer-progress {
  height: 0.72rem;
  border-radius: 999px;
  overflow: hidden;
  background: #e5e7eb;
}

.timer-progress .progress-bar {
  transition: width 180ms linear;
  font-size: 0.65rem;
  line-height: 0.72rem;
}

.level-complete-modal .modal-content {
  border: 0;
  border-radius: 1.5rem;
  overflow: hidden;
}

.level-complete-modal .modal-dialog {
  margin: 0.75rem;
}

.level-complete-modal .modal-body {
  padding-bottom: 1rem;
}

.level-complete-card {
  background: linear-gradient(180deg, #ffffff, #f0f9ff);
  box-shadow: 0 24px 60px rgba(15, 23, 42, 0.18);
  animation: modalRise 260ms ease-out;
}

.level-complete-modal.show .modal-dialog {
  animation: modalScaleIn 260ms ease-out;
}

.level-complete-badge {
  width: 84px;
  height: 84px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: radial-gradient(circle at 30% 30%, #fff7cc, #fde68a);
  color: #92400e;
  font-size: 2rem;
  box-shadow: 0 14px 30px rgba(234, 179, 8, 0.22);
}

@keyframes modalRise {
  from {
    transform: translateY(18px);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

@keyframes modalScaleIn {
  from {
    transform: scale(0.94);
    opacity: 0;
  }
  to {
    transform: scale(1);
    opacity: 1;
  }
}

#levelContent {
  min-height: 260px;
}

.info-panel {
  background: rgba(255, 255, 255, 0.92);
}

.student-profile-card {
  display: grid;
  grid-template-columns: 110px 1fr;
  gap: 1rem;
  align-items: center;
  background: rgba(255, 255, 255, 0.96);
  border-radius: 1.25rem;
  padding: 1rem;
  box-shadow: 0 12px 30px rgba(15, 23, 42, 0.08);
}

.student-photo-wrap {
  width: 110px;
  height: 110px;
  border-radius: 1rem;
  overflow: hidden;
  background: linear-gradient(135deg, #dbeafe, #dcfce7);
  display: flex;
  align-items: center;
  justify-content: center;
}

.student-photo {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.student-meta {
  min-width: 0;
}

.challenge-area {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.75rem;
}

@media (min-width: 768px) {
  .challenge-area {
    grid-template-columns: 1fr 1fr;
  }
}

.item-card {
  background: var(--card);
  border-radius: 1rem;
  padding: 0.75rem;
  text-align: center;
  border: 2px dashed rgba(31, 41, 55, 0.15);
  animation: popIn 280ms ease;
}

.item-card img {
  max-width: 160px;
  max-height: 160px;
  object-fit: contain;
  user-select: none;
  -webkit-user-drag: element;
}

.item-name {
  margin-top: 0.75rem;
  font-weight: 700;
}

.bins-row {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.5rem;
}

@media (min-width: 768px) {
  .bins-row.cols-2 {
    grid-template-columns: repeat(2, 1fr);
  }
  .bins-row.cols-3 {
    grid-template-columns: repeat(3, 1fr);
  }
}

.bin {
  background: linear-gradient(180deg, #ffffff, #f8fbff);
  border: 2px solid rgba(14, 165, 233, 0.35);
  border-radius: 1rem;
  min-height: 132px;
  padding: 0.65rem;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  font-weight: 700;
  transition: transform 120ms ease, background 120ms ease, border-color 120ms ease;
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.08);
}

.bin-visual {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
}

.bin-image {
  width: min(100%, 120px);
  height: 82px;
  object-fit: contain;
  display: block;
  user-select: none;
  pointer-events: none;
}

.bin-label {
  font-size: 0.9rem;
  line-height: 1.2;
}

.bin.over {
  transform: scale(1.02);
  background: #ecfeff;
  border-color: var(--accent);
}

.bin.good {
  border-color: var(--accent-2);
  background: #f0fdf4;
}

.bin.bad {
  border-color: var(--bad);
  background: #fef2f2;
}

.quiz-image-wrap {
  background: #fff;
  border-radius: 1rem;
  padding: 0.75rem;
  text-align: center;
}

.quiz-image-wrap img {
  max-width: 180px;
  max-height: 180px;
  object-fit: contain;
}

.options-grid {
  display: grid;
  gap: 0.75rem;
}

.options-grid button {
  text-align: left;
  border-radius: 0.75rem;
  font-weight: 700;
}

.notice {
  font-weight: 700;
  min-height: 1.6rem;
}

.notice.good {
  color: #166534;
}

.notice.bad {
  color: #991b1b;
}

.typing-box {
  width: 100%;
  min-height: 120px;
  border-radius: 0.75rem;
  border: 2px solid rgba(31, 41, 55, 0.2);
  padding: 0.75rem;
}

.typing-marks {
  display: inline-block;
  margin-left: 0.35rem;
  padding: 0.2rem 0.6rem;
  border-radius: 999px;
  background: #eff6ff;
  color: #1d4ed8;
  font-weight: 800;
}

.final-badge {
  display: inline-block;
  background: #ecfeff;
  color: #0c4a6e;
  padding: 0.25rem 0.75rem;
  border-radius: 999px;
  font-weight: 700;
}

@keyframes popIn {
  from {
    transform: translateY(8px) scale(0.98);
    opacity: 0;
  }
  to {
    transform: translateY(0) scale(1);
    opacity: 1;
  }
}
