/*
 * PS Library - plain CSS on purpose: it must render in the PS4 browser (old WebKit).
 * Avoid: flex gap, aspect-ratio, clamp(), :is/:where, nesting, color-mix, oklch.
 */
:root {
  --bg: #0b0e14;
  --bg-2: #121722;
  --bg-3: #1a2130;
  --line: #263044;
  --text: #e8ecf3;
  --muted: #8b96ab;
  --accent: #3d8bfd;
  --accent-2: #2a6fd6;
  --ps4: #3d8bfd;
  --ps5: #e8ecf3;
  --ok: #34c77b;
  --warn: #f2b33d;
  --bad: #f05b5b;
  --radius: 10px;
}

* { box-sizing: border-box; }

html, body { margin: 0; padding: 0; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 18px;
  line-height: 1.45;
}

a { color: var(--accent); text-decoration: none; }
a:hover, a:focus { text-decoration: underline; }

img { max-width: 100%; }

h1, h2, h3 { line-height: 1.2; margin: 0 0 12px; }
h1 { font-size: 34px; }
h2 { font-size: 24px; }
h3 { font-size: 19px; }

.muted { color: var(--muted); }
.small { font-size: 14px; }
.mono { font-family: Consolas, "SF Mono", Menlo, monospace; font-size: 15px; }
.right { text-align: right; }
.nowrap { white-space: nowrap; }
.hidden { display: none; }
.mt { margin-top: 16px; }
.mb { margin-bottom: 16px; }

/* ---- Layout ---- */
.topbar {
  display: -webkit-flex; display: flex;
  -webkit-align-items: center; align-items: center;
  padding: 0 28px;
  height: 68px;
  background: rgba(11, 14, 20, 0.92);
  border-bottom: 1px solid var(--line);
  position: -webkit-sticky; position: sticky;
  top: 0;
  z-index: 10;
}
.brand {
  font-weight: 700;
  font-size: 22px;
  color: var(--text);
  margin-right: 28px;
  letter-spacing: 0.5px;
}
.brand span { color: var(--accent); }
.nav a {
  display: inline-block;
  color: var(--muted);
  padding: 10px 16px;
  margin-right: 4px;
  border-radius: 999px;
  font-weight: 600;
}
.nav a:hover, .nav a:focus, .nav a.active {
  color: var(--text);
  background: var(--bg-3);
  text-decoration: none;
}
.topbar .spacer { -webkit-flex: 1; flex: 1; }

.page { padding: 28px; max-width: 1800px; margin: 0 auto; }

.subnav { margin-bottom: 24px; border-bottom: 1px solid var(--line); }
.subnav a {
  display: inline-block;
  padding: 10px 16px;
  color: var(--muted);
  font-weight: 600;
  border-bottom: 3px solid transparent;
  margin-right: 6px;
}
.subnav a.active, .subnav a:hover { color: var(--text); border-bottom-color: var(--accent); text-decoration: none; }

/* ---- Messages ---- */
.flash {
  padding: 14px 18px;
  border-radius: var(--radius);
  margin-bottom: 20px;
  background: rgba(52, 199, 123, 0.12);
  border: 1px solid rgba(52, 199, 123, 0.4);
}
.flash.error { background: rgba(240, 91, 91, 0.12); border-color: rgba(240, 91, 91, 0.45); }
.flash ul { margin: 0; padding-left: 20px; }

/* ---- Forms & buttons ---- */
.btn, button {
  display: inline-block;
  font: inherit;
  font-weight: 600;
  font-size: 17px;
  color: #fff;
  background: var(--accent);
  border: 2px solid transparent;
  border-radius: 999px;
  padding: 11px 24px;
  cursor: pointer;
  text-decoration: none;
  vertical-align: middle;
}
.btn:hover, button:hover, .btn:focus, button:focus { background: var(--accent-2); text-decoration: none; outline: none; border-color: #fff; }
.btn.secondary, button.secondary { background: var(--bg-3); color: var(--text); }
.btn.danger, button.danger { background: transparent; color: var(--bad); border-color: rgba(240, 91, 91, 0.5); }
.btn.small, button.small { padding: 6px 14px; font-size: 14px; }
.btn[disabled], button[disabled] { opacity: 0.4; cursor: default; }

input[type=text], input[type=email], input[type=password], input[type=search], input[type=url],
input[type=date], select, textarea {
  font: inherit;
  color: var(--text);
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 11px 14px;
  width: 100%;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); }
input[type=checkbox] { width: 22px; height: 22px; vertical-align: middle; }
textarea { min-height: 140px; }
label { display: block; font-weight: 600; margin-bottom: 6px; }
.field { margin-bottom: 18px; }
.inline-form { display: inline; }

.row { display: -webkit-flex; display: flex; -webkit-flex-wrap: wrap; flex-wrap: wrap; margin: 0 -8px; }
.row > * { padding: 0 8px; }
.col { -webkit-flex: 1; flex: 1; min-width: 200px; }
.col-auto { -webkit-flex: 0 0 auto; flex: 0 0 auto; }

.card {
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 22px;
  margin-bottom: 22px;
}

/* ---- Tables ---- */
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 12px 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { color: var(--muted); font-size: 14px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.5px; }
tr:hover td { background: rgba(255, 255, 255, 0.02); }

/* ---- Badges ---- */
.badge {
  display: inline-block;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.5px;
  padding: 3px 9px;
  border-radius: 6px;
  background: var(--bg-3);
  color: var(--muted);
  vertical-align: middle;
  text-transform: uppercase;
}
.badge.ps4 { background: var(--ps4); color: #fff; }
.badge.ps5 { background: var(--ps5); color: #000; }
.badge.ok { background: rgba(52, 199, 123, 0.18); color: var(--ok); }
.badge.warn { background: rgba(242, 179, 61, 0.18); color: var(--warn); }
.badge.bad { background: rgba(240, 91, 91, 0.18); color: var(--bad); }
.chip {
  display: inline-block;
  padding: 5px 14px;
  border-radius: 999px;
  background: var(--bg-3);
  color: var(--text);
  margin: 0 6px 6px 0;
  font-size: 15px;
}

/* ---- Library ---- */
.filters { margin-bottom: 26px; }
.filters .tabs a {
  display: inline-block;
  padding: 9px 20px;
  border-radius: 999px;
  color: var(--muted);
  font-weight: 700;
  margin-right: 6px;
  background: var(--bg-2);
}
.filters .tabs a.active { background: var(--text); color: #000; }
.filters form { margin-top: 14px; }

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  grid-gap: 22px;
  gap: 22px;
}
.tile {
  display: block;
  color: var(--text);
  border-radius: var(--radius);
  outline: none;
  -webkit-transition: -webkit-transform 0.15s ease;
  transition: transform 0.15s ease;
}
.tile:hover, .tile:focus { -webkit-transform: scale(1.04); transform: scale(1.04); text-decoration: none; }
.tile .art {
  position: relative;
  width: 100%;
  padding-top: 100%; /* square: no aspect-ratio on old WebKit */
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--bg-3);
  border: 3px solid transparent;
}
.tile:focus .art, .tile:hover .art { border-color: #fff; }
.tile .art img, .tile .art .placeholder {
  position: absolute; top: 0; left: 0;
  width: 100%; height: 100%;
  object-fit: cover;
}
.tile .art .placeholder {
  display: -webkit-flex; display: flex;
  -webkit-align-items: center; align-items: center;
  -webkit-justify-content: center; justify-content: center;
  text-align: center;
  padding: 12px;
  font-weight: 700;
  color: var(--muted);
}
.tile .art .badge { position: absolute; top: 8px; left: 8px; }
.tile .name { font-weight: 600; margin-top: 10px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tile .meta { font-size: 14px; color: var(--muted); }

.pagination { margin-top: 30px; text-align: center; }
.pagination a, .pagination span {
  display: inline-block; padding: 8px 14px; margin: 0 3px; border-radius: 8px; background: var(--bg-2); color: var(--text);
}
.pagination .current { background: var(--accent); }

/* ---- Game page ---- */
.hero {
  position: relative;
  margin: -28px -28px 28px;
  min-height: 420px;
  background-color: var(--bg-2);
  background-size: cover;
  background-position: center top;
}
.hero .shade {
  position: absolute; top: 0; left: 0; right: 0; bottom: 0;
  background: -webkit-linear-gradient(top, rgba(11,14,20,0.2) 0%, rgba(11,14,20,0.75) 60%, #0b0e14 100%);
  background: linear-gradient(to bottom, rgba(11,14,20,0.2) 0%, rgba(11,14,20,0.75) 60%, #0b0e14 100%);
}
.hero .content {
  position: relative;
  display: -webkit-flex; display: flex;
  -webkit-align-items: flex-end; align-items: flex-end;
  padding: 140px 28px 28px;
  max-width: 1800px;
  margin: 0 auto;
}
.hero .icon {
  width: 220px; height: 220px;
  border-radius: 14px;
  object-fit: cover;
  margin-right: 30px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.6);
  background: var(--bg-3);
}
.hero h1 { font-size: 44px; text-shadow: 0 2px 12px rgba(0, 0, 0, 0.7); }
.facts span { margin-right: 22px; color: var(--muted); }
.facts strong { color: var(--text); }

.screens {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  grid-gap: 14px;
  gap: 14px;
}
.screens a { display: block; border-radius: 8px; overflow: hidden; border: 3px solid transparent; }
.screens a:focus, .screens a:hover { border-color: #fff; }
.screens img { display: block; width: 100%; }

.lightbox {
  position: fixed; top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0, 0, 0, 0.92);
  z-index: 50;
  display: -webkit-flex; display: flex;
  -webkit-align-items: center; align-items: center;
  -webkit-justify-content: center; justify-content: center;
}
.lightbox img { max-width: 94%; max-height: 92%; }

.download-bar {
  display: -webkit-flex; display: flex;
  -webkit-align-items: center; align-items: center;
  -webkit-flex-wrap: wrap; flex-wrap: wrap;
  padding-top: 16px;
}
.download-bar > * { margin: 0 14px 10px 0; }
.download-bar select { width: auto; min-width: 240px; }

/* ---- Downloads ---- */
.progress { height: 10px; background: var(--bg-3); border-radius: 999px; overflow: hidden; min-width: 160px; }
.progress div { height: 100%; background: var(--accent); width: 0; -webkit-transition: width 0.5s; transition: width 0.5s; }
.status-done .progress div { background: var(--ok); }
.status-failed .progress div { background: var(--bad); }
.status-paused .progress div { background: var(--warn); }

/* ---- Login ---- */
.login {
  max-width: 440px;
  margin: 12vh auto 0;
}

.thumb { width: 64px; height: 64px; object-fit: cover; border-radius: 8px; background: var(--bg-3); }
.pair-code { font-size: 34px; font-weight: 800; letter-spacing: 6px; color: var(--accent); }

.hero .content > div { -webkit-flex: 1; flex: 1; min-width: 0; }

/* ---- Phones / narrow windows ---- */
@media (max-width: 760px) {
  body { font-size: 16px; }
  .topbar { padding: 0 12px; height: 58px; }
  .brand { font-size: 18px; margin-right: 10px; }
  .nav a { padding: 8px 10px; margin-right: 0; }
  .page { padding: 16px; }
  .hero { margin: -16px -16px 20px; min-height: 0; }
  .hero .content { display: block; padding: 90px 16px 16px; }
  .hero .icon { width: 120px; height: 120px; margin: 0 0 14px; }
  .hero h1 { font-size: 28px; }
  .grid { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); grid-gap: 14px; gap: 14px; }
  .screens { grid-template-columns: 1fr; }
  table { display: block; overflow-x: auto; }
  .card { padding: 16px; }
}

/* ---- Game page, PlayStation Store layout ---- */
.icon { display: inline-block; vertical-align: middle; -webkit-flex-shrink: 0; flex-shrink: 0; }

.store-top { position: relative; margin-bottom: 30px; }
.store-bg {
  height: 400px;
  background-color: var(--bg-2);
  background-size: cover;
  background-position: center 20%;
}
.store-head {
  display: -webkit-flex; display: flex;
  -webkit-align-items: flex-start; align-items: flex-start;
  max-width: 1800px;
  margin: -300px auto 0;
  padding: 0 40px;
  position: relative;
}
.store-panel {
  width: 600px;
  -webkit-flex-shrink: 0; flex-shrink: 0;
  background: rgba(28, 29, 33, 0.97);
  padding: 40px 48px 44px;
  border-radius: 4px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.45);
}
.store-icon { width: 128px; height: 128px; border-radius: 12px; object-fit: cover; display: block; margin-bottom: 20px; }
.store-panel h1 { font-size: 46px; font-weight: 400; margin-bottom: 14px; }
.store-publisher { font-size: 14px; font-weight: 700; letter-spacing: 0.4px; text-transform: uppercase; margin-bottom: 12px; }
.store-tags { margin-bottom: 8px; }
.platform-tag {
  display: inline-block;
  border: 1px solid #c8ccd4;
  border-radius: 3px;
  font-size: 11px;
  font-weight: 700;
  padding: 1px 6px;
  margin-right: 8px;
  vertical-align: middle;
}
.store-rating { display: -webkit-flex; display: flex; -webkit-align-items: center; align-items: center; font-size: 22px; margin: 6px 0 4px; }
.store-rating .score { margin-right: 10px; }
.store-rating .stars { color: #fff; margin-right: 12px; white-space: nowrap; }
.store-rating .stars .icon { margin-right: 2px; }
.store-size { font-size: 26px; margin: 26px 0 22px; }
.store-cta {
  display: block;
  text-align: center;
  background: #d53b00;
  padding: 14px 24px;
  font-size: 18px;
}
.store-cta:hover, .store-cta:focus { background: #b33200; }

.store-side { -webkit-flex: 1; flex: 1; min-width: 0; padding: 330px 0 0 50px; }
.feature-list {
  list-style: none; margin: 0; padding: 0;
  display: grid;
  grid-template-columns: repeat(2, minmax(220px, 280px));
  grid-gap: 14px 30px;
  gap: 14px 30px;
}
.feature-list.single { grid-template-columns: minmax(220px, 300px); }
.feature-list li { display: -webkit-flex; display: flex; -webkit-align-items: center; align-items: center; font-size: 16px; line-height: 1.3; }
.feature-list li .icon { margin-right: 12px; }
.feature-group { margin-top: 22px; }
.feature-group h3 { font-size: 16px; margin-bottom: 10px; }
.age-rating { display: -webkit-flex; display: flex; -webkit-align-items: flex-start; align-items: flex-start; margin-top: 24px; }
.age-rating > img { height: 76px; margin-right: 18px; }
.age-rating figure { margin: 0 14px 0 0; text-align: center; font-size: 15px; }
.age-rating figure img { height: 60px; display: block; margin: 0 auto 6px; }

.spec-table { margin-bottom: 30px; background: var(--bg-2); border-radius: var(--radius); overflow: hidden; }
.spec-table th { background: var(--bg-3); padding: 14px 18px; }
.spec-table th .icon { margin-right: 6px; color: var(--accent); }
.spec-table td { padding: 16px 18px; font-size: 18px; vertical-align: top; }
.spec-table .chip { margin-bottom: 0; }

.screens-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  grid-gap: 22px;
  gap: 22px;
  margin-bottom: 30px;
}
.screens-row a { display: block; border-radius: 10px; overflow: hidden; border: 3px solid transparent; }
.screens-row a:hover, .screens-row a:focus { border-color: #fff; }
.screens-row img { display: block; width: 100%; height: 100%; object-fit: cover; }

@media (max-width: 1100px) {
  .store-head { display: block; margin-top: -200px; padding: 0 16px; }
  .store-panel { width: auto; max-width: 600px; }
  .store-side { padding: 26px 0 0; }
  .screens-row { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 760px) {
  .store-bg { height: 240px; }
  .store-head { margin-top: -120px; }
  .store-panel { padding: 24px; }
  .store-panel h1 { font-size: 32px; }
  .store-icon { width: 96px; height: 96px; }
  .feature-list { grid-template-columns: 1fr; }
  .spec-table thead { display: none; }
  .spec-table td { display: block; }
  .screens-row { grid-template-columns: 1fr; }
}
