:root {
  --bg: #f6f7fb;
  --surface: #ffffff;
  --text: #1d2233;
  --muted: #667085;
  --accent: #4f46e5;
  --accent-soft: #eef2ff;
  --star: #f5a524;
  --star-off: #d0d5dd;
  --border: #e4e7ec;
  --ok: #067647;
  --ok-soft: #ecfdf3;
  --warn: #b54708;
  --warn-soft: #fffaeb;
  --radius: 14px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1220;
    --surface: #181c2e;
    --text: #e6e8f0;
    --muted: #9aa3b8;
    --accent: #8b84ff;
    --accent-soft: #24264a;
    --star-off: #3a405a;
    --border: #2a2f47;
    --ok: #6ce9a6;
    --ok-soft: #10301f;
    --warn: #fdb022;
    --warn-soft: #3a2a0c;
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

.wrap { max-width: 1100px; margin: 0 auto; padding: 0 16px; }

.hero {
  background: linear-gradient(135deg, var(--accent) 0%, #7c3aed 100%);
  color: #fff;
  padding: 40px 0 32px;
  margin-bottom: 24px;
}
.hero h1 { margin: 0 0 8px; font-size: 2rem; letter-spacing: -0.02em; }
.lead { margin: 0 0 20px; max-width: 640px; opacity: 0.92; }

.progress { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.progress-bar {
  width: 240px; height: 8px; border-radius: 999px; background: rgba(255, 255, 255, 0.25);
  overflow: hidden;
}
.progress-bar span {
  display: block; height: 100%; width: 0; background: #fff; border-radius: inherit;
  transition: width 0.3s ease;
}

.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 24px;
}
.panel-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.panel h2 { margin: 0; font-size: 1.25rem; }
.hint { color: var(--muted); margin: 8px 0 16px; min-height: 1.5em; }

.badge {
  font-size: 0.8rem; padding: 2px 10px; border-radius: 999px;
  background: var(--accent-soft); color: var(--accent);
}
.badge:empty { display: none; }
.badge.full { background: var(--ok-soft); color: var(--ok); }
.badge.fallback { background: var(--warn-soft); color: var(--warn); }

.search {
  width: 100%; margin: 12px 0 16px; padding: 12px 14px; font: inherit;
  color: var(--text); background: var(--bg);
  border: 1px solid var(--border); border-radius: 10px;
}
.search:focus { outline: 2px solid var(--accent); outline-offset: 1px; }

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

.card {
  display: flex; flex-direction: column; justify-content: space-between; gap: 8px;
  padding: 14px; border: 1px solid var(--border); border-radius: 12px; background: var(--bg);
}
.card .title { margin: 0; font-size: 0.98rem; line-height: 1.3; }
.card .meta { margin: 4px 0 0; color: var(--muted); font-size: 0.85rem; }

.stars { display: flex; gap: 2px; }
.star {
  border: 0; background: none; padding: 0 1px; cursor: pointer;
  font-size: 1.35rem; line-height: 1; color: var(--star-off);
  transition: transform 0.1s ease, color 0.1s ease;
}
.star.on { color: var(--star); }
.stars:hover .star { color: var(--star); }
.stars .star:hover ~ .star { color: var(--star-off); }
.star:hover { transform: scale(1.15); }
.star:focus-visible { outline: 2px solid var(--accent); border-radius: 4px; }

.empty { color: var(--muted); margin: 0; }

.footer { color: var(--muted); font-size: 0.85rem; padding-bottom: 32px; }

.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 20px);
  background: var(--text); color: var(--surface); padding: 10px 16px; border-radius: 10px;
  opacity: 0; pointer-events: none; transition: opacity 0.2s ease, transform 0.2s ease;
  max-width: calc(100% - 32px);
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
