/* iOS ZOOM PREVENTION & RESET */
html, body { touch-action: pan-x pan-y; -webkit-text-size-adjust: 100%; }
* { box-sizing: border-box; margin: 0; padding: 0; }
button, input, a, .upgrade-card, .tarot-card, .orb-wrapper { touch-action: manipulation; user-select: none; }

body { background: #0a0812; color: #e2daf0; font-family: 'VT323', monospace; display: flex; justify-content: center; align-items: flex-start; min-height: 100vh; overflow-x: hidden; }
.game-wrapper { display: flex; gap: 20px; width: 100%; max-width: 850px; padding: 20px; margin-top: 40px; }
.hidden { display: none !important; }

/* MODALS & PANELS */
.fullscreen-panel { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: #0a0812; display: flex; flex-direction: column; justify-content: center; align-items: center; text-align: center; z-index: 100; overflow-y: auto; padding: 20px; }
.modal { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.85); display: flex; justify-content: center; align-items: center; z-index: 200; }
.modal-content { background: #141021; border: 4px solid #d8b4fe; padding: 30px; width: 90%; max-width: 500px; text-align: center; box-shadow: 0 10px 40px rgba(0,0,0,0.8); border-radius: 12px; }
.game-title { font-size: 4rem; color: #d8b4fe; text-shadow: 4px 4px 0 #6b21a8; margin-bottom: 20px; }
.intro-text { font-size: 1.5rem; color: #a79fc2; margin: 20px 0; max-width: 600px; line-height: 1.5; }
.input-group { display: flex; flex-direction: column; gap: 15px; width: 300px; margin: 0 auto; }
input[type="text"] { background: #1a162b; border: 2px solid #6d28d9; color: #fff; font-family: 'VT323', monospace; font-size: 1.5rem; padding: 12px; text-align: center; outline: none; border-radius: 8px;}
.primary-btn { background: #7e22ce; color: white; border: 4px solid #9333ea; padding: 12px 20px; font-size: 1.5rem; font-family: 'VT323', monospace; cursor: pointer; text-transform: uppercase; transition: 0.1s; border-radius: 8px;}
.primary-btn:active { transform: translateY(4px); }
.close-btn { margin-top: 15px; background: #333; color: white; border: 4px solid #555; padding: 12px 20px; font-family: 'VT323', monospace; font-size: 1.2rem; cursor: pointer; text-transform: uppercase; border-radius: 8px;}
.close-btn:active { transform: translateY(4px); }

/* SIDE MENU */
#menuToggle { position: fixed; top: 15px; right: 20px; font-size: 2.5rem; color: #d8b4fe; cursor: pointer; z-index: 50; }
.side-menu { position: fixed; top: 60px; right: 20px; background: #141021; border: 2px solid #3d345e; padding: 15px; display: flex; flex-direction: column; gap: 10px; z-index: 49; box-shadow: -5px 5px 0 rgba(0,0,0,0.5); border-radius: 8px;}
.side-menu button, .side-menu a { background: #2d2647; color: #e2daf0; border: 2px solid #4a3e75; padding: 10px; font-family: 'VT323', monospace; font-size: 1.2rem; cursor: pointer; text-decoration: none; text-align: center; border-radius: 4px;}
.side-menu button:hover, .side-menu a:hover { background: #4a3e75; }
.danger-btn { color: #ef4444 !important; border-color: #7f1d1d !important; }

/* WIZARD PANEL & ARCANE ORB */
.wizard-panel { flex: 1; background: #141021; border: 4px solid #3d345e; padding: 30px; display: flex; flex-direction: column; align-items: center; text-align: center; position: relative; border-radius: 12px;}
.player-name-tag { position: absolute; top: -18px; background: #0a0812; padding: 0 15px; border: 2px solid #3d345e; color: #a79fc2; border-radius: 8px;}
.avatar-container { width: 120px; height: 120px; background: #1a162b; border: 4px solid #4a3e75; display: flex; justify-content: center; align-items: center; margin-bottom: 16px; margin-top: 10px; border-radius: 50%; box-shadow: 0 0 20px rgba(138, 92, 235, 0.4);}
.emoji-wizard { font-size: 4.5rem; animation: float 3s ease-in-out infinite; }
#wizardTitle { color: #d8b4fe; font-size: 2rem; margin-bottom: 24px; text-transform: uppercase; }

.evolution-container { width: 100%; position: relative; background: #0a0812; border: 4px solid #4a3e75; height: 40px; margin-bottom: 24px; cursor: pointer; overflow: hidden; border-radius: 8px;}
.evolution-container.ready { border-color: #10b981; }
.progress-bar-bg { width: 100%; height: 100%; position: absolute; }
.progress-fill { height: 100%; background: #6b21a8; width: 0%; transition: width 0.3s ease; }
.evolution-container.ready .progress-fill { background: #059669; }
.evolution-text { position: absolute; width: 100%; line-height: 32px; font-size: 1.2rem; text-shadow: 2px 2px 0 #000; z-index: 2; pointer-events: none; }

.mana-display { margin-bottom: 24px; }
.mana-count { font-size: 4rem; color: #fff; text-shadow: 4px 4px 0 #6b21a8; }
.mana-label { color: #a79fc2; font-size: 1.2rem; }

/* THE ARCANE ORB */
.orb-wrapper { background: #1a162b; border: 4px dashed #7e22ce; width: 100%; padding: 30px 20px; cursor: pointer; display: flex; flex-direction: column; align-items: center; justify-content: center; transition: background 0.2s; border-radius: 12px;}
.orb-wrapper:active { background: #2d2647; border-color: #d8b4fe; }
.arcane-orb { width: 80px; height: 80px; border-radius: 50%; background: radial-gradient(circle at 30% 30%, #e879f9, #7e22ce, #3b0764); box-shadow: 0 0 20px #9333ea, inset 0 0 15px #fdf4ff; animation: orbPulse 3s infinite alternate; transition: transform 0.1s, box-shadow 0.1s; }
.orb-wrapper:active .arcane-orb { transform: scale(0.9); box-shadow: 0 0 40px #fdf4ff, inset 0 0 30px #fdf4ff; animation: none; }
@keyframes orbPulse { 0% { transform: scale(1); box-shadow: 0 0 15px #9333ea; } 100% { transform: scale(1.05); box-shadow: 0 0 25px #d8b4fe; } }
.wand-text { font-size: 1.5rem; color: #d8b4fe; margin-top: 15px; pointer-events: none; }

.action-btn { color: white; border: 4px solid; padding: 12px; font-family: 'VT323', monospace; font-size: 1.4rem; cursor: pointer; border-radius: 8px;}
.action-btn:active { transform: translateY(4px); }
.genie-theme { background: #0284c7; border-color: #38bdf8; }

/* PET PANEL */
.pet-panel { margin-top: 20px; width: 100%; background: #1a162b; border: 4px dashed #10b981; padding: 15px; border-radius: 12px;}
.pet-header { display: flex; align-items: center; margin-bottom: 10px; }
.pet-icon { font-size: 3.5rem; margin-right: 15px; animation: float 3s infinite alternate; }
.pet-info { text-align: left; }
.pet-info h4 { color: #34d399; font-size: 1.5rem; margin-bottom: 2px; }
.pet-info p { color: #a79fc2; font-size: 1.1rem; }
.pet-btn { background: #059669; color: white; border: 4px solid #10b981; width: 100%; padding: 10px; font-family: 'VT323', monospace; font-size: 1.2rem; cursor: pointer; border-radius: 8px;}
.pet-btn:active:not(:disabled) { transform: translateY(4px); }
.pet-choices { display: flex; justify-content: center; gap: 15px; margin: 20px 0; }
.pet-choices button { font-size: 1.5rem; padding: 15px 10px; background: #1a162b; border: 4px solid #10b981; color: white; font-family: 'VT323', monospace; cursor: pointer; display: flex; flex-direction: column; align-items: center; gap: 5px; border-radius: 8px;}
.pet-choices button:hover { background: #064e3b; }

/* SHOP */
.shop-panel { flex: 1; background: #141021; border: 4px solid #362c54; padding: 24px; display: flex; flex-direction: column; max-height: 750px; overflow-y: auto; border-radius: 12px;}
header { display: flex; justify-content: space-between; align-items: flex-end; border-bottom: 4px dashed #362c54; padding-bottom: 12px; margin-bottom: 16px; }
h3 { color: #c4a7ff; font-size: 2rem; }
.upgrade-card { background: #1a162b; border: 4px solid #3d345e; padding: 12px; margin-bottom: 12px; display: flex; justify-content: space-between; align-items: center; transition: 0.1s; border-radius: 8px;}
.upgrade-card.locked { opacity: 0.4; filter: grayscale(100%); border-color: #141021; pointer-events: none; }
.shop-icon { font-size: 2.2rem; margin-right: 12px; }
.upgrade-details h4 { color: #e2daf0; font-size: 1.4rem; }
.upgrade-details p { font-size: 1.1rem; color: #9288b3; }
.buy-btn { background: #4c1d95; color: white; border: 4px solid #6d28d9; padding: 8px 12px; font-family: 'VT323', monospace; font-size: 1.2rem; cursor: pointer; min-width: 90px; border-radius: 6px;}
.buy-btn:active:not(:disabled) { transform: translateY(4px); }
.maxed-btn { background: #10b981 !important; border-color: #059669 !important; color: #000 !important; }

/* GENIE TAROT CARDS */
.genie-options { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; margin-top: 20px; }
.genie-options button { background: #c026d3; color: white; border: 4px solid #f0abfc; padding: 10px; font-family: 'VT323', monospace; font-size: 1.2rem; cursor: pointer; flex: 1; min-width: 80px; border-radius: 8px;}
.genie-options button:active { transform: translateY(2px); }
.tarot-deck { display: flex; justify-content: center; gap: 15px; margin: 20px 0; }
.tarot-card { width: 80px; height: 120px; perspective: 1000px; cursor: pointer; }
.tarot-inner { width: 100%; height: 100%; transition: transform 0.6s; transform-style: preserve-3d; position: relative; }
.tarot-card.flipped .tarot-inner { transform: rotateY(180deg); }
.tarot-front, .tarot-back { width: 100%; height: 100%; position: absolute; backface-visibility: hidden; display: flex; justify-content: center; align-items: center; border: 4px solid #fde047; font-size: 3.5rem; background: #4c1d95; border-radius: 6px;}
.tarot-back { transform: rotateY(180deg); background: #1a162b; }
.genie-result { font-size: 1.5rem; margin-bottom: 20px; min-height: 40px; }

/* ASCENSION PATH */
.path-options { display: flex; flex-direction: column; gap: 15px; width: 100%; max-width: 500px; margin-top: 20px; }
.path-btn { background: #166534; color: white; border: 4px solid #22c55e; padding: 15px; font-family: 'VT323', monospace; font-size: 1.4rem; cursor: pointer; text-align: left; border-radius: 8px;}
.path-btn:hover { background: #15803d; border-color: #4ade80; }

@keyframes float { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-8px); } }
.floating-text { position: absolute; color: #c4a7ff; font-size: 2rem; pointer-events: none; animation: floatUp 1s ease-out forwards; text-shadow: 2px 2px 0 #000; z-index: 50; font-weight: bold;}
@keyframes floatUp { 0% { opacity: 1; transform: translateY(0); } 100% { opacity: 0; transform: translateY(-50px); } }

@media (max-width: 768px) {
  .game-wrapper { flex-direction: column; padding: 10px; margin-top: 50px; }
  .shop-panel { max-height: 400px; }
}