﻿body {
  margin: 0;
  font-family: Arial, sans-serif;
  background: linear-gradient(#f8fbff, #ffffff);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

.frac {
  font-size: 1.15em;
} 

.screen {
  display: none;
  min-height: 100vh;
  padding: 20px;
}

.screen.active {
  display: block;
}

.menu button {
  width: 220px;
  padding: 15px;
  margin: 10px;
  font-size: 16px;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

#progress {
  width: 60%;
  height: 24px;
  background: #f5f5dc;
  border-radius: 12px;
  overflow: hidden;
}

#energy {
  height: 100%;
  background: #2f75bb;
  width: 0%;
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
}

.question {
  margin-top: 30px;
  font-size: 18px;
}


.option {
  padding: 12px;
  margin: 10px 0;
  background: #eef5ff;
  border-radius: 8px;
  cursor: pointer;
}

.option.correct { background: #4caf50; color: white; }
.option.wrong { background: #f44336; color: white; }

.tf-row {
  display: flex;
  align-items: center;
  margin: 10px 0;
}

.tf-text {
  background: #eee;
  padding: 10px;
  flex: 1;
}

.tf-btn {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  margin-left: 10px;
  background: #2f75bb;
  color: white;
  border: none;
  cursor: pointer;
}

.tf-btn.correct { background: #4caf50; }
.tf-btn.wrong { background: #f44336; }

.short-input {
  display: flex;
  align-items: center;
  gap: 10px;
}

.short-input > input:not(.short-char) {
  width: 120px;
  padding: 10px;
}


.result-card {
  background: #2f75bb;
  color: white;
  padding: 30px;
  border-radius: 16px;
  border: 2px solid black;
  max-width: 500px;
  margin: 100px auto;
  text-align: center;
}

#finalScore {
  background: #fff;
  padding: 15px;
  margin-bottom: 20px;
  font-size: 28px;
  font-weight: bold;
}
/* ===== SHORT ANSWER PASSKEY STYLE ===== */
.short-input {
  margin-top: 16px;
}

.short-box {
  display: flex;
  gap: 0;              /* KHÃT nhau */
  align-items: center;
}

.short-char {
  width: 64px;           /* â‰ˆ 200% font-size */
  height: 32px;
  font-size: 16px;
  text-align: center;
  border: 1px solid #000;
  outline: none;
  box-sizing: border-box;
}

.short-char:focus {
  border-color: #000;
  box-shadow: none;
}

.short-input button {
  margin-left: 10px;
  height: 32px;
  padding: 0 10px;
}
/* ===== GENERAL ===== */
:root {
  --primary: #2f75bb;
  --primary-dark: #245c93;
  --secondary: #3d8bd9;
  --light: #f8fbff;
  --dark: #333;
}

body {
  margin: 0;
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  background: linear-gradient(135deg, #f8fbff 0%, #eef5ff 100%);
  min-height: 100vh;
  position: relative;
  overflow-x: hidden;
}


/* ===== HEADER ===== */
.header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 15px 30px;
  background-color: white;
  box-shadow: 0 4px 12px rgba(47, 117, 187, 0.2);
  border-bottom: 3px solid var(--primary);
}

.logo {
  font-size: 28px;
  font-weight: bold;
  color: var(--primary);
  display: flex;
  align-items: center;
  gap: 10px;
}

.logo i {
  font-size: 32px;
}

.header-buttons {
  display: flex;
  gap: 15px;
}

.header-btn {
  padding: 10px 20px;
  background-color: var(--primary);
  color: white;
  border: none;
  border-radius: 50px;
  font-size: 16px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: all 0.3s ease;
}

.header-btn:hover {
  background-color: var(--primary-dark);
  transform: translateY(-3px);
  box-shadow: 0 5px 15px rgba(47, 117, 187, 0.3);
}


.music-btn {
  position: relative;
  min-width: 132px;
  justify-content: center;
  font-weight: 600;
  letter-spacing: 0.2px;
  background: linear-gradient(135deg, #4f46e5, #6d28d9);
  box-shadow: 0 8px 18px rgba(79, 70, 229, 0.3);
}

.music-btn:hover {
  background: linear-gradient(135deg, #4338ca, #5b21b6);
  box-shadow: 0 10px 20px rgba(67, 56, 202, 0.36);
}

.music-btn:focus-visible {
  outline: 3px solid rgba(255, 255, 255, 0.95);
  outline-offset: 2px;
  box-shadow: 0 0 0 4px rgba(79, 70, 229, 0.45);
}

.music-btn i {
  transition: transform 0.25s ease;
}

.music-btn.is-ready {
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.music-btn.is-paused {
  background: linear-gradient(135deg, #ea580c, #f59e0b);
  box-shadow: 0 8px 18px rgba(234, 88, 12, 0.35);
}

.music-btn.is-paused:hover {
  background: linear-gradient(135deg, #c2410c, #d97706);
  box-shadow: 0 10px 20px rgba(194, 65, 12, 0.4);
}

.music-btn.is-playing {
  background: linear-gradient(135deg, #059669, #10b981);
  box-shadow: 0 8px 18px rgba(5, 150, 105, 0.35);
}

.music-btn.is-playing i {
  transform: scale(1.08);
}

.music-btn.is-playing::after {
  content: none;
}


/* Dropdown */
/* Dropdown */
.dropdown {
  position: relative;
  display: inline-block;
}

.dropdown-content {
  position: absolute;
  top: 100%;
  left: 0;

  background: #fff;
  min-width: 170px;
  border-radius: 10px;
  box-shadow: 0 6px 18px rgba(0,0,0,0.15);
  overflow: hidden;
  z-index: 10;

  /* tráº¡ng thÃ¡i Ä‘Ã³ng */
  opacity: 0;
  transform: translateY(-8px);
  pointer-events: none;
  visibility: hidden;

  transition:
    opacity 0.25s ease,
    transform 0.25s ease;
}

.dropdown-content.show {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
  visibility: visible;
}

.dropdown-content a {
  padding: 12px 16px;
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--dark);
  text-decoration: none;
}

.dropdown-content a:hover {
  background-color: #f1f1f1;
}


/* ===== MAIN CONTENT ===== */
.main-content {
  text-align: center;
  padding: 20px 20px 60px;
  max-width: 1200px;
  margin: 0 auto;
}

.title {
  font-size: 3rem;
  color: var(--primary);
  margin-bottom: 10px;
  text-shadow: 2px 2px 4px rgba(0,0,0,0.1);
}

.subtitle {
  font-size: 1.2rem;
  color: #666;
  margin-bottom: 50px;
}

/* ===== MODE BUTTONS ===== */
.menu {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 30px;
  margin-bottom: 60px;
}

.mode-btn {
  width: 280px;
  height: 180px;
  background: linear-gradient(145deg, #ffffff, #eef5ff);
  border: 3px solid var(--primary);
  border-radius: 20px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  color: var(--dark);
  font-size: 24px;
  font-weight: bold;
  cursor: pointer;
  transition: all 0.4s ease;
  box-shadow: 0 10px 20px rgba(47, 117, 187, 0.2);
  position: relative;
  overflow: hidden;
}

.mode-btn::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(45deg, transparent 30%, rgba(47, 117, 187, 0.15) 100%);
  z-index: 1;
}

.mode-btn i {
  font-size: 48px;
  color: var(--primary);
  margin-bottom: 15px;
  z-index: 2;
}

.mode-btn span {
  z-index: 2;
}

.mode-btn small {
  font-size: 14px;
  font-weight: normal;
  color: #777;
  margin-top: 8px;
  z-index: 2;
}

.mode-btn:hover {
  transform: translateY(-10px) scale(1.05);
  box-shadow: 0 15px 30px rgba(47, 117, 187, 0.3);
  background: linear-gradient(145deg, #eef5ff, #ffffff);
  border-color: var(--secondary);
}

.mode-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
  box-shadow: 0 5px 15px rgba(0,0,0,0.1);
}

.mode-btn:disabled:hover {
  transform: none;
  box-shadow: 0 5px 15px rgba(0,0,0,0.1);
  border-color: var(--primary);
}

/* ===== SUBPAGE INPUT ===== */
.subpage-input {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 10px;
  margin-top: 40px;
}

.subpage-input input {
  width: 300px;
  padding: 15px;
  border: 2px solid var(--primary);
  border-radius: 50px;
  font-size: 16px;
  outline: none;
  transition: border-color 0.3s;
}

.subpage-input input:focus {
  border-color: var(--secondary);
  box-shadow: 0 0 10px rgba(47, 117, 187, 0.45);
}

.subpage-input button {
  padding: 15px 30px;
  background-color: var(--primary);
  color: white;
  border: none;
  border-radius: 50px;
  font-size: 16px;
  cursor: pointer;
  transition: all 0.3s;
}

.subpage-input button:hover {
  background-color: var(--primary-dark);
  transform: scale(1.05);
}
/* ===== SUPPORT BUTTON ===== */
.support-btn {
  background: linear-gradient(135deg, #ff6b6b, #ff8787);
}

.support-btn:hover {
  background: linear-gradient(135deg, #ff5252, #ff6b6b);
  box-shadow: 0 5px 18px rgba(255, 107, 107, 0.4);
}

.support-btn i {
  color: #fff;
}

.header-btn.has-notice {
  position: relative;
}

.header-btn .notice-dot {
  position: absolute;
  top: 0px;
  right: 0px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #ff2d2d;
  box-shadow: 0 0 0 2px rgba(255,255,255,0.95);
}

.header-btn .notice-dot.hidden {
  display: none;
}


/* ===== RESPONSIVE ===== */
@media (max-width: 992px) {
  .menu {
    flex-direction: column;
    align-items: center;
  }
  .mode-btn {
    width: 90%;
    height: 150px;
  }
  .header {
    flex-direction: column;
    gap: 20px;
  }
  .header-buttons {
    flex-wrap: wrap;
    justify-content: center;
  }
  .music-btn.is-playing::after {
    content: none;
    animation: none;
    box-shadow: none;
  }
}

@media (max-width: 576px) {
  .title {
    font-size: 2.2rem;
  }
  .subtitle {
    font-size: 1rem;
  }
  .subpage-input {
    flex-direction: column;
  }
  .subpage-input input {
    width: 90%;
  }
  .music-btn {
    min-width: auto;
    padding: 10px 14px;
    gap: 6px;
  }
  .music-btn span {
    display: inline;
  }
}
/* ===== UPGRADED RESULT SCREEN ===== */
#result {
  background: radial-gradient(circle at center, #2f75bb 0%, #1b3f6b 100%);
  display: none;
  align-items: center;
  justify-content: center;
}

#result.active {
  display: flex; /* CÄƒn giá»¯a mÃ n hÃ¬nh */
}

.result-card {
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(10px);
  border: none;
  border-radius: 24px;
  padding: 40px;
  width: 90%;
  max-width: 450px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.3), 
              0 0 20px rgba(47, 117, 187, 0.5);
  position: relative;
  overflow: visible;
}

.chem-icon-float {
  position: absolute;
  top: -30px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 50px;
  background: white;
  width: 80px;
  height: 80px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 10px 20px rgba(0,0,0,0.1);
  animation: float 3s ease-in-out infinite;
}

@keyframes float {
  0%, 100% { transform: translate(-50%, 0); }
  50% { transform: translate(-50%, -10px); }
}

.result-title {
  color: #003366;
  font-size: 20px;
  letter-spacing: 2px;
  margin-top: 20px;
  text-transform: uppercase;
}

.score-container {
  margin: 30px 0;
  padding: 20px;
  background: #eef5ff;
  border-radius: 15px;
  border-left: 5px solid var(--primary);
}

#finalScore {
  font-family: 'Courier New', Courier, monospace;
  font-size: clamp(30px, 9vw, 48px) !important;
  font-weight: 900;
  margin: 0;
  background: none;
  padding: 0;
  text-align: center;
  white-space: nowrap;
  line-height: 1.1;
  max-width: 100%;
}

.score-container p {
  margin: 5px 0 0;
  color: #666;
  font-size: 14px;
  text-transform: uppercase;
}

.stat-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 15px;
  margin-bottom: 30px;
}

/* NÃºt báº¥m kiá»ƒu High-tech */
.result-btns {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 15px;
}

.btn-glow, .btn-outline, .btn-save {
  padding: 12px;
  border-radius: 12px;
  font-weight: bold;
  cursor: pointer;
  transition: all 0.3s;
  border: none;
  font-size: 15px;
}

.btn-glow {
  background: var(--primary);
  color: white;
  box-shadow: 0 4px 15px rgba(47, 117, 187, 0.45);
}

.btn-glow:hover {
  background: var(--primary-dark);
  transform: scale(1.05);
}

.btn-outline {
  background: white;
  color: var(--primary);
  border: 2px solid var(--primary);
}

.btn-outline:hover {
  background: #eef5ff;
}

.btn-save {
  width: 100%;
  margin-top: 15px;
  background: #2ecc71;
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.btn-save:hover {
  background: #27ae60;
  box-shadow: 0 5px 15px rgba(46, 204, 113, 0.3);
}


/* ÄÃ¨ mÃ u Ä‘iá»ƒm sá»‘ tá»« Logic.js */
#finalScore[style*="color: gold"] { text-shadow: 0 0 10px rgba(255, 215, 0, 0.5); }
#finalScore[style*="color: green"] { text-shadow: 0 0 10px rgba(76, 175, 80, 0.3); }
.cheer-message {
    font-size: 16px;
    font-weight: 600;
    margin: 10px 0;
    padding: 5px 15px;
    border-radius: 20px;
    background: rgba(255, 255, 255, 0.5);
    display: inline-block;
    animation: slideUp 0.6s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    color: #333;
}

/* Hiá»‡u á»©ng bay lÃªn khi hiá»‡n thÃ´ng Ä‘iá»‡p */
@keyframes slideUp {
    0% {
        opacity: 0;
        transform: translateY(20px);
    }
    100% {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Tinh chá»‰nh mÃ u sáº¯c theo tráº¡ng thÃ¡i cá»§a finalScore (dÃ¹ng CSS nÃ¢ng cao) */
#finalScore[style*="gold"] + #cheerMessage { color: #b8860b; border: 1px solid gold; }
#finalScore[style*="green"] + #cheerMessage { color: #2e7d32; border: 1px solid #2e7d32; }
#finalScore[style*="orange"] + #cheerMessage { color: #ef6c00; border: 1px solid #ef6c00; }
#finalScore[style*="red"] + #cheerMessage { color: #c62828; border: 1px solid #c62828; }
#finalScore.quick-score-legendary + #cheerMessage { color: #06141a; border: 1px solid #06141a; }
/* Hiá»‡u á»©ng xoay cháº­m cho logo Atom */
.fa-spin-slow {
    animation: fa-spin 5s infinite linear;
    color: var(--primary);
}

.time-record {
    margin-top: 10px;
    font-size: 15px;
    color: #555;
    background: rgba(47, 117, 187, 0.15);
    display: inline-block;
    padding: 4px 12px;
    border-radius: 50px;
    font-weight: 500;
}

.time-record i {
    color: var(--primary);
    margin-right: 5px;
}

/* Tinh chá»‰nh icon trong card káº¿t quáº£ */
.chem-icon-float {
    font-size: 50px !important; /* Atom thÆ°á»ng thanh máº£nh nÃªn cho to hÆ¡n chÃºt */
    color: var(--primary);
}
#finalScore {
    font-family: 'Courier New', Courier, monospace; /* Font chá»¯ mÃ¡y tÃ­nh */
    font-variant-numeric: tabular-nums; /* GiÃºp cÃ¡c con sá»‘ cÃ³ Ä‘á»™ rá»™ng báº±ng nhau */
    min-width: 120px;
    display: block;
}

.modal {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.45);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 9999;
}

.modal.active {
  display: flex;
}
.modal-card {
  width: 420px;
  background: #fff;
  border-radius: 14px;
  padding: 22px;
}

.modal-actions {
  display: flex;
  gap: 10px;
  margin-top: 14px;
}

.modal-actions button {
  flex: 1;
  border: 0;
  border-radius: 10px;
  padding: 10px 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.modal-actions button:disabled {
  opacity: 0.65;
  cursor: not-allowed;
}

#exportPdf {
  background: var(--primary);
  color: #fff;
}

#exportPdf[disabled] {
  opacity: 0.7;
  cursor: wait;
}

#closeModal {
  background: #eef1f8;
  color: #334155;
}

.save-status {
  margin-top: 12px;
  min-height: 20px;
  font-size: 14px;
  line-height: 1.4;
  text-align: left;
  color: #475569;
}

.save-status.loading {
  color: #1d4ed8;
}

.save-status.success {
  color: #15803d;
}

.save-status.error {
  color: #b91c1c;
}

.save-progress {
  display: none;
  margin-top: 10px;
}

.save-progress.active {
  display: block;
}

.save-progress-track {
  height: 8px;
  border-radius: 999px;
  background: #e2e8f0;
  overflow: hidden;
}

.save-progress-bar {
  height: 100%;
  width: 0%;
  border-radius: inherit;
  background: linear-gradient(90deg, #2563eb, #38bdf8);
  transition: width 0.35s ease;
}

.save-progress.done .save-progress-bar {
  background: linear-gradient(90deg, #16a34a, #22c55e);
}

.save-progress.error .save-progress-bar {
  background: linear-gradient(90deg, #b91c1c, #ef4444);
}

.save-progress-text {
  margin-top: 6px;
  font-size: 13px;
  color: #475569;
}
/* ===== DONATE MODAL ===== */
.donate-card {
  position: relative;
  width: 360px;
  text-align: center;
  padding: 28px;
}

.donate-title {
  font-size: 20px;
  font-weight: 700;
  color: var(--primary);
  margin-bottom: 16px;
}

.donate-qr {
  width: 240px;
  max-width: 100%;
  border-radius: 12px;
  box-shadow: 0 8px 20px rgba(0,0,0,0.2);
  margin-bottom: 16px;
}

.donate-text {
  font-size: 14px;
  line-height: 1.6;
  color: #444;
}

.donate-close {
  position: absolute;
  top: 10px;
  right: 12px;
  background: none;
  border: none;
  font-size: 26px;
  cursor: pointer;
  color: #666;
}

.donate-close:hover {
  color: var(--primary);
}

.news-card {
  position: relative;
  width: 420px;
  max-width: calc(100vw - 32px);
  text-align: left;
  padding: 24px;
}

.news-content {
  font-size: 14px;
  line-height: 1.6;
  color: #334155;
  max-height: 65vh;
  overflow: auto;
  padding-right: 4px;
}

.news-content h4,
.news-content p,
.news-content ul {
  margin: 0 0 10px;
}

.news-content ul {
  padding-left: 18px;
}

#newsModal .donate-title {
  text-align: center;
}

.guide-card {
  position: relative;
  width: 420px;
  max-width: calc(100vw - 32px);
  text-align: left;
  padding: 24px;
}

.guide-content {
  font-size: 14px;
  line-height: 1.65;
  color: #334155;
  max-height: 65vh;
  overflow: auto;
  padding-right: 6px;
}

.guide-intro {
  background: linear-gradient(135deg, #eef6ff, #e8f2ff);
  border: 1px solid #d6e7ff;
  border-radius: 12px;
  padding: 12px 14px;
  margin-bottom: 12px;
}

.guide-intro h4 {
  margin: 0 0 6px;
  font-size: 16px;
  color: #1b3f6b;
}

.guide-intro p {
  margin: 0;
  color: #475569;
}

.guide-section {
  background: #fff;
  border: 1px solid #e6e8ef;
  border-left: 4px solid var(--primary);
  border-radius: 12px;
  padding: 12px 14px;
  margin-bottom: 12px;
}

.guide-section h5 {
  margin: 0 0 8px;
  font-size: 14px;
  color: #1e293b;
  text-transform: uppercase;
  letter-spacing: 0.4px;
}

.guide-list {
  margin: 0;
  padding-left: 18px;
}

.guide-list li {
  margin-bottom: 8px;
}

.guide-list li:last-child {
  margin-bottom: 0;
}

.guide-modes {
  display: grid;
  gap: 10px;
  margin-bottom: 10px;
}

.guide-mode-card {
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  padding: 10px 12px;
  background: #f8fafc;
}

.guide-mode-head {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
  color: #1e293b;
}

.guide-mode-head i {
  color: var(--primary);
}

.guide-mode-card p {
  margin: 0;
  color: #475569;
}

.guide-mode-card .guide-list {
  margin-top: 8px;
}

.guide-mode-card.is-coming {
  background: #f9fafb;
  border-style: dashed;
}

.guide-coming {
  display: inline-block;
  margin: 0;
  font-weight: 700;
  color: #b45309;
  background: #fffbeb;
  border: 1px solid #fde68a;
  border-radius: 999px;
  padding: 2px 10px;
}

.guide-footer {
  margin: 2px 0 0;
  padding: 10px 12px;
  background: #f8fafc;
  border-radius: 10px;
  color: #0f172a;
  font-weight: 600;
  text-align: center;
}

#guideModal .donate-title {
  text-align: center;
}

.contact-card {
  position: relative;
  width: 360px;
  max-width: calc(100vw - 32px);
  text-align: center;
  padding: 28px 24px 24px;
}

.contact-avatar {
  width: 120px;
  height: 120px;
  border-radius: 50%;
  object-fit: cover;
  border: 3px solid #dfeaff;
  box-shadow: 0 10px 24px rgba(47, 117, 187, 0.2);
  margin: 6px auto 14px;
  display: block;
}

.contact-zalo {
  display: inline-block;
  font-size: 18px;
  font-weight: 700;
  color: var(--primary);
  text-decoration: none;
  margin-bottom: 10px;
}

.contact-zalo:hover {
  color: var(--primary-dark);
  text-decoration: underline;
}

.contact-text {
  margin: 0;
  font-size: 14px;
  line-height: 1.6;
  color: #475569;
}




