* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #e0f7ff, #fdf3d8);
  font-family: Arial, Helvetica, sans-serif;
}

.auth-panel {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 20px;
}

.auth-box {
  width: min(90vw, 440px);
  background: rgba(255, 255, 255, 0.9);
  border: 2px solid rgba(59, 130, 246, 0.3);
  border-radius: 24px;
  padding: 30px 24px;
  box-shadow: 0 20px 50px rgba(30, 41, 59, 0.12);
}

.auth-box h1 {
  margin-top: 0;
  color: #1d3557;
  text-align: center;
}

.auth-box p {
  color: #475569;
  text-align: center;
}

.field-group {
  margin-bottom: 16px;
}

.field-group label {
  display: block;
  margin-bottom: 8px;
  color: #334155;
  font-weight: bold;
}

.field-group input {
  width: 100%;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid #cbd5e1;
  font-size: 1rem;
}

.auth-actions,
.top-actions {
  display: flex;
  gap: 12px;
  justify-content: center;
  flex-wrap: wrap;
}

.primary-btn,
.secondary-btn,
.logout-btn,
.play-again,
.new-game {
  border: none;
  border-radius: 12px;
  padding: 12px 18px;
  font-size: 1rem;
  font-weight: bold;
  cursor: pointer;
}

.primary-btn {
  background: #3b82f6;
  color: white;
}

.secondary-btn,
.logout-btn {
  background: #e2e8f0;
  color: #1e293b;
}

.auth-error {
  color: #dc2626;
  font-weight: bold;
}

.auth-box .auth-switch {
  margin-bottom: 0;
  font-size: 0.95rem;
}

.auth-switch button {
  padding: 0;
  border: 0;
  background: none;
  color: #2563eb;
  font: inherit;
  font-weight: bold;
  text-decoration: underline;
  cursor: pointer;
}

.dashboard-panel {
  width: min(92vw, 980px);
  background: rgba(255, 255, 255, 0.82);
  border: 3px solid rgba(72, 168, 255, 0.55);
  border-radius: 24px;
  box-shadow: 0 18px 50px rgba(38, 62, 118, 0.18);
  padding: 30px;
}

.profile-panel {
  width: min(92vw, 760px);
  max-height: 94vh;
  overflow-y: auto;
  background: rgba(255, 255, 255, 0.9);
  border: 2px solid rgba(59, 130, 246, 0.3);
  border-radius: 24px;
  padding: 30px;
  box-shadow: 0 20px 50px rgba(30, 41, 59, 0.12);
}

.profile-panel .dashboard-header h1 {
  color: #1d3557;
}

.profile-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  column-gap: 18px;
  margin-top: 20px;
}

.profile-section-title {
  margin: 20px 0 4px;
  color: #1d3557;
  font-size: 1.15rem;
}

.profile-section-title span,
.profile-help {
  color: #64748b;
  font-size: 0.9rem;
  font-weight: normal;
}

.profile-help {
  margin: 0;
}

.profile-success {
  color: #15803d;
  font-weight: bold;
}

.profile-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.profile-actions button:disabled {
  cursor: wait;
  opacity: 0.7;
}

.dashboard-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
  margin-bottom: 24px;
}

.dashboard-header h1 {
  margin: 0;
  color: #1d3557;
}

.admin-panel {
  width: min(96vw, 1100px);
  background: rgba(255, 255, 255, 0.8);
  border: 3px solid rgba(72, 168, 255, 0.55);
  border-radius: 24px;
  box-shadow: 0 18px 50px rgba(38, 62, 118, 0.18);
  padding: 25px;
}

.table-wrap {
  overflow-x: auto;
}

.admin-table {
  width: 100%;
  border-collapse: collapse;
  background: #fff;
  border-radius: 12px;
  overflow: hidden;
}

.admin-table th,
.admin-table td {
  border: 1px solid #e2e8f0;
  padding: 12px 10px;
  text-align: left;
}

.admin-table th {
  background: #eef6ff;
  color: #1d3557;
}

.admin-table td {
  color: #334155;
}

.game-settings {
  margin: 24px 0;
  padding: 20px;
  border: 1px solid #dbeafe;
  border-radius: 16px;
  background: #f8fbff;
}

.game-settings h2 {
  margin: 0 0 6px;
  color: #1d3557;
  font-size: 1.25rem;
}

.game-settings > p {
  margin: 0 0 16px;
  color: #475569;
}

.game-settings-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 12px;
}

.game-setting {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  background: #fff;
}

.game-setting > div {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.game-status-active,
.game-status-inactive {
  font-size: 0.85rem;
  font-weight: bold;
}

.game-status-active {
  color: #15803d;
}

.game-status-inactive {
  color: #b91c1c;
}

.activate-btn,
.deactivate-btn {
  flex-shrink: 0;
  border: 0;
  border-radius: 9px;
  padding: 9px 12px;
  color: #fff;
  font-weight: bold;
  cursor: pointer;
}

.activate-btn {
  background: #16a34a;
}

.deactivate-btn {
  background: #dc2626;
}

.activate-btn:disabled,
.deactivate-btn:disabled {
  cursor: wait;
  opacity: 0.65;
}

.dashboard-error {
  color: #b91c1c;
  font-weight: bold;
}

.dashboard-empty {
  padding: 18px;
  border-radius: 12px;
  background: #fff;
  color: #475569;
  text-align: center;
}

.admin-panel {
  width: min(96vw, 1100px);
  background: rgba(255, 255, 255, 0.8);
  border: 3px solid rgba(72, 168, 255, 0.55);
  border-radius: 24px;
  box-shadow: 0 18px 50px rgba(38, 62, 118, 0.18);
  padding: 25px;
}

.table-wrap {
  overflow-x: auto;
}

.admin-table {
  width: 100%;
  border-collapse: collapse;
  background: #fff;
  border-radius: 12px;
  overflow: hidden;
}

.admin-table th,
.admin-table td {
  border: 1px solid #e2e8f0;
  padding: 12px 10px;
  text-align: left;
}

.admin-table th {
  background: #eef6ff;
  color: #1d3557;
}

.admin-table td {
  color: #334155;
}

.dashboard-header p {
  margin: 6px 0 0;
  color: #475569;
}

.game-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 20px;
}

.game-card {
  text-align: left;
  background: linear-gradient(180deg, #f8fbff, #edf6ff);
  border: 2px solid #dfeeff;
  border-radius: 18px;
  padding: 20px;
  color: #1e293b;
  cursor: pointer;
  box-shadow: 0 12px 24px rgba(59, 130, 246, 0.08);
}

.game-icon {
  width: 54px;
  height: 54px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 16px;
  background: linear-gradient(135deg, #7dd3fc, #3b82f6);
  color: white;
  font-size: 2rem;
  font-weight: bold;
  margin-bottom: 12px;
}

.game-card h3 {
  margin: 0 0 10px;
  font-size: 1.3rem;
}

.invite-panel {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  flex-wrap: wrap;
  margin-top: 24px;
  padding: 20px;
  border: 1px solid #bbf7d0;
  border-radius: 16px;
  background: linear-gradient(135deg, #f0fdf4, #ecfdf5);
}

.invite-panel h2 {
  margin: 0 0 6px;
  color: #166534;
  font-size: 1.2rem;
}

.invite-panel p {
  margin: 0;
  color: #475569;
}

.invite-details {
  display: flex;
  flex-direction: column;
  gap: 4px;
  color: #475569;
}

.invite-details strong {
  color: #166534;
  font-size: 1.25rem;
  letter-spacing: 1.5px;
}

.whatsapp-invite {
  display: inline-block;
  background: #16a34a;
  color: #fff;
  text-decoration: none;
  white-space: nowrap;
}

.whatsapp-invite:hover {
  background: #15803d;
}

.invite-limit {
  margin: 0;
  color: #b91c1c;
  font-weight: bold;
}

.game-card p {
  margin: 0 0 16px;
  color: #475569;
}

.game-score-box {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: #fff;
  border-radius: 12px;
  padding: 10px 12px;
  font-size: 0.95rem;
  color: #334155;
}

.game-score-box strong {
  color: #7c3aed;
}

.game-container {
  width: min(90vw, 780px);
  background: rgba(255, 255, 255, 0.75);
  border: 3px solid rgba(72, 168, 255, 0.55);
  border-radius: 24px;
  box-shadow: 0 18px 50px rgba(38, 62, 118, 0.18);
  padding: 24px;
}

.top-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 24px;
  flex-wrap: wrap;
}

.info-box {
  min-width: 120px;
  background: linear-gradient(135deg, #ffd166, #f4b942);
  color: #2e2e2e;
  border-radius: 18px;
  padding: 12px 18px;
  font-size: 1.2rem;
  box-shadow: 0 8px 18px rgba(244, 185, 66, 0.3);
}

.timer-box {
  background: linear-gradient(135deg, #7dd3fc, #38bdf8);
  box-shadow: 0 8px 18px rgba(56, 189, 248, 0.25);
}

.round-box {
  background: linear-gradient(135deg, #c4b5fd, #8b5cf6);
  box-shadow: 0 8px 18px rgba(139, 92, 246, 0.25);
}

.info-box .label {
  display: block;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.new-game {
  border: none;
  background: #3b82f6;
  color: white;
  border-radius: 12px;
  padding: 12px 18px;
  font-size: 1rem;
  font-weight: bold;
  cursor: pointer;
  transition: transform 0.2s ease;
}

.new-game:hover {
  transform: translateY(-1px);
}

.welcome-line {
  text-align: right;
  color: #334155;
  font-weight: bold;
  margin-bottom: 12px;
}

.game-panel {
  text-align: center;
}

.question-box {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  background: #fff;
  border-radius: 20px;
  padding: 28px 20px;
  margin-bottom: 24px;
  box-shadow: inset 0 0 0 2px rgba(91, 120, 255, 0.1);
}

.number,
.operator,
.equals,
.question-prompt {
  font-size: clamp(2rem, 5vw, 4rem);
  font-weight: 800;
  color: #1d3557;
}

.question-prompt {
  overflow-wrap: anywhere;
}

.operator {
  color: #ef476f;
}

.balloons {
  display: grid;
  grid-template-columns: repeat(2, minmax(120px, 1fr));
  gap: 22px;
  justify-items: center;
}

.balloon {
  width: 140px;
  height: 120px;
  border: none;
  border-radius: 50% 50% 50% 50% / 45% 45% 55% 55%;
  background: linear-gradient(180deg, #ff7a7a, #ff4d6d);
  color: white;
  font-size: 2rem;
  font-weight: 700;
  box-shadow: inset -12px -12px 18px rgba(0, 0, 0, 0.12), 0 18px 25px rgba(255, 77, 109, 0.25);
  cursor: pointer;
  position: relative;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.balloon::before {
  content: "";
  position: absolute;
  width: 14px;
  height: 14px;
  background: rgba(255, 255, 255, 0.35);
  border-radius: 50%;
  top: 18px;
  left: 26px;
}

.balloon:hover {
  transform: translateY(-6px) scale(1.02);
}

.balloon.correct {
  background: linear-gradient(180deg, #7bd389, #35c759);
  box-shadow: 0 18px 25px rgba(53, 199, 89, 0.25);
}

.balloon.wrong {
  background: linear-gradient(180deg, #f8a5a5, #f05e5e);
  box-shadow: 0 18px 25px rgba(240, 94, 94, 0.25);
}

.message {
  min-height: 28px;
  margin-top: 22px;
  font-size: 1.1rem;
  font-weight: bold;
}

.message.success {
  color: #15803d;
}

.message.error {
  color: #b91c1c;
}

.message.finished {
  color: #7c3aed;
}

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 1000;
}

.result-modal {
  width: min(90vw, 420px);
  background: white;
  border-radius: 22px;
  padding: 32px 24px;
  text-align: center;
  box-shadow: 0 28px 50px rgba(15, 23, 42, 0.22);
}

.result-modal h2 {
  margin: 0 0 18px;
  color: #1d3557;
  font-size: 2rem;
}

.result-score,
.result-rating {
  font-size: 1.2rem;
  color: #374151;
  margin: 10px 0;
}

.result-rating strong {
  color: #7c3aed;
}

.landing-page {
  width: min(100%, 1120px);
  min-height: 100vh;
  margin: 0 auto;
  padding: 26px 38px 20px;
  display: flex;
  flex-direction: column;
  color: #172554;
}

.landing-nav,
.landing-nav-actions,
.landing-brand,
.hero-actions,
.challenge-topline,
.challenge-footer {
  display: flex;
  align-items: center;
}

.landing-nav {
  justify-content: space-between;
}

.landing-brand {
  gap: 10px;
  color: #172554;
  text-decoration: none;
  font-size: 1.15rem;
  font-weight: 800;
  letter-spacing: -0.4px;
}

.brand-mark {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border-radius: 12px;
  background: #dbeafe;
  color: #2563eb;
  font-size: 1.5rem;
}

.landing-nav-actions {
  gap: 20px;
}

.landing-login,
.back-home {
  padding: 8px 0;
  border: 0;
  background: transparent;
  color: #334155;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

.landing-nav-actions .primary-btn {
  border-radius: 10px;
  padding: 10px 16px;
  background: #1d4ed8;
}

.landing-hero {
  display: grid;
  grid-template-columns: 1.08fr 0.92fr;
  align-items: center;
  gap: 28px;
  flex: 1;
  padding: 42px 0 36px;
}

.hero-copy {
  position: relative;
  z-index: 1;
}

.hero-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  color: #2563eb;
  font-size: 0.82rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.eyebrow-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #22c55e;
  box-shadow: 0 0 0 4px #dcfce7;
}

.hero-copy h1 {
  margin: 20px 0 16px;
  color: #172554;
  font-size: clamp(2.8rem, 6vw, 4.65rem);
  line-height: 1.02;
  letter-spacing: -0.065em;
}

.hero-copy h1 span {
  color: #2563eb;
}

.hero-copy > p {
  max-width: 470px;
  margin: 0;
  color: #526079;
  font-size: 1.08rem;
  line-height: 1.7;
}

.hero-actions {
  gap: 18px;
  flex-wrap: wrap;
  margin-top: 28px;
}

.hero-primary {
  display: inline-flex;
  align-items: center;
  gap: 14px;
  padding: 14px 20px;
  border: 0;
  border-radius: 12px;
  background: #1d4ed8;
  box-shadow: 0 10px 22px rgba(37, 99, 235, 0.2);
  color: #fff;
  font: inherit;
  font-weight: 800;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.hero-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 14px 26px rgba(37, 99, 235, 0.27);
}

.hero-primary span {
  font-size: 1.2rem;
}

.hero-note {
  color: #64748b;
  font-size: 0.88rem;
}

.invite-note,
.registration-note {
  margin-top: 16px !important;
  font-size: 0.9rem !important;
}

.invite-note strong {
  color: #166534;
  letter-spacing: 0.08em;
}

.registration-note {
  color: #64748b !important;
}

.hero-art {
  position: relative;
  min-height: 330px;
  display: grid;
  place-items: center;
  overflow: hidden;
  border: 1px solid rgba(147, 197, 253, 0.45);
  border-radius: 34px;
  background:
    radial-gradient(circle at 50% 45%, rgba(255, 255, 255, 0.96), rgba(239, 246, 255, 0.8) 48%, transparent 72%),
    linear-gradient(145deg, #dbeafe, #eff6ff 55%, #f5f3ff);
}

.orbit {
  position: absolute;
  width: 270px;
  height: 270px;
  border: 1px dashed rgba(59, 130, 246, 0.2);
  border-radius: 50%;
}

.orbit-two {
  width: 350px;
  height: 350px;
  border-color: rgba(139, 92, 246, 0.13);
}

.math-float {
  position: absolute;
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  border-radius: 16px;
  background: #fff;
  box-shadow: 0 12px 26px rgba(30, 64, 175, 0.13);
  color: #2563eb;
  font-size: 1.7rem;
  font-weight: 800;
}

.float-plus {
  top: 16%;
  left: 18%;
  transform: rotate(-12deg);
}

.float-minus {
  right: 15%;
  top: 23%;
  color: #7c3aed;
  transform: rotate(12deg);
}

.float-multiply {
  bottom: 14%;
  left: 22%;
  color: #059669;
  transform: rotate(9deg);
}

.challenge-card {
  position: relative;
  z-index: 1;
  width: min(78%, 330px);
  padding: 22px;
  border: 1px solid rgba(226, 232, 240, 0.9);
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: 0 24px 55px rgba(30, 64, 175, 0.15);
  transform: rotate(-3deg);
}

.challenge-topline,
.challenge-footer {
  justify-content: space-between;
}

.challenge-topline {
  color: #64748b;
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.1em;
}

.challenge-spark {
  color: #f59e0b;
  font-size: 1.2rem;
}

.challenge-equation {
  margin: 24px 0 20px;
  color: #172554;
  font-size: 2.8rem;
  font-weight: 800;
  letter-spacing: -0.05em;
  text-align: center;
}

.challenge-equation span {
  color: #2563eb;
}

.challenge-equation b {
  color: #94a3b8;
  font-size: 1.8rem;
}

.challenge-options {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.challenge-options span {
  padding: 10px 4px;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  color: #475569;
  font-weight: 700;
  text-align: center;
}

.challenge-options .correct-option {
  border-color: #86efac;
  background: #f0fdf4;
  color: #15803d;
}

.correct-option b {
  margin-left: 2px;
}

.challenge-progress {
  height: 7px;
  margin: 20px 0 14px;
  overflow: hidden;
  border-radius: 8px;
  background: #e2e8f0;
}

.challenge-progress span {
  display: block;
  width: 68%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #3b82f6, #8b5cf6);
}

.challenge-footer {
  color: #64748b;
  font-size: 0.8rem;
}

.challenge-footer strong {
  color: #16a34a;
}

.landing-features {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  padding: 18px 0;
  border-top: 1px solid #dbeafe;
}

.feature-card {
  display: flex;
  align-items: flex-start;
  gap: 13px;
  padding: 15px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.65);
}

.feature-icon {
  flex: 0 0 40px;
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  border-radius: 13px;
  font-size: 1.2rem;
  font-weight: 800;
}

.feature-blue {
  background: #dbeafe;
  color: #2563eb;
}

.feature-purple {
  background: #ede9fe;
  color: #7c3aed;
}

.feature-green {
  background: #dcfce7;
  color: #15803d;
}

.feature-card h2 {
  margin: 1px 0 5px;
  color: #1e293b;
  font-size: 0.98rem;
}

.feature-card p {
  margin: 0;
  color: #64748b;
  font-size: 0.82rem;
  line-height: 1.5;
}

.landing-footer {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding-top: 13px;
  color: #64748b;
  font-size: 0.78rem;
}

.footer-star {
  color: #f59e0b;
}

.auth-box .back-home {
  display: block;
  margin: -4px 0 16px;
  color: #2563eb;
  font-size: 0.9rem;
}

.play-again {
  margin-top: 18px;
  border: none;
  background: linear-gradient(135deg, #3b82f6, #7c3aed);
  color: white;
  border-radius: 12px;
  padding: 12px 24px;
  font-size: 1rem;
  font-weight: bold;
  cursor: pointer;
}

@media (max-width: 560px) {
  .landing-page {
    padding: 18px 20px;
  }

  .landing-nav-actions {
    gap: 12px;
  }

  .landing-nav-actions .primary-btn {
    padding: 9px 12px;
  }

  .landing-hero {
    grid-template-columns: 1fr;
    gap: 18px;
    padding: 48px 0 24px;
  }

  .hero-copy h1 {
    font-size: clamp(2.7rem, 14vw, 4rem);
  }

  .hero-art {
    min-height: 280px;
  }

  .landing-features {
    grid-template-columns: 1fr;
    gap: 8px;
    padding: 10px 0;
  }

  .landing-footer {
    flex-wrap: wrap;
    font-size: 0.72rem;
  }

  .profile-panel {
    padding: 22px 18px;
  }

  .profile-grid {
    grid-template-columns: 1fr;
  }

  .top-bar {
    flex-direction: column;
    gap: 12px;
  }

  .balloons {
    grid-template-columns: repeat(2, minmax(110px, 1fr));
  }

  .balloon {
    width: 120px;
    height: 105px;
    font-size: 1.6rem;
  }
}
