/* ==========================================================================
   MKS öğrenci paneli. Tasarım dili: "kareli defter + kur yolculuğu"
   Marka renkleri gelince yalnızca :root tokenları değişir.
   ========================================================================== */
:root {
  --ink: #101631;          /* koyu lacivert: başlık zemini, ana metin */
  --ink-2: #1c2550;
  --paper: #f5f2ea;        /* sıcak defter kağıdı */
  --card: #ffffff;
  --text: #101631;
  --muted: #646b86;
  --line: #e7e3d8;
  --grid: rgba(16, 22, 49, .055);
  --accent: #ffb020;       /* sarı-turuncu: devam, ilerleme */
  --accent-ink: #231600;
  --accent-soft: #fff1d1;
  --done: #17b57f;         /* nane yeşili: tamamlandı */
  --done-soft: #dcf6ec;
  --info-soft: #e6e9fb;
  --danger: #e5484d;
  --shadow: 0 1px 0 rgba(16,22,49,.04), 0 10px 30px -12px rgba(16,22,49,.18);
  --r-lg: 24px; --r-md: 16px; --r-sm: 12px;
  --display: 'Bricolage Grotesque', 'Plus Jakarta Sans', system-ui, sans-serif;
  --body: 'Plus Jakarta Sans', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --ease: cubic-bezier(.2, .8, .2, 1);
}
@media (prefers-color-scheme: dark) {
  :root {
    --paper: #0b1024; --card: #141b36; --text: #eef0f8; --muted: #9aa2c2;
    --line: #232c52; --grid: rgba(255,255,255,.035);
    --accent-soft: #3a2a07; --done-soft: #0f3528; --info-soft: #1e2650;
    --shadow: 0 1px 0 rgba(0,0,0,.2), 0 14px 34px -14px rgba(0,0,0,.6);
  }
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
[hidden] { display: none !important; }
html, body { margin: 0; }
body {
  font-family: var(--body); font-size: 16px; line-height: 1.5; color: var(--text);
  min-height: 100dvh; -webkit-font-smoothing: antialiased;
  background-color: var(--paper);
  background-image: linear-gradient(var(--grid) 1px, transparent 1px), linear-gradient(90deg, var(--grid) 1px, transparent 1px);
  background-size: 24px 24px;
}
button { font: inherit; color: inherit; cursor: pointer; }
a { color: inherit; text-decoration: none; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; border-radius: 6px; }
.num { font-variant-numeric: tabular-nums; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- marka işareti ---------- */
.logo-mark {
  align-self: flex-start; display: inline-flex; align-items: center; gap: 2px;
  font-family: var(--display); font-weight: 800; letter-spacing: .02em; line-height: 1;
  color: var(--ink); background: var(--accent); border-radius: 12px; padding: 9px 11px 8px; font-size: 20px;
  box-shadow: inset 0 -3px 0 rgba(0,0,0,.12);
}
.logo-mark.small { font-size: 15px; padding: 7px 9px 6px; border-radius: 10px; }
.splash { min-height: 100dvh; display: grid; place-items: center; background: var(--ink); }
.splash .logo-mark { animation: pop .6s var(--ease) both; }

/* ---------- koyu sahne (giriş + üst bölüm) ---------- */
.stage {
  position: relative; overflow: hidden; color: #fff; isolation: isolate;
  background:
    radial-gradient(90% 70% at 110% -10%, rgba(255,176,32,.28), transparent 60%),
    radial-gradient(70% 60% at -20% 110%, rgba(23,181,127,.18), transparent 60%),
    var(--ink);
}
.stage::before { /* beyaz kareli doku */
  content: ''; position: absolute; inset: 0; z-index: -1; opacity: .5;
  background-image: linear-gradient(rgba(255,255,255,.05) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,.05) 1px, transparent 1px);
  background-size: 24px 24px;
  mask-image: linear-gradient(to bottom, #000 40%, transparent);
}
.glyphs { position: absolute; inset: 0; z-index: -1; pointer-events: none; font-family: var(--display); font-weight: 800; color: rgba(255,255,255,.07); }
.glyphs span { position: absolute; font-size: var(--s, 56px); transform: rotate(var(--r, 0deg)); animation: drift 14s ease-in-out infinite alternate; }
@keyframes drift { to { transform: translateY(-14px) rotate(calc(var(--r, 0deg) + 8deg)); } }

/* ---------- giriş ---------- */
.login { min-height: 100dvh; display: flex; flex-direction: column; padding: calc(28px + var(--safe-top)) 24px calc(24px + var(--safe-bottom)); max-width: 520px; margin: 0 auto; }
.login-wrap { min-height: 100dvh; }
.login h1 { font-family: var(--display); font-size: clamp(32px, 9vw, 42px); line-height: 1.02; letter-spacing: -.02em; margin: 48px 0 12px; font-weight: 800; }
.login h1 em { font-style: normal; color: var(--accent); }
.login p.lead { color: #c4cbe4; margin: 0; font-size: 17px; max-width: 30ch; }
.login form { margin-top: auto; display: grid; gap: 12px; padding-top: 32px; }
.login label { font-size: 14px; font-weight: 600; color: #c4cbe4; }
.field {
  width: 100%; font: inherit; font-size: 18px; padding: 17px 16px; border-radius: var(--r-md);
  border: 1.5px solid rgba(255,255,255,.14); background: rgba(255,255,255,.06); color: #fff; outline: none;
  transition: border-color .2s, background .2s;
}
.field::placeholder { color: rgba(255,255,255,.35); }
.field:focus { border-color: var(--accent); background: rgba(255,255,255,.09); }
.field.code { font-family: var(--display); font-size: 34px; letter-spacing: .45em; text-align: center; font-weight: 800; padding-left: calc(16px + .45em); }
.field.shake { animation: shake .35s; border-color: var(--danger); }
.msg { min-height: 22px; font-size: 14px; color: #ffd27a; }
.msg.err { color: #ffa3a3; }
.hint { font-size: 13px; color: #8f98bb; margin: 2px 0 0; text-align: center; }
.back-link { align-self: flex-start; background: none; border: 0; color: #c4cbe4; font-weight: 600; font-size: 16px; padding: 10px 0; min-height: 44px; }
.steps { display: flex; gap: 6px; margin-top: 18px; }
.steps i { width: 28px; height: 4px; border-radius: 4px; background: rgba(255,255,255,.18); }
.steps i.on { background: var(--accent); }

/* ---------- butonlar ---------- */
.btn {
  position: relative; border: 0; border-radius: var(--r-md); padding: 17px 18px; min-height: 56px;
  font-weight: 700; font-size: 17px; width: 100%;
  background: var(--accent); color: var(--accent-ink);
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  box-shadow: inset 0 -3px 0 rgba(0,0,0,.14), 0 8px 20px -8px rgba(255,176,32,.7);
  transition: transform .15s var(--ease), box-shadow .2s;
}
.btn:active { transform: translateY(1px) scale(.99); box-shadow: inset 0 -1px 0 rgba(0,0,0,.14); }
.btn:disabled { opacity: .65; }
.btn svg { width: 22px; height: 22px; flex: none; }
.btn.ghost { background: transparent; box-shadow: none; color: #c4cbe4; font-weight: 600; font-size: 15px; min-height: 44px; padding: 10px; }
.btn.ghost:disabled { opacity: .5; }
.spin { width: 18px; height: 18px; border: 2.5px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: rot .7s linear infinite; }

/* ---------- panel: üst ---------- */
.top { padding: calc(14px + var(--safe-top)) 20px 104px; }
.top-row { display: flex; align-items: center; justify-content: space-between; max-width: 560px; margin: 0 auto; }
.top-in { max-width: 560px; margin: 0 auto; }
.top-actions { display: flex; gap: 8px; }
.icon-btn {
  min-height: 42px; min-width: 42px; padding: 0 12px; border-radius: 12px; border: 1px solid rgba(255,255,255,.12);
  background: rgba(255,255,255,.07); color: #fff; font-size: 14px; font-weight: 600;
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; transition: background .2s;
}
.icon-btn svg { width: 18px; height: 18px; }
.icon-btn.spinning svg { animation: rot .8s linear infinite; }
.icon-btn.warn { background: var(--danger); border-color: var(--danger); }
.hello { margin: 26px 0 0; }
.hello .hi { margin: 0; color: #c4cbe4; font-size: 15px; }
.hello h1 { margin: 2px 0 0; font-family: var(--display); font-size: 34px; line-height: 1.05; font-weight: 800; letter-spacing: -.02em; }

main { position: relative; padding: 0 16px calc(32px + var(--safe-bottom)); margin: -84px auto 0; display: grid; gap: 14px; max-width: 560px; }
.card { background: var(--card); border-radius: var(--r-lg); padding: 20px; box-shadow: var(--shadow); border: 1px solid var(--line); }

/* ---------- kaldığın yer ---------- */
.resume { display: grid; gap: 18px; padding: 22px; }
.eyebrow { font-size: 12px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); display: flex; align-items: center; gap: 8px; }
.eyebrow .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
.resume-head { display: flex; gap: 16px; align-items: center; justify-content: space-between; }
.resume-head .course-name { font-size: 15px; font-weight: 600; color: var(--muted); margin: 0 0 4px; }
.resume-head h2 { font-family: var(--display); margin: 0; font-size: 25px; line-height: 1.12; font-weight: 800; letter-spacing: -.01em; }
.resume-head .lesson-no { display: inline-block; margin-top: 8px; font-size: 13px; font-weight: 700; color: var(--accent-ink); background: var(--accent-soft); padding: 4px 10px; border-radius: 99px; }
@media (prefers-color-scheme: dark) { .resume-head .lesson-no { color: var(--accent); } }
.ring { position: relative; width: 92px; height: 92px; flex: none; }
.ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.ring circle { fill: none; stroke-width: 9; }
.ring .track { stroke: var(--line); }
.ring .val { stroke: var(--accent); stroke-linecap: round; transition: stroke-dashoffset 1.1s var(--ease); }
.ring .lbl { position: absolute; inset: 0; display: grid; place-content: center; text-align: center; }
.ring .lbl b { font-family: var(--display); font-size: 24px; line-height: 1; font-weight: 800; }
.ring .lbl small { font-size: 11px; color: var(--muted); font-weight: 600; margin-top: 2px; }
.resume .hint { color: var(--muted); margin: -6px 0 0; }
.celebrate { text-align: center; padding: 6px 0; }
.celebrate .big { font-size: 44px; line-height: 1; }
.celebrate h2 { font-family: var(--display); margin: 8px 0 4px; font-size: 24px; }
.celebrate p { margin: 0; color: var(--muted); }

/* ---------- istatistik şeridi ---------- */
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: var(--r-md); padding: 14px 12px; box-shadow: var(--shadow); }
.stat b { display: block; font-family: var(--display); font-size: 24px; line-height: 1.05; font-weight: 800; }
.stat span { display: block; font-size: 12px; color: var(--muted); font-weight: 600; margin-top: 4px; line-height: 1.25; }

/* ---------- kur yolculuğu ---------- */
.section-head { display: flex; align-items: baseline; justify-content: space-between; margin: 12px 4px 0; }
.section-head h2 { font-family: var(--display); margin: 0; font-size: 22px; font-weight: 800; letter-spacing: -.01em; }
.section-head span { font-size: 13px; color: var(--muted); font-weight: 600; }
.journey { list-style: none; margin: 0; padding: 0; position: relative; display: grid; gap: 12px; }
.journey::before { /* hat */
  content: ''; position: absolute; left: 27px; top: 30px; bottom: 30px; width: 4px; border-radius: 4px;
  background: linear-gradient(to bottom, var(--done) 0 var(--fill, 0%), var(--line) var(--fill, 0%) 100%);
}
.stop { position: relative; display: grid; grid-template-columns: 58px 1fr; align-items: start; }
.node {
  position: relative; z-index: 1; width: 58px; height: 58px; border-radius: 18px;
  display: grid; place-items: center; font-family: var(--display); font-weight: 800; font-size: 17px;
  background: var(--card); color: var(--muted); border: 2px solid var(--line);
}
.stop.done .node { background: var(--done); color: #fff; border-color: var(--done); }
.stop.now .node { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); box-shadow: 0 0 0 6px var(--accent-soft); }
.stop.now .node::after { content: ''; position: absolute; inset: -6px; border-radius: 22px; border: 2px solid var(--accent); animation: pulse 2s ease-out infinite; }
.stop.upnext .node { color: var(--text); border-color: var(--text); border-style: dashed; }
.stop-card {
  margin-left: 12px; display: grid; gap: 10px; padding: 14px 16px; border-radius: var(--r-md);
  background: var(--card); border: 1px solid var(--line); box-shadow: var(--shadow);
  transition: transform .15s var(--ease), border-color .2s;
}
a.stop-card:active { transform: scale(.985); }
@media (hover: hover) { a.stop-card:hover { border-color: var(--accent); } }
.stop-top { display: flex; align-items: center; gap: 10px; }
.stop-top h3 { margin: 0; font-size: 17px; font-weight: 700; }
.stop-top .pct { margin-left: auto; font-family: var(--display); font-size: 18px; font-weight: 800; }
.stop .meta { margin: -6px 0 0; font-size: 13px; color: var(--muted); }
.bar { height: 8px; border-radius: 99px; background: var(--line); overflow: hidden; }
.bar i { display: block; height: 100%; width: var(--w, 0%); border-radius: 99px; background: var(--accent); transition: width 1s var(--ease); }
.stop.done .bar i { background: var(--done); }
.stop-next { display: flex; align-items: center; gap: 8px; margin: 0; font-size: 14px; color: var(--muted); min-width: 0; }
.stop-next span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stop-next svg { width: 16px; height: 16px; flex: none; color: var(--accent); }
.tag { font-size: 11px; font-weight: 700; letter-spacing: .02em; border-radius: 99px; padding: 3px 9px; white-space: nowrap; }
.tag.now { background: var(--accent-soft); color: #8a5a00; }
.tag.next { background: var(--info-soft); color: var(--text); }
.tag.done { background: var(--done-soft); color: var(--done); }
@media (prefers-color-scheme: dark) { .tag.now { color: var(--accent); } }

/* ---------- bonus ---------- */
.bonus { display: grid; gap: 12px; position: relative; overflow: hidden;
  background: linear-gradient(135deg, var(--ink) 0%, var(--ink-2) 100%); color: #fff; border: 0; }
.bonus::after { content: '∑'; position: absolute; right: -6px; top: -26px; font-family: var(--display); font-size: 130px; font-weight: 800; color: rgba(255,255,255,.06); }
.bonus .eyebrow { color: var(--accent); }
.bonus h3 { margin: 0; font-family: var(--display); font-size: 20px; line-height: 1.15; font-weight: 800; max-width: 22ch; }
.bonus .bar { background: rgba(255,255,255,.14); }
.bonus .row { display: flex; justify-content: space-between; font-size: 13px; color: #c4cbe4; }

/* ---------- uygulamayı ekle ---------- */
.install { display: flex; gap: 12px; align-items: center; position: relative; padding: 16px 48px 16px 16px; background: var(--accent-soft); border-color: transparent; }
.install .ico { width: 42px; height: 42px; border-radius: 12px; flex: none; display: grid; place-items: center; background: var(--ink); }
.install .ico .logo-mark { font-size: 10px; padding: 4px 5px; border-radius: 6px; }
.install p { margin: 0; font-size: 14px; line-height: 1.4; }
.install .btn { width: auto; min-height: 42px; padding: 10px 16px; font-size: 15px; flex: none; }
.install .x { position: absolute; top: 6px; right: 6px; width: 40px; height: 40px; border: 0; background: none; font-size: 22px; color: var(--muted); border-radius: 10px; }

/* ---------- ilk derse geçiş paneli ---------- */
.sheet-wrap { position: fixed; inset: 0; z-index: 50; display: flex; align-items: flex-end; justify-content: center;
  background: rgba(8, 11, 26, .55); backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px); animation: fade .2s both; }
.sheet-wrap.out { animation: fade .2s reverse both; }
.sheet { width: 100%; max-width: 560px; background: var(--card); color: var(--text); border-radius: 28px 28px 0 0;
  padding: 10px 22px calc(18px + var(--safe-bottom)); display: grid; gap: 12px; box-shadow: 0 -20px 50px -20px rgba(0,0,0,.4);
  animation: up .32s var(--ease) both; }
.sheet-grip { width: 42px; height: 5px; border-radius: 5px; background: var(--line); justify-self: center; margin-bottom: 6px; }
.sheet-ico { width: 52px; height: 52px; border-radius: 16px; display: grid; place-items: center; font-size: 26px; background: var(--accent-soft); }
.sheet h2 { margin: 0; font-family: var(--display); font-size: 24px; font-weight: 800; letter-spacing: -.01em; }
.sheet p { margin: 0; color: var(--muted); }
.sheet p b, .sheet li b { color: var(--text); }
.sheet ul { margin: 0; padding-left: 20px; color: var(--muted); display: grid; gap: 6px; font-size: 15px; }
.btn.ghost.dark { color: var(--muted); }
@keyframes fade { from { opacity: 0; } }
@keyframes up { from { transform: translateY(40px); opacity: 0; } }

/* ---------- durumlar ---------- */
.offline { display: flex; gap: 8px; align-items: center; background: var(--accent-soft); color: var(--text); border-radius: var(--r-md); padding: 12px 14px; font-size: 14px; font-weight: 600; }
.foot { text-align: center; color: var(--muted); font-size: 12px; padding: 4px 16px 0; }
.error-box { margin: auto 0; text-align: center; }
.sk { background: linear-gradient(90deg, var(--line) 25%, var(--paper) 50%, var(--line) 75%); background-size: 200% 100%; animation: sh 1.2s infinite; border-radius: 10px; }
.stage .sk { background: rgba(255,255,255,.1); }
.sk-title { height: 34px; width: 55%; margin-top: 6px; }
.sk-line { height: 16px; margin: 8px 0; }
.sk-block { height: 92px; margin: 16px 0; }
.sk-btn { height: 56px; }
.w40 { width: 40%; } .w60 { width: 60%; }

/* ---------- hareket ---------- */
.rise { animation: rise .55s var(--ease) both; animation-delay: calc(var(--i, 0) * 60ms); }
@keyframes rise { from { opacity: 0; transform: translateY(14px); } }
@keyframes pop { from { opacity: 0; transform: scale(.85); } }
@keyframes rot { to { transform: rotate(360deg); } }
@keyframes sh { to { background-position: -200% 0; } }
@keyframes pulse { from { opacity: .8; transform: scale(1); } to { opacity: 0; transform: scale(1.25); } }
@keyframes shake { 20%, 60% { transform: translateX(-6px); } 40%, 80% { transform: translateX(6px); } }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
