/* ===== RESET & BASE ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; }

:root {
  --bg: #1a1a1a;
  --bg-2: #111111;
  --surface: #2a2a2a;
  --surface-2: #333333;
  --surface-3: #3a3a3a;
  --border: #404040;
  --border-light: #555;
  --text: #e8e4de;
  --text-muted: #9a9590;
  --text-faint: #8a847d;
  --accent: #c8a45c;
  --accent-hover: #d4b46c;
  --accent-dim: rgba(200,164,92,0.15);
  --accent-dim2: rgba(200,164,92,0.08);
  --success: #6daa45;
  --error: #d16363;
  --info: #5b9bd5;
  --radius: 8px;
  --radius-lg: 12px;
  --radius-xl: 16px;
  --transition: 200ms cubic-bezier(0.16, 1, 0.3, 1);
  --font-body: 'Satoshi', -apple-system, sans-serif;
  --font-display: 'General Sans', -apple-system, sans-serif;
  --shadow: 0 4px 24px rgba(0,0,0,0.3);
  --shadow-sm: 0 2px 8px rgba(0,0,0,0.2);
}

body {
  min-height: 100dvh;
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.6;
  color: var(--text);
  background: var(--bg);
  overflow-x: hidden;
}

/* ===== SCROLLBAR ===== */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--accent); }

/* ===== HEADER ===== */
.app-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  background: rgba(26,26,26,0.92);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border);
  padding: 0 24px;
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 18px;
  color: var(--accent);
  cursor: default;
}

.logo svg {
  width: 28px;
  height: 28px;
}

/* ===== NAV TABS ===== */
.nav-tabs {
  display: flex;
  gap: 2px;
  background: var(--surface);
  border-radius: var(--radius);
  padding: 3px;
}

.nav-tab {
  padding: 8px 18px;
  border-radius: 6px;
  font-family: var(--font-body);
  font-size: 14px;
  font-weight: 500;
  color: var(--text-muted);
  cursor: pointer;
  transition: all var(--transition);
  border: none;
  background: none;
  white-space: nowrap;
}

.nav-tab:hover {
  color: var(--text);
  background: var(--surface-2);
}

.nav-tab.active {
  color: var(--bg);
  background: var(--accent);
  font-weight: 600;
}

/* ===== MOBILE NAV ===== */
.mobile-nav {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 100;
  background: rgba(26,26,26,0.95);
  backdrop-filter: blur(20px);
  border-top: 1px solid var(--border);
  padding: 6px 8px;
  padding-bottom: max(6px, env(safe-area-inset-bottom));
}

.mobile-nav-inner {
  display: flex;
  justify-content: space-around;
}

.mobile-tab {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  min-height: 44px;
  padding: 6px 8px;
  border-radius: var(--radius);
  color: var(--text-muted);
  font-size: 10px;
  font-weight: 500;
  cursor: pointer;
  border: none;
  background: none;
  transition: all var(--transition);
}

.mobile-tab svg {
  width: 20px;
  height: 20px;
}

.mobile-tab.active {
  color: var(--accent);
}

/* ===== MAIN CONTENT ===== */
.main-content {
  margin-top: 60px;
  min-height: calc(100dvh - 60px);
}

.page {
  display: none;
  animation: fadeIn 0.3s ease;
}

.page.active {
  display: block;
}

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

@keyframes slideUp {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ===== BROWSE PAGE ===== */
.browse-header {
  padding: 32px 24px 16px;
  max-width: 1400px;
  margin: 0 auto;
}

.browse-title {
  font-family: var(--font-display);
  font-size: clamp(24px, 4vw, 36px);
  font-weight: 700;
  color: var(--text);
  margin-bottom: 20px;
}

.browse-title span {
  color: var(--accent);
}

.filters-row {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  align-items: center;
  margin-bottom: 8px;
}

.search-box {
  flex: 1;
  min-width: 200px;
  max-width: 400px;
  position: relative;
}

.search-box input {
  width: 100%;
  padding: 10px 16px 10px 40px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-size: 14px;
  font-family: var(--font-body);
  transition: border-color var(--transition);
}

.search-box input:focus {
  border-color: var(--accent);
}

.search-box svg {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  width: 18px;
  height: 18px;
  color: var(--text-muted);
  pointer-events: none;
}

.filter-select {
  padding: 10px 32px 10px 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-size: 14px;
  font-family: var(--font-body);
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg width='12' height='8' viewBox='0 0 12 8' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1L6 6L11 1' stroke='%239a9590' stroke-width='2' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  transition: border-color var(--transition);
}

.filter-select:focus {
  border-color: var(--accent);
}

.filter-select option {
  background: var(--surface);
  color: var(--text);
}

.results-count {
  font-size: 13px;
  color: var(--text-muted);
  padding: 8px 0;
}

/* ===== ARTIST GRID ===== */
.artists-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 20px;
  padding: 0 24px 40px;
  max-width: 1400px;
  margin: 0 auto;
}

.artist-card {
  background: var(--surface);
  border-radius: var(--radius-lg);
  overflow: hidden;
  cursor: pointer;
  transition: all var(--transition);
  border: 1px solid transparent;
}

.artist-card:hover {
  transform: translateY(-4px);
  border-color: var(--accent);
  box-shadow: var(--shadow);
}

.artist-card-img {
  width: 100%;
  height: 200px;
  object-fit: cover;
  background: var(--bg-2);
}

.artist-card-placeholder {
  width: 100%;
  height: 200px;
  background: linear-gradient(135deg, var(--surface-2) 0%, var(--bg-2) 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-faint);
  font-size: 36px;
  font-family: var(--font-display);
  font-weight: 700;
  letter-spacing: 2px;
}

.artist-card-body {
  padding: 16px;
}

.artist-card-name {
  font-family: var(--font-display);
  font-size: 17px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 2px;
}

.artist-card-orig {
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.artist-card-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 8px;
}

.tag {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 500;
  background: var(--accent-dim);
  color: var(--accent);
}

.tag.region {
  background: rgba(91,155,213,0.15);
  color: var(--info);
}

.artist-card-years {
  font-size: 13px;
  color: var(--text-faint);
}

.artist-card-works {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 4px;
}

/* ===== ARTIST DETAIL MODAL ===== */
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: rgba(0,0,0,0.7);
  backdrop-filter: blur(8px);
  display: none;
  justify-content: center;
  align-items: flex-start;
  overflow-y: auto;
  padding: 40px 16px;
}

.modal-overlay.open {
  display: flex;
}

.modal {
  background: var(--bg);
  border-radius: var(--radius-xl);
  width: 100%;
  max-width: 900px;
  border: 1px solid var(--border);
  animation: slideUp 0.3s ease;
  margin-bottom: 40px;
}

.modal-close {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  justify-content: flex-end;
  padding: 16px 20px 0;
}

.modal-close-btn {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text-muted);
  cursor: pointer;
  transition: all var(--transition);
}

.modal-close-btn:hover {
  color: var(--text);
  background: var(--surface-2);
}

.modal-header {
  padding: 8px 32px 24px;
}

.modal-artist-name {
  font-family: var(--font-display);
  font-size: clamp(24px, 4vw, 32px);
  font-weight: 700;
  margin-bottom: 4px;
}

.modal-artist-orig {
  font-size: 15px;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.modal-artist-years {
  font-size: 14px;
  color: var(--accent);
  margin-bottom: 4px;
}

.modal-artist-country {
  font-size: 14px;
  color: var(--text-muted);
  margin-bottom: 16px;
}

.modal-section-title {
  font-family: var(--font-display);
  font-size: 16px;
  font-weight: 600;
  color: var(--accent);
  margin-bottom: 8px;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.modal-text {
  font-size: 15px;
  line-height: 1.7;
  color: var(--text);
  margin-bottom: 24px;
  max-width: 72ch;
}

.modal-body {
  padding: 0 32px 32px;
}

.modal-works-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 16px;
  margin-top: 16px;
}

.work-card {
  background: var(--surface);
  border-radius: var(--radius);
  overflow: hidden;
  transition: all var(--transition);
  border: 1px solid transparent;
}

.work-card:hover {
  border-color: var(--accent);
  box-shadow: var(--shadow-sm);
}

.work-card-img {
  width: 100%;
  height: 180px;
  object-fit: cover;
  background: var(--bg-2);
}

.work-card-body {
  padding: 12px;
}

.work-card-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 4px;
  line-height: 1.3;
}

.work-card-year {
  font-size: 12px;
  color: var(--accent);
  margin-bottom: 2px;
}

.work-card-location {
  font-size: 12px;
  color: var(--text-muted);
}

/* ===== IMAGE LIGHTBOX ===== */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 300;
  background: rgba(0,0,0,0.92);
  display: none;
  align-items: center;
  justify-content: center;
  cursor: zoom-out;
  padding: 20px;
}

.lightbox.open {
  display: flex;
}

.lightbox img {
  max-width: 95vw;
  max-height: 90vh;
  object-fit: contain;
  border-radius: var(--radius);
}

.lightbox-caption {
  position: absolute;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(26,26,26,0.9);
  padding: 8px 20px;
  border-radius: var(--radius);
  font-size: 14px;
  color: var(--text);
  text-align: center;
  max-width: 90%;
  pointer-events: none;
}

/* ===== LEARN PAGE ===== */
.learn-page {
  max-width: 800px;
  margin: 0 auto;
  padding: 32px 24px;
}

.learn-header {
  margin-bottom: 24px;
}

.learn-title {
  font-family: var(--font-display);
  font-size: clamp(24px, 4vw, 32px);
  font-weight: 700;
  margin-bottom: 8px;
}

.learn-subtitle {
  color: var(--text-muted);
  font-size: 15px;
}

.learn-mode-selector {
  display: flex;
  gap: 8px;
  margin-bottom: 24px;
  flex-wrap: wrap;
}

.learn-mode-btn {
  padding: 10px 20px;
  border-radius: var(--radius);
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition);
}

.learn-mode-btn:hover {
  background: var(--surface-2);
  color: var(--text);
}

.learn-mode-btn.active {
  background: var(--accent-dim);
  border-color: var(--accent);
  color: var(--accent);
}

/* Flashcard */
.flashcard-container {
  perspective: 1000px;
  margin-bottom: 24px;
}

.flashcard {
  position: relative;
  width: 100%;
  min-height: 560px;
  transition: transform 0.6s;
  transform-style: preserve-3d;
  cursor: pointer;
}

.flashcard.flipped {
  transform: rotateY(180deg);
}

.flashcard-front, .flashcard-back {
  position: absolute;
  inset: 0;
  backface-visibility: hidden;
  border-radius: var(--radius-lg);
  background: var(--surface);
  border: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 28px;
  background:
    radial-gradient(circle at top, rgba(200,164,92,0.12), transparent 52%),
    linear-gradient(180deg, rgba(255,255,255,0.02), transparent 35%),
    var(--surface);
}

.flashcard-back {
  transform: rotateY(180deg);
}

.flashcard-img {
  max-width: 100%;
  width: min(100%, 720px);
  max-height: 470px;
  object-fit: contain;
  border-radius: var(--radius-lg);
  margin-bottom: 20px;
  background: rgba(0,0,0,0.2);
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.04);
}

.flashcard-question {
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 600;
  color: var(--text);
  text-align: center;
  margin-bottom: 8px;
}

.flashcard-hint {
  font-size: 14px;
  color: var(--text-muted);
  text-align: center;
}

.flashcard-answer-title {
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 700;
  color: var(--accent);
  text-align: center;
  margin-bottom: 8px;
}

.flashcard-answer-info {
  font-size: 15px;
  color: var(--text);
  text-align: center;
  margin-bottom: 4px;
}

.flashcard-controls {
  display: flex;
  gap: 12px;
  justify-content: center;
}

.fc-btn {
  padding: 12px 28px;
  border-radius: var(--radius);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition);
  border: 1px solid;
}

.fc-btn.wrong {
  background: rgba(209,99,99,0.1);
  border-color: var(--error);
  color: var(--error);
}

.fc-btn.wrong:hover {
  background: rgba(209,99,99,0.2);
}

.fc-btn.right {
  background: rgba(109,170,69,0.1);
  border-color: var(--success);
  color: var(--success);
}

.fc-btn.right:hover {
  background: rgba(109,170,69,0.2);
}

.fc-btn.next {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--bg);
}

.fc-btn.next:hover {
  background: var(--accent-hover);
}

.fc-btn:disabled {
  opacity: 0.5;
  cursor: default;
}

/* Progress stats */
.progress-section {
  background: var(--surface);
  border-radius: var(--radius-lg);
  padding: 20px;
  margin-bottom: 24px;
  border: 1px solid var(--border);
}

.progress-title {
  font-family: var(--font-display);
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 6px;
  color: var(--accent);
}

.progress-copy {
  font-size: 13px;
  line-height: 1.5;
  color: var(--text-muted);
  margin-bottom: 16px;
}

.progress-bars {
  display: grid;
  gap: 14px;
}

.progress-century {
  display: grid;
  gap: 6px;
}

.progress-item {
  display: flex;
  align-items: center;
  gap: 12px;
}

.progress-label {
  font-size: 13px;
  color: var(--text-muted);
  min-width: 100px;
  flex-shrink: 0;
}

.progress-bar {
  flex: 1;
  height: 8px;
  background: var(--bg);
  border-radius: 4px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 4px;
  transition: width 0.5s ease;
}

.progress-pct {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  min-width: 36px;
  text-align: right;
}

.progress-subtext {
  font-size: 12px;
  color: var(--text-faint);
  padding-left: 112px;
}

/* ===== QUIZ PAGE ===== */
.quiz-page {
  max-width: 700px;
  margin: 0 auto;
  padding: 32px 24px;
}

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

.quiz-title {
  font-family: var(--font-display);
  font-size: clamp(24px, 4vw, 32px);
  font-weight: 700;
}

.quiz-stats {
  display: flex;
  gap: 16px;
  align-items: center;
}

.quiz-stat {
  text-align: center;
}

.quiz-stat-value {
  font-family: var(--font-display);
  font-size: 24px;
  font-weight: 700;
  color: var(--accent);
}

.quiz-stat-label {
  font-size: 11px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.quiz-settings {
  display: flex;
  gap: 8px;
  margin-bottom: 24px;
  flex-wrap: wrap;
}

.quiz-card {
  background: var(--surface);
  border-radius: var(--radius-lg);
  padding: 24px;
  border: 1px solid var(--border);
  margin-bottom: 20px;
}

.quiz-image {
  width: 100%;
  max-height: 350px;
  object-fit: contain;
  border-radius: var(--radius);
  margin-bottom: 16px;
  background: var(--bg-2);
}

.quiz-question {
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 600;
  margin-bottom: 16px;
  line-height: 1.4;
}

.quiz-options {
  display: grid;
  gap: 8px;
}

.quiz-option {
  padding: 14px 18px;
  border-radius: var(--radius);
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--text);
  font-size: 15px;
  cursor: pointer;
  transition: all var(--transition);
  text-align: left;
}

.quiz-option:hover:not(.selected) {
  border-color: var(--accent);
  background: var(--accent-dim2);
}

.quiz-option.correct {
  border-color: var(--success);
  background: rgba(109,170,69,0.15);
  color: var(--success);
}

.quiz-option.wrong {
  border-color: var(--error);
  background: rgba(209,99,99,0.15);
  color: var(--error);
}

.quiz-option.selected {
  pointer-events: none;
}

.quiz-next-btn {
  display: block;
  width: 100%;
  padding: 14px;
  margin-top: 16px;
  border-radius: var(--radius);
  background: var(--accent);
  border: none;
  color: var(--bg);
  font-size: 15px;
  font-weight: 600;
  font-family: var(--font-body);
  cursor: pointer;
  transition: all var(--transition);
}

.quiz-next-btn:hover {
  background: var(--accent-hover);
}

.streak-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 12px;
  border-radius: 20px;
  background: rgba(200,164,92,0.15);
  color: var(--accent);
  font-size: 13px;
  font-weight: 600;
}

/* ===== TIMELINE PAGE ===== */
.timeline-page {
  padding: 32px 0;
}

.timeline-header {
  padding: 0 24px 24px;
  max-width: 1400px;
  margin: 0 auto;
}

.timeline-title {
  font-family: var(--font-display);
  font-size: clamp(24px, 4vw, 32px);
  font-weight: 700;
  margin-bottom: 8px;
}

.timeline-subtitle {
  font-size: 15px;
  color: var(--text-muted);
  margin-bottom: 16px;
}

.timeline-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 8px;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--text-muted);
}

.legend-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
}

.timeline-container {
  overflow-x: auto;
  overflow-y: visible;
  padding: 20px 24px 60px;
  position: relative;
  cursor: grab;
  user-select: none;
}

.timeline-scroll {
  position: relative;
  min-height: 500px;
}

.timeline-container.dragging {
  cursor: grabbing;
}

.timeline-container.dragging .timeline-item {
  transition: none;
}

.timeline-axis {
  position: absolute;
  top: 50%;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--border);
}

.timeline-region-label {
  position: absolute;
  left: 0;
  font-family: var(--font-display);
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 1px;
  writing-mode: vertical-rl;
  transform: rotate(180deg);
}

.timeline-marker {
  position: absolute;
  top: 50%;
  width: 1px;
  background: var(--border);
  height: 20px;
  transform: translateY(-50%);
}

.timeline-marker-label {
  position: absolute;
  top: 50%;
  transform: translateX(-50%);
  font-size: 12px;
  color: var(--text-faint);
  white-space: nowrap;
  margin-top: 18px;
}

.timeline-item {
  position: absolute;
  transform: translateX(-50%);
  cursor: pointer;
  transition: all var(--transition);
  z-index: 1;
}

.timeline-item:hover {
  z-index: 10;
  transform: translateX(-50%) scale(1.05);
}

.timeline-dot {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 2px solid var(--bg);
  margin: 0 auto 4px;
  transition: all var(--transition);
}

.timeline-item:hover .timeline-dot {
  transform: scale(1.3);
  box-shadow: 0 0 12px currentColor;
}

.timeline-item-name {
  font-size: 11px;
  font-weight: 600;
  text-align: center;
  color: var(--text);
  white-space: nowrap;
  max-width: 100px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.timeline-item-years {
  font-size: 10px;
  text-align: center;
  color: var(--text-faint);
}

/* Timeline tooltip */
.timeline-tooltip {
  display: none;
  position: absolute;
  z-index: 50;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px;
  width: 280px;
  box-shadow: var(--shadow);
  pointer-events: auto;
}

.timeline-tooltip.visible {
  display: block;
  animation: fadeIn 0.2s ease;
}

.timeline-tooltip-img {
  width: 100%;
  height: 150px;
  object-fit: cover;
  border-radius: var(--radius);
  margin-bottom: 10px;
}

.timeline-tooltip-name {
  font-family: var(--font-display);
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 2px;
}

.timeline-tooltip-years {
  font-size: 13px;
  color: var(--accent);
  margin-bottom: 6px;
}

.timeline-tooltip-movement {
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.timeline-tooltip-works {
  font-size: 12px;
  color: var(--text-muted);
}

/* Identify works grid in flashcard mode */
.identify-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: 16px;
  margin-top: 18px;
}

.identify-item {
  position: relative;
  display: flex;
  flex-direction: column;
  border-radius: var(--radius);
  overflow: hidden;
  cursor: pointer;
  border: 2px solid var(--border);
  background: linear-gradient(180deg, rgba(255,255,255,0.02), rgba(0,0,0,0.12));
  box-shadow: var(--shadow-sm);
  transition: transform var(--transition), border-color var(--transition), box-shadow var(--transition), opacity var(--transition), background var(--transition);
}

.identify-item:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
  box-shadow: 0 10px 24px rgba(0,0,0,0.25);
}

.identify-item.selected {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px rgba(200,164,92,0.35), 0 14px 28px rgba(0,0,0,0.28);
}

.identify-item.selected::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(200,164,92,0.18), transparent 55%);
  pointer-events: none;
}

.identify-item.correct-selected {
  border-color: var(--success);
  box-shadow: 0 0 0 1px rgba(109,170,69,0.35), 0 14px 28px rgba(0,0,0,0.28);
}

.identify-item.wrong-selected {
  border-color: var(--error);
  background: linear-gradient(180deg, rgba(209,99,99,0.14), rgba(0,0,0,0.18));
}

.identify-item.wrong-selected img {
  opacity: 0.72;
  filter: saturate(0.85);
}

.identify-item.missed-correct {
  border-color: var(--success);
  box-shadow: inset 0 0 0 1px rgba(109,170,69,0.4);
}

.identify-item.neutral-locked {
  opacity: 0.6;
  border-color: var(--border-light);
}

.identify-item.locked {
  cursor: default;
}

.identify-item.locked:hover {
  transform: none;
  box-shadow: var(--shadow-sm);
}

.identify-item-badge {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 1;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 9px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: #111;
  background: rgba(232,228,222,0.92);
  opacity: 0;
  transform: translateY(-4px);
  transition: opacity var(--transition), transform var(--transition);
  pointer-events: none;
}

.identify-item.selected .identify-item-badge,
.identify-item.correct-selected .identify-item-badge,
.identify-item.wrong-selected .identify-item-badge,
.identify-item.missed-correct .identify-item-badge {
  opacity: 1;
  transform: translateY(0);
}

.identify-item.selected .identify-item-badge {
  background: rgba(200,164,92,0.95);
}

.identify-item.correct-selected .identify-item-badge {
  background: rgba(109,170,69,0.95);
}

.identify-item.wrong-selected .identify-item-badge {
  background: rgba(209,99,99,0.95);
  color: #fff3f3;
}

.identify-item.missed-correct .identify-item-badge {
  background: rgba(109,170,69,0.18);
  color: var(--success);
  border: 1px solid rgba(109,170,69,0.45);
}

.identify-item img {
  width: 100%;
  height: 156px;
  object-fit: cover;
  display: block;
}

.identify-item-label {
  font-size: 12px;
  line-height: 1.4;
  padding: 10px 12px 12px;
  color: var(--text-muted);
  background: var(--surface);
  text-align: center;
  min-height: 56px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.identify-item.selected .identify-item-label {
  color: var(--text);
}

.identify-item.correct-selected .identify-item-label {
  color: var(--success);
}

.identify-item.wrong-selected .identify-item-label {
  color: #f1b0b0;
}

.identify-item.missed-correct .identify-item-label {
  color: #b9ddb1;
}

.identify-summary {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 10px;
  margin-top: 18px;
  padding: 14px;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  background: linear-gradient(180deg, rgba(255,255,255,0.02), rgba(0,0,0,0.08));
}

.identify-summary[hidden] {
  display: none;
}

.identify-summary-verdict {
  grid-column: 1 / -1;
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 700;
  color: var(--accent);
}

.identify-summary-stat {
  padding: 10px 12px;
  border-radius: var(--radius);
  background: var(--bg);
  border: 1px solid var(--border);
}

.identify-summary-stat-value {
  font-family: var(--font-display);
  font-size: 24px;
  font-weight: 700;
  line-height: 1;
  color: var(--text);
}

.identify-summary-stat-label {
  margin-top: 4px;
  font-size: 12px;
  color: var(--text-muted);
}

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
  .app-header {
    height: 52px;
    padding: 0 16px;
  }
  
  .nav-tabs {
    display: none;
  }
  
  .mobile-nav {
    display: block;
  }
  
  .main-content {
    margin-top: 52px;
    margin-bottom: 70px;
  }
  
  .artists-grid {
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 12px;
    padding: 0 16px 24px;
  }
  
  .artist-card-img {
    height: 140px;
  }
  
  .browse-header {
    padding: 20px 16px 12px;
  }
  
  .modal-header, .modal-body {
    padding-left: 20px;
    padding-right: 20px;
  }
  
  .modal-works-grid {
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  }
  
  .learn-page, .quiz-page {
    padding: 20px 16px;
  }
  
  .flashcard-front, .flashcard-back {
    padding: 16px;
  }
  
  .flashcard-img {
    max-height: 300px;
  }

  .flashcard {
    min-height: 420px;
  }

  .identify-grid {
    grid-template-columns: repeat(auto-fill, minmax(148px, 1fr));
    gap: 12px;
  }

  .identify-item img {
    height: 132px;
  }

  .identify-item-label {
    min-height: 52px;
    font-size: 11px;
    padding: 8px 10px 10px;
  }
  
  .timeline-page {
    padding: 20px 0;
  }
  
  .timeline-header {
    padding: 0 16px 16px;
  }
  
  .timeline-container {
    padding: 20px 16px 60px;
  }
  
  .filters-row {
    gap: 8px;
  }
  
  .filter-select {
    flex: 1;
    min-width: 0;
    font-size: 13px;
    padding: 8px 28px 8px 10px;
  }
  
  .search-box {
    flex-basis: 100%;
    max-width: none;
  }
}

/* ===== EMPTY STATE ===== */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-muted);
}

.empty-state svg {
  width: 48px;
  height: 48px;
  margin-bottom: 16px;
  opacity: 0.5;
}

.empty-state-text {
  font-size: 16px;
  margin-bottom: 8px;
}

/* ===== QUIZ START SCREEN ===== */
.quiz-start {
  text-align: center;
  padding: 40px 20px;
  background: var(--surface);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
}

.quiz-start h3 {
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 600;
  margin-bottom: 8px;
}

.quiz-start p {
  color: var(--text-muted);
  margin-bottom: 24px;
  max-width: 400px;
  margin-left: auto;
  margin-right: auto;
}

.quiz-type-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 12px;
  margin-bottom: 20px;
}

.quiz-type-card {
  padding: 16px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  transition: all var(--transition);
  text-align: left;
}

.quiz-type-card:hover {
  border-color: var(--accent);
  background: var(--accent-dim2);
}

.quiz-type-card.active {
  border-color: var(--accent);
  background: var(--accent-dim);
}

.quiz-type-title {
  font-weight: 600;
  font-size: 14px;
  margin-bottom: 4px;
}

.quiz-type-desc {
  font-size: 12px;
  color: var(--text-muted);
}

.start-quiz-btn {
  display: inline-block;
  padding: 14px 40px;
  background: var(--accent);
  color: var(--bg);
  border: none;
  border-radius: var(--radius);
  font-size: 16px;
  font-weight: 600;
  font-family: var(--font-body);
  cursor: pointer;
  transition: all var(--transition);
  margin-top: 8px;
}

.start-quiz-btn:hover {
  background: var(--accent-hover);
}

/* ===== ACCESSIBILITY ===== */
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* Cards and tiles render as real buttons for keyboard access */
button.artist-card {
  display: block;
  width: 100%;
  padding: 0;
  font: inherit;
  color: inherit;
  text-align: left;
}

button.identify-item {
  padding: 0;
  font: inherit;
  color: inherit;
  text-align: inherit;
}

button.timeline-item {
  background: none;
  border: none;
  padding: 0;
  font: inherit;
}

.work-card-img-btn {
  display: block;
  width: 100%;
  padding: 0;
  border: none;
  background: none;
  cursor: zoom-in;
}

.identify-item-placeholder {
  width: 100%;
  height: 156px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  font-size: 12px;
  background: var(--bg-2);
}

@media (max-width: 768px) {
  .identify-item-placeholder {
    height: 132px;
  }

  .progress-subtext {
    padding-left: 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
