/* ===== Spilsamlingen — design reproduceret fra Lovable (TanStack) i ren CSS ===== */

:root {
  --background: #14151D;
  --foreground: #F2F0EA;
  --card: #1E1F2A;
  --muted: #1E1F2A;
  --muted-foreground: #9A97A6;
  --favorite: #E5484D;
  --rating: #D4A24E;
  --border: rgba(255,255,255,0.07);
  --radius: 0.5rem;
  --font-display: "Archivo", "Bricolage Grotesque", sans-serif;
  --font-sans: "Inter", system-ui, sans-serif;
  --maxw: 48rem;        /* max-w-3xl */
  --maxw-narrow: 42rem; /* max-w-2xl */
}

* { box-sizing: border-box; border-color: var(--border); }
html, body {
  margin: 0;
  background-color: var(--background);
  color: var(--foreground);
  font-family: var(--font-sans);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
h1, h2, h3, .font-display { font-family: var(--font-display); letter-spacing: -0.01em; }
a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; }
img { display: block; max-width: 100%; }
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0;
}
:focus-visible { outline: 2px solid var(--muted-foreground); outline-offset: 2px; }

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}

/* ---------- Topbar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 30;
  border-bottom: 1px solid var(--border);
  background: color-mix(in srgb, var(--background) 95%, transparent);
  backdrop-filter: blur(12px);
}
.topbar-inner { max-width: var(--maxw); margin: 0 auto; padding: 1.25rem 1.25rem 0.75rem; }
.topbar-row { display: flex; align-items: center; justify-content: space-between; margin-bottom: 1rem; }
.brand {
  font-size: 1.125rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.18em; margin: 0;
}
.topbar-actions { display: flex; align-items: center; gap: 0.75rem; }
.count { font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted-foreground); }
.iconlink { display: inline-flex; padding: 0.25rem; }
.iconlink svg { width: 1.25rem; height: 1.25rem; }
.iconlink.fav { color: var(--favorite); }

.searchrow { display: flex; align-items: center; gap: 0.5rem; }
.searchfield { position: relative; flex: 1; }
.searchfield .searchicon {
  position: absolute; left: 0.75rem; top: 50%; transform: translateY(-50%);
  width: 1rem; height: 1rem; color: var(--muted-foreground); pointer-events: none;
}
.searchfield input {
  height: 2.75rem; width: 100%;
  border-radius: 9999px; border: 1px solid var(--border);
  background: var(--card); color: var(--foreground);
  padding: 0 1rem 0 2.25rem; font-size: 16px; outline: none;  /* 16px → iOS zoomer ikke ind ved fokus */
}
.searchfield input::placeholder { color: var(--muted-foreground); }
.searchfield input:focus { border-color: var(--muted-foreground); }

.filterbtn {
  position: relative; display: inline-flex; align-items: center; justify-content: center;
  height: 2.75rem; width: 2.75rem; flex: 0 0 auto;
  border-radius: 9999px; border: 1px solid var(--border);
  background: var(--card); color: var(--foreground);
}
.filterbtn svg { width: 1rem; height: 1rem; }
.filterbadge {
  position: absolute; top: -0.25rem; right: -0.25rem;
  min-width: 1.1rem; height: 1.1rem; padding: 0 0.25rem;
  border-radius: 9999px; background: var(--rating); color: var(--background);
  font-size: 0.7rem; font-weight: 700; display: flex; align-items: center; justify-content: center;
}

/* ---------- Page head (tilbage-pil sider) ---------- */
.page-head {
  position: sticky; top: 0; z-index: 30;
  border-bottom: 1px solid var(--border);
  background: color-mix(in srgb, var(--background) 95%, transparent);
  backdrop-filter: blur(12px);
}
.page-head-inner { max-width: var(--maxw); margin: 0 auto; display: flex; align-items: center; gap: 0.75rem; padding: 1rem 1.25rem; }
.page-title { font-size: 1.125rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.18em; margin: 0; }
.backbtn { display: inline-flex; padding: 0.5rem; border: none; background: none; color: var(--muted-foreground); border-radius: 9999px; }
.backbtn svg { width: 1.25rem; height: 1.25rem; }
.head-spacer { margin-left: auto; }
.ny-konsol-link {
  margin-left: auto; display: inline-flex; align-items: center; gap: 0.375rem;
  border-radius: 9999px; border: 1px solid var(--border); padding: 0.5rem 0.75rem;
  font-size: 0.6875rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em;
  color: var(--muted-foreground);
}
.ny-konsol-link svg { width: 0.875rem; height: 0.875rem; }

/* ---------- Container + grid ---------- */
.container { max-width: var(--maxw); margin: 0 auto; padding: 1.25rem; }
/* minmax(0,1fr) — ikke 1fr — så lange titler (white-space:nowrap) ikke
   tvinger kolonnen bredere end skærmen og får billederne til at flyde ud. */
.grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; }
@media (min-width: 640px) { .grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (min-width: 768px) { .grid { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.grid > * { min-width: 0; }

/* ---------- Card ---------- */
.card { display: block; min-width: 0; }
.poster {
  position: relative; width: 100%; aspect-ratio: 3 / 4;
  overflow: hidden; border-radius: var(--radius); background: var(--card);
}
.poster img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; transition: transform 0.5s ease; }
.card:hover .poster img { transform: scale(1.02); }
.cover-fallback {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  padding: 1rem; text-align: center;
}
.cover-fallback .ctitle { font-family: var(--font-display); font-size: 1.125rem; font-weight: 600; line-height: 1.15; color: color-mix(in srgb, var(--foreground) 90%, transparent); }

.poster-badges {
  position: absolute; top: 0.375rem; right: 0.375rem;
  display: flex; flex-direction: column; align-items: flex-end; gap: 0.25rem;
}

.status-overlay {
  position: absolute; left: 0; right: 0; bottom: 0;
  padding: 1.5rem 0.5rem 0.375rem;
  background: linear-gradient(to top, rgba(0,0,0,0.85), rgba(0,0,0,0.25) 55%, transparent);
}
.status-overlay span {
  font-size: 0.625rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.15em;
}
.st-platinum { color: var(--rating); }
.st-completed { color: #9be39b; }
.st-playing { color: #ffffff; }
.st-backlog { color: var(--muted-foreground); }

.card-meta { margin-top: 0.5rem; padding: 0 0.125rem; min-width: 0; }
.card-title { font-size: 0.875rem; font-weight: 500; margin: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card-sub { margin: 0.125rem 0 0; font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted-foreground); }

/* ---------- Platform badge ---------- */
.badge {
  display: inline-flex; align-items: center; justify-content: center;
  font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em; color: #fff;
  background-color: var(--c, #555);
  background: linear-gradient(160deg, var(--c, #555), color-mix(in srgb, var(--c, #555) 78%, #000));
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.18), 0 1px 2px rgba(0,0,0,0.4);
}
.badge.sm { height: 22px; padding: 0 0.5rem; font-size: 11px; border-radius: 0.375rem; }
.badge.md { height: 28px; padding: 0 0.625rem; font-size: 0.75rem; border-radius: 0.5rem; }
.badge.lg { height: 36px; padding: 0 0.875rem; font-size: 0.875rem; border-radius: 0.5rem; }

/* ---------- Empty state ---------- */
.empty { margin-top: 6rem; text-align: center; }
.empty-title { font-family: var(--font-display); font-size: 1.25rem; margin: 0; }
.empty-sub { margin-top: 0.5rem; font-size: 0.875rem; color: var(--muted-foreground); }
.empty-icon svg { width: 2.5rem; height: 2.5rem; color: var(--muted-foreground); margin: 0 auto 0.75rem; }

/* ---------- Buttons ---------- */
.btn-primary {
  display: block; width: 100%; border: none;
  border-radius: 9999px; background: var(--foreground); color: var(--background);
  padding: 0.75rem; font-size: 0.875rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em;
}
.btn-primary:disabled { opacity: 0.5; }
.btn-outline {
  display: block; width: 100%; border: 1px solid var(--border); background: none;
  border-radius: 9999px; color: var(--muted-foreground);
  padding: 0.75rem; font-size: 0.875rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em;
}

/* ---------- Filter bottom-sheet ---------- */
.sheet-overlay { position: fixed; inset: 0; z-index: 50; visibility: hidden; }
.sheet-overlay.is-open { visibility: visible; }
.sheet-backdrop { position: absolute; inset: 0; background: rgba(0,0,0,0.6); opacity: 0; transition: opacity 0.3s; }
.sheet-overlay.is-open .sheet-backdrop { opacity: 1; }
.sheet-panel {
  position: absolute; left: 0; right: 0; bottom: 0;
  max-height: 85vh; overflow-y: auto;
  border-top: 1px solid var(--border); border-radius: 1rem 1rem 0 0;
  background: var(--card); padding: 1.25rem;
  transform: translateY(100%); transition: transform 0.3s ease;
}
.sheet-overlay.is-open .sheet-panel { transform: translateY(0); }
.sheet-grip { width: 2.5rem; height: 0.25rem; border-radius: 9999px; background: color-mix(in srgb, var(--muted-foreground) 30%, transparent); margin: 0 auto 1rem; }
.sheet-head-row { display: flex; align-items: center; justify-content: space-between; margin-bottom: 1rem; }
.sheet-title { font-family: var(--font-display); font-size: 1.25rem; font-weight: 600; margin: 0; }
.sheet-close { border: none; background: none; color: var(--muted-foreground); padding: 0.5rem; border-radius: 9999px; }
.sheet-close svg { width: 1.25rem; height: 1.25rem; }

.fsection { margin-bottom: 1.25rem; }
.flabel { font-size: 0.75rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.2em; color: var(--muted-foreground); margin: 0 0 0.5rem; }

.chips { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.chip {
  min-height: 44px; border-radius: 9999px; border: 1px solid var(--border);
  background: none; color: var(--foreground);
  padding: 0 1rem; font-size: 0.75rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em;
}
.chip.is-active { border-color: var(--foreground); background: var(--foreground); color: var(--background); }
.chips[data-group="sort"] .chip.is-active { border-color: var(--rating); background: var(--rating); color: var(--background); }

/* Konsol-vælger (pills med farvet ramme når aktiv) */
.platform-pick { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.ppick {
  display: flex; align-items: center; justify-content: center;
  min-height: 52px; padding: 0.375rem; border-radius: 0.75rem;
  background: var(--card); border: 1.5px solid transparent; opacity: 0.6;
  transition: opacity 0.15s, border-color 0.15s;
}
.ppick.is-active { background: transparent; opacity: 1; border-color: var(--c, var(--foreground)); }
.ppick.on-bg { background: var(--background); }
.ppick.on-bg.is-active { background: transparent; }
.ppick-add {
  display: inline-flex; align-items: center; gap: 0.375rem;
  min-height: 52px; padding: 0 0.75rem; border-radius: 0.75rem;
  border: 1px dashed var(--border); color: var(--muted-foreground);
  font-size: 0.6875rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em;
}
.ppick-add svg { width: 0.875rem; height: 0.875rem; }

.sheet-foot { display: flex; gap: 0.75rem; margin-top: 1.5rem; }
.sheet-foot .btn-outline, .sheet-foot .btn-primary { flex: 1; }

/* ---------- Detalje ---------- */
.detail-head {
  position: sticky; top: 0; z-index: 30;
  display: flex; align-items: center; justify-content: space-between;
  border-bottom: 1px solid var(--border);
  background: color-mix(in srgb, var(--background) 95%, transparent);
  backdrop-filter: blur(12px); padding: 1rem 1.25rem;
}
.iconbtn { display: inline-flex; padding: 0.5rem; border: none; background: none; color: var(--muted-foreground); border-radius: 9999px; }
.iconbtn svg { width: 1.5rem; height: 1.5rem; }
.iconbtn.is-fav { color: var(--favorite); }
.iconbtn.is-fav svg { fill: currentColor; }

.detail-main { max-width: var(--maxw-narrow); margin: 0 auto; padding: 0.5rem 1.25rem 0; }
.detail-cover {
  margin: 0 auto; aspect-ratio: 3 / 4; max-width: 260px;
  overflow: hidden; border-radius: var(--radius); background: var(--card);
  box-shadow: 0 25px 50px -12px rgba(0,0,0,0.6);
}
.detail-cover img { width: 100%; height: 100%; object-fit: cover; }
.detail-cover .cover-fallback { position: static; height: 100%; }
.detail-cover .ctitle { font-size: 1.5rem; }

.detail-titlewrap { margin-top: 1.5rem; text-align: center; }
.detail-title { font-family: var(--font-display); font-size: 1.875rem; font-weight: 700; line-height: 1.1; margin: 0; }
.detail-meta { margin-top: 0.5rem; font-size: 0.875rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted-foreground); }
.detail-publisher { margin-top: 0.25rem; font-size: 0.75rem; color: var(--muted-foreground); }

.center-row { display: flex; flex-wrap: wrap; justify-content: center; gap: 0.5rem; }
.mt5 { margin-top: 1.25rem; } .mt3 { margin-top: 0.75rem; } .mt4 { margin-top: 1rem; }
.genre-chip { border-radius: 9999px; border: 1px solid var(--border); padding: 0.25rem 0.75rem; font-size: 0.75rem; color: var(--muted-foreground); }

.igdb-rating { margin-top: 1rem; text-align: center; font-size: 0.875rem; }
.igdb-rating .star { color: var(--rating); }
.igdb-rating .num { font-weight: 600; }
.igdb-rating .lbl { font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted-foreground); }

.summary { max-width: 65ch; margin: 1.5rem auto 0; font-size: 0.875rem; line-height: 1.65; color: var(--muted-foreground); }

.detail-section { margin-top: 2.5rem; }
.section-label { font-family: var(--font-display); font-size: 0.75rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.2em; color: var(--muted-foreground); margin: 0; }

.stars { display: flex; gap: 0.25rem; margin-top: 0.5rem; }
.stars button { border: none; background: none; padding: 0; line-height: 1; color: var(--muted-foreground); font-size: 1.75rem; }
.stars button.on { color: var(--rating); }
.rating-hint { margin-top: 0.5rem; font-size: 0.75rem; color: var(--muted-foreground); }
.rating-reset { border: none; background: none; color: var(--muted-foreground); font-size: 0.7rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.12em; }

.statuspills { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-top: 0.75rem; }
.statuspill {
  min-height: 44px; border-radius: 9999px; border: 1px solid var(--border); background: none;
  color: var(--foreground); padding: 0 1rem;
  font-size: 0.75rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em;
}
.statuspill.is-active { border-color: var(--rating); background: var(--rating); color: var(--background); }
.progress { margin-top: 1.25rem; }
.progress-track { height: 0.375rem; width: 100%; overflow: hidden; border-radius: 9999px; background: var(--border); }
.progress-fill { height: 100%; border-radius: 9999px; background: var(--foreground); transition: width 0.5s; }
.progress-fill.platinum { background: var(--rating); }
.progress-label { margin-top: 0.5rem; font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted-foreground); }

/* ---------- Tilføj ---------- */
.stack { max-width: var(--maxw-narrow); margin: 0 auto; padding: 1.5rem 1.25rem 0; }
.stack > section { margin-bottom: 2rem; }
.scan-big {
  display: flex; width: 100%; align-items: center; justify-content: center; gap: 0.75rem;
  border-radius: 1rem; border: 1px solid var(--border); background: var(--card);
  color: var(--foreground); padding: 2rem 1rem;
}
.scan-big svg { width: 1.5rem; height: 1.5rem; }
.scan-big span { font-family: var(--font-display); font-size: 1.125rem; }
.scan-error { margin-top: 0.5rem; text-align: center; font-size: 0.75rem; color: var(--favorite); }
.subhead { font-size: 0.75rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.2em; color: var(--muted-foreground); margin: 0 0 0.75rem; }
.hint { font-size: 0.8rem; line-height: 1.5; color: var(--muted-foreground); }

.results { margin-top: 1rem; display: flex; flex-direction: column; gap: 0.5rem; list-style: none; padding: 0; }
.result {
  display: flex; width: 100%; align-items: center; gap: 0.75rem; text-align: left;
  border-radius: var(--radius); border: 1px solid var(--border); background: var(--card); padding: 0.75rem;
}
.result.is-picked { border-color: var(--rating); }
.result .thumb { height: 4rem; width: 3rem; flex: 0 0 auto; overflow: hidden; border-radius: 0.25rem; background: var(--background); }
.result .thumb img { width: 100%; height: 100%; object-fit: cover; }
.result .info { min-width: 0; flex: 1; }
.result .rtitle { display: block; font-size: 0.875rem; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.result .rsub { display: block; margin-top: 0.125rem; font-size: 0.75rem; color: var(--muted-foreground); }

.pickcard { border-radius: 1rem; border: 1px solid var(--border); background: var(--card); padding: 1.25rem; }
.pickcard h2 { font-family: var(--font-display); font-size: 1.125rem; margin: 0; }
.pick-label { margin-top: 0.25rem; font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted-foreground); }

.addplatform { border-radius: 1rem; border: 1px solid color-mix(in srgb, var(--rating) 40%, transparent); background: var(--card); padding: 1.25rem; scroll-margin-top: 6rem; }
.addplatform-head { display: flex; align-items: center; gap: 0.5rem; }
.addplatform-head svg { width: 1rem; height: 1rem; color: var(--rating); }
.addplatform-head h2 { font-family: var(--font-display); font-size: 1.125rem; margin: 0; }
.custom-list { margin: 1rem 0 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 0.5rem; }
.custom-list li { display: flex; align-items: center; justify-content: space-between; border-radius: 0.5rem; border: 1px solid var(--border); background: var(--background); padding: 0.5rem 0.75rem; }
.custom-list .left { display: flex; align-items: center; gap: 0.75rem; }
.icon-danger { border: none; background: none; color: var(--muted-foreground); padding: 0.5rem; border-radius: 9999px; }
.icon-danger:hover { color: var(--favorite); }
.icon-danger svg { width: 1rem; height: 1rem; }

.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0.75rem; margin-top: 1rem; }
.field {
  height: 2.75rem; width: 100%; border-radius: var(--radius); border: 1px solid var(--border);
  background: var(--background); color: var(--foreground); padding: 0 0.75rem; font-size: 16px; outline: none;  /* 16px → ingen iOS-zoom ved fokus */
}
.field:focus { border-color: var(--muted-foreground); }
.color-row { display: flex; align-items: center; justify-content: space-between; border-radius: 0.5rem; border: 1px solid var(--border); background: var(--background); padding: 0.5rem 0.75rem; margin-top: 0.75rem; }
.color-row label { display: flex; align-items: center; gap: 0.75rem; font-size: 0.875rem; color: var(--muted-foreground); }
.color-row input[type=color] { height: 2.25rem; width: 3rem; border-radius: 0.25rem; border: 1px solid var(--border); background: var(--background); padding: 0; }

.alert { border-radius: var(--radius); border: 1px solid color-mix(in srgb, var(--favorite) 40%, transparent); background: color-mix(in srgb, var(--favorite) 12%, transparent); color: var(--foreground); padding: 0.75rem; font-size: 0.875rem; }

/* ---------- Scan ---------- */
.scanwrap { display: flex; flex-direction: column; gap: 0.75rem; }
.scanview { position: relative; aspect-ratio: 3 / 4; max-width: 22rem; width: 100%; margin: 0 auto; overflow: hidden; border-radius: 1rem; background: #000; }
.scanview video { width: 100%; height: 100%; object-fit: cover; }
.scanframe { position: absolute; inset: 12% 10%; border: 2px solid rgba(255,255,255,0.7); border-radius: 0.75rem; }
.scan-hit { text-align: center; font-size: 0.8rem; color: var(--rating); }

/* ---------- Bottom nav ---------- */
.bottomnav {
  position: sticky; bottom: 0; z-index: 40;
  border-top: 1px solid var(--border);
  background: color-mix(in srgb, var(--background) 70%, transparent);
  backdrop-filter: blur(12px);
}
.bottomnav-inner { max-width: var(--maxw); margin: 0 auto; display: flex; align-items: stretch; justify-content: space-around; list-style: none; padding: 0; }
.bottomnav-inner li { flex: 1; }
.navitem {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 0.25rem;
  min-height: 56px; padding: 0.5rem;
  font-size: 0.625rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.15em;
  color: var(--muted-foreground); transition: color 0.15s;
}
.navitem.is-active { color: var(--rating); }
.navitem.is-active .navicon svg { fill: none; }
.navicon svg { width: 1.25rem; height: 1.25rem; }

.has-bottomnav { padding-bottom: 1.25rem; }

/* ---------- Animation ---------- */
@keyframes fadeInUp { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.fade-in-up { animation: fadeInUp 0.35s ease both; }
