/* =========================================================================
   SAT Vocab — tasarim sistemi / design system
   Renk, tipografi, boşluk ve bileşenler tek dosyada toplanır.
   ====================================================================== */

/* ---------- 1. Jetonlar / tokens ---------------------------------------- */
:root {
  /* Marka renkleri */
  --violet:      #6E2BF5;
  --violet-ink:  #4A14BD;
  --violet-soft: #EFE8FF;
  --lime:        #C6F224;
  --lime-deep:   #7C9400;
  --lime-soft:   #F2FBD2;
  --pink:        #FF3D8F;
  --pink-soft:   #FFE6F0;
  --cyan:        #00C2DB;
  --cyan-soft:   #DDF7FB;

  /* Yüzeyler */
  --bg:          #FAF8F3;
  --bg-2:        #F1EEE6;
  --surface:     #FFFFFF;
  --surface-2:   #FBFAF7;
  --line:        #E5E0D5;
  --line-strong: #D3CCBC;

  /* Metin */
  --ink:         #191722;
  --ink-2:       #4D4859;
  --ink-3:       #7B7589;
  --on-accent:   #FFFFFF;

  /* Durum */
  --ok:          #12A150;
  --ok-soft:     #DFF6E8;
  --warn:        #C2740A;
  --warn-soft:   #FDF0DA;
  --bad:         #DC2B4B;
  --bad-soft:    #FDE5EA;

  /* Tipografi */
  --font-ui:      'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  --font-display: 'Space Grotesk', 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;

  --t-xs:   0.75rem;
  --t-sm:   0.8125rem;
  --t-base: 0.9375rem;
  --t-md:   1.0625rem;
  --t-lg:   1.25rem;
  --t-xl:   1.625rem;
  --t-2xl:  2.125rem;
  --t-3xl:  2.875rem;

  /* Boşluk ölçeği (4px tabanlı) */
  --s1: 4px;  --s2: 8px;  --s3: 12px; --s4: 16px;
  --s5: 20px; --s6: 24px; --s7: 32px; --s8: 40px; --s9: 56px;

  --r-sm: 10px; --r-md: 14px; --r-lg: 20px; --r-xl: 28px; --r-full: 999px;

  --shadow-1: 0 1px 2px rgba(25,23,34,.06), 0 2px 8px rgba(25,23,34,.05);
  --shadow-2: 0 4px 12px rgba(25,23,34,.08), 0 12px 32px rgba(25,23,34,.07);
  --shadow-3: 0 12px 28px rgba(25,23,34,.12), 0 32px 64px rgba(25,23,34,.10);

  --topbar-h: 60px;
  --navbar-h: 62px;
  --ease: cubic-bezier(.22,.9,.28,1);
  --dur-1: 140ms;
  --dur-2: 240ms;
  --dur-3: 420ms;
}

:root[data-theme="dark"],
:root[data-theme="system"] {
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root[data-theme="system"] { color-scheme: dark; }
}

/* Koyu tema — jetonların rolleri korunur, yalnızca değerler değişir. */
:root[data-theme="dark"],
:root[data-theme="system"] { }

html[data-dark="1"] {
  color-scheme: dark;
  --bg:          #121118;
  --bg-2:        #191822;
  --surface:     #1E1C28;
  --surface-2:   #24222F;
  --line:        #322F41;
  --line-strong: #454156;
  --ink:         #F3F1F8;
  --ink-2:       #BDB8CC;
  --ink-3:       #8E89A0;
  --violet:      #9B6BFF;
  --violet-ink:  #C3A6FF;
  --violet-soft: #2A2140;
  --lime:        #C6F224;
  --lime-deep:   #D6F86A;
  --lime-soft:   #27300B;
  --pink:        #FF6BA8;
  --pink-soft:   #3A1B2A;
  --cyan:        #2BD9EF;
  --cyan-soft:   #10323A;
  --ok:          #39CC7D;
  --ok-soft:     #14301F;
  --warn:        #E8A33B;
  --warn-soft:   #35270F;
  --bad:         #FF6B84;
  --bad-soft:    #3A1620;
  --on-accent:   #14121C;
  --shadow-1: 0 1px 2px rgba(0,0,0,.4);
  --shadow-2: 0 4px 14px rgba(0,0,0,.45);
  --shadow-3: 0 16px 40px rgba(0,0,0,.55);
}

/* ---------- 2. Temel / base --------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-ui);
  font-size: var(--t-base);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  -webkit-text-size-adjust: 100%;
  overflow-wrap: break-word;
}

h1, h2, h3, h4 { font-family: var(--font-display); font-weight: 700; line-height: 1.15; margin: 0; letter-spacing: -0.02em; }
h1 { font-size: var(--t-2xl); }
h2 { font-size: var(--t-xl); }
h3 { font-size: var(--t-md); letter-spacing: -0.01em; }
p  { margin: 0; }
img, svg { max-width: 100%; }

a { color: inherit; }

button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }

[hidden] { display: none !important; }

:focus-visible {
  outline: 3px solid var(--violet);
  outline-offset: 2px;
  border-radius: 6px;
}
html[data-dark="1"] :focus-visible { outline-color: var(--lime); }

.skip-link {
  position: fixed; top: -100px; left: var(--s4); z-index: 200;
  background: var(--violet); color: #fff; padding: var(--s3) var(--s5);
  border-radius: var(--r-md); text-decoration: none; font-weight: 600;
}
.skip-link:focus { top: var(--s4); }

.visually-hidden {
  position: absolute !important; width: 1px; height: 1px;
  padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* ---------- 3. Açılış ekranı / boot ------------------------------------- */
.boot {
  position: fixed; inset: 0; display: grid; place-content: center; justify-items: center;
  gap: var(--s5); background: var(--bg); z-index: 150;
}
.boot-mark {
  width: 52px; height: 52px; border-radius: var(--r-lg);
  background: var(--violet);
  box-shadow: 0 0 0 0 rgba(110,43,245,.45);
  animation: bootPulse 1.4s var(--ease) infinite;
}
@keyframes bootPulse {
  0%   { box-shadow: 0 0 0 0 rgba(110,43,245,.4); transform: scale(1); }
  70%  { box-shadow: 0 0 0 22px rgba(110,43,245,0); transform: scale(1.06); }
  100% { box-shadow: 0 0 0 0 rgba(110,43,245,0); transform: scale(1); }
}
.boot-text { color: var(--ink-3); font-size: var(--t-sm); }

/* ---------- 4. İskelet / layout ----------------------------------------- */
.shell { min-height: 100%; display: flex; flex-direction: column; }

.topbar {
  position: sticky; top: 0; z-index: 60;
  height: var(--topbar-h);
  display: flex; align-items: center; gap: var(--s4);
  padding: 0 var(--s4);
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: saturate(1.6) blur(12px);
  border-bottom: 1px solid var(--line);
}

.brand { display: inline-flex; align-items: center; min-height: 44px; gap: var(--s2); text-decoration: none; font-family: var(--font-display); font-weight: 700; font-size: var(--t-md); letter-spacing: -0.03em; }
.brand-mark svg { width: 26px; height: 26px; display: block; }
.brand-mark rect { fill: var(--violet); }
.brand-mark path { stroke: var(--lime); stroke-width: 12; fill: none; stroke-linecap: round; stroke-linejoin: round; }
.brand-accent { color: var(--violet); }

.nav-desktop { display: none; gap: var(--s1); margin-left: var(--s4); flex: 1; }
.nav-desktop a {
  padding: var(--s2) var(--s3); border-radius: var(--r-full);
  text-decoration: none; font-size: var(--t-sm); font-weight: 550; color: var(--ink-2);
  transition: background var(--dur-1) var(--ease), color var(--dur-1) var(--ease);
  white-space: nowrap;
}
.nav-desktop a:hover { background: var(--bg-2); color: var(--ink); }
.nav-desktop a[aria-current="page"] { background: var(--ink); color: var(--bg); }

.topbar-right { margin-left: auto; display: flex; align-items: center; gap: var(--s2); }

.streak-chip {
  display: inline-flex; align-items: center; gap: 5px;
  background: var(--lime-soft); color: var(--lime-deep);
  border: 1px solid color-mix(in srgb, var(--lime) 45%, var(--line));
  padding: 5px var(--s3); border-radius: var(--r-full);
  font-size: var(--t-sm); font-weight: 700; font-variant-numeric: tabular-nums;
}
.streak-chip .flame { font-size: 13px; filter: grayscale(.15); }
.streak-chip[data-cold="1"] { background: var(--bg-2); color: var(--ink-3); border-color: var(--line); }

.main {
  flex: 1;
  width: 100%;
  max-width: 1120px;
  margin: 0 auto;
  padding: var(--s6) var(--s4) calc(var(--navbar-h) + var(--s8));
  outline: none;
}

.nav-mobile {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 60;
  height: calc(var(--navbar-h) + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom);
  display: grid; grid-template-columns: repeat(3, 1fr); max-width: 420px; margin: 0 auto;
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  backdrop-filter: saturate(1.6) blur(14px);
  border-top: 1px solid var(--line);
}
.nav-mobile a {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  text-decoration: none; font-size: 10.5px; font-weight: 600; color: var(--ink-3);
  min-height: 44px;
  transition: color var(--dur-1) var(--ease);
}
.nav-mobile a .ico { font-size: 17px; line-height: 1; }
.nav-mobile a[aria-current="page"] { color: var(--violet); }
html[data-dark="1"] .nav-mobile a[aria-current="page"] { color: var(--lime); }

@media (min-width: 900px) {
  .nav-desktop { display: flex; }
  .nav-mobile { display: none; }
  .main { padding: var(--s8) var(--s6) var(--s9); }
}

/* Focus mode: a study/quiz card is on screen — hide the app chrome around it
   so the card and its answer buttons fit in one view on a phone. */
html[data-focus="1"] .topbar { display: none; }
html[data-focus="1"] .nav-mobile { display: none; }
html[data-focus="1"] .main { padding-top: var(--s3); padding-bottom: var(--s4); }

/* ---------- 5. Kartlar / cards ------------------------------------------ */
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: var(--s5);
}
.card-pad-lg { padding: var(--s6); }

/* minmax(0,1fr): a single column that may shrink below its widest child, so a
   wide row or a long nowrap line can never push the page wider than the screen. */
.stack { display: grid; gap: var(--s5); grid-template-columns: minmax(0, 1fr); }
.stack-sm { display: grid; gap: var(--s3); grid-template-columns: minmax(0, 1fr); }
.row { display: flex; align-items: center; gap: var(--s3); flex-wrap: wrap; }
.row-tight { display: flex; align-items: center; gap: var(--s2); flex-wrap: wrap; }
.spacer { flex: 1; }

.grid-2 { display: grid; gap: var(--s4); grid-template-columns: 1fr; }
.grid-3 { display: grid; gap: var(--s4); grid-template-columns: repeat(2, 1fr); }
.grid-4 { display: grid; gap: var(--s3); grid-template-columns: repeat(2, 1fr); }
@media (min-width: 760px) {
  .grid-2 { grid-template-columns: 1fr 1fr; }
  .grid-3 { grid-template-columns: repeat(3, 1fr); }
  .grid-4 { grid-template-columns: repeat(4, 1fr); }
}

.section-head { display: flex; align-items: baseline; gap: var(--s3); margin-bottom: var(--s4); }
.section-head h2 { flex: 1; }
.eyebrow {
  font-size: var(--t-xs); font-weight: 700; letter-spacing: .09em; text-transform: uppercase;
  color: var(--ink-3);
}

.muted { color: var(--ink-2); }
.dim   { color: var(--ink-3); }
.small { font-size: var(--t-sm); }
.tnum  { font-variant-numeric: tabular-nums; }

/* ---------- 6. Düğmeler / buttons --------------------------------------- */
.btn {
  --btn-bg: var(--surface);
  --btn-fg: var(--ink);
  --btn-bd: var(--line-strong);
  display: inline-flex; align-items: center; justify-content: center; gap: var(--s2);
  min-height: 44px; padding: 0 var(--s5);
  background: var(--btn-bg); color: var(--btn-fg);
  border: 1.5px solid var(--btn-bd); border-radius: var(--r-full);
  font-size: var(--t-base); font-weight: 650; text-decoration: none; text-align: center;
  transition: transform var(--dur-1) var(--ease), box-shadow var(--dur-1) var(--ease),
              background var(--dur-1) var(--ease), border-color var(--dur-1) var(--ease);
}
.btn:hover { transform: translateY(-1px); box-shadow: var(--shadow-1); }
.btn:active { transform: translateY(1px) scale(.99); box-shadow: none; }
.btn[disabled], .btn[aria-disabled="true"] { opacity: .45; pointer-events: none; }

.btn-primary { --btn-bg: var(--violet); --btn-fg: #fff; --btn-bd: var(--violet); }
.btn-primary:hover { box-shadow: 0 6px 18px color-mix(in srgb, var(--violet) 40%, transparent); }
html[data-dark="1"] .btn-primary { --btn-fg: #13101E; }

.btn-lime { --btn-bg: var(--lime); --btn-fg: #1B2400; --btn-bd: var(--lime); }
.btn-lime:hover { box-shadow: 0 6px 18px color-mix(in srgb, var(--lime) 50%, transparent); }

.btn-pink { --btn-bg: var(--pink); --btn-fg: #fff; --btn-bd: var(--pink); }
html[data-dark="1"] .btn-pink { --btn-fg: #2A0A18; }

.btn-ghost { --btn-bg: transparent; --btn-bd: transparent; --btn-fg: var(--ink-2); }
.btn-ghost:hover { --btn-bg: var(--bg-2); --btn-fg: var(--ink); }

.btn-sm { min-height: 36px; padding: 0 var(--s4); font-size: var(--t-sm); }
.btn-lg { min-height: 56px; padding: 0 var(--s7); font-size: var(--t-md); font-weight: 700; }
.btn-block { display: flex; width: 100%; }

.btn-hero {
  --btn-bg: var(--violet); --btn-fg: #fff; --btn-bd: var(--violet);
  min-height: 60px; font-size: var(--t-md); font-weight: 700;
  box-shadow: 0 10px 26px color-mix(in srgb, var(--violet) 32%, transparent);
}
.btn-hero:hover { box-shadow: 0 14px 34px color-mix(in srgb, var(--violet) 42%, transparent); }
html[data-dark="1"] .btn-hero { --btn-fg: #13101E; }

.icon-btn {
  display: inline-grid; place-items: center;
  width: 44px; height: 44px; border-radius: var(--r-full);
  background: transparent; border: 1.5px solid var(--line); color: var(--ink-2);
  transition: background var(--dur-1) var(--ease), color var(--dur-1) var(--ease), border-color var(--dur-1) var(--ease);
}
.icon-btn:hover { background: var(--bg-2); color: var(--ink); }
.icon-btn[aria-pressed="true"] { background: var(--pink-soft); border-color: var(--pink); color: var(--pink); }

/* ---------- 7. Rozetler / badges & chips -------------------------------- */
.badge {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px var(--s3); border-radius: var(--r-full);
  font-size: var(--t-xs); font-weight: 700; letter-spacing: .01em;
  background: var(--bg-2); color: var(--ink-2); border: 1px solid var(--line);
  white-space: nowrap;
}
.badge-new      { background: var(--cyan-soft);   color: #046C7C; border-color: color-mix(in srgb, var(--cyan) 40%, var(--line)); }
.badge-learning { background: var(--violet-soft); color: var(--violet-ink); border-color: color-mix(in srgb, var(--violet) 32%, var(--line)); }
.badge-review   { background: var(--warn-soft);   color: var(--warn); border-color: color-mix(in srgb, var(--warn) 34%, var(--line)); }
.badge-learned  { background: var(--ok-soft);     color: var(--ok); border-color: color-mix(in srgb, var(--ok) 34%, var(--line)); }
.badge-topic    { background: var(--pink-soft);   color: #B0175C; border-color: color-mix(in srgb, var(--pink) 30%, var(--line)); }
.badge-pos      { background: var(--surface-2, var(--bg)); color: var(--ink-2); font-style: italic; }
.pos-tag        { font-size: .72em; font-weight: 600; font-style: italic; color: var(--ink-3); margin-left: 6px; letter-spacing: 0; }
html[data-dark="1"] .badge-new { color: var(--cyan); }
html[data-dark="1"] .badge-topic { color: var(--pink); }

.chip {
  display: inline-flex; align-items: center; gap: 6px;
  min-height: 38px; padding: 0 var(--s4);
  background: var(--surface); border: 1.5px solid var(--line); border-radius: var(--r-full);
  font-size: var(--t-sm); font-weight: 600; color: var(--ink-2);
  transition: all var(--dur-1) var(--ease);
}
.chip:hover { border-color: var(--line-strong); color: var(--ink); }
.chip[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: var(--bg); }
.chip .count { font-variant-numeric: tabular-nums; opacity: .7; font-weight: 600; }

/* ---------- 8. İstatistik kutuları / stat tiles -------------------------- */
.tile {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md);
  padding: var(--s4); display: grid; gap: 2px; align-content: start;
}
.tile .k { font-size: var(--t-xs); font-weight: 650; color: var(--ink-3); letter-spacing: .01em; }
.tile .v { font-family: var(--font-display); font-size: var(--t-xl); font-weight: 700; font-variant-numeric: tabular-nums; line-height: 1.1; }
.tile .sub { font-size: var(--t-xs); color: var(--ink-3); }
.tile-violet .v { color: var(--violet); }
.tile-pink   .v { color: var(--pink); }
.tile-cyan   .v { color: #068EA1; }
html[data-dark="1"] .tile-cyan .v { color: var(--cyan); }
.tile-ok     .v { color: var(--ok); }

/* ---------- 9. İlerleme / progress -------------------------------------- */
.bar { height: 10px; background: var(--bg-2); border-radius: var(--r-full); overflow: hidden; }
.bar > i {
  display: block; height: 100%; border-radius: var(--r-full);
  background: linear-gradient(90deg, var(--violet), var(--pink));
  transition: width var(--dur-3) var(--ease);
}
.bar-lime > i { background: linear-gradient(90deg, var(--lime-deep), var(--lime)); }

.ring { display: block; }
.ring circle { fill: none; stroke-linecap: round; }
.ring .track { stroke: var(--bg-2); }
.ring .fill  { stroke: var(--violet); transition: stroke-dashoffset var(--dur-3) var(--ease); }

/* ---------- 10. Tick8 izleyici / tracker -------------------------------- */
.tick8 { display: inline-flex; align-items: center; gap: 5px; }
.tick8-slot {
  position: relative;
  width: 22px; height: 22px; border-radius: 7px;
  display: grid; place-items: center;
  background: var(--bg-2); border: 1.5px solid var(--line);
  font-size: 12px; font-weight: 800; line-height: 1; color: var(--ink-3);
  transition: transform var(--dur-2) var(--ease), background var(--dur-2) var(--ease);
}
.tick8-slot[data-s="ok"]  { background: var(--lime); border-color: var(--lime-deep); color: #26300A; }
.tick8-slot[data-s="bad"] { background: var(--bad-soft); border-color: var(--bad); color: var(--bad); }
.tick8-slot[data-s="now"] { border-color: var(--violet); border-style: dashed; background: var(--violet-soft); color: var(--violet-ink); }
.tick8-slot.pop { animation: slotPop var(--dur-3) var(--ease); }
@keyframes slotPop {
  0%   { transform: scale(.4) rotate(-12deg); }
  55%  { transform: scale(1.22) rotate(4deg); }
  100% { transform: scale(1) rotate(0); }
}
.tick8-sm .tick8-slot { width: 15px; height: 15px; border-radius: 5px; font-size: 9px; border-width: 1.25px; }
.tick8-lg .tick8-slot { width: 34px; height: 34px; border-radius: 11px; font-size: 17px; }

/* ---------- 11. Çalışma kartı / flashcard ------------------------------- */
.session-wrap { max-width: 640px; margin: 0 auto; display: grid; gap: var(--s5); }

.session-top { display: flex; align-items: center; gap: var(--s3); }
.session-top .bar { flex: 1; }

.flip {
  perspective: 1600px;
  min-height: 360px;   /* JS gercek icerik yuksekligini ayarlar */
  touch-action: pan-y;
}
.flip-inner {
  position: relative; width: 100%; height: 100%; min-height: 360px;
  transform-style: preserve-3d;
  transition: transform var(--dur-3) var(--ease);
}
.flip[data-face="back"] .flip-inner { transform: rotateY(180deg); }
.flip-face {
  position: absolute; inset: 0;
  backface-visibility: hidden; -webkit-backface-visibility: hidden;
  background: var(--surface); border: 1.5px solid var(--line);
  border-radius: var(--r-xl); padding: var(--s6);
  display: flex; flex-direction: column;
  box-shadow: var(--shadow-2);
  overflow: auto;
}
.flip-face.back { transform: rotateY(180deg); }
.flip[data-drag="1"] .flip-inner { transition: none; }

.card-kind { display: flex; align-items: center; gap: var(--s2); margin-bottom: auto; }

.word-xl {
  font-family: var(--font-display); font-weight: 700;
  font-size: clamp(2.1rem, 9vw, 3.4rem); line-height: 1.05; letter-spacing: -0.035em;
  text-align: center; margin: var(--s5) 0 var(--s2);
  overflow-wrap: anywhere;
}
.word-sub { text-align: center; color: var(--ink-3); font-size: var(--t-sm); }
.card-hint { margin-top: auto; text-align: center; color: var(--ink-3); font-size: var(--t-sm); }

.meaning-block { display: grid; gap: var(--s2); padding: var(--s4) 0; border-top: 1px solid var(--line); }
.meaning-block:first-of-type { border-top: 0; padding-top: var(--s2); }
.meaning-block .lbl { font-size: var(--t-xs); font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-3); }
.meaning-en { font-size: var(--t-md); font-weight: 600; }
.meaning-tr { font-size: var(--t-md); color: var(--violet); font-weight: 600; }
html[data-dark="1"] .meaning-tr { color: var(--violet-ink); }
.meaning-ex { font-size: var(--t-base); color: var(--ink-2); font-style: italic; }
.meaning-ex mark { background: var(--lime); color: #26300A; padding: 0 3px; border-radius: 4px; font-style: normal; font-weight: 650; }
.affix-chip {
  display: inline-block; font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: var(--t-sm); background: var(--cyan-soft); color: #055B68;
  border: 1px solid color-mix(in srgb, var(--cyan) 35%, var(--line));
  padding: var(--s2) var(--s3); border-radius: var(--r-sm);
}
html[data-dark="1"] .affix-chip { color: var(--cyan); }

.answer-row { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s3); }
/* Dar ekranda "Tekrar Et" iki satira bolunmesin. */
.answer-row .btn { padding-inline: var(--s3); white-space: nowrap; }

.swipe-tag {
  position: absolute; top: var(--s5); padding: 6px var(--s4);
  border-radius: var(--r-full); font-weight: 800; font-size: var(--t-sm);
  opacity: 0; transition: opacity var(--dur-1) linear; pointer-events: none;
}
.swipe-tag.yes { right: var(--s5); background: var(--lime); color: #26300A; transform: rotate(8deg); }
.swipe-tag.no  { left: var(--s5);  background: var(--bad); color: #fff; transform: rotate(-8deg); }

/* ---------- 12. Alıştırma / quiz ---------------------------------------- */
.q-stem {
  font-size: var(--t-md); line-height: 1.6;
}
.q-stem mark { background: var(--lime); color: #26300A; padding: 1px 5px; border-radius: 5px; font-weight: 650; }
.q-blank {
  display: inline-block; min-width: 96px; border-bottom: 3px solid var(--violet);
  vertical-align: baseline; margin: 0 4px;
}
.opts { display: grid; gap: var(--s3); }
.opt {
  display: flex; align-items: center; gap: var(--s3); width: 100%;
  min-height: 56px; padding: var(--s3) var(--s4);
  background: var(--surface); border: 1.5px solid var(--line); border-radius: var(--r-md);
  text-align: left; font-size: var(--t-base); font-weight: 550; color: var(--ink);
  transition: all var(--dur-1) var(--ease);
}
.opt:hover:not([disabled]) { border-color: var(--violet); background: var(--violet-soft); transform: translateY(-1px); }
.opt .key {
  flex: none; display: grid; place-items: center;
  width: 28px; height: 28px; border-radius: 9px;
  background: var(--bg-2); color: var(--ink-3);
  font-size: var(--t-sm); font-weight: 800;
}
.opt[data-state="correct"] { border-color: var(--ok); background: var(--ok-soft); }
.opt[data-state="correct"] .key { background: var(--ok); color: #fff; }
.opt[data-state="wrong"]   { border-color: var(--bad); background: var(--bad-soft); }
.opt[data-state="wrong"] .key { background: var(--bad); color: #fff; }
.opt[disabled] { cursor: default; }
.opt[disabled][data-state=""] { opacity: .55; }

.feedback {
  border-radius: var(--r-md); padding: var(--s4);
  border: 1.5px solid var(--line); background: var(--surface-2);
  display: grid; gap: var(--s2);
  animation: rise var(--dur-2) var(--ease);
}
.feedback[data-ok="1"] { border-color: var(--ok); background: var(--ok-soft); }
.feedback[data-ok="0"] { border-color: var(--bad); background: var(--bad-soft); }
.feedback .fb-title { font-family: var(--font-display); font-weight: 700; font-size: var(--t-md); }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* ---------- 13. Kelime listesi / library -------------------------------- */
.search-wrap { position: relative; }
.search-wrap input {
  width: 100%; min-height: 50px; padding: 0 var(--s5) 0 46px;
  background: var(--surface); border: 1.5px solid var(--line); border-radius: var(--r-full);
  font-size: var(--t-md);
}
.search-wrap input::placeholder { color: var(--ink-3); }
.search-wrap .mag { position: absolute; left: 18px; top: 50%; transform: translateY(-50%); color: var(--ink-3); pointer-events: none; }
.search-wrap .clear {
  position: absolute; right: 6px; top: 50%; transform: translateY(-50%);
  width: 38px; height: 38px; border: 0; background: var(--bg-2);
}
.search-wrap .clear:hover { background: var(--line); }

.filters { display: flex; gap: var(--s2); overflow-x: auto; padding: var(--s1) 0 var(--s2); scrollbar-width: thin; }
.filters::-webkit-scrollbar { height: 5px; }
.filters::-webkit-scrollbar-thumb { background: var(--line-strong); border-radius: 3px; }
.filters .chip { flex: none; }

.wlist { display: grid; gap: var(--s2); grid-template-columns: minmax(0, 1fr); }
.witem {
  display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: var(--s2) var(--s4); align-items: center;
  width: 100%; min-width: 0; padding: var(--s3) var(--s4);
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md);
  text-align: left;
  transition: border-color var(--dur-1) var(--ease), transform var(--dur-1) var(--ease);
}
.witem:hover { border-color: var(--violet); transform: translateX(2px); }
.witem .w { font-family: var(--font-display); font-weight: 650; font-size: var(--t-md); letter-spacing: -.02em; }
.witem .m { font-size: var(--t-sm); color: var(--ink-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.witem .side { display: flex; align-items: center; gap: var(--s2); justify-self: end; }
.witem .tr { font-size: var(--t-sm); color: var(--ink-3); grid-column: 1 / -1; }
.witem mark { background: var(--lime); color: #26300A; border-radius: 3px; padding: 0 2px; }

/* ---------- 14. Alt sayfa / sheet --------------------------------------- */
.sheet { position: fixed; inset: 0; z-index: 120; display: flex; align-items: flex-end; justify-content: center; }
.sheet-scrim { position: absolute; inset: 0; background: rgba(20,17,30,.5); backdrop-filter: blur(3px); animation: fade var(--dur-2) var(--ease); }
@keyframes fade { from { opacity: 0 } to { opacity: 1 } }
.sheet-panel {
  position: relative; width: min(620px, 100%); max-height: 88vh; overflow: auto;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r-xl) var(--r-xl) 0 0;
  padding: var(--s6) var(--s5) calc(var(--s7) + env(safe-area-inset-bottom));
  box-shadow: var(--shadow-3);
  animation: sheetUp var(--dur-3) var(--ease);
}
@keyframes sheetUp { from { transform: translateY(24px); opacity: 0 } to { transform: none; opacity: 1 } }
.sheet-close { position: absolute; top: var(--s4); right: var(--s4); width: 38px; height: 38px; border-radius: var(--r-full); border: 1px solid var(--line); background: var(--surface); color: var(--ink-2); font-size: 15px; }
@media (min-width: 700px) {
  .sheet { align-items: center; }
  .sheet-panel { border-radius: var(--r-xl); padding-bottom: var(--s7); }
}

/* ---------- 15. Bildirim / toast ---------------------------------------- */
.toast {
  position: fixed; left: 50%; bottom: calc(var(--navbar-h) + var(--s5)); transform: translateX(-50%) translateY(20px);
  z-index: 140; max-width: calc(100% - 32px);
  background: var(--ink); color: var(--bg);
  padding: var(--s3) var(--s5); border-radius: var(--r-full);
  font-size: var(--t-sm); font-weight: 600;
  opacity: 0; pointer-events: none;
  transition: opacity var(--dur-2) var(--ease), transform var(--dur-2) var(--ease);
}
.toast[data-show="1"] { opacity: 1; transform: translateX(-50%) translateY(0); }
@media (min-width: 900px) { .toast { bottom: var(--s6); } }

/* ---------- 16. Boş / yükleniyor durumları ------------------------------ */
.empty {
  display: grid; gap: var(--s3); justify-items: center; text-align: center;
  padding: var(--s8) var(--s4); color: var(--ink-2);
}
.empty .emoji { font-size: 34px; }
.empty h3 { color: var(--ink); }

.skeleton { background: linear-gradient(90deg, var(--bg-2) 25%, var(--surface-2) 50%, var(--bg-2) 75%); background-size: 200% 100%; animation: shimmer 1.3s linear infinite; border-radius: var(--r-sm); }
@keyframes shimmer { to { background-position: -200% 0; } }

/* ---------- 17. Kutlama / celebration ----------------------------------- */
.celebrate { position: fixed; inset: 0; z-index: 130; display: grid; place-items: center; pointer-events: none; }
.celebrate .burst {
  position: absolute; width: 9px; height: 9px; border-radius: 2px;
  animation: burst 1100ms var(--ease) forwards;
}
@keyframes burst {
  0%   { transform: translate(0,0) scale(1) rotate(0); opacity: 1; }
  100% { transform: translate(var(--dx), var(--dy)) scale(.4) rotate(320deg); opacity: 0; }
}
.celebrate-card {
  pointer-events: auto;
  background: var(--surface); border: 2px solid var(--violet); border-radius: var(--r-xl);
  padding: var(--s7) var(--s6); text-align: center; display: grid; gap: var(--s4); justify-items: center;
  box-shadow: var(--shadow-3); max-width: min(420px, calc(100% - 32px));
  animation: popIn var(--dur-3) var(--ease);
}
@keyframes popIn { 0% { transform: scale(.85); opacity: 0 } 100% { transform: none; opacity: 1 } }

/* ---------- 18. Grafikler / charts -------------------------------------- */
.chart { width: 100%; height: auto; display: block; overflow: visible; }
.chart .grid-line { stroke: var(--line); stroke-width: 1; }
.chart .bar-v { fill: var(--violet); transition: fill var(--dur-1) var(--ease); }
.chart .bar-v.empty-bar { fill: var(--bg-2); }
.chart .lbl { fill: var(--ink-3); font-size: 10px; font-family: var(--font-ui); }

.weekdots {
  display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 6px;
  max-width: 360px;   /* isi haritasi kucuk kareler halinde okunur */
}
.weekdots .d {
  aspect-ratio: 1; border-radius: 8px; background: var(--bg-2);
  display: grid; place-items: center; font-size: 11px; font-weight: 700; color: var(--ink-3);
}
.weekdots .d[data-lv="1"] { background: var(--lime-soft); color: var(--lime-deep); }
.weekdots .d[data-lv="2"] { background: color-mix(in srgb, var(--lime) 60%, var(--lime-soft)); color: var(--lime-deep); }
.weekdots .d[data-lv="3"] { background: var(--lime); color: #26300A; }
.weekdots .d[data-today="1"] { outline: 2px solid var(--violet); outline-offset: 1px; }

/* ---------- 20. Formlar / forms ----------------------------------------- */
.field { display: grid; gap: var(--s2); }
.field label { font-size: var(--t-sm); font-weight: 650; }
.field .help { font-size: var(--t-xs); color: var(--ink-3); }
.field select, .field input[type="number"], .field input[type="text"] {
  min-height: 46px; padding: 0 var(--s4);
  background: var(--surface); border: 1.5px solid var(--line); border-radius: var(--r-md);
}
.seg { display: inline-flex; background: var(--bg-2); border-radius: var(--r-full); padding: 3px; gap: 2px; }
.seg button {
  min-height: 38px; padding: 0 var(--s4); border: 0; border-radius: var(--r-full);
  background: transparent; font-size: var(--t-sm); font-weight: 650; color: var(--ink-2);
  transition: all var(--dur-1) var(--ease);
}
.seg button[aria-pressed="true"] { background: var(--surface); color: var(--ink); box-shadow: var(--shadow-1); }

.switch-row { display: flex; align-items: center; gap: var(--s4); justify-content: space-between; padding: var(--s3) 0; border-top: 1px solid var(--line); }
.switch-row:first-child { border-top: 0; }

.note {
  border-left: 3px solid var(--cyan); background: var(--cyan-soft);
  padding: var(--s3) var(--s4); border-radius: 0 var(--r-sm) var(--r-sm) 0;
  font-size: var(--t-sm); color: var(--ink-2);
}
.note-warn { border-left-color: var(--warn); background: var(--warn-soft); }

/* ---------- 21. Hareket tercihi / reduced motion ------------------------ */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .001ms !important; animation-iteration-count: 1 !important;
    transition-duration: .001ms !important; scroll-behavior: auto !important;
  }
}
html[data-motion="reduced"] *, html[data-motion="reduced"] *::before, html[data-motion="reduced"] *::after {
  animation-duration: .001ms !important; animation-iteration-count: 1 !important;
  transition-duration: .001ms !important;
}
html[data-motion="reduced"] .flip-inner { transition: none !important; }

/* ---------- 22. Gunluk calisma secimi / mode cards ---------------------- */
.mode-grid { gap: var(--s4); }

.mode-card {
  display: grid; gap: var(--s2); align-content: start;
  padding: var(--s6) var(--s5);
  background: var(--surface); border: 1.5px solid var(--line);
  border-radius: var(--r-xl); text-decoration: none; color: inherit;
  position: relative; overflow: hidden;
  transition: transform var(--dur-1) var(--ease), box-shadow var(--dur-1) var(--ease),
              border-color var(--dur-1) var(--ease);
}
.mode-card::after {
  content: ''; position: absolute; inset: auto -40px -60px auto;
  width: 160px; height: 160px; border-radius: 50%;
  background: var(--tone-soft); opacity: .7; pointer-events: none;
}
.mode-card[data-tone="cyan"]   { --tone: var(--cyan);   --tone-soft: var(--cyan-soft); }
.mode-card[data-tone="violet"] { --tone: var(--violet); --tone-soft: var(--violet-soft); }
.mode-card:hover { transform: translateY(-2px); border-color: var(--tone); box-shadow: var(--shadow-2); }
.mode-card[aria-disabled="true"] { opacity: .6; pointer-events: none; }

.mode-top { display: flex; align-items: center; gap: var(--s3); position: relative; z-index: 1; }
.mode-emoji {
  display: grid; place-items: center; flex: none;
  width: 42px; height: 42px; border-radius: var(--r-md);
  background: var(--tone); color: #fff; font-size: 20px; font-weight: 700;
}
html[data-dark="1"] .mode-emoji { color: #15121F; }
.mode-count {
  font-family: var(--font-display); font-size: var(--t-3xl); font-weight: 700;
  line-height: 1; letter-spacing: -.04em; font-variant-numeric: tabular-nums;
}
.mode-title { position: relative; z-index: 1; font-size: var(--t-lg); }
.mode-desc  { position: relative; z-index: 1; font-size: var(--t-sm); color: var(--ink-2); }
.mode-go {
  position: relative; z-index: 1; margin-top: var(--s2);
  font-size: var(--t-sm); font-weight: 700; color: var(--tone);
}
html[data-dark="1"] .mode-card[data-tone="cyan"] .mode-go { color: var(--cyan); }

/* ---------- 23. Takvim / calendar --------------------------------------- */
.cal-card { gap: var(--s3); }
.cal-head { display: flex; align-items: center; justify-content: space-between; gap: var(--s3); }
.cal-month { font-size: var(--t-md); text-align: center; flex: 1; }
.cal-head, .cal-legend { max-width: 460px; margin-inline: auto; width: 100%; }
.cal-head .icon-btn { width: 38px; height: 38px; font-size: 20px; line-height: 1; }
.cal-head .icon-btn[disabled] { opacity: .3; pointer-events: none; }

.cal-grid {
  display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 5px;
  /* Genis ekranda hucreler devasa olmasin; takvim ortalanir. */
  max-width: 460px; margin-inline: auto; width: 100%;
}
.cal-dow span {
  text-align: center; font-size: 10px; font-weight: 700;
  color: var(--ink-3); letter-spacing: .04em;
}
.cal-blank { aspect-ratio: 1; }

.cal-day {
  position: relative; aspect-ratio: 1;
  display: grid; place-items: center; gap: 0;
  border: 1.5px solid transparent; border-radius: var(--r-sm);
  background: var(--bg-2); color: var(--ink-2);
  font-size: var(--t-sm); font-weight: 650; font-variant-numeric: tabular-nums;
  min-height: 38px;
  transition: transform var(--dur-1) var(--ease), background var(--dur-1) var(--ease);
}
.cal-day:hover { transform: scale(1.06); border-color: var(--line-strong); }
.cal-day[data-lv="1"] { background: var(--lime-soft); color: var(--lime-deep); }
.cal-day[data-lv="2"] { background: color-mix(in srgb, var(--lime) 62%, var(--lime-soft)); color: #2C3706; }
.cal-day[data-lv="3"] { background: var(--lime); color: #26300A; }
.cal-day[data-today="1"] { box-shadow: inset 0 0 0 2px var(--violet); }
.cal-day[data-sel="1"] { border-color: var(--ink); background: var(--ink); color: var(--bg); transform: scale(1.06); }
.cal-day[data-sel="1"] .cal-dot { background: var(--lime); }
.cal-day[data-future="1"] { opacity: .4; }
.cal-num { line-height: 1; }
.cal-dot {
  position: absolute; bottom: 4px; left: 50%; transform: translateX(-50%);
  width: 4px; height: 4px; border-radius: 50%; background: currentColor; opacity: .55;
}

.cal-legend { display: flex; align-items: center; gap: 5px; flex-wrap: wrap; }
.cal-key { width: 14px; height: 14px; border-radius: 4px; background: var(--bg-2); }
.cal-key[data-lv="1"] { background: var(--lime-soft); }
.cal-key[data-lv="2"] { background: color-mix(in srgb, var(--lime) 62%, var(--lime-soft)); }
.cal-key[data-lv="3"] { background: var(--lime); }

/* Secili gunun dokumu */
.day-panel { border-color: var(--violet); }
.day-sec { display: grid; gap: var(--s2); padding-top: var(--s3); border-top: 1px solid var(--line); }

.word-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.word-chip {
  padding: 5px var(--s3); border-radius: var(--r-full);
  border: 1px solid var(--line); background: var(--surface-2);
  font-size: var(--t-sm); font-weight: 600; color: var(--ink);
  min-height: 32px;
  transition: all var(--dur-1) var(--ease);
}
.word-chip:hover { border-color: var(--violet); background: var(--violet-soft); }
.word-chip[data-tone="cyan"]   { background: var(--cyan-soft);   border-color: color-mix(in srgb, var(--cyan) 35%, var(--line)); }
.word-chip[data-tone="violet"] { background: var(--violet-soft); border-color: color-mix(in srgb, var(--violet) 30%, var(--line)); }
.word-chip[data-tone="ok"]     { background: var(--ok-soft);     border-color: color-mix(in srgb, var(--ok) 35%, var(--line)); }
.word-chip.more { background: transparent; border-style: dashed; color: var(--ink-3); }

/* ---------- 24. Kelime yapisi / affix breakdown ------------------------- */
.affix-row { display: flex; flex-wrap: wrap; align-items: stretch; gap: var(--s2); }
.affix-plus {
  align-self: center; font-family: var(--font-display);
  font-size: var(--t-lg); font-weight: 700; color: var(--ink-3);
}
.affix-part {
  flex: 1 1 160px; min-width: 0;
  display: grid; gap: 2px; align-content: start;
  padding: var(--s3); border-radius: var(--r-md);
  border: 1.5px solid var(--line); background: var(--surface-2);
  border-left-width: 4px;
}
.affix-part[data-kind="prefix"] { border-left-color: var(--cyan); }
.affix-part[data-kind="root"]   { border-left-color: var(--violet); }
.affix-part[data-kind="suffix"] { border-left-color: var(--pink); }
.affix-kind {
  font-size: 10px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase;
  color: var(--ink-3);
}
.affix-label {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: var(--t-md); font-weight: 700; overflow-wrap: anywhere;
}
.affix-mean { font-size: var(--t-sm); color: var(--ink-2); }

/* ---------- 25. Yeni kelime karti / learn card -------------------------- */
.learn-card { border-width: 1.5px; }
.learn-title { display: flex; align-items: center; justify-content: center; gap: var(--s3); flex-wrap: wrap; }
.learn-word { margin: var(--s2) 0; }
.review-word {
  font-family: var(--font-display); font-weight: 700;
  font-size: clamp(1.5rem, 6vw, 2.1rem); letter-spacing: -.03em; text-align: center;
  overflow-wrap: anywhere;
}

/* ---------- 26. Genel ilerleme / overall progress ----------------------- */
.bar-stack { display: flex; gap: 2px; }
.bar-stack > i { height: 100%; flex: none; border-radius: 0; background: var(--bg-2); }
.bar-stack > i:first-child { border-radius: var(--r-full) 0 0 var(--r-full); }
.bar-stack > i:last-child  { border-radius: 0 var(--r-full) var(--r-full) 0; }
.bar-stack > i:only-child  { border-radius: var(--r-full); }
.bar-stack > i[data-k="mastered"]  { background: var(--ok); }
.bar-stack > i[data-k="reviewing"] { background: var(--violet); }
.bar-stack > i[data-k="learning"]  { background: var(--cyan); }

.prog-legend { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--s3); margin-top: var(--s4); }
.prog-item { display: flex; gap: var(--s2); align-items: flex-start; min-width: 0; }
.prog-dot { flex: none; width: 10px; height: 10px; border-radius: 3px; margin-top: 9px; background: var(--ink-3); }
.prog-item[data-k="mastered"]  .prog-dot { background: var(--ok); }
.prog-item[data-k="reviewing"] .prog-dot { background: var(--violet); }
.prog-item[data-k="learning"]  .prog-dot { background: var(--cyan); }
.prog-n { font-family: var(--font-display); font-size: var(--t-xl); font-weight: 700; line-height: 1.1; font-variant-numeric: tabular-nums; }
.prog-label { font-size: var(--t-sm); font-weight: 650; }
.prog-hint { font-size: var(--t-xs); color: var(--ink-3); line-height: 1.35; }
@media (max-width: 420px) { .prog-hint { display: none; } }

/* ---------- 27. Dar ekran duzeltmeleri / narrow-screen fixes ------------ */
.witem > div:first-child { min-width: 0; }
.witem .side { flex-wrap: wrap; justify-content: flex-end; min-width: 0; }
@media (max-width: 520px) {
  /* Text on top, status + progress underneath, so the word and its meaning
     get the full row instead of a sliver next to the badges. */
  .witem { grid-template-columns: minmax(0, 1fr); }
  .witem .side { order: 3; justify-self: start; justify-content: flex-start; }
}

/* Setting rows: label and its control wrap onto two lines when they don't fit. */
.switch-row { flex-wrap: wrap; }
.seg { max-width: 100%; }
