r<?php
session_start();
$practiceDone = $_SESSION['practice_completed'] ?? false;
$reinforcementDone = $_SESSION['reinforcement_completed'] ?? false;
?>
<!DOCTYPE html>
<html>
<head>
<title>Coding Challenges</title>
<style>
body{
    background:radial-gradient(circle at top,#0f172a,#020617);
    color:#e5e7eb;font-family:Arial;
}
.box{
    max-width:900px;margin:60px auto;
    background:rgba(15,23,42,.95);
    padding:40px;border-radius:16px;
}
label{display:block;margin-top:15px;color:#94a3b8;}
input,select{
    width:100%;padding:12px;margin-top:6px;
    background:#020617;color:#fff;
    border:none;border-radius:10px;
}
.grid{
    display:grid;
    grid-template-columns:repeat(3,1fr);
    gap:20px;margin-top:30px;
}
button{
    padding:14px;border:none;border-radius:12px;
    background:#0b8c9f;color:#fff;
    font-size:15px;cursor:pointer;
}
button[disabled]{opacity:.4;cursor:not-allowed;}
</style>
</head>
<body>

<div class="box">
<h2>💻 Coding Challenges</h2>

<form method="GET">
<label>Student Name</label>
<input name="name" required>

<label>Roll Number</label>
<input name="roll" required>

<label>Class</label>
<input name="class" required>

<label>Coding Language</label>
<select name="lang">
    <option value="python">Python</option>
    <option value="c">C</option>
    <option value="java">Java</option>
</select>

<!-- 🔥 REQUIRED BY practice.php -->
<input type="hidden" name="concept_id" value="1">

<div class="grid">
<button formaction="/rs_lab/practice_track.php">
🧠 Start Practice
</button>

<button formaction="/rs_lab/reinforcement_track.php"
<?= !$practiceDone ? 'disabled' : '' ?>>
🔁 Start Reinforcement
</button>

<button formaction="/rs_lab/final_track.php"
<?= !$reinforcementDone ? 'disabled' : '' ?>>
🏁 Start Final
</button>
</div>
</form>
</div>

</body>
</html>
