/* ===== Matematik Animasyonları — ortak stiller (basic-IT stillerinden uyarlandı) ===== */
@font-face { font-family: "Nunito"; font-style: normal; font-display: swap; font-weight: 200 1000; src: url(../vendor/fonts/nunito-latin-ext-wght-normal.woff2) format("woff2"); unicode-range: U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,U+0304,U+0308,U+0329,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF; }
@font-face { font-family: "Nunito"; font-style: normal; font-display: swap; font-weight: 200 1000; src: url(../vendor/fonts/nunito-latin-wght-normal.woff2) format("woff2"); unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD; }
:root {
  --bg: #eef3fa;
  --panel: #ffffff;
  --ink: #1d2a3a;
  --muted: #5b6b80;
  --line: #d5deea;
  --accent: #3b6cf6;
  --ok: #16a34a;
  --bad: #e5484d;
  --glow: #ffcc00;
  --radius: 18px;
  --font: 'Nunito', 'Segoe UI', system-ui, sans-serif;
  --font-emoji: 'Nunito', 'Segoe UI Emoji', 'Apple Color Emoji', 'Noto Color Emoji', sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  -webkit-tap-highlight-color: transparent;
}
button { font-family: inherit; }

.btn {
  display: inline-flex; align-items: center; gap: .5em;
  min-height: 64px; padding: 0 28px;
  border: 0; border-radius: 999px;
  background: var(--accent); color: #fff;
  font-size: 24px; font-weight: 800; text-decoration: none;
  cursor: pointer; user-select: none;
  box-shadow: 0 4px 0 rgba(0,0,0,.18);
  transition: transform .1s, filter .15s, opacity .2s;
}
.btn:hover { filter: brightness(1.08); }
.btn:active { transform: translateY(3px); box-shadow: 0 1px 0 rgba(0,0,0,.18); }
.btn:disabled { opacity: .35; cursor: default; filter: none; transform: none; }
.btn.ghost { background: #fff; color: var(--ink); box-shadow: 0 0 0 2px var(--line) inset; }
.btn.big { min-height: 76px; font-size: 28px; padding: 0 36px; }

/* ===== Konu oynatıcısı ===== */
.lesson { height: 100vh; height: 100dvh; display: flex; flex-direction: column; overflow: hidden; }

.topbar {
  display: flex; align-items: center; gap: 20px;
  padding: 12px 20px;
  background: var(--panel);
  border-bottom: 4px solid var(--accent);
}
.topbar .ttl { flex: 1; min-width: 0; text-align: center; }
.topbar .cat { display: block; font-size: 18px; font-weight: 800; color: var(--accent); text-transform: uppercase; letter-spacing: .06em; }
.topbar h1 { margin: 0; font-size: 36px; line-height: 1.1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar h1 small { font-size: 24px; color: var(--muted); font-weight: 700; }

.stage {
  flex: 1; min-height: 0;
  container-type: size;
  display: grid; place-items: center;
  padding: 12px;
}
.canvas {
  position: relative;
  width: min(100cqw, calc(100cqh * 16 / 9));
  aspect-ratio: 16 / 9;
  container-type: inline-size;
  background: var(--panel);
  border-radius: var(--radius);
  box-shadow: 0 10px 30px rgba(29,42,58,.10);
  overflow: hidden;
}
.canvas > svg { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
svg text { font-family: var(--font-emoji); }

/* Sahne görünürlüğü */
[data-s]:not(.anim) { transition: opacity .5s ease, visibility .5s; }
.notrans [data-s] { transition: none !important; }
.off { opacity: 0; visibility: hidden; pointer-events: none; }

/* Vurgulama */
.hl { animation: hlpulse 1.3s ease-in-out infinite; }
@keyframes hlpulse {
  0%, 100% { filter: drop-shadow(0 0 2px var(--glow)) drop-shadow(0 0 4px var(--glow)); }
  50%      { filter: drop-shadow(0 0 10px var(--glow)) drop-shadow(0 0 22px var(--glow)); }
}
.dot { filter: drop-shadow(0 0 6px currentColor); }

/* Alt bölüm: altyazı + kontroller */
.bottom {
  display: flex; align-items: center; gap: 20px;
  padding: 14px 20px 18px;
  background: var(--panel);
  border-top: 2px solid var(--line);
}
.caption { flex: 1; min-width: 0; display: flex; align-items: center; gap: 18px; min-height: 96px; }
.caption .step {
  flex: none; display: grid; place-items: center;
  width: 72px; height: 72px; border-radius: 50%;
  background: var(--accent); color: #fff; font-size: 24px; font-weight: 900;
}
.caption p { margin: 0; font-size: clamp(22px, 2.1vw, 34px); line-height: 1.3; font-weight: 700; }

.controls { flex: none; display: flex; align-items: center; gap: 14px; }
.dots { display: flex; gap: 8px; flex-wrap: wrap; max-width: 300px; justify-content: center; }
.dots button {
  width: 22px; height: 22px; padding: 0; border-radius: 50%;
  border: 3px solid var(--accent); background: #fff; cursor: pointer;
}
.dots button.on { background: var(--accent); }
.dots button.game { width: auto; height: 26px; padding: 0 8px; border-radius: 13px; font-size: 14px; font-weight: 800; color: var(--accent); line-height: 1; }
.dots button.game.on { color: #fff; }

/* ===== Sürükle-bırak oyunu ===== */
.overlay { position: absolute; inset: 0; display: none; font-size: 2cqw; }
.overlay.on { display: block; }

.bank {
  position: absolute;
  display: flex; flex-direction: column; align-items: stretch; justify-content: center; gap: .45em;
  padding: 1em;
  background: #f3f6fb; border: .15em dashed var(--line); border-radius: 1em;
}
.bank::before { content: 'Etiketler'; font-weight: 900; color: var(--muted); text-align: center; font-size: .9em; }

.chip {
  display: inline-flex; align-items: center; justify-content: center;
  padding: .35em .8em;
  background: var(--accent); color: #fff;
  border-radius: .7em;
  font-weight: 900; white-space: nowrap;
  box-shadow: 0 .2em 0 rgba(0,0,0,.2);
  cursor: grab; user-select: none; touch-action: none;
  position: relative; z-index: 2;
}
.chip.sel { outline: .2em solid var(--glow); outline-offset: .15em; }
.chip.dragging { cursor: grabbing; pointer-events: none; z-index: 50; box-shadow: 0 .6em 1.2em rgba(0,0,0,.3); }
.chip.done { background: var(--ok); cursor: default; box-shadow: 0 .15em .4em rgba(0,0,0,.25); }

.zone {
  position: absolute;
  display: flex; align-items: center; justify-content: center;
  border: .18em dashed rgba(255,255,255,.95);
  background: rgba(255,255,255,.18);
  border-radius: .6em;
  box-shadow: 0 0 0 .12em rgba(0,0,0,.25);
  transition: background .15s, border-color .15s;
}
.zone.hot { background: rgba(255,204,0,.45); border-color: var(--glow); border-style: solid; }
.zone.bad { background: rgba(229,72,77,.5); border-color: var(--bad); }
.zone.filled { border-style: solid; border-color: var(--ok); background: rgba(22,163,74,.25); }

/* Eşleştirme kartı türündeki hedefler */
.zone.card {
  flex-direction: column; gap: .4em; padding: .6em;
  background: #fff; border-color: var(--line); box-shadow: 0 .2em .6em rgba(0,0,0,.08);
  color: var(--ink); font-weight: 700; text-align: center; line-height: 1.25;
}
.zone.card .slot { min-height: 2.4em; min-width: 70%; border-radius: .6em; border: .15em dashed var(--line); display: flex; align-items: center; justify-content: center; }
.zone.card.hot { background: #fff8d6; }
.zone.card.filled { background: #ecfdf3; }
.zone.card.filled .slot { border: 0; }

/* Kazanma ekranı */
.win {
  position: absolute; inset: 0; z-index: 100;
  display: grid; place-items: center;
  background: rgba(29,42,58,.55);
}
.win .box {
  background: #fff; border-radius: 1.2em; padding: 1.6em 2.4em; text-align: center;
  box-shadow: 0 1em 3em rgba(0,0,0,.3);
}
.win h2 { margin: 0 0 .2em; font-size: 2.6em; }
.win p { margin: 0 0 1em; font-size: 1.2em; color: var(--muted); font-weight: 700; }
.win .row { display: flex; gap: .6em; justify-content: center; flex-wrap: wrap; }
.win .btn { font-size: 1em; min-height: 2.8em; }
.confetti { position: absolute; top: -20px; width: 14px; height: 20px; border-radius: 3px; z-index: 101; pointer-events: none; }

/* ===== Ana sayfa ===== */
.home { max-width: 1500px; margin: 0 auto; padding: 32px 24px 60px; }
.hero { display: flex; align-items: center; gap: 24px; flex-wrap: wrap; margin-bottom: 28px; }
.hero h1 { margin: 0; font-size: clamp(36px, 4vw, 60px); line-height: 1.05; }
.hero p { margin: 6px 0 0; font-size: 24px; color: var(--muted); font-weight: 700; }
.hero .grow { flex: 1; min-width: 280px; }
.progress { background: #fff; border-radius: var(--radius); padding: 16px 24px; font-size: 22px; font-weight: 800; box-shadow: 0 0 0 2px var(--line) inset; }
.progress .bar { height: 14px; width: 280px; max-width: 100%; background: var(--line); border-radius: 7px; margin-top: 8px; overflow: hidden; }
.progress .bar i { display: block; height: 100%; background: var(--ok); border-radius: 7px; }

.cat-sec { margin-top: 36px; }
.cat-sec h2 { display: flex; align-items: center; gap: 12px; margin: 0 0 16px; font-size: 34px; }
.cat-sec h2 .pill { width: 14px; height: 40px; border-radius: 7px; background: var(--c); }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 18px; }
.tcard {
  position: relative; display: flex; flex-direction: column; gap: 6px;
  min-height: 170px; padding: 20px;
  background: #fff; border-radius: var(--radius);
  border-top: 8px solid var(--c);
  box-shadow: 0 6px 18px rgba(29,42,58,.08);
  color: var(--ink); text-decoration: none;
  transition: transform .15s, box-shadow .15s;
}
a.tcard:hover { transform: translateY(-4px); box-shadow: 0 12px 28px rgba(29,42,58,.14); }
.tcard .ico { font-size: 48px; line-height: 1; }
.tcard b { font-size: 26px; line-height: 1.15; }
.tcard small { font-size: 18px; color: var(--muted); font-weight: 700; }
.tcard .badge { position: absolute; top: 14px; right: 14px; font-size: 15px; font-weight: 800; padding: 4px 10px; border-radius: 999px; background: #eef1f6; color: var(--muted); }
.tcard .badge.done { background: #dcfce7; color: var(--ok); }
.tcard.soon { opacity: .55; }

/* ===== Ses düğmeleri ===== */
.tools { display: flex; gap: 10px; align-items: center; }
.btn.icon { padding: 0 22px; font-size: 28px; }
.btn.muted { background: #fee2e2; color: var(--bad); box-shadow: 0 0 0 2px var(--bad) inset; }
@media (max-width: 1100px) { .tools .btn { padding: 0 16px; font-size: 20px; min-height: 52px; } }
.btn.wait { background: #fef9c3; color: #854d0e; box-shadow: 0 0 0 2px #facc15 inset; animation: hlpulse 1.3s ease-in-out infinite; }

/* ===== Keşif kaydırıcıları ===== */
.ctrls { position: absolute; inset: 0; pointer-events: none; font-size: 1.6cqw; z-index: 5; }
.slider {
  position: absolute; pointer-events: auto;
  display: grid; grid-template-columns: 1fr auto; gap: .35em .6em; align-items: center;
  padding: .7em 1em .9em;
  background: #fff; border-radius: .9em;
  box-shadow: 0 0 0 .15em var(--accent) inset, 0 .4em 1em rgba(29,42,58,.12);
  font-weight: 800; color: var(--ink);
}
.ctrls .tgl { position: absolute; pointer-events: auto; min-height: 0; padding: .55em 1em; font-size: 1.05em; justify-content: center;
  transition: filter .15s; /* transform/opacity'yi GSAP yönetiyor; CSS geçişi onunla çakışır */ }
.ctrls .tgl.on { background: #fef9c3; color: #854d0e; box-shadow: 0 0 0 .15em #facc15 inset; }
.slider .lb { font-size: .95em; }
.slider .val { font-size: 1.15em; color: var(--accent); font-variant-numeric: tabular-nums; }
.slider input {
  grid-column: 1 / -1; width: 100%; margin: 0; height: 1.6em;
  -webkit-appearance: none; appearance: none; background: transparent; cursor: pointer; touch-action: none;
}
.slider input::-webkit-slider-runnable-track { height: .5em; border-radius: .25em; background: linear-gradient(90deg, var(--accent) var(--p, 50%), var(--line) var(--p, 50%)); }
.slider input::-moz-range-track { height: .5em; border-radius: .25em; background: var(--line); }
.slider input::-moz-range-progress { height: .5em; border-radius: .25em; background: var(--accent); }
.slider input::-webkit-slider-thumb { -webkit-appearance: none; width: 1.5em; height: 1.5em; margin-top: -.5em; border-radius: 50%; background: #fff; border: .25em solid var(--accent); box-shadow: 0 .15em .3em rgba(0,0,0,.25); }
.slider input::-moz-range-thumb { width: 1.1em; height: 1.1em; border-radius: 50%; background: #fff; border: .25em solid var(--accent); }
.slider input:focus-visible { outline: .15em solid var(--glow); outline-offset: .2em; border-radius: .3em; }

/* Ana sayfa: ders kartlarındaki sıra numarası */
.tcard .num { font-size: 15px; font-weight: 900; color: var(--c); letter-spacing: .05em; }
.cat-sec .story { margin: -8px 0 14px 26px; color: var(--muted); font-weight: 700; font-size: 19px; }

/* ===== Klavye odağı (oyun) ===== */
.chip:focus-visible, .zone:focus-visible { outline: .2em solid var(--glow); outline-offset: .15em; }
.zone .zi { font-size: 2em; line-height: 1; }

/* ===== Uyarlanabilir yerleşim: altyazı sahneyi ezmesin ===== */
.btn { white-space: nowrap; }
.caption { min-height: 72px; }
.caption .step { width: 56px; height: 56px; font-size: 22px; }
.caption p { font-size: clamp(17px, min(1.6vw, 2.9vh), 30px); }
.bottom { padding: 10px 20px 12px; }
.topbar { padding: 8px 20px; }
.btn.big { min-height: 64px; font-size: 24px; padding: 0 28px; }

/* Tablet: altyazı tam genişlik, kontroller altında */
@media (max-width: 1100px) {
  .topbar { gap: 10px; padding: 6px 12px; }
  .topbar h1 { font-size: 26px; }
  .topbar h1 small { display: none; }
  .topbar .cat { font-size: 14px; }
  .bottom { flex-direction: column; align-items: stretch; gap: 8px; padding: 8px 12px 10px; }
  .caption { min-height: 0; gap: 12px; max-height: 26dvh; overflow-y: auto; }
  .caption .step { width: 42px; height: 42px; font-size: 18px; }
  .caption p { font-size: 20px; }
  .controls { justify-content: space-between; gap: 10px; }
  .dots { flex: 1; max-width: none; }
  .btn.big { min-height: 52px; font-size: 20px; padding: 0 20px; }
  .btn { min-height: 52px; font-size: 20px; padding: 0 16px; }
}

/* Alçak ekran (telefon yatay) */
@media (max-height: 500px) {
  .topbar .cat { display: none; }
  .topbar h1 { font-size: 18px; }
  .btn, .btn.big, .tools .btn { min-height: 38px; font-size: 16px; padding: 0 12px; }
  .bottom { flex-direction: row; padding: 4px 10px; align-items: center; }
  .caption { max-height: 22dvh; }
  .caption .step { display: none; }
  .caption p { font-size: 14px; }
  .controls { flex: none; }
  .dots { display: none; }
  .stage { padding: 4px; }
}

/* Telefon dik: düğmeler simgeye iner, kaydırıcı ve oyun sahnenin altına/üstüne yerleşir */
@media (max-width: 640px) {
  .tx { display: none; }
  .tools { gap: 6px; }
  .topbar .btn, .tools .btn { min-height: 44px; min-width: 44px; padding: 0 10px; font-size: 18px; justify-content: center; }
  .topbar h1 { font-size: 18px; }
  .topbar .cat { font-size: 12px; }
  .stage { padding: 8px; place-items: start center; }
  .caption p { font-size: 17px; }
  .dots { gap: 5px; }
  .dots button { width: 14px; height: 14px; border-width: 2px; }
  .dots button.game { height: 22px; font-size: 12px; padding: 0 6px; }

  .canvas { overflow: visible; }
  .ctrls { inset: auto 0; top: 100%; display: flex; flex-direction: column; gap: 8px; padding-top: 8px; font-size: 15px; }
  .ctrls .slider { position: static; width: auto !important; }
  .ctrls .tgl { position: static; width: auto !important; min-height: 44px; }

  .canvas:has(.overlay.on) { width: 100%; height: 100cqh; aspect-ratio: auto; overflow: hidden; }
  .canvas:has(.overlay.on) > svg { display: none; }
  .overlay.on {
    display: grid; grid-template-columns: 1fr 1fr; align-content: start; gap: 8px;
    padding: 8px; overflow-y: auto; font-size: 15px;
  }
  .overlay.on .zone, .overlay.on .bank { position: static; left: auto !important; top: auto !important; width: auto !important; height: auto !important; }
  .overlay.on .bank { grid-column: 1 / -1; flex-direction: row; flex-wrap: wrap; justify-content: center; order: -1; padding: .5em; }
  .overlay.on .bank::before { display: none; }
  .overlay.on .zone.card { min-height: 8.5em; }
  .overlay.on .chip { min-height: 44px; }
  .win .box { max-width: 92%; padding: 1em; }
  .win .btn { min-height: 44px; }
}
