/* ==========================================================================
   YDS365 Kelime Çalışması — turkuaz + Türk motifli tema
   Palet tanıtım sayfasıyla (landing.css) birebir aynıdır; yalnızca kontrast
   için türetilmiş yardımcı değişkenler (--primary-text vb.) eklenmiştir.
   ========================================================================== */

:root {
  --bg: #FBF7EE;
  --surface: #FFFFFF;
  --text: #1B2430;
  --text-muted: #6B7480;
  --primary: #0C8C8C;
  --primary-dark: #0A7373;
  --primary-soft: #E3F4F2;
  --cobalt: #14395B;
  --gold: #C6952E;
  --border: #E4DCC8;
  --success: #16A34A;
  --error: #C1272D;

  /* Türetilmiş (kontrast ≥ 4.5:1 için) */
  --heading: var(--cobalt);
  --text-subtle: #5A636E;        /* krem zeminde küçük yardımcı metin */
  --primary-text: var(--primary-dark);
  --btn-primary-bg: var(--primary-dark);
  --btn-primary-hover: #085E5E;
  --on-primary: #FFFFFF;
  --success-text: #11793A;
  --gold-text: #8A6414;
  --on-error: #FFFFFF;
  --card-shadow: 0 24px 44px -30px rgba(20, 57, 91, 0.35);
  --focus-ring: var(--primary);

  /* Yan menü (kobalt zemin) */
  --side-text: #FBF7EE;
  --side-muted: #C9D3DA;
  --side-accent: #5FE0E0;
  --side-line: rgba(251, 247, 238, 0.28);

  --font-body: "Manrope", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-display: "Fraunces", Georgia, "Times New Roman", serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0F1A24;
    --surface: #16242F;
    --text: #F1EDE3;
    --text-muted: #9AA5AE;
    --primary: #2BB5B5;
    --primary-dark: #22A0A0;
    --primary-soft: #133236;
    --cobalt: #0B2238;
    --gold: #D8A941;
    --border: #2A3A47;
    --success: #4ADE80;
    --error: #F87171;

    --heading: var(--text);
    --text-subtle: var(--text-muted);
    --primary-text: var(--primary);
    --btn-primary-bg: var(--primary);
    --btn-primary-hover: var(--primary-dark);
    --on-primary: #0F1A24;
    --success-text: var(--success);
    --gold-text: var(--gold);
    --on-error: #0F1A24;
    --card-shadow: 0 24px 44px -30px rgba(0, 0, 0, 0.7);
  }
}

* { box-sizing: border-box; }

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

body {
  margin: 0;
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  overflow-x: hidden;
}

/* İznik lale deseni: rengi soldurulmuş, çok düşük opaklıkta bir filigran; içeriğin önüne geçmez. */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background: url("/img/pattern.jpg") center / cover no-repeat;
  filter: grayscale(1) sepia(0.5);
  opacity: var(--pattern-opacity);
}

:root { --pattern-opacity: 0.06; }

@media (prefers-color-scheme: dark) {
  :root { --pattern-opacity: 0.04; }
}

button, input, select { font-family: inherit; }

h1, h2 {
  font-family: var(--font-display);
  font-weight: 600;
  color: var(--heading);
}

:focus-visible {
  outline: 2px solid var(--focus-ring);
  outline-offset: 2px;
}

.hidden { display: none !important; }

/* ---------- Kabuk düzeni (telefon: tek sütun) ---------- */

.app-shell {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* Telefonda yan menü kutusu kaybolur; çocukları kabuğun doğrudan öğesi olur,
   böylece sıra: header → kilim şeridi → içerik → footer. */
.sidebar { display: contents; }
.content { order: 1; flex: 1 0 auto; }
.footer { order: 2; }

.topbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px 12px;
  padding: 14px 16px 0;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  color: var(--heading);
  text-decoration: none;
  border-radius: 10px;
}

.brand-logo { color: var(--primary); flex-shrink: 0; width: 32px; height: 32px; border-radius: 22%; object-fit: cover; }

.brand h1 {
  margin: 0;
  font-size: 1.2rem;
  line-height: 1.2;
  color: inherit;
}

.topbar-right {
  order: 1;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 10px;
  min-width: 0;
}

select {
  min-height: 44px;
  padding: 8px 12px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-size: 0.9rem;
  max-width: 100%;
}

.progress-label { font-size: 0.85rem; color: var(--text-subtle); }

.stats-toggle-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-width: 44px;
  min-height: 44px;
  padding: 0;
  border: 1px solid transparent;
  border-radius: 10px;
  background: transparent;
  color: var(--text-subtle);
  cursor: pointer;
}

.stats-toggle-btn:hover { color: var(--primary-text); border-color: var(--border); }
.stats-toggle-text { display: none; font-size: 0.9rem; font-weight: 600; }

.auth-area { display: flex; align-items: center; min-width: 0; }

.login-btn {
  min-height: 44px;
  padding: 8px 16px;
  border-radius: 10px;
  border: 1px solid var(--primary);
  background: transparent;
  color: var(--primary-text);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
}

.login-btn:hover { background: var(--primary-soft); }

.user-info {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  font-size: 0.8rem;
  color: var(--text-subtle);
}

.user-info #userEmail {
  color: var(--text);
  min-width: 0;
  max-width: 160px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ---------- Sekmeler ---------- */

.tabs {
  order: 2;
  flex: 1 0 100%;
  display: flex;
  gap: 2px;
  overflow-x: auto;
  scrollbar-width: none;
}

.tabs::-webkit-scrollbar { display: none; }

.tab-btn {
  flex: 1 0 auto;
  min-height: 44px;
  padding: 10px 10px;
  border: none;
  border-bottom: 3px solid transparent;
  background: transparent;
  color: var(--text-subtle);
  font-size: 0.92rem;
  font-weight: 500;
  white-space: nowrap;
  cursor: pointer;
}

.tab-btn:hover { color: var(--primary-text); }

.tab-btn.active {
  color: var(--primary-text);
  border-bottom-color: var(--primary);
  font-weight: 700;
}

.tab-ico { width: 20px; height: 20px; flex-shrink: 0; }
.tab-label-short { display: none; }

/* ---------- İlerleme çubuğu (başlıkta / yan menüde, kobalt zemin) ---------- */

.progress-wrap { display: flex; flex-direction: column; gap: 5px; min-width: 0; }

.progress-track {
  height: 6px;
  border-radius: 999px;
  background: rgba(251, 247, 238, 0.16);
  overflow: hidden;
}

.progress-fill {
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--side-accent), var(--gold));
  transition: width 0.4s ease;
}

/* ---------- Kilim şeridi ---------- */

/* Lale + dama bordürü: aynalanmış karo, yatayda kesintisiz tekrar eder. */
.kilim-strip {
  height: 44px;
  background: #1A262E url("/img/lale-border.jpg") repeat-x left center / auto 100%;
}

.kilim-strip--side { display: none; }

/* ---------- İçerik ---------- */

main { max-width: 520px; margin: 0 auto; padding: 24px 16px 48px; }

.view { display: none; }
.view.active { display: block; }

.empty-state {
  text-align: center;
  color: var(--text-subtle);
  padding: 40px 0;
}

.stats-panel {
  max-width: 520px;
  margin: 16px auto 0;
  padding: 16px 20px;
  background: var(--surface);
  border: 1px solid var(--gold);
  border-radius: 20px;
  box-shadow: var(--card-shadow);
}

.content > .stats-panel { width: calc(100% - 32px); }

.stats-chart-wrap svg { width: 100%; height: auto; display: block; }
.stats-chart-wrap .empty-state { padding: 16px 0; margin: 0; }
.stats-chart-label { color: var(--text-muted); font-size: 0.75rem; }

/* ---------- Kelime kartı ---------- */

.flashcard {
  position: relative;
  perspective: 1200px;
  height: 280px;
  cursor: pointer;
  margin-bottom: 12px;
  border-radius: 22px;
}

.flashcard-inner {
  position: relative;
  width: 100%;
  height: 100%;
  transition: transform 0.5s;
  transform-style: preserve-3d;
}

.flashcard.is-flipped .flashcard-inner { transform: rotateY(180deg); }

.flashcard-front, .flashcard-back {
  position: absolute;
  inset: 0;
  -webkit-backface-visibility: hidden;
  backface-visibility: hidden;
  border-radius: 22px;
  background: var(--surface);
  border: 1px solid var(--gold);
  box-shadow: var(--card-shadow);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  justify-content: safe center;
  padding: 48px 22px 22px;
  text-align: center;
  overflow-y: auto;
  overflow-wrap: anywhere;
}

.flashcard-back { transform: rotateY(180deg); }

.fc-word {
  font-family: var(--font-display);
  font-size: 2.2rem;
  font-weight: 600;
  line-height: 1.15;
  color: var(--heading);
}

.fc-pos { color: var(--text-muted); font-style: italic; }
.fc-tr { font-size: 1.5rem; font-weight: 700; color: var(--primary-text); line-height: 1.3; }
.fc-example { color: var(--text-muted); font-size: 0.95rem; }
.fc-example-tr { color: var(--text-muted); font-size: 0.88rem; font-style: italic; }

/* Cümle kartı: kelime yerine cümle gösterildiği için daha küçük, düz yazı. */
.flashcard.is-sentence .fc-word {
  font-family: var(--font-body);
  font-size: 1.2rem;
  font-weight: 600;
  line-height: 1.5;
  color: var(--text);
}
.flashcard.is-sentence .fc-tr { font-size: 1.1rem; line-height: 1.45; }

mark {
  background: color-mix(in srgb, var(--primary) 22%, transparent);
  color: inherit;
  border-radius: 4px;
  padding: 0 2px;
  box-shadow: inset 0 -2px 0 var(--gold);
}

.fc-mode-tag {
  position: absolute;
  top: 14px;
  left: 16px;
  z-index: 2;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--primary-text);
  background: var(--primary-soft);
  border: 1px solid color-mix(in srgb, var(--primary) 35%, transparent);
  border-radius: 999px;
  padding: 2px 10px;
  pointer-events: none;
}

.fc-badges { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; }

.word-badge {
  font-size: 0.72rem;
  font-weight: 600;
  border-radius: 999px;
  padding: 3px 10px;
  border: 1px solid var(--border);
  color: var(--text-muted);
  background: var(--surface);
}

#fcFreqBadge[data-level="4"], #fcFreqBadge[data-level="3"],
#fcYdsBadge[data-level="3"] {
  color: var(--success-text);
  border-color: color-mix(in srgb, var(--success) 45%, var(--border));
  background: color-mix(in srgb, var(--success) 10%, var(--surface));
}

#fcFreqBadge[data-level="2"], #fcYdsBadge[data-level="2"] {
  color: var(--primary-text);
  border-color: color-mix(in srgb, var(--primary) 40%, var(--border));
  background: var(--primary-soft);
}

#fcYdsBadge { cursor: help; }

/* Kaydet (yıldız) butonu */
.save-star {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-width: 44px;
  min-height: 44px;
  background: none;
  border: none;
  padding: 4px 6px;
  border-radius: 10px;
  color: var(--text-muted);
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  vertical-align: middle;
}

.save-star:hover { color: var(--primary-text); }
.save-star.is-saved { color: var(--gold-text); }
.save-star:focus-visible { outline: 2px solid var(--focus-ring); outline-offset: 1px; }
.save-star .star-icon { display: block; flex-shrink: 0; }

.fc-save-star {
  position: absolute;
  top: 6px;
  right: 8px;
  z-index: 2;
}

.fc-save-star .star-icon { width: 22px; height: 22px; }

.quiz-save-btn { font-weight: 500; margin-top: 6px; }

.sentence-rate-row {
  display: flex;
  justify-content: center;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 16px;
  color: var(--text-subtle);
  font-size: 0.85rem;
}

.sentence-rate-row label { display: inline-flex; align-items: center; gap: 8px; }
.quiz-start .sentence-rate-row { margin-top: 0; gap: 8px; }
.sentence-rate-select { min-width: 96px; }

.hint { text-align: center; color: var(--text-subtle); font-size: 0.85rem; margin: 10px 0 18px; }

.fc-actions { display: flex; gap: 12px; justify-content: center; }
.fc-actions .btn { flex: 1 1 0; max-width: 220px; }

/* ---------- Butonlar ---------- */

.btn {
  min-height: 48px;
  padding: 12px 20px;
  border-radius: 12px;
  border: 1px solid transparent;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: background-color 0.15s, border-color 0.15s;
}

.btn-primary { background: var(--btn-primary-bg); color: var(--on-primary); }
.btn-primary:hover { background: var(--btn-primary-hover); }
.btn-primary:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-secondary { background: var(--surface); color: var(--text); border-color: var(--border); }
.btn-secondary:hover { border-color: var(--primary); }

/* ---------- Quiz ---------- */

.quiz-start { display: flex; flex-direction: column; gap: 14px; align-items: center; padding: 30px 0; }
.quiz-start > label { font-weight: 600; }

.quiz-progress {
  text-align: center;
  color: var(--text-subtle);
  font-size: 0.85rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  margin-bottom: 14px;
}

.quiz-rules { margin: 0; color: var(--text-subtle); font-size: 0.85rem; text-align: center; }

.quiz-gate {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 14px 16px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-size: 0.92rem;
  font-weight: 600;
  text-align: center;
}

.quiz-gate.is-cooldown { border-color: var(--gold); color: var(--gold-text); }

.quiz-timer { display: flex; align-items: center; gap: 10px; margin: -4px 0 18px; }

.quiz-timer-track {
  flex: 1;
  height: 8px;
  border-radius: 999px;
  background: var(--border);
  overflow: hidden;
}

.quiz-timer-fill {
  width: 100%;
  height: 100%;
  border-radius: inherit;
  background: var(--primary);
  transition: width 0.2s linear, background-color 0.3s;
}

.quiz-timer-fill.is-low { background: var(--error); }

.quiz-timer-label {
  min-width: 2ch;
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  color: var(--text-subtle);
  text-align: right;
}

.quiz-timer-label.is-low { color: var(--error); }

.quiz-question {
  font-size: 1.15rem;
  text-align: center;
  margin-bottom: 20px;
  padding: 0 8px;
  overflow-wrap: anywhere;
}

.quiz-choices { display: flex; flex-direction: column; gap: 10px; }

.quiz-choice-btn,
.pl-choice-btn {
  min-height: 52px;
  padding: 12px 18px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-size: 1rem;
  cursor: pointer;
  text-align: left;
  white-space: normal;
  overflow-wrap: anywhere;
  line-height: 1.4;
  box-shadow: 0 10px 24px -22px rgba(20, 57, 91, 0.45);
}

.quiz-choice-btn:hover:not(:disabled),
.pl-choice-btn:hover:not(:disabled) { border-color: var(--primary); background: var(--primary-soft); }
.quiz-choice-btn:disabled,
.pl-choice-btn:disabled { cursor: default; }
.quiz-choice-btn.correct,
.pl-choice-btn.correct {
  border-color: var(--success);
  box-shadow: inset 0 0 0 1px var(--success);
  background: color-mix(in srgb, var(--success) 15%, var(--surface));
}
.quiz-choice-btn.incorrect,
.pl-choice-btn.incorrect {
  border-color: var(--error);
  box-shadow: inset 0 0 0 1px var(--error);
  background: color-mix(in srgb, var(--error) 15%, var(--surface));
}

.quiz-type-wrap { display: flex; gap: 10px; }

input[type="text"], input[type="email"] {
  min-height: 48px;
  padding: 12px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-size: 1rem;
}

input::placeholder { color: var(--text-muted); opacity: 1; }

.quiz-type-wrap input { flex: 1; min-width: 0; }

.quiz-feedback { text-align: center; margin-top: 16px; font-weight: 600; min-height: 1.2em; }

.quiz-sentence-prompt { font-size: 0.9rem; color: var(--text-subtle); margin-bottom: 8px; }
.quiz-sentence { font-size: 1.15rem; line-height: 1.5; }
.quiz-cloze-tr { margin-top: 10px; color: var(--text-muted); font-size: 0.95rem; font-style: italic; }

.quiz-cloze-hint {
  display: inline-block;
  margin-top: 12px;
  padding: 4px 12px;
  border-radius: 999px;
  background: var(--primary-soft);
  color: var(--primary-text);
  font-size: 0.85rem;
  font-weight: 600;
}
.feedback-correct { color: var(--success-text); }
.feedback-incorrect { color: var(--error); }

.quiz-result { text-align: center; padding: 40px 0; }
.quiz-result h2 { font-size: 1.6rem; margin: 0 0 8px; }

/* ---------- Footer / yedekleme ---------- */

/* Footer sadece masaüstü yan menüsünün altındaki kilim şeridini taşır. */
.footer { display: none; }

.backup-link {
  min-height: 44px;
  background: none;
  border: none;
  padding: 0 6px;
  border-radius: 8px;
  color: var(--text-subtle);
  font-size: 0.8rem;
  font-weight: 500;
  cursor: pointer;
  text-decoration: none;
}

.backup-link:hover { color: var(--primary-text); text-decoration: underline; }

.kbd-hint {
  text-align: center;
  color: var(--text-subtle);
  font-size: 0.75rem;
  margin-top: 10px;
}

@media (max-width: 600px) {
  .kbd-hint { display: none; }
}

/* ==========================================================================
   Telefon / tablet (< 900px): uygulama tipi kobalt üst çubuk + sabit alt sekme çubuğu
   ========================================================================== */

@media (max-width: 899px) {
  .topbar {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto auto;
    grid-template-areas:
      "brand brand stats auth"
      "level progress progress progress";
    align-items: center;
    gap: 10px 6px;
    padding: calc(10px + env(safe-area-inset-top)) 14px 14px 16px;
    background: var(--cobalt);
    color: var(--side-text);
    --focus-ring: var(--side-accent);
  }

  .topbar-right { display: contents; }

  .brand { grid-area: brand; min-width: 0; color: var(--side-text); }
  .brand-logo { box-shadow: 0 0 0 1px rgba(216, 169, 65, 0.5); }
  .brand h1 { font-size: 1rem; line-height: 1.15; color: var(--side-text); }

  .stats-toggle-btn { grid-area: stats; color: var(--side-text); }
  .stats-toggle-btn:hover { color: var(--side-accent); border-color: var(--side-line); }

  .auth-area { grid-area: auth; }

  .login-btn {
    min-height: 40px;
    padding: 6px 14px;
    background: var(--side-text);
    border-color: var(--side-text);
    color: var(--cobalt);
    font-size: 0.85rem;
  }
  .login-btn:hover { background: #FFFFFF; }

  /* Telefonda başlıkta sadece avatar; çıkış profil sayfasında. */
  .topbar .profile-btn-text,
  .topbar #btnLogout { display: none; }

  #levelFilter {
    grid-area: level;
    min-height: 40px;
    padding: 6px 32px 6px 12px;
    -webkit-appearance: none;
    appearance: none;
    background: rgba(251, 247, 238, 0.1) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath d='M2.5 4.5 6 8l3.5-3.5' fill='none' stroke='%23FBF7EE' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") no-repeat right 12px center;
    border-color: var(--side-line);
    border-radius: 999px;
    color: var(--side-text);
    font-size: 0.85rem;
    font-weight: 600;
  }
  #levelFilter option { background: var(--cobalt); color: var(--side-text); }

  .progress-wrap { grid-area: progress; padding-left: 6px; }
  .progress-label { color: var(--side-muted); font-size: 0.78rem; line-height: 1.2; }

  .kilim-strip--top { height: 28px; }

  /* Alt sekme çubuğu */
  .tabs {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 50;
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 0;
    overflow: visible;
    padding: 6px 4px calc(6px + env(safe-area-inset-bottom));
    background: var(--surface);
    border-top: 1px solid var(--border);
    box-shadow: 0 -14px 30px -24px rgba(20, 57, 91, 0.5);
    --focus-ring: var(--primary);
  }

  .tab-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    min-width: 0;
    min-height: 56px;
    padding: 2px;
    border-bottom: none;
    border-radius: 12px;
    color: var(--text-subtle);
    font-size: 0.7rem;
    font-weight: 600;
    -webkit-tap-highlight-color: transparent;
  }

  .tab-btn .tab-ico {
    width: 52px;
    height: 30px;
    padding: 4px 14px;
    border-radius: 999px;
    transition: background-color 0.2s;
  }

  .tab-btn.active { color: var(--primary-text); border-bottom-color: transparent; }
  .tab-btn.active .tab-ico { background: var(--primary-soft); }

  .tab-label-long { display: none; }
  .tab-label-short { display: inline; }

  main { padding-bottom: calc(96px + env(safe-area-inset-bottom)); }

  .flashcard { height: clamp(270px, 46vh, 400px); }
  .fc-word { font-size: 2.5rem; }
  .fc-actions .btn { min-height: 54px; font-size: 1rem; }
}

@media (max-width: 359px) {
  .brand h1 { font-size: 0.92rem; }
  .tab-btn { font-size: 0.64rem; }
}

/* ---------- Tekrar listesi ---------- */

.review-list {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.review-item {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--gold);
  border-radius: 20px;
  box-shadow: var(--card-shadow);
  padding: 18px 20px 10px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  overflow-wrap: anywhere;
}

.review-item-word {
  font-family: var(--font-display);
  font-size: 1.35rem;
  font-weight: 600;
  color: var(--heading);
  padding-right: 48px;
}

.review-item-word .fc-pos { font-family: var(--font-body); font-size: 0.85rem; font-weight: 400; margin-left: 2px; }
.review-item-tr { color: var(--primary-text); font-weight: 600; }
.review-item-example { color: var(--text-muted); font-size: 0.9rem; }
.review-item-example-tr { color: var(--text-muted); font-size: 0.85rem; font-style: italic; }

.review-item-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 4px 14px; margin-top: 2px; }
.review-item-actions .review-item-clear { margin-top: 0; }
.review-save-btn { padding: 0 6px; font-size: 0.8rem; font-weight: 500; }

.review-badge {
  position: absolute;
  top: 16px;
  right: 18px;
  background: var(--error);
  color: var(--on-error);
  font-size: 0.75rem;
  font-weight: 700;
  border-radius: 999px;
  padding: 2px 9px;
  min-width: 1.6em;
  text-align: center;
}

.review-item-clear {
  align-self: flex-start;
  min-height: 44px;
  background: none;
  border: none;
  padding: 0 6px;
  margin-top: 4px;
  border-radius: 8px;
  color: var(--text-muted);
  font-size: 0.8rem;
  cursor: pointer;
  text-decoration: none;
}

.review-item-clear:hover { color: var(--primary-text); text-decoration: underline; }

/* ---------- Lider tablosu ---------- */

.leaderboard-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.leaderboard-row {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 56px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 12px 18px;
  box-shadow: 0 10px 24px -22px rgba(20, 57, 91, 0.45);
}

.leaderboard-row:first-child { border-color: var(--gold); }

.leaderboard-row-self {
  border-color: var(--primary);
  box-shadow: inset 3px 0 0 var(--primary);
  background: var(--primary-soft);
}

.leaderboard-rank {
  font-family: var(--font-display);
  font-weight: 600;
  color: var(--gold-text);
  min-width: 2.2em;
}

.leaderboard-nickname {
  flex: 1;
  min-width: 0;
  font-weight: 600;
  overflow-wrap: anywhere;
}

.leaderboard-points {
  color: var(--primary-text);
  font-weight: 700;
  font-size: 0.9rem;
  white-space: nowrap;
}

.leaderboard-nickname-form {
  display: flex;
  gap: 10px;
  margin-bottom: 18px;
}

.leaderboard-nickname-form input { flex: 1; min-width: 0; }

/* ---------- Seviye testi ---------- */

.pl-card {
  background: var(--surface);
  border: 1px solid var(--gold);
  border-radius: 22px;
  box-shadow: var(--card-shadow);
  padding: 26px 22px;
  text-align: center;
  overflow-wrap: anywhere;
}

.pl-start { display: flex; flex-direction: column; align-items: center; gap: 14px; }
.pl-start h2 { margin: 0; font-size: 1.45rem; }
.pl-desc { margin: 0; color: var(--text); }
.pl-last {
  margin: 0;
  padding: 6px 14px;
  border-radius: 999px;
  background: var(--primary-soft);
  color: var(--primary-text);
  font-size: 0.88rem;
  font-weight: 600;
}
.pl-start .btn { min-width: 200px; }
.pl-start .empty-state { padding: 8px 0 0; }
.pl-start .kbd-hint { margin: 0; }

.pl-link-btn {
  min-height: 44px;
  padding: 0 8px;
  border: none;
  border-radius: 8px;
  background: none;
  color: var(--primary-text);
  font-size: 0.88rem;
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
}
.pl-link-btn:hover { color: var(--text); }

.pl-progress {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 16px;
  text-align: center;
  color: var(--text-subtle);
  font-size: 0.85rem;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.pl-bar {
  height: 6px;
  border-radius: 999px;
  background: var(--border);
  overflow: hidden;
}

.pl-bar-fill {
  height: 100%;
  width: 0;
  border-radius: inherit;
  background: var(--primary);
  transition: width 0.3s ease;
}

.pl-word {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.35rem;
  color: var(--heading);
}

.pl-dontknow-btn {
  display: block;
  width: 100%;
  min-height: 48px;
  margin-top: 12px;
  padding: 10px 18px;
  border: 1px dashed var(--text-subtle);
  border-radius: 14px;
  background: transparent;
  color: var(--text-subtle);
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
}
.pl-dontknow-btn:hover:not(:disabled) { color: var(--primary-text); border-color: var(--primary); }
.pl-dontknow-btn:disabled { cursor: default; }
.pl-dontknow-btn.is-chosen {
  border-style: solid;
  border-color: var(--error);
  color: var(--text);
  background: color-mix(in srgb, var(--error) 12%, transparent);
}

.pl-kicker {
  margin: 0;
  color: var(--text-subtle);
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.pl-level-big {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 4rem;
  line-height: 1.05;
  margin: 6px 0 4px;
  color: var(--primary-text);
}

.pl-level-sub { margin: 0 0 18px; color: var(--text); font-weight: 600; }

.pl-breakdown {
  list-style: none;
  margin: 0 auto;
  padding: 0;
  max-width: 300px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.pl-row {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 6px 12px;
  border-radius: 12px;
  border: 1px solid transparent;
}
.pl-row.is-next { border-color: var(--primary); background: var(--primary-soft); }

.pl-row-level { width: 2.2em; text-align: left; font-weight: 700; color: var(--heading); }
.pl-row.is-passed .pl-row-level { color: var(--success-text); }

.pl-dots { display: inline-flex; gap: 6px; flex: 1; }
.pl-dot {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 2px solid var(--text-subtle);
  background: transparent;
}
.pl-dot.is-on { border-color: var(--primary); background: var(--primary); }

.pl-row-score { font-weight: 700; color: var(--text); font-variant-numeric: tabular-nums; }

.pl-note { margin: 18px 0; color: var(--text-subtle); font-size: 0.85rem; }

.pl-actions { display: flex; flex-direction: column; gap: 10px; }

/* ---------- Profil butonu (başlık / yan menü) ---------- */

.profile-btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  min-height: 44px;
  padding: 0;
  border: none;
  border-radius: 999px;
  background: none;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.profile-btn-avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: var(--gold);
  color: #1B2430;
  font-family: var(--font-display);
  font-size: 1.1rem;
  font-weight: 600;
  box-shadow: 0 0 0 2px rgba(251, 247, 238, 0.35);
}

.profile-btn:hover .profile-btn-avatar { box-shadow: 0 0 0 2px var(--side-accent); }

.profile-btn-text { display: flex; flex-direction: column; min-width: 0; line-height: 1.25; }
.profile-btn-label { font-size: 0.9rem; font-weight: 700; }

/* ---------- Profilim ---------- */

.profile-wrap { display: flex; flex-direction: column; gap: 16px; }

.profile-card {
  padding: 18px;
  border: 1px solid var(--border);
  border-radius: 20px;
  background: var(--surface);
  box-shadow: var(--card-shadow);
}

.profile-card > .stats-badges { padding-top: 0; border-top: 0; }

.profile-head {
  display: flex;
  align-items: center;
  gap: 14px;
  border-color: var(--gold);
  background: linear-gradient(135deg, var(--cobalt), #0F4C5C);
  color: var(--side-text);
  --focus-ring: var(--side-accent);
}

.profile-avatar {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: var(--gold);
  color: #1B2430;
  font-family: var(--font-display);
  font-size: 1.7rem;
  font-weight: 600;
  box-shadow: 0 0 0 3px rgba(251, 247, 238, 0.25);
}

.profile-who { flex: 1; min-width: 0; }
.profile-name { margin: 0; font-size: 1.3rem; line-height: 1.2; color: inherit; overflow-wrap: break-word; }
.profile-email { margin: 2px 0 0; font-size: 0.82rem; color: var(--side-muted); overflow-wrap: anywhere; }

.profile-inline-link { min-height: 32px; padding: 0; font-size: 0.82rem; }
.profile-head .profile-inline-link { color: var(--side-accent); }

.profile-points {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 8px 12px;
  border-radius: 14px;
  background: rgba(251, 247, 238, 0.1);
}

.profile-points-value {
  font-family: var(--font-display);
  font-size: 1.6rem;
  font-weight: 600;
  line-height: 1.1;
  color: var(--gold);
}

.profile-points-caption { font-size: 0.7rem; color: var(--side-muted); white-space: nowrap; }

.profile-guest { display: flex; flex-direction: column; align-items: center; gap: 12px; text-align: center; }
.profile-guest .profile-name { color: var(--heading); }
.profile-guest .profile-email { color: var(--text-subtle); }

.profile-level-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }

.profile-level-box {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  padding: 12px 14px;
  border-radius: 14px;
  background: var(--primary-soft);
}

.profile-level-caption { font-size: 0.75rem; font-weight: 600; color: var(--text-subtle); }

.profile-level-big {
  font-family: var(--font-display);
  font-size: 2rem;
  font-weight: 600;
  line-height: 1.1;
  color: var(--primary-text);
}

.profile-level-big.is-empty { color: var(--text-subtle); }
.profile-level-sub { font-size: 0.72rem; color: var(--text-subtle); }

.profile-bars { display: flex; flex-direction: column; gap: 10px; margin: 16px 0 0; padding: 0; list-style: none; }

.profile-bar-row {
  display: grid;
  grid-template-columns: 2.4em minmax(0, 1fr) 5.5em;
  align-items: center;
  gap: 10px;
  font-size: 0.85rem;
}

.profile-bar-level { font-weight: 700; color: var(--heading); }
.profile-bar-track { height: 8px; border-radius: 999px; background: var(--border); overflow: hidden; }
.profile-bar-fill { display: block; height: 100%; border-radius: inherit; background: var(--primary); transition: width 0.4s ease; }
.profile-bar-row.is-cleared .profile-bar-fill { background: var(--gold); }
.profile-bar-count { text-align: right; font-size: 0.8rem; color: var(--text-subtle); font-variant-numeric: tabular-nums; }

.profile-logout { align-self: center; min-width: 180px; }

@media (max-width: 420px) {
  .profile-head { flex-wrap: wrap; }
  .profile-points { flex: 1 0 100%; flex-direction: row; justify-content: center; gap: 8px; align-items: baseline; }
}

/* ---------- Giriş modalı ---------- */

.login-modal {
  position: fixed;
  inset: 0;
  background: rgba(11, 34, 56, 0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 20px;
}

.login-modal-card {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--gold);
  border-radius: 22px;
  box-shadow: 0 30px 60px -30px rgba(11, 34, 56, 0.6);
  padding: 30px 24px 26px;
  max-width: 360px;
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.login-modal-card h2 { margin: 0; font-size: 1.35rem; padding-right: 36px; }

.login-modal-desc { margin: 0; color: var(--text-muted); font-size: 0.88rem; }

.google-login-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 48px;
  padding: 10px 16px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-size: 0.95rem;
  font-weight: 600;
  text-decoration: none;
}

.google-login-btn:hover { border-color: var(--primary); background: var(--primary-soft); }

.login-modal input[type="email"] { background: var(--bg); }

.login-modal-close {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 44px;
  height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: none;
  border-radius: 10px;
  font-size: 1.5rem;
  line-height: 1;
  color: var(--text-muted);
  cursor: pointer;
  padding: 0;
}

.login-modal-close:hover { color: var(--primary-text); }

.login-modal-msg {
  margin: 0;
  min-height: 1.2em;
  font-size: 0.8rem;
  color: var(--text-muted);
  text-align: center;
}

/* ==========================================================================
   Masaüstü (≥ 900px): solda sabit kobalt yan menü, sağda krem içerik
   ========================================================================== */

@media (min-width: 900px) {
  .app-shell {
    display: grid;
    grid-template-columns: 280px minmax(0, 1fr);
    align-items: start;
  }

  .sidebar {
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 22px;
    padding: 28px 20px 20px;
    background: var(--cobalt);
    color: var(--side-text);
    border-right: 1px solid var(--border);
    --focus-ring: var(--side-accent);
  }

  .content { order: 0; padding: 48px 40px 64px; }

  .content > .stats-panel { width: 100%; max-width: 480px; margin: 0 auto 28px; }
  main { max-width: 480px; padding: 0; }

  .flashcard { height: 300px; }

  /* Header yan menüde dikey akar: logo → ayraç → sekmeler → kontroller */
  .topbar {
    flex-direction: column;
    flex-wrap: nowrap;
    align-items: stretch;
    gap: 22px;
    padding: 0;
  }

  .brand {
    color: var(--side-text);
    padding-bottom: 20px;
    border-bottom: 1px solid var(--gold);
    border-radius: 0;
    align-items: center;
  }

  .brand-logo { color: var(--side-accent); width: 40px; height: 40px; box-shadow: 0 0 0 1px rgba(216, 169, 65, 0.5); }
  .brand h1 { font-size: 1.3rem; color: var(--side-text); }

  .tabs {
    order: 0;
    flex: none;
    flex-direction: column;
    gap: 4px;
    overflow: visible;
  }

  .tab-btn {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: none;
    width: 100%;
    text-align: left;
    padding: 11px 14px;
    border-bottom: none;
    border-left: 3px solid transparent;
    border-radius: 0 10px 10px 0;
    color: var(--side-muted);
    font-size: 0.98rem;
  }

  .tab-btn:hover { color: var(--side-text); background: rgba(251, 247, 238, 0.06); }

  .tab-btn.active {
    color: var(--side-accent);
    background: rgba(12, 140, 140, 0.18);
    border-left-color: var(--side-accent);
  }

  .topbar-right {
    order: 1;
    flex-direction: column;
    flex-wrap: nowrap;
    align-items: stretch;
    gap: 12px;
    padding-top: 18px;
    border-top: 1px solid var(--side-line);
  }

  .sidebar select {
    width: 100%;
    background: rgba(251, 247, 238, 0.06);
    border-color: var(--side-line);
    color: var(--side-text);
  }

  .sidebar select option { background: var(--cobalt); color: var(--side-text); }

  .sidebar .progress-label { color: var(--side-muted); padding: 0 2px; }

  .stats-toggle-btn {
    justify-content: flex-start;
    width: 100%;
    padding: 0 12px;
    color: var(--side-text);
    border-color: var(--side-line);
  }

  .stats-toggle-btn:hover { color: var(--side-accent); border-color: var(--side-accent); }
  .stats-toggle-text { display: inline; }

  .auth-area { display: block; }

  .login-btn {
    width: 100%;
    background: var(--side-text);
    border-color: var(--side-text);
    color: var(--cobalt);
  }

  .login-btn:hover { background: #FFFFFF; border-color: var(--side-accent); }

  .user-info {
    flex-direction: column;
    align-items: flex-start;
    gap: 2px;
    color: var(--side-muted);
  }

  .user-info #userEmail { color: var(--side-muted); max-width: 100%; font-size: 0.8rem; }

  .profile-btn {
    width: 100%;
    padding: 8px 10px;
    border: 1px solid var(--side-line);
    border-radius: 12px;
    color: var(--side-text);
  }

  .profile-btn:hover { border-color: var(--side-accent); }

  .sidebar .backup-link { color: var(--side-muted); }
  .sidebar .backup-link:hover { color: var(--side-accent); }

  .kilim-strip--top { display: none; }

  .footer {
    display: block;
    order: 0;
    margin-top: auto;
    padding: 0;
    border-top: none;
    text-align: left;
  }

  .kilim-strip--side {
    display: block;
    height: 40px;
    margin: 0 -20px -20px;
  }
}
