:root {
  --bg: #ffffff;
  --fg: #1f2328;
  --muted: #57606a;
  --border: #e5e7eb;
  --input-border: #d0d7de;
  --surface: #ffffff;
  --surface-2: #f6f8fa;
  --accent: #0969da;
  --scroll: rgba(0, 0, 0, 0.18);
  --scroll-hover: rgba(0, 0, 0, 0.32);
}
:root[data-theme="dark"] {
  --bg: #0d1117;
  --fg: #e6edf3;
  --muted: #9198a1;
  --border: #30363d;
  --input-border: #30363d;
  --surface: #161b22;
  --surface-2: #21262d;
  --accent: #4493f8;
  --scroll: rgba(255, 255, 255, 0.16);
  --scroll-hover: rgba(255, 255, 255, 0.3);
}
@media (prefers-color-scheme: dark) {
  :root[data-theme="system"] {
    --bg: #0d1117;
    --fg: #e6edf3;
    --muted: #9198a1;
    --border: #30363d;
    --input-border: #30363d;
    --surface: #161b22;
    --surface-2: #21262d;
    --accent: #4493f8;
    --scroll: rgba(255, 255, 255, 0.16);
    --scroll-hover: rgba(255, 255, 255, 0.3);
  }
}

/* İnce, şık scrollbar (default kaba tasarımı değiştirir) */
* { scrollbar-width: thin; scrollbar-color: var(--scroll) transparent; }
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: var(--scroll);
  border-radius: 8px;
  border: 2px solid transparent;
  background-clip: padding-box;
}
::-webkit-scrollbar-thumb:hover {
  background: var(--scroll-hover);
  background-clip: padding-box;
}
::-webkit-scrollbar-corner { background: transparent; }

* { box-sizing: border-box; }
html { background: var(--bg); }
body {
  font-family: -apple-system, system-ui, sans-serif;
  margin: 0 auto;
  max-width: 1024px;
  font-size: 14px;
  color: var(--fg);
  background: var(--bg);
}
/* 1024'ten genişse (web): ortalı + etrafında kenarlık, dışı farklı zemin */
@media (min-width: 1025px) {
  html { background: var(--surface-2); }
  body { border: 1px solid var(--border); min-height: 100vh; }
}
header {
  padding: 12px 14px 0;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  background: var(--bg);
  z-index: 2;
}
h1 { font-size: 16px; margin: 0 0 8px; }
header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding-bottom: 10px;
}
.page-title {
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
  margin: 0;
}
.header-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; justify-content: flex-end; margin-left: auto; }
.quick-shift {
  display: inline-flex;
  align-items: center;
  gap: 2px;
}
.quick-shift .qs-btn {
  border: none;
  background: transparent;
  color: var(--muted);
  font-size: 15px;
  font-weight: 600;
  line-height: 1;
  width: 20px;
  height: 20px;
  border-radius: 5px;
  cursor: pointer;
}
.quick-shift .qs-btn:hover { background: var(--border); color: var(--fg); }
.quick-shift .qs-mid {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 34px;
}
.quick-shift .qs-mid b { font-size: 11px; font-weight: 600; color: var(--muted); }
.clear-all {
  background: var(--surface-2);
  border: 1px solid var(--input-border);
  color: #cf222e;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  padding: 6px 10px;
  border-radius: 6px;
}
.clear-all:hover { opacity: 0.9; }
.clear-all.hidden { display: none; }

/* Sağ alt köşede dikey istifli yüzen butonlar */
.fab-stack {
  position: fixed;
  /* Kutu 1024'e kapandığında FAB'ı kutunun sağ kenarına hizala */
  right: max(16px, calc((100vw - 1024px) / 2 + 16px));
  bottom: 16px;
  z-index: 9;
  display: flex;
  flex-direction: column;
  gap: 10px;
  align-items: center;
}
.fab-items { display: flex; flex-direction: column; gap: 10px; }
.fab-items.hidden { display: none; }
.fab-toggle svg { transition: transform 0.2s ease; }
.fab-toggle.open svg { transform: rotate(180deg); }
.gear-btn {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 1px solid var(--input-border);
  background: var(--surface);
  color: var(--fg);
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.25);
  display: flex;
  align-items: center;
  justify-content: center;
}
.gear-btn:hover { background: var(--surface-2); }
.gear-btn.active {
  background: var(--accent);
  color: #fff;
  border-color: transparent;
}

/* Sayfa Ayarları: altyazı zamanlama kayması */
.offset-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}
.offset-label { font-size: 12px; color: var(--muted); }
.offset-label small { color: var(--muted); }
.offset-controls { display: flex; align-items: center; gap: 6px; flex-shrink: 0; }
.offset-controls .tool-btn { padding: 6px 12px; font-size: 15px; }
.offset-controls input[type="number"] { width: 70px; margin-top: 0; text-align: center; }
.offset-row.disabled { opacity: 0.45; }
.export-row { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 8px; }

/* Flashcard */
.fc-body { display: flex; flex-direction: column; } /* liste üstte başlar */
/* Çalışma görünümü dikeyde ortalansın (liste üstte kalsın) */
#fcStudy:not(.hidden) {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
}
.fc-progress { color: var(--muted); font-weight: 400; font-size: 13px; }
#gmProgress { margin-right: auto; } /* sayaç başlığın yanında; aksiyonlar sağda kalsın */
.fc-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: center;
  margin-bottom: 14px;
}
.fc-stat {
  font-size: 11px;
  font-weight: 600;
  padding: 3px 9px;
  border-radius: 999px;
  color: #fff;
  white-space: nowrap;
  cursor: pointer;
  user-select: none;
  transition: opacity 0.12s, filter 0.12s;
}
.fc-stat:hover { filter: brightness(1.12); }
.fc-stat.fc-stat-off { opacity: 0.4; filter: grayscale(0.6); }
.fc-stat.grade-bad { background: #cf222e; }
.fc-stat.grade-mid { background: var(--accent); }
.fc-stat.grade-easy { background: #1f883d; }
.fc-stat.fc-stat-new { background: var(--border); color: var(--fg); }
.fc-stat.fc-stat-learned { background: #6e7781; }
/* Kelime flashcard — cümle kartıyla aynı yapı (.sf-card/.sf-reveal/.sf-actions ortak) */
.fc-front-row { display: flex; align-items: center; justify-content: center; gap: 10px; }
.fc-front { font-size: 22px; font-weight: 700; color: var(--fg); }
.fc-show-row { display: grid; grid-template-columns: 1fr; margin-bottom: 18px; }
.fc-show-row .tool-btn[disabled] { opacity: 0.45; }

/* Grade renkleri (buton + rozet) */
.tool-btn.grade-bad { background: #cf222e; color: #fff; border-color: transparent; }
.tool-btn.grade-mid { background: var(--accent); color: #fff; border-color: transparent; }
.tool-btn.grade-easy { background: #1f883d; color: #fff; border-color: transparent; }
.lvl-badge {
  font-size: 10px;
  padding: 1px 7px;
  border-radius: 10px;
  color: #fff;
  vertical-align: middle;
}
.lvl-badge.grade-bad { background: #cf222e; }
.lvl-badge.grade-mid { background: var(--accent); }
.lvl-badge.grade-easy { background: #1f883d; }

/* Grade renkleri (buton + rozet) */
.tool-btn.grade-bad { background: #cf222e; color: #fff; border-color: transparent; }
.tool-btn.grade-mid { background: var(--accent); color: #fff; border-color: transparent; }
.tool-btn.grade-easy { background: #1f883d; color: #fff; border-color: transparent; }
.lvl-badge {
  font-size: 10px;
  padding: 1px 7px;
  border-radius: 10px;
  color: #fff;
  vertical-align: middle;
}
.lvl-badge.grade-bad { background: #cf222e; }
.lvl-badge.grade-mid { background: var(--accent); }
.lvl-badge.grade-easy { background: #1f883d; }

/* Liste / yönetim */
.fc-filters { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 10px; }
.fc-filter {
  background: var(--surface-2);
  border: 1px solid var(--input-border);
  border-radius: 14px;
  padding: 4px 11px;
  font-size: 12px;
  cursor: pointer;
  color: var(--fg);
}
.fc-filter.grade-bad { color: #cf222e; }
.fc-filter.grade-mid { color: var(--accent); }
.fc-filter.grade-easy { color: #1f883d; }
.fc-filter.active { background: var(--accent); color: #fff; border-color: transparent; }
.fc-filter.grade-bad.active { background: #cf222e; color: #fff; }
.fc-filter.grade-mid.active { background: var(--accent); color: #fff; }
.fc-filter.grade-easy.active { background: #1f883d; color: #fff; }
.fc-bulk { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.fc-selall { font-size: 12px; color: var(--muted); display: flex; align-items: center; gap: 5px; }
.fc-selall input { width: auto; margin: 0; }
.fc-row {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 8px;
  border: 1px solid var(--border);
  border-radius: 6px;
  margin-bottom: 6px;
}
.fc-row .fc-check { width: auto; margin: 3px 0 0; flex-shrink: 0; }
.fc-row-main { flex: 1; min-width: 0; }
.fc-row-learn { flex-shrink: 0; }
.fc-studied { font-size: 11px; color: var(--muted); font-weight: 400; }

/* --- Oyunlar --- */
#gamesBody.g-centered { display: flex; flex-direction: column; justify-content: center; }
.g-menu { display: flex; flex-direction: column; gap: 10px; }
.g-card {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 12px;
  text-align: left;
  background: var(--surface-2);
  border: 1px solid var(--input-border);
  border-radius: 8px;
  padding: 14px;
  cursor: pointer;
  color: var(--fg);
}
.g-card:hover { border-color: var(--accent); }
.g-icon {
  flex: 0 0 auto;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  background: var(--surface);
  border: 1px solid var(--input-border);
  color: var(--accent);
}
.g-card:hover .g-icon { border-color: var(--accent); }
.g-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.g-text b { font-size: 14px; color: var(--fg); }
.g-text span { font-size: 12px; color: var(--muted); }
.g-progress { font-size: 12px; color: var(--muted); text-align: center; margin-bottom: 14px; }
.g-question { font-size: 22px; font-weight: 700; text-align: center; margin-bottom: 18px; }
.g-question .row-btn, .g-meaning .row-btn { cursor: pointer; color: var(--accent); display: inline-flex; vertical-align: middle; }
.g-options { display: flex; flex-direction: column; gap: 8px; }
.g-opt { text-align: center; padding: 11px; }
.g-opt.g-correct { background: #1f883d; color: #fff; border-color: transparent; }
.g-opt.g-wrong { background: #cf222e; color: #fff; border-color: transparent; }
.g-match { display: flex; gap: 12px; }
.g-col { flex: 1; display: flex; flex-direction: column; gap: 8px; }
.g-m { padding: 11px 8px; }
.g-m.g-sel { outline: 2px solid var(--accent); }
.g-m.g-correct { background: #1f883d; color: #fff; border-color: transparent; }
.g-m.g-wrong { background: #cf222e; color: #fff; border-color: transparent; }
.g-meaning { font-size: 16px; text-align: center; margin-bottom: 14px; }
.g-sentence { font-size: 15px; line-height: 1.6; margin-bottom: 10px; }
.g-blank { color: var(--accent); font-weight: 700; letter-spacing: 1px; }
.g-typerow { display: flex; gap: 8px; }
.g-typerow input { flex: 1; margin-top: 0; }
.g-feedback { margin-top: 12px; text-align: center; font-weight: 600; min-height: 20px; }
/* --- Cümle Kartı --- */
.sf-wrap { width: 100%; max-width: 600px; margin: 0 auto; container-type: inline-size; }
.sf-source {
  text-align: center;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--muted);
  margin-bottom: 8px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sf-card {
  padding: 14px 4px 18px;
  text-align: center;
  margin-top: 4px;
  border-bottom: 1px solid var(--border);
}
.sf-l1 { display: flex; align-items: center; gap: 8px; font-size: 19px; font-weight: 600; line-height: 1.65; }
.sf-l1-text { flex: 1; min-width: 0; text-align: center; }
.sf-time {
  flex-shrink: 0;
  cursor: pointer;
  background: var(--surface-2);
  color: var(--accent);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 2px 7px;
  font-size: 11px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  transition: border-color 0.12s, background 0.12s;
}
.sf-time:hover { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 16%, transparent); }
.sf-l1 .word { cursor: pointer; border-radius: 4px; padding: 0 2px; transition: background 0.12s; }
.sf-l1 .word:hover { background: color-mix(in srgb, var(--accent) 28%, transparent); }
.sf-l1 .word.vocab-word { background: color-mix(in srgb, var(--accent) 16%, transparent); }
.sf-target {
  text-decoration: underline;
  text-decoration-color: var(--accent);
  text-underline-offset: 4px;
  text-decoration-thickness: 2px;
  font-weight: 700;
}
.sf-speak { flex-shrink: 0; cursor: pointer; color: var(--accent); display: inline-flex; vertical-align: middle; margin-left: 2px; }
.sf-speak:hover { opacity: 0.8; }

.sf-reveal { display: flex; flex-direction: column; gap: 8px; }
.sf-reveal:has(> :not(.hidden)) { margin-top: 16px; padding-top: 16px; border-top: 1px solid var(--border); }
.sf-block {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 9px;
  padding: 9px 12px;
  text-align: left;
}
.sf-block-label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  margin-bottom: 4px;
}
.sf-block-val { display: block; font-size: 14px; line-height: 1.55; color: var(--fg); }
.sf-mean-word { color: var(--accent); font-weight: 700; }
.sf-l2 { font-style: italic; }
.sf-dim { opacity: 0.65; font-style: normal; }
.sf-nudge { display: inline-flex; align-items: center; gap: 2px; margin-left: auto; }
.sf-l1-left { display: flex; flex-direction: column; align-items: center; gap: 5px; flex-shrink: 0; }
.sf-l1 .sf-l1-nudge { margin-left: 0; }
/* Dar kartta (yanlardan sıkışınca) dikey istifle: üstte zaman kayması + aralık, ortada altyazı, altta seslendirme.
   DOM sırası [sf-l1-left, sf-l1-text, sf-speak] zaten bu sırada → column yeter. */
@container (max-width: 440px) {
  .sf-l1 { flex-direction: column; gap: 10px; }
  .sf-l1-left { flex-direction: row; gap: 8px; }
  .sf-l1-text { flex: none; }
}
.sf-nudge-btn {
  border: none;
  background: transparent;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
  line-height: 1;
  width: 18px;
  height: 18px;
  border-radius: 4px;
  cursor: pointer;
}
.sf-nudge-btn:hover { background: var(--border); color: var(--fg); }
.sf-nudge-val { font-size: 10px; color: var(--muted); min-width: 26px; text-align: center; }

.sf-actions { display: flex; flex-direction: column; gap: 8px; margin-top: 18px; }
.sf-show-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-bottom: 18px; }
.sf-show-grid .tool-btn { min-width: 0; font-size: 11.5px; padding: 10px 4px; line-height: 1.25; }
.sf-show-grid .tool-btn[disabled] { opacity: 0.45; }
.sf-grade-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.sf-act-row { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 18px; }
.sf-grade-row .tool-btn, .sf-act-row .tool-btn { min-width: 0; }
.sf-del:hover { border-color: #cf222e; color: #cf222e; }
.g-loading { text-align: center; color: var(--muted); padding: 28px 0; }
.qa-explain-btn { display: block; margin: 12px auto 0; }
.qa-analyze-btn { display: block; margin: 8px auto 0; }
.qa-explain { margin-top: 10px; font-size: 13px; line-height: 1.5; }
.qa-explain:empty { display: none; }
.qa-nav { display: flex; gap: 8px; margin-top: 16px; }
.qa-nav .tool-btn { flex: 1; }

/* Sözcük Türü oyunu (sürükle-bırak rozetler) */
.pos-row { display: flex; flex-wrap: wrap; gap: 12px 14px; justify-content: center; margin: 6px 0 12px; }
.pos-word { display: flex; flex-direction: column; align-items: center; gap: 5px; }
.pos-w { font-size: 15px; font-weight: 600; cursor: pointer; border-radius: 3px; padding: 0 2px; }
.pos-w:hover { background: color-mix(in srgb, var(--accent) 22%, transparent); }
.pos-w.vocab-word { text-decoration: underline; text-decoration-color: var(--accent); text-underline-offset: 3px; }
.pos-slot {
  min-width: 58px;
  min-height: 26px;
  border: 1px dashed var(--input-border);
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2px;
}
.pos-slot.correct { border-color: #1f883d; border-style: solid; background: color-mix(in srgb, #1f883d 14%, transparent); }
.pos-slot.wrong { border-color: #cf222e; border-style: solid; background: color-mix(in srgb, #cf222e 14%, transparent); }
.pos-correct { font-size: 10px; color: #1f883d; font-weight: 600; }
.pos-pool {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
  min-height: 38px;
  padding: 8px;
  border: 1px dashed var(--input-border);
  border-radius: 8px;
  margin-bottom: 12px;
}
.pos-badge {
  background: var(--accent);
  color: #fff;
  border-radius: 14px;
  padding: 4px 12px;
  font-size: 12px;
  font-weight: 600;
  cursor: grab;
  user-select: none;
}
.pos-badge.picked { outline: 2px solid var(--fg); }
.pos-actions { display: flex; gap: 8px; justify-content: center; margin-top: 4px; }
.pos-actions .tool-btn { min-width: 110px; }
.pos-legend {
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 12px;
  background: var(--surface-2);
  border: 1px solid var(--input-border);
  border-radius: 8px;
  padding: 8px 10px;
}
.pos-leg-row { display: flex; align-items: center; gap: 8px; margin: 4px 0; }
.pos-leg-row .pos-badge { cursor: default; }
.pos-legend-btn { display: block; margin: 0 auto 12px; font-size: 12px; padding: 6px 14px; }
.pos-tr {
  font-size: 14px;
  color: var(--fg);
  text-align: center;
  font-style: italic;
  background: var(--surface-2);
  border: 1px solid var(--input-border);
  border-radius: 8px;
  padding: 8px 10px;
  margin: 0 0 12px;
}
.g-source {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 12px;
}
.g-source select { margin-top: 0; }

/* Altyazı Kütüphanesi */
.lib-list { display: flex; flex-direction: column; gap: 8px; }
.lib-row {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--surface-2);
  border: 1px solid var(--input-border);
  border-radius: 8px;
  padding: 10px 12px;
}
.lib-main { flex: 1; min-width: 0; }
.lib-title { font-weight: 600; font-size: 13px; }
.lib-url { font-size: 11px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lib-meta { font-size: 11px; color: var(--muted); margin-top: 2px; }
.lib-actions { display: flex; align-items: center; gap: 6px; flex-shrink: 0; }
.lib-go { padding: 6px 12px; }
.g-correct-text { color: #1f883d; }
.g-wrong-text { color: #cf222e; }
.g-done { text-align: center; padding: 30px 0; display: flex; flex-direction: column; gap: 12px; align-items: center; }
.g-done-score { font-size: 28px; font-weight: 700; color: var(--accent); }
.fc-row-del { color: #cf222e; cursor: pointer; flex-shrink: 0; }
.offset-controls button:disabled,
.offset-controls input:disabled { cursor: default; }

/* Ayarlar modal kutusu */
/* Tam ekran modal kutusu (ayarlar / arama / analiz) */
.modal-box.settings-box,
.modal-box.search-box,
.modal-box.analysis-box {
  width: 100%;
  height: 100%;
  max-width: none;
  max-height: none;
  border-radius: 0;
  box-shadow: none;
  display: flex;
  flex-direction: column;
  padding: 0;
}

/* Modal gövdesi (arama / ayarlar) */
.search-body,
.settings-body {
  padding: 14px;
  overflow-y: auto;
  flex: 1;
  min-height: 0;
}
.loaded-info {
  background: color-mix(in srgb, var(--accent) 14%, var(--surface));
  border: 1px solid color-mix(in srgb, var(--accent) 35%, transparent);
  border-radius: 6px;
  padding: 8px 10px;
  font-size: 12px;
  line-height: 1.4;
  margin-bottom: 8px;
}
.loaded-info.hidden { display: none; }
.loaded-info .li-row { padding: 1px 0; }
.loaded-info .li-cur { font-weight: 600; }
.loaded-info .li-note { margin-top: 4px; opacity: 0.75; font-size: 11px; }
.search-controls { display: flex; gap: 6px; }
.search-controls #searchQuery { flex: 1; margin-top: 0; }
.search-controls #searchLang { width: 104px; margin-top: 0; }
.search-controls #searchGo { margin-top: 0; white-space: nowrap; }
.sub-filter { position: sticky; top: 0; background: var(--surface); padding-bottom: 8px; margin-bottom: 4px; z-index: 1; }
.sub-filter input { width: 100%; margin-top: 0; box-sizing: border-box; }
.sub-server { display: flex; gap: 6px; margin-bottom: 6px; }
.sub-server input { width: 100%; min-width: 0; margin-top: 0; }
.sub-server .tool-btn { margin-top: 0; white-space: nowrap; }
.head-actions { display: flex; align-items: center; gap: 8px; }
.head-actions .tool-btn { white-space: nowrap; }

/* Yakalama tuşu butonu */
.keycap {
  display: inline-block;
  margin-top: 4px;
  min-width: 60px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}
.keycap.recording { background: var(--accent); color: #fff; border-color: transparent; }

/* Panel kısayol satırları */
.sc-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
  font-size: 12px;
  color: var(--muted);
  font-weight: 600;
}
.sc-row .keycap { flex-shrink: 0; margin-top: 0; min-width: 52px; text-align: center; }
.search-hint { font-size: 11px; color: var(--muted); margin: 8px 0 12px; }
.sresult {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px;
  border: 1px solid var(--border);
  border-radius: 6px;
  margin-bottom: 6px;
}
.sr-main { flex: 1; min-width: 0; }
.sr-title { font-weight: 600; font-size: 13px; }
.sr-year { color: var(--muted); font-weight: 400; }
.sr-meta { font-size: 11px; color: var(--muted); margin-top: 2px; }
.sr-import { flex-shrink: 0; }
.pager {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin: 12px 0 4px;
}
.pager-info { font-size: 12px; color: var(--muted); }
main { padding: 12px 14px 76px; }

label { display: block; margin-bottom: 12px; font-size: 12px; color: var(--muted); font-weight: 600; }
input, select, textarea {
  width: 100%;
  margin-top: 4px;
  padding: 8px;
  border: 1px solid var(--input-border);
  border-radius: 6px;
  font-size: 13px;
  font-family: inherit;
  color: var(--fg);
  background: var(--surface);
}
input:disabled, select:disabled, textarea:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  background: var(--surface-2);
}
button.primary {
  background: #1f883d;
  color: #fff;
  border: none;
  padding: 9px 16px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
}
button.secondary {
  background: var(--surface-2);
  color: var(--fg);
  border: 1px solid var(--input-border);
  padding: 8px 14px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
}
button.secondary:disabled { opacity: 0.5; cursor: default; }
#fetchModels { margin-bottom: 12px; }

.group { margin-bottom: 18px; }
.group h2 {
  font-size: 12px;
  text-transform: uppercase;
  color: var(--muted);
  margin: 0 0 6px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.group h2 .del { cursor: pointer; color: #cf222e; font-weight: normal; text-transform: none; }
.entry {
  display: flex;
  gap: 8px;
  padding: 8px;
  border: 1px solid var(--border);
  border-radius: 6px;
  margin-bottom: 6px;
  background: var(--surface);
}
.entry { transition: background-color 0.15s ease, border-color 0.15s ease; }
.entry.active {
  border-color: var(--accent);
  box-shadow: inset 3px 0 0 var(--accent);
  background: color-mix(in srgb, var(--accent) 20%, var(--surface));
}
/* Zaman bu altyazının aralığı DIŞINDAysa (boşluk) sarı göster */
.entry.active.outside {
  border-color: #d4a72c;
  box-shadow: inset 3px 0 0 #d4a72c;
  background: color-mix(in srgb, #d4a72c 14%, var(--surface));
}
.entry .time {
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  color: var(--accent);
  white-space: nowrap;
  cursor: pointer;
}
.entry .time:hover { text-decoration: underline; }
.entry-texts { flex: 1; min-width: 0; align-self: flex-start; }
.entry .text { display: block; white-space: pre-wrap; overflow-wrap: anywhere; }
.entry .text.empty { color: #8c959f; font-style: italic; }
.entry .entry-hr { border: none; border-top: 1px dashed var(--border); margin: 5px 0; }
.entry .text2 { display: block; white-space: pre-wrap; overflow-wrap: anywhere; color: var(--muted); }
.entry .word { cursor: pointer; border-radius: 3px; padding: 0 1px; }
.entry .word:hover { background: color-mix(in srgb, var(--accent) 28%, transparent); }
/* Kelime defterindeki (bakılmış) kelimeler renklenir */
.entry .word.vocab-word {
  background: color-mix(in srgb, var(--accent) 16%, transparent);
  border-bottom: 1.5px solid var(--accent);
}
/* Quiz modu: dili gizle, tıkla-göster */
.entry .text.blur,
.entry .text2.blur {
  filter: blur(5px);
  cursor: pointer;
  user-select: none;
}
/* Satır ikon butonu (seslendir) */
.entry .row-btn {
  cursor: pointer;
  color: var(--muted);
  align-self: flex-start;
  flex-shrink: 0;
  display: inline-flex;
}
.entry .row-btn:hover { color: var(--accent); }

/* Kelime defteri modalı */
.vocab-item {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 8px;
  border: 1px solid var(--border);
  border-radius: 6px;
  margin-bottom: 6px;
}
.vocab-item .row-btn { cursor: pointer; color: var(--accent); flex-shrink: 0; display: inline-flex; }
.vocab-main { flex: 1; min-width: 0; }
.vocab-word { font-weight: 600; }
.vocab-count { color: var(--muted); font-weight: 400; font-size: 11px; }
.vocab-meanings { color: var(--muted); font-size: 12px; margin-top: 2px; }
.vocab-del { color: #cf222e; cursor: pointer; flex-shrink: 0; }

/* Kelime popover başlığı + seslendir + not */
.wp-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.wp-actions { display: flex; align-items: center; gap: 6px; flex-shrink: 0; }
.wp-speak { background: none; border: none; cursor: pointer; color: var(--accent); padding: 0; display: inline-flex; }
.wp-close {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--muted);
  font-size: 18px;
  line-height: 1;
  padding: 0 2px;
}
.wp-close:hover { color: var(--fg); }
.wp-note { margin-top: 6px; font-size: 11px; color: var(--muted); }

/* Kelime çeviri popover'ı */
.word-popover {
  position: fixed;
  z-index: 11;
  max-width: 240px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.3);
  padding: 8px 10px;
  font-size: 13px;
}
.word-popover.hidden { display: none; }
.wp-word { font-weight: 700; color: var(--accent); margin-bottom: 4px; }
.wp-list { margin: 0; padding-left: 18px; }
.wp-list li { margin: 2px 0; }
.wp-loading, .wp-err { color: var(--muted); }
.sec-title {
  display: block;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
  margin-bottom: 2px;
}
.entry .del-entry {
  cursor: pointer;
  color: #fff;
  background: #cf222e;
  border-radius: 4px;
  padding: 3px;
  align-self: flex-start;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.entry .del-entry:hover { opacity: 0.85; }
.entry .analysis-ai {
  cursor: pointer;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #fff;
  background: var(--accent);
  border-radius: 4px;
  padding: 2px 6px;
  align-self: flex-start;
  flex-shrink: 0;
}
.entry .analysis-ai:hover { opacity: 0.85; }
.entry .analysis-ai.pending { background: #cf222e; } /* analiz edilmemiş */
.entry .analysis-ai.loading {
  color: transparent;
  position: relative;
  pointer-events: none;
}
.entry .analysis-ai.loading::after {
  content: "";
  position: absolute;
  inset: 0;
  margin: auto;
  width: 11px;
  height: 11px;
  border: 2px solid rgba(255, 255, 255, 0.45);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.tool-btn {
  background: var(--surface-2);
  color: var(--fg);
  border: 1px solid var(--input-border);
  border-radius: 6px;
  padding: 6px 10px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}
.tool-btn:hover { opacity: 0.9; }
.tool-btn.accent { background: var(--accent); color: #fff; border-color: transparent; }
.tool-btn.stop { background: #cf222e; color: #fff; border-color: transparent; }
.tool-btn.loaded { background: #1f883d; color: #fff; border-color: transparent; } /* dil yüklü */
.tool-btn:disabled { opacity: 0.5; cursor: default; }
.tool-btn.hidden { display: none; }

/* Ayarlar: toggle satırı */
label.toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--fg);
  font-weight: 600;
}
label.toggle input {
  width: auto;
  margin: 0;
  flex-shrink: 0;
}

.status {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px;
  border-radius: 6px;
  margin-bottom: 10px;
  font-size: 12px;
  position: sticky;
  top: calc(var(--header-h, 56px) + 8px);
  margin-top: 4px;
  z-index: 1;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.18);
}
.status .status-msg { flex: 1; min-width: 0; }
.status .status-x {
  flex-shrink: 0;
  border: none;
  background: none;
  color: inherit;
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
  opacity: 0.7;
  padding: 0 2px;
}
.status .status-x:hover { opacity: 1; }
#saveStatus { margin-top: 12px; }
.status.info { background: #ddf4ff; color: #0969da; }
.status.error { background: #ffebe9; color: #cf222e; }
.status.ok { background: #dafbe1; color: #1a7f37; }
.status.hidden { display: none; }
.hidden { display: none; }
.empty-state { color: #8c959f; text-align: center; padding: 30px 0; }
.start-screen {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  min-height: 65vh;
  text-align: center;
}
.start-title { font-size: 15px; font-weight: 600; color: var(--fg); }
.start-btn { padding: 12px 30px; font-size: 16px; }
.start-hint { font-size: 12px; color: var(--muted); max-width: 300px; line-height: 1.5; }

/* Toast bildirimi */
#toast {
  position: fixed;
  left: 50%;
  bottom: 28px;
  transform: translateX(-50%) translateY(12px);
  max-width: 80%;
  padding: 10px 16px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  color: #fff;
  background: #444;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.3);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s, transform 0.2s;
  z-index: 50;
}
#toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
#toast.toast-error { background: #cf222e; }
#toast.toast-ok { background: #1f883d; }

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10;
}
.modal-overlay.hidden { display: none; }
/* Onay penceresi (#modal) her zaman diğer modalların üstünde olsun */
#modal.modal-overlay { z-index: 20; }
/* Analiz modalı oyun/defter modallarının üstünde açılabilsin */
#analysisModal.modal-overlay { z-index: 15; }
.modal-box {
  background: var(--surface);
  border-radius: 8px;
  padding: 18px;
  max-width: 280px;
  width: 85%;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
}
.modal-box p { margin: 0 0 16px; font-size: 14px; }
.modal-actions { display: flex; justify-content: flex-end; align-items: center; gap: 8px; }
.modal-actions button { margin: 0; }
button.danger {
  background: #cf222e;
  color: #fff;
  border: 1px solid transparent;
  padding: 8px 16px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
}

/* Analiz modalı — tüm paneli kaplar */
.analysis-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.analysis-head-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}
.analysis-head strong {
  font-size: 13px;
  line-height: 1.3;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}
.modal-x {
  background: none;
  border: none;
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
  color: var(--muted);
  padding: 0 4px;
  flex-shrink: 0;
}
.analysis-body {
  padding: 12px 14px;
  overflow-y: auto;
  font-size: 13px;
  line-height: 1.5;
  flex: 1;
  min-height: 0;
  word-break: break-word;
}
.analysis-body h1,
.analysis-body h2,
.analysis-body h3,
.analysis-body h4,
.analysis-body h5,
.analysis-body h6 {
  margin: 14px 0 8px;
  font-size: 13px;
  font-weight: 700;
  color: var(--accent);
}
.analysis-body :first-child { margin-top: 0; }
.analysis-body p { margin: 0 0 10px; }
.analysis-body ul { margin: 0 0 10px; padding-left: 18px; }
.analysis-body li { margin: 2px 0; }
.analysis-body hr { border: none; border-top: 1px solid var(--border); margin: 12px 0; }
.analysis-body code {
  background: var(--surface-2);
  padding: 1px 4px;
  border-radius: 4px;
  font-size: 12px;
}
.analysis-body table {
  width: 100%;
  border-collapse: collapse;
  margin: 4px 0 12px;
  font-size: 12px;
}
.analysis-body th,
.analysis-body td {
  border: 1px solid var(--border);
  padding: 5px 7px;
  text-align: left;
  vertical-align: top;
}
.analysis-body th {
  background: var(--surface-2);
  font-weight: 600;
}
