* { box-sizing: border-box; }
html, body { margin: 0; width: 100%; height: 100%; overflow: hidden; font-family: Arial, Helvetica, sans-serif; background: #0e1117; color: #eef2ff; }
button, input { font: inherit; }
.screen { display: none; width: 100vw; height: 100vh; }
.screen.active { display: flex; }
#startScreen, #endScreen { align-items: center; justify-content: center; background: radial-gradient(circle at top, #243b55 0, #141e30 42%, #090b10 100%); }
.start-card, .end-card { width: min(760px, 92vw); background: rgba(18, 24, 38, .94); border: 1px solid rgba(255,255,255,.12); border-radius: 22px; padding: 34px; box-shadow: 0 20px 60px rgba(0,0,0,.45); }
h1 { margin: 0 0 8px; font-size: 42px; letter-spacing: .5px; }
.subtitle { margin: 0 0 28px; color: #b8c7e8; font-size: 18px; }
.form-grid { display: grid; grid-template-columns: 1fr 180px; gap: 16px; margin-bottom: 22px; }
label { display: flex; flex-direction: column; gap: 8px; color: #d8e2ff; font-weight: 700; }
input { height: 46px; border-radius: 12px; border: 1px solid rgba(255,255,255,.18); background: #0c1220; color: #fff; padding: 0 14px; outline: none; }
input:focus { border-color: #86efac; }
.rules { background: rgba(255,255,255,.06); padding: 16px 18px; border-radius: 16px; margin: 20px 0; color: #dbe7ff; line-height: 1.45; }
button { border: 0; border-radius: 12px; padding: 12px 18px; color: #fff; background: #334155; cursor: pointer; transition: transform .08s ease, filter .15s ease; }
button:hover { filter: brightness(1.1); }
button:active { transform: scale(.98); }
button.primary { background: linear-gradient(135deg, #16a34a, #15803d); font-weight: 800; }
#gameScreen { align-items: center; justify-content: center; background: #090b10; }
.game-wrap { width: 1320px; height: 720px; display: grid; grid-template-columns: 960px 340px; gap: 20px; }
.game-frame { position: relative; background: #020617; padding: 0; border: 1px solid rgba(255,255,255,.14); border-radius: 18px; overflow: hidden; box-shadow: 0 16px 45px rgba(0,0,0,.4); align-self: start; }
canvas { display: block; width: 960px; height: 560px; image-rendering: pixelated; }
#hintBar { height: 48px; display: flex; align-items: center; justify-content: center; background: #111827; color: #d1d5db; border-top: 1px solid rgba(255,255,255,.12); font-weight: 700; }
.panel { height: 608px; background: rgba(15, 23, 42, .96); border: 1px solid rgba(255,255,255,.12); border-radius: 18px; padding: 20px; box-shadow: 0 16px 45px rgba(0,0,0,.32); }
.panel h2 { margin: 0 0 12px; }
.student-box { display: grid; gap: 4px; padding: 12px; background: rgba(255,255,255,.06); border-radius: 14px; color: #dbeafe; }
.timer { margin: 18px 0; text-align: center; font-size: 48px; font-weight: 900; color: #fde68a; }
.stats { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.stats div { background: rgba(255,255,255,.07); border-radius: 14px; padding: 12px; display: grid; gap: 6px; }
.stats span { color: #aebbd5; font-size: 13px; }
.stats b { font-size: 24px; }
.objective { margin: 18px 0; padding: 14px; border-radius: 14px; background: rgba(22, 163, 74, .12); border: 1px solid rgba(22, 163, 74, .28); color: #dcfce7; line-height: 1.35; }
.log-box { height: 120px; overflow: auto; background: rgba(0,0,0,.25); border-radius: 12px; padding: 10px; font-size: 12px; color: #cbd5e1; }
.log-box p { margin: 0 0 8px; }
.modal { position: fixed; inset: 0; background: rgba(0,0,0,.66); display: flex; align-items: center; justify-content: center; z-index: 10; }
.modal.hidden { display: none; }
.modal-card { width: 720px; background: #f8fafc; color: #0f172a; border-radius: 22px; padding: 26px; box-shadow: 0 20px 70px rgba(0,0,0,.55); }
.modal-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; border-bottom: 1px solid #d8dee9; padding-bottom: 12px; margin-bottom: 14px; }
.modal-head h3 { margin: 0; font-size: 26px; }
#questionMeta { background: #e0f2fe; color: #075985; padding: 6px 10px; border-radius: 999px; font-weight: 800; }
#questionText { font-size: 20px; line-height: 1.4; }
.answers { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 18px; }
.answers button { background: #1e293b; min-height: 52px; text-align: left; }
.answers button.correct { background: #16a34a; }
.answers button.wrong { background: #dc2626; }
.feedback { min-height: 26px; font-weight: 800; }
.summary { background: rgba(255,255,255,.06); padding: 18px; border-radius: 16px; line-height: 1.7; margin: 18px 0; }
.end-actions { display: flex; gap: 10px; flex-wrap: wrap; }
@media (max-width: 1200px), (max-height: 690px) {
  .game-wrap { transform: scale(.9); transform-origin: center; }
}
