/* Esperanto-kurso — Pico CSS overrides */
/* Esperanto flag colours: green (#009900) and white, with a gold star */

:root {
  --eo-green: #008000;
  --eo-green-light: #00a000;
  --eo-green-dark: #006000;
  --eo-gold: #f5c400;
  --correct-bg: #d4edda;
  --correct-border: #28a745;
  --incorrect-bg: #f8d7da;
  --incorrect-border: #dc3545;
  --delta-pos: #28a745;
  --delta-neg: #dc3545;
  --reading-bg: #f8f9fa;
  --reading-color: inherit;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --eo-green: #00c000;
    --eo-green-light: #00e000;
    --eo-green-dark: #00a000;
    --correct-bg: rgba(40, 167, 69, 0.2);
    --correct-border: #5cb85c;
    --incorrect-bg: rgba(220, 53, 69, 0.2);
    --incorrect-border: #e05a6a;
    --delta-pos: #5cb85c;
    --delta-neg: #e05a6a;
    --reading-bg: rgba(255, 255, 255, 0.05);
    --reading-color: inherit;
  }
}

[data-theme="dark"] {
  --eo-green: #00c000;
  --eo-green-light: #00e000;
  --eo-green-dark: #00a000;
  --correct-bg: rgba(40, 167, 69, 0.2);
  --correct-border: #5cb85c;
  --incorrect-bg: rgba(220, 53, 69, 0.2);
  --incorrect-border: #e05a6a;
  --delta-pos: #5cb85c;
  --delta-neg: #e05a6a;
  --reading-bg: rgba(255, 255, 255, 0.05);
  --reading-color: inherit;
}

/* ---- Typography ---- */
.site-title {
  font-size: 1.25rem;
  font-weight: bold;
  color: var(--eo-green) !important;
  text-decoration: none;
}

/* ---- Navigation ---- */
header nav {
  border-bottom: 3px solid var(--eo-green);
}

/* ---- Rating badge ---- */
.rating-badge {
  display: inline-block;
  background: var(--eo-green);
  color: white;
  font-size: 0.75rem;
  font-weight: bold;
  padding: 0.1em 0.5em;
  border-radius: 1em;
}

/* ---- Type badges ---- */
.type-badge {
  display: inline-block;
  font-size: 0.7rem;
  font-weight: bold;
  text-transform: uppercase;
  padding: 0.1em 0.4em;
  border-radius: 0.25em;
  color: white;
}
.type-multiplechoice { background: #6f42c1; }
.type-fillin         { background: #007bff; }
.type-listening      { background: #e83e8c; }
.type-vocab          { background: #20c997; }
.type-reading        { background: #fd7e14; }
.type-video          { background: #c0392b; }
.type-phrasebook     { background: #17a2b8; }
.type-image          { background: #6c757d; }

/* ---- Tags ---- */
.tag {
  display: inline-block;
  background: #e9ecef;
  color: #495057;
  padding: 0.1em 0.4em;
  border-radius: 0.2em;
  font-size: 0.7rem;
  margin-right: 0.2em;
}

/* ---- Inline vocab language switcher (inside translation box) ---- */
.traduko-lang-switch {
  margin-top: 0.5rem;
  padding-top: 0.5rem;
  border-top: 1px solid #dee2e6;
}

.inline-lang-form {
  display: inline;
  margin: 0;
}

.inline-lang-form label {
  display: inline-flex;
  align-items: center;
  gap: 0.3em;
  font-size: 0.8rem;
  color: #6c757d;
  margin: 0;
}

.lang-select-inline {
  font-size: 0.8rem;
  padding: 0.1em 0.3em;
  border-radius: 0.2em;
  display: inline-block;
  width: auto;
  margin: 0;
}

/* ---- Vocab generation word grid ---- */
.word-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin: 1rem 0;
}
.word-check {
  display: inline-flex;
  align-items: center;
  gap: 0.3em;
  background: var(--pico-card-background-color, #f8f9fa);
  border: 1px solid var(--pico-muted-border-color, #dee2e6);
  border-radius: 0.3em;
  padding: 0.25em 0.6em;
  cursor: pointer;
}
.word-exists {
  opacity: 0.45;
  cursor: default;
}

/* ---- Tag cloud (/etikedoj) ---- */
.tag-cloud {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin: 1rem 0;
}

.tag-item {
  display: inline-flex;
  align-items: center;
  gap: 0.3em;
  text-decoration: none;
  background: #e9ecef;
  border-radius: 0.3em;
  padding: 0.25em 0.6em;
  color: #495057;
  transition: background 0.15s;
}

.tag-item:hover {
  background: var(--eo-green);
  color: white;
}

.tag-item .tag {
  background: none;
  padding: 0;
  margin: 0;
  font-size: 0.9rem;
  color: inherit;
}

.tag-count {
  background: rgba(0,0,0,0.15);
  border-radius: 1em;
  padding: 0 0.4em;
  font-size: 0.75rem;
}

/* ---- Exercise grid (home page) ---- */
.exercise-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 1rem;
}

.exercise-card {
  display: flex;
  flex-direction: column;
  height: 100%;
}

.exercise-card img {
  width: 100%;
  height: 140px;
  object-fit: cover;
  border-radius: 0.25rem;
  margin-bottom: 0.5rem;
}

.exercise-card a[role="button"] {
  margin-top: auto;
  background: var(--eo-green);
  border-color: var(--eo-green);
  color: white;
}

.exercise-card a[role="button"]:hover {
  background: var(--eo-green-dark);
  border-color: var(--eo-green-dark);
  color: white;
}

/* Vortaro start-practice button and any other standalone primary role=button */
a[role="button"]:not(.outline):not([class*="secondary"]) {
  color: white;
}

/* ---- Exercise image ---- */
.exercise-image {
  max-width: 100%;
  max-height: 300px;
  border-radius: 0.5rem;
  margin: 1rem 0;
}

/* ---- Fill-in gap inputs ---- */
.fillin-question {
  font-size: 1.1rem;
  line-height: 2.6;
}

.gap-input {
  display: inline-block !important;
  width: 4ch !important;
  min-width: 2ch;
  max-width: 24ch;
  padding: 0.05em 0.2em !important;
  margin: 0 0.1em;
  vertical-align: baseline;
  border-bottom: 2px solid var(--eo-green) !important;
  border-top: none !important;
  border-left: none !important;
  border-right: none !important;
  border-radius: 0 !important;
  background: transparent !important;
  font-size: 0.95em;
  box-sizing: content-box !important;
}

.gap-input:focus {
  outline: none;
  border-bottom-color: var(--eo-green-dark);
  background: rgba(0, 128, 0, 0.05);
}

/* ---- Vocab word ---- */
.vocab-word {
  font-size: 3rem;
  text-align: center;
  color: var(--eo-green);
  border: 2px solid var(--eo-green);
  border-radius: 0.5rem;
  padding: 1rem;
  margin: 1rem 0;
}

/* ---- Phrase display ---- */
.phrase {
  font-size: 2rem;
  text-align: center;
  color: #333;
  margin: 1rem 0;
  font-style: italic;
}

/* ---- Reading text ---- */
.reading-text {
  background: var(--reading-bg);
  color: var(--reading-color);
  padding: 1.5rem;
  border-left: 4px solid var(--eo-green);
  border-radius: 0 0.5rem 0.5rem 0;
  margin-bottom: 1rem;
}

/* ---- Result panel ---- */
.rezulto {
  margin-top: 1.5rem;
  padding: 1rem 1.5rem;
  border-radius: 0.5rem;
  animation: fadeIn 0.3s ease;
}

.rezulto.correct {
  background: var(--correct-bg);
  border-left: 4px solid var(--correct-border);
}

.rezulto.incorrect {
  background: var(--incorrect-bg);
  border-left: 4px solid var(--incorrect-border);
}

.rezulto-ikono {
  font-size: 1.5rem;
  font-weight: bold;
  margin-bottom: 0.5rem;
}

.delta-pos { color: var(--delta-pos); font-weight: bold; }
.delta-neg { color: var(--delta-neg); font-weight: bold; }

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

/* ---- Voting ---- */
.vochdonado {
  margin-top: 1rem;
}

.vote-buttons {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.vote-btn {
  background: none;
  border: 1px solid #ccc;
  border-radius: 0.25rem;
  padding: 0.2em 0.6em;
  cursor: pointer;
  font-size: 1rem;
  transition: background 0.15s;
}

.vote-btn.active {
  background: var(--eo-green);
  color: white;
  border-color: var(--eo-green);
}

.vote-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.vote-score {
  font-weight: bold;
  min-width: 2rem;
  text-align: center;
}

/* ---- Compact inline voting (result + peek) ---- */
.result-nav-row {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
}

.vote-inline {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  margin: 0;
}

.vote-arrow {
  background: none;
  border: 1px solid var(--pico-muted-border-color, #ccc);
  border-radius: 0.2rem;
  padding: 0.1em 0.4em;
  cursor: pointer;
  font-size: 0.85rem;
  line-height: 1;
  transition: background 0.15s;
}

.vote-arrow.active {
  background: var(--eo-green);
  color: white;
  border-color: var(--eo-green);
}

.vote-score-inline {
  font-weight: bold;
  min-width: 1.5rem;
  text-align: center;
  font-size: 0.9rem;
}

/* ---- Comments ---- */
.komentoj {
  margin-top: 2rem;
  border-top: 1px solid #dee2e6;
  padding-top: 1rem;
}

.comment {
  background: #f8f9fa;
  padding: 0.75rem 1rem;
  border-radius: 0.5rem;
  margin-bottom: 0.5rem;
}

.comment-author {
  color: #6c757d;
  font-size: 0.8rem;
}

/* ---- Magic link ---- */
.magic-link-container {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

.magic-link-container input {
  flex: 1;
  font-family: monospace;
  font-size: 0.85rem;
}

/* ---- Admin ---- */
.admin-toolbar {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1rem;
}

.filter-form {
  display: flex;
  gap: 0.5rem;
  margin: 0;
}

.filter-form select {
  margin: 0;
  width: auto;
}

.table-responsive {
  overflow-x: auto;
}

table td, table th {
  padding: 0.5rem 0.75rem;
}

/* Status badges */
.status-badge {
  display: inline-block;
  padding: 0.1em 0.4em;
  border-radius: 0.25em;
  font-size: 0.8rem;
  font-weight: bold;
}
.status-draft    { background: #e9ecef; color: #6c757d; }
.status-pending  { background: #fff3cd; color: #856404; }
.status-approved { background: #d4edda; color: #155724; }
.status-rejected { background: #f8d7da; color: #721c24; }

/* Moderation */
.moderation-item {
  border-left: 4px solid #ffc107;
}

.approve-btn {
  background: var(--eo-green);
  border-color: var(--eo-green);
  color: white;
  margin-right: 0.5rem;
}

.reject-btn {
  background: #dc3545;
  border-color: #dc3545;
  color: white;
}

/* ---- Judgment buttons (Anki-style) ---- */
/* "malfacile" = orange outline */
button[value="malfacile"] {
  background: transparent;
  border-color: #e07000;
  color: #b85c00;
}
button[value="malfacile"]:hover {
  background: #e07000;
  color: white;
}
/* "bone" = green outline */
button[value="bone"] {
  background: transparent;
  border-color: var(--eo-green);
  color: var(--eo-green-dark);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) button[value="bone"] {
    color: var(--eo-green-light);
    border-color: var(--eo-green-light);
  }
  :root:not([data-theme="light"]) button[value="malfacile"] {
    color: #e07000;
    border-color: #e07000;
  }
}
[data-theme="dark"] button[value="bone"] {
  color: var(--eo-green-light);
  border-color: var(--eo-green-light);
}
[data-theme="dark"] button[value="malfacile"] {
  color: #e07000;
  border-color: #e07000;
}
button[value="bone"]:hover {
  background: var(--eo-green);
  color: white;
}
/* "facile" = filled green */
button[value="facile"] {
  background: var(--eo-green);
  border-color: var(--eo-green);
  color: white;
}

/* ---- Easier / harder navigation buttons ---- */
a[href].outline, a[role="button"].outline {
  border-width: 2px;
}
/* easier = muted blue-gray, readable */
.next-buttons a.outline.secondary,
.next-buttons a[class*="outline secondary"] {
  border-color: #5f6b7a;
  color: #3d4a56;
  background: transparent;
}
.next-buttons a.outline.secondary:hover {
  background: #5f6b7a;
  color: white;
}
/* harder = amber */
.next-buttons a.outline:not(.secondary) {
  border-color: #b07a00;
  color: #7a5400;
  background: transparent;
}
.next-buttons a.outline:not(.secondary):hover {
  background: #b07a00;
  color: white;
}

/* ---- HTMX loading indicator ---- */
.htmx-indicator { display: none; }
.htmx-request .htmx-indicator { display: inline; }

/* ---- Footer ---- */
footer {
  border-top: 1px solid #dee2e6;
  margin-top: 2rem;
  padding-top: 1rem;
  color: #6c757d;
}

/* ---- Form actions ---- */
.form-actions {
  display: flex;
  gap: 0.75rem;
  align-items: center;
  margin-top: 1rem;
}

/* Hidden admin link — blends with nav background, visible on hover */
#admin-link {
  color: var(--pico-background-color, #1b1b32);
  text-decoration: none;
  font-size: 0.5rem;
  opacity: 0.15;
  transition: opacity 0.3s;
}
#admin-link:hover {
  opacity: 1;
  color: var(--pico-primary);
}

/* Responsive video embed */
.video-wrapper {
  position: relative;
  padding-bottom: 56.25%; /* 16:9 */
  height: 0;
  overflow: hidden;
  max-width: 100%;
  margin: 1rem 0;
}
.video-wrapper iframe {
  position: absolute;
  top: 0; left: 0;
  width: 100%; height: 100%;
  border: 0;
}

/* ---- CEFR level badges ---- */
.cefr-badge {
  display: inline-block;
  padding: 0.15em 0.5em;
  border-radius: 0.25em;
  font-size: 0.8rem;
  font-weight: bold;
  color: #fff;
  vertical-align: middle;
  letter-spacing: 0.05em;
}
.cefr-A0 { background: #9e9e9e; }
.cefr-A1 { background: #4caf50; }
.cefr-A2 { background: #2196f3; }
.cefr-B1 { background: #ff9800; }
.cefr-B2 { background: #f44336; }
.cefr-C1 { background: #9c27b0; }
.cefr-C2 { background: #212121; }

/* ---- Streak badge ---- */
.streak-badge {
  display: inline-block;
  padding: 0.15em 0.5em;
  border-radius: 0.25em;
  font-size: 0.8rem;
  background: #fff3cd;
  color: #856404;
  border: 1px solid #ffc107;
  vertical-align: middle;
}

/* ---- Level-up banner ---- */
.level-up-banner {
  background: linear-gradient(135deg, var(--eo-green), #00c853);
  color: #fff;
  text-align: center;
  padding: 0.75rem 1rem;
  border-radius: 0.5rem;
  font-size: 1.1rem;
  margin-bottom: 1rem;
  animation: level-up-pop 0.5s ease-out;
}
@keyframes level-up-pop {
  0%   { transform: scale(0.8); opacity: 0; }
  60%  { transform: scale(1.05); }
  100% { transform: scale(1); opacity: 1; }
}

/* ---- Exercise result card ---- */
.rezulto {
  border-radius: 0.5rem;
  padding: 1.25rem;
  margin-top: 1rem;
}
.rezulto.correct {
  border-left: 4px solid var(--correct-border);
  background: var(--correct-bg);
}
.rezulto.incorrect {
  border-left: 4px solid var(--incorrect-border);
  background: var(--incorrect-bg);
}
.rezulto-ikono {
  font-size: 1.4rem;
  font-weight: bold;
  margin-bottom: 0.5rem;
}

/* ---- Series progress bar ---- */
.series-progress {
  font-size: 0.85rem;
  color: var(--pico-muted-color, #666);
  margin-bottom: 0.5rem;
  letter-spacing: 0.1em;
}

/* ---- Child series buttons ---- */
.child-series-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin: 0.75rem 0;
}
.child-series-nav a[role="button"] {
  font-size: 0.9rem;
  padding: 0.3em 0.8em;
}

/* ---- Next buttons ---- */
.next-buttons ul {
  list-style: none;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 1rem;
}
.next-buttons li { margin: 0; }

/* ---- Difficulty-colored left border on exercise article ---- */
article.exercise-card {
  border-left: 4px solid transparent;
  border-radius: 0 0.25rem 0.25rem 0;
  padding-left: 1rem;
}
article.difficulty-easy   { border-left-color: #4caf50; }
article.difficulty-medium { border-left-color: #ff9800; }
article.difficulty-hard   { border-left-color: #f44336; }

/* ---- HTMX transition fade ---- */
.htmx-swapping { opacity: 0; transition: opacity 0.15s ease-out; }
.htmx-settling  { opacity: 1; transition: opacity 0.2s ease-in; }

/* ---- Hide community sections until answered ---- */
.post-answer-hidden {
  display: none;
}
.post-answer-visible {
  display: block;
}

/* ---- Contribute link in nav ---- */
nav a[href="/admin/enhavo/nova"] {
  color: var(--eo-green);
  font-weight: bold;
}

/* ---- Language switchers in nav ---- */
.lang-switchers {
  display: flex;
  align-items: center;
  gap: 0.25rem;
}
.lang-form {
  display: inline-flex;
  align-items: center;
  margin: 0;
  padding: 0;
}
.lang-form label {
  display: inline-flex;
  align-items: center;
  gap: 0.15rem;
  margin: 0;
  cursor: pointer;
  font-size: 1rem;
}
.lang-select {
  font-size: 0.75rem;
  padding: 0.1em 0.2em;
  border: 1px solid transparent;
  border-radius: 0.25em;
  background: transparent;
  cursor: pointer;
  color: inherit;
  max-width: 7rem;
  margin: 0;
  /* collapse to just the selected value width */
  width: auto;
}
.lang-select:hover, .lang-select:focus {
  border-color: var(--pico-muted-border-color, #ccc);
  background: var(--pico-background-color, #fff);
}

/* Datalist-based vocab lang picker */
.lang-input {
  font-size: 0.75rem;
  padding: 0.1em 0.2em;
  border: 1px solid transparent;
  border-radius: 0.25em;
  background: transparent;
  color: inherit;
  width: 5.5rem !important;
  flex-shrink: 0;
  margin: 0;
  min-height: unset !important;
  display: inline;
  transition: width 0.15s;
}
.lang-input:hover, .lang-input:focus {
  border-color: var(--pico-muted-border-color, #ccc);
  background: var(--pico-background-color, #fff);
  width: 9rem !important;
}

/* ---- Theme toggle ---- */
.theme-toggle {
  background: none;
  border: none;
  padding: 0.1em 0.2em;
  cursor: pointer;
  font-size: 1rem;
  opacity: 0.6;
  line-height: 1;
}
.theme-toggle:hover { opacity: 1; }

/* ---- Focus mode ---- */
.focus-toggle {
  background: none;
  border: none;
  padding: 0.1em 0.2em;
  cursor: pointer;
  font-size: 1rem;
  opacity: 0.5;
  line-height: 1;
}
.focus-toggle:hover { opacity: 1; }

/* Floating exit button — only visible in focus mode */
.focus-exit {
  display: none;
  position: fixed;
  bottom: 1rem;
  right: 1rem;
  z-index: 999;
  background: rgba(0,0,0,0.15);
  border: none;
  border-radius: 50%;
  width: 2.4rem;
  height: 2.4rem;
  font-size: 1.1rem;
  cursor: pointer;
  opacity: 0.4;
  transition: opacity 0.2s;
}
.focus-exit:hover { opacity: 1; }

body.focus-mode .focus-exit { display: flex; align-items: center; justify-content: center; }
body.focus-mode header { display: none; }
body.focus-mode footer { display: none; }
body.focus-mode .type-badge,
body.focus-mode .cefr-badge,
body.focus-mode .tag { display: none; }
body.focus-mode .series-pill-details { display: none; }
body.focus-mode .exercise-actions { display: none; }
body.focus-mode .contributor-bar { display: none; }
body.focus-mode .exercise-card { border-top: none; }

/* ---- RTL overrides ---- */
/* When dir="rtl" is set on <html>, the browser and Pico CSS handle most
   mirroring automatically. We only need to fix explicit left/right properties. */

[dir="rtl"] .reading-text {
  border-left: none;
  border-right: 4px solid var(--eo-green);
  border-radius: 0.5rem 0 0 0.5rem;
}

[dir="rtl"] .rezulto.correct {
  border-left: none;
  border-right: 4px solid var(--correct-border);
}

[dir="rtl"] .rezulto.incorrect {
  border-left: none;
  border-right: 4px solid var(--incorrect-border);
}

[dir="rtl"] article.exercise-card {
  border-left: none;
  border-right: 4px solid transparent;
  border-radius: 0.25rem 0 0 0.25rem;
  padding-left: 0;
  padding-right: 1rem;
}
[dir="rtl"] article.difficulty-easy   { border-right-color: #4caf50; }
[dir="rtl"] article.difficulty-medium { border-right-color: #ff9800; }
[dir="rtl"] article.difficulty-hard   { border-right-color: #f44336; }

[dir="rtl"] .moderation-item {
  border-left: none;
  border-right: 4px solid #ffc107;
}

[dir="rtl"] .approve-btn {
  margin-right: 0;
  margin-left: 0.5rem;
}

/* Input fields and textareas keep LTR for Esperanto answers */
[dir="rtl"] input[type="text"],
[dir="rtl"] input[type="search"],
[dir="rtl"] textarea {
  direction: ltr;
  text-align: left;
}

/* Vocab and phrase displays are Esperanto — keep LTR */
[dir="rtl"] .vocab-word,
[dir="rtl"] .phrase {
  direction: ltr;
}

/* ---- Vocab mode switcher ---- */
.vocab-mode-switch {
  display: flex;
  gap: 0.4rem;
  flex-wrap: wrap;
  margin-bottom: 0.8rem;
}
.vocab-mode-switch a {
  font-size: 0.8rem;
  padding: 0.2em 0.6em;
  border: 1px solid var(--pico-muted-border-color);
  border-radius: 1em;
  text-decoration: none;
  color: var(--pico-muted-color);
}
.vocab-mode-switch a[aria-current="page"] {
  background: var(--eo-green);
  border-color: var(--eo-green);
  color: #fff;
  font-weight: bold;
}
.vocab-mode-switch a:hover:not([aria-current="page"]) {
  border-color: var(--eo-green);
  color: var(--eo-green);
}

/* ---- Flashcard ---- */
.flashcard {
  margin: 0.5rem 0;
}
.flashcard-front,
.flashcard-back {
  padding: 1rem;
  border: 2px solid var(--pico-muted-border-color);
  border-radius: 0.5rem;
  text-align: center;
  background: var(--pico-card-background-color);
}
.flashcard-back {
  border-color: var(--eo-green);
}
.flashcard-front button,
.flashcard-back button {
  margin-top: 0.8rem;
}

/* ---- Clickable words in reading texts ---- */
.reading-text a.eo-word {
  color: inherit;
  text-decoration: underline;
  text-decoration-color: var(--eo-green);
  text-decoration-style: dotted;
  text-underline-offset: 3px;
  cursor: pointer;
  position: relative;
}
.reading-text a.eo-word:hover {
  color: var(--eo-green);
}
/* CSS tooltip: shows data-def on hover */
.reading-text a.eo-word[data-def]:hover::after {
  content: attr(data-def);
  position: absolute;
  bottom: 125%;
  left: 50%;
  transform: translateX(-50%);
  background: var(--pico-contrast-background, #222);
  color: var(--pico-contrast-inverse, #fff);
  padding: 0.25em 0.5em;
  border-radius: 4px;
  white-space: nowrap;
  font-size: 0.8em;
  pointer-events: none;
  z-index: 100;
  box-shadow: 0 2px 6px rgba(0,0,0,0.3);
}

/* ---- User ID / username in footer ---- */
.user-id-badge a {
  color: var(--pico-muted-color);
  text-decoration: none;
  font-family: monospace;
  font-size: 0.75em;
}
.user-id-badge a:hover {
  color: var(--eo-green);
}

/* ---- Vortaro tag filter pills ---- */
.tag-filter-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
  margin: 0.5rem 0 0.75rem;
}
.tag-filter-nav a {
  display: inline-block;
  padding: 0.2em 0.6em;
  border-radius: 999px;
  border: 1px solid var(--pico-muted-border-color);
  font-size: 0.8em;
  text-decoration: none;
  color: var(--pico-muted-color);
}
.tag-filter-nav a:hover {
  border-color: var(--eo-green);
  color: var(--eo-green);
}
.tag-filter-nav a[aria-current="page"] {
  background: var(--eo-green);
  border-color: var(--eo-green);
  color: #fff;
}

/* ---- Pagination ---- */
.pagination {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
  margin: 1rem 0;
  align-items: center;
}
.pagination a {
  display: inline-block;
  padding: 0.25em 0.6em;
  border: 1px solid var(--pico-muted-border-color);
  border-radius: 4px;
  text-decoration: none;
  font-size: 0.85em;
  color: var(--pico-color);
  min-width: 2em;
  text-align: center;
}
.pagination a:hover {
  border-color: var(--eo-green);
  color: var(--eo-green);
}
.pagination a[aria-current="page"] {
  background: var(--eo-green);
  border-color: var(--eo-green);
  color: #fff;
  font-weight: bold;
}

/* ── Favorites star + admin edit buttons on exercises ── */
.exercise-actions {
  margin-left: auto;
  display: inline-flex;
  gap: 0.25rem;
  align-items: center;
}
.icon-btn {
  background: none;
  border: none;
  padding: 0.1rem 0.3rem;
  font-size: 1.1rem;
  cursor: pointer;
  color: var(--pico-muted-color);
  line-height: 1;
  text-decoration: none;
  border-radius: 4px;
}
.icon-btn:hover {
  color: var(--pico-primary);
  background: var(--pico-primary-background);
}


.dolt-suggestions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-bottom: 0.75rem;
}
.dolt-suggestion-btn {
  font-size: 0.85rem;
  padding: 0.2rem 0.6rem;
  cursor: pointer;
}

.eo-definition {
  font-size: 0.9rem;
  border-left: 3px solid var(--pico-muted-border-color);
  margin: 0.5rem 0 0.75rem;
  padding: 0.3rem 0.75rem;
  color: var(--pico-muted-color);
}
.def-source {
  font-style: normal;
  opacity: 0.7;
}

.series-skip-nav {
  margin-top: 1rem;
  text-align: right;
}
.series-skip-nav a {
  font-size: 0.9rem;
}

.parent-panel {
  margin-bottom: 1rem;
  border: 1px solid var(--pico-muted-border-color);
  border-radius: 6px;
  padding: 0.5rem 0.75rem;
  background: var(--pico-card-background-color);
}
.parent-panel summary {
  font-size: 0.9em;
  color: var(--pico-muted-color);
  cursor: pointer;
  list-style: none;
}
.parent-panel summary::before {
  content: '▶ ';
  font-size: 0.75em;
}
.parent-panel[open] summary::before {
  content: '▼ ';
}

/* ---- Series pill (header badge → popover with series list) ---- */
.series-pill-details {
  display: inline-block;
  position: relative;
}
.series-pill-details > summary {
  list-style: none;
  cursor: pointer;
  user-select: none;
}
.series-pill-details > summary::-webkit-details-marker { display: none; }
.series-pill-popover {
  position: absolute;
  z-index: 200;
  top: calc(100% + 4px);
  left: 0;
  min-width: 14rem;
  max-width: 22rem;
  background: var(--pico-card-background-color, #fff);
  border: 1px solid var(--pico-muted-border-color);
  border-radius: 8px;
  padding: 0.5rem 0.75rem;
  box-shadow: 0 4px 16px rgba(0,0,0,0.15);
}
.series-item-list {
  margin: 0;
  padding: 0 0 0 1.2rem;
  font-size: 0.85rem;
  max-height: 14rem;
  overflow-y: auto;
}
.series-item-list li {
  margin: 0.15rem 0;
}
.series-item-list li.series-item-current {
  font-weight: bold;
}
.series-item-list li.series-item-current a {
  color: var(--eo-green);
}
.series-pos {
  font-size: 0.8em;
  opacity: 0.75;
}

/* ── Series badge pill (header summary trigger) ── */
.series-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.3em;
  background: var(--pico-card-background-color, #f0f0f0);
  border: 1px solid var(--pico-muted-border-color, #ccc);
  border-radius: 999px;
  padding: 0.15em 0.6em;
  font-size: 0.8rem;
  font-weight: normal;
  cursor: pointer;
  white-space: nowrap;
  max-width: 14rem;
  overflow: hidden;
  text-overflow: ellipsis;
}
.series-badge:hover {
  border-color: var(--eo-green);
  color: var(--eo-green);
}

/* ── Consistent minimum touch target for all interactive elements ── */
/* Only applied where Pico's natural height might be too small */
.anki-buttons button,
.submit-row button,
.next-buttons a[role="button"] {
  min-height: 2.75rem;
}

/* ── Anki / judgment buttons: CSS grid for guaranteed equal size ── */
.anki-buttons ul {
  list-style: none;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.5rem;
  margin: 0.75rem 0;
}
.anki-buttons ul li {
  margin: 0;
}
.anki-buttons ul li button {
  width: 100%;
  height: 100%;
  white-space: normal;
  text-align: center;
}
@media (max-width: 480px) {
  .anki-buttons ul {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* ── Submit row: grid keeps both buttons the same height ── */
.submit-row ul {
  list-style: none;
  padding: 0;
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 0.5rem;
  margin: 0.75rem 0;
}
.submit-row ul li {
  margin: 0;
}
.submit-row ul li button {
  width: 100%;
  height: 100%;
}

/* ── Next buttons: stack vertically on mobile ── */
@media (max-width: 600px) {
  .next-buttons ul {
    flex-direction: column;
  }
  .next-buttons li {
    width: 100%;
  }
  .next-buttons a[role="button"] {
    display: block;
    text-align: center;
    box-sizing: border-box;
    width: 100%;
  }
}

/* ── Child series nav: stack on mobile ── */
@media (max-width: 600px) {
  .child-series-nav {
    flex-direction: column;
  }
  .child-series-nav a[role="button"] {
    width: 100%;
    text-align: center;
    box-sizing: border-box;
  }
}

/* ── Series pill popover: anchor to bottom of screen on very narrow phones ── */
@media (max-width: 480px) {
  .series-pill-popover {
    position: fixed;
    left: 1rem;
    right: 1rem;
    bottom: 1rem;
    top: auto;
    max-width: none;
    min-width: 0;
    z-index: 500;
  }
}

/* ── Mobile nav: collapse search + shrink lang dropdowns ── */
@media (max-width: 640px) {
  .nav-search {
    width: 2.4rem;
    min-width: 0;
    padding-inline: 0.35rem;
    transition: width 0.2s ease;
  }
  .nav-search:focus {
    width: 9rem;
  }
  .lang-select {
    max-width: 4.5rem;
    font-size: 0.7rem;
  }
}

/* ── Shared "small" button style (replaces scattered inline style="padding:...") ── */
.btn-sm {
  font-size: 0.8rem;
  padding: 0.2em 0.6em;
  min-height: unset;
}

/* ── Series browser (/serioj) ── */
.series-browser-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(14rem, 1fr));
  gap: 0.6rem;
  margin: 0.75rem 0 1.5rem;
}
.series-browser-card {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.6rem 0.9rem;
  border: 1px solid var(--pico-muted-border-color);
  border-radius: 0.4rem;
  text-decoration: none;
  color: var(--pico-color);
  background: var(--pico-card-background-color);
  transition: border-color 0.15s, background 0.15s;
}
.series-browser-card:hover {
  border-color: var(--eo-green);
  background: var(--pico-primary-background, rgba(0,128,0,0.05));
  color: var(--pico-color);
}

/* ── Contributor edit bar (bottom of exercise card) ── */
.contributor-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-top: 1.25rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--pico-muted-border-color, #dee2e6);
}
