* { box-sizing: border-box; }

.hidden { display: none !important; }

:root {
  color-scheme: dark;
  --bg: #10151a;
  --surface: #1a2129;
  --surface-2: #212b34;
  --border: #2c3944;
  --text: #eef2f5;
  --text-dim: #8fa1ac;
  --accent: #f2c14e;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Segoe UI", "Helvetica Neue", Arial, sans-serif;
  min-height: 100vh;
}

/* desktop: show the cards larger (phones keep their 1:1 size) */
@media (min-width: 521px) {
  body { zoom: 1.4; }
}

.wrap {
  max-width: 560px;
  margin: 0 auto;
  padding: 28px 16px 60px;
}

header.app-header {
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

header.app-header h1 {
  font-size: 22px;
  margin: 0;
  letter-spacing: 0.5px;
}

header.app-header h1 span {
  color: var(--accent);
}

#category-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 24px;
}

.cat-btn {
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text-dim);
  padding: 8px 14px;
  border-radius: 999px;
  font-size: 13px;
  cursor: pointer;
  transition: border-color 0.1s, color 0.1s;
}

.cat-btn:hover { border-color: var(--accent); color: var(--text); }

.cat-btn.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #1a1a1a;
  font-weight: 600;
}

.mode-row {
  margin-bottom: 20px;
}

#floating-controls {
  position: fixed;
  top: 16px;
  right: 16px;
  z-index: 100;
  display: flex;
  gap: 8px;
}

.floating-btn {
  background: var(--accent);
  color: #1a1a1a;
  border: none;
  padding: 10px 18px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.35);
}

.floating-btn:hover { opacity: 0.9; }

.floating-btn.secondary {
  background: var(--surface-2);
  color: var(--text-dim);
  border: 1px solid var(--border);
}

.floating-btn.secondary.active {
  background: var(--accent);
  color: #1a1a1a;
  border-color: var(--accent);
}

#grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-bottom: 20px;
}

.flash-cell {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 16px 8px;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.15s, transform 0.1s;
}

.flash-cell:hover { border-color: var(--accent); }
.flash-cell:active { transform: scale(0.97); }

.flash-cell.quiz-hidden .german-word {
  visibility: hidden;
}

.flash-cell.speaking {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent);
}

.emoji { font-size: 96px; line-height: 1; }
.emoji-multi { font-size: 56px; letter-spacing: 4px; }
.numeral { font-size: 88px; font-weight: 700; color: var(--accent); }
.numeral-sm { font-size: 56px; }
/* Every card gets the same square picture box, so the words line up across
   a row whatever the picture type (image, swatch, emoji, numeral). */
.media { width: 100%; max-width: 120px; aspect-ratio: 1; display: flex; align-items: center; justify-content: center; flex: none; }
.media .emoji, .media .numeral { max-width: 100%; overflow: hidden; }
.swatch { width: 100%; aspect-ratio: 1; height: auto; border-radius: 14px; margin: 0 auto; border: 2px solid rgba(255,255,255,0.15); }
.illus { display: flex; align-items: center; justify-content: center; width: 100%; aspect-ratio: 1; height: auto; margin: 0 auto; border-radius: 14px; overflow: hidden; border: 2px solid rgba(255,255,255,0.15); background: #fff; }
.illus img { width: 100%; height: 100%; object-fit: contain; display: block; }

.german-word {
  font-family: inherit;
  font-size: 19px;
  font-weight: 700;
  margin-top: 12px;
  color: var(--accent);
  overflow-wrap: anywhere;
}

.english-word {
  font-family: inherit;
  font-size: 16px;
  font-weight: 600;
  color: var(--text-dim);
  overflow-wrap: anywhere;
  margin-top: 2px;
}

.hint {
  font-size: 12px;
  color: var(--text-dim);
  margin-bottom: 12px;
}

@media (max-width: 520px) {
  .wrap { padding: 20px 12px 48px; }
  #grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .flash-cell { padding: 14px 8px 12px; border-radius: 14px; }
  .media { max-width: 132px; }
  /* Quiz buttons go to the bottom on phones so they don't cover the header. */
  #floating-controls { top: auto; right: 12px; left: 12px; justify-content: center; bottom: calc(12px + env(safe-area-inset-bottom, 0px)); }
  .wrap { padding-bottom: 96px; }
  .german-word { font-size: 17px; margin-top: 10px; }
  .english-word { font-size: 14px; }
  .emoji { font-size: 72px; }
  .numeral { font-size: 72px; }
  #category-bar { gap: 6px; margin-bottom: 18px; }
  .cat-btn { padding: 7px 12px; }
}

/* ── report bad picture ── */
.report-btn {
  position: absolute;
  top: 6px;
  right: 6px;
  z-index: 1;
  width: 28px;
  height: 28px;
  padding: 0;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text-dim);
  font-size: 13px;
  line-height: 1;
  cursor: pointer;
  opacity: 0.55;
}
.report-btn:hover { opacity: 1; color: #ff7a6b; border-color: #ff7a6b; }
.report-btn.reported { opacity: 1; background: #ff7a6b; border-color: #ff7a6b; color: #1a1a1a; }

#reports-panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 14px;
  margin-bottom: 20px;
}
.reports-head { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.reports-actions { display: flex; flex-wrap: wrap; gap: 6px; }
.cat-btn.danger:hover { border-color: #ff7a6b; color: #ff7a6b; }
#reports-list { list-style: none; margin: 0; padding: 0; max-height: 50vh; overflow-y: auto; }
#reports-list li { display: flex; align-items: center; gap: 10px; padding: 6px 0; border-top: 1px solid var(--border); font-size: 14px; }
#reports-list li:first-child { border-top: none; }
#reports-list img { width: 36px; height: 36px; border-radius: 6px; object-fit: contain; background: #fff; flex: none; }
#reports-list li span { flex: 1; min-width: 0; overflow-wrap: anywhere; }
#reports-list b { color: var(--accent); }
#reports-list i { color: var(--text-dim); font-style: normal; }
#reports-list li button { padding: 4px 10px; }
.reports-empty { color: var(--text-dim); }

.nav-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.nav-row button {
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 12px 20px;
  border-radius: 10px;
  cursor: pointer;
  font-size: 14px;
}

.nav-row button:hover { border-color: var(--accent); }

#progress-label {
  font-size: 13px;
  color: var(--text-dim);
}

/* ── filters in a dropdown ── */
#category-bar { position: relative; display: block; margin-bottom: 18px; }
.filter-toggle { display: inline-flex; align-items: center; gap: 8px; }
.filter-toggle .chev { font-size: 11px; opacity: .7; }
.filter-panel { display: none; position: absolute; z-index: 30; top: calc(100% + 6px); left: 0;
  width: max-content; max-width: min(620px, 92vw); flex-wrap: wrap; gap: 8px; padding: 12px;
  background: var(--surface-2); border: 1px solid var(--border); border-radius: 16px;
  box-shadow: 0 18px 44px rgba(0,0,0,.45); }
#category-bar.open .filter-panel { display: flex; }
.mode-row { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 8px; }

/* ── mobile: a thin slider on the right to scrub through the cards fast ── */
#card-slider { display: none; }
@media (max-width: 560px) {
  #card-slider {
    display: block; position: fixed; right: 4px; top: 50%; transform: translateY(-50%);
    writing-mode: vertical-lr; direction: rtl;
    width: 22px; height: 46vh; z-index: 55; accent-color: var(--accent); opacity: .85;
    background: transparent;
  }
  #deck { padding-right: 26px; }   /* keep cards clear of the slider */
}
