/* =========================================================
  AtomLab Interaktif - game.css
  ---------------------------------------------------------
  File ini khusus untuk Mode Game:
  - menu pemilihan level
  - kartu level
  - status bar game
  - papan permainan
  - panel atom game
  - area tantangan
  - pilihan jawaban
  - feedback benar/salah
  - hasil akhir
========================================================= */

/* =========================================================
  Game Menu
========================================================= */

.game-menu-content {
  position: relative;
  z-index: 1;
}

.game-menu-content h2 {
  color: var(--text-main);
  font-size: clamp(var(--text-4xl), 6vw, 4.5rem);
}

.game-menu-content .eyebrow {
  color: var(--primary);
}

.game-menu-content .section-description {
  color: var(--text-muted);
}

.level-card {
  min-height: 290px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  padding: var(--space-5);
  border: 1px solid rgba(15, 23, 42, 0.12);
  border-radius: var(--radius-2xl);
  color: var(--text-main);
  background:
    radial-gradient(circle at 30% 20%, rgba(255, 255, 255, 0.72), transparent 36%),
    linear-gradient(135deg, #f5d0fe 0%, #ddd6fe 58%, #bfdbfe 100%);
  box-shadow: var(--shadow-lg);
  text-align: center;
  overflow: hidden;
  position: relative;
  transition:
    transform var(--duration-slow) var(--ease-out),
    box-shadow var(--duration-slow) var(--ease-out),
    filter var(--duration-slow) var(--ease-out);
}

.level-card::before {
  content: "";
  position: absolute;
  width: 170px;
  height: 170px;
  top: -70px;
  right: -70px;
  border-radius: var(--radius-full);
  background: rgba(255, 255, 255, 0.35);
}

.level-card::after {
  content: "";
  position: absolute;
  width: 110px;
  height: 110px;
  left: -45px;
  bottom: -45px;
  border-radius: var(--radius-full);
  background: rgba(37, 99, 235, 0.12);
}

.level-card:hover,
.level-card:focus-visible {
  transform: translateY(-8px) scale(1.01);
  box-shadow: var(--shadow-xl);
  filter: saturate(1.08);
}

.level-card > * {
  position: relative;
  z-index: 1;
}

.level-card strong {
  font-size: var(--text-3xl);
  line-height: var(--leading-tight);
  letter-spacing: -0.04em;
}

.level-card span:not(.level-preview):not(.level-stars) {
  color: var(--color-slate-700);
  font-weight: 800;
}

.level-preview {
  width: 128px;
  height: 128px;
  display: grid;
  place-items: center;
  border-radius: var(--radius-2xl);
  color: var(--text-main);
  background: rgba(255, 255, 255, 0.76);
  border: 1px solid rgba(255, 255, 255, 0.76);
  box-shadow: inset 0 0 0 1px rgba(15, 23, 42, 0.08), var(--shadow-sm);
  font-size: 4rem;
  font-weight: 950;
  line-height: 1;
}

.level-preview-periodic {
  color: var(--accent-orange);
  border: 3px solid var(--text-main);
  border-radius: var(--radius-md);
  background: var(--color-white);
  font-size: 3.25rem;
}

.level-preview-symbol {
  color: var(--primary);
  border: 3px solid var(--text-main);
  border-radius: var(--radius-md);
  background: var(--color-white);
}

.level-stars {
  width: 100%;
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-lg);
  color: var(--color-slate-300);
  background: rgba(255, 255, 255, 0.82);
  font-size: var(--text-xl);
  letter-spacing: 0.08em;
  box-shadow: inset 0 0 0 1px rgba(15, 23, 42, 0.06);
}

.level-stars .is-earned,
.level-stars.is-earned {
  color: var(--warning);
}

/* =========================================================
  Game Play Status Bar
========================================================= */

.game-status-bar {
  position: relative;
  overflow: hidden;
}

.game-status-bar::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 12% 50%, rgba(255, 255, 255, 0.22), transparent 28%),
    radial-gradient(circle at 80% 20%, rgba(250, 204, 21, 0.2), transparent 30%);
  pointer-events: none;
}

.game-status-bar > * {
  position: relative;
  z-index: 1;
}

.game-status-bar strong {
  color: var(--warning-soft);
  font-weight: 950;
}

#gameStartOverButton {
  color: var(--text-main);
  background: rgba(255, 255, 255, 0.88);
  box-shadow: none;
}

#gameStartOverButton:hover {
  background: var(--color-white);
}

/* =========================================================
  Game Board
========================================================= */

.game-board {
  position: relative;
  overflow: hidden;
}

.game-board::before,
.game-board::after {
  content: "";
  position: absolute;
  pointer-events: none;
  border-radius: var(--radius-full);
}

.game-board::before {
  width: 380px;
  height: 380px;
  left: -160px;
  top: -120px;
  background: radial-gradient(circle, rgba(37, 99, 235, 0.12), transparent 68%);
}

.game-board::after {
  width: 320px;
  height: 320px;
  right: -130px;
  bottom: -140px;
  background: radial-gradient(circle, rgba(250, 204, 21, 0.18), transparent 70%);
}

.game-atom-panel,
.game-challenge-panel {
  z-index: 1;
}

.game-atom-panel::after {
  content: "Atom Tantangan";
  position: absolute;
  left: 50%;
  bottom: var(--space-4);
  transform: translateX(-50%);
  padding: 0.45rem 0.8rem;
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-full);
  color: var(--primary);
  background: rgba(255, 255, 255, 0.82);
  font-size: var(--text-xs);
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

#gameAtomCanvas {
  filter: drop-shadow(0 18px 36px rgba(37, 99, 235, 0.14));
}

/* =========================================================
  Challenge Area
========================================================= */

.game-challenge-content {
  width: min(620px, 100%);
  display: grid;
  justify-items: center;
  gap: var(--space-5);
  animation: challengeFadeIn var(--duration-slow) var(--ease-out);
}

@keyframes challengeFadeIn {
  from {
    opacity: 0;
    transform: translateY(8px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.challenge-kicker {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 32px;
  padding: 0.35rem 0.8rem;
  border-radius: var(--radius-full);
  color: var(--primary);
  background: var(--color-blue-50);
  border: 1px solid var(--color-blue-100);
  font-size: var(--text-xs);
  font-weight: 950;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.challenge-title {
  color: var(--text-main);
  font-size: clamp(var(--text-3xl), 5vw, 3.4rem);
  font-weight: 850;
  line-height: var(--leading-tight);
  letter-spacing: -0.05em;
}

.challenge-description {
  max-width: 48ch;
  color: var(--text-muted);
  font-size: var(--text-lg);
  line-height: var(--leading-relaxed);
}

.answer-grid {
  width: 100%;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: var(--space-3);
}

.answer-button {
  min-width: 122px;
  min-height: 58px;
  padding-inline: var(--space-5);
  border-radius: var(--radius-lg);
  color: var(--text-main);
  background: var(--color-white);
  border: 1px solid var(--border-soft);
  box-shadow: var(--shadow-sm);
  font-size: var(--text-2xl);
  font-weight: 950;
  transition:
    transform var(--duration-fast) var(--ease-out),
    box-shadow var(--duration-fast) var(--ease-out),
    background-color var(--duration-fast) var(--ease-out),
    border-color var(--duration-fast) var(--ease-out);
}

.answer-button:hover,
.answer-button:focus-visible {
  transform: translateY(-2px);
  border-color: rgba(37, 99, 235, 0.26);
  background: var(--color-blue-50);
  box-shadow: var(--shadow-md);
}

.answer-button.is-correct {
  color: var(--color-white);
  background: var(--success);
  border-color: var(--success);
}

.answer-button.is-wrong {
  color: var(--color-white);
  background: var(--danger);
  border-color: var(--danger);
}

.number-answer-row {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: var(--space-3);
}

.number-answer-row input {
  width: 130px;
  height: 64px;
  border: 2px solid var(--text-main);
  border-radius: var(--radius-lg);
  background: var(--color-white);
  font-size: var(--text-3xl);
  font-weight: 950;
  text-align: center;
}

.number-answer-row .btn {
  min-height: 64px;
  padding-inline: var(--space-6);
  font-size: var(--text-lg);
}

.game-feedback {
  width: min(520px, 100%);
  min-height: 56px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-4);
  border-radius: var(--radius-lg);
  color: var(--text-muted);
  background: rgba(255, 255, 255, 0.82);
  border: 1px solid var(--border-soft);
  font-size: var(--text-base);
  font-weight: 850;
  line-height: var(--leading-normal);
}

.game-feedback.is-correct {
  color: var(--color-green-700);
  background: var(--success-soft);
  border-color: rgba(22, 163, 74, 0.24);
}

.game-feedback.is-wrong {
  color: var(--color-red-700);
  background: var(--danger-soft);
  border-color: rgba(220, 38, 38, 0.24);
}

.game-feedback.is-finished {
  color: var(--primary);
  background: var(--color-blue-50);
  border-color: rgba(37, 99, 235, 0.2);
}

/* =========================================================
  Game Symbol Card In Challenge
========================================================= */

.challenge-symbol-card {
  width: 230px;
  height: 280px;
  position: relative;
  display: grid;
  place-items: center;
  border: 3px solid var(--text-main);
  border-radius: var(--radius-md);
  background: var(--color-white);
  box-shadow: var(--shadow-md);
}

.challenge-symbol-card strong {
  font-size: 6rem;
  line-height: 1;
  font-weight: 950;
}

.challenge-symbol-card span {
  position: absolute;
  font-size: var(--text-3xl);
  font-weight: 950;
  line-height: 1;
}

.challenge-symbol-card .challenge-mass {
  top: var(--space-4);
  left: var(--space-4);
}

.challenge-symbol-card .challenge-charge {
  top: var(--space-4);
  right: var(--space-4);
  color: var(--accent-orange);
}

.challenge-symbol-card .challenge-atomic {
  left: var(--space-4);
  bottom: var(--space-4);
  color: var(--accent-orange);
}

.challenge-symbol-card .unknown-value {
  color: var(--primary);
  animation: unknownPulse 1.6s ease-in-out infinite;
}

@keyframes unknownPulse {
  0%, 100% {
    opacity: 1;
    transform: scale(1);
  }
  50% {
    opacity: 0.58;
    transform: scale(1.08);
  }
}

/* =========================================================
  Final Result
========================================================= */

.game-result-card {
  width: min(560px, 100%);
  display: grid;
  justify-items: center;
  gap: var(--space-5);
  padding: var(--space-8);
  border-radius: var(--radius-3xl);
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid rgba(255, 255, 255, 0.76);
  box-shadow: var(--shadow-xl);
}

.game-result-icon {
  width: 96px;
  height: 96px;
  display: grid;
  place-items: center;
  border-radius: var(--radius-full);
  color: var(--color-white);
  background: var(--gradient-success);
  font-size: var(--text-5xl);
  box-shadow: var(--shadow-md);
}

.game-result-title {
  color: var(--text-main);
  font-size: clamp(var(--text-3xl), 5vw, var(--text-5xl));
  font-weight: 950;
  letter-spacing: -0.06em;
}

.game-result-score {
  color: var(--primary);
  font-size: clamp(var(--text-4xl), 7vw, 5rem);
  font-weight: 950;
  line-height: 1;
}

.game-result-message {
  color: var(--text-muted);
  font-size: var(--text-lg);
  line-height: var(--leading-relaxed);
}

/* =========================================================
  Game States
========================================================= */

.game-play.is-answer-locked .answer-button,
.game-play.is-answer-locked .number-answer-row input,
.game-play.is-answer-locked .number-answer-row button {
  pointer-events: none;
}

.game-play.is-correct-flash .game-board {
  animation: correctFlash 520ms ease-out;
}

.game-play.is-wrong-flash .game-board {
  animation: wrongFlash 520ms ease-out;
}

@keyframes correctFlash {
  0%, 100% {
    box-shadow: var(--shadow-lg);
  }
  45% {
    box-shadow: 0 0 0 6px rgba(22, 163, 74, 0.18), var(--shadow-xl);
  }
}

@keyframes wrongFlash {
  0%, 100% {
    box-shadow: var(--shadow-lg);
  }
  45% {
    box-shadow: 0 0 0 6px rgba(220, 38, 38, 0.18), var(--shadow-xl);
  }
}

/* =========================================================
  Responsive Game Mode
========================================================= */

@media (max-width: 1120px) {
  .game-atom-panel {
    min-height: 520px;
  }

  .game-challenge-panel {
    min-height: 500px;
  }

  .game-atom-panel::after {
    bottom: var(--space-3);
  }
}

@media (max-width: 900px) {
  .level-card {
    min-height: 250px;
  }

  .level-preview {
    width: 112px;
    height: 112px;
    font-size: 3.5rem;
  }

  .game-status-bar p {
    font-size: var(--text-lg);
  }
}

@media (max-width: 760px) {
  .game-menu {
    padding: var(--space-5) var(--space-3);
  }

  .level-card {
    min-height: 230px;
  }

  .game-board {
    min-height: auto;
  }

  .game-atom-panel,
  .game-challenge-panel {
    min-height: 440px;
  }

  .challenge-title {
    font-size: var(--text-3xl);
  }

  .challenge-description {
    font-size: var(--text-base);
  }

  .answer-button {
    min-width: 104px;
    min-height: 52px;
    font-size: var(--text-xl);
  }

  .number-answer-row input {
    width: 112px;
    height: 58px;
    font-size: var(--text-2xl);
  }

  .number-answer-row .btn {
    min-height: 58px;
  }

  .challenge-symbol-card {
    width: 200px;
    height: 246px;
  }

  .challenge-symbol-card strong {
    font-size: 5.2rem;
  }

  .challenge-symbol-card span {
    font-size: var(--text-2xl);
  }
}

@media (max-width: 520px) {
  .level-preview {
    width: 96px;
    height: 96px;
    font-size: 3rem;
  }

  .level-card strong {
    font-size: var(--text-2xl);
  }

  .level-stars {
    font-size: var(--text-lg);
  }

  .game-atom-panel,
  .game-challenge-panel {
    min-height: 410px;
  }

  .game-challenge-panel {
    padding: var(--space-4);
  }

  .game-challenge-content {
    gap: var(--space-4);
  }

  .answer-grid {
    gap: var(--space-2);
  }

  .answer-button {
    flex: 1 1 44%;
    min-width: 0;
    padding-inline: var(--space-3);
  }

  .number-answer-row {
    width: 100%;
  }

  .number-answer-row input {
    flex: 1;
    min-width: 0;
  }

  .number-answer-row .btn {
    flex: 1;
  }

  .challenge-symbol-card {
    width: 180px;
    height: 225px;
  }

  .challenge-symbol-card strong {
    font-size: 4.7rem;
  }

  .game-result-card {
    padding: var(--space-5);
  }

  .game-result-icon {
    width: 76px;
    height: 76px;
    font-size: var(--text-4xl);
  }
}
