:root{
  --bg:#0f1216;
  --card:#161a20;
  --muted:#a7b0c0;
  --text:#e8ecf3;
  --accent:#4b9cff;
  --accent-weak:#4b9cff22;
  --good:#35c759;
  --warn:#f59e0b;
  --bad:#ef4444;
  --border:#242a33;
  --shadow:0 6px 18px rgba(0,0,0,0.25);
  --radius:16px;
}

*{box-sizing:border-box}
html,body{height:100%}
body{
  margin:0;
  font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, "Helvetica Neue", Arial;
  color:var(--text);
  background: radial-gradient(1000px 700px at 10% -10%, #1c2430 0%, transparent 60%), var(--bg);
}

.app-header{
  padding:32px 20px 16px;
  text-align:center;
}
.app-header h1{margin:0;font-size:28px; letter-spacing:0.5px}
.tagline{margin:6px 0 0; color:var(--muted); font-size:14px}

.container{
  max-width:1100px;
  margin:0 auto;
  padding:16px;
  display:grid;
  gap:16px;
}

.card{
  background:var(--card);
  border:1px solid var(--border);
  border-radius:var(--radius);
  padding:16px;
  box-shadow:var(--shadow);
}

.controls .grid{
  display:grid;
  grid-template-columns: repeat(4, minmax(0,1fr));
  gap:12px;
}
@media (max-width:900px){
  .controls .grid{grid-template-columns:repeat(2,minmax(0,1fr))}
}
@media (max-width:560px){
  .controls .grid{grid-template-columns:1fr}
}

.field{display:flex; flex-direction:column; gap:6px}
label{font-size:12px; color:var(--muted)}
select, input[type=number], input[type=text]{
  padding:10px 12px;
  border-radius:10px;
  border:1px solid var(--border);
  background:#0e1116;
  color:var(--text);
  outline:none;
}

.actions{display:flex; gap:10px; margin-top:12px; flex-wrap:wrap}
.btn{
  border:none;
  padding:10px 14px;
  border-radius:12px;
  background:#273041;
  color:var(--text);
  cursor:pointer;
  transition: transform .05s ease, background .2s ease;
}
.btn:hover{background:#2e3a50}
.btn:active{transform:translateY(1px)}
.btn.primary{background:var(--accent); color:#051321}
.btn.primary:hover{background:#64aaff}
.btn.danger{background:#3b1f26; color:#ffdfe4}
.btn.danger:hover{background:#4a232b}

.quiz .quiz-row{
  display:grid;
  grid-template-columns: 280px 1fr;
  gap:16px;
}
@media (max-width:900px){
  .quiz .quiz-row{grid-template-columns:1fr}
}

.timer-box{
  background:#0e1116;
  border:1px dashed var(--border);
  border-radius:14px;
  padding:14px;
}
.timer-label{color:var(--muted); font-size:12px}
.timer-value{
  font-size:40px;
  font-weight:700;
  margin:6px 0 8px;
}
.progress{
  width:100%;
  height:10px;
  border-radius:999px;
  background:#0b0f14;
  border:1px solid var(--border);
  overflow:hidden;
}
.progress-bar{
  height:100%;
  width:0%;
  background:linear-gradient(90deg, var(--accent), #00d4ff);
}

.question-box{
  display:flex;
  flex-direction:column;
  gap:10px;
}
.question{
  font-size:28px;
  font-weight:700;
  letter-spacing:.5px;
  min-height:40px;
}
.answer-row{
  display:flex;
  gap:10px;
  flex-wrap:wrap;
}
.answer-row input{
  flex:1 1 200px;
  font-size:16px;
}

.feedback{min-height:20px; font-size:14px; color:var(--muted)}
.feedback.good{color:var(--good)}
.feedback.bad{color:var(--bad)}

.stats-grid{
  display:grid;
  grid-template-columns: repeat(7, minmax(0,1fr));
  gap:12px;
}
@media (max-width:900px){
  .stats-grid{grid-template-columns:repeat(3,minmax(0,1fr))}
}
.stat{
  background:#0e1116;
  border:1px solid var(--border);
  border-radius:14px;
  padding:12px;
}
.stat-label{font-size:11px; color:var(--muted)}
.stat-value{font-size:20px; font-weight:700; margin-top:4px}

.history-header{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
}
.table-wrap{
  width:100%;
  overflow:auto;
  border:1px solid var(--border);
  border-radius:12px;
}
table{
  width:100%;
  border-collapse:collapse;
  min-width:760px;
}
th, td{
  border-bottom:1px solid var(--border);
  padding:10px 12px;
  text-align:left;
  font-size:14px;
}
th{color:var(--muted); font-weight:600; background:#12161c}
tr:last-child td{border-bottom:none}

.app-footer{
  text-align:center;
  padding:20px 12px 40px;
  color:var(--muted);
  font-size:13px;
}
