/* ui.md: canlı renkler, açık arka plan, yuvarlak kartlar, yumuşak gölge, mor yok */

:root {
  --color-bg: #f0f9ff;
  --color-bg-warm: #fffbeb;
  --color-surface: #ffffff;
  --color-primary: #1E90FF;
  --color-primary-hover: #1a7ae6;
  --color-turquoise: #0d9488;
  --color-turquoise-soft: rgba(13, 148, 136, 0.15);
  --color-green: #059669;
  --color-yellow: #eab308;
  --color-yellow-soft: rgba(234, 179, 8, 0.12);
  --color-support: #20b2aa;
  --color-correct: #22c55e;
  --color-correct-hover: #16a34a;
  --color-wrong: #ef4444;
  --color-wrong-hover: #dc2626;
  --color-text: #1e293b;
  --color-text-muted: #64748b;
  --shadow-soft: 0 4px 14px rgba(30, 144, 255, 0.15);
  --shadow-card: 0 10px 30px rgba(30, 144, 255, 0.12);
  --shadow-card-hover: 0 14px 40px rgba(30, 144, 255, 0.18);
  --radius-card: 20px;
  --radius-btn: 12px;
  --transition-flip: 380ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-smooth: 0.3s ease;
  /* Kart renkleri (arka plan): der=mavi, die=pembe, das=yeşil */
  --article-der: #1E90FF;
  --article-der-bg: #e0f0ff;
  --article-der-soft: rgba(30, 144, 255, 0.2);
  --article-die: #db2777;
  --article-die-bg: #fce7f3;
  --article-die-soft: rgba(219, 39, 119, 0.2);
  --article-das: #059669;
  --article-das-bg: #d1fae5;
  --article-das-soft: rgba(5, 150, 105, 0.2);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: system-ui, -apple-system, sans-serif;
  background: var(--color-bg);
  color: var(--color-text);
}

/* --- Login ekranı (şık, animasyonlu) --- */
.login-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  background: linear-gradient(165deg, #e0f2fe 0%, #f0f9ff 25%, #fffbeb 60%, #fef3c7 100%);
  background-size: 200% 200%;
  animation: loginBgShift 12s ease-in-out infinite;
}

@keyframes loginBgShift {
  0%, 100% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
}

.login-screen.hidden {
  display: none;
}

.login-inner {
  width: 100%;
  max-width: 420px;
  text-align: center;
  animation: loginInnerIn 0.6s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

@keyframes loginInnerIn {
  from { opacity: 0; transform: translateY(20px) scale(0.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.login-title {
  margin: 0 0 0.25rem 0;
  font-size: 1.9rem;
  font-weight: 800;
  background: linear-gradient(135deg, var(--color-primary), var(--color-turquoise));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  letter-spacing: -0.02em;
  animation: loginTitleFloat 4s ease-in-out infinite;
}

@keyframes loginTitleFloat {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-3px); }
}

.login-subtitle {
  margin: 0 0 2rem 0;
  font-size: 0.95rem;
  color: var(--color-text-muted);
}

.login-form {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}
.login-label {
  font-size: 0.9rem;
  font-weight: 500;
  margin: 0;
}
.login-select {
  width: 100%;
  padding: 0.85rem 1rem;
  font-size: 1rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--bg-card);
}
.login-submit {
  margin-top: 0.5rem;
  padding: 0.85rem 1.5rem;
}

.login-cards {
  display: flex;
  gap: 1.25rem;
  justify-content: center;
  flex-wrap: wrap;
}

.login-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
  width: 150px;
  padding: 1.75rem 1.25rem;
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(12px);
  border: 2px solid rgba(30, 144, 255, 0.15);
  border-radius: 24px;
  box-shadow: 0 8px 32px rgba(30, 144, 255, 0.12), 0 2px 8px rgba(0, 0, 0, 0.04);
  cursor: pointer;
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.3s, border-color 0.3s;
  animation: loginCardIn 0.5s cubic-bezier(0.34, 1.56, 0.64, 1) backwards;
}

.login-card:nth-child(1) { animation-delay: 0.1s; }
.login-card:nth-child(2) { animation-delay: 0.2s; }

@keyframes loginCardIn {
  from { opacity: 0; transform: translateY(24px) scale(0.9); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.login-card:hover {
  transform: translateY(-6px) scale(1.02);
  box-shadow: 0 16px 48px rgba(30, 144, 255, 0.2), 0 4px 12px rgba(0, 0, 0, 0.06);
  border-color: var(--color-primary);
}

.login-card:active {
  transform: translateY(-2px) scale(0.99);
}

.login-card-avatar {
  width: 64px;
  height: 64px;
  line-height: 64px;
  font-size: 1.75rem;
  font-weight: 700;
  color: #fff;
  background: linear-gradient(135deg, var(--color-primary), var(--color-turquoise));
  border-radius: 50%;
  box-shadow: 0 4px 14px rgba(30, 144, 255, 0.4);
  transition: transform 0.25s, box-shadow 0.25s;
}

.login-card:hover .login-card-avatar {
  transform: scale(1.08);
  box-shadow: 0 6px 20px rgba(30, 144, 255, 0.5);
}

.login-card-name {
  font-weight: 600;
  font-size: 1.15rem;
  color: var(--color-text);
}

.login-password-wrap {
  margin-top: 1.5rem;
  padding: 1.75rem;
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(12px);
  border-radius: 24px;
  box-shadow: 0 12px 40px rgba(30, 144, 255, 0.15), 0 2px 8px rgba(0, 0, 0, 0.04);
  text-align: left;
  border: 1px solid rgba(30, 144, 255, 0.1);
  animation: loginPasswordIn 0.4s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

@keyframes loginPasswordIn {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}

.login-password-label {
  margin: 0 0 0.75rem 0;
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--color-text);
}

.login-password-input {
  width: 100%;
  padding: 0.85rem 1rem;
  margin-bottom: 1rem;
  border: 2px solid #e2e8f0;
  border-radius: 14px;
  font-size: 1rem;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.login-password-input:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 4px rgba(30, 144, 255, 0.15);
}

.login-password-actions {
  display: flex;
  gap: 0.75rem;
}

.login-error {
  margin: 0.75rem 0 0 0;
  font-size: 0.9rem;
  color: var(--color-wrong);
  animation: loginErrorShake 0.4s ease;
}

@keyframes loginErrorShake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-4px); }
  75% { transform: translateX(4px); }
}

@media (max-width: 380px) {
  .login-screen { padding: 1rem; }
  .login-card { width: 100%; max-width: 220px; }
}

.app-shell {
  animation: appShellIn 0.5s ease-out;
}

.app-shell.hidden {
  display: none;
}

@keyframes appShellIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* --- Header (şık, cam efekt) --- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid rgba(30, 144, 255, 0.08);
  box-shadow: 0 2px 20px rgba(30, 144, 255, 0.06);
  animation: topbarIn 0.4s ease-out;
}

@keyframes topbarIn {
  from { opacity: 0; transform: translateY(-8px); }
  to { opacity: 1; transform: translateY(0); }
}

.topbar-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0.85rem 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.logo {
  font-weight: 800;
  font-size: 1.2rem;
  letter-spacing: -0.02em;
  background: linear-gradient(135deg, var(--color-primary), var(--color-turquoise));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  text-decoration: none;
  transition: transform 0.2s, filter 0.2s;
}

.logo:hover {
  transform: scale(1.03);
  filter: brightness(1.1);
}

.mode-nav {
  display: flex;
  gap: 0.35rem;
}

.mode-link {
  padding: 0.5rem 0.9rem;
  border-radius: 14px;
  color: var(--color-text-muted);
  text-decoration: none;
  font-weight: 500;
  font-size: 0.9rem;
  transition: color 0.2s, background 0.2s, transform 0.2s;
}

.mode-link:hover {
  color: var(--color-primary);
  background: rgba(30, 144, 255, 0.08);
  transform: translateY(-1px);
}

.mode-link.active {
  color: #fff;
  background: linear-gradient(135deg, var(--color-primary), var(--color-turquoise));
  box-shadow: 0 2px 8px rgba(30, 144, 255, 0.3);
}

.user-area {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.user-name {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--color-text);
  padding: 0.35rem 0.75rem;
  background: rgba(30, 144, 255, 0.08);
  border-radius: 12px;
  border: 1px solid rgba(30, 144, 255, 0.12);
}

.btn-logout {
  padding: 0.4rem 0.8rem;
  border: 1px solid rgba(100, 116, 139, 0.3);
  border-radius: 12px;
  background: transparent;
  color: var(--color-text-muted);
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  transition: border-color 0.2s, color 0.2s, background 0.2s;
}

.btn-logout:hover {
  border-color: var(--color-primary);
  color: var(--color-primary);
  background: rgba(30, 144, 255, 0.06);
}

/* --- Main content --- */
.main {
  max-width: 700px;
  margin: 0 auto;
  padding: 2rem 1.25rem 3rem;
}

.view {
  display: none;
}

.view.view-active {
  display: block;
  animation: viewFadeIn 0.4s ease-out;
}

@keyframes viewFadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* --- Flashcard ekranı: canlı, enerjik (ui.md) --- */
#view-flashcards {
  /* view geçişi .view.view-active ile uygulanıyor */
}

.flashcard-container {
  display: flex;
  justify-content: center;
  align-items: flex-start;
  min-height: 320px;
  margin-bottom: 2rem;
  padding: 1.5rem;
  background: linear-gradient(145deg, rgba(30, 144, 255, 0.06) 0%, rgba(13, 148, 136, 0.06) 50%, var(--color-yellow-soft) 100%);
  border-radius: 24px;
  position: relative;
  transition: min-height 0.35s ease;
}

.flashcard-container::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 24px;
  padding: 2px;
  background: linear-gradient(135deg, rgba(30, 144, 255, 0.25), rgba(13, 148, 136, 0.2), rgba(234, 179, 8, 0.15));
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  pointer-events: none;
}

.flashcard {
  width: 100%;
  max-width: 420px;
  aspect-ratio: 4/3;
  cursor: pointer;
  perspective: 1000px;
  outline: none;
  transition: transform var(--transition-smooth), aspect-ratio 0.35s ease, min-height 0.35s ease;
}

.flashcard.is-flipped {
  aspect-ratio: auto;
  height: auto;
  min-height: 320px;
}

.flashcard:hover:not(.is-flipped) {
  transform: scale(1.02);
}

.flashcard:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: 4px;
}

.flashcard-inner {
  position: relative;
  width: 100%;
  height: 100%;
  transition: transform var(--transition-flip);
  transform-style: preserve-3d;
}

.flashcard.is-flipped .flashcard-inner {
  transform: rotateY(180deg);
  height: auto;
  min-height: 320px;
}

.flashcard-face {
  position: absolute;
  inset: 0;
  backface-visibility: hidden;
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-card);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  background: var(--color-surface);
  border: 2px solid rgba(30, 144, 255, 0.15);
  transition: box-shadow var(--transition-smooth), border-color var(--transition-smooth), background var(--transition-smooth);
}

.flashcard:hover .flashcard-face {
  box-shadow: var(--shadow-card-hover);
}

/* Artikel renkleri: der=mavi, die=pembe, das=yeşil */
/* Kart arka planı artikel rengi – der=mavi, die=pembe, das=yeşil */
.flashcard.article-der .flashcard-face {
  background: var(--article-der-bg);
  border-color: var(--article-der-soft);
  box-shadow: 0 10px 30px rgba(30, 144, 255, 0.2);
}
.flashcard.article-der:hover .flashcard-face {
  border-color: rgba(30, 144, 255, 0.45);
  box-shadow: 0 14px 40px rgba(30, 144, 255, 0.25);
}

.flashcard.article-die .flashcard-face {
  background: var(--article-die-bg);
  border-color: var(--article-die-soft);
  box-shadow: 0 10px 30px rgba(219, 39, 119, 0.18);
}
.flashcard.article-die:hover .flashcard-face {
  border-color: rgba(219, 39, 119, 0.45);
  box-shadow: 0 14px 40px rgba(219, 39, 119, 0.22);
}

.flashcard.article-das .flashcard-face {
  background: var(--article-das-bg);
  border-color: var(--article-das-soft);
  box-shadow: 0 10px 30px rgba(5, 150, 105, 0.2);
}
.flashcard.article-das:hover .flashcard-face {
  border-color: rgba(5, 150, 105, 0.45);
  box-shadow: 0 14px 40px rgba(5, 150, 105, 0.25);
}

.flashcard-back {
  transform: rotateY(180deg);
  align-items: stretch;
  justify-content: flex-start;
  text-align: left;
  border-color: rgba(13, 148, 136, 0.2);
  height: auto;
  min-height: 100%;
  overflow: visible;
}

.card-word {
  font-size: 2.25rem;
  font-weight: 700;
  margin: 0 0 0.5rem 0;
  animation: wordPop 0.5s ease;
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: center;
  gap: 0.25em;
  color: var(--color-text);
}

.card-article {
  font-size: 0.65em;
  font-weight: 600;
  opacity: 0.85;
}

.flashcard.article-der .card-article { color: var(--article-der); }
.flashcard.article-die .card-article { color: var(--article-die); }
.flashcard.article-das .card-article { color: var(--article-das); }

.card-word-only {
  color: var(--color-text);
}

/* Kelime türü badge: ikon + isim/fiil/sıfat, hover’da tooltip (title) */
.card-word-type-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  margin-top: 0.4rem;
  margin-bottom: 0.5rem;
  padding: 0.4rem 0.75rem;
  font-size: 0.85rem;
  font-weight: 700;
  border-radius: 10px;
  cursor: default;
  border: 1px solid transparent;
}

.card-word-type-badge.type-noun { color: #1e3a8a; background: rgba(30, 64, 175, 0.22); border-color: rgba(30, 64, 175, 0.35); }
.card-word-type-badge.type-verb { color: #92400e; background: rgba(180, 83, 9, 0.22); border-color: rgba(180, 83, 9, 0.35); }
.card-word-type-badge.type-adjective { color: #065f46; background: rgba(4, 120, 87, 0.22); border-color: rgba(4, 120, 87, 0.35); }
.card-word-type-badge.type-adverb { color: #6b21a8; background: rgba(107, 33, 168, 0.18); border-color: rgba(107, 33, 168, 0.35); }

@keyframes wordPop {
  0% { opacity: 0; transform: scale(0.95); }
  100% { opacity: 1; transform: scale(1); }
}

.btn-tts {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 52px;
  height: 52px;
  border: none;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.08);
  color: var(--color-text-muted);
  cursor: pointer;
  transition: background 0.25s, transform 0.2s, box-shadow 0.2s, color 0.2s;
}

.flashcard.article-der .btn-tts { background: var(--article-der-soft); color: var(--article-der); }
.flashcard.article-die .btn-tts { background: var(--article-die-soft); color: var(--article-die); }
.flashcard.article-das .btn-tts { background: var(--article-das-soft); color: var(--article-das); }

.btn-tts:hover {
  transform: scale(1.08);
}

.flashcard.article-der .btn-tts:hover { background: rgba(30, 144, 255, 0.3); box-shadow: 0 4px 12px rgba(30, 144, 255, 0.25); }
.flashcard.article-die .btn-tts:hover { background: rgba(219, 39, 119, 0.25); box-shadow: 0 4px 12px rgba(219, 39, 119, 0.25); }
.flashcard.article-das .btn-tts:hover { background: rgba(5, 150, 105, 0.25); box-shadow: 0 4px 12px rgba(5, 150, 105, 0.25); }

.btn-tts.is-playing {
  animation: pulse-tts 0.6s ease;
}

@keyframes pulse-tts {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.15); }
}

.card-meaning {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--color-text);
  margin: 0 0 0.25rem 0;
}

.card-desc {
  font-size: 0.95rem;
  color: var(--color-turquoise);
  margin: 0 0 0.75rem 0;
}

.card-desc:empty {
  display: none;
}

/* Çoğul (sadece isimlerde), kart arkasında – görünürlük JS ile */
.card-plural {
  font-size: 0.95rem;
  color: var(--color-text-muted);
  margin: 0 0 0.75rem 0;
}

.example-area {
  margin-bottom: 1rem;
  padding: 1rem;
  background: linear-gradient(135deg, var(--color-turquoise-soft), rgba(30, 144, 255, 0.08));
  border-radius: var(--radius-btn);
  border-left: 4px solid var(--color-turquoise);
}

/* Örnek kutusu kart rengine uyumlu, hafif ton */
.flashcard.article-der .example-area { border-left-color: var(--article-der); background: rgba(255,255,255,0.6); }
.flashcard.article-die .example-area { border-left-color: var(--article-die); background: rgba(255,255,255,0.6); }
.flashcard.article-das .example-area { border-left-color: var(--article-das); background: rgba(255,255,255,0.6); }

.example-label {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--color-text-muted);
  font-weight: 600;
  margin: 0 0 0.5rem 0;
}

.example-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.example-item {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  padding: 0.6rem 0.75rem;
  background: rgba(255, 255, 255, 0.85);
  border-radius: 12px;
  border-left: 3px solid var(--article-der);
  animation: exampleSlideIn 0.4s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

.flashcard.article-die .example-item { border-left-color: var(--article-die); }
.flashcard.article-das .example-item { border-left-color: var(--article-das); }

.example-item:nth-child(1) { animation-delay: 0.02s; }
.example-item:nth-child(2) { animation-delay: 0.06s; }
.example-item:nth-child(3) { animation-delay: 0.1s; }
.example-item:nth-child(4) { animation-delay: 0.14s; }
.example-item:nth-child(5) { animation-delay: 0.18s; }
.example-item:nth-child(n+6) { animation-delay: 0.22s; }

@keyframes exampleSlideIn {
  from {
    opacity: 0;
    transform: translateY(-12px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.example-item-content {
  flex: 1;
  min-width: 0;
}

.example-item .ex-de {
  font-size: 0.95rem;
  margin: 0;
  color: var(--color-text);
}

.example-item .ex-tr {
  font-size: 0.85rem;
  color: var(--color-text-muted);
  margin: 0.2rem 0 0 0;
}

/* Örnek cümle TTS – ufak hoparlör ikonu */
.btn-tts-example {
  flex-shrink: 0;
  width: 32px;
  height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: none;
  border-radius: 50%;
  background: rgba(30, 144, 255, 0.12);
  color: var(--color-primary);
  cursor: pointer;
  transition: background 0.2s, transform 0.2s;
}

.btn-tts-example:hover {
  background: rgba(30, 144, 255, 0.22);
  transform: scale(1.1);
}

.btn-tts-example.is-playing {
  animation: pulse-tts 0.5s ease;
}

.btn-tts-example svg {
  width: 16px;
  height: 16px;
}

.card-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.btn-link {
  background: none;
  border: none;
  padding: 0.35rem 0;
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--color-primary);
  cursor: pointer;
  text-decoration: none;
  border-radius: var(--radius-btn);
  transition: color 0.2s, background 0.2s;
}

.btn-link:hover {
  color: var(--color-primary-hover);
  background: rgba(30, 144, 255, 0.1);
}

.btn-more-examples:hover {
  color: var(--color-turquoise);
}

.btn-add-sentence:hover {
  color: var(--color-green);
}

/* --- Cümle ekle modal --- */
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  animation: modalFadeIn 0.25s ease;
}

.modal-overlay[hidden] {
  display: none;
}

@keyframes modalFadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.4);
  backdrop-filter: blur(4px);
}

.modal-box {
  position: relative;
  width: 100%;
  max-width: 400px;
  padding: 1.5rem;
  background: var(--color-surface);
  border-radius: var(--radius-card);
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.15), 0 0 0 1px rgba(30, 144, 255, 0.1);
  border: 2px solid rgba(234, 179, 8, 0.25);
  animation: modalSlideIn 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes modalSlideIn {
  from {
    opacity: 0;
    transform: scale(0.95) translateY(-10px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

.modal-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.modal-icon {
  width: 36px;
  height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--color-primary), var(--color-turquoise));
  color: #fff;
  border-radius: 10px;
  font-size: 1rem;
}

.modal-title {
  margin: 0;
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--color-text);
}

.modal-box .input-inline {
  margin-bottom: 0.75rem;
}

.modal-actions {
  display: flex;
  gap: 0.5rem;
  margin-top: 1rem;
}

.input-inline {
  width: 100%;
  padding: 0.65rem 0.85rem;
  border: 2px solid #e2e8f0;
  border-radius: var(--radius-btn);
  font-size: 0.95rem;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.input-inline:focus {
  outline: none;
  border-color: var(--color-turquoise);
  box-shadow: 0 0 0 3px var(--color-turquoise-soft);
}

.btn-primary {
  padding: 0.5rem 1rem;
  border: none;
  border-radius: var(--radius-btn);
  background: var(--color-primary);
  color: #fff;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.2s, transform 0.2s;
}

.btn-primary:hover {
  background: var(--color-primary-hover);
  transform: translateY(-1px);
}

.btn-primary:active {
  transform: translateY(0) scale(0.98);
}

.btn-secondary {
  padding: 0.5rem 1rem;
  border: 1px solid var(--color-text-muted);
  border-radius: var(--radius-btn);
  background: transparent;
  color: var(--color-text-muted);
  cursor: pointer;
  transition: border-color 0.2s, color 0.2s, transform 0.2s;
}

.btn-secondary:hover {
  border-color: var(--color-primary);
  color: var(--color-primary);
  transform: translateY(-1px);
}

.btn-secondary:active {
  transform: translateY(0) scale(0.98);
}

/* --- Kart altı kontroller ui.md §3.4 --- */
.flashcard-progress {
  text-align: center;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--color-text-muted);
  margin: 0 0 0.5rem 0;
}

.bitti-screen {
  text-align: center;
  padding: 2.5rem 1rem;
  animation: bittiIn 0.5s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

@keyframes bittiIn {
  from { opacity: 0; transform: scale(0.92); }
  to { opacity: 1; transform: scale(1); }
}

.bitti-title {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--color-text);
  margin: 0 0 1.25rem 0;
}

.btn-restart {
  padding: 0.75rem 1.5rem;
  font-size: 1rem;
  background: var(--color-primary);
  color: #fff;
  border: none;
  border-radius: var(--radius-btn);
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s, transform 0.2s;
}

.btn-restart:hover {
  background: var(--color-primary-hover);
  transform: translateY(-2px);
}

.flashcard-controls {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.75rem;
  animation: controlsFadeIn 0.4s ease 0.1s both;
}

@keyframes controlsFadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

.btn-control {
  padding: 0.75rem 1.5rem;
  border: none;
  border-radius: var(--radius-btn);
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.25s, transform 0.2s, box-shadow 0.25s;
}

.btn-control:hover {
  transform: translateY(-2px);
}

.btn-control:active {
  transform: translateY(0) scale(0.98);
}

.btn-control.control-pulse {
  animation: controlPulse 0.4s ease;
}

@keyframes controlPulse {
  0%, 100% { transform: translateY(-2px) scale(1); }
  50% { transform: translateY(-2px) scale(1.05); }
}

.btn-correct {
  background: var(--color-correct);
  color: #fff;
}

.btn-correct:hover {
  background: var(--color-correct-hover);
}

.btn-wrong {
  background: var(--color-wrong);
  color: #fff;
}

.btn-wrong:hover {
  background: var(--color-wrong-hover);
}

.btn-next {
  background: var(--color-primary);
  color: #fff;
}

.btn-next:hover {
  background: var(--color-primary-hover);
  box-shadow: 0 4px 14px rgba(30, 144, 255, 0.35);
}

.btn-correct:hover {
  box-shadow: 0 4px 14px rgba(34, 197, 94, 0.35);
}

.btn-wrong:hover {
  box-shadow: 0 4px 14px rgba(239, 68, 68, 0.3);
}

/* --- Eşleştirme oyunu (glassmorphic) --- */
.view-match { padding: 0 1rem 2rem; position: relative; min-height: 60vh; }
.view-match .main { max-width: none; }

.match-bg {
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(224, 240, 255, 0.95) 0%, rgba(240, 253, 244, 0.9) 40%, rgba(254, 249, 195, 0.85) 100%);
  pointer-events: none;
  z-index: 0;
}

.match-board {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.25rem 1.5rem;
  max-width: 920px;
  margin: 0 auto 1.5rem;
  align-items: stretch;
}

.match-col {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  padding: 1.25rem;
  min-height: 0;
  background: rgba(255, 255, 255, 0.5);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-radius: 20px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.06), inset 0 1px 0 rgba(255, 255, 255, 0.8);
  border: 1px solid rgba(255, 255, 255, 0.6);
}

.match-col-title {
  margin: 0 0 0.75rem 0;
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--color-text);
  letter-spacing: 0.02em;
}

.match-col-inner { display: flex; flex-direction: column; gap: 0.6rem; flex: 1; min-height: 0; }
.match-col-inner .match-card { flex: 1; min-height: 48px; }

.match-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  min-height: 52px;
  padding: 0 1rem;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.9) 0%, rgba(255, 255, 255, 0.7) 100%);
  border: 2px solid rgba(255, 255, 255, 0.9);
  border-radius: 14px;
  font-size: 1rem;
  font-weight: 500;
  cursor: pointer;
  user-select: none;
  transition: transform 0.25s ease, box-shadow 0.25s ease, border-color 0.2s, background 0.2s;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

.match-col-tr .match-card:not(.correct) {
  border-style: dashed;
  border-color: rgba(0, 0, 0, 0.12);
  background: rgba(255, 255, 255, 0.85);
}

/* Sadece Almanca (DE) kartları artikel rengi alır */
.match-col-de .match-card.article-der { background: linear-gradient(180deg, rgba(255,255,255,0.95) 0%, var(--article-der-bg) 100%); border-color: var(--article-der-soft); }
.match-col-de .match-card.article-die { background: linear-gradient(180deg, rgba(255,255,255,0.95) 0%, var(--article-die-bg) 100%); border-color: var(--article-die-soft); }
.match-col-de .match-card.article-das { background: linear-gradient(180deg, rgba(255,255,255,0.95) 0%, var(--article-das-bg) 100%); border-color: var(--article-das-soft); }

.match-card:hover { transform: translateY(-2px); box-shadow: 0 6px 20px rgba(30, 144, 255, 0.15); border-color: rgba(30, 144, 255, 0.4); }
.match-card.selected { border-style: solid; border-color: var(--color-primary); background: rgba(30, 144, 255, 0.12); box-shadow: 0 0 0 3px rgba(30, 144, 255, 0.25); transform: translateY(-2px); }
.match-card.correct { border-style: solid; border-color: var(--color-correct); background: rgba(34, 197, 94, 0.18); cursor: default; pointer-events: none; animation: matchCorrect 0.5s ease; box-shadow: 0 4px 16px rgba(34, 197, 94, 0.25); }
.match-card.wrong,
.match-col-de .match-card.wrong,
.match-col-tr .match-card.wrong { border-style: solid !important; border-color: var(--color-wrong) !important; background: rgba(239, 68, 68, 0.28) !important; box-shadow: 0 4px 16px rgba(239, 68, 68, 0.3); animation: matchWrong 0.55s ease; }
.match-card.drag-over { border-style: solid; border-color: var(--color-primary); background: rgba(30, 144, 255, 0.15); animation: matchDragOver 0.3s ease; box-shadow: 0 0 0 3px rgba(30, 144, 255, 0.3); }
.match-card.dragging { opacity: 0.85; transform: scale(1.02) translateY(-4px); box-shadow: 0 12px 28px rgba(0, 0, 0, 0.15); }

@keyframes matchCorrect {
  0% { transform: scale(1); }
  40% { transform: scale(1.06); }
  100% { transform: scale(1); }
}
@keyframes matchWrong {
  0%, 100% { transform: translateX(0); }
  15% { transform: translateX(-8px); }
  35% { transform: translateX(8px); }
  55% { transform: translateX(-6px); }
  75% { transform: translateX(6px); }
}
@keyframes matchDragOver {
  0% { transform: scale(1); }
  50% { transform: scale(1.02); }
  100% { transform: scale(1); }
}

.match-card-text { flex: 1; min-width: 0; }
.match-card-tts {
  flex-shrink: 0;
  width: 38px;
  height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: none;
  border-radius: 50%;
  background: rgba(30, 144, 255, 0.15);
  color: var(--color-primary);
  cursor: pointer;
  font-size: 0.9rem;
  transition: transform 0.2s, background 0.2s;
}
.match-card-tts:hover { background: rgba(30, 144, 255, 0.28); transform: scale(1.08); }
.match-card.correct .match-card-tts { pointer-events: auto; cursor: pointer; }
.match-col-tr .match-card-tts { display: none; }

/* Mobilde en üstte: doğru/yanlış + tekrar */
.match-toolbar-top {
  display: none;
  position: relative;
  z-index: 2;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  padding: 0.75rem 0.5rem 1rem;
  margin-bottom: 0.5rem;
  background: rgba(255, 255, 255, 0.7);
  backdrop-filter: blur(8px);
  border-radius: 16px;
  border: 1px solid rgba(30, 144, 255, 0.1);
  box-shadow: 0 2px 12px rgba(30, 144, 255, 0.08);
  animation: matchToolbarIn 0.35s ease-out;
}

@keyframes matchToolbarIn {
  from { opacity: 0; transform: translateY(-6px); }
  to { opacity: 1; transform: translateY(0); }
}

.match-footer {
  position: relative;
  z-index: 1;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  padding: 1rem 0.5rem 0.5rem;
}

.match-stats { display: flex; gap: 1.5rem; }
.match-stat { font-weight: 700; font-size: 1.05rem; }
.match-correct { color: var(--color-correct); }
.match-wrong { color: var(--color-wrong); }

@media (max-width: 640px) {
  .view-match { padding: 0 0.75rem 1.5rem; }
  .match-toolbar-top {
    display: flex;
  }
  .match-footer {
    display: none;
  }
  .match-board { grid-template-columns: 1fr; gap: 1rem; padding: 0; align-items: stretch; }
  .match-col { padding: 1rem; min-height: 0; }
  .match-col-de { order: 2; }
  .match-col-tr { order: 3; }
  .match-col-title { font-size: 0.85rem; margin-bottom: 0.5rem; }
  .match-col-inner { display: grid; grid-auto-rows: 1fr; gap: 0.5rem; }
  .match-card { min-height: 50px; padding: 0 1rem; font-size: 0.95rem; }
}

@media (min-width: 641px) and (max-width: 900px) {
  .match-board { gap: 1rem 1.25rem; }
  .match-col { padding: 1rem; }
  .match-card { min-height: 50px; padding: 0 1rem; font-size: 0.95rem; }
}

/* --- CSV yükleme ekranı --- */
.view-csv {
  max-width: 720px;
  margin: 0 auto;
  padding: 1.5rem 1rem 2rem;
}

.csv-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.csv-title {
  margin: 0;
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--color-text);
}

.csv-upload-box {
  padding: 1.25rem;
  background: var(--color-surface);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-soft);
  margin-bottom: 1.5rem;
}

.csv-label {
  display: block;
  font-weight: 600;
  color: var(--color-text);
  margin-bottom: 0.25rem;
}

.csv-hint {
  font-size: 0.85rem;
  color: var(--color-text-muted);
  margin: 0 0 0.75rem 0;
}

.csv-file-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.csv-file-input {
  flex: 1;
  min-width: 180px;
  padding: 0.5rem;
  border: 2px solid #e2e8f0;
  border-radius: var(--radius-btn);
  font-size: 0.9rem;
}

.csv-preview-box {
  padding: 1.25rem;
  background: var(--color-surface);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-soft);
}

.csv-preview-title {
  margin: 0 0 0.75rem 0;
  font-size: 1rem;
  font-weight: 600;
  color: var(--color-text);
}

.csv-preview-table-wrap {
  overflow-x: auto;
  margin-bottom: 1rem;
}

.csv-preview-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

.csv-preview-table th,
.csv-preview-table td {
  padding: 0.5rem 0.75rem;
  text-align: left;
  border-bottom: 1px solid #e2e8f0;
}

.csv-preview-table th {
  font-weight: 600;
  color: var(--color-text-muted);
  background: #f8fafc;
}

.csv-preview-table tr.error-row td {
  background: rgba(239, 68, 68, 0.08);
  color: var(--color-wrong);
}

.csv-validation {
  font-size: 0.9rem;
  color: var(--color-text-muted);
  margin-bottom: 1rem;
  padding: 0.75rem;
  background: #f8fafc;
  border-radius: var(--radius-btn);
}

.csv-validation .warn {
  color: var(--color-yellow);
}

.csv-validation .err {
  color: var(--color-wrong);
}

.csv-actions {
  display: flex;
  gap: 0.75rem;
}

/* Tek kelime modal – form satırları */
.form-row {
  margin-bottom: 0.85rem;
}

.form-row-optional {
  margin-bottom: 0.5rem;
}

.form-label {
  display: block;
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--color-text);
  margin-bottom: 0.35rem;
}

.modal-box-word {
  max-width: 420px;
}

.modal-box-word .input-inline {
  margin-bottom: 0;
}

.btn-add-single {
  white-space: nowrap;
}

.csv-live-msg {
  min-height: 0;
  padding: 0;
  margin-top: 0.5rem;
  font-weight: 500;
  color: var(--color-green);
  opacity: 0;
  transition: opacity 0.25s;
}

.csv-live-msg-visible {
  opacity: 1;
}

/* --- Analiz sayfası --- */
.view-analiz {
  max-width: 1100px;
  margin: 0 auto;
  padding: 1.5rem 1rem 2rem;
}

.analiz-header {
  margin-bottom: 1.5rem;
}

.analiz-title {
  margin: 0;
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--color-text);
}

.analiz-kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 1rem;
  margin-bottom: 2rem;
}

.analiz-kpi-card {
  padding: 1rem 1.25rem;
  background: var(--color-surface);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-soft);
  text-align: center;
  border: 1px solid rgba(30, 144, 255, 0.12);
  animation: analizKpiIn 0.4s ease-out backwards;
}

.analiz-kpi-card:nth-child(1) { animation-delay: 0.05s; }
.analiz-kpi-card:nth-child(2) { animation-delay: 0.1s; }
.analiz-kpi-card:nth-child(3) { animation-delay: 0.15s; }
.analiz-kpi-card:nth-child(4) { animation-delay: 0.2s; }
.analiz-kpi-card:nth-child(5) { animation-delay: 0.25s; }
.analiz-kpi-grid-alltime .analiz-kpi-card:nth-child(1) { animation-delay: 0.3s; }
.analiz-kpi-grid-alltime .analiz-kpi-card:nth-child(2) { animation-delay: 0.35s; }
.analiz-kpi-grid-alltime .analiz-kpi-card:nth-child(3) { animation-delay: 0.4s; }
.analiz-kpi-grid-alltime .analiz-kpi-card:nth-child(4) { animation-delay: 0.45s; }
.analiz-kpi-grid-alltime .analiz-kpi-card:nth-child(5) { animation-delay: 0.5s; }

@keyframes analizKpiIn {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}

.analiz-kpi-value {
  display: block;
  font-size: 1.75rem;
  font-weight: 800;
  color: var(--color-primary);
  line-height: 1.2;
}

.analiz-kpi-card:nth-child(2) .analiz-kpi-value { color: var(--color-correct); }
.analiz-kpi-card:nth-child(3) .analiz-kpi-value { color: var(--color-wrong); }
.analiz-kpi-card:nth-child(4) .analiz-kpi-value { color: var(--color-turquoise); }

.analiz-kpi-label {
  font-size: 0.8rem;
  color: var(--color-text-muted);
  margin-top: 0.35rem;
  display: block;
}

.analiz-section-label {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--color-text-muted);
  margin: 0 0 0.5rem 0;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.analiz-kpi-grid-alltime .analiz-kpi-value { font-size: 1.5rem; }

.analiz-charts {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1.25rem;
  margin-bottom: 2rem;
  min-width: 0;
}

.analiz-chart-card {
  padding: 1.25rem;
  background: var(--color-surface);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-soft);
  border: 1px solid rgba(30, 144, 255, 0.08);
  min-width: 0;
  overflow: hidden;
}

.analiz-chart-card-wide {
  grid-column: 1 / -1;
}

.analiz-chart-title {
  margin: 0 0 1rem 0;
  font-size: 1rem;
  font-weight: 600;
  color: var(--color-text);
}

.analiz-chart-wrap {
  position: relative;
  width: 100%;
  max-width: 100%;
  height: 220px;
  min-height: 180px;
  overflow: hidden;
}

.analiz-chart-card-wide .analiz-chart-wrap {
  height: 260px;
  min-height: 220px;
}

.analiz-table-section {
  padding: 1.25rem;
  background: var(--color-surface);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-soft);
}

.analiz-table-section .analiz-chart-title {
  margin-bottom: 0.75rem;
}

.analiz-table-wrap {
  overflow-x: auto;
}

.analiz-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

.analiz-table th,
.analiz-table td {
  padding: 0.6rem 0.75rem;
  text-align: left;
  border-bottom: 1px solid #e2e8f0;
}

.analiz-table th {
  font-weight: 600;
  color: var(--color-text-muted);
  background: #f8fafc;
}

.analiz-table tbody tr:hover {
  background: #f8fafc;
}

.analiz-history-wrap { max-height: 280px; overflow-y: auto; -webkit-overflow-scrolling: touch; }

@media (max-width: 640px) {
  .view-analiz {
    padding: 1rem 0.75rem 1.5rem;
    overflow-x: hidden;
    max-width: 100vw;
    box-sizing: border-box;
  }
  .analiz-header { margin-bottom: 1rem; }
  .analiz-title { font-size: 1.25rem; }
  .analiz-kpi-grid,
  .analiz-kpi-grid-alltime {
    grid-template-columns: repeat(2, 1fr);
    gap: 0.75rem;
    margin-bottom: 1.25rem;
  }
  .analiz-kpi-card {
    padding: 0.85rem 0.75rem;
  }
  .analiz-kpi-value { font-size: 1.4rem; }
  .analiz-kpi-grid-alltime .analiz-kpi-value { font-size: 1.25rem; }
  .analiz-kpi-label { font-size: 0.7rem; }
  /* Grafik kartları mobil: tek sütun, tam genişlik, taşma yok */
  .analiz-charts {
    grid-template-columns: 1fr;
    gap: 1rem;
    margin-bottom: 1.5rem;
    width: 100%;
    max-width: 100%;
  }
  .analiz-chart-card {
    padding: 1rem;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
  }
  .analiz-chart-title { font-size: 0.9rem; margin-bottom: 0.75rem; }
  .analiz-chart-wrap {
    width: 100%;
    max-width: 100%;
    height: 200px;
    min-height: 180px;
    box-sizing: border-box;
  }
  .analiz-chart-card-wide .analiz-chart-wrap {
    height: 220px;
    min-height: 200px;
  }
  .analiz-table-section { padding: 1rem; }
  .analiz-table { font-size: 0.8rem; }
  .analiz-table th,
  .analiz-table td { padding: 0.5rem 0.6rem; }
  .analiz-history-wrap { max-height: 220px; }
}

@media (max-width: 380px) {
  .analiz-kpi-grid,
  .analiz-kpi-grid-alltime { grid-template-columns: 1fr; }
  .view-analiz { padding: 0.75rem 0.5rem 1rem; }
  .analiz-chart-card { padding: 0.75rem; }
  .analiz-chart-wrap { height: 180px; min-height: 160px; }
  .analiz-chart-card-wide .analiz-chart-wrap { height: 200px; min-height: 180px; }
}

.placeholder-msg {
  text-align: center;
  color: var(--color-text-muted);
  padding: 3rem 1rem;
}

@media (max-width: 640px) {
  .topbar-inner {
    flex-wrap: wrap;
  }
  .mode-nav {
    order: 3;
    width: 100%;
    justify-content: center;
  }
  .card-word {
    font-size: 1.75rem;
  }
  .flashcard-controls {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    flex-wrap: nowrap;
    justify-content: flex-start;
    gap: 0.5rem;
    padding-bottom: 0.25rem;
  }
  .flashcard-controls .btn-control {
    flex-shrink: 0;
    padding: 0.6rem 1rem;
    font-size: 0.9rem;
  }
}
