/* DuoPharma Mario — Frontend Game CSS */
@import url('https://fonts.googleapis.com/css2?family=Fira+Sans:wght@400;600;700;800;900&family=Fira+Mono:wght@600&display=swap');

#dpma-root {
  --cr: #DC143C;
  --cr-dark: #A50E2D;
  --cr-glow: rgba(220,20,60,0.35);
  --black: #0A0A0A;
  --dark: #141414;
  --card: #1A1A1A;
  --white: #FFFFFF;
  --gold: #FFD700;
  --green: #2ECC71;
  font-family: 'Fira Sans', sans-serif;
  background: #1a0a2e;
  border-radius: 8px;
  overflow: hidden;
  position: relative;
}

/* ---- Screens ---- */
.dpma-screen { width: 100%; }
.dpma-hidden { display: none !important; }

/* ---- World Select ---- */
#dpma-world-select { padding: 30px 20px; background: linear-gradient(160deg, #0d1b3e, #1a0a2e); min-height: 400px; }
.dpma-game-header { text-align: center; margin-bottom: 30px; }
.dpma-game-logo { font-size: 2rem; font-weight: 900; color: #fff; letter-spacing: -1px; }
.dpma-game-logo span { color: #DC143C; }
.dpma-game-sub { color: #888; font-size: 13px; margin-top: 4px; }

.dpma-units-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 16px; max-width: 900px; margin: 0 auto; }
.dpma-loading { color: #888; text-align: center; padding: 40px; grid-column: 1/-1; }

/* Section heading */
.dpma-section-heading { grid-column: 1/-1; color: #DC143C; font-size: 11px; font-weight: 800; letter-spacing: 2px; text-transform: uppercase; margin-top: 8px; }

/* Unit cards */
.dpma-unit-card {
  background: #1a1a2e; border: 2px solid #2a2a4e; border-radius: 16px;
  padding: 20px 16px; cursor: pointer; transition: all 0.2s ease;
  text-align: center; position: relative; overflow: hidden;
}
.dpma-unit-card:hover:not(.dpma-locked) { border-color: #DC143C; transform: translateY(-3px); box-shadow: 0 8px 24px rgba(220,20,60,0.3); }
.dpma-unit-card.dpma-locked { opacity: 0.5; cursor: not-allowed; }
.dpma-unit-card.dpma-completed { border-color: #2ECC71; }
.dpma-unit-card.dpma-completed::after { content: '✅'; position: absolute; top: 8px; right: 10px; font-size: 14px; }

.dpma-unit-icon { font-size: 2rem; margin-bottom: 8px; }
.dpma-unit-name { font-size: 14px; font-weight: 700; color: #fff; margin-bottom: 4px; }
.dpma-unit-section { font-size: 10px; color: #DC143C; font-weight: 800; letter-spacing: 1px; text-transform: uppercase; margin-bottom: 6px; }
.dpma-unit-desc { font-size: 11px; color: #888; line-height: 1.4; }
.dpma-unit-qs { font-size: 10px; color: #555; margin-top: 8px; }
.dpma-unit-score { font-size: 12px; color: #FFD700; font-weight: 700; margin-top: 4px; }
.dpma-lock-icon { font-size: 1.5rem; margin-bottom: 6px; }

/* ---- HUD ---- */
.dpma-hud {
  display: flex; justify-content: space-between; align-items: center;
  padding: 8px 16px; background: rgba(0,0,0,0.8);
  border-bottom: 2px solid #DC143C;
  pointer-events: none;
}
.dpma-hud-label { font-size: 9px; font-weight: 700; letter-spacing: 1px; text-transform: uppercase; color: #FFD700; }
.dpma-hud-val { font-size: 18px; font-weight: 800; color: #fff; text-shadow: 1px 1px 0 #000; }

/* ---- Canvas ---- */
#dpma-canvas { display: block; width: 100%; background: #0d1b3e; }

/* ---- Mobile Controls ---- */
.dpma-mobile-ctrl {
  display: none; justify-content: space-between; padding: 8px 12px;
  background: rgba(0,0,0,0.6);
}
.dpma-ctrl-group { display: flex; gap: 8px; }
.dpma-ctrl-btn {
  width: 52px; height: 52px; border-radius: 12px;
  background: rgba(255,255,255,0.1); border: 2px solid rgba(255,255,255,0.2);
  color: #fff; font-size: 18px; cursor: pointer; user-select: none;
  -webkit-user-select: none; display: flex; align-items: center; justify-content: center;
  transition: background 0.1s;
}
.dpma-ctrl-btn:active { background: rgba(220,20,60,0.5); }
@media (max-width: 600px) { .dpma-mobile-ctrl { display: flex; } }

/* ---- Quiz Overlay ---- */
.dpma-quiz-overlay {
  position: fixed; top: 0; left: 0; width: 100%; height: 100%;
  background: rgba(0,0,0,0.88);
  display: flex; align-items: flex-start; justify-content: center;
  z-index: 50; padding: 16px;
  overflow-y: auto;
}
.dpma-quiz-box {
  background: #1a1a2e; border: 3px solid #DC143C; border-radius: 16px;
  padding: 22px; max-width: 440px; width: 100%;
  box-shadow: 0 0 40px rgba(220,20,60,0.4);
  animation: dpmaQuizPop 0.3s cubic-bezier(.17,.67,.35,1.3);
  margin: auto;
  flex-shrink: 0;
}
@keyframes dpmaQuizPop { from{transform:scale(0.7);opacity:0} to{transform:scale(1);opacity:1} }
.dpma-quiz-header { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.dpma-quiz-icon { font-size: 1.8rem; }
.dpma-quiz-cat { font-size: 10px; font-weight: 800; letter-spacing: 1px; text-transform: uppercase; color: #DC143C; background: rgba(220,20,60,0.12); border: 1px solid rgba(220,20,60,0.3); padding: 3px 10px; border-radius: 20px; }
.dpma-timer-bar-wrap { height: 5px; background: #222; border-radius: 3px; margin-bottom: 14px; overflow: hidden; }
.dpma-timer-bar { height: 100%; background: #DC143C; border-radius: 3px; transition: width 0.1s linear; width: 100%; }
.dpma-quiz-q { color: #fff; font-size: 14px; font-weight: 600; line-height: 1.5; margin-bottom: 14px; }
.dpma-quiz-opts { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 12px; }
.dpma-quiz-opt {
  background: #0d0d1a; border: 2px solid #333; border-radius: 10px;
  padding: 10px 10px; color: #fff; font-size: 12px; font-weight: 600;
  cursor: pointer; text-align: left; display: flex; align-items: center; gap: 7px;
  transition: all 0.12s; font-family: 'Fira Sans', sans-serif; line-height: 1.3;
}
.dpma-quiz-opt:hover:not(:disabled) { border-color: #DC143C; background: #1a0010; }
.dpma-quiz-opt.correct { border-color: #2ecc71; background: rgba(46,204,113,0.12); color: #2ecc71; }
.dpma-quiz-opt.wrong { border-color: #DC143C; background: rgba(220,20,60,0.12); color: #ff6b80; }
.dpma-opt-letter { width: 20px; height: 20px; border-radius: 5px; background: #222; display: flex; align-items: center; justify-content: center; font-size: 10px; font-weight: 800; flex-shrink: 0; }
.dpma-quiz-opt.correct .dpma-opt-letter { background: #2ecc71; color: #000; }
.dpma-quiz-opt.wrong .dpma-opt-letter { background: #DC143C; color: #fff; }
.dpma-quiz-fb { padding: 10px 12px; border-radius: 8px; font-size: 12px; font-weight: 600; line-height: 1.4; display: none; }
.dpma-quiz-fb.show { display: block; }
.dpma-quiz-fb.ok { background: rgba(46,204,113,0.1); border: 1px solid rgba(46,204,113,0.4); color: #2ecc71; }
.dpma-quiz-fb.no { background: rgba(220,20,60,0.1); border: 1px solid rgba(220,20,60,0.4); color: #ff6b80; }
.dpma-quiz-fb small { display: block; color: #888; font-weight: 400; margin-top: 4px; font-size: 11px; }
.dpma-quiz-cont { width: 100%; margin-top: 10px; padding: 11px; background: #DC143C; border: none; border-radius: 8px; color: #fff; font-size: 13px; font-weight: 800; cursor: pointer; font-family: 'Fira Sans', sans-serif; transition: background 0.15s; }
.dpma-quiz-cont:hover { background: #e8183e; }

/* ---- Result Overlay ---- */
.dpma-result-overlay {
  position: absolute; top: 0; left: 0; width: 100%; height: 100%;
  background: rgba(0,0,0,0.92); display: flex; align-items: center; justify-content: center; z-index: 60;
}
.dpma-result-box { text-align: center; padding: 30px 24px; max-width: 360px; width: 100%; }
.dpma-result-icon { font-size: 3rem; margin-bottom: 6px; }
.dpma-result-title { font-size: 1.6rem; font-weight: 900; color: #fff; margin-bottom: 10px; }
.dpma-result-score { font-size: 3.5rem; font-weight: 900; color: #DC143C; text-shadow: 0 0 40px rgba(220,20,60,0.5); }
.dpma-result-label { font-size: 10px; color: #888; text-transform: uppercase; letter-spacing: 1px; margin-bottom: 24px; }
.dpma-result-stats { display: grid; grid-template-columns: repeat(3,1fr); gap: 12px; margin-bottom: 24px; }
.dpma-rs { background: #1a1a2e; border: 1px solid #2a2a4e; border-radius: 12px; padding: 14px 8px; }
.dpma-rs-val { font-size: 1.5rem; font-weight: 800; color: #fff; }
.dpma-rs-lbl { font-size: 10px; color: #888; text-transform: uppercase; }
.dpma-result-btns { display: flex; gap: 10px; justify-content: center; }
.dpma-game-btn { padding: 12px 28px; border-radius: 10px; font-size: 13px; font-weight: 800; cursor: pointer; border: none; font-family: 'Fira Sans', sans-serif; transition: all 0.15s; }
.dpma-game-btn-primary { background: #DC143C; color: #fff; box-shadow: 0 4px 16px rgba(220,20,60,0.4); }
.dpma-game-btn-primary:hover { background: #e8183e; transform: translateY(-1px); }
.dpma-game-btn-outline { background: transparent; border: 2px solid #444; color: #888; }
.dpma-game-btn-outline:hover { border-color: #DC143C; color: #fff; }

/* Points popup */
.dpma-pts-pop { position: absolute; font-size: 15px; font-weight: 900; color: #FFD700; text-shadow: 1px 1px 0 #000; pointer-events: none; z-index: 40; animation: dpmaPtsFloat 0.9s ease-out forwards; }
@keyframes dpmaPtsFloat { 0%{opacity:1;transform:translateY(0)} 100%{opacity:0;transform:translateY(-50px)} }
