/* BilArena — devre kartı teması */
@font-face { font-family: 'Baloo 2'; font-weight: 600; font-display: swap; src: url(/fonts/baloo-2-latin-600-normal.woff2) format('woff2'); unicode-range: U+0000-00FF, U+2000-206F; }
@font-face { font-family: 'Baloo 2'; font-weight: 600; font-display: swap; src: url(/fonts/baloo-2-latin-ext-600-normal.woff2) format('woff2'); unicode-range: U+0100-024F, U+1E00-1EFF; }
@font-face { font-family: 'Baloo 2'; font-weight: 800; font-display: swap; src: url(/fonts/baloo-2-latin-800-normal.woff2) format('woff2'); unicode-range: U+0000-00FF, U+2000-206F; }
@font-face { font-family: 'Baloo 2'; font-weight: 800; font-display: swap; src: url(/fonts/baloo-2-latin-ext-800-normal.woff2) format('woff2'); unicode-range: U+0100-024F, U+1E00-1EFF; }
@font-face { font-family: 'Atkinson'; font-weight: 400; font-display: swap; src: url(/fonts/atkinson-hyperlegible-latin-400-normal.woff2) format('woff2'); unicode-range: U+0000-00FF, U+2000-206F; }
@font-face { font-family: 'Atkinson'; font-weight: 400; font-display: swap; src: url(/fonts/atkinson-hyperlegible-latin-ext-400-normal.woff2) format('woff2'); unicode-range: U+0100-024F, U+1E00-1EFF; }
@font-face { font-family: 'Atkinson'; font-weight: 700; font-display: swap; src: url(/fonts/atkinson-hyperlegible-latin-700-normal.woff2) format('woff2'); unicode-range: U+0000-00FF, U+2000-206F; }
@font-face { font-family: 'Atkinson'; font-weight: 700; font-display: swap; src: url(/fonts/atkinson-hyperlegible-latin-ext-700-normal.woff2) format('woff2'); unicode-range: U+0100-024F, U+1E00-1EFF; }

:root {
  --pcb: #0f5a44;        /* lehim maskesi yeşili */
  --pcb-deep: #093d2f;
  --pcb-line: #2c7a60;   /* bakır olmayan iz */
  --copper: #d8a23d;     /* bakır ped */
  --copper-dark: #a8781f;
  --silk: #f3f6ef;       /* serigrafi beyazı */
  --desk: #e9efec;       /* öğretmen masası */
  --ink: #12332a;
  --muted: #557268;
  --a0: #e5484d; --a1: #2f6feb; --a2: #e8a800; --a3: #8e4ec6; /* cevap renkleri */
  --ok: #2fbf71; --bad: #e5484d;
  --r-sm: 6px; --r-md: 12px; --r-lg: 20px;
  --display: 'Baloo 2', ui-rounded, system-ui, sans-serif;
  --text: 'Atkinson', system-ui, -apple-system, 'Segoe UI', sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body { font: 400 1rem/1.5 var(--text); color: var(--ink); background: var(--desk); -webkit-font-smoothing: antialiased; }
h1, h2, h3 { font-family: var(--display); font-weight: 800; line-height: 1.1; margin: 0 0 .5em; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--copper); outline-offset: 2px; }
[hidden] { display: none !important; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* ---------- Oyun yüzeyi (devre kartı) ---------- */
body.board {
  background-color: var(--pcb);
  background-image:
    radial-gradient(circle at 1px 1px, rgba(255,255,255,.07) 1px, transparent 0),
    linear-gradient(var(--pcb), var(--pcb-deep));
  background-size: 22px 22px, 100% 100%;
  color: var(--silk);
  min-height: 100dvh;
}
.board a:not(.btn) { color: var(--copper); }
a.btn { text-decoration: none; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .5em;
  border: 0; border-radius: var(--r-md); padding: .75em 1.4em; cursor: pointer;
  font-family: var(--display); font-weight: 800; font-size: 1.1rem; letter-spacing: .01em;
  background: var(--copper); color: #2b1d02; box-shadow: 0 4px 0 var(--copper-dark);
  transition: transform .08s, box-shadow .08s;
}
.btn:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--copper-dark); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.ghost { background: transparent; color: inherit; box-shadow: inset 0 0 0 2px currentColor; }
.btn.small { font-size: .95rem; padding: .45em .9em; }
.btn.danger { background: var(--bad); color: #fff; box-shadow: 0 4px 0 #9e2b2f; }
.btn.dark { background: var(--ink); color: var(--silk); box-shadow: 0 4px 0 #06150f; }

/* Çip: PIN ve önemli sayılar bir entegre devre gibi gösterilir */
.chip {
  position: relative; display: inline-block; background: #17181a; color: var(--silk);
  border-radius: var(--r-sm); padding: .35em .8em; font-family: var(--display); font-weight: 800;
  letter-spacing: .08em; box-shadow: 0 6px 0 #000a;
}
.chip::before, .chip::after {
  content: ''; position: absolute; left: 10%; right: 10%; height: 8px;
  background: repeating-linear-gradient(90deg, var(--copper) 0 10px, transparent 10px 22px);
}
.chip::before { top: -8px; } .chip::after { bottom: -8px; }

.field { display: grid; gap: .35rem; }
.field label { font-weight: 700; font-size: .95rem; }
.input {
  width: 100%; border: 2px solid #c6d4ce; border-radius: var(--r-md); padding: .7em .9em; background: #fff; color: var(--ink);
}
.board .input { border-color: transparent; }
.input:focus { border-color: var(--copper); outline: none; }

/* ---------- Öğrenci giriş ---------- */
.join { min-height: 100dvh; display: grid; place-items: center; padding: 24px 16px; }
.join-card { width: min(420px, 100%); text-align: center; }
.logo { font-family: var(--display); font-weight: 800; font-size: clamp(2.6rem, 9vw, 3.6rem); line-height: 1; margin-bottom: .2em; }
.logo span { color: var(--copper); }
.join-card p { color: #cfe3da; margin: 0 0 1.6rem; }
.pin-input { font-family: var(--display); font-weight: 800; font-size: 2rem; text-align: center; letter-spacing: .25em; padding: .4em; }
.join-card form { display: grid; gap: 14px; }
.msg { min-height: 1.5em; font-weight: 700; color: #ffd0d1; }
.foot { margin-top: 2rem; font-size: .9rem; color: #a9c8bc; }

/* ---------- Öğrenci oyun ekranı ---------- */
.play { min-height: 100dvh; display: flex; flex-direction: column; }
.play-top { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 12px 16px; background: #0007; font-weight: 700; }
.play-top .score { font-family: var(--display); font-size: 1.3rem; color: var(--copper); }
.play-main { flex: 1; display: flex; flex-direction: column; padding: 16px; gap: 16px; max-width: 900px; width: 100%; margin: 0 auto; }
.center-msg { flex: 1; display: grid; place-content: center; text-align: center; gap: 12px; }
.center-msg h2 { font-size: clamp(1.8rem, 6vw, 2.6rem); }
.q-text { font-family: var(--display); font-weight: 600; font-size: clamp(1.25rem, 4.5vw, 1.8rem); line-height: 1.25; background: var(--silk); color: var(--ink); padding: 16px 18px; border-radius: var(--r-md); }
.answers { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; flex: 1; min-height: 50vh; }
@media (max-width: 560px) { .answers { grid-template-columns: 1fr; min-height: auto; } }
.ans {
  border: 0; border-radius: var(--r-md); color: #fff; padding: 16px; cursor: pointer; text-align: left;
  display: flex; align-items: center; gap: 14px; font-weight: 700; font-size: clamp(1.05rem, 3.6vw, 1.35rem);
  min-height: 72px; box-shadow: 0 5px 0 #0006; transition: transform .08s, opacity .2s;
}
.ans:active { transform: translateY(3px); box-shadow: 0 2px 0 #0006; }
.ans:disabled { cursor: default; }
.ans .shape { flex: 0 0 34px; height: 34px; background: #fff; }
.ans0 { background: var(--a0); } .ans0 .shape { clip-path: polygon(50% 5%, 95% 92%, 5% 92%); }
.ans1 { background: var(--a1); } .ans1 .shape { clip-path: polygon(50% 0, 100% 50%, 50% 100%, 0 50%); }
.ans2 { background: var(--a2); color: #2a1e00; } .ans2 .shape { border-radius: 50%; background: #2a1e00; }
.ans3 { background: var(--a3); } .ans3 .shape { border-radius: 4px; transform: scale(.85); }
.ans.dim { opacity: .35; }
.ans.right { outline: 5px solid #fff; }

.timer { height: 10px; border-radius: 10px; background: #0005; overflow: hidden; }
.timer > i { display: block; height: 100%; background: var(--copper); transform-origin: left; }

.result { border-radius: var(--r-lg); padding: 28px 20px; text-align: center; }
.result.good { background: var(--ok); color: #05301a; }
.result.bad { background: var(--bad); color: #fff; }
.result h2 { font-size: 2.2rem; margin-bottom: .2em; }
.result p { margin: .2em 0; font-size: 1.1rem; }

.toast { position: fixed; left: 50%; top: 16px; transform: translateX(-50%); background: #17181a; color: var(--silk); padding: 12px 18px; border-radius: var(--r-md); font-weight: 700; z-index: 50; box-shadow: 0 8px 20px #0006; max-width: calc(100% - 32px); }

/* Altın avı sandıkları */
.chests { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.chest {
  aspect-ratio: 1; border: 0; cursor: pointer; border-radius: var(--r-md); font-family: var(--display); font-weight: 800; font-size: 1.05rem;
  background: linear-gradient(#8a5a1c 0 38%, #3b2a12 38% 46%, #a8702a 46%); color: #fff6e0; box-shadow: 0 6px 0 #4a3210;
  display: grid; place-items: center; padding: 6px; text-align: center;
}
.chest:hover:not(:disabled) { transform: translateY(-3px); }
.chest.opened { background: #17181a; }
.chest.picked { outline: 4px solid var(--copper); }

/* Yarış: devre yolu */
.track { display: grid; gap: 10px; }
.lane { position: relative; height: 34px; }
.lane::before { content: ''; position: absolute; left: 0; right: 28px; top: 50%; height: 6px; transform: translateY(-50%); background: var(--copper-dark); border-radius: 3px; }
.lane::after { content: ''; position: absolute; right: 0; top: 50%; width: 22px; height: 22px; transform: translateY(-50%); background: var(--copper); border-radius: 50%; box-shadow: 0 0 0 5px #0f5a44, 0 0 0 7px var(--copper); }
.lane .sig {
  position: absolute; top: 50%; transform: translateY(-50%); transition: left .6s cubic-bezier(.3,1.4,.5,1); max-width: 130px; overflow: hidden; text-overflow: ellipsis;
  background: var(--silk); color: var(--ink); border-radius: 999px; padding: 2px 10px; font-weight: 700; font-size: .85rem; white-space: nowrap; z-index: 1;
}
.lane .sig.me { background: var(--copper); color: #2b1d02; }
.lane .sig.frozen { background: #8fb0ff; }
.lane .sig.done { background: var(--ok); }
@media (prefers-reduced-motion: reduce) { .lane .sig, .ans, .btn { transition: none; } }

/* ---------- Öğretmen sunum ekranı ---------- */
.host { min-height: 100dvh; display: flex; flex-direction: column; }
.host-bar { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 12px 20px; background: #0007; flex-wrap: wrap; }
.host-bar .title { font-family: var(--display); font-weight: 800; font-size: 1.2rem; }
.host-bar .actions { display: flex; gap: 8px; flex-wrap: wrap; }
.host-main { flex: 1; padding: 20px; display: flex; flex-direction: column; gap: 20px; width: 100%; max-width: 1400px; margin: 0 auto; }
.lobby { display: grid; grid-template-columns: minmax(0, 1fr); gap: 28px; text-align: center; justify-items: center; padding-top: 2vh; }
.lobby .how { font-size: clamp(1.1rem, 2.4vw, 1.6rem); }
.lobby .how b { color: var(--copper); }
.lobby .pin { font-size: clamp(3.5rem, 13vw, 9rem); line-height: 1; padding: .2em .6em; }
.roster { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; max-width: 1100px; }
.roster .p { background: var(--silk); color: var(--ink); padding: .35em .9em; border-radius: 999px; font-weight: 700; border: 0; cursor: pointer; font-size: 1.05rem; }
.roster .p.off { opacity: .45; }
.roster .p:hover { background: #ffd0d1; text-decoration: line-through; }
.count { font-family: var(--display); font-size: 1.4rem; }
.host-q { font-family: var(--display); font-weight: 800; font-size: clamp(1.6rem, 3.4vw, 3rem); text-align: center; background: var(--silk); color: var(--ink); border-radius: var(--r-lg); padding: 24px 28px; }
.host-row { display: flex; justify-content: space-between; align-items: center; gap: 16px; }
.big-timer { width: 110px; height: 110px; border-radius: 50%; display: grid; place-items: center; font-family: var(--display); font-weight: 800; font-size: 3rem; background: #17181a; border: 6px solid var(--copper); }
.host .answers { min-height: 32vh; }
.host .ans { font-size: clamp(1.2rem, 2.2vw, 1.8rem); cursor: default; }
.ans .cnt { margin-left: auto; font-family: var(--display); font-size: 1.6rem; }
.explain { background: #0006; border-radius: var(--r-md); padding: 12px 16px; font-size: 1.15rem; }
.board-list { list-style: none; padding: 0; margin: 0 auto; width: min(760px, 100%); display: grid; gap: 8px; counter-reset: r; }
.board-list li { display: flex; align-items: center; gap: 14px; background: var(--silk); color: var(--ink); border-radius: var(--r-md); padding: 10px 16px; font-weight: 700; font-size: 1.25rem; }
.board-list li .rk { font-family: var(--display); font-weight: 800; width: 2ch; color: var(--muted); }
.board-list li .sc { margin-left: auto; font-family: var(--display); font-weight: 800; }
.board-list li:nth-child(1) { background: var(--copper); }
.podium { display: flex; justify-content: center; align-items: flex-end; gap: 14px; margin-top: 2vh; }
.podium .step { width: min(220px, 30vw); text-align: center; }
.podium .step .name { font-family: var(--display); font-weight: 800; font-size: clamp(1.1rem, 2.5vw, 1.8rem); }
.podium .step .block { background: var(--silk); color: var(--ink); border-radius: var(--r-md) var(--r-md) 0 0; display: grid; place-items: center; font-family: var(--display); font-weight: 800; font-size: 3rem; }
.podium .s1 .block { height: 220px; background: var(--copper); } .podium .s2 .block { height: 160px; } .podium .s3 .block { height: 120px; }
.feed { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; font-size: 1.05rem; }
.feed li { background: #0006; padding: 6px 12px; border-radius: var(--r-sm); }
.split { display: grid; grid-template-columns: 2fr 1fr; gap: 24px; align-items: start; }
@media (max-width: 860px) { .split { grid-template-columns: 1fr; } }

/* ---------- Öğretmen paneli (açık zemin) ---------- */
.desk-top { background: var(--pcb); color: var(--silk); }
.desk-top .in { max-width: 1100px; margin: 0 auto; padding: 14px 16px; display: flex; align-items: center; gap: 20px; flex-wrap: wrap; }
.desk-top .logo { font-size: 1.8rem; margin: 0; }
.tabs { display: flex; gap: 4px; flex: 1; flex-wrap: wrap; }
.tab { border: 0; background: transparent; color: #cfe3da; padding: .5em .9em; border-radius: var(--r-sm); cursor: pointer; font-weight: 700; }
.tab[aria-current="page"] { background: var(--silk); color: var(--ink); }
.tab { text-decoration: none; }
.who { font-size: .95rem; display: flex; gap: 10px; align-items: center; }
.who button { background: none; border: 0; color: var(--copper); cursor: pointer; font-weight: 700; padding: 0; }
.page { max-width: 1100px; margin: 0 auto; padding: 24px 16px 60px; }
.page h1 { font-size: 2rem; }
.page a:not(.btn) { color: var(--pcb); font-weight: 700; }
.lead { color: var(--muted); max-width: 65ch; margin-top: -.3em; }
.panel { background: #fff; border-radius: var(--r-lg); padding: 22px; border: 1px solid #d3dfda; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 720px) { .grid2 { grid-template-columns: 1fr; } }
.seg { display: inline-flex; background: var(--desk); border-radius: var(--r-md); padding: 4px; gap: 4px; flex-wrap: wrap; }
.seg button { border: 0; background: transparent; padding: .45em 1em; border-radius: var(--r-sm); cursor: pointer; font-weight: 700; color: var(--muted); }
.seg button[aria-pressed="true"] { background: var(--ink); color: var(--silk); }
.outcomes { display: grid; gap: 8px; }
.outcome { display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; border-radius: var(--r-md); border: 2px solid #d3dfda; cursor: pointer; }
.outcome:has(input:checked) { border-color: var(--pcb); background: #eef6f2; }
.outcome input { margin-top: .3em; accent-color: var(--pcb); width: 18px; height: 18px; }
.code { font-weight: 700; color: var(--pcb); white-space: nowrap; }
.stack { display: grid; gap: 18px; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.row.end { justify-content: flex-end; }
.quiz-list { display: grid; gap: 10px; }
.quiz-item { display: grid; grid-template-columns: 1fr auto; gap: 10px; align-items: center; background: #fff; border: 1px solid #d3dfda; border-radius: var(--r-md); padding: 14px 16px; }
.quiz-item h3 { font-size: 1.2rem; margin: 0 0 .15em; }
.meta { color: var(--muted); font-size: .92rem; }
.empty { text-align: center; padding: 40px 16px; color: var(--muted); }
.empty .btn { margin-top: 12px; }
.status { padding: 12px 14px; border-radius: var(--r-md); font-weight: 700; }
.status.err { background: #fde3e4; color: #8b1d22; }
.status.info { background: #e3efe9; color: var(--ink); }

/* Soru düzenleyici */
.qedit { border: 1px solid #d3dfda; border-radius: var(--r-md); padding: 14px; display: grid; gap: 10px; background: #fff; }
.qedit .opts { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
@media (max-width: 640px) { .qedit .opts { grid-template-columns: 1fr; } }
.opt { display: flex; gap: 8px; align-items: center; }
.opt input[type="radio"] { accent-color: var(--ok); width: 20px; height: 20px; flex: 0 0 auto; }
.opt .sw { width: 14px; height: 14px; border-radius: 3px; flex: 0 0 auto; }
textarea.input { resize: vertical; min-height: 64px; }

/* Modal */
dialog { border: 0; border-radius: var(--r-lg); padding: 0; width: min(520px, calc(100% - 32px)); }
dialog::backdrop { background: #082a20cc; }
dialog .in { padding: 24px; display: grid; gap: 16px; }

/* Rapor */
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 8px 10px; border-bottom: 1px solid #e1e9e5; vertical-align: top; }
th { font-size: .9rem; color: var(--muted); font-weight: 700; }
.bar { height: 10px; background: #e1e9e5; border-radius: 10px; overflow: hidden; min-width: 80px; }
.bar > i { display: block; height: 100%; background: var(--pcb); }
.pct { font-weight: 700; }
.low { color: #b3261e; }
.scroll { overflow-x: auto; }

/* Giriş sayfası (öğretmen) */
.auth { min-height: 100dvh; display: grid; grid-template-columns: 1fr 1fr; }
.auth .side { background: var(--pcb); color: var(--silk); padding: 48px; display: flex; flex-direction: column; justify-content: space-between; }
.auth .side p { color: #cfe3da; max-width: 40ch; font-size: 1.1rem; }
.auth .form { display: grid; place-items: center; padding: 32px 16px; }
.auth form { width: min(380px, 100%); display: grid; gap: 14px; }
@media (max-width: 760px) { .auth { grid-template-columns: 1fr; } .auth .side { padding: 28px 16px; } }
.copper-link { color: var(--copper); }
a.plain { color: inherit; text-decoration: none; }
.lbl { font-weight: 700; }

/* ---------- Kumanda ---------- */
.how.small { font-size: clamp(1rem, 1.6vw, 1.2rem); color: #cfe3da; margin-top: -18px; }
.roster .p .rid { display: inline-block; background: var(--ink); color: var(--silk); border-radius: 6px; font-size: .8em; padding: 0 .4em; margin-right: .4em; }
.roster .p .low { color: #b3261e; font-size: .85em; }
.ans .key { margin-left: auto; flex: 0 0 auto; width: 1.8em; height: 1.8em; border-radius: 50%; display: grid; place-items: center; background: #fff3; font-family: var(--display); font-weight: 800; }
.ans .cnt + .key { margin-left: 12px; }
.rx-on { box-shadow: inset 0 0 0 2px var(--ok) !important; color: #b9f3d3 !important; }
.sim { position: fixed; right: 0; bottom: 0; left: 0; max-height: 52vh; overflow: auto; background: #0b2c22f2; border-top: 3px solid var(--copper); padding: 12px 16px; z-index: 40; color: var(--silk); }
.sim-head { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; margin-bottom: 10px; }
.sim-head .meta { color: #a9c8bc; flex: 1; }
.sim-list { display: flex; gap: 14px; flex-wrap: wrap; }
.remote { background: #23262b; border-radius: 22px; padding: 12px; width: 260px; box-shadow: 0 6px 0 #000a; }
.remote-top { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; font-size: .9rem; }
.remote-top .linkish { margin-left: auto; background: none; border: 0; color: #a9c8bc; cursor: pointer; }
.led { width: 12px; height: 12px; border-radius: 50%; background: #333; box-shadow: 0 0 8px currentColor; }
.oled { background: #000; color: #e9f2ff; font: 13px/1.25 ui-monospace, 'Cascadia Mono', Menlo, Consolas, monospace; padding: 6px 8px; border-radius: 4px; min-height: 92px; white-space: pre; overflow: hidden; }
.oled .oh { display: flex; justify-content: space-between; background: #e9f2ff; color: #000; margin: -2px -4px 3px; padding: 0 4px; }
.remote-ctl { display: flex; justify-content: space-between; align-items: center; margin-top: 12px; }
.joy { display: grid; grid-template-columns: repeat(3, 30px); grid-template-rows: repeat(3, 30px); gap: 2px; }
.jbtn { border: 0; border-radius: 6px; background: #3a3f46; color: #ddd; cursor: pointer; font-size: .8rem; }
.ju { grid-area: 1 / 2; } .jl { grid-area: 2 / 1; } .jc { grid-area: 2 / 2; border-radius: 50%; } .jr { grid-area: 2 / 3; } .jd { grid-area: 3 / 2; }
.keys { display: grid; grid-template-columns: repeat(2, 48px); gap: 8px; }
.kbtn { border: 0; height: 44px; border-radius: 50%; color: #fff; font-family: var(--display); font-weight: 800; font-size: 1.1rem; cursor: pointer; box-shadow: 0 3px 0 #0008; }
.kbtn:active { transform: translateY(2px); box-shadow: none; }
.kbtn.ans2 { color: #2a1e00; }
