:root {
  --bg: #F6F5F1;
  --bg-raised: #FBFAF7;
  --surface: #FFFFFF;
  --chip: #EFEDE7;
  --seg: #EAE7E0;
  --border: #E6E3DB;
  --border-strong: #D6D2C8;
  --divider: #EFECE5;
  --text: #16181D;
  --text-body: #3A3D42;
  --text-2: #5B5F66;
  --accent: #3F3BD1;
  --accent-hover: #3430B8;
  --accent-bg: #ECEBFC;
  --accent-ink: #2B2896;
  --accent-soft: #C9C7F5;
  --ok: #15803D;
  --ok-bg: #E3F3E8;
  --ok-ink: #0F5A2B;
  --warn: #C2410C;
  --warn-bg: #FDF3E7;
  --warn-border: #F3D3AE;
  --warn-ink: #7A3306;
  --review-bg: #FBEBD5;
  --review-ink: #8A3B06;
  --night: #1E2340;
  --night-2: #C3C7E0;
  --night-3: #DADDF0;
  --code-bg: #16181D;
  --code-text: #E8E8EC;
  --code-kw: #A5A3FF;
  --code-lit: #F9C27B;
  --code-hl: #2E2F4A;
  --code-ok: #7EE2A8;
  --font: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); font-family: var(--font); -webkit-font-smoothing: antialiased; }
body { min-height: 100vh; min-height: 100dvh; -webkit-tap-highlight-color: transparent; }
button, input { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--accent); }
h1, h2, p { margin: 0; }
.mono { font-family: var(--mono); }
.muted { color: var(--text-2); }
.boot { padding: 40vh 24px 0; text-align: center; color: var(--text-2); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
:focus-visible { outline: 3px solid var(--accent-soft); outline-offset: 2px; }

/* ---------- Kabuk: telefonda alt sekme çubuğu, bilgisayarda yan menü ---------- */
.shell { min-height: 100vh; min-height: 100dvh; display: flex; }
.sidebar { display: none; }
.main { flex: 1; min-width: 0; padding: calc(24px + var(--safe-top)) 20px calc(96px + var(--safe-bottom)); display: flex; flex-direction: column; gap: 18px; max-width: 640px; margin: 0 auto; width: 100%; }
.tabbar { position: fixed; left: 0; right: 0; bottom: 0; display: grid; grid-template-columns: repeat(3, 1fr); padding: 8px 12px calc(10px + var(--safe-bottom)); background: var(--bg-raised); border-top: 1px solid var(--border); z-index: 10; }
.tabbar a { display: flex; flex-direction: column; align-items: center; gap: 3px; min-height: 48px; justify-content: center; font-size: 11px; font-weight: 500; color: var(--text-2); text-decoration: none; }
.tabbar a[aria-current="page"] { color: var(--accent); font-weight: 600; }

@media (min-width: 900px) {
  .sidebar { display: flex; flex-direction: column; gap: 6px; width: 250px; flex-shrink: 0; padding: 28px 16px; border-right: 1px solid var(--border); background: var(--bg-raised); position: sticky; top: 0; height: 100vh; }
  .sidebar .brand { display: flex; align-items: center; gap: 10px; padding: 0 10px 22px; font-size: 18px; font-weight: 700; }
  .sidebar a.nav { display: flex; align-items: center; gap: 10px; height: 42px; padding: 0 12px; border-radius: 10px; color: var(--text-body); font-size: 15px; text-decoration: none; }
  .sidebar a.nav:hover { background: var(--chip); }
  .sidebar a.nav[aria-current="page"] { background: var(--accent-bg); color: var(--accent-ink); font-weight: 600; }
  .sidebar .spacer { flex: 1; }
  .tabbar { display: none; }
  .main { max-width: 1120px; padding: 36px 40px 48px; gap: 24px; }
}

/* ---------- Ortak parçalar ---------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: 22px; padding: 20px; display: flex; flex-direction: column; gap: 16px; }
.tile { background: var(--surface); border: 1px solid var(--border); border-radius: 18px; padding: 14px 16px; display: flex; flex-direction: column; gap: 4px; }
.tile .k { font-size: 13px; color: var(--text-2); }
.tile .v { font-size: 22px; font-weight: 700; }
.tile .s { font-size: 12px; color: var(--text-2); }
.grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.label { font-size: 13px; font-weight: 600; color: var(--text-2); padding-left: 4px; }
.pill { display: inline-flex; align-items: center; font-size: 13px; font-weight: 600; padding: 5px 11px; border-radius: 999px; white-space: nowrap; }
.pill.learn { background: var(--accent-bg); color: var(--accent); }
.pill.review { background: var(--review-bg); color: var(--review-ink); }
.chip { display: inline-flex; align-items: center; gap: 6px; background: var(--surface); border: 1px solid var(--border); border-radius: 999px; padding: 8px 12px; font-size: 14px; font-weight: 600; }
.chip.light { font-weight: 400; color: var(--text-body); }
.btn { min-height: 50px; border: none; border-radius: 14px; padding: 0 22px; font-size: 16px; font-weight: 600; display: inline-flex; align-items: center; justify-content: center; gap: 8px; text-decoration: none; }
.btn.primary { background: var(--accent); color: #fff; }
.btn.primary:hover { background: var(--accent-hover); }
.btn.dark { background: var(--text); color: #fff; }
.btn.secondary { background: var(--surface); border: 1px solid var(--border-strong); color: var(--text); }
.btn.warn { background: var(--warn); color: #fff; }
.btn.ghost { background: transparent; color: var(--text-body); font-weight: 500; min-height: 44px; }
.btn.block { width: 100%; }
.btn.big { min-height: 54px; border-radius: 16px; font-size: 17px; }
.btn[disabled] { opacity: .6; cursor: progress; }
.kbd { font-family: var(--mono); font-size: 12px; background: var(--chip); padding: 2px 6px; border-radius: 5px; }
.hint { font-size: 13px; color: var(--text-2); }
.desktop-only { display: none !important; }
@media (min-width: 900px) and (pointer: fine) { .desktop-only { display: inline-flex !important; } }

.segbar { display: grid; grid-template-columns: repeat(var(--n, 5), minmax(0, 1fr)); gap: 6px; }
.segbar i { height: 8px; border-radius: 4px; background: var(--border); }
.segbar.thin i { height: 6px; border-radius: 3px; }
.segbar i.on { background: var(--accent); }
.segbar i.now { background: var(--accent-soft); }
.segbar i.ok { background: var(--ok); }
.segbar i.bad { background: var(--warn); }

.list { background: var(--surface); border: 1px solid var(--border); border-radius: 18px; display: flex; flex-direction: column; overflow: hidden; }
.list .row { display: flex; align-items: center; gap: 12px; padding: 14px 16px; border-bottom: 1px solid var(--divider); font-size: 15px; }
.list .row:last-child { border-bottom: none; }
.list .row .grow { flex: 1; min-width: 0; }
.list a.row { color: inherit; text-decoration: none; }
.list a.row:hover { background: var(--bg-raised); }
.dot { width: 28px; height: 28px; border-radius: 999px; display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; }
.dot.ok { background: var(--ok-bg); color: var(--ok); }
.dot.warn { background: var(--warn-bg); color: var(--warn); }
.dot.now { background: var(--accent-bg); color: var(--accent); font-size: 13px; font-weight: 700; }
.dot.off { background: var(--chip); color: var(--text-2); font-size: 13px; font-weight: 600; }

.note { background: var(--chip); border-radius: 16px; padding: 14px 16px; display: flex; gap: 12px; align-items: flex-start; font-size: 14px; line-height: 1.45; color: var(--text-body); }
.note.accent { background: var(--accent-bg); color: var(--accent-ink); }
.note svg { flex-shrink: 0; margin-top: 1px; }

/* ---------- Bugün ---------- */
.today-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 12px; flex-wrap: wrap; }
.today-head h1 { font-size: 32px; font-weight: 700; letter-spacing: -0.5px; }
.today-head .date { font-size: 14px; color: var(--text-2); margin-bottom: 4px; }
.today-head .chips { display: flex; gap: 10px; flex-wrap: wrap; }
.status { display: flex; align-items: center; gap: 10px; background: var(--ok-bg); border-radius: 14px; padding: 10px 14px; font-size: 14px; color: var(--ok-ink); }
.status .led { width: 10px; height: 10px; border-radius: 999px; background: var(--ok); flex-shrink: 0; }
.status .grow { flex: 1; }
.status b { font-weight: 600; font-size: 13px; }
.hero .top { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.hero .next { display: flex; flex-direction: column; gap: 4px; }
.hero .next .t { font-size: 22px; font-weight: 700; font-family: var(--mono); overflow-wrap: anywhere; }
.hero .next .d { font-size: 15px; color: var(--text-body); line-height: 1.45; }
.hero .actions { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.night { background: var(--night); color: #fff; border-radius: 22px; padding: 20px; display: flex; flex-direction: column; gap: 10px; }
.night .t { font-size: 20px; font-weight: 600; }
.night .d { font-size: 15px; line-height: 1.45; color: var(--night-3); }
.alert { background: var(--warn-bg); border: 1px solid var(--warn-border); border-radius: 22px; padding: 20px; display: flex; flex-direction: column; gap: 12px; color: var(--warn-ink); }
.alert .t { display: flex; align-items: center; gap: 10px; font-size: 19px; font-weight: 700; }
.alert .d { font-size: 15px; line-height: 1.45; }
.alert .s { font-size: 13px; line-height: 1.45; }
.dash { display: grid; gap: 20px; grid-template-columns: minmax(0, 1fr); }
.week { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 8px; align-items: end; height: 120px; }
.week i { border-radius: 6px; background: var(--accent-soft); min-height: 6px; }
.week i.today { background: var(--accent); }
.week i.zero { background: var(--border); }
.weekdays { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 8px; font-size: 12px; color: var(--text-2); text-align: center; }
.stats3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; border-top: 1px solid var(--divider); padding-top: 14px; }
.stats3 .k { font-size: 12px; color: var(--text-2); }
.stats3 .v { font-size: 20px; font-weight: 700; }
.week-card { display: none; }
@media (min-width: 900px) {
  .dash { grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); }
  .week-card { display: flex; }
  .mobile-tiles { display: none; }
  .today-head h1 { font-size: 34px; }
}

/* ---------- Kart ekranları (öğren / tekrar) ---------- */
.focus { min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; }
.focus-head { display: flex; align-items: center; gap: 14px; padding: calc(14px + var(--safe-top)) 20px 14px; flex-wrap: wrap; }
.focus-head .close { width: 44px; height: 44px; border-radius: 999px; background: var(--seg); border: none; display: inline-flex; align-items: center; justify-content: center; text-decoration: none; color: var(--text-body); }
.focus-head .segbar { flex: 1 1 100%; order: 5; }
.focus-head .meta { margin-left: auto; font-size: 13px; color: var(--text-2); min-width: 0; flex: 0 1 auto; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 45%; }
@media (min-width: 900px) { .focus-head .meta { max-width: none; } }
.focus-body { flex: 1; width: 100%; max-width: 640px; margin: 0 auto; padding: 4px 20px calc(24px + var(--safe-bottom)); display: flex; flex-direction: column; gap: 18px; }
.focus-body .col { display: flex; flex-direction: column; gap: 18px; min-width: 0; }
.focus-foot { display: flex; gap: 12px; align-items: center; justify-content: flex-end; flex-wrap: wrap; margin-top: auto; padding-top: 8px; }
.focus-foot .btn { flex: 1; }
.topic { font-size: 34px; font-weight: 700; font-family: var(--mono); letter-spacing: -1px; overflow-wrap: anywhere; }
.explain { font-size: 17px; line-height: 1.5; color: #2A2D33; }
.question { font-size: 24px; font-weight: 700; line-height: 1.3; letter-spacing: -0.3px; }
.code { background: var(--code-bg); color: var(--code-text); border-radius: 18px; padding: 16px; font-family: var(--mono); font-size: 15px; line-height: 1.6; overflow-x: auto; white-space: pre; }
.code .ln { display: block; padding: 0 8px; margin: 0 -8px; border-radius: 6px; }
.code .ln.hl { background: var(--code-hl); }
.code .kw { color: var(--code-kw); }
.code .lit { color: var(--code-lit); }
.code .blank { color: var(--code-lit); border-bottom: 2px solid var(--code-lit); padding: 0 6px; }
.code .blank.ok { color: var(--code-ok); border-color: var(--code-ok); }
.table { background: var(--surface); border: 1px solid var(--border); border-radius: 14px; font-size: 15px; overflow-x: auto; }
.table table { width: 100%; border-collapse: collapse; }
.table th { text-align: left; font-size: 13px; font-weight: 600; color: var(--text-2); padding: 10px 14px; border-bottom: 1px solid var(--divider); }
.table td { padding: 10px 14px; border-bottom: 1px solid var(--divider); }
.table tr:last-child td { border-bottom: none; }
.table .null { color: var(--text-2); font-style: italic; font-family: var(--mono); font-size: 13px; }
.practice { background: var(--surface); border: 1px solid var(--border); border-radius: 18px; padding: 16px; display: flex; flex-direction: column; gap: 12px; }
.practice .q { font-family: var(--mono); font-size: 15px; line-height: 1.6; overflow-wrap: anywhere; }
.practice .gap { display: inline-block; min-width: 64px; border-bottom: 2px solid var(--accent); text-align: center; color: var(--accent); font-weight: 500; }
.practice .gap.ok { color: var(--ok); border-color: var(--ok); }
.practice .gap.bad { color: var(--warn); border-color: var(--warn); }
.opts { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.opt { min-height: 44px; border: 1px solid var(--border); border-radius: 12px; background: var(--bg); font-family: var(--mono); font-size: 14px; padding: 6px 8px; display: flex; align-items: center; justify-content: center; gap: 8px; text-align: center; overflow-wrap: anywhere; }
.opt .n { font-family: var(--font); font-size: 11px; color: var(--text-2); border: 1px solid var(--border-strong); border-radius: 4px; padding: 0 5px; }
.opt.ok { border: 2px solid var(--ok); background: var(--ok-bg); color: var(--ok-ink); font-weight: 500; }
.opt.bad { border: 2px solid var(--warn); background: var(--warn-bg); color: var(--warn-ink); }
.opt.dim { color: var(--text-2); }
.opts.big { grid-template-columns: minmax(0, 1fr); gap: 10px; }
.opts.big .opt { min-height: 56px; border-radius: 14px; font-size: 16px; justify-content: flex-start; padding: 0 16px; background: var(--surface); }
.opts.big .opt .mark { margin-left: auto; }
.feedback { border-radius: 16px; padding: 14px 16px; display: flex; flex-direction: column; gap: 4px; }
.feedback.ok { background: var(--ok-bg); color: #1D4D2E; }
.feedback.ok .t { color: var(--ok-ink); }
.feedback.bad { background: var(--warn-bg); color: var(--warn-ink); }
.feedback .t { font-size: 15px; font-weight: 600; }
.feedback .d { font-size: 14px; line-height: 1.45; }
.small-feedback { font-size: 13px; line-height: 1.45; }
.small-feedback.ok { color: var(--ok-ink); }
.small-feedback.bad { color: var(--warn-ink); }

@media (min-width: 900px) {
  .focus-head { padding: 18px 28px; border-bottom: 1px solid var(--border); background: var(--bg-raised); flex-wrap: nowrap; }
  .focus-head .segbar { order: 0; flex: 1 1 200px; max-width: 360px; }
  .focus-body { max-width: 1120px; padding: 40px 28px; display: grid; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); gap: 32px; align-content: start; }
  .focus-body.narrow { max-width: 760px; display: flex; padding-top: 48px; gap: 24px; }
  .focus-foot .btn { flex: 0 0 auto; padding: 0 28px; }
  .topic { font-size: 44px; }
  .explain { font-size: 18px; }
  .question { font-size: 30px; }
  .code { font-size: 17px; padding: 20px 22px; }
  .opts.big { grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; }
  .opts.big .opt { min-height: 60px; font-size: 17px; }
}

/* ---------- Kurulum, izin, anahtar, set sonu ---------- */
.center { flex: 1; width: 100%; max-width: 520px; margin: 0 auto; padding: calc(56px + var(--safe-top)) 20px calc(24px + var(--safe-bottom)); display: flex; flex-direction: column; gap: 20px; min-height: 100vh; min-height: 100dvh; }
.hero-icon { display: flex; flex-direction: column; align-items: center; gap: 14px; text-align: center; }
.hero-icon h1 { font-size: 28px; font-weight: 700; letter-spacing: -0.5px; }
.hero-icon p { font-size: 16px; color: var(--text-2); line-height: 1.45; }
.appicon { width: 76px; height: 76px; border-radius: 18px; background: var(--accent); display: flex; align-items: center; justify-content: center; }
.bubble { width: 88px; height: 88px; border-radius: 999px; display: flex; align-items: center; justify-content: center; }
.bubble.accent { background: var(--accent-bg); color: var(--accent); }
.bubble.ok { background: var(--ok-bg); color: var(--ok); }
.steps { list-style: none; margin: 0; padding: 0; }
.steps .num { width: 28px; height: 28px; border-radius: 999px; background: var(--accent-bg); color: var(--accent); font-size: 14px; font-weight: 700; display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; }
.share-arrow { display: flex; flex-direction: column; align-items: center; gap: 2px; color: var(--accent); font-size: 13px; font-weight: 600; margin-top: auto; }
.field { display: flex; flex-direction: column; gap: 6px; font-size: 13px; color: var(--text-2); }
.field input { height: 48px; border: 1px solid var(--border-strong); border-radius: 12px; padding: 0 14px; font-size: 16px; color: var(--text); background: var(--surface); }
.err { font-size: 13px; color: var(--warn-ink); }
.sample-note { display: flex; gap: 10px; align-items: center; }

/* ---------- Saatler ---------- */
.settings { display: grid; gap: 20px; grid-template-columns: minmax(0, 1fr); align-items: start; }
@media (min-width: 900px) { .settings { grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); } }
.times { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.times input { height: 48px; border: 1px solid var(--border-strong); border-radius: 12px; padding: 0 12px; font-size: 17px; font-weight: 600; background: var(--bg-raised); width: 100%; }
.segmented { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 4px; background: var(--seg); padding: 4px; border-radius: 14px; }
.segmented button { height: 40px; border: none; border-radius: 10px; background: transparent; font-size: 14px; color: var(--text-body); }
.segmented button[aria-pressed="true"] { background: var(--surface); font-weight: 600; color: var(--text); }
.days { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 6px; }
.days button { height: 44px; border-radius: 12px; border: 1px solid var(--border); background: var(--surface); font-size: 14px; color: var(--text-body); padding: 0; }
.days button[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 600; }
.savebar { display: flex; justify-content: flex-end; gap: 12px; align-items: center; flex-wrap: wrap; }
.badge { font-size: 13px; font-weight: 600; padding: 4px 10px; border-radius: 999px; white-space: nowrap; }
.badge.ok { background: var(--ok-bg); color: var(--ok-ink); }
.badge.warn { background: var(--warn-bg); color: var(--warn-ink); }
.badge.off { background: var(--chip); color: var(--text-2); }

#toast { position: fixed; left: 50%; bottom: calc(96px + var(--safe-bottom)); transform: translateX(-50%) translateY(20px); background: var(--text); color: #fff; padding: 12px 18px; border-radius: 14px; font-size: 14px; opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s; max-width: calc(100vw - 32px); z-index: 50; }
#toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
@media (min-width: 900px) { #toast { bottom: 32px; } }
@media (prefers-reduced-motion: reduce) { #toast { transition: none; } }
