/* style.css - main stylesheet importing modular css */
@import url('battle.css');
@import url('modal.css');
@import url('fanfare.css');

:root {
  --bg: #1a1a24;
  --panel: #2a2a3b;
  --accent: #ffcc00;
  --danger: #ff4444;
  --success: #00cc66;
  --text: #ffffff;
  --font-main: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

body {
  background: #000;
  color: var(--text);
  font-family: var(--font-main);
}

#stage {
  --stage-w: 430px;
  --stage-h: 745px;
  background: var(--bg);
  display: flex;
  flex-direction: column;
  position: relative;
  overflow: hidden;
}

#top-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.6rem 0.8rem;
  gap: 0.5rem;
  font-size: 1rem;
  font-weight: 700;
  background: rgba(0,0,0,0.35);
  border-bottom: 2px solid var(--panel);
}

#hero-buffs {
  display: flex;
  gap: 4px;
  font-size: 1.1rem;
}

.hud-stats {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 2px;
  font-size: 0.85rem;
  line-height: 1.1;
  text-align: right;
}

.hud-stats #gold { color: #ffd86b; }

#hero-level {
  color: #66ccff;
}

#xp-bar-bg {
  width: 110px;
  height: 8px;
  background: var(--panel);
  border: 2px solid #000;
  border-radius: 5px;
  overflow: hidden;
  margin-top: 2px;
}

#xp-bar-fill {
  width: 0%;
  height: 100%;
  background: linear-gradient(90deg, #66ccff, #0066ff);
  transition: width 0.3s ease;
}

.icon-btn {
  background: transparent;
  border: none;
  font-size: 1.3rem;
  cursor: pointer;
  padding: 4px;
  border-radius: 6px;
  line-height: 1;
  transition: transform 0.1s ease;
}

.icon-btn:active {
  transform: scale(0.85);
}

#problem-area {
  text-align: center;
  padding: 0.8rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.1rem;
}

.equation-wrap {
  position: relative;
}

.equation-wrap.hidden {
  display: none;
}

.eq-label {
  display: none;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 3px;
  color: #888;
}

#problem-area.double .eq-label {
  display: block;
}

.equation-wrap.active .eq-label {
  color: var(--accent);
  text-shadow: 0 0 8px rgba(255, 204, 0, 0.6);
}

.equation-wrap.active h2 {
  color: var(--accent);
  text-shadow: 0 0 20px rgba(255, 204, 0, 0.45);
}

.equation-wrap.solved h2 {
  color: #5fbf77;
  text-decoration: line-through;
  opacity: 0.85;
}

#equation, #equation2, #equation3 {
  font-size: 3.2rem;
  margin: 0;
  font-weight: 900;
  color: var(--text);
  text-shadow: 0 4px 10px rgba(0,0,0,0.5);
}

#problem-area.double #equation,
#problem-area.double #equation2,
#problem-area.double #equation3 {
  font-size: 1.95rem;
}

#answers-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  padding: 1.2rem;
  margin-bottom: env(safe-area-inset-bottom);
}

.answer-btn {
  background: var(--panel);
  border: 2px solid #444;
  color: var(--text);
  font-family: var(--font-main);
  font-size: 2rem;
  font-weight: 700;
  padding: 1.3rem 1rem;
  border-radius: 12px;
  box-shadow: 0 4px 0 #111;
  cursor: pointer;
  transition: transform 0.1s, box-shadow 0.1s, background 0.2s;
  appearance: none;
  -webkit-appearance: none;
}

.answer-btn:active {
  transform: translateY(4px);
  box-shadow: 0 0 0 #111;
}

.answer-btn.correct {
  background: var(--success);
  border-color: #00994d;
}

.answer-btn.wrong {
  background: var(--danger);
  border-color: #cc0000;
}

.answer-btn.hidden {
  visibility: hidden;
  pointer-events: none;
}

/* Screen shake for damage */
#stage.damage-shake {
  animation: stage-shake 0.35s ease-in-out;
}

@keyframes stage-shake {
  0% { transform: translate(0, 0); }
  20% { transform: translate(-8px, 6px); }
  40% { transform: translate(8px, -6px); }
  60% { transform: translate(-6px, -4px); }
  80% { transform: translate(6px, 4px); }
  100% { transform: translate(0, 0); }
}

/* Keypad styles for Sorcerer Boss */
#keypad-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 0 1rem 0.5rem;
  gap: 0.4rem;
}

#keypad-container.hidden {
  display: none !important;
}

#keypad-display {
  width: 100%;
  max-width: 260px;
  height: 40px;
  background: rgba(0, 0, 0, 0.5);
  border: 2px solid #a855f7;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  font-weight: 800;
  color: #ffcc00;
  box-shadow: 0 0 10px rgba(168, 85, 247, 0.4);
}

.keypad-cursor {
  animation: blink 0.8s infinite;
  margin-left: 2px;
}

@keyframes blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0; }
}

#keypad-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.4rem;
  width: 100%;
  max-width: 260px;
}

.keypad-btn {
  background: var(--panel);
  color: var(--text);
  border: 2px solid #555;
  border-radius: 8px;
  padding: 0.5rem 0;
  font-size: 1.25rem;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.05s ease, background 0.15s ease;
}

.keypad-btn:active {
  transform: scale(0.92);
  background: #4a4a6b;
}

.keypad-btn.action-key {
  background: #4b2a2a;
  border-color: #aa4444;
  color: #ff9999;
}

.keypad-btn.submit-key {
  background: #2a4b35;
  border-color: #22c55e;
  font-size: 1.2rem;
}
