* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
}

body {
  background: #040b16;
  color: #ffffff;
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
  padding: 16px;
}

/* Samsung Tab / iPad Frame */
.tablet-bezel {
  background: #1c222d;
  border: 4px solid #374151;
  border-radius: 32px;
  padding: 18px 22px;
  width: 100%;
  max-width: 960px;
  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.75);
  position: relative;
}

.tablet-camera {
  width: 10px;
  height: 10px;
  background: #0f172a;
  border: 2px solid #475569;
  border-radius: 50%;
  margin: 0 auto 10px auto;
}

/* Dark Blue Screen */
.tablet-screen {
  background: #0a192f;
  color: #ffffff;
  border-radius: 20px;
  min-height: 620px;
  padding: 18px;
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

/* Top Bar */
.top-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  padding-bottom: 12px;
  border-bottom: 1px solid #1e3a5f;
}

.player-badge {
  display: flex;
  align-items: center;
  gap: 10px;
}

.level-pill {
  background: #1d4ed8;
  color: #ffffff;
  padding: 6px 14px;
  border-radius: 999px;
  font-weight: 700;
  font-size: 0.9rem;
}

#playerNameInput {
  background: #112240;
  border: 1px solid #233554;
  color: #ffffff;
  padding: 6px 10px;
  border-radius: 8px;
  font-weight: 600;
  width: 130px;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

/* Golden Coin Wallet */
.coin-wallet {
  background: linear-gradient(135deg, #1e293b, #0f172a);
  border: 2px solid #ffd700;
  color: #ffd700;
  padding: 6px 16px;
  border-radius: 999px;
  font-weight: 800;
  font-size: 1.1rem;
  display: flex;
  align-items: center;
  gap: 6px;
  box-shadow: 0 0 12px rgba(255, 215, 0, 0.3);
}

.btn-db {
  background: #112240;
  color: #38bdf8;
  border: 1px solid #38bdf8;
  padding: 7px 12px;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 600;
}

/* Level Tabs */
.level-tabs {
  display: flex;
  gap: 6px;
  margin: 12px 0;
  overflow-x: auto;
}

.level-tabs .tab {
  background: #112240;
  color: #cbd5e1;
  border: 1px solid #233554;
  padding: 6px 12px;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 600;
  font-size: 0.85rem;
}

.level-tabs .tab.active {
  background: #2563eb;
  color: #ffffff;
  border-color: #60a5fa;
}

/* Math Question Grid (2 Columns) */
.category-bar {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
}

.cat-btn {
  background: #112240;
  color: #ffffff;
  border: 1px solid #3b82f6;
  padding: 5px 12px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.85rem;
}

.cat-btn.active {
  background: #3b82f6;
}

.questions-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  overflow-y: auto;
  max-height: 440px;
  padding-right: 4px;
}

@media (max-width: 640px) {
  .questions-grid {
    grid-template-columns: 1fr;
  }
}

.question-card {
  background: #112240;
  border: 1px solid #233554;
  border-radius: 12px;
  padding: 12px;
  transition: transform 0.2s, border-color 0.2s;
}

.question-card.solved {
  border-color: #22c55e;
  background: #0f292e;
}

.question-card.shake {
  animation: shakeCard 0.35s ease;
  border-color: #ef4444;
}

@keyframes shakeCard {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-6px); }
  75% { transform: translateX(6px); }
}

.q-number {
  font-size: 0.8rem;
  font-weight: 700;
  color: #ffd700;
  margin-bottom: 6px;
  display: flex;
  justify-content: space-between;
}

.q-body {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.q-text {
  font-size: 1.05rem;
  font-weight: 700;
  color: #ffffff;
}

.q-controls {
  display: flex;
  gap: 6px;
}

.answer-input {
  width: 72px;
  padding: 6px 8px;
  border-radius: 6px;
  border: 1px solid #3b82f6;
  background: #0a192f;
  color: #ffffff;
  font-size: 1rem;
  font-weight: 700;
  text-align: center;
}

/* Green Answer Button with White Text */
.btn-answer, .btn-green {
  background: #16a34a;
  color: #ffffff;
  border: none;
  padding: 6px 14px;
  border-radius: 6px;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.2s;
}

.btn-answer:hover, .btn-green:hover {
  background: #15803d;
}

.btn-answer:disabled {
  background: #1e3a2f;
  color: #86efac;
  cursor: default;
}

/* Flying Golden Coin Animation */
.flying-coin {
  position: fixed;
  font-size: 1.4rem;
  z-index: 9999;
  pointer-events: none;
  transition: transform 0.75s cubic-bezier(0.22, 1, 0.36, 1), opacity 0.75s ease;
}

/* Mini-Games Styling (Balloons, Darts, River) */
.game-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: #112240;
  padding: 10px 14px;
  border-radius: 10px;
  margin-bottom: 12px;
}

.balloon-arena {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 16px;
  padding: 20px;
  background: #0d213f;
  border-radius: 14px;
  min-height: 360px;
  align-items: center;
}

.balloon {
  width: 68px;
  height: 82px;
  border-radius: 50% 50% 50% 50% / 45% 45% 55% 55%;
  display: flex;
  justify-content: center;
  align-items: center;
  font-size: 1.3rem;
  font-weight: 800;
  color: #ffffff;
  cursor: crosshair;
  box-shadow: inset -6px -6px 12px rgba(0, 0, 0, 0.3);
  transition: transform 0.2s;
  user-select: none;
}

.balloon:hover {
  transform: scale(1.08);
}

.balloon.popped {
  visibility: hidden;
}

/* Dartboard */
.dart-arena {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.dart-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 10px;
  width: 100%;
  max-width: 520px;
}

.dart-ring {
  aspect-ratio: 1;
  border-radius: 50%;
  background: radial-gradient(circle, #ef4444 30%, #ffffff 32%, #ffffff 55%, #1d4ed8 57%);
  color: #0a192f;
  font-weight: 900;
  font-size: 1.1rem;
  display: flex;
  justify-content: center;
  align-items: center;
  cursor: crosshair;
  border: 3px solid #ffd700;
  transition: transform 0.15s;
}

.dart-ring:hover {
  transform: scale(1.07);
}

/* River Crossing */
.river-arena {
  position: relative;
  background: linear-gradient(180deg, #0284c7, #0369a1);
  border-radius: 14px;
  height: 360px;
  padding: 16px;
  overflow: hidden;
}

.stone {
  position: absolute;
  width: 52px;
  height: 44px;
  background: #64748b;
  border: 3px solid #cbd5e1;
  border-radius: 45%;
  color: #ffffff;
  font-weight: 800;
  display: flex;
  justify-content: center;
  align-items: center;
  cursor: pointer;
}

.stone.visited {
  background: #16a34a;
  border-color: #ffd700;
}

.big-fish {
  position: absolute;
  font-size: 2.4rem;
  top: 45%;
  left: 0;
  pointer-events: auto;
  cursor: pointer;
  animation: swimFish 6s linear infinite alternate;
}

@keyframes swimFish {
  from { left: 5%; transform: scaleX(1); }
  to { left: 82%; transform: scaleX(-1); }
}

/* Modals & 3D Trophy */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(2, 6, 23, 0.85);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 1000;
}

.hidden {
  display: none !important;
}

.celebration-card, .settings-card {
  background: #112240;
  border: 2px solid #ffd700;
  border-radius: 20px;
  padding: 24px;
  max-width: 440px;
  width: 92%;
  text-align: center;
  color: #ffffff;
}

.trophy-3d {
  font-size: 5rem;
  display: inline-block;
  animation: spinTrophy 3s ease-in-out infinite;
  filter: drop-shadow(0 0 18px rgba(255, 215, 0, 0.8));
}

@keyframes spinTrophy {
  0%, 100% { transform: rotateY(0deg) scale(1); }
  50% { transform: rotateY(180deg) scale(1.12); }
}

.certificate-box {
  background: #0a192f;
  border: 1px dashed #ffd700;
  border-radius: 12px;
  padding: 14px;
  margin: 14px 0;
}

.bonus-text {
  color: #ffd700;
  font-weight: 700;
  margin: 8px 0;
}

.settings-card {
  text-align: left;
  border-color: #38bdf8;
}

.settings-card input {
  width: 100%;
  padding: 8px;
  margin: 6px 0 12px 0;
  border-radius: 6px;
  border: 1px solid #334155;
  background: #0a192f;
  color: #ffffff;
}

.modal-buttons {
  display: flex;
  justify-content: center;
  gap: 10px;
  margin-top: 12px;
}

.btn-outline {
  background: transparent;
  color: #ffffff;
  border: 1px solid #94a3b8;
  padding: 6px 14px;
  border-radius: 6px;
  cursor: pointer;
}