:root {
  --bg-color: #fcfaf7;
  --card-bg: #ffffff;
  --text-main: #2d3436;
  --text-dim: #636e72;
  --accent-primary: #10ac84;
  /* Emerald */
  --accent-wrong: #ee5253;
  /* Red */
  --accent-neutral: #54a0ff;
  /* Blue */
  --gold: #d4af37;
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.05);
  --border-radius: 24px;
}

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

body {
  font-family: 'Outfit', sans-serif;
  background-color: var(--bg-color);
  color: var(--text-main);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center; /* Changed from center to allow top-down scroll flow */
  padding: 20px;
  overflow-x: hidden;
}

html {
  overflow-x: hidden;
}

#app-container {
  width: 100%;
  max-width: 900px;
  display: flex;
  flex-direction: column;
  gap: 30px;
  transition: max-width 0.4s ease;
}

#app-container.wide-mode {
  max-width: 1200px;
}

header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap; /* Allow wrapping to prevent overflow on zoom-out/narrow screens */
  gap: 15px;
  width: 100%;
}

.logo {
  font-weight: 800;
  letter-spacing: 4px;
  font-size: 1.2rem;
  color: var(--text-dim);
}

#stats {
  display: flex;
  gap: 20px;
  font-weight: 600;
  font-size: 0.9rem;
  flex-wrap: wrap; /* Prevent statistical block from pushing viewport width */
  align-items: center;
}

#curation-btn {
  background: var(--accent-neutral);
  color: white;
  border: none;
  padding: 8px 16px;
  border-radius: 100px;
  font-family: inherit;
  font-size: 0.8rem;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.2s;
}

#study-list-btn {
  background: var(--gold);
  color: white;
  border: none;
  padding: 8px 16px;
  border-radius: 100px;
  font-family: inherit;
  font-size: 0.8rem;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.2s;
}

#curation-btn:hover, #study-list-btn:hover {
  transform: scale(1.05);
}

#mode-toggle-btn {
  background: #f1f2f6;
  color: var(--text-main);
  border: 2px solid transparent;
  padding: 8px 16px;
  border-radius: 100px;
  font-family: inherit;
  font-size: 0.8rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s ease;
}

#mode-toggle-btn:hover {
  border-color: var(--accent-primary);
}

#mode-toggle-btn.active-mode {
  background: var(--accent-primary);
  color: white;
  border-color: var(--accent-primary);
}

.stat-item span {
  color: var(--accent-primary);
}

/* =====================
   Learning Mode
   ===================== */
/* =====================
   Learning Mode — Card Flow
   ===================== */
.learn-nav-bar {
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 24px;
  background: rgba(255, 255, 255, 0.8);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border-radius: 100px;
  padding: 12px 16px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.05);
  border: 1px solid rgba(0, 0, 0, 0.04);
  gap: 20px;
  z-index: 10;
}

.learn-status-controls {
  display: flex;
  gap: 8px;
  background: rgba(0, 0, 0, 0.03);
  padding: 4px;
  border-radius: 100px;
}

.status-btn {
  padding: 6px 16px;
  border-radius: 100px;
  border: none;
  font-family: inherit;
  font-weight: 700;
  font-size: 0.75rem;
  cursor: pointer;
  transition: all 0.2s ease;
}

.status-btn.known {
  background: white;
  color: var(--accent-primary);
}

.status-btn.known:hover {
  background: var(--accent-primary);
  color: white;
}

.status-btn.unknown {
  background: white;
  color: var(--accent-wrong);
}

.status-btn.unknown:hover {
  background: var(--accent-wrong);
  color: white;
}

.learn-nav-btn {
  background: var(--text-dim);
  color: white;
  border: none;
  padding: 8px 18px;
  border-radius: 100px;
  font-size: 0.75rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s;
}

.learn-nav-btn:hover:not(:disabled) {
  background: var(--text-main);
}

.learn-nav-btn:disabled {
  opacity: 0.25;
  cursor: default;
}

.learn-card {
  background: var(--card-bg);
  border-radius: var(--border-radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  border: 1px solid rgba(0, 0, 0, 0.04);
}

.learn-card-header {
  padding: 40px 44px 30px;
  border-bottom: 1px solid #f1f2f6;
  text-align: center;
}

.learn-meta {
  display: flex;
  gap: 8px;
  justify-content: center;
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

.learn-word {
  font-family: 'Playfair Display', serif;
  font-size: 3.5rem;
  font-weight: 700;
  margin: 0 0 6px;
  padding-bottom: 0.15em; /* Prevent descender clipping */
  color: var(--text-main);
  white-space: nowrap;
  overflow: hidden;
  max-width: 100%;
  display: block;
  line-height: 1.2;
}

.learn-pos {
  font-size: 0.85rem;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 2px;
  margin: 0;
}

.learn-section {
  padding: 24px 44px;
  border-bottom: 1px solid #f8f9fa;
}

.learn-section-label {
  font-size: 0.72rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: var(--text-dim);
  margin-bottom: 12px;
}

.learn-definition {
  font-size: 1.1rem;
  line-height: 1.65;
  color: var(--text-main);
  margin: 0;
}

.learn-etymology-box {
  background: #f8f9fa;
  border-radius: 12px;
  padding: 18px 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.etym-row {
  display: flex;
  gap: 12px;
  align-items: baseline;
}

.etym-key {
  font-size: 0.7rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-dim);
  min-width: 50px;
  flex-shrink: 0;
}

.etym-val {
  font-size: 0.9rem;
  line-height: 1.5;
  color: var(--text-main);
}

.learn-tag-cloud {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.learn-tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  border-radius: 100px;
  font-size: 0.8rem;
  font-weight: 600;
}

.learn-tag-score {
  background: rgba(0, 0, 0, 0.12);
  border-radius: 100px;
  padding: 1px 6px;
  font-size: 0.7rem;
  font-weight: 800;
}

.learn-section-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  border-bottom: 1px solid #f8f9fa;
}

.learn-section-grid .learn-section {
  border-bottom: none;
  border-right: 1px solid #f1f2f6;
}

.learn-section-grid .learn-section:last-child {
  border-right: none;
}

.antonym-tag {
  background: rgba(238, 82, 83, 0.08);
  color: #ee5253;
}

.family-tag {
  background: var(--accent-primary);
  color: white;
  padding: 4px 12px;
  border-radius: 100px;
  font-size: 0.72rem;
  font-weight: 700;
}

/* =====================
   Keyboard Shortcut Hints
   ===================== */
.learn-kb-hints {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 20px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.kb-hint {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--text-dim);
  opacity: 0.65;
  user-select: none;
}

kbd {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #f1f2f6;
  border: 1px solid rgba(0, 0, 0, 0.15);
  border-bottom-width: 2px;
  border-radius: 5px;
  padding: 1px 6px;
  font-family: inherit;
  font-size: 0.68rem;
  font-weight: 700;
  color: var(--text-dim);
  box-shadow: 0 1px 0 rgba(0,0,0,0.1);
  line-height: 1.6;
}

/* Hide keyboard hints on touch screens / small viewports */
@media (hover: none), (max-width: 480px) {
  .learn-kb-hints {
    display: none;
  }
}


.search-container {
  position: relative;
  flex: 1;
  max-width: 400px;
  margin: 0 30px;
}

#lex-search {
  width: 100%;
  padding: 12px 45px 12px 20px;
  border-radius: 100px;
  border: 1px solid rgba(0, 0, 0, 0.08);
  background: white;
  font-family: inherit;
  font-size: 0.9rem;
  transition: all 0.3s ease;
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.02);
}

#lex-search:focus {
  outline: none;
  border-color: var(--accent-neutral);
  box-shadow: 0 0 0 4px rgba(84, 160, 255, 0.1);
  max-width: 100%;
}

.search-icon {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  opacity: 0.8;
  cursor: pointer;
  pointer-events: auto;
  width: 38px;
  height: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  border: 2px solid var(--accent-neutral);
  background: white;
  transition: all 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  color: var(--text-main);
  font-size: 1.1rem;
}

.search-icon:hover {
  opacity: 1;
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 4px rgba(84, 160, 255, 0.2);
  transform: translateY(-50%) scale(1.05);
}

.search-icon:active {
  transform: translateY(-50%) scale(0.92);
  background: #f1f2f6;
}

.quiz-pos {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 1.5px;
  margin-top: -4px;
  margin-bottom: 20px;
}

/* =====================
   Filter Bar — Accordion
   ===================== */
#filter-bar {
  display: flex;
  flex-direction: row;
  gap: 8px;
  flex-wrap: wrap;
  animation: fadeIn 0.3s ease;
}

/* Each accordion wrapper */
.filter-accordion {
  position: relative;
}

/* The toggle button that acts as the collapsed label */
.filter-accordion-toggle {
  display: flex;
  align-items: center;
  gap: 6px;
  background: #f1f2f6;
  border: 2px solid transparent;
  padding: 7px 14px;
  border-radius: 100px;
  font-family: inherit;
  font-size: 0.75rem;
  font-weight: 700;
  cursor: pointer;
  color: var(--text-dim);
  transition: all 0.2s ease;
  white-space: nowrap;
  user-select: none;
}

.filter-accordion-toggle:hover {
  border-color: var(--accent-neutral);
  color: var(--text-main);
}

.filter-accordion-toggle.is-open {
  background: var(--text-main);
  color: white;
  border-color: var(--text-main);
}

.filter-accordion-label {
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 1px;
  opacity: 0.7;
}

.filter-accordion-value {
  font-size: 0.8rem;
  font-weight: 800;
}

.filter-accordion-arrow {
  font-size: 1rem;
  line-height: 1;
  transition: transform 0.25s ease;
  display: inline-block;
}

.filter-accordion-toggle.is-open .filter-accordion-arrow {
  transform: rotate(90deg);
}

/* The dropdown panel of pills */
.filter-accordion-panel {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  background: white;
  border-radius: 16px;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.12);
  border: 1px solid rgba(0, 0, 0, 0.06);
  padding: 12px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  z-index: 100;
  min-width: 240px;
  /* Hidden by default */
  opacity: 0;
  pointer-events: none;
  transform: translateY(-6px);
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.filter-accordion-panel.is-open {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}

/* Active state pill gets its border highlighted */
.filter-pill {
  background: #f1f2f6;
  border: 2px solid transparent;
  padding: 6px 14px;
  border-radius: 100px;
  font-family: inherit;
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  color: var(--text-dim);
  transition: all 0.2s ease;
}

.filter-pill:hover {
  border-color: var(--accent-neutral);
  color: var(--text-main);
}

.filter-pill.active {
  background: var(--text-main);
  color: white;
  border-color: var(--text-main);
}

.filter-warning {
  font-size: 0.8rem;
  color: var(--accent-wrong);
  margin-top: 4px;
  font-style: italic;
}

/* Part of Speech pill accent colors when active */
.pos-pill[data-value="noun"].active {
  background: #a29bfe;
  border-color: #a29bfe;
  color: white;
}

.pos-pill[data-value="verb"].active {
  background: #fd79a8;
  border-color: #fd79a8;
  color: white;
}

.pos-pill[data-value="adj"].active {
  background: #e17055;
  border-color: #e17055;
  color: white;
}

/* Card Design */
.card {
  background: var(--card-bg);
  padding: 50px;
  border-radius: var(--border-radius);
  box-shadow: var(--shadow);
  text-align: center;
  border: 1px solid rgba(0, 0, 0, 0.03);
  width: 100%;
}

.meta-row {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 15px;
  margin-bottom: 20px;
}

.tag {
  background: #f1f2f6;
  color: var(--text-dim);
  padding: 4px 12px;
  border-radius: 100px;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.pronunciation {
  font-family: 'Playfair Display', serif;
  font-style: italic;
  color: var(--text-dim);
  font-size: 1rem;
}

h1 {
  font-family: 'Playfair Display', serif;
  font-size: 3.5rem;
  margin-bottom: 10px;
  padding-bottom: 0.1em; /* Prevent descender clipping */
  color: var(--text-main);
  white-space: nowrap;
  overflow: hidden;
  max-width: 100%;
  line-height: 1.2;
  display: block;
}

.instruction {
  color: var(--text-dim);
  font-size: 0.95rem;
  margin-bottom: 30px;
}

/* Options */
#options-container {
  display: flex;
  flex-direction: column;
  gap: 15px;
}

.option-btn {
  background: #f8f9fa;
  border: 2px solid transparent;
  padding: 20px;
  border-radius: 16px;
  font-family: inherit;
  font-size: 1.1rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  color: var(--text-main);
  text-align: left;
}

.option-btn:hover {
  background: #fff;
  border-color: var(--accent-neutral);
  transform: translateY(-2px);
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.05);
}

.option-btn.correct {
  background: rgba(16, 172, 132, 0.1);
  border-color: var(--accent-primary);
  color: var(--accent-primary);
}

.option-btn.wrong {
  background: rgba(238, 82, 83, 0.1);
  border-color: var(--accent-wrong);
  color: var(--accent-wrong);
}

.option-btn.disabled {
  pointer-events: none;
  opacity: 0.7;
}

/* Feedback Box */
#feedback {
  margin-top: 40px;
  padding-top: 30px;
  border-top: 1px solid #eee;
  text-align: left;
  animation: fadeIn 0.4s ease;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

#feedback-message {
  font-weight: 800;
  font-size: 1.2rem;
  margin-bottom: 15px;
  text-align: center;
}

.helper {
  background: #f1f2f6;
  padding: 20px;
  border-radius: 12px;
  font-size: 0.95rem;
  color: var(--text-dim);
  margin-bottom: 25px;
}

.helper strong {
  display: block;
  color: var(--text-main);
  margin-bottom: 5px;
}

#next-btn {
  width: 100%;
  padding: 20px;
  background: var(--text-main);
  color: white;
  border: none;
  border-radius: 16px;
  font-family: inherit;
  font-weight: 600;
  font-size: 1.1rem;
  cursor: pointer;
  transition: transform 0.2s;
}

#next-btn:hover {
  transform: scale(1.02);
}

.hidden {
  display: none !important;
}

/* Footer */
footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.8rem;
  color: var(--text-dim);
}

#reset-btn {
  background: none;
  border: none;
  color: var(--text-dim);
  font-weight: 600;
  cursor: pointer;
  text-decoration: underline;
}

.explorer-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  animation: fadeIn 0.4s ease;
}

.explorer-header h3 {
  font-size: 1.1rem;
  font-weight: 400;
  opacity: 0.7;
}

.explorer-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 20px;
  animation: fadeIn 0.5s ease;
}

.result-card {
  text-align: left !important;
  padding: 30px !important;
}

.result-card h2 {
  font-family: 'Playfair Display', serif;
  font-size: 2rem;
  margin: 10px 0;
}

.definition-main {
  font-size: 1.1rem;
  color: var(--text-main);
  margin-bottom: 15px;
}

.history-note {
  font-size: 0.85rem;
  background: #f8f9fa;
  padding: 15px;
  border-radius: 12px;
  color: var(--text-dim);
  border-left: 3px solid var(--accent-neutral);
  margin-bottom: 15px;
}

.tag-cloud {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.mini-tag {
  font-size: 0.7rem;
  background: rgba(0, 0, 0, 0.05);
  padding: 4px 10px;
  border-radius: 4px;
  text-transform: lowercase;
  font-weight: 600;
  opacity: 0.6;
}

/* =====================
   Curation Table
   ===================== */
.table-wrapper {
  background: white;
  border-radius: var(--border-radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  border: 1px solid rgba(0, 0, 0, 0.05);
  overflow-x: auto;
}

/* =====================
   Overlay
   ===================== */
.overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 1000;
  animation: fadeIn 0.3s ease;
}

.overlay.hidden {
  display: none !important;
}

.overlay-content {
  background: white;
  padding: 40px;
  border-radius: var(--border-radius);
  max-width: 800px;
  width: 90%;
  max-height: 90vh;
  overflow-y: auto;
  position: relative;
  box-shadow: 0 20px 50px rgba(0,0,0,0.2);
}

.close-overlay {
  position: absolute;
  top: 20px; right: 20px;
  background: none; border: none;
  font-size: 1.5rem;
  cursor: pointer;
  color: var(--text-dim);
}

.close-overlay:hover {
  color: var(--accent-wrong);
}

.ety-row {
  display: flex;
  margin-bottom: 25px;
  align-items: center;
}

.ety-label {
  flex: 0 0 160px;
  font-weight: 700;
  font-size: 0.95rem;
}

.ety-bars {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.ety-bar-wrapper {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.85rem;
}

.ety-bar-bg {
  flex: 1;
  background: #f1f2f6;
  height: 14px;
  border-radius: 7px;
  overflow: hidden;
}

.ety-bar-fill {
  height: 100%;
  border-radius: 7px;
}

.ety-val {
  width: 50px;
  text-align: right;
  font-weight: 600;
  color: var(--text-dim);
}

.curation-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 0.9rem;
  white-space: nowrap;
}

.curation-table th {
  background: #f8f9fa;
  padding: 16px 20px;
  font-weight: 700;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 1px;
  font-size: 0.7rem;
  position: sticky;
  top: 0;
  z-index: 10;
}

.curation-table tbody tr {
  transition: background 0.15s ease;
}

.curation-table tbody tr:hover {
  background: #f8f9fa;
}

.curation-table td {
  padding: 16px 20px;
  border-bottom: 1px solid #f1f2f6;
  vertical-align: top;
  white-space: normal;
}

.td-word {
  font-family: 'Playfair Display', serif;
  font-weight: 700;
  font-size: 1.15rem;
  color: var(--text-main);
  min-width: 140px;
}

.td-def {
  max-width: 280px;
  line-height: 1.5;
  color: var(--text-dim);
  min-width: 200px;
}

.td-tags {
  min-width: 180px;
}

.td-history {
  font-size: 0.82rem;
  color: var(--text-dim);
  min-width: 140px;
}

.td-history strong {
  color: var(--text-main);
}

/* Difficulty Color Dots */
.difficulty-dot {
  display: inline-block;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  vertical-align: middle;
}

.diff-1 {
  background: #10ac84;
}

/* Green  - Easy */
.diff-2 {
  background: #54a0ff;
}

/* Blue   - Moderate */
.diff-3 {
  background: #feca57;
}

/* Yellow - Medium */
.diff-4 {
  background: #ff9f43;
}

/* Orange - Hard */
.diff-5 {
  background: #ee5253;
}

/* Red    - Master */

@media (max-width: 768px) {
  body {
    padding: 12px;
    align-items: flex-start;
  }

  #app-container {
    padding: 0;
    gap: 16px;
  }

  header {
    gap: 10px;
  }

  .logo {
    font-size: 1rem;
    letter-spacing: 3px;
  }

  .search-container {
    margin: 0;
    flex: 1;
    min-width: 140px;
    order: 0;
  }

  #stats {
    gap: 10px;
    font-size: 0.8rem;
  }

  #mode-toggle-btn,
  #curation-btn {
    padding: 6px 12px;
    font-size: 0.75rem;
  }

  .card {
    padding: 28px 18px;
  }

  /* Word title: JS shrinks dynamically; CSS provides the mobile ceiling */
  h1 {
    font-size: clamp(1.4rem, 9vw, 3.5rem);
    white-space: nowrap;
    overflow: hidden;
  }

  .learn-word {
    font-size: clamp(1.4rem, 9vw, 3.5rem);
  }

  /* Accordion toggle smaller on mobile */
  .filter-accordion-toggle {
    padding: 6px 12px;
    font-size: 0.7rem;
  }

  /* Accordion panel on mobile */
  .filter-accordion-panel {
    min-width: 200px;
  }

  /* Floating learn nav on mobile */
  .learn-nav-bar {
    padding: 6px 8px;
  }

  .learn-nav-btn {
    padding: 8px 16px;
    font-size: 0.78rem;
  }
}

.clear-all-btn {
  background: white;
  color: var(--accent-wrong);
  border: 1px solid var(--accent-wrong);
  padding: 10px 22px;
  border-radius: 100px;
  font-family: inherit;
  font-weight: 700;
  font-size: 0.85rem;
  cursor: pointer;
  transition: all 0.2s;
}

.clear-all-btn:hover {
  background: var(--accent-wrong);
  color: white;
}

/* Universal Study Add Button for Search/Curation */
.study-add-btn {
  background: white;
  color: var(--gold);
  border: 1.5px solid var(--gold);
  padding: 6px 12px;
  border-radius: 100px;
  font-weight: 700;
  font-size: 0.7rem;
  cursor: pointer;
  transition: all 0.2s;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.study-add-btn:hover {
  background: var(--gold);
  color: white;
  transform: translateY(-1px);
}

.study-add-btn.in-list {
  background: var(--gold);
  color: white;
  opacity: 0.6;
  pointer-events: none;
}

/* =====================
   Study Mode — Tile Grid
   ===================== */
.study-grid-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
  padding: 0 10px;
}

.study-title {
  font-family: 'Playfair Display', serif;
  font-size: 1.8rem;
  color: var(--text-main);
  margin: 0;
}

.print-btn {
  background: linear-gradient(135deg, var(--gold), #f39c12);
  color: white;
  border: none;
  padding: 10px 22px;
  border-radius: 100px;
  font-family: inherit;
  font-weight: 700;
  font-size: 0.85rem;
  cursor: pointer;
  box-shadow: 0 4px 15px rgba(243, 156, 18, 0.25);
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  gap: 8px;
}

.print-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(243, 156, 18, 0.35);
  filter: brightness(1.1);
}

.print-btn:active {
  transform: translateY(0);
}

.study-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 20px;
  padding-bottom: 60px;
}

.study-tile {
  background: white;
  border-radius: 20px;
  padding: 24px;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
  border: 1px solid rgba(0, 0, 0, 0.04);
  display: flex;
  flex-direction: column;
  gap: 12px;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.study-tile:hover {
  transform: translateY(-4px);
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.08);
}

.tile-word-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
}

.tile-word {
  font-family: 'Playfair Display', serif;
  font-size: 1.5rem;
  margin: 0;
  color: var(--text-main);
}

.tile-pos {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-dim);
  font-weight: 700;
}

.tile-definition {
  font-size: 0.95rem;
  color: var(--text-main);
  line-height: 1.5;
  flex-grow: 1;
}

.tile-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-top: 15px;
  border-top: 1px solid #f1f2f6;
}

.tile-tag {
  background: #f1f2f6;
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--text-dim);
}

.tile-action-btn {
  background: white;
  color: var(--accent-primary);
  border: 2px solid var(--accent-primary);
  padding: 6px 14px;
  border-radius: 100px;
  font-weight: 700;
  font-size: 0.8rem;
  cursor: pointer;
  transition: all 0.2s;
}

.tile-action-btn:hover {
  background: var(--accent-primary);
  color: white;
}

@media print {
  body * {
    visibility: hidden;
  }
  #content-area, #content-area * {
    visibility: visible;
  }
  #content-area {
    position: absolute;
    left: 0;
    top: 0;
    width: 100%;
  }
  .print-btn, .tile-action-btn, .learn-nav-bar, header {
    display: none !important;
  }
  .study-grid {
    display: block;
  }
  .study-tile {
    break-inside: avoid;
    border-bottom: 2px solid #eee;
    margin-bottom: 20px;
    padding: 10px 0;
    box-shadow: none;
  }
}
/* REVISED PRINT SYSTEM */
@media print {
  @page { margin: 1.5cm; }
  body { background: white !important; padding: 0; }
  header, footer, .learn-nav-bar, .print-btn, .clear-all-btn, .tile-action-btn, #filter-bar, .explorer-header { display: none !important; }
  #content-area { display: block !important; padding: 0 !important; visibility: visible !important; }
  #content-area * { visibility: visible !important; }
  .study-title { 
    font-size: 2.22rem; 
    border-bottom: 2px solid #000; 
    padding-bottom: 12px; 
    margin-bottom: 30px; 
    text-align: center; 
    font-family: 'Playfair Display', serif;
  }
  .study-grid { display: block !important; }
  .study-tile { 
    break-inside: avoid; 
    border: none; 
    border-bottom: 1px solid #eee; 
    padding: 20px 0; 
    margin-bottom: 0; 
    box-shadow: none;
  }
  .tile-word { font-size: 2rem; font-family: 'Playfair Display', serif; }
  .tile-definition { font-size: 1.15rem; margin: 10px 0; line-height: 1.5; }
  .tile-meta { border: none; padding: 0; font-size: 0.9rem; color: #666; }
}

/* TOAST & FEEDBACK */
.toast {
  position: fixed;
  bottom: 30px;
  left: 50%;
  transform: translateX(-50%) translateY(100px);
  background: var(--accent-primary);
  color: white;
  padding: 12px 24px;
  border-radius: 100px;
  font-weight: 700;
  box-shadow: 0 10px 40px rgba(16, 172, 132, 0.3);
  z-index: 10000;
  transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  pointer-events: none;
  display: flex;
  align-items: center;
  gap: 10px;
}

.toast.show {
  transform: translateX(-50%) translateY(0);
}

@keyframes pulse-gold {
  0% { box-shadow: 0 0 0 0 rgba(212, 175, 55, 0.7); }
  70% { box-shadow: 0 0 0 15px rgba(212, 175, 55, 0); }
  100% { box-shadow: 0 0 0 0 rgba(212, 175, 55, 0); }
}

.pulse-gold {
  animation: pulse-gold 0.8s ease-out;
}

/* OXFORD STUDY TILE SYSTEM */
.tile-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 15px;
  border-bottom: 1px solid rgba(0,0,0,0.05);
  padding-bottom: 8px;
  margin-bottom: 10px;
}

.tile-meta-right {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-dim);
  font-style: italic;
}

.tile-actions-screen {
  margin-top: 10px;
  display: flex;
  justify-content: flex-end;
}

/* REVISED OXFORD PRINT OVERLAY */
@media print {
  @page { margin: 1cm; }
  body { background: white !important; color: black !important; }
  .study-title { 
    font-family: 'Playfair Display', serif; 
    font-size: 2.22rem; 
    border-bottom: 3px double #000; 
    padding-bottom: 8px; 
    margin-bottom: 24px; 
  }
  .study-grid { display: block !important; }
  .study-tile { 
    break-inside: avoid; 
    border: none; 
    border-bottom: 0.5pt solid #ddd; 
    padding: 12px 0; 
    margin-bottom: 0; 
    background: transparent !important;
  }
  .tile-header { 
    border-bottom: none; 
    padding-bottom: 0; 
    margin-bottom: 4px;
    display: flex;
    justify-content: space-between;
  }
  .tile-word { 
    font-size: 1.4rem; 
    font-family: 'Playfair Display', serif; 
    font-weight: 700;
    margin: 0;
  }
  .tile-meta-right { 
    font-size: 0.85rem; 
    color: #444 !important; 
    font-style: italic;
    font-weight: 400;
  }
  .tile-definition { 
    font-size: 1rem; 
    margin: 4px 0; 
    line-height: 1.4; 
    color: black !important;
  }
  .tile-actions-screen { display: none !important; }
  .tile-tag, .tag, .print-btn, .clear-all-btn, header, footer { display: none !important; }
}

/* FINAL OXFORD REFINEMENTS */
@media print {
  .study-tile { 
    border-bottom: 1px dotted #888 !important; 
    border-radius: 0 !important;
    padding: 18px 0 !important;
  }
  .tile-word { 
    text-transform: capitalize !important;
    font-size: 1.5rem !important;
    letter-spacing: 0.5px;
  }
  .tile-meta-right {
    text-transform: uppercase !important;
    color: #555 !important;
    font-size: 0.75rem !important;
    letter-spacing: 1.5px !important;
  }
}

/* LIGHTER PRINT LINE */
@media print {
  .study-tile { 
    border-bottom: 1px dotted #ccc !important; 
  }
}

/* QUICK QUIZ MODAL */
#quick-quiz-overlay {
  background: rgba(45, 52, 54, 0.98);
  backdrop-filter: blur(15px);
}

.quick-quiz-content {
  background: white;
  padding: 40px;
  border-radius: 32px;
  width: 90%;
  max-width: 500px;
  text-align: center;
  box-shadow: 0 30px 60px rgba(0,0,0,0.5);
}

.quick-quiz-word {
  font-family: 'Playfair Display', serif;
  font-size: 2.5rem;
  margin-bottom: 20px;
  color: var(--text-main);
}

.quick-quiz-options {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 30px;
}

.quick-option-btn {
  background: #f8f9fa;
  border: 2px solid transparent;
  padding: 14px;
  border-radius: 16px;
  font-family: inherit;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  color: var(--text-main);
  text-align: left;
}

.quick-option-btn:hover {
  background: white;
  border-color: var(--accent-neutral);
}

.quick-option-btn.correct { background: #dff9fb; border-color: var(--accent-primary); color: var(--accent-primary); }
.quick-option-btn.wrong { background: #feebeb; border-color: var(--accent-wrong); color: var(--accent-wrong); }
