/* ============================================================
   AGIF — Style Global (Warm Playful)
   Main Game, Dapat Ilmu
   ============================================================ */

/* ===== RESET & BASE ===== */
*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  /* Palette */
  --bg-main: #FDF6E3;
  --bg-card: #FFFFFF;
  --primary: #F59E0B;
  --primary-dark: #D97706;
  --secondary: #3B82F6;
  --success: #22C55E;
  --soft-warning: #FED7AA;
  --text-main: #3E2723;
  --text-sub: #78716C;
  --border: #E7D4B5;
  --shadow-sm: 0 2px 6px rgba(62, 39, 35, 0.06);
  --shadow-md: 0 4px 16px rgba(62, 39, 35, 0.08);
  --shadow-lg: 0 8px 28px rgba(62, 39, 35, 0.12);
  --radius-sm: 12px;
  --radius-md: 20px;
  --radius-lg: 28px;

  /* Character Colors */
  --agif: #F59E0B;
  --lean: #3B82F6;
  --zeya: #EC4899;
  --arkhan: #A16207;
  --dovy: #A855F7;
  --unni: #22C55E;
  --radjo: #F97316;
}

html, body {
  height: 100%;
  font-family: 'Nunito', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg-main);
  color: var(--text-main);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Subtle background pattern */
body::before {
  content: '';
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background-image:
    radial-gradient(circle at 20% 30%, rgba(245, 158, 11, 0.06) 0%, transparent 40%),
    radial-gradient(circle at 80% 70%, rgba(236, 72, 153, 0.05) 0%, transparent 40%),
    radial-gradient(circle at 50% 90%, rgba(34, 197, 94, 0.04) 0%, transparent 40%);
  pointer-events: none;
  z-index: 0;
}

/* ===== LAYOUT ===== */
.app-container {
  position: relative;
  z-index: 1;
  min-height: 100%;
  max-width: 720px;
  margin: 0 auto;
  padding: 32px 20px 24px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

/* ===== HEADER ===== */
.app-header {
  text-align: center;
  padding: 12px 0;
}

.logo-area {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
}

.logo-icon {
  font-size: 40px;
  line-height: 1;
  animation: float 3s ease-in-out infinite;
}

.logo-text {
  font-family: 'Poppins', sans-serif;
  font-weight: 700;
  font-size: 42px;
  color: var(--primary);
  letter-spacing: 2px;
  text-shadow: 2px 2px 0 rgba(245, 158, 11, 0.15);
}

.tagline {
  font-family: 'Poppins', sans-serif;
  font-weight: 500;
  font-size: 15px;
  color: var(--text-sub);
  letter-spacing: 0.5px;
}

/* ===== SUBTITLE ===== */
.subtitle {
  text-align: center;
  font-size: 16px;
  color: var(--text-sub);
  font-weight: 600;
}

/* ===== GRID KARAKTER ===== */
.guides-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 14px;
  margin-top: 8px;
}

@media (min-width: 560px) {
  .guides-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
  }
}

/* Kartu Karakter */
.guide-card {
  background: var(--bg-card);
  border-radius: var(--radius-md);
  padding: 18px 12px;
  text-align: center;
  box-shadow: var(--shadow-sm);
  border: 2px solid transparent;
  cursor: pointer;
  transition: all 0.25s ease;
  position: relative;
  overflow: hidden;
}

.guide-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 4px;
  background: var(--accent, var(--primary));
}

.guide-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-md);
  border-color: var(--accent, var(--primary));
}

.guide-card:active {
  transform: translateY(-1px);
}

.guide-avatar {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  object-fit: cover;
  margin: 0 auto 10px;
  display: block;
  border: 3px solid var(--accent, var(--primary));
  background: var(--bg-main);
  transition: transform 0.25s ease;
}

.guide-card:hover .guide-avatar {
  transform: scale(1.06);
}

.guide-name {
  font-family: 'Poppins', sans-serif;
  font-weight: 600;
  font-size: 16px;
  color: var(--text-main);
  margin-bottom: 2px;
}

.guide-role {
  font-size: 11px;
  color: var(--text-sub);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  line-height: 1.3;
}

/* ===== DIVIDER ===== */
.divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 8px 0;
  color: var(--text-sub);
  font-size: 13px;
  font-weight: 600;
}

.divider::before,
.divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}

/* ===== LOGIN MANUAL ===== */
.login-manual {
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: var(--bg-card);
  padding: 20px;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
}

.login-label {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-main);
}

.login-input {
  width: 100%;
  padding: 14px 16px;
  font-size: 16px;
  font-family: 'Nunito', sans-serif;
  font-weight: 700;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--text-main);
  background: var(--bg-main);
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  outline: none;
  transition: border-color 0.2s ease;
  text-align: center;
}

.login-input:focus {
  border-color: var(--primary);
  background: #FFFFFF;
}

.login-input::placeholder {
  color: #B8A99A;
  letter-spacing: 1px;
  text-transform: none;
}

.btn-primary {
  width: 100%;
  padding: 15px 20px;
  font-family: 'Poppins', sans-serif;
  font-size: 16px;
  font-weight: 700;
  color: #FFFFFF;
  background: var(--primary);
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(245, 158, 11, 0.35);
  transition: all 0.2s ease;
  letter-spacing: 0.5px;
}

.btn-primary:hover {
  background: var(--primary-dark);
  box-shadow: 0 6px 16px rgba(245, 158, 11, 0.45);
  transform: translateY(-2px);
}

.btn-primary:active {
  transform: translateY(0);
}

.btn-primary:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

.login-hint {
  font-size: 12px;
  color: var(--text-sub);
  text-align: center;
  font-weight: 600;
}

/* ===== FOOTER ===== */
.app-footer {
  text-align: center;
  margin-top: auto;
  padding-top: 20px;
  color: var(--text-sub);
  font-size: 13px;
}

.app-footer strong {
  color: var(--primary);
  font-weight: 700;
}

.footer-tagline {
  font-family: 'Poppins', sans-serif;
  font-size: 11px;
  letter-spacing: 0.5px;
  margin-top: 2px;
  opacity: 0.8;
}

/* ===== NOTIFICATION / TOAST ===== */
.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(100px);
  background: var(--text-main);
  color: #FFFFFF;
  padding: 12px 20px;
  border-radius: var(--radius-sm);
  font-weight: 700;
  font-size: 14px;
  box-shadow: var(--shadow-lg);
  opacity: 0;
  transition: all 0.35s ease;
  z-index: 999;
  max-width: 90vw;
  text-align: center;
}

.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.toast.error {
  background: #DC2626;
}

.toast.success {
  background: var(--success);
}

/* ===== ANIMASI ===== */
@keyframes float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-6px); }
}

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

.guide-card {
  animation: fadeIn 0.4s ease backwards;
}

.guide-card:nth-child(1) { animation-delay: 0.05s; }
.guide-card:nth-child(2) { animation-delay: 0.10s; }
.guide-card:nth-child(3) { animation-delay: 0.15s; }
.guide-card:nth-child(4) { animation-delay: 0.20s; }
.guide-card:nth-child(5) { animation-delay: 0.25s; }
.guide-card:nth-child(6) { animation-delay: 0.30s; }
.guide-card:nth-child(7) { animation-delay: 0.35s; }

/* ===== LOADING ===== */
.loading {
  display: inline-block;
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255,255,255,0.3);
  border-top-color: #FFFFFF;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  margin-right: 8px;
  vertical-align: middle;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ===== PETA HEADER ===== */
.peta-header {
  display: flex;
  align-items: center;
  gap: 14px;
  background: var(--bg-card);
  padding: 14px 18px;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
}

.btn-back {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: none;
  background: var(--bg-main);
  color: var(--text-main);
  font-size: 20px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s ease;
  flex-shrink: 0;
}

.btn-back:hover {
  background: var(--border);
}

.user-info {
  flex: 1;
  min-width: 0;
}

.user-greeting {
  font-family: 'Poppins', sans-serif;
  font-weight: 600;
  font-size: 16px;
  color: var(--text-main);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.user-stats {
  display: flex;
  gap: 10px;
  font-size: 12px;
  color: var(--text-sub);
  font-weight: 700;
  margin-top: 2px;
}

.user-stats span {
  background: var(--bg-main);
  padding: 2px 8px;
  border-radius: 999px;
}

.logo-mini {
  font-size: 28px;
  line-height: 1;
  flex-shrink: 0;
}

.peta-title {
  text-align: center;
  padding: 0 8px;
}

.peta-title h2 {
  font-family: 'Poppins', sans-serif;
  font-weight: 700;
  font-size: 22px;
  color: var(--text-main);
  margin-bottom: 4px;
}

/* ===== MISI PAGE ===== */
.dunia-avatar-mini { flex-shrink: 0; }
.misi-list { display: flex; flex-direction: column; gap: 12px; }
.misi-card { background: var(--bg-card); border-radius: var(--radius-md); padding: 16px 18px; box-shadow: var(--shadow-sm); border-left: 5px solid var(--accent, var(--primary)); cursor: pointer; transition: all 0.2s ease; }
.misi-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.misi-card:active { transform: translateY(0); }
.misi-card-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.misi-badge { background: var(--accent, var(--primary)); color: white; font-size: 11px; font-weight: 700; padding: 3px 10px; border-radius: 999px; text-transform: uppercase; letter-spacing: 0.5px; }
.misi-kelas { font-size: 12px; font-weight: 700; color: var(--text-sub); }
.misi-title { font-family: 'Poppins', sans-serif; font-weight: 600; font-size: 16px; color: var(--text-main); margin-bottom: 6px; }
.misi-meta { font-size: 12px; color: var(--text-sub); font-weight: 600; margin-bottom: 8px; }
.misi-cta { font-size: 12px; font-weight: 700; color: var(--accent, var(--primary)); text-align: right; }
.loading-box { text-align: center; padding: 40px 20px; color: var(--text-sub); font-weight: 600; }

/* ===== GAME ===== */
.game-area { flex: 1; }
.soal-card { background: var(--bg-card); border-radius: var(--radius-md); padding: 20px; box-shadow: var(--shadow-sm); }
.progress-bar { height: 6px; background: var(--bg-main); border-radius: 999px; overflow: hidden; margin-bottom: 18px; }
.progress-fill { height: 100%; background: var(--primary); border-radius: 999px; transition: width 0.4s ease; }
.soal-pertanyaan { font-family: 'Poppins', sans-serif; font-weight: 600; font-size: 17px; line-height: 1.5; color: var(--text-main); margin-bottom: 18px; }
.opsi-list { display: flex; flex-direction: column; gap: 10px; }
.opsi-btn { display: flex; align-items: center; gap: 12px; padding: 14px 16px; background: var(--bg-main); border: 2px solid var(--border); border-radius: var(--radius-sm); text-align: left; cursor: pointer; transition: all 0.2s ease; font-family: 'Nunito', sans-serif; font-size: 15px; font-weight: 600; color: var(--text-main); }
.opsi-btn:hover:not(:disabled) { border-color: var(--primary); background: #FFF8E7; }
.opsi-btn:disabled { opacity: 0.6; cursor: not-allowed; }
.opsi-label { width: 32px; height: 32px; border-radius: 50%; background: var(--primary); color: white; display: flex; align-items: center; justify-content: center; font-weight: 700; flex-shrink: 0; }
.opsi-text { flex: 1; }
.input-area { display: flex; flex-direction: column; gap: 12px; }
.feedback-box { margin-top: 16px; padding: 16px; border-radius: var(--radius-sm); display: flex; gap: 12px; animation: fadeIn 0.3s ease; }
.feedback-benar { background: #DCFCE7; border-left: 4px solid var(--success); }
.feedback-coba { background: var(--soft-warning); border-left: 4px solid var(--primary); }
.feedback-icon { font-size: 32px; line-height: 1; }
.feedback-text strong { font-family: 'Poppins', sans-serif; font-size: 16px; color: var(--text-main); display: block; margin-bottom: 4px; }
.feedback-text p { font-size: 14px; color: var(--text-main); }
.level-complete { background: var(--bg-card); border-radius: var(--radius-md); padding: 32px 20px; text-align: center; box-shadow: var(--shadow-md); }
.complete-icon { font-size: 64px; margin-bottom: 8px; animation: float 2s ease-in-out infinite; }
.level-complete h2 { font-family: 'Poppins', sans-serif; font-size: 24px; color: var(--text-main); margin-bottom: 12px; }
.bintang-besar { font-size: 40px; letter-spacing: 4px; margin-bottom: 12px; }
.complete-xp { font-family: 'Poppins', sans-serif; font-size: 22px; font-weight: 700; color: var(--primary); margin-bottom: 8px; }
.complete-pesan { font-size: 14px; color: var(--text-sub); margin-bottom: 20px; }
.complete-actions { display: flex; flex-direction: column; gap: 10px; }
.btn-secondary { padding: 14px 20px; font-family: 'Poppins', sans-serif; font-size: 15px; font-weight: 600; color: var(--text-main); background: var(--bg-main); border: 2px solid var(--border); border-radius: var(--radius-sm); cursor: pointer; transition: all 0.2s ease; }
.btn-secondary:hover { background: var(--border); }

/* ===== AUTH TABS ===== */
.auth-tabs {
  display: flex;
  gap: 8px;
  background: var(--bg-main);
  padding: 6px;
  border-radius: var(--radius-sm);
  border: 2px solid var(--border);
}

.auth-tab {
  flex: 1;
  padding: 12px 8px;
  font-family: 'Poppins', sans-serif;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-sub);
  background: transparent;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.auth-tab.active {
  background: var(--bg-card);
  color: var(--text-main);
  box-shadow: var(--shadow-sm);
}

.auth-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
  background: var(--bg-card);
  padding: 20px;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
}

/* Mini Guides */
.mini-guides {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 4px 0;
  scrollbar-width: none;
}

.mini-guides::-webkit-scrollbar { display: none; }

.mini-guide {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 8px;
  border-radius: 12px;
  border: 2px solid transparent;
  cursor: pointer;
  background: var(--bg-main);
  flex-shrink: 0;
  min-width: 70px;
  transition: all 0.2s ease;
}

.mini-guide.active {
  border-color: var(--accent, var(--primary));
  background: #FFF8E7;
}

.mini-guide img {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--accent, var(--primary));
}

.mini-guide span {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-main);
}

/* ===== MODAL ===== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(62, 39, 35, 0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 9999;
  animation: fadeIn 0.3s ease;
}

.modal-box {
  background: var(--bg-card);
  border-radius: var(--radius-md);
  padding: 28px 24px;
  max-width: 400px;
  width: 100%;
  text-align: center;
  box-shadow: var(--shadow-lg);
  animation: fadeIn 0.4s ease;
}

.modal-icon {
  font-size: 56px;
  margin-bottom: 8px;
  animation: float 2s ease-in-out infinite;
}

.modal-box h2 {
  font-family: 'Poppins', sans-serif;
  font-size: 22px;
  color: var(--text-main);
  margin-bottom: 8px;
}

.modal-desc {
  font-size: 14px;
  color: var(--text-sub);
  margin-bottom: 16px;
}

.kode-besar {
  font-family: 'Poppins', sans-serif;
  font-size: 32px;
  font-weight: 700;
  letter-spacing: 4px;
  color: var(--primary);
  background: var(--bg-main);
  padding: 18px;
  border-radius: var(--radius-sm);
  border: 2px dashed var(--primary);
  margin-bottom: 12px;
}

.modal-hint {
  font-size: 12px;
  color: var(--text-sub);
  margin-bottom: 20px;
  font-weight: 600;
}

/* ===== TRUE / FALSE ===== */
.tf-list { display: flex; flex-direction: column; gap: 12px; margin-top: 8px; }
.tf-item { background: var(--bg-main); padding: 14px; border-radius: var(--radius-sm); border-left: 4px solid var(--border); }
.tf-text { font-size: 14px; font-weight: 600; color: var(--text-main); margin-bottom: 10px; line-height: 1.5; }
.tf-buttons { display: flex; gap: 8px; }
.tf-btn { flex: 1; padding: 10px; font-family: 'Nunito', sans-serif; font-size: 13px; font-weight: 700; border-radius: 8px; border: 2px solid var(--border); background: var(--bg-card); color: var(--text-main); cursor: pointer; transition: all 0.2s ease; }
.tf-btn:hover:not(:disabled) { border-color: var(--primary); }
.tf-btn.tf-benar.active { background: var(--success); color: white; border-color: var(--success); }
.tf-btn.tf-salah.active { background: #DC2626; color: white; border-color: #DC2626; }
.tf-btn:disabled { opacity: 0.6; cursor: not-allowed; }

/* ===== VOCABULARY MATCH ===== */
.vocab-match { display: flex; flex-direction: column; gap: 12px; margin-top: 8px; }
.vocab-item { background: var(--bg-main); padding: 12px 14px; border-radius: var(--radius-sm); border-left: 4px solid var(--primary); }
.vocab-term { font-family: 'Poppins', sans-serif; font-size: 15px; font-weight: 600; color: var(--text-main); margin-bottom: 8px; }
.vocab-select { width: 100%; padding: 10px 12px; font-family: 'Nunito', sans-serif; font-size: 13px; font-weight: 600; color: var(--text-main); background: var(--bg-card); border: 2px solid var(--border); border-radius: 8px; outline: none; }
.vocab-select:focus { border-color: var(--primary); }
.vocab-select:disabled { opacity: 0.6; }

/* ===== INVESTIGASI ===== */
.investigasi-box { display: flex; flex-direction: column; gap: 12px; margin-top: 8px; }
.investigasi-label { font-size: 14px; color: var(--text-main); }
.investigasi-steps { background: var(--bg-main); padding: 14px 18px 14px 36px; border-radius: var(--radius-sm); border-left: 4px solid var(--primary); font-size: 14px; line-height: 1.6; color: var(--text-main); }
.investigasi-steps li { margin-bottom: 4px; }

.soal-sentence {
  background: #FFF8E7;
  border-left: 4px solid var(--primary);
  padding: 16px 18px;
  border-radius: var(--radius-sm);
  font-family: 'Poppins', sans-serif;
  font-size: 17px;
  font-weight: 500;
  line-height: 1.6;
  color: var(--text-main);
  margin-bottom: 12px;
}

.soal-hint {
  font-size: 13px;
  color: var(--text-sub);
  font-weight: 600;
  background: var(--bg-main);
  padding: 8px 12px;
  border-radius: 8px;
  margin-bottom: 12px;
}

.logo-img-mini {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  object-fit: cover;
  box-shadow: 0 2px 8px rgba(245, 158, 11, 0.3);
  flex-shrink: 0;
}

.logo-img {
  width: 56px !important;
  height: 56px !important;
  max-width: 56px !important;
  max-height: 56px !important;
  border-radius: 14px;
  object-fit: cover;
  box-shadow: 0 4px 12px rgba(245, 158, 11, 0.35);
  animation: float 3s ease-in-out infinite;
  display: block;
}
