/* ===== RESET & GLOBAL STYLES ===== */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  user-select: none;
}

body {
  background: linear-gradient(135deg, #d0dad5, #d2ddd8);
  min-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
  font-family: 'Segoe UI', Roboto, 'Merriweather', system-ui, -apple-system, sans-serif;
  padding: 20px;
  position: relative;
}

/* Logo as background image */
body::before {
  content: "";
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-image: url('logo.png');
  background-size: 150px;
  background-repeat: repeat;
  background-position: center;
  opacity: 0.08;
  pointer-events: none;
  z-index: 0;
}

/* Single large centered logo */
body::after {
  content: "";
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 400px;
  height: 400px;
  background-image: url('logo.png');
  background-size: contain;
  background-repeat: no-repeat;
  background-position: center;
  opacity: 0.05;
  pointer-events: none;
  z-index: 0;
}

/* MAIN EXAM CARD */
.exam-card {
  max-width: 1000px;
  width: 100%;
  background: #cecdcd;
  background-image: radial-gradient(circle at 10% 30%, rgba(245, 240, 220, 0.5) 2%, #fff6e8 95%);
  border-radius: 48px 32px 48px 32px;
  overflow: hidden;
  transition: transform 0.2s ease;
}

/* ========== COVERAGE SELECTION SCREEN ========== */
.coverage-screen {
  padding: 32px 28px 40px;
}

.coverage-header {
  text-align: center;
  margin-bottom: 32px;
}

.coverage-header h1 {
  font-size: 2rem;
  color: #2c5e3a;
  letter-spacing: -0.5px;
  text-shadow: 1px 1px 0 #e9ddc3;
}

.coverage-header p {
  color: #5a6e4a;
  font-weight: 500;
  margin-top: 6px;
}

.datetime-display {
  color: #3f5b3d;
  font-size: 0.95rem;
  font-weight: 600;
  align-self: center;
  white-space: nowrap;
}

.exam-header .datetime-display {
  color: #ffdca3;
  font-size: 0.95rem;
  font-weight: 600;
  margin-left: auto;
}

.badge-flag {
  display: inline-block;
  background: #2c5e3a;
  color: #ffeaaf;
  padding: 8px 24px;
  border-radius: 60px;
  font-weight: bold;
  margin-top: 16px;
  font-size: 0.85rem;
  letter-spacing: 1px;
}

.coverage-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(240px, 1fr));
  grid-auto-rows: minmax(240px, auto);
  gap: 24px;
  margin: 28px 0;
}

.coverage-card {
  background: white;
  border-radius: 32px;
  padding: 22px 18px 24px;
  text-align: center;
  transition: all 0.25s ease;
  border: 2px solid #e8e0ce;
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.05);
}

.coverage-card:hover {
  transform: translateY(-6px);
  border-color: #c9aa6f;
  box-shadow: 0 18px 28px rgba(0, 0, 0, 0.1);
}

.coverage-icon {
  font-size: 3.2rem;
  margin-bottom: 12px;
}

.coverage-card h3 {
  font-size: 1.5rem;
  color: #2b5e3a;
  margin-bottom: 14px;
  font-weight: 700;
}

.coverage-card ul {
  list-style: none;
  text-align: left;
  margin: 16px 0;
  padding-left: 8px;
}

.coverage-card li {
  font-size: 0.8rem;
  padding: 5px 0;
  color: #4e5b3e;
  border-bottom: 1px dashed #ede3cf;
  display: flex;
  align-items: center;
  gap: 8px;
}

.coverage-card li::before {
  content: "▹";
  color: #c9aa6f;
  font-size: 0.7rem;
}

.select-coverage-btn {
  background: #2c5e3a;
  border: none;
  color: white;
  font-weight: bold;
  padding: 10px 20px;
  border-radius: 40px;
  cursor: pointer;
  font-size: 0.9rem;
  margin-top: 12px;
  transition: 0.1s linear;
  width: 100%;
  font-family: inherit;
  box-shadow: 0 3px 0 #1a3a22;
  transform: translateY(-2px);
}

.select-coverage-btn:active {
  transform: translateY(2px);
  box-shadow: none;
}

.coverage-footer {
  text-align: center;
  margin-top: 28px;
  padding-top: 18px;
  border-top: 2px dashed #e2d4be;
  color: #7a6a4e;
  font-size: 0.8rem;
  font-weight: 500;
}

/* ========== EXAM SCREEN ========== */
.exam-screen {
  display: flex;
  flex-direction: column;
}

.exam-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
  padding: 1rem 2rem;
  background: #2c5e3a;
  color: white;
  border-radius: 12px;
}

.back-arrow-btn {
  flex-shrink: 0;
}

.title-section {
  flex: 1;
  text-align: center;
}

.stats-panel {
  display: flex;
  gap: 1.5rem;
  flex-shrink: 0;
}

.title-section h1 {
  font-size: 1.6rem;
  letter-spacing: -0.5px;
  color: #FFE3A4;
  text-shadow: 2px 2px 0 #1e4628;
}

.title-section p {
  color: #e9f5e1;
  font-weight: 500;
  font-size: 0.8rem;
  margin-top: 4px;
}

.stats-panel {
  background: #fef1cf;
  padding: 8px 20px;
  border-radius: 60px;
  display: flex;
  gap: 24px;
  font-weight: bold;
  color: #2b4b2b;
  box-shadow: inset 0 1px 2px rgba(0,0,0,0.05), 0 4px 8px rgba(0,0,0,0.1);
}

.stat {
  display: flex;
  align-items: baseline;
  gap: 6px;
  font-size: 1rem;
}

.stat span:first-child {
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
}

.stat-value {
  font-size: 1.8rem;
  font-weight: 800;
  color: #c4450c;
  line-height: 1;
}

#timerDisplay {
  color: #c4450c;
}

#timerDisplay.timer-warning {
  color: #ff6b6b;
  animation: pulse-warning 0.6s infinite;
}

@keyframes pulse-warning {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.6; }
}

/* QUESTION AREA */
.question-area {
  padding: 28px 30px 20px 30px;
}

.category-badge {
  display: inline-block;
  background: #e3cbaa;
  padding: 6px 18px;
  border-radius: 40px;
  font-size: 0.75rem;
  font-weight: 700;
  color: #4a2e1a;
  margin-bottom: 18px;
  letter-spacing: 0.5px;
  box-shadow: inset 0 0 0 1px #fff8e7, 0 2px 4px rgba(0,0,0,0.05);
}

.question-text {
  font-size: 1.55rem;
  font-weight: 700;
  color: #2c3a1f;
  line-height: 1.35;
  margin-bottom: 28px;
  padding-right: 10px;
}

/* OPTIONS GRID */
.options-grid {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin-bottom: 28px;
}

.option-btn {
  background: white;
  border: 2px solid #e2dccd;
  border-radius: 60px;
  padding: 14px 22px;
  font-size: 1rem;
  font-weight: 500;
  text-align: left;
  display: flex;
  align-items: center;
  gap: 16px;
  cursor: pointer;
  transition: all 0.2s ease;
  font-family: inherit;
  color: #2f3e2c;
  background: #fefcf5;
  box-shadow: 0 2px 3px rgba(0,0,0,0.02);
}

.option-btn:hover:not(:disabled) {
  background: #fff0db;
  border-color: #c9aa6f;
  transform: scale(0.99);
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.05);
}

.option-prefix {
  font-weight: 800;
  background: #efdecb;
  width: 34px;
  height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 40px;
  color: #5c3e1a;
  font-size: 1.2rem;
}

.option-btn.disabled-opt, .option-btn:disabled {
  opacity: 0.7;
  cursor: not-allowed;
}

/* FEEDBACK & NEXT */
.feedback-area {
  background: #ede3cf;
  margin: 0 28px 24px 28px;
  padding: 14px 22px;
  border-radius: 60px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 16px;
}

.feedback-message {
  font-weight: 600;
  font-size: 0.9rem;
  color: #4d3b24;
  flex: 1;
}

.next-btn {
  background: #2c5e3a;
  border: none;
  color: white;
  font-weight: bold;
  padding: 10px 28px;
  border-radius: 40px;
  font-size: 0.95rem;
  cursor: pointer;
  transition: 0.15s;
  font-family: inherit;
  box-shadow: 0 3px 0 #1a3a22;
  transform: translateY(-2px);
}

.next-btn:active {
  transform: translateY(2px);
  box-shadow: none;
}

.next-btn:disabled {
  opacity: 0.6;
  transform: none;
  cursor: default;
}

.back-arrow-btn {
  background: #fff;
  border: 2px solid #d8d1c0;
  color: #2f3e2c;
  padding: 10px 18px;
  border-radius: 999px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.12);
  transition: background 0.2s, transform 0.1s;
  margin-bottom: 12px;
}

.back-arrow-btn:hover {
  background: #f7f4eb;
  transform: translateY(-1px);
}

/* Hide logout button when exam starts (body gets class 'exam-active') */
body.exam-active .logout-global-btn {
  display: none !important;
}

.logout-global-btn:hover {
  background: linear-gradient(135deg, #ff416c 0%, #ff8a5c 100%);
  transform: translateY(-2px);
  box-shadow: 0 18px 30px rgba(255, 95, 115, 0.4);
}

.logout-global-btn:active {
  transform: translateY(0);
  box-shadow: 0 10px 18px rgba(255, 95, 115, 0.25);
}

.logout-global-btn.hidden {
  display: none;
}

.logout-header-btn {
  background: #014430;
  border: none;
  color: white;
  font-weight: 700;
  padding: 10px 16px;
  border-radius: 30px;
  cursor: pointer;
  transition: background 0.2s, transform 0.1s;
  box-shadow: 0 3px 0 #01351d;
}

.logout-header-btn:hover {
  background: #a59496;
}

.logout-confirm-overlay {
  position: fixed;
  inset: 0;
  display: flex;
  justify-content: center;
  align-items: center;
  background: rgba(0, 0, 0, 0.65);
  z-index: 2000;
  padding: 20px;
}

.logout-confirm-card {
  background: #fffdf7;
  border-radius: 26px;
  width: min(100%, 420px);
  padding: 28px 26px;
  box-shadow: 0 30px 50px rgba(0, 0, 0, 0.28);
  text-align: center;
  border: 1px solid #f0e5d1;
}

.logout-confirm-card h2 {
  font-size: 1.6rem;
  color: #2c3e2f;
  margin-bottom: 14px;
}

.logout-confirm-card p {
  color: #4c4a44;
  font-size: 1rem;
  margin-bottom: 24px;
  line-height: 1.6;
}

.confirm-btns {
  display: flex;
  gap: 14px;
  justify-content: center;
  flex-wrap: wrap;
}

.confirm-btn {
  padding: 12px 22px;
  border: none;
  border-radius: 999px;
  font-size: 0.95rem;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.1s ease, background 0.2s ease;
}

.confirm-btn:hover {
  transform: translateY(-1px);
}

.confirm-yes-btn {
  background: #dc3545;
  color: white;
}

.confirm-yes-btn:hover {
  background: #b71c1c;
}

.confirm-no-btn {
  background: #e7e2d9;
  color: #3c3a34;
}

.confirm-no-btn:hover {
  background: #d5cfc5;
}

/* RESULT MODAL */
.result-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.8);
  backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  font-family: inherit;
}

.result-card {
  background: #fff9ef;
  max-width: 440px;
  width: 90%;
  border-radius: 48px;
  padding: 32px 26px;
  text-align: center;
  box-shadow: 0 30px 40px rgba(0,0,0,0.4);
  border: 2px solid #ffdd99;
}

.result-card h2 {
  font-size: 1.9rem;
  color: #2b5e3a;
  margin-bottom: 12px;
}

.score-circle {
  background: #e9ddc3;
  border-radius: 100px;
  width: 140px;
  height: 140px;
  margin: 18px auto;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  font-weight: bold;
  box-shadow: inset 0 0 0 5px #ffefcf, 0 10px 20px rgba(0,0,0,0.1);
}

.score-number {
  font-size: 3.4rem;
  font-weight: 800;
  color: #c4450c;
}

.verdict {
  font-size: 1.2rem;
  font-weight: 700;
  margin: 16px 0;
  padding: 10px;
  border-radius: 60px;
  background: #f6efdd;
}

.restart-btn {
  background: #2c5e3a;
  color: white;
  border: none;
  padding: 12px 28px;
  font-size: 1rem;
  font-weight: bold;
  border-radius: 60px;
  cursor: pointer;
  margin-top: 10px;
  transition: 0.1s linear;
  font-family: inherit;
}

.restart-btn:hover {
  background: #1f452c;
}

.progress-footer {
  background: #e7dbbc;
  padding: 12px 28px;
  font-size: 0.75rem;
  font-weight: 600;
  text-align: center;
  color: #5d4a2e;
  letter-spacing: 0.3px;
}

/* WELCOME SCREEN */
.welcome-screen {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
  width: 100%;
  padding: 20px;
  position: fixed;
  top: 0;
  left: 0;
}

.welcome-container {
  background: #fff9ef;
  background-image: radial-gradient(circle at 10% 20%, rgba(102, 126, 234, 0.05) 2%, transparent 2%);
  background-size: 30px 30px;
  max-width: 600px;
  width: 100%;
  margin: 0 auto;
  text-align: center;
  position: relative;
  border-radius: 30px;
  padding: 50px 40px;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.2);
  animation: fadeIn 0.5s ease;
}

.welcome-logo-section {
  display: flex;
  align-items: center;
  gap: 30px;
  margin-bottom: 40px;
  flex-wrap: wrap;
}

.welcome-logo-left {
  flex-shrink: 0;
}

.welcome-logo-img {
  width: 100px;
  height: auto;
  border-radius: 20px;
}

.welcome-header-text {
  flex: 1;
}

.welcome-header-text h1 {
  font-family: 'Franklin Gothic Medium', 'Arial Narrow', Arial, sans-serif;
  color: #2c3e6d;
  font-size: 28px;
  margin-bottom: 10px;
}

.welcome-subtitle {
  color: #666;
  margin-bottom: 15px;
  font-size: 16px;
}

.name-input-container {
  margin: 30px 0;
}

.name-input-container label {
  display: block;
  text-align: left;
  margin-bottom: 10px;
  font-weight: 600;
  color: #333;
  font-size: 16px;
}

.name-input {
  width: 100%;
  padding: 15px;
  font-size: 16px;
  border: 2px solid #e0e0e0;
  border-radius: 12px;
  transition: all 0.3s;
  font-family: inherit;
}

.name-input:focus {
  outline: none;
  border-color: #667eea;
  box-shadow: 0 0 0 3px rgba(102,126,234,0.1);
}

.start-btn {
  width: 100%;
  margin-top: 20px;
  padding: 15px;
  font-size: 18px;
  font-weight: bold;
  background: linear-gradient(135deg, #667eea, #764ba2);
  color: white;
  border: none;
  border-radius: 12px;
  cursor: pointer;
  transition: transform 0.2s, box-shadow 0.2s;
}

.start-btn:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 5px 20px rgba(102,126,234,0.4);
}

.start-btn:disabled {
  background: #ccc;
  cursor: not-allowed;
  transform: none;
}

.exam-info {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 15px;
  margin-top: 30px;
  padding-top: 20px;
  border-top: 2px solid #f0f0f0;
}

.info-item {
  background: linear-gradient(135deg, #f5f5f5, #fff);
  padding: 12px;
  border-radius: 12px;
  font-size: 14px;
  color: #555;
  font-weight: 500;
  text-align: center;
  transition: transform 0.2s;
}

.info-item:hover {
  transform: translateY(-3px);
  box-shadow: 0 5px 15px rgba(0,0,0,0.1);
}

.developer-credit {
  font-weight: bold;
  text-align: center;
  margin-top: 25px;
  color: #313030;
  font-size: 12px;
}

.user-greeting {
  text-align: center;
  margin-bottom: 15px;
}

.user-greeting p {
  font-size: 18px;
  color: #2c3e6d;
  font-weight: 500;
}

#playerNameDisplay {
  color: #764ba2;
  font-weight: bold;
}

.ph-flag, .coverage-img {
  width: 42px;
  height: auto;
  object-fit: contain;
}

.welcome-icon {
  display: none;
}

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

/* ========== RESPONSIVE DESIGN (MOBILE & TABLET) ========== */
@media (max-width: 768px) {
  /* Coverage grid - stack on mobile */
  .coverage-grid {
    grid-template-columns: 1fr;
    gap: 20px;
  }
  
  .coverage-card {
    padding: 18px 15px 20px;
  }
  
  .coverage-card h3 {
    font-size: 1.3rem;
  }
  
  .coverage-screen {
    padding: 20px 18px 30px;
  }
  
  /* Exam header - stack vertically */
  .exam-header {
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 1rem 1.2rem;
  }
  
  .title-section h1 {
    font-size: 1.3rem;
  }
  
  .stats-panel {
    padding: 6px 16px;
    gap: 16px;
  }
  
  .stat-value {
    font-size: 1.4rem;
  }
  
  .stat span:first-child {
    font-size: 0.7rem;
  }
  
  /* Question area spacing */
  .question-area {
    padding: 20px 18px 15px;
  }
  
  .question-text {
    font-size: 1.2rem;
    line-height: 1.4;
    margin-bottom: 20px;
  }
  
  .category-badge {
    font-size: 0.7rem;
    padding: 4px 14px;
  }
  
  /* Options - touch friendly */
  .option-btn {
    padding: 12px 16px;
    font-size: 0.9rem;
    gap: 12px;
  }
  
  .option-prefix {
    width: 30px;
    height: 30px;
    font-size: 1rem;
  }
  
  .feedback-area {
    margin: 0 18px 20px 18px;
    padding: 12px 16px;
    flex-direction: column;
    text-align: center;
  }
  
  .next-btn {
    width: 100%;
    padding: 10px 20px;
  }
  
  /* Welcome screen responsive */
  .welcome-logo-section {
    flex-direction: column;
    text-align: center;
    gap: 15px;
  }
  
  .welcome-header-text h1 {
    font-size: 24px;
  }
  
  .welcome-container {
    padding: 30px 20px;
  }
  
  .exam-info {
    grid-template-columns: 1fr;
    gap: 12px;
  }
  
  .name-input {
    padding: 12px;
  }
  
  .start-btn {
    padding: 12px;
    font-size: 16px;
  }
  
  /* Fixed button adjustments */
  .logout-global-btn {
    width: 48px;
    height: 48px;
    font-size: 1rem;
    top: 12px;
    right: 12px;
  }
  
  /* Result modal */
  .result-card {
    padding: 24px 18px;
    width: 95%;
  }
  
  .result-card h2 {
    font-size: 1.5rem;
  }
  
  .score-circle {
    width: 110px;
    height: 110px;
  }
  
  .score-number {
    font-size: 2.6rem;
  }
  
  .verdict {
    font-size: 1rem;
  }
  
  /* Back button */
  .back-arrow-btn {
    padding: 8px 14px;
    font-size: 0.85rem;
  }
}

/* Extra small devices (phones under 480px) */
@media (max-width: 480px) {
  body {
    padding: 12px;
  }
  
  .exam-card {
    border-radius: 32px 24px 32px 24px;
  }
  
  .coverage-header h1 {
    font-size: 1.6rem;
  }
  
  .coverage-header p {
    font-size: 0.85rem;
  }
  
  .badge-flag {
    padding: 6px 18px;
    font-size: 0.75rem;
  }
  
  .stats-panel {
    gap: 12px;
    padding: 5px 12px;
  }
  
  .stat {
    gap: 3px;
  }
  
  .stat-value {
    font-size: 1.2rem;
  }
  
  .question-text {
    font-size: 1rem;
  }
  
  .option-btn {
    padding: 10px 12px;
    font-size: 0.85rem;
  }
  
  .option-prefix {
    width: 26px;
    height: 26px;
    font-size: 0.85rem;
  }
  
  .feedback-message {
    font-size: 0.8rem;
  }
  
  .logout-global-btn {
    width: 42px;
    height: 42px;
    font-size: 0.9rem;
  }
  
  .welcome-container {
    padding: 20px 16px;
  }
  
  .welcome-header-text h1 {
    font-size: 20px;
  }
  
  .welcome-subtitle {
    font-size: 14px;
  }
  
  .welcome-logo-img {
    width: 70px;
  }
}

/* Landscape mode on mobile */
@media (max-width: 768px) and (orientation: landscape) {
  .coverage-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  
  .exam-header {
    flex-direction: row;
    flex-wrap: wrap;
    gap: 0.8rem;
  }
  
  .question-text {
    font-size: 1rem;
    margin-bottom: 15px;
  }
  
  .options-grid {
    gap: 10px;
    margin-bottom: 15px;
  }
  
  .option-btn {
    padding: 8px 12px;
  }
}

/* Tablet devices (768px - 1024px) */
@media (min-width: 769px) and (max-width: 1024px) {
  .coverage-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
  }
  
  .question-text {
    font-size: 1.4rem;
  }
  
  .exam-header {
    padding: 0.8rem 1.5rem;
  }
  
  .stats-panel {
    gap: 20px;
  }
}

/* Large screens (PC) optimization */
@media (min-width: 1200px) {
  .exam-card {
    max-width: 1100px;
  }
  
  .question-text {
    font-size: 1.7rem;
  }
  
  .option-btn {
    padding: 16px 24px;
    font-size: 1.05rem;
  }
  
  .stats-panel {
    padding: 10px 24px;
  }
  
  .stat-value {
    font-size: 2rem;
  }
}

/* Utility classes for flexibility */
.container-flex {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
}

.hide-on-mobile {
  display: block;
}

@media (max-width: 768px) {
  .hide-on-mobile {
    display: none;
  }
}

/* Touch-friendly tap targets */
button, 
.select-coverage-btn,
.option-btn,
.next-btn,
.back-arrow-btn,
.restart-btn,
.confirm-btn,
.start-btn,
.logout-global-btn,
.logout-header-btn {
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

/* Ensure no horizontal scroll */
body {
  overflow-x: hidden;
}

img, svg {
  max-width: 100%;
  height: auto;
}
