:root {
  --bg: #f0f4ff;
  --bg-accent: #e8eeff;
  --card: #ffffff;
  --text: #1a1f36;
  --text-muted: #5c6378;
  --primary: #4f46e5;
  --primary-light: #eef2ff;
  --primary-dark: #3730a3;
  --accent: #ef4444;
  --accent-soft: #fef2f2;
  --success: #10b981;
  --border: #e2e8f0;
  --shadow: 0 4px 24px rgba(79, 70, 229, 0.08);
  --shadow-lg: 0 12px 40px rgba(79, 70, 229, 0.12);
  --radius: 16px;
  --radius-sm: 10px;
  --font: 'DM Sans', system-ui, -apple-system, sans-serif;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

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

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  font-family: var(--font);
  background: var(--bg);
  background-image:
    radial-gradient(ellipse 80% 50% at 50% -20%, rgba(79, 70, 229, 0.15), transparent),
    radial-gradient(ellipse 60% 40% at 100% 100%, rgba(239, 68, 68, 0.06), transparent);
  color: var(--text);
  line-height: 1.6;
  min-height: 100dvh;
  padding-bottom: var(--safe-bottom);
}

a {
  color: var(--primary);
  text-decoration: none;
}

img {
  max-width: 100%;
  height: auto;
  display: block;
}

/* Layout */
.container {
  width: 100%;
  max-width: 480px;
  margin: 0 auto;
  padding: 1rem 1rem 2rem;
}

.site-header {
  text-align: center;
  padding: 1.5rem 0 1rem;
}

.site-header h1 {
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text);
}

.site-header p {
  font-size: 0.9rem;
  color: var(--text-muted);
  margin-top: 0.25rem;
}

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--primary);
  margin-bottom: 0.75rem;
  padding: 0.35rem 0;
  transition: opacity 0.2s;
}

.back-link:hover {
  opacity: 0.8;
}

.back-link svg {
  width: 18px;
  height: 18px;
}

/* Home – word list */
.word-grid {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.word-card-link {
  display: flex;
  align-items: center;
  gap: 1rem;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.875rem 1rem;
  box-shadow: var(--shadow);
  transition: transform 0.2s, box-shadow 0.2s, border-color 0.2s;
  color: inherit;
}

.word-card-link:active {
  transform: scale(0.98);
}

.word-card-link:hover {
  border-color: var(--primary);
  box-shadow: var(--shadow-lg);
}

.word-thumb {
  width: 56px;
  height: 56px;
  border-radius: var(--radius-sm);
  object-fit: cover;
  flex-shrink: 0;
  background: var(--bg-accent);
}

.word-info {
  flex: 1;
  min-width: 0;
}

.word-info .en {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text);
  text-transform: capitalize;
}

.word-info .tr {
  font-size: 0.85rem;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.word-arrow {
  color: var(--primary);
  opacity: 0.6;
  flex-shrink: 0;
}

.word-count {
  text-align: center;
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 1.25rem;
}

/* Vocabulary card */
.vocab-card {
  background: var(--card);
  border-radius: calc(var(--radius) + 4px);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  border: 1px solid var(--border);
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  padding: 1.25rem 1rem 0.75rem;
  position: relative;
}

.card-word {
  font-size: clamp(1.75rem, 6vw, 2.25rem);
  font-weight: 800;
  letter-spacing: -0.03em;
  text-transform: uppercase;
  color: var(--accent);
  line-height: 1.1;
}

.btn-speak {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  border: none;
  border-radius: 50%;
  background: var(--primary-light);
  color: var(--primary);
  cursor: pointer;
  flex-shrink: 0;
  transition: background 0.2s, transform 0.15s, color 0.2s;
  -webkit-tap-highlight-color: transparent;
}

.btn-speak:hover {
  background: var(--primary);
  color: #fff;
}

.btn-speak:active {
  transform: scale(0.92);
}

.btn-speak.speaking {
  background: var(--primary);
  color: #fff;
  animation: pulse-speak 0.8s ease infinite;
}

@keyframes pulse-speak {
  0%, 100% { box-shadow: 0 0 0 0 rgba(79, 70, 229, 0.4); }
  50% { box-shadow: 0 0 0 10px rgba(79, 70, 229, 0); }
}

.btn-speak svg {
  width: 22px;
  height: 22px;
}

.card-image-wrap {
  display: block;
  width: 100%;
  margin: 0;
  padding: 0;
  border: none;
  background: transparent;
  cursor: pointer;
  line-height: 0;
  -webkit-tap-highlight-color: transparent;
}

.card-image-wrap img {
  display: block;
  width: 100%;
  height: auto;
  max-height: min(70vw, 320px);
  margin: 0 auto;
  object-fit: contain;
}

/* Tam ekran resim önizleme */
.image-lightbox {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  padding-top: max(1rem, env(safe-area-inset-top));
  padding-bottom: max(1rem, env(safe-area-inset-bottom));
}

.image-lightbox[hidden] {
  display: none;
}

.lightbox-backdrop {
  position: absolute;
  inset: 0;
  border: none;
  background: rgba(15, 23, 42, 0.92);
  cursor: pointer;
  padding: 0;
}

.lightbox-inner {
  position: relative;
  z-index: 1;
  max-width: 100%;
  max-height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.lightbox-inner img {
  max-width: 100%;
  max-height: calc(100dvh - 2rem);
  width: auto;
  height: auto;
  object-fit: contain;
}

.lightbox-close {
  position: absolute;
  top: -0.5rem;
  right: -0.5rem;
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  border-radius: 50%;
  background: #fff;
  color: var(--text);
  cursor: pointer;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.2);
  -webkit-tap-highlight-color: transparent;
}

.lightbox-close:hover {
  background: var(--primary-light);
  color: var(--primary);
}

body.lightbox-open {
  overflow: hidden;
}

.card-body {
  padding: 1.25rem 1.25rem 1.5rem;
}

.meaning-block {
  text-align: center;
  margin-bottom: 1.25rem;
}

.meaning-label {
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--primary);
  margin-bottom: 0.35rem;
}

.meaning-text {
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--text);
  line-height: 1.3;
}

.section {
  margin-bottom: 1.15rem;
}

.section-label {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  margin-bottom: 0.4rem;
}

.section-label svg {
  width: 14px;
  height: 14px;
  opacity: 0.7;
}

.section p,
.section .example-en {
  font-size: 0.95rem;
  color: var(--text);
}

.section .example-en {
  font-style: italic;
  line-height: 1.55;
}

.section .example-en strong {
  color: var(--accent);
  font-style: normal;
  font-weight: 700;
}

.example-tr {
  font-size: 0.875rem;
  color: var(--text-muted);
  margin-top: 0.35rem;
  padding-left: 0.5rem;
  border-left: 3px solid var(--primary-light);
}

.description-text {
  font-size: 0.9rem;
  color: var(--text-muted);
  line-height: 1.65;
}

.meta-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.6rem;
  margin: 1.25rem 0;
}

.meta-item {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.35rem 0.5rem;
  padding: 0.75rem 1rem;
  background: var(--bg);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
}

.meta-item.type-badge {
  justify-content: center;
  background: var(--primary-light);
  border-color: transparent;
}

.meta-key {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
}

.meta-value {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text);
}

.type-badge .meta-value {
  color: var(--primary-dark);
  font-size: 1rem;
}

.meta-item.synonym .meta-value {
  color: var(--success);
}

.meta-item.antonym .meta-value {
  color: var(--accent);
}

.btn-youtube {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  width: 100%;
  padding: 0.9rem 1.25rem;
  background: linear-gradient(135deg, #ff0000 0%, #cc0000 100%);
  color: #fff;
  font-size: 0.95rem;
  font-weight: 600;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  text-decoration: none;
  transition: transform 0.15s, box-shadow 0.2s;
  -webkit-tap-highlight-color: transparent;
  margin-top: 0.5rem;
}

.btn-youtube:hover {
  color: #fff;
  box-shadow: 0 6px 20px rgba(255, 0, 0, 0.35);
}

.btn-youtube:active {
  transform: scale(0.98);
}

.btn-youtube svg {
  width: 22px;
  height: 22px;
  flex-shrink: 0;
}

/* 404 */
.error-card {
  text-align: center;
  padding: 3rem 1.5rem;
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.error-card h2 {
  font-size: 1.25rem;
  margin-bottom: 0.5rem;
}

.error-card p {
  color: var(--text-muted);
  margin-bottom: 1.25rem;
}

.btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.75rem 1.5rem;
  background: var(--primary);
  color: #fff;
  font-weight: 600;
  border-radius: var(--radius-sm);
  transition: background 0.2s;
}

.btn-primary:hover {
  background: var(--primary-dark);
  color: #fff;
}

/* Tablet+ */
@media (min-width: 640px) {
  .container {
    max-width: 520px;
    padding: 2rem 1.5rem;
  }

  .word-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
  }

  .site-header h1 {
    font-size: 1.75rem;
  }
}
