:root {
  --primary-blue: #3498db;
  --primary-green: #2ecc71;
  --primary-purple: #9b59b6;
  --primary-red: #e74c3c;
  --primary-orange: #ff8c00;
  --gold: #ffd700;
  --dark: #2c3e50;
  --bg-card: rgba(255, 255, 255, 0.92);
  --shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  font-family: 'Segoe UI', -apple-system, BlinkMacSystemFont, Roboto, sans-serif;
  -webkit-tap-highlight-color: transparent;
}

body {
  background-color: #1a1a2e;
  min-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 10px;
}

/* Smartphone Mockup Frame */
.phone-container {
  width: 100%;
  max-width: 380px;
  height: 800px;
  max-height: 96vh;
  background-image: url('images/bg.jpeg');
  background-size: cover;
  background-position: center;
  border-radius: 36px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.6), 0 0 0 10px #1e272e;
  display: flex;
  flex-direction: column;
  position: relative;
  overflow: hidden;
}

/* Top Notch & Speaker */
.phone-notch {
  width: 120px;
  height: 18px;
  background: #1e272e;
  margin: 0 auto;
  border-bottom-left-radius: 12px;
  border-bottom-right-radius: 12px;
  z-index: 100;
}

/* Screen wrapper */
.screen-wrapper {
  flex: 1;
  position: relative;
  overflow-y: auto;
  padding: 16px 20px 24px 20px;
  display: flex;
  flex-direction: column;
}

/* Hide scrollbar */
.screen-wrapper::-webkit-scrollbar {
  display: none;
}
.screen-wrapper {
  -ms-overflow-style: none;
  scrollbar-width: none;
}

/* Home Indicator Bar */
.phone-home-bar {
  width: 110px;
  height: 4px;
  background: rgba(0, 0, 0, 0.4);
  border-radius: 2px;
  margin: 6px auto 10px auto;
}

/* Screen states */
.screen {
  display: none;
  flex-direction: column;
  width: 100%;
  height: 100%;
  animation: fadeIn 0.25s ease-in-out;
}

.screen.active {
  display: flex;
}

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

/* Header & Typography */
.app-title-shadow {
  position: relative;
  text-align: center;
  font-size: 26px;
  font-weight: 800;
  letter-spacing: 1px;
  color: var(--gold);
  text-shadow: 2px 3px 6px rgba(0, 0, 0, 0.45);
  margin-top: 10px;
}

.app-subtitle {
  text-align: center;
  font-size: 13px;
  color: #111;
  font-weight: 500;
  margin-top: 2px;
}

.welcome-text {
  text-align: center;
  font-size: 14px;
  color: #444;
  margin: 12px 0 16px 0;
}

/* Module Cards */
.module-cards {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin-bottom: 20px;
}

.card {
  background: var(--bg-card);
  border-radius: 14px;
  padding: 14px 16px;
  cursor: pointer;
  border: 2px solid;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
  transition: transform 0.15s ease, background 0.15s ease, box-shadow 0.15s ease;
  user-select: none;
}

.card:hover, .card:active {
  transform: translateY(-2px);
  background: #ffffff;
  box-shadow: 0 8px 16px rgba(0, 0, 0, 0.15);
}

.card-learn { border-color: var(--primary-blue); }
.card-quiz { border-color: var(--primary-green); }
.card-badge { border-color: var(--primary-purple); }

.card-heading {
  font-size: 14px;
  font-weight: 700;
  margin-bottom: 5px;
}
.card-learn .card-heading { color: var(--primary-blue); }
.card-quiz .card-heading { color: var(--primary-green); }
.card-badge .card-heading { color: var(--primary-purple); }

.card-desc {
  font-size: 12px;
  color: #555;
  line-height: 1.4;
  margin-bottom: 8px;
}

.card-explore {
  font-size: 12px;
  font-weight: 700;
  text-align: right;
}
.card-learn .card-explore { color: var(--primary-blue); }
.card-quiz .card-explore { color: var(--primary-green); }
.card-badge .card-explore { color: var(--primary-purple); }

/* Buttons */
.btn {
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 10px 16px;
  border-radius: 12px;
  border: none;
  color: #fff;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  transition: filter 0.15s ease, transform 0.1s ease;
  user-select: none;
}

.btn:active {
  transform: scale(0.98);
}

.btn-blue { background-color: var(--primary-blue); }
.btn-green { background-color: var(--primary-green); }
.btn-purple { background-color: var(--primary-purple); }
.btn-red { background-color: var(--primary-red); }
.btn-orange { background-color: var(--primary-orange); }

.btn-mute {
  background: var(--primary-blue);
  color: #fff;
  margin-top: auto;
  gap: 8px;
}

/* Learning Module */
.learning-image-box {
  width: 100%;
  height: 160px;
  border-radius: 12px;
  overflow: hidden;
  border: 2px solid rgba(255, 215, 0, 0.7);
  margin: 12px 0;
  background: #000;
  display: flex;
  align-items: center;
  justify-content: center;
}

.learning-image-box img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.learning-content {
  flex: 1;
  background: rgba(255, 255, 255, 0.85);
  border-radius: 12px;
  padding: 14px;
  font-size: 13px;
  color: #222;
  line-height: 1.5;
  white-space: pre-line;
  overflow-y: auto;
  margin-bottom: 14px;
}

.compare-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  flex: 1;
  margin-bottom: 14px;
}

.compare-col {
  padding: 10px;
  border-radius: 10px;
  font-size: 11px;
  line-height: 1.4;
  white-space: pre-line;
  overflow-y: auto;
}
.compare-renew { background: #d2ffd2; border: 1px solid #78c978; }
.compare-nonrenew { background: #ffd2d2; border: 1px solid #c97878; }

.nav-row {
  display: flex;
  gap: 8px;
  justify-content: space-between;
}
.nav-row .btn {
  flex: 1;
}

/* Quiz Lobby */
.input-group {
  margin: 16px 0;
}
.input-label {
  font-size: 13px;
  font-weight: 700;
  color: #222;
  margin-bottom: 6px;
  display: block;
}
.text-input {
  width: 100%;
  padding: 12px;
  border-radius: 12px;
  border: 2px solid #ccc;
  font-size: 14px;
  font-weight: 600;
  outline: none;
  transition: border-color 0.2s;
}
.text-input:focus {
  border-color: var(--primary-blue);
}

.diff-buttons {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin: 12px 0 20px 0;
}
.diff-btn {
  padding: 12px;
  font-size: 14px;
  font-weight: 700;
  border-radius: 12px;
  border: 3px solid transparent;
  cursor: pointer;
  color: white;
  transition: all 0.15s ease;
}
.diff-btn.easy { background: var(--primary-green); }
.diff-btn.medium { background: var(--primary-orange); }
.diff-btn.hard { background: var(--primary-red); }

.diff-btn.selected {
  filter: brightness(0.8);
  border-color: #2ecc71;
  box-shadow: 0 0 10px rgba(46, 204, 113, 0.6);
}

/* Quiz Engine */
.quiz-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-weight: 700;
  font-size: 14px;
  margin: 10px 0 6px 0;
  color: #111;
}

.progress-track {
  width: 100%;
  height: 8px;
  background: rgba(255, 255, 255, 0.5);
  border-radius: 4px;
  overflow: hidden;
  margin-bottom: 12px;
}
.progress-fill {
  height: 100%;
  background: var(--primary-blue);
  width: 5%;
  transition: width 0.3s ease;
}

.question-box {
  background: var(--bg-card);
  padding: 16px;
  border-radius: 14px;
  font-size: 14px;
  font-weight: 700;
  text-align: center;
  color: #111;
  min-height: 80px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(0,0,0,0.1);
  box-shadow: 0 4px 10px rgba(0,0,0,0.06);
  margin-bottom: 10px;
}

.feedback-badge {
  text-align: center;
  font-size: 16px;
  font-weight: 800;
  height: 24px;
  margin-bottom: 6px;
  letter-spacing: 1px;
}
.feedback-badge.correct { color: #2ecc71; text-shadow: 0 1px 3px rgba(0,0,0,0.3); }
.feedback-badge.wrong { color: #e74c3c; text-shadow: 0 1px 3px rgba(0,0,0,0.3); }

.options-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 12px;
}
.options-grid.tf-mode {
  grid-template-columns: 1fr 1fr;
}

.opt-btn {
  background: rgba(255, 248, 220, 0.9);
  border: 2px solid #e0d0a0;
  border-radius: 14px;
  padding: 14px 10px;
  font-size: 12px;
  font-weight: 700;
  color: #333;
  cursor: pointer;
  min-height: 70px;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  transition: all 0.15s ease;
  user-select: none;
}
.opt-btn:hover {
  background: #fff;
  border-color: var(--primary-blue);
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(0,0,0,0.1);
}
.opt-btn.selected {
  background: #3498db;
  color: #fff;
  border-color: #2980b9;
}
.opt-btn:disabled {
  pointer-events: none;
}

/* Results Screen */
.result-card {
  background: rgba(255, 255, 255, 0.94);
  border-radius: 18px;
  padding: 18px;
  margin: 12px 0;
  border: 3px solid;
  text-align: center;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.12);
}

.stars-row {
  display: flex;
  justify-content: center;
  gap: 6px;
  margin: 10px 0;
}
.star-icon {
  width: 36px;
  height: 36px;
  object-fit: contain;
}

.result-badge-title {
  font-size: 16px;
  font-weight: 800;
  margin: 6px 0;
}
.result-level-title {
  font-size: 13px;
  font-weight: 700;
  color: #444;
}
.result-motivation {
  font-size: 12px;
  color: #333;
  line-height: 1.4;
  margin: 10px 0;
  font-style: italic;
}
.result-quote {
  font-size: 11px;
  font-style: italic;
  color: #1e5e34;
  margin: 8px 0 16px 0;
  text-align: center;
}

/* Badges & Leaderboard screen */
.tab-row {
  display: flex;
  gap: 8px;
  margin: 12px 0;
}
.tab-btn {
  flex: 1;
  padding: 8px;
  background: rgba(255, 255, 255, 0.6);
  border: none;
  border-radius: 8px;
  font-weight: 700;
  font-size: 13px;
  cursor: pointer;
  color: #333;
}
.tab-btn.active {
  background: var(--primary-purple);
  color: #fff;
}

.records-scroll {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding-right: 4px;
  margin-bottom: 12px;
}
.record-card {
  background: var(--bg-card);
  border-radius: 12px;
  padding: 12px;
  border-left: 5px solid;
  box-shadow: 0 4px 8px rgba(0,0,0,0.06);
}
.record-card-gold { border-left-color: #daa520; }
.record-card-silver { border-left-color: #a0a0a0; }
.record-card-bronze { border-left-color: #b87333; }
.record-card-rookie { border-left-color: #333; }

.table-wrapper {
  flex: 1;
  background: #fff;
  border-radius: 12px;
  overflow: auto;
  margin-bottom: 12px;
  border: 1px solid #ddd;
}
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}
th, td {
  padding: 8px 10px;
  text-align: left;
  border-bottom: 1px solid #eee;
}
th {
  background: #f8f9fa;
  font-weight: 700;
  color: #333;
}
