:root {
  --bg: #0f1419;
  --surface: #1a222c;
  --text: #f2f5f8;
  --muted: #9aa7b5;
  --accent: #3dd6c6;
  --accent-dim: #2a9d8f;
  --border: #2c3846;
  --chip: #243040;
  --radius: 14px;
  --font: "Segoe UI", system-ui, -apple-system, sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font);
  color: var(--text);
  background:
    radial-gradient(1200px 600px at 10% -10%, #1e3a3a 0%, transparent 55%),
    radial-gradient(900px 500px at 100% 0%, #243352 0%, transparent 50%),
    var(--bg);
  line-height: 1.45;
}

.hero {
  padding: 2.25rem 1.25rem 1.75rem;
  max-width: 960px;
  margin: 0 auto;
}

.hero-brand {
  display: flex;
  align-items: center;
  gap: 1.1rem;
}

.hero-logo {
  flex-shrink: 0;
  width: 80px;
  height: 80px;
  border-radius: 20px;
  border: 1px solid var(--border);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.35);
}

.hero-copy {
  min-width: 0;
}

.brand {
  margin: 0;
  font-size: 0.85rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent);
  font-weight: 700;
}

.hero h1 {
  margin: 0.2rem 0 0.35rem;
  font-size: clamp(2rem, 5vw, 3rem);
  font-weight: 800;
  letter-spacing: -0.02em;
}

.tagline {
  margin: 0;
  color: var(--muted);
  font-size: 1.05rem;
  max-width: 36rem;
}

.play-cta {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  margin-top: 1.25rem;
  padding: 0.75rem 1.15rem;
  border-radius: 999px;
  background: linear-gradient(135deg, #3dd6c6, #2a9d8f);
  color: #041210;
  font-weight: 800;
  text-decoration: none;
  box-shadow: 0 10px 28px rgba(61, 214, 198, 0.22);
}

.play-cta:hover {
  filter: brightness(1.06);
}

.play-cta-icon {
  display: inline-grid;
  place-items: center;
  width: 1.4rem;
  height: 1.4rem;
  border-radius: 999px;
  background: rgba(4, 18, 16, 0.12);
  font-size: 0.7rem;
}

main {
  max-width: 960px;
  margin: 0 auto;
  padding: 0 1.25rem 3rem;
}

.import-help {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.1rem 1.25rem;
  margin-bottom: 1.5rem;
}

.import-help h2 {
  margin: 0 0 0.6rem;
  font-size: 1.05rem;
}

.import-help ol {
  margin: 0;
  padding-left: 1.2rem;
}

.muted { color: var(--muted); font-size: 0.92rem; }

.toolbar {
  display: grid;
  gap: 0.85rem;
  margin-bottom: 1rem;
}

.search input {
  width: 100%;
  padding: 0.75rem 1rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font: inherit;
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.chip {
  border: 1px solid var(--border);
  background: var(--chip);
  color: var(--text);
  border-radius: 999px;
  padding: 0.4rem 0.85rem;
  font: inherit;
  cursor: pointer;
}

.chip[aria-pressed="true"] {
  background: var(--accent-dim);
  border-color: var(--accent);
  color: #041210;
  font-weight: 700;
}

.status {
  min-height: 1.25rem;
  color: var(--muted);
  font-size: 0.92rem;
}

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

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0;
  overflow: hidden;
}

.card-cover {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 10;
  object-fit: contain;
  background: #243040;
  border-bottom: 1px solid var(--border);
}

.card .badge,
.card h3,
.card > p,
.card-actions {
  margin-left: 1.15rem;
  margin-right: 1.15rem;
}

.card .badge {
  margin-top: 0.9rem;
}

.card h3 {
  margin: 0.35rem 1.15rem 0;
  font-size: 1.15rem;
}

.badge {
  align-self: flex-start;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--accent);
  font-weight: 700;
}

.card > p {
  margin: 0.4rem 1.15rem 0;
  color: var(--muted);
  flex: 1;
  font-size: 0.92rem;
  line-height: 1.4;
}

.card-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin: 0.75rem 1.15rem 1.1rem;
}

.card button {
  margin-top: 0;
  border: 0;
  border-radius: 10px;
  padding: 0.65rem 0.9rem;
  background: var(--accent);
  color: #041210;
  font-weight: 700;
  font: inherit;
  cursor: pointer;
}

.card button.btn-secondary {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--border);
}

.card-clickable {
  cursor: pointer;
  transition: border-color 0.15s ease, transform 0.15s ease;
}

.card-clickable:hover,
.card-clickable:focus-visible {
  border-color: var(--accent);
  outline: none;
}

.card-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.card button:hover { filter: brightness(1.05); }
.card button:disabled { opacity: 0.55; cursor: wait; }

.preview-dialog {
  border: 0;
  padding: 0;
  background: transparent;
  max-width: min(640px, calc(100vw - 1.5rem));
  width: 100%;
  color: var(--text);
}

.preview-dialog[open],
.preview-dialog:modal {
  display: flex;
  align-items: center;
  justify-content: center;
  margin: auto;
}

.preview-dialog::backdrop {
  background: rgba(4, 8, 12, 0.72);
}

.preview-panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  max-height: min(85vh, 900px);
  display: flex;
  flex-direction: column;
}

.preview-header {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: flex-start;
  padding: 1.1rem 1.2rem 0.75rem;
  border-bottom: 1px solid var(--border);
}

.preview-header h2 {
  margin: 0.2rem 0 0;
  font-size: 1.35rem;
}

.btn-ghost {
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text);
  border-radius: 10px;
  padding: 0.45rem 0.75rem;
  font: inherit;
  cursor: pointer;
}

.preview-body {
  padding: 1rem 1.2rem;
  overflow: auto;
}

.preview-desc {
  margin: 0 0 1rem;
  color: var(--muted);
}

.preview-cover {
  display: block;
  width: 100%;
  max-height: 220px;
  object-fit: contain;
  background: #243040;
  border: 1px solid var(--border);
  border-radius: 12px;
  margin-bottom: 1rem;
}

.preview-stats {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 0.65rem;
  margin-bottom: 1.1rem;
}

.stat {
  background: var(--chip);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.55rem 0.7rem;
}

.stat-label {
  display: block;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
}

.stat-value {
  display: block;
  margin-top: 0.2rem;
  font-weight: 800;
}

.preview-set {
  margin-bottom: 1rem;
}

.preview-set h4 {
  margin: 0 0 0.55rem;
  color: var(--accent);
}

.preview-set ol {
  margin: 0;
  padding: 0;
  list-style: none;
}

.preview-set li {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  margin-bottom: 0.55rem;
}

.round-thumb {
  width: 52px;
  height: 52px;
  border-radius: 10px;
  object-fit: contain;
  background: #243040;
  border: 1px solid var(--border);
  flex: 0 0 auto;
}

.round-thumb.placeholder {
  display: inline-block;
  background: var(--chip);
}

.round-copy {
  min-width: 0;
}

.round-rest {
  color: var(--muted);
  font-weight: 500;
}

.set-rest {
  margin: 0.45rem 0 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.preview-footer {
  padding: 0.9rem 1.2rem 1.1rem;
  border-top: 1px solid var(--border);
}

.preview-footer button {
  width: 100%;
  border: 0;
  border-radius: 10px;
  padding: 0.75rem 0.9rem;
  background: var(--accent);
  color: #041210;
  font-weight: 700;
  font: inherit;
  cursor: pointer;
}

.preview-footer button:disabled {
  opacity: 0.55;
  cursor: wait;
}

.error { color: #ff8f8f; }

.site-footer {
  margin-top: 2rem;
  border-top: 1px solid var(--border);
  background: rgba(10, 14, 18, 0.65);
}

.site-footer-inner {
  max-width: 960px;
  margin: 0 auto;
  padding: 1.75rem 1.25rem 2.25rem;
  display: grid;
  gap: 1.1rem;
}

.site-footer-brand {
  display: flex;
  gap: 0.85rem;
  align-items: center;
}

.footer-logo {
  border-radius: 12px;
  border: 1px solid var(--border);
}

.site-footer-brand strong {
  display: block;
  font-size: 1.05rem;
}

.site-footer-brand p {
  margin: 0.2rem 0 0;
  color: var(--muted);
  font-size: 0.92rem;
}

.site-footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.85rem 1.25rem;
}

.site-footer-links a {
  color: var(--accent);
  text-decoration: none;
  font-weight: 700;
}

.site-footer-links a:hover {
  text-decoration: underline;
}

.site-footer-copy {
  margin: 0;
  color: var(--muted);
  font-size: 0.88rem;
  letter-spacing: 0.04em;
}

footer a { color: var(--accent); }

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

code {
  font-size: 0.9em;
  color: var(--text);
}

@media (max-width: 560px) {
  .hero-brand {
    align-items: flex-start;
  }

  .hero-logo {
    width: 64px;
    height: 64px;
    border-radius: 16px;
  }
}
