/* ÖSYM optik formundan esinlenen tema */
:root {
  --paper: #eef2f4;
  --paper-2: #e4eaee;
  --ink: #1b2747;
  --ink-2: #4a5675;
  --muted: #6c7690;
  --line: #c4476a;          /* optik form pembe-bordo çizgisi */
  --line-soft: #e9b8c6;
  --line-faint: #f3d9e1;
  --pencil: #3d3f44;
  --pencil-2: #6b6e75;
  --ok: #2c6e49;
  --timing: #1b2747;
  --focus: #c4476a;
  --font-head: 'Familjen Grotesk', 'Segoe UI', Roboto, system-ui, sans-serif;
  --font-body: 'Source Sans 3', 'Segoe UI', Roboto, system-ui, sans-serif;
  --font-num: 'JetBrains Mono', ui-monospace, 'Cascadia Mono', Consolas, monospace;
  --gutter: 16px;
  --timing-w: 10px;
  --tabbar-h: 58px;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --paper: #121722;
    --paper-2: #1a2130;
    --ink: #e3e8f2;
    --ink-2: #b3bcd0;
    --muted: #8a94ab;
    --line: #e27a98;
    --line-soft: #6d3447;
    --line-faint: #3a2330;
    --pencil: #c9ccd3;
    --pencil-2: #9a9ea8;
    --ok: #7cc49a;
    --timing: #3a4560;
    color-scheme: dark;
  }
}

*,
*::before,
*::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 17px/1.5 var(--font-body);
  padding-left: calc(var(--timing-w) + env(safe-area-inset-left));
  padding-right: env(safe-area-inset-right);
  padding-bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom) + 24px);
  overflow-x: hidden;
}

/* Kenardaki zamanlama işaretleri */
.timing {
  position: fixed;
  left: env(safe-area-inset-left);
  top: 0;
  bottom: 0;
  width: var(--timing-w);
  background: repeating-linear-gradient(to bottom, transparent 0 14px, var(--timing) 14px 20px);
  background-size: 6px 100%;
  background-repeat: repeat-y;
  background-position: 2px 0;
  z-index: 3;
}

h1, h2, h3 { font-family: var(--font-head); line-height: 1.15; margin: 0; }
h1 { font-size: 1.6rem; font-weight: 700; letter-spacing: -0.01em; margin: 20px 0 6px; }
h2 { font-size: 1rem; font-weight: 700; }
p { margin: 0 0 8px; }
a { color: var(--line); text-underline-offset: 3px; }
code { font-family: var(--font-num); font-size: 0.85em; word-break: break-all; }
.num { font-family: var(--font-num); font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); font-weight: 400; }
.hint { color: var(--ink-2); font-size: 0.95rem; }
.sub { color: var(--ink-2); margin: 0 0 4px; }
.lvl { font-family: var(--font-num); font-size: 0.8em; color: var(--line); font-weight: 600; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }

/* Üst şerit */
.top-strip {
  position: sticky;
  top: 0;
  z-index: 2;
  background: var(--paper);
  border-bottom: 1px solid var(--line);
  padding: calc(8px + env(safe-area-inset-top)) var(--gutter) 8px;
  font-size: 0.82rem;
  color: var(--ink-2);
}
.strip-row { display: flex; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.strip-row b { color: var(--ink); font-weight: 600; }
.strip-phase { font-family: var(--font-head); font-weight: 700; color: var(--line); text-transform: uppercase; letter-spacing: 0.04em; font-size: 0.78rem; }
.strip-stats { margin-top: 2px; }

main { padding: 0 var(--gutter); max-width: 640px; margin: 0 auto; outline: none; }
section { margin-top: 22px; }

/* Bölüm başlığı: optik formdaki pembe kılavuz çizgisi */
.rule {
  display: flex;
  align-items: baseline;
  gap: 8px;
  color: var(--line);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-size: 0.8rem;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--line-soft);
  margin-bottom: 4px;
}
.rule .muted { text-transform: none; letter-spacing: 0; font-size: 0.8rem; }

/* Düğmeler */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 0 16px;
  border: 1.5px solid var(--ink);
  border-radius: 6px;
  background: transparent;
  color: var(--ink);
  font: 600 0.95rem var(--font-body);
  text-decoration: none;
  cursor: pointer;
}
.btn:active { transform: translateY(1px); }
.btn.primary { background: var(--ink); color: var(--paper); }
.btn.small { min-height: 36px; padding: 0 12px; font-size: 0.88rem; border-width: 1px; }
.btn.wide { width: 100%; }
.btn.danger { border-color: var(--line); color: var(--line); }
.btn-row { display: flex; gap: 10px; flex-wrap: wrap; }
.btn.file { position: relative; }

/* Baloncuk */
.bubble {
  --s: 30px;
  display: inline-grid;
  place-items: center;
  width: var(--s);
  height: var(--s);
  flex: none;
  border-radius: 50%;
  border: 1.5px solid var(--line);
  color: var(--line);
  font: 600 0.75rem var(--font-num);
  background: transparent;
  transition: background-color 0.15s;
}
.bubble.full,
.bubble.part {
  color: transparent;
  border-color: var(--pencil);
  /* kurşun kalem dolgusu: hafif çizgili, kenarı düzensiz gri */
  background:
    repeating-linear-gradient(118deg, rgb(255 255 255 / 0.07) 0 1px, transparent 1px 3px),
    radial-gradient(circle at 45% 40%, var(--pencil-2), var(--pencil) 70%);
}
.bubble.part {
  background:
    linear-gradient(to top, var(--pencil) 0 50%, transparent 50%);
  border-color: var(--pencil-2);
}

/* Bugün */
.today-head .kicker { font-weight: 600; color: var(--ink); margin: 0; }
.today-head .back { display: inline-block; margin-top: 6px; }

.vocab-box {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 0;
  border-top: 1px solid var(--line-soft);
  border-bottom: 1px solid var(--line-soft);
}
.vocab-box .big { font-size: 1.8rem; font-weight: 600; }

.tasks { list-style: none; margin: 0; padding: 0; }
.task {
  display: flex;
  gap: 12px;
  padding: 14px 0;
  border-bottom: 1px dashed var(--line-soft);
}
.task .mark { background: none; border: 0; padding: 0; margin: 0; cursor: pointer; align-self: flex-start; min-width: 44px; min-height: 44px; display: grid; place-items: center; }
.task .mark .bubble { --s: 34px; }
.task .mark:disabled { cursor: not-allowed; opacity: 0.55; }
.task-body { flex: 1; min-width: 0; }
.task-title { display: flex; justify-content: space-between; gap: 10px; font-weight: 600; padding-top: 9px; }
.task-title span:first-child { overflow-wrap: anywhere; }
.task .min { color: var(--muted); font-size: 0.82rem; font-weight: 400; white-space: nowrap; }
.task-desc { color: var(--ink-2); font-size: 0.93rem; margin: 2px 0 6px; }
.task.done .task-title span:first-child { color: var(--pencil-2); text-decoration: line-through; text-decoration-color: var(--pencil-2); }
.task-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.task-actions:empty { display: none; }
.copied { display: inline-block; margin-top: 6px; color: var(--ok); font-weight: 600; font-size: 0.9rem; }
.prompt-fallback { width: 100%; margin-top: 4px; font: 0.85rem/1.4 var(--font-body); color: var(--ink); background: var(--paper-2); border: 1px solid var(--line-soft); border-radius: 6px; padding: 8px; }

.week-strip { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; padding-top: 8px; }
.day {
  display: grid;
  justify-items: center;
  gap: 4px;
  padding: 6px 0;
  text-decoration: none;
  color: var(--ink-2);
  border-radius: 6px;
}
.day .bubble { --s: 32px; }
.day .dow { font-size: 0.75rem; text-transform: capitalize; }
.day .cnt { font-size: 0.7rem; color: var(--muted); }
.day.is-today .dow { color: var(--line); font-weight: 700; }
.day.sel { background: var(--paper-2); outline: 1px solid var(--line-soft); }

/* Bölüm seçici */
.seg { display: flex; border-bottom: 1px solid var(--line-soft); margin-top: 6px; overflow-x: auto; scrollbar-width: none; }
.seg a { flex: 1; text-align: center; padding: 10px 6px; color: var(--ink-2); text-decoration: none; font-weight: 600; font-size: 0.93rem; white-space: nowrap; border-bottom: 2px solid transparent; }
.seg a.on { color: var(--ink); border-bottom-color: var(--line); }
.words-body { margin-top: 16px; }

/* Kart */
.queue-info { color: var(--ink-2); font-size: 0.9rem; display: flex; gap: 8px; align-items: center; }
.tag { font: 600 0.72rem var(--font-num); color: var(--line); border: 1px solid var(--line-soft); padding: 1px 6px; border-radius: 10px; }
.flash {
  padding: 28px 4px 24px;
  border-top: 2px solid var(--ink);
  border-bottom: 1px solid var(--line-soft);
  margin-bottom: 16px;
  min-height: 190px;
}
.flash-en { font: 700 2rem/1.1 var(--font-head); margin-bottom: 12px; overflow-wrap: anywhere; }
.flash-ex { color: var(--ink-2); font-style: italic; }
.flash-tr { font-size: 1.3rem; font-weight: 600; color: var(--line); margin-top: 14px; padding-top: 12px; border-top: 1px dashed var(--line-soft); }
.grade { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 8px; }
.grade .btn { padding: 0 6px; }

.word-list { list-style: none; margin: 8px 0 0; padding: 0; }
.word-list li { display: flex; justify-content: space-between; gap: 10px; padding: 10px 0; border-bottom: 1px dashed var(--line-soft); }
.w-main { min-width: 0; display: grid; }
.w-main b { font-weight: 600; overflow-wrap: anywhere; }
.w-main span { color: var(--ink-2); font-size: 0.92rem; }
.w-meta { display: grid; justify-items: end; align-content: start; gap: 2px; font-size: 0.75rem; }
.dots { display: inline-flex; gap: 3px; }
.dots i { width: 9px; height: 9px; border-radius: 50%; border: 1px solid var(--line); }
.dots i.on { background: var(--pencil); border-color: var(--pencil); }

/* Formlar */
.form { display: grid; gap: 12px; }
.row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.field { display: grid; gap: 4px; min-width: 0; }
.field > span { font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--line); font-weight: 600; }
input, select, textarea {
  width: 100%;
  min-width: 0;
  font: 1rem var(--font-body);
  color: var(--ink);
  background: var(--paper);
  border: 0;
  border-bottom: 1.5px solid var(--ink-2);
  border-radius: 0;
  padding: 10px 2px;
  min-height: 44px;
}
textarea { border: 1.5px solid var(--ink-2); border-radius: 6px; padding: 10px; font-family: var(--font-num); font-size: 0.85rem; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--line); }
input[type='date'] { appearance: none; -webkit-appearance: none; }
.form-msg, .backup-msg { color: var(--ok); font-weight: 600; min-height: 1.2em; margin: 0; }
.score-live { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.score-live .live { font-size: 1.6rem; color: var(--line); }

/* Plan */
.phase h2 { margin-bottom: 0; }
.week { border-bottom: 1px dashed var(--line-soft); }
.week summary {
  display: grid;
  grid-template-columns: 40px 1fr auto;
  grid-template-rows: auto auto;
  align-items: center;
  column-gap: 8px;
  padding: 10px 0 8px;
  cursor: pointer;
  list-style: none;
}
.week summary::-webkit-details-marker { display: none; }
.week .wk { font-weight: 600; color: var(--line); }
.week .wt { font-weight: 600; min-width: 0; overflow-wrap: anywhere; }
.week .pct { font-size: 0.82rem; color: var(--ink-2); }
.week .bar { grid-column: 2 / 4; height: 3px; background: var(--line-faint); margin-top: 6px; }
.week .bar i { display: block; height: 100%; background: var(--pencil); }
.week.current { background: var(--paper-2); margin: 0 -8px; padding: 0 8px; border-left: 3px solid var(--line); }
.days { list-style: none; margin: 0 0 10px; padding: 0; }
.days a { display: grid; grid-template-columns: 24px 1fr auto; gap: 8px; padding: 7px 0; text-decoration: none; color: var(--ink); font-size: 0.93rem; }
.days .dd { color: var(--muted); }
.days .dl { min-width: 0; overflow-wrap: anywhere; }
.days .dn { color: var(--muted); font-size: 0.8rem; }
.days .dn.full { color: var(--ok); }
.days li.is-today a { font-weight: 700; }
.days li.is-today .dd { color: var(--line); }

/* Denemeler */
.chart { margin: 8px 0 0; }
.chart svg { width: 100%; height: auto; display: block; }
.chart .g { stroke: var(--line-faint); stroke-width: 1; }
.chart .t { fill: var(--muted); font: 10px var(--font-num); }
.chart .tt { fill: var(--line); }
.chart .target { stroke: var(--line); stroke-width: 1.5; stroke-dasharray: 5 4; }
.chart .line { fill: none; stroke: var(--ink); stroke-width: 2; stroke-linejoin: round; }
.chart .pt { fill: var(--paper); stroke: var(--ink); stroke-width: 2; }
.exam-list { list-style: none; margin: 0; padding: 0; }
.exam-list li { display: grid; grid-template-columns: auto 1fr auto; grid-template-rows: auto auto; gap: 2px 10px; align-items: center; padding: 10px 0; border-bottom: 1px dashed var(--line-soft); }
.exam-list .ed { font-size: 0.85rem; color: var(--ink-2); }
.exam-list .en { min-width: 0; overflow-wrap: anywhere; }
.exam-list .es { grid-column: 1 / 3; font-size: 0.85rem; color: var(--ink-2); }
.exam-list .es b { color: var(--ink); }
.exam-list .del { grid-column: 3; grid-row: 1 / 3; }

.empty { color: var(--muted); padding: 12px 0; }
.empty-state { padding: 18px 0; border-top: 1px solid var(--line-soft); border-bottom: 1px solid var(--line-soft); }
.empty-state .big { font: 700 1.2rem var(--font-head); }

/* Alt sekme çubuğu */
.tabbar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 4;
  display: flex;
  background: var(--paper);
  border-top: 1px solid var(--line);
  padding: 0 env(safe-area-inset-right) env(safe-area-inset-bottom) calc(var(--timing-w) + env(safe-area-inset-left));
}
.tabbar a {
  flex: 1;
  min-width: 0;
  height: var(--tabbar-h);
  display: grid;
  place-items: center;
  text-decoration: none;
  color: var(--ink-2);
  font: 600 0.78rem var(--font-head);
  letter-spacing: 0.01em;
  border-top: 3px solid transparent;
}
.tabbar a.on { color: var(--ink); border-top-color: var(--line); }

@media (min-width: 700px) {
  :root { --timing-w: 16px; }
  .timing { background-size: 10px 100%; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; scroll-behavior: auto !important; }
}
