/* Custom Properties for Premium Theme */
:root {
    --bg-dark: #080314;
    --bg-light: #160a2d;
    --primary: #a855f7;
    --primary-glow: rgba(168, 85, 247, 0.5);
    --secondary: #06b6d4;
    --secondary-glow: rgba(6, 182, 212, 0.5);
    --accent: #ec4899;
    --accent-glow: rgba(236, 72, 153, 0.5);
    --success: #10b981;
    --success-glow: rgba(16, 185, 129, 0.5);
    --warning: #f59e0b;
    --danger: #ef4444;
    --danger-glow: rgba(239, 68, 68, 0.5);
    --text-main: #f3f4f6;
    --text-muted: #9ca3af;
    --glass-bg: transparent; /* Changed to fully transparent */
    --glass-border: rgba(255, 255, 255, 0.05);
    --card-shadow: none; /* Removed heavy shadows for transparency */
}

/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    background-color: var(--bg-dark);
    color: var(--text-main);
    font-family: 'Outfit', sans-serif;
    min-height: 100vh;
    overflow: hidden;
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: background-color 0.5s ease;
}

/* Magical Background Mesh & Glows */
.bg-magic-mesh {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -3;
    opacity: 0.08;
    background-image: 
        radial-gradient(circle at 20% 30%, var(--primary) 1px, transparent 1px),
        radial-gradient(circle at 75% 60%, var(--secondary) 1px, transparent 1px);
    background-size: 40px 40px;
}

.bg-glow-orb {
    position: fixed;
    border-radius: 50%;
    filter: blur(130px);
    z-index: -3;
    opacity: 0.18;
    pointer-events: none;
    transition: all 0.5s ease;
}

.bg-glow-orb.purple {
    width: 70vw;
    height: 70vw;
    top: -15vw;
    left: -15vw;
    background: radial-gradient(circle, var(--primary) 0%, transparent 70%);
}

.bg-glow-orb.cyan {
    width: 75vw;
    height: 75vw;
    bottom: -20vw;
    right: -15vw;
    background: radial-gradient(circle, var(--secondary) 0%, transparent 70%);
}

/* Floating Fullscreen Button */
.fullscreen-btn {
    position: fixed;
    top: 1.5rem;
    right: 1.5rem;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    border: 1px solid var(--glass-border);
    background: rgba(20, 10, 30, 0.6);
    color: var(--text-main);
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    backdrop-filter: blur(8px);
    z-index: 10;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.fullscreen-btn:hover {
    background: var(--primary);
    border-color: var(--primary);
    box-shadow: 0 0 12px var(--primary-glow);
    transform: scale(1.08);
}

/* Wizard Stage (NOW BACKGROUND BACKDROP - FIXED AND CENTERED) */
.wizard-stage {
    position: fixed;
    top: 58%; /* Shifted down to prevent overlapping the header text */
    left: 50%;
    transform: translate(-50%, -50%);
    width: 100vw;
    height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: -1;
    pointer-events: none;
    overflow: hidden;
    background: radial-gradient(circle, rgba(168, 85, 247, 0.12) 0%, transparent 60%);
    transition: transform 0.5s ease;
}

/* Wizard Container (Massive Backdrop Size) */
.wizard-container {
    position: relative;
    width: 80vh;
    height: 80vh;
    max-width: 580px;
    max-height: 580px;
    display: flex;
    justify-content: center;
    align-items: center;
    animation: floating 6s infinite ease-in-out;
}

.wizard-img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    opacity: 0.85; /* Changed to high opacity for extreme clarity */
    filter: drop-shadow(0 10px 15px rgba(0, 0, 0, 0.7));
    transition: filter 0.5s ease, transform 0.5s ease, opacity 0.5s ease;
}

/* Wizard state glows */
.wizard-container.casting .wizard-img {
    opacity: 0.95;
    filter: drop-shadow(0 0 35px var(--primary)) drop-shadow(0 10px 15px rgba(0, 0, 0, 0.7));
    animation: casting-vibration 0.15s infinite linear;
}

.wizard-container.success-glow .wizard-img {
    opacity: 1.0;
    filter: drop-shadow(0 0 45px var(--success)) drop-shadow(0 10px 15px rgba(0, 0, 0, 0.7));
    transform: scale(1.08);
}

.wizard-container.fail-glow .wizard-img {
    opacity: 0.85;
    filter: drop-shadow(0 0 30px var(--danger)) grayscale(25%) drop-shadow(0 10px 15px rgba(0, 0, 0, 0.7));
    transform: scale(0.96);
    animation: fail-shake 0.5s ease-in-out;
}

.wizard-glow {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 110%;
    height: 110%;
    transform: translate(-50%, -50%);
    background: radial-gradient(circle, rgba(168, 85, 247, 0.15) 0%, transparent 60%);
    border-radius: 50%;
    z-index: -1;
    opacity: 0;
    transition: opacity 0.5s ease;
}

.wizard-container.casting .wizard-glow {
    opacity: 1;
    background: radial-gradient(circle, rgba(168, 85, 247, 0.3) 0%, rgba(6, 182, 212, 0.08) 50%, transparent 70%);
}

.wizard-container.success-glow .wizard-glow {
    opacity: 1;
    background: radial-gradient(circle, rgba(16, 185, 129, 0.4) 0%, transparent 70%);
}

.wizard-container.fail-glow .wizard-glow {
    opacity: 1;
    background: radial-gradient(circle, rgba(239, 68, 68, 0.3) 0%, transparent 70%);
}

/* Rune Circles in Background (Scaled up for Backdrop) */
.rune-circle-outer, .rune-circle-inner {
    position: absolute;
    border-radius: 50%;
    border: 1px dashed rgba(6, 182, 212, 0.12);
    z-index: 1;
    pointer-events: none;
    transition: border-color 0.5s ease, opacity 0.5s ease;
}

.rune-circle-outer {
    width: 90vh;
    height: 90vh;
    max-width: 680px;
    max-height: 680px;
    border: 2px dashed rgba(168, 85, 247, 0.12);
    animation: spin-rune 40s infinite linear;
}

.rune-circle-inner {
    width: 80vh;
    height: 80vh;
    max-width: 590px;
    max-height: 590px;
    animation: spin-rune-rev 30s infinite linear;
}

/* Magic circle when active */
.wizard-stage.active-magic .rune-circle-outer {
    border-color: rgba(168, 85, 247, 0.4);
    box-shadow: 0 0 25px rgba(168, 85, 247, 0.15);
    border-style: double;
}

.wizard-stage.active-magic .rune-circle-inner {
    border-color: rgba(6, 182, 212, 0.4);
    box-shadow: 0 0 15px rgba(6, 182, 212, 0.15);
    border-style: solid;
}

/* Shockwave animation on cast */
.spell-shockwave {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.1);
    width: 80vh;
    height: 80vh;
    max-width: 600px;
    max-height: 600px;
    border-radius: 50%;
    border: 4px solid var(--accent);
    opacity: 0;
    pointer-events: none;
    z-index: 2;
}

.spell-shockwave.trigger {
    animation: shockwave 0.6s cubic-bezier(0.1, 0.8, 0.3, 1) forwards;
}

/* Particle Sparks */
.spark-emitter {
    position: absolute;
    width: 100%;
    height: 100%;
    top: 0;
    left: 0;
    pointer-events: none;
    z-index: 3;
}

.spark {
    position: absolute;
    width: 6px;
    height: 6px;
    background-color: var(--secondary);
    border-radius: 50%;
    box-shadow: 0 0 8px var(--secondary-glow);
    animation: spark-travel 1.2s forwards cubic-bezier(0.1, 0.8, 0.2, 1);
}

.spark.perfect {
    border-radius: 50%;
}

.spark.fail {
    background-color: var(--danger);
    box-shadow: 0 0 8px var(--danger-glow);
}

/* App Container Layout */
.app-container.centered {
    width: 100%;
    max-width: 480px;
    min-height: 100vh;
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: space-between;
    z-index: 1;
}

/* Header/Title */
.game-title {
    text-align: center;
    margin-bottom: 0.5rem;
}

.brand-logo-container {
    display: flex;
    justify-content: center;
    margin-bottom: 0.5rem;
}

.brand-logo {
    max-height: 55px;
    width: auto;
    object-fit: contain;
    filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.6));
}

.logo-text {
    font-family: 'Cinzel Decorative', serif;
    font-size: 2.25rem;
    font-weight: 700;
    letter-spacing: 4px;
    background: linear-gradient(135deg, #fff 0%, var(--primary) 50%, var(--secondary) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    text-shadow: 
        0 0 20px rgba(168, 85, 247, 0.35),
        0 2px 10px rgba(0, 0, 0, 0.95);
}

/* Center Panel: Arena */
.arena-panel {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    width: 100%;
}

/* Transparent Panel Base */
.glass-panel {
    background: var(--glass-bg); /* Completely transparent */
    border: 1px solid var(--glass-border);
    backdrop-filter: none; /* Removed blur to make it completely clear */
    -webkit-backdrop-filter: none;
    border-radius: 28px;
    box-shadow: var(--card-shadow);
    padding: 2rem;
    transition: border-color 0.3s ease;
}

.glass-panel:hover {
    border-color: rgba(255, 255, 255, 0.15);
}

/* Target Indicator OUTSIDE the box/card */
.target-outside-label {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.6rem;
    font-size: 1.2rem;
    font-weight: 800;
    letter-spacing: 2px;
    color: var(--text-muted);
    margin-top: 0.5rem;
    margin-bottom: 0.25rem;
    text-transform: uppercase;
}

.target-outside-label .highlight {
    color: var(--accent);
    font-family: 'Share Tech Mono', monospace;
    font-size: 2.6rem; /* Significantly enlarged for high visibility */
    text-shadow: 0 0 16px var(--accent-glow);
}

/* Timer Dashboard card */
.dashboard {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.5rem;
    position: relative;
    overflow: hidden;
}

.dashboard::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 4px;
    background: linear-gradient(90deg, var(--primary), var(--secondary), var(--accent));
}

/* Timer text display with heavy drop shadow for legibility over wizard */
.timer-display-container {
    text-align: center;
    width: 100%;
}

.timer-text {
    font-family: 'Share Tech Mono', monospace;
    font-size: 5rem;
    font-weight: bold;
    color: #fff;
    line-height: 1;
    letter-spacing: -1px;
    text-shadow: 
        0 0 20px rgba(0, 0, 0, 0.9), 
        0 4px 15px rgba(0, 0, 0, 0.95), 
        0 0 8px var(--primary-glow);
    transition: color 0.3s ease, text-shadow 0.3s ease;
}

.timer-subtext {
    font-size: 0.85rem;
    color: var(--text-main);
    letter-spacing: 2.5px;
    text-transform: uppercase;
    margin-top: 0.85rem;
    font-weight: 800;
    text-shadow: 0 2px 5px rgba(0, 0, 0, 0.9);
    transition: color 0.3s ease;
}

/* Action Button: HUGE and glowing */
.action-btn {
    position: relative;
    width: 100%;
    padding: 1.25rem;
    border-radius: 16px;
    border: none;
    cursor: pointer;
    font-family: 'Outfit', sans-serif;
    font-size: 1.25rem;
    font-weight: 800;
    letter-spacing: 1.5px;
    color: #fff;
    text-transform: uppercase;
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    overflow: hidden;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.5);
}

.action-btn.cast {
    background: linear-gradient(135deg, var(--primary) 0%, var(--accent) 100%);
    box-shadow: 0 0 25px var(--primary-glow);
}

.action-btn.cast:hover {
    box-shadow: 0 0 35px var(--primary-glow), 0 0 15px var(--accent-glow);
    transform: translateY(-2px);
}

.action-btn.stop {
    background: linear-gradient(135deg, var(--secondary) 0%, #0891b2 100%);
    box-shadow: 0 0 25px var(--secondary-glow);
}

.action-btn.stop:hover {
    box-shadow: 0 0 35px var(--secondary-glow);
    transform: translateY(-2px);
}

.action-btn:active {
    transform: translateY(1px);
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.5);
}

.btn-text {
    position: relative;
    z-index: 2;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.4);
}

.btn-ripple {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.1);
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    opacity: 0;
    z-index: 1;
    pointer-events: none;
}

.action-btn:active .btn-ripple {
    animation: button-click-ripple 0.4s ease-out;
}

/* Animations Keyframes */

@keyframes floating {
    0% { transform: translateY(0px) rotate(0deg); }
    50% { transform: translateY(-20px) rotate(1deg); }
    100% { transform: translateY(0px) rotate(0deg); }
}

@keyframes spin-rune {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

@keyframes spin-rune-rev {
    0% { transform: rotate(360deg); }
    100% { transform: rotate(0deg); }
}

@keyframes casting-vibration {
    0% { transform: translate(2px, 2px) rotate(0deg); }
    100% { transform: translate(-2px, -2px) rotate(1deg); }
}

@keyframes fail-shake {
    0% { transform: translateX(0); }
    20% { transform: translateX(-10px) rotate(-3deg); }
    40% { transform: translateX(8px) rotate(2deg); }
    60% { transform: translateX(-6px) rotate(-1deg); }
    80% { transform: translateX(3px) rotate(1deg); }
    100% { transform: translateX(0); }
}

@keyframes shockwave {
    0% { transform: translate(-50%, -50%) scale(0.1); opacity: 0.8; border-width: 6px; }
    50% { opacity: 0.5; }
    100% { transform: translate(-50%, -50%) scale(1.4); opacity: 0; border-width: 1px; }
}

@keyframes spark-travel {
    0% { transform: translate(0, 0) scale(1); opacity: 1; }
    100% { transform: translate(var(--x), var(--y)) scale(0.1); opacity: 0; }
}

@keyframes button-click-ripple {
    0% { transform: translate(-50%, -50%) scale(0.1); opacity: 0.8; }
    100% { transform: translate(-50%, -50%) scale(2.5); opacity: 0; }
}

/* Feedback states */
.timer-text.perfect-stop {
    color: #fbbf24;
    text-shadow: 
        0 0 35px rgba(251, 191, 36, 0.9), 
        0 0 10px rgba(0, 0, 0, 0.95);
}
.timer-text.fail-stop {
    color: var(--danger);
    text-shadow: 
        0 0 25px var(--danger-glow), 
        0 0 10px rgba(0, 0, 0, 0.95);
}

/* ------------------------------------------------------------------------- */
/* EPIC VICTORY "HEBOH" ANIMATIONS                                           */
/* ------------------------------------------------------------------------- */

.epic-victory {
    background-color: #0b0117 !important;
}

.epic-victory .bg-glow-orb.purple {
    animation: rainbow-flash-purple 0.4s infinite alternate;
}
.epic-victory .bg-glow-orb.cyan {
    animation: rainbow-flash-cyan 0.4s infinite alternate;
}
.epic-victory .wizard-stage {
    animation: success-pulse-zoom 0.5s infinite alternate ease-in-out;
    background: radial-gradient(circle, rgba(251, 191, 36, 0.2) 0%, rgba(236, 72, 153, 0.1) 50%, transparent 80%);
}
.epic-victory .timer-text {
    animation: rainbow-text 0.6s infinite linear;
}

@keyframes rainbow-flash-purple {
    0% { background: radial-gradient(circle, var(--accent) 0%, transparent 70%); opacity: 0.85; filter: blur(80px); }
    100% { background: radial-gradient(circle, var(--primary) 0%, transparent 70%); opacity: 0.85; filter: blur(80px); }
}
@keyframes rainbow-flash-cyan {
    0% { background: radial-gradient(circle, var(--secondary) 0%, transparent 70%); opacity: 0.85; filter: blur(80px); }
    100% { background: radial-gradient(circle, #facc15 0%, transparent 70%); opacity: 0.85; filter: blur(80px); }
}
@keyframes success-pulse-zoom {
    0% { transform: translate(-50%, -50%) scale(1) rotate(0deg); }
    100% { transform: translate(-50%, -50%) scale(1.05) rotate(0.5deg); }
}
@keyframes rainbow-text {
    0% { color: #ff007f; text-shadow: 0 0 30px #ff007f, 0 0 10px rgba(0,0,0,0.9); }
    25% { color: #00f0ff; text-shadow: 0 0 30px #00f0ff, 0 0 10px rgba(0,0,0,0.9); }
    50% { color: #facc15; text-shadow: 0 0 30px #facc15, 0 0 10px rgba(0,0,0,0.9); }
    75% { color: #10b981; text-shadow: 0 0 30px #10b981, 0 0 10px rgba(0,0,0,0.9); }
    100% { color: #ff007f; text-shadow: 0 0 30px #ff007f, 0 0 10px rgba(0,0,0,0.9); }
}

/* Responsive adjustments */
@media (max-width: 480px) {
    .timer-text {
        font-size: 4.2rem;
    }
    .wizard-container {
        width: 65vh;
        height: 65vh;
    }
    .rune-circle-outer {
        width: 75vh;
        height: 75vh;
    }
    .rune-circle-inner {
        width: 65vh;
        height: 65vh;
    }
}
