<?php
session_start();

$selected = $_POST['answer'] ?? '';
$correct  = $_POST['correct'] ?? '';
$hint     = $_POST['hint'] ?? 'Try again! 💡';

$isCorrect = ($selected === $correct);

if ($isCorrect) {
    $_SESSION['practice_index']++;
}
?>

<!DOCTYPE html>
<html>
<head>
<style>
body{
    background:linear-gradient(135deg,#0b1020,#1e293b);
    color:#fff;
    font-family:sans-serif;
    text-align:center;
}

.box{
    margin-top:120px;
}

.btn{
    margin-top:25px;
    padding:12px 25px;
    border:none;
    border-radius:25px;
    background:linear-gradient(135deg,#22c55e,#06b6d4);
    cursor:pointer;
    font-weight:bold;
}
</style>
</head>

<body>

<div class="box">

<?php if($isCorrect): ?>

<h2>✅ Correct! Super da 🔥</h2>
<p>You’re improving fast 🚀 Keep going!</p>

<a href="practice_track.php" class="btn">Next Question →</a>

<?php else: ?>

<h2>👍 Almost there!</h2>
<p>Small mistake... but you're learning 💡</p>

<p><b>Hint:</b> <?= htmlspecialchars($hint) ?></p>

<a href="practice_track.php" class="btn">Try Again 🔁</a>

<?php endif; ?>

</div>

</body>
</html>