/* Compute It — yenilenmiş görünüm (yalnızca görsel; mantık app.js'te değişmedi)
   NOT: app.js hücre/kod boyutunu .board ve .code-wrap'ın ÖLÇÜSÜNDEN hesaplar; bu iki elemana iç boşluk (padding) koymayın,
   süslemeyi dış sarmalayıcılarda (.board-frame, .code-card) yapın. */
:root {
  --bg-1: #eef4ff;
  --bg-2: #dbe8ff;
  --ink: #0b2447;
  --soft: #5b7096;
  --line: #d3e1fb;
  --cyan: #0ea5e9;
  --green: #16a34a;
  --pink: #e11d48;
  --gold: #f59e0b;
  --brand: #2563eb;
  --panel-1: #0b1e45;
  --panel-2: #16357a;
  --font: "Nunito", "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "Cascadia Code", "Consolas", "Courier New", monospace;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; width: 100%; height: 100%; font-family: var(--font); color: var(--ink); }
body {
  background:
    radial-gradient(900px 500px at 8% -10%, #ffffff 0%, transparent 60%),
    radial-gradient(700px 500px at 100% 110%, #c7dcff 0%, transparent 60%),
    radial-gradient(circle, rgba(37, 99, 235, .10) 1.2px, transparent 1.6px) 0 0 / 26px 26px,
    linear-gradient(160deg, var(--bg-1), var(--bg-2));
}
.app {
  width: 100%;
  height: 100dvh;
  min-height: 0;
  display: grid;
  grid-template-columns: 1fr minmax(290px, 34%);
  gap: 22px;
  padding: 18px 22px;
  overflow: hidden;
}

/* ---------- sol taraf: üst şerit, sayaçlar, tahta ---------- */
.board-wrap { display: flex; flex-direction: column; min-height: 0; min-width: 0; }
.top-row { display: flex; gap: 10px; margin-bottom: 12px; align-items: center; flex-wrap: wrap; }
.brand { display: flex; align-items: center; gap: 9px; margin-right: 4px; }
.brand-logo {
  width: 38px; height: 38px; display: grid; place-items: center; font-size: 21px; border-radius: 12px;
  background: linear-gradient(145deg, #3b82f6, #1d4ed8); box-shadow: 0 6px 14px rgba(37, 99, 235, .35), inset 0 1px 0 rgba(255, 255, 255, .35);
}
.brand-name { font-weight: 900; font-size: 19px; letter-spacing: .3px; color: var(--ink); white-space: nowrap; }
.level-pill, .progress-pill, .xp-pill {
  background: #fff;
  color: var(--ink);
  border-radius: 999px;
  padding: 7px 14px;
  font-weight: 800;
  font-size: 14px;
  border: 1px solid var(--line);
  box-shadow: 0 4px 10px rgba(15, 45, 92, .06);
}
.level-pill { background: linear-gradient(135deg, #2563eb, #1d4ed8); color: #fff; border-color: transparent; box-shadow: 0 6px 14px rgba(37, 99, 235, .3); }
.level-pill span { font-variant-numeric: tabular-nums; }
.progress-pill::before { content: "✅ "; }
.xp-pill { background: linear-gradient(135deg, #fde68a, #fbbf24); color: #7c2d12; border-color: rgba(245, 158, 11, .55); box-shadow: 0 6px 14px rgba(245, 158, 11, .28); }
.xp-pill span { font-variant-numeric: tabular-nums; }

.board-stage {
  flex: 1;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 16px;
  min-height: 0;
}
.board-frame {
  display: flex;
  min-width: 0;
  min-height: 0;
  padding: clamp(10px, 2vw, 24px);
  border-radius: 30px;
  background:
    radial-gradient(circle at 50% 0%, rgba(96, 165, 250, .28), transparent 60%),
    radial-gradient(circle, rgba(255, 255, 255, .07) 1.2px, transparent 1.6px) 0 0 / 24px 24px,
    linear-gradient(150deg, var(--panel-2), var(--panel-1));
  border: 1px solid rgba(255, 255, 255, .12);
  box-shadow: 0 22px 46px rgba(11, 36, 71, .38), inset 0 1px 0 rgba(255, 255, 255, .18);
}
.board {
  flex: 1;
  display: grid;
  gap: 14px;
  align-content: center;
  justify-content: center;
  transition: transform 0.45s ease, opacity 0.45s ease, filter 0.45s ease;
  min-width: 0;
  min-height: 0;
}
.board:focus { outline: none; }
.board.advance { transform: scale(1.03); opacity: 0.55; filter: blur(1px); }

/* ---------- hücreler: parlak cam toplar ---------- */
.cell {
  position: relative;
  width: var(--cell-size, 92px);
  height: var(--cell-size, 92px);
  border-radius: 999px;
  background: radial-gradient(circle at 32% 26%, #f1f8ff 0%, #a6d3fb 38%, #5aa4ee 100%);
  box-shadow: inset 0 -7px 12px rgba(15, 45, 92, .30), inset 0 4px 7px rgba(255, 255, 255, .65), 0 7px 14px rgba(0, 0, 0, .32);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background .3s ease, box-shadow .3s ease, transform .25s ease;
}
.cell.wall { /* engel / boş çukur */
  opacity: .5;
  background: radial-gradient(circle at 50% 35%, #0a1530, #131f40);
  box-shadow: inset 0 5px 10px rgba(0, 0, 0, .7), inset 0 -2px 4px rgba(255, 255, 255, .08);
}
.cell.trail-a { background: radial-gradient(circle at 32% 26%, #e7f9ff 0%, #6fd6fb 40%, #0ea5e9 100%); }
.cell.trail-b { background: radial-gradient(circle at 32% 26%, #e8fdef 0%, #86efac 40%, #16a34a 100%); }
.cell.trail-c { background: radial-gradient(circle at 32% 26%, #fff0f8 0%, #f9a8d4 40%, #db2777 100%); }
.board.solved .cell.trail-a,
.board.solved .cell.trail-b,
.board.solved .cell.trail-c {
  background: radial-gradient(circle at 32% 26%, #ecfff3 0%, #6ee7a0 42%, #15803d 100%);
  box-shadow: inset 0 -7px 12px rgba(0, 60, 20, .3), inset 0 4px 7px rgba(255, 255, 255, .6), 0 0 0 3px rgba(74, 222, 128, .35), 0 0 18px rgba(74, 222, 128, .55);
}
.cell.goal { background: radial-gradient(circle at 32% 26%, #ffffff 0%, #e2e8f0 45%, #94a3b8 100%); }
.cell.goal-color-1 { background: radial-gradient(circle at 32% 26%, #e7f9ff 0%, #6fd6fb 40%, #0ea5e9 100%); }
.cell.goal-color-2 { background: radial-gradient(circle at 32% 26%, #e8fdef 0%, #86efac 40%, #16a34a 100%); }
.cell.goal-color-3 { background: radial-gradient(circle at 32% 26%, #fff0f8 0%, #f9a8d4 40%, #db2777 100%); }

/* ---------- top ---------- */
.ball {
  width: max(16px, calc(var(--cell-size, 92px) * .42));
  height: max(16px, calc(var(--cell-size, 92px) * .42));
  border-radius: 50%;
  background: radial-gradient(circle at 32% 28%, #ffffff 0%, #fff1f5 50%, #fecdd3 100%);
  border: max(3px, calc(var(--cell-size, 92px) * .07)) solid var(--pink);
  position: relative;
  box-shadow: 0 7px 12px rgba(0, 0, 0, .38), inset 0 -4px 6px rgba(0, 0, 0, .12);
  will-change: transform; /* kayma animasyonu app.js'ten satır içi transform ile verilir */
}
.ball.signal-1 { border-color: #0ea5e9; background: radial-gradient(circle at 32% 28%, #fff, #eaf8ff 50%, #bae6fd); }
.ball.signal-2 { border-color: #16a34a; background: radial-gradient(circle at 32% 28%, #fff, #effdf4 50%, #bbf7d0); }
.ball.signal-3 { border-color: #db2777; background: radial-gradient(circle at 32% 28%, #fff, #fff0f8 50%, #fbcfe8); }
.ball.done {
  animation: ballDonePop 0.5s ease;
  border-color: #16a34a;
  background: radial-gradient(circle at 32% 28%, #fff, #ecfdf3 55%, #86efac);
}
.ball.done::after {
  content: "✓";
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #15803d;
  font-weight: 900;
  font-size: max(12px, calc(var(--cell-size, 92px) * .22));
}
@keyframes ballDonePop {
  0% { transform: scale(1); }
  45% { transform: scale(1.28); }
  100% { transform: scale(1); }
}

/* ---------- sağ taraf: kod kartı ---------- */
.code-card {
  display: flex;
  min-width: 0;
  min-height: 0;
  padding: 20px 20px 18px;
  border-radius: 28px;
  color: #e6eeff;
  background:
    radial-gradient(500px 260px at 100% 0%, rgba(59, 130, 246, .28), transparent 60%),
    linear-gradient(165deg, #0d1a38, #12264f);
  border: 1px solid rgba(255, 255, 255, .1);
  box-shadow: 0 22px 46px rgba(11, 36, 71, .38), inset 0 1px 0 rgba(255, 255, 255, .12);
  overflow: hidden;
}
.code-wrap {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
}
.code-wrap h2 {
  margin: 0 0 10px;
  color: #fff;
  font-size: 19px;
  font-weight: 900;
  letter-spacing: .3px;
  display: flex;
  align-items: center;
  gap: 9px;
}
.code-wrap h2::before {
  content: "</>";
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 800;
  color: #bfdbfe;
  background: rgba(96, 165, 250, .22);
  border: 1px solid rgba(147, 197, 253, .35);
  padding: 3px 7px;
  border-radius: 8px;
}
.cmd-list {
  color: #dbe7ff;
  font-family: var(--mono);
  font-size: var(--code-font-size, 18px);
  line-height: var(--code-line-height, 20px);
  min-width: 0;
  flex: 0 1 auto;
  overflow: visible;
  padding: 0;
}
.cmd-list .line { display: block; white-space: pre; min-width: 0; border-radius: 6px; }
.cmd-list.compact-columns {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  column-gap: 8px;
  align-content: start;
}
.cmd-list .kw-red { color: #fb7185; font-weight: 800; }
.cmd-list .kw-blue { color: #60a5fa; font-weight: 800; }
.cmd-list .i0 { padding-left: 0; }
.cmd-list .i1 { padding-left: var(--code-indent, 13px); }
.cmd-list .i2 { padding-left: calc(var(--code-indent, 13px) * 2); }
.cmd-list .i3 { padding-left: calc(var(--code-indent, 13px) * 3); }
/* Adım yardımcısı yok: sıradaki satır işaretlenmez, öğrenci kod sırasını kendisi takip eder. */
.cmd-list .ok { color: #4ade80; }
.cmd-list .bad { color: #fca5a5; background: rgba(248, 113, 113, .16); box-shadow: inset 3px 0 0 #f87171; }

.vars-box {
  margin-top: 10px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  align-self: flex-start;
  background: rgba(251, 191, 36, .14);
  color: #fde68a;
  border: 1px solid rgba(251, 191, 36, .45);
  border-radius: 999px;
  padding: 6px 13px;
  font-family: var(--mono);
  font-weight: 800;
}
.runner-status {
  margin-top: 14px;
  color: #fecaca;
  background: rgba(239, 68, 68, .16);
  border: 1px solid rgba(248, 113, 113, .45);
  border-radius: 12px;
  padding: 9px 12px;
  font-weight: 700;
  font-size: 14px;
  line-height: 1.5;
  overflow-wrap: anywhere;
}
.actions { margin-top: 14px; display: flex; gap: 8px; flex-wrap: wrap; }
.actions button {
  border: 0;
  border-radius: 14px;
  padding: 10px 15px;
  font-family: inherit;
  font-weight: 900;
  font-size: 14px;
  cursor: pointer;
  color: #fff;
  background: linear-gradient(135deg, #3b82f6, #2563eb);
  box-shadow: 0 8px 16px rgba(37, 99, 235, .35);
  transition: transform .12s, filter .12s, box-shadow .12s;
}
.actions button:hover:not([disabled]) { transform: translateY(-2px); filter: brightness(1.08); }
.actions button:active:not([disabled]) { transform: translateY(0); }
#btn-reset { background: rgba(255, 255, 255, .1); border: 1px solid rgba(255, 255, 255, .22); box-shadow: none; color: #e6eeff; }
#btn-reset::before { content: "↺ "; }
#btn-next { background: linear-gradient(135deg, #22c55e, #15803d); box-shadow: 0 8px 16px rgba(21, 128, 61, .4); }
#btn-next::after { content: " ›"; font-weight: 900; }
.actions button[disabled] { opacity: .42; cursor: not-allowed; box-shadow: none; }
.reset-flash { animation: resetFlash 0.45s ease; }
@keyframes resetFlash {
  0% { transform: scale(1); opacity: 1; filter: none; }
  50% { transform: scale(0.985); opacity: 0.55; filter: blur(1px); }
  100% { transform: scale(1); opacity: 1; filter: none; }
}

/* ---------- pencereler ---------- */
.modal.hidden { display: none; }
.modal { position: fixed; inset: 0; z-index: 100; display: flex; align-items: center; justify-content: center; padding: 14px; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(8, 18, 44, .62); backdrop-filter: blur(3px); }
.modal-content {
  position: relative;
  z-index: 1;
  width: min(600px, 94vw);
  background: #fff;
  border-radius: 22px;
  padding: 20px;
  box-shadow: 0 26px 60px rgba(0, 0, 0, .4);
  animation: modalPop .28s cubic-bezier(.2, .9, .3, 1.2);
}
.modal-content h3 { margin: 0 0 12px; font-size: 20px; font-weight: 900; color: var(--ink); }
.modal-content p { color: var(--soft); font-weight: 700; line-height: 1.5; }
@keyframes modalPop { from { transform: scale(.9); opacity: 0; } to { transform: scale(1); opacity: 1; } }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.form-grid input {
  border: 2px solid var(--line);
  border-radius: 12px;
  padding: 10px 12px;
  font-family: inherit;
  font-weight: 700;
  color: var(--ink);
  background: #f8fbff;
}
.form-grid input:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px rgba(37, 99, 235, .18); background: #fff; }
.modal-actions { margin-top: 14px; display: flex; justify-content: flex-end; gap: 8px; }
.modal-actions button {
  border: 0;
  border-radius: 12px;
  padding: 10px 16px;
  cursor: pointer;
  font-family: inherit;
  font-weight: 900;
  background: linear-gradient(135deg, #3b82f6, #2563eb);
  color: #fff;
  box-shadow: 0 6px 14px rgba(37, 99, 235, .3);
}
.modal-actions .ghost { background: #e8eefb; color: #1e293b; box-shadow: none; }
.modal-actions .danger { background: linear-gradient(135deg, #ef4444, #dc2626); color: #fff; box-shadow: 0 6px 14px rgba(220, 38, 38, .3); }

/* ---------- küçük ekranlar ---------- */
@media (max-width: 1024px) {
  .app {
    grid-template-columns: 1fr;
    grid-template-rows: minmax(0, 34vh) minmax(0, 1fr);
    gap: 6px;
    padding: 8px;
  }
  .brand-logo { width: 28px; height: 28px; font-size: 15px; border-radius: 9px; }
  .brand-name { font-size: 15px; }
  .top-row { margin-bottom: 6px; gap: 6px; }
  .board-stage {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: minmax(0, 1fr);
    gap: 6px;
  }
  .board-frame { padding: 8px; border-radius: 18px; }  .board { gap: 4px; }
  .cell { width: var(--cell-size, 28px); height: var(--cell-size, 28px); }
  .code-card { padding: 10px 12px; border-radius: 18px; }
  .code-wrap { justify-content: space-between; }
  .code-wrap h2 { margin-bottom: 4px; font-size: 15px; }
  .code-wrap h2::before { font-size: 10px; padding: 2px 5px; }
  .vars-box { margin-top: 4px; padding: 3px 9px; font-size: 12px; }
  .runner-status { margin-top: 4px; padding: 6px 8px; font-size: 11px; line-height: 1.2; }
  .actions { margin-top: 4px; }
  .actions button { padding: 6px 10px; font-size: 12px; border-radius: 10px; }
}
@media (max-width: 1024px) and (orientation: landscape) {
  .app {
    grid-template-columns: minmax(0, 40%) minmax(0, 1fr);
    grid-template-rows: minmax(0, 1fr);
    gap: 4px;
    padding: 6px;
  }
  .top-row { gap: 4px; margin-bottom: 4px; }
  .brand-name { display: none; }
  .level-pill, .progress-pill, .xp-pill { padding: 4px 9px; font-size: 11px; }
  .board-stage {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: minmax(0, 1fr);
    gap: 4px;
  }}
@media (max-width: 640px) {
  .form-grid { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
.actions button[hidden] { display: none; }
#btn-hint { background: rgba(250, 204, 21, .18); border: 1px solid rgba(250, 204, 21, .5); box-shadow: none; color: #fde68a; }

/* Seviye seçici penceresi */
.level-pill-btn { font: inherit; color: inherit; cursor: pointer; }
.level-pill-btn:hover { filter: brightness(1.12); }
.picker-card { width: min(880px, 94vw); max-height: 90vh; overflow: auto; text-align: left; }
.picker-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.picker-head h3 { margin: 0; font-size: 20px; font-weight: 900; }
.picker-x { min-width: 38px; padding: 6px 10px; }
.picker-group { margin-bottom: 16px; }
.picker-group h4 { margin: 0 0 8px; font-size: 14px; font-weight: 900; display: flex; align-items: center; gap: 8px; }
.picker-group h4 small { color: var(--soft); font-weight: 800; }
.picker-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(72px, 1fr)); gap: 8px; }
.picker-tile {
  position: relative; display: grid; gap: 2px; justify-items: center; padding: 10px 4px 8px; border-radius: 14px;
  border: 2px solid var(--line); background: #f4f8ff; color: var(--ink); font: inherit; font-weight: 900; cursor: pointer;
  transition: transform .12s, border-color .12s;
}
.picker-tile:hover:not(:disabled) { transform: translateY(-2px); border-color: var(--brand); }
.picker-tile .t-num { font-size: 18px; }
.picker-tile .t-state { font-size: 11px; color: var(--soft); font-weight: 800; }
.picker-tile.done { border-color: #86efac; background: #e8f9ee; }
.picker-tile.current { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(37, 99, 235, .25); }
.picker-tile:disabled { opacity: .45; cursor: not-allowed; }
.picker-tile .lock { position: absolute; top: 4px; right: 5px; font-size: 11px; }
