:root {
  --bg: #f4f2fb; --panel: #fff; --text: #1d1b2e; --muted: #6b6880; --line: #e3e0ef;
  --brand: #46178f; --brand2: #6a2fd0; --ok: #26890c; --bad: #e21b3c;
  --c0: #e21b3c; --c1: #1368ce; --c2: #d89e00; --c3: #26890c;
  --radius: 10px;
}
@media (prefers-color-scheme: dark) {
  :root { --bg: #15131f; --panel: #211e2e; --text: #eeeaf8; --muted: #a29fb5; --line: #353148; }
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; background: var(--bg); color: var(--text); font-size: 15px; line-height: 1.45; }
h1, h2, h3 { margin: 0 0 12px; line-height: 1.2; }
h2 { font-size: 20px; } h3 { font-size: 16px; }
a { color: var(--brand2); }
.hidden { display: none !important; }
.muted { color: var(--muted); font-size: 13px; }
.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.row > * { flex: 0 0 auto; }
.grow { flex: 1 1 200px !important; }
.stack > * + * { margin-top: 10px; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; margin-bottom: 16px; }
label { display: block; font-size: 13px; color: var(--muted); margin-bottom: 4px; }
input, select, textarea { width: 100%; font: inherit; color: var(--text); background: var(--bg); border: 1px solid var(--line); border-radius: 8px; padding: 9px 10px; }
textarea { min-height: 110px; resize: vertical; }
input[type=checkbox], input[type=radio] { width: auto; }
.check { display: flex; gap: 8px; align-items: center; color: var(--text); font-size: 14px; margin: 0; }
button, .btn { font: inherit; font-weight: 600; border: 0; border-radius: 8px; padding: 9px 16px; cursor: pointer; background: var(--brand); color: #fff; text-decoration: none; display: inline-block; }
button:hover { filter: brightness(1.1); }
button:disabled { opacity: .5; cursor: default; }
button.secondary { background: transparent; color: var(--text); border: 1px solid var(--line); }
button.danger { background: var(--bad); }
button.small { padding: 5px 10px; font-size: 13px; }
.tag { display: inline-block; font-size: 12px; padding: 2px 8px; border-radius: 99px; background: var(--line); color: var(--text); }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 8px 6px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-size: 12px; color: var(--muted); font-weight: 600; }
.scroll { overflow-x: auto; }
.msg { padding: 10px 12px; border-radius: 8px; background: var(--line); margin: 10px 0; font-size: 14px; white-space: pre-wrap; }
.msg.error { background: #fde3e7; color: #8a0b20; }
.msg.ok { background: #dff3d8; color: #1b5e08; }

/* Yönetim paneli */
.topbar { background: var(--brand); color: #fff; padding: 10px 16px; display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.topbar .logo { font-weight: 800; font-size: 18px; margin-right: 8px; }
.tabs { display: flex; gap: 4px; flex-wrap: wrap; flex: 1; }
.tabs button { background: transparent; color: #e7dcff; padding: 7px 12px; }
.tabs button.active { background: rgba(255,255,255,.18); color: #fff; }
.topbar .coursesel { width: auto; max-width: 320px; background: rgba(255,255,255,.15); color: #fff; border-color: rgba(255,255,255,.3); }
.topbar .coursesel option { color: #222; }
.topbar .user { font-size: 13px; display: flex; gap: 8px; align-items: center; }
main { max-width: 1100px; margin: 0 auto; padding: 16px; }
.qitem { border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; margin-bottom: 8px; background: var(--panel); }
.qitem .opts { display: grid; grid-template-columns: 1fr 1fr; gap: 4px 12px; font-size: 13px; margin-top: 6px; }
.qitem .opts .right { color: var(--ok); font-weight: 700; }
@media (max-width: 600px) { .qitem .opts { grid-template-columns: 1fr; } }
.optedit { display: grid; grid-template-columns: auto 1fr; gap: 6px 8px; align-items: center; }
.picklist { max-height: 260px; overflow: auto; border: 1px solid var(--line); border-radius: 8px; padding: 8px; }
.picklist .check { padding: 3px 0; }
.output { white-space: pre-wrap; background: var(--bg); border: 1px solid var(--line); border-radius: 8px; padding: 12px; max-height: 500px; overflow: auto; }

/* Login */
.login { max-width: 360px; margin: 12vh auto; padding: 0 16px; }
.login .card { padding: 24px; }
.brandtitle { text-align: center; color: var(--brand2); font-size: 28px; font-weight: 800; margin-bottom: 16px; }

/* Sunucu (host) ekranı */
.host { position: fixed; inset: 0; background: var(--brand); color: #fff; overflow: auto; z-index: 10; display: flex; flex-direction: column; }
.host header { display: flex; justify-content: space-between; align-items: center; padding: 10px 16px; gap: 10px; flex-wrap: wrap; }
.host header button { background: rgba(255,255,255,.15); color: #fff; }
.host .body button { background: #fff; color: var(--brand); font-size: 20px; padding: 12px 28px; }
.host .body { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 16px; gap: 16px; text-align: center; }
.pinbox { background: #fff; color: #222; border-radius: 12px; padding: 16px 24px; display: flex; gap: 24px; align-items: center; flex-wrap: wrap; justify-content: center; }
.pinbox .pin { font-size: clamp(40px, 8vw, 72px); font-weight: 900; letter-spacing: 4px; }
.pinbox .url { font-size: 15px; color: #555; word-break: break-all; }
.qr { background: #fff; padding: 4px; border-radius: 8px; line-height: 0; width: 200px; height: 200px; }
.qr svg { width: 100%; height: 100%; }
.players { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; max-width: 1000px; }
.players span { background: rgba(255,255,255,.15); padding: 6px 12px; border-radius: 99px; font-weight: 700; cursor: pointer; }
.players span.off { opacity: .45; }
.bigq { background: #fff; color: #222; border-radius: 12px; padding: 18px 24px; font-size: clamp(20px, 3vw, 34px); font-weight: 700; max-width: 1100px; width: 100%; }
.answers { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; width: 100%; max-width: 1100px; }
.answers div { color: #fff; border-radius: 10px; padding: 18px; font-size: clamp(16px, 2.2vw, 26px); font-weight: 700; text-align: left; display: flex; gap: 12px; align-items: center; min-height: 80px; }
.answers div.dim { opacity: .3; }
.answers div.win { outline: 5px solid #fff; }
.shape { font-size: 1.3em; }
.o0 { background: var(--c0); } .o1 { background: var(--c1); } .o2 { background: var(--c2); } .o3 { background: var(--c3); }
.timer { width: 90px; height: 90px; border-radius: 50%; background: #fff; color: var(--brand); font-size: 38px; font-weight: 900; display: flex; align-items: center; justify-content: center; }
.stats { display: flex; gap: 24px; align-items: center; font-size: 20px; font-weight: 700; }
.bars { display: flex; gap: 14px; align-items: flex-end; height: 160px; }
.bars div { width: 70px; border-radius: 6px 6px 0 0; display: flex; align-items: flex-start; justify-content: center; color: #fff; font-weight: 800; padding-top: 4px; min-height: 30px; }
.board { background: #fff; color: #222; border-radius: 12px; padding: 12px 18px; width: 100%; max-width: 600px; text-align: left; }
.board div { display: flex; justify-content: space-between; padding: 8px 4px; border-bottom: 1px solid #eee; font-size: 20px; font-weight: 700; }
.board div:last-child { border: 0; }
.explain { background: rgba(255,255,255,.15); border-radius: 10px; padding: 12px 16px; max-width: 1100px; font-size: 18px; }

/* Oyuncu (telefon) ekranı */
.play { min-height: 100vh; min-height: 100dvh; background: var(--brand); color: #fff; display: flex; flex-direction: column; }
.play .top { display: flex; justify-content: space-between; padding: 10px 14px; font-weight: 700; font-size: 14px; background: rgba(0,0,0,.15); }
.play .center { flex: 1; display: flex; flex-direction: column; justify-content: center; align-items: center; padding: 16px; gap: 14px; text-align: center; }
.play .join { background: #fff; color: #222; border-radius: 12px; padding: 20px; width: 100%; max-width: 360px; }
.play .join input { font-size: 20px; text-align: center; font-weight: 700; margin-bottom: 10px; background: #fff; color: #222; border-color: #ccc; }
.play .join button { width: 100%; font-size: 18px; padding: 12px; }
.play .ptext { font-size: 18px; font-weight: 700; background: #fff; color: #222; border-radius: 10px; padding: 12px; width: 100%; }
.pbtns { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; width: 100%; flex: 1; max-height: 60vh; }
.pbtns button { border-radius: 10px; font-size: 16px; padding: 12px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; min-height: 90px; }
.pbtns button .shape { font-size: 34px; }
.big { font-size: 28px; font-weight: 900; }
.verdict { padding: 18px 26px; border-radius: 12px; font-size: 26px; font-weight: 900; }
.verdict.ok { background: var(--ok); } .verdict.bad { background: var(--bad); }
