/* ── Tokens ─────────────────────────────────────────── */
:root {
  --bg:          #0f0f1a;
  --surface:     #1a1a2e;
  --surface2:    #22223b;
  --accent:      #e74c3c;
  --accent2:     #e76f51;
  --text:        #edf2f4;
  --text-muted:  #8d99ae;
  --radius:      1px;
  --font-display: 'Georgia', 'Times New Roman', serif;
  --font-body:    system-ui, -apple-system, sans-serif;
}

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

/* ── Base ───────────────────────────────────────────── */
body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  min-height: 100dvh;
  display: flex;
  justify-content: center;
  padding: 2rem 1rem 4rem;
}

#app {
  width: 100%;
  max-width: 520px;
  display: flex;
  flex-direction: column;
  gap: 2rem;
}

/* ── Header ─────────────────────────────────────────── */
header {
  text-align: center;
  padding-top: 1rem;
}

header h1 {
  font-family: var(--font-display);
  font-size: clamp(2rem, 8vw, 3rem);
  font-weight: 400;
  letter-spacing: -0.02em;
  color: var(--accent);
}

.tagline {
  font-size: 0.85rem;
  color: var(--text-muted);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  margin-top: 0.25rem;
}

.streak-bar {
  display: inline-flex;
  align-items: baseline;
  gap: 0.4rem;
  margin-top: 1.2rem;
  background: var(--surface);
  padding: 0.4rem 1rem;
  border-radius: 999px;
  border: 1px solid var(--surface2);
}

.lolita-bar {
  display: inline-flex;
  align-items: baseline;
  gap: 0.4rem;
  margin-top: 1.2rem;
  background: var(--surface);
  padding: 0.4rem 1rem;
  border-radius: 999px;
  border: 1px solid var(--surface2);
  display: flex;
  justify-content: center; /* horizontal center */
  align-items: center;     /* vertical center (if height exists) */
}

#streak-count {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--accent);
}

.streak-label {
  font-size: 0.8rem;
  color: var(--text-muted);
}

/* ── Button ─────────────────────────────────────────── */
#new-word-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  width: 100%;
  padding: 1rem 1.5rem;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  color: #fff;
  font-size: 1.1rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  border: none;
  border-radius: 12px;
  border-bottom-left-radius:0px;
  border-bottom-right-radius:0px;
  cursor: pointer;
  transition: opacity 0.15s, transform 0.1s;
  -webkit-tap-highlight-color: transparent;
}


#new-word-btn:hover { opacity: 0.9; }
#new-word-btn:active { transform: scale(0.98); }
#new-word-btn:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-icon {
  font-size: 0.9em;
  animation: spin-star 4s linear infinite;
  display: inline-block;
}

@keyframes spin-star {
  to { transform: rotate(360deg); }
}


#reset-cache-btn {
  background: #1a1a2e;
  color: #edf2f4;
  padding: 12px 18px;
  border-radius: 12px;
  font-size: 16px;
  cursor: pointer;

  display: flex;

  justify-content: center;
  align-items: center;

  width: 100%; 
  text-align: center;
}



/* ── Word card ──────────────────────────────────────── */
#word-card {
  background: var(--surface);
  border: 1px solid var(--surface2);
  border-radius: var(--radius);
  padding: 2rem 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

#word-card.fade-in {
  animation: fade-in 0.4s ease both;
}

@keyframes fade-in {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

.word-main {
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.spanish-word {
  font-family: var(--font-display);
  font-size: clamp(2.2rem, 10vw, 3.5rem);
  font-weight: 400;
  color: var(--text);
  letter-spacing: -0.02em;
  line-height: 1.1;
}

.equals {
  font-size: 1.2rem;
  color: var(--text-muted);
  margin: 0.1rem 0;
}

.dutch-word {
  font-size: 1.3rem;
  color: var(--accent);
  font-weight: 500;
}

/* ── Sentence block ─────────────────────────────────── */
.sentence-block {
  border-top: 1px solid var(--surface2);
  padding-top: 1.2rem;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.sentence-es {
  font-size: 1rem;
  color: var(--text);
  font-style: italic;
  line-height: 1.5;
}

.sentence-nl {
  font-size: 0.9rem;
  color: var(--text-muted);
  line-height: 1.5;
}

/* ── Loading ────────────────────────────────────────── */
#loading {
  text-align: center;
  color: var(--text-muted);
  font-size: 0.9rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
  padding: 1.5rem;
}

.spinner {
  width: 28px;
  height: 28px;
  border: 3px solid var(--surface2);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* ── Error ──────────────────────────────────────────── */
#error-msg {
  background: #2d1515;
  border: 1px solid #6b2020;
  border-radius: var(--radius);
  padding: 1rem 1.25rem;
  font-size: 0.9rem;
  color: #f87171;
  text-align: center;
}

/* ── History ────────────────────────────────────────── */
#history-section {
  border-top: 1px solid var(--surface2);
  padding-top: 1.5rem;
  max-height: 650px;
  margin: 20px;
  padding: 10px;
  overflow-y: auto;
  overflow-x: hidden;
  scrollbar-width: thin;
  scrollbar-color: #6b7280 transparent;
}

/* Chrome, Edge, Safari */
#history-section::-webkit-scrollbar {
  width: 10px;
}

#history-section::-webkit-scrollbar-track {
  background: transparent;
}

#history-section::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, #7c8aff, #5b6cff);
  border-radius: 999px;
  border: 2px solid transparent;
  background-clip: padding-box;
  transition: background 0.3s ease;
}

#history-section::-webkit-scrollbar-thumb:hover {
  background: linear-gradient(180deg, #98a4ff, #7283ff);
}

#history-section::-webkit-scrollbar-thumb:active {
  background: linear-gradient(180deg, #5b6cff, #4c5be0);
}

#history-section h2 {
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 1rem;
}

#history-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

#history-list li {
  display: flex;
  align-items: baseline;
  gap: 0.6rem;
  font-size: 0.95rem;
  color: var(--text-muted);
  padding: 0.35rem 0;
  border-bottom: 1px solid var(--surface);
  transition: color 0.15s;
}

#history-list li:last-child { border-bottom: none; }

#history-list li:hover { color: var(--text); }

#history-list .hist-word {
  font-family: var(--font-display);
  color: var(--text);
  font-size: 1rem;
}

#history-list .hist-sep {
  color: var(--surface2);
}

.category-filter {
  position: absolute;
  right: 20px;
  top: 140px; /* adjust if needed depending on header height */
  
  display: flex;
  flex-direction: column;
  gap: 10px;

  align-items: flex-end;
}

.category-filter .pill {
  display: flex;
  align-items: center;
  gap: 8px;

  padding: 8px 12px;
  border-radius: 999px;

  font-size: 12px;
  color: #edf2f4;

  background: #0f0f1a;
  border: 1px solid rgba(237, 242, 244, 0.25);

  cursor: pointer;
  user-select: none;
  transition: 0.2s ease;
  white-space: nowrap;
}


.category-filter input {
  display: none;
}

/* checked state */
.category-filter .pill:has(input:checked) {
  background: linear-gradient(2deg, var(--accent), var(--accent2));
  border-color: #edf2f4;
}


/* ── Utility ────────────────────────────────────────── */
.hidden { display: none !important; }

/* ── Reduced motion ─────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; }
}


@media (max-width: 768px) {
  .category-filter {
    top: 10px;
    right: 10px;

    flex-direction: row;
    gap: 6px;

    align-items: center;
  }

  .category-filter .pill {
    padding: 4px 8px;
    font-size: 10px;
    gap: 4px;
  }
}