/* ============================================
   BigBen Tracker — Dashboard Styles
   Dark theme, modern minimal design
   ============================================ */

/* --- Google Fonts --- */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

/* --- CSS Variables --- */
:root {
  --bg: #0a0f1a;
  --bg2: #111827;
  --surface: #1e293b;
  --surface2: #283548;
  --border: #334155;
  --border2: #475569;

  --text: #f1f5f9;
  --text2: #94a3b8;
  --text3: #64748b;

  --blue: #3b82f6;
  --blue-dim: rgba(59, 130, 246, 0.15);
  --green: #22c55e;
  --green-dim: rgba(34, 197, 94, 0.15);
  --amber: #f59e0b;
  --amber-dim: rgba(245, 158, 11, 0.15);
  --red: #ef4444;
  --red-dim: rgba(239, 68, 68, 0.15);
  --violet: #8b5cf6;
  --violet-dim: rgba(139, 92, 246, 0.15);
  --cyan: #06b6d4;
  --cyan-dim: rgba(6, 182, 212, 0.15);

  --radius: 8px;
  --radius-lg: 12px;
  --radius-xl: 16px;
  --shadow: 0 1px 3px rgba(0,0,0,0.3), 0 1px 2px rgba(0,0,0,0.2);
  --shadow-lg: 0 4px 16px rgba(0,0,0,0.4);
  --transition: 150ms ease;
}

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

html {
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
}

a {
  color: var(--blue);
  text-decoration: none;
  transition: color var(--transition);
}
a:hover {
  color: #60a5fa;
}

img, video {
  max-width: 100%;
  display: block;
}

ul, ol { list-style: none; }

/* --- Typography --- */
h1 { font-size: 1.75rem; font-weight: 700; letter-spacing: -0.02em; }
h2 { font-size: 1.35rem; font-weight: 600; letter-spacing: -0.01em; }
h3 { font-size: 1.1rem; font-weight: 600; }
h4 { font-size: 0.95rem; font-weight: 600; }

.text-muted { color: var(--text2); }
.text-dim { color: var(--text3); }
.text-sm { font-size: 0.85rem; }
.text-xs { font-size: 0.75rem; }
.mono { font-family: 'JetBrains Mono', 'Fira Code', monospace; }

/* --- Layout --- */
.container {
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 24px;
}

.container-wide {
  max-width: 1440px;
  margin: 0 auto;
  padding: 0 24px;
}

.page {
  padding-top: 24px;
  padding-bottom: 48px;
}

.grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
}

.grid-3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
}

.grid-4 {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
}

.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-8 { gap: 8px; }
.gap-12 { gap: 12px; }
.gap-16 { gap: 16px; }
.gap-24 { gap: 24px; }

/* --- Header / Navigation --- */
.app-header {
  background: var(--bg2);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
}

.app-header .container {
  display: flex;
  align-items: center;
  height: 56px;
  gap: 32px;
}

.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: 1.1rem;
  color: var(--text);
  white-space: nowrap;
}

.logo-icon {
  width: 28px;
  height: 28px;
  background: linear-gradient(135deg, var(--blue), var(--violet));
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.logo-icon svg {
  width: 16px;
  height: 16px;
  color: white;
}

.nav {
  display: flex;
  align-items: center;
  gap: 4px;
}

.nav a {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  border-radius: var(--radius);
  color: var(--text2);
  font-size: 0.9rem;
  font-weight: 500;
  transition: all var(--transition);
}

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

.nav a.active {
  color: var(--blue);
  background: var(--blue-dim);
}

.nav a svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

/* --- Card Component --- */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  transition: border-color var(--transition);
}

.card:hover {
  border-color: var(--border2);
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.card-title {
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text2);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.card-value {
  font-size: 2rem;
  font-weight: 700;
  line-height: 1.1;
  margin-top: 4px;
}

.card-subtitle {
  font-size: 0.8rem;
  color: var(--text3);
  margin-top: 4px;
}

/* Stat card icon */
.stat-icon {
  width: 40px;
  height: 40px;
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
}

.stat-icon svg {
  width: 20px;
  height: 20px;
}

.stat-icon.blue { background: var(--blue-dim); color: var(--blue); }
.stat-icon.green { background: var(--green-dim); color: var(--green); }
.stat-icon.amber { background: var(--amber-dim); color: var(--amber); }
.stat-icon.violet { background: var(--violet-dim); color: var(--violet); }
.stat-icon.red { background: var(--red-dim); color: var(--red); }

/* --- Badges --- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 10px;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 600;
  white-space: nowrap;
  line-height: 1.8;
}

/* Status badges */
.badge-uploaded { background: var(--blue-dim); color: var(--blue); }
.badge-transcribed { background: var(--cyan-dim); color: var(--cyan); }
.badge-analyzed { background: var(--violet-dim); color: var(--violet); }
.badge-complete, .badge-done { background: var(--green-dim); color: var(--green); }
.badge-error { background: var(--red-dim); color: var(--red); }
.badge-draft { background: rgba(148,163,184,0.15); color: var(--text2); }
.badge-scored { background: var(--amber-dim); color: var(--amber); }
.badge-audio_extracted { background: rgba(6,182,212,0.1); color: #22d3ee; }
.badge-frames_extracted { background: rgba(168,85,247,0.1); color: #a855f7; }

/* CS category badges */
.badge-easy { background: var(--green-dim); color: var(--green); }
.badge-medium { background: var(--amber-dim); color: var(--amber); }
.badge-hard { background: rgba(249,115,22,0.15); color: #f97316; }
.badge-critical { background: var(--red-dim); color: var(--red); }

/* Type badges */
.badge-bug { background: var(--red-dim); color: var(--red); }
.badge-feature { background: var(--blue-dim); color: var(--blue); }
.badge-enhancement { background: var(--violet-dim); color: var(--violet); }

/* Priority badges */
.badge-priority-low { background: rgba(148,163,184,0.15); color: var(--text2); }
.badge-priority-medium { background: var(--amber-dim); color: var(--amber); }
.badge-priority-high { background: rgba(249,115,22,0.15); color: #f97316; }
.badge-priority-urgent { background: var(--red-dim); color: var(--red); }

/* Small dot before badge text */
.badge .dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
  flex-shrink: 0;
}

/* --- Buttons --- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text2);
  font-family: inherit;
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition);
  white-space: nowrap;
}

.btn:hover {
  border-color: var(--border2);
  color: var(--text);
  background: var(--surface2);
}

.btn svg {
  width: 16px;
  height: 16px;
}

.btn-primary {
  background: var(--blue);
  border-color: var(--blue);
  color: white;
}

.btn-primary:hover {
  background: #2563eb;
  border-color: #2563eb;
  color: white;
}

.btn-sm {
  padding: 4px 10px;
  font-size: 0.8rem;
}

.btn-ghost {
  border-color: transparent;
  background: transparent;
}

.btn-ghost:hover {
  background: var(--surface);
}

/* --- Tables --- */
.table-wrapper {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.table {
  width: 100%;
  border-collapse: collapse;
}

.table th {
  padding: 12px 16px;
  text-align: left;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text3);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  background: var(--bg2);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

.table td {
  padding: 12px 16px;
  border-bottom: 1px solid rgba(51, 65, 85, 0.5);
  font-size: 0.9rem;
  vertical-align: middle;
}

.table tbody tr {
  transition: background var(--transition);
}

.table tbody tr:hover {
  background: rgba(30, 41, 59, 0.5);
}

.table tbody tr:last-child td {
  border-bottom: none;
}

.table-clickable tbody tr {
  cursor: pointer;
}

.table-clickable tbody tr:hover {
  background: var(--surface2);
}

/* --- Filter Bar --- */
.filter-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.filter-bar .filter-group {
  display: flex;
  align-items: center;
  gap: 6px;
}

.filter-bar label {
  font-size: 0.8rem;
  color: var(--text3);
  font-weight: 500;
  white-space: nowrap;
}

/* --- Form Inputs --- */
input[type="text"],
input[type="search"],
input[type="email"],
input[type="number"],
select,
textarea {
  font-family: inherit;
  font-size: 0.85rem;
  padding: 8px 12px;
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  transition: all var(--transition);
  outline: none;
  width: 100%;
}

input[type="text"]:focus,
input[type="search"]:focus,
input[type="email"]:focus,
input[type="number"]:focus,
select:focus,
textarea:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

input::placeholder,
textarea::placeholder {
  color: var(--text3);
}

select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  padding-right: 32px;
  cursor: pointer;
}

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

textarea {
  resize: vertical;
  min-height: 80px;
  line-height: 1.5;
}

/* Inline filter inputs */
.filter-bar input,
.filter-bar select {
  width: auto;
  min-width: 150px;
}

.filter-bar input[type="search"] {
  min-width: 220px;
}

/* --- Search Box --- */
.search-box {
  position: relative;
}

.search-box svg {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  width: 16px;
  height: 16px;
  color: var(--text3);
  pointer-events: none;
}

.search-box input {
  padding-left: 34px;
}

/* --- Pagination --- */
.pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px;
  border-top: 1px solid var(--border);
  background: var(--bg2);
}

.pagination-info {
  font-size: 0.8rem;
  color: var(--text3);
}

.pagination-buttons {
  display: flex;
  gap: 4px;
}

.pagination-buttons .btn {
  min-width: 36px;
  padding: 6px 10px;
}

.pagination-buttons .btn.active {
  background: var(--blue);
  border-color: var(--blue);
  color: white;
}

/* --- Video Player --- */
.video-container {
  background: #000;
  border-radius: var(--radius-lg);
  overflow: hidden;
  border: 1px solid var(--border);
}

.video-container video {
  width: 100%;
  display: block;
  max-height: 480px;
  object-fit: contain;
  background: #000;
}

/* --- Frames Gallery --- */
.frames-gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 8px;
  margin-top: 12px;
}

.frame-thumb {
  position: relative;
  border-radius: var(--radius);
  overflow: hidden;
  border: 2px solid transparent;
  cursor: pointer;
  transition: all var(--transition);
  aspect-ratio: 16/9;
  background: var(--bg2);
}

.frame-thumb:hover {
  border-color: var(--blue);
  transform: translateY(-1px);
}

.frame-thumb.active {
  border-color: var(--blue);
  box-shadow: 0 0 0 2px var(--blue-dim);
}

.frame-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.frame-thumb .frame-time {
  position: absolute;
  bottom: 4px;
  right: 4px;
  background: rgba(0,0,0,0.75);
  color: white;
  font-size: 0.65rem;
  font-weight: 600;
  padding: 1px 5px;
  border-radius: 3px;
}

/* --- CS Score Circle --- */
.cs-circle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  font-size: 1rem;
  font-weight: 700;
  line-height: 1;
  flex-shrink: 0;
}

.cs-circle-sm {
  width: 32px;
  height: 32px;
  font-size: 0.8rem;
}

.cs-circle-lg {
  width: 60px;
  height: 60px;
  font-size: 1.4rem;
}

.cs-circle.easy {
  background: var(--green-dim);
  color: var(--green);
  border: 2px solid var(--green);
}

.cs-circle.medium {
  background: var(--amber-dim);
  color: var(--amber);
  border: 2px solid var(--amber);
}

.cs-circle.hard {
  background: rgba(249,115,22,0.15);
  color: #f97316;
  border: 2px solid #f97316;
}

.cs-circle.critical {
  background: var(--red-dim);
  color: var(--red);
  border: 2px solid var(--red);
}

.cs-circle.none {
  background: rgba(148,163,184,0.1);
  color: var(--text3);
  border: 2px solid var(--border);
}

/* --- CS Progress Bars --- */
.cs-breakdown {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.cs-bar-row {
  display: flex;
  align-items: center;
  gap: 12px;
}

.cs-bar-label {
  width: 80px;
  font-size: 0.8rem;
  color: var(--text2);
  font-weight: 500;
  flex-shrink: 0;
}

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

.cs-bar-fill {
  height: 100%;
  border-radius: 4px;
  transition: width 0.4s ease;
}

.cs-bar-fill.level-1 { width: 33.3%; background: var(--green); }
.cs-bar-fill.level-2 { width: 66.6%; background: var(--amber); }
.cs-bar-fill.level-3 { width: 100%; background: var(--red); }

.cs-bar-value {
  width: 24px;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text2);
  text-align: right;
  flex-shrink: 0;
}

/* --- Card Grid (cards.html) --- */
.cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 16px;
}

.card-item {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px;
  cursor: pointer;
  transition: all var(--transition);
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.card-item:hover {
  border-color: var(--border2);
  transform: translateY(-1px);
  box-shadow: var(--shadow-lg);
}

.card-item-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.card-item-title {
  font-weight: 600;
  font-size: 0.95rem;
  line-height: 1.4;
  flex: 1;
}

.card-item-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.card-item-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: auto;
  padding-top: 12px;
  border-top: 1px solid rgba(51,65,85,0.5);
}

.card-item-footer .meta-text {
  font-size: 0.75rem;
  color: var(--text3);
}

/* --- Section Headers --- */
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.section-title {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text);
}

/* --- Page Header --- */
.page-header {
  margin-bottom: 24px;
}

.page-header h1 {
  margin-bottom: 4px;
}

.page-header .page-desc {
  color: var(--text2);
  font-size: 0.9rem;
}

/* --- Back Link --- */
.back-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.85rem;
  color: var(--text3);
  margin-bottom: 16px;
  padding: 4px 0;
  transition: color var(--transition);
}

.back-link:hover {
  color: var(--text);
}

.back-link svg {
  width: 16px;
  height: 16px;
}

/* --- Detail Header --- */
.detail-header {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 24px;
  flex-wrap: wrap;
}

.detail-header h1 {
  font-size: 1.5rem;
}

.detail-meta {
  display: flex;
  align-items: center;
  gap: 16px;
  color: var(--text2);
  font-size: 0.85rem;
}

.detail-meta .sep {
  color: var(--border);
}

/* --- Two Column Layout --- */
.two-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  align-items: start;
}

.two-col-wide {
  display: grid;
  grid-template-columns: 3fr 2fr;
  gap: 24px;
  align-items: start;
}

/* --- Transcription --- */
.transcript-box {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px;
  max-height: 400px;
  overflow-y: auto;
  font-size: 0.9rem;
  line-height: 1.8;
  color: var(--text2);
}

.transcript-box::-webkit-scrollbar {
  width: 6px;
}

.transcript-box::-webkit-scrollbar-track {
  background: transparent;
}

.transcript-box::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 3px;
}

.transcript-word {
  cursor: pointer;
  padding: 1px 2px;
  border-radius: 2px;
  transition: all var(--transition);
}

.transcript-word:hover {
  background: var(--blue-dim);
  color: var(--blue);
}

.transcript-word.active {
  background: var(--blue-dim);
  color: var(--blue);
  font-weight: 600;
}

/* --- Analysis Section --- */
.analysis-section {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px;
}

.analysis-section h3 {
  margin-bottom: 12px;
}

.analysis-steps {
  font-size: 0.9rem;
  line-height: 1.8;
  color: var(--text2);
}

.analysis-steps li {
  padding-left: 4px;
  margin-bottom: 4px;
}

.analysis-steps li::before {
  display: none;
}

.analysis-field {
  margin-top: 16px;
}

.analysis-field h4 {
  color: var(--text3);
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 6px;
}

.analysis-field p {
  font-size: 0.9rem;
  color: var(--text2);
  line-height: 1.6;
}

/* --- Comments --- */
.comments-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 16px;
}

.comment {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px;
}

.comment-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
}

.comment-author {
  font-weight: 600;
  font-size: 0.85rem;
  color: var(--text);
}

.comment-date {
  font-size: 0.75rem;
  color: var(--text3);
}

.comment-text {
  font-size: 0.9rem;
  color: var(--text2);
  line-height: 1.5;
}

.comment-form {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.comment-form-row {
  display: flex;
  gap: 10px;
  align-items: end;
}

.comment-form-row textarea {
  flex: 1;
}

/* --- Analytics: Distribution Bars --- */
.dist-bar-container {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.dist-bar-row {
  display: flex;
  align-items: center;
  gap: 12px;
}

.dist-bar-label {
  width: 70px;
  font-size: 0.8rem;
  color: var(--text2);
  font-weight: 500;
  flex-shrink: 0;
  text-transform: capitalize;
}

.dist-bar-track {
  flex: 1;
  height: 24px;
  background: var(--bg2);
  border-radius: 6px;
  overflow: hidden;
  position: relative;
}

.dist-bar-fill {
  height: 100%;
  border-radius: 6px;
  display: flex;
  align-items: center;
  padding-left: 8px;
  font-size: 0.75rem;
  font-weight: 600;
  color: white;
  min-width: 28px;
  transition: width 0.6s ease;
}

.dist-bar-fill.easy { background: var(--green); }
.dist-bar-fill.medium { background: var(--amber); }
.dist-bar-fill.hard { background: #f97316; }
.dist-bar-fill.critical { background: var(--red); }

.dist-bar-count {
  width: 32px;
  text-align: right;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text);
  flex-shrink: 0;
}

/* --- Activity List --- */
.activity-list {
  display: flex;
  flex-direction: column;
}

.activity-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid rgba(51,65,85,0.5);
}

.activity-item:last-child {
  border-bottom: none;
}

.activity-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-top: 6px;
  flex-shrink: 0;
}

.activity-dot.blue { background: var(--blue); }
.activity-dot.green { background: var(--green); }
.activity-dot.amber { background: var(--amber); }
.activity-dot.violet { background: var(--violet); }
.activity-dot.red { background: var(--red); }

.activity-content {
  flex: 1;
}

.activity-text {
  font-size: 0.85rem;
  color: var(--text2);
}

.activity-text strong {
  color: var(--text);
}

.activity-time {
  font-size: 0.75rem;
  color: var(--text3);
  margin-top: 2px;
}

/* --- Empty State --- */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 48px 24px;
  color: var(--text3);
  text-align: center;
}

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

.empty-state p {
  font-size: 0.9rem;
}

/* --- Loading Spinner --- */
.loading {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 48px;
}

.spinner {
  width: 32px;
  height: 32px;
  border: 3px solid var(--border);
  border-top-color: var(--blue);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

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

/* --- Screenshots / Architecture --- */
.screenshots-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 12px;
}

.screenshot-item {
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--border);
  transition: border-color var(--transition);
  cursor: pointer;
}

.screenshot-item:hover {
  border-color: var(--blue);
}

.screenshot-item img {
  width: 100%;
  aspect-ratio: 16/9;
  object-fit: cover;
}

.screenshot-item .caption {
  padding: 6px 10px;
  font-size: 0.75rem;
  color: var(--text3);
  background: var(--bg2);
  border-top: 1px solid var(--border);
}

/* --- Description formatted text --- */
.formatted-text {
  font-size: 0.9rem;
  line-height: 1.7;
  color: var(--text2);
}

.formatted-text h2 {
  font-size: 1rem;
  color: var(--text);
  margin: 16px 0 8px;
}

.formatted-text h2:first-child {
  margin-top: 0;
}

.formatted-text p {
  margin-bottom: 8px;
}

.formatted-text code {
  background: var(--bg);
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 0.85em;
}

/* --- Sort Controls --- */
.sort-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
}

.sort-bar label {
  font-size: 0.8rem;
  color: var(--text3);
  white-space: nowrap;
}

/* --- Responsive --- */
@media (max-width: 1024px) {
  .two-col,
  .two-col-wide {
    grid-template-columns: 1fr;
  }

  .grid-4 {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 768px) {
  .container {
    padding: 0 16px;
  }

  .app-header .container {
    gap: 16px;
  }

  .nav a span {
    display: none;
  }

  .filter-bar {
    flex-direction: column;
    align-items: stretch;
  }

  .filter-bar input,
  .filter-bar select {
    width: 100%;
    min-width: 0;
  }

  .grid-2,
  .grid-3,
  .grid-4 {
    grid-template-columns: 1fr;
  }

  .cards-grid {
    grid-template-columns: 1fr;
  }

  .detail-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }

  .table th,
  .table td {
    padding: 10px 12px;
  }

  h1 { font-size: 1.35rem; }
}

@media (max-width: 480px) {
  html { font-size: 13px; }

  .app-header .container {
    gap: 8px;
  }

  .logo span:last-child {
    display: none;
  }
}

/* --- Utility --- */
.mt-8 { margin-top: 8px; }
.mt-12 { margin-top: 12px; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }
.mt-32 { margin-top: 32px; }
.mb-8 { margin-bottom: 8px; }
.mb-16 { margin-bottom: 16px; }
.mb-24 { margin-bottom: 24px; }
.hidden { display: none !important; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
