:root {
  --bg: #ffffff;
  --bg-elev: #f5f5f7;
  --fill: rgba(120, 120, 128, 0.12);
  --fill-strong: rgba(120, 120, 128, 0.2);
  --text: #1d1d1f;
  --text-2: #6e6e73;
  --text-3: #8e8e93;
  --sep: rgba(60, 60, 67, 0.18);
  --blue: #0071e3;
  --blue-hover: #0077ed;
  --bar: rgba(255, 255, 255, 0.72);
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.06), 0 8px 24px rgba(0, 0, 0, 0.08);
  --radius: 14px;
  --maxw: 1080px;
  --gutter: 32px;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #1e1e1e;
    --bg-elev: #2a2a2c;
    --fill: rgba(120, 120, 128, 0.24);
    --fill-strong: rgba(120, 120, 128, 0.36);
    --text: #f5f5f7;
    --text-2: #a1a1a6;
    --text-3: #8e8e93;
    --sep: rgba(84, 84, 88, 0.6);
    --blue: #0a84ff;
    --blue-hover: #409cff;
    --bar: rgba(30, 30, 30, 0.72);
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 8px 24px rgba(0, 0, 0, 0.35);
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.45 -apple-system, BlinkMacSystemFont, "SF Pro Text", "Inter", "Segoe UI", system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }
button { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid color-mix(in srgb, var(--blue) 55%, transparent); outline-offset: 2px; }
h1, h2, h3 { margin: 0; letter-spacing: -0.01em; }
.muted { color: var(--text-2); }

/* ---------- Top bar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 20;
  background: var(--bar);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  border-bottom: 0.5px solid var(--sep);
}
.topbar-inner {
  max-width: var(--maxw); margin: 0 auto; height: 52px;
  padding: 0 var(--gutter);
  display: flex; align-items: center; gap: 10px;
}
.topbar-title { font-weight: 600; font-size: 15px; }
.back {
  width: 30px; height: 30px; border: 0; border-radius: 8px; background: transparent;
  display: grid; place-items: center; cursor: pointer; color: var(--text-2);
}
.back[hidden] { display: none; }
.back:hover { background: var(--fill); color: var(--text); }
.back svg { width: 10px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }

.view { max-width: var(--maxw); margin: 0 auto; padding: 24px var(--gutter) 80px; }
.view.enter { animation: enter 0.35s cubic-bezier(0.2, 0.8, 0.2, 1); }
@keyframes enter { from { opacity: 0; transform: translateY(8px); } }
@media (prefers-reduced-motion: reduce) { .view.enter { animation: none; } }

/* ---------- Icons ---------- */
/* macOS icons ship with their own shape + padding, so we don't clip them */
.icon { display: block; object-fit: contain; flex: none; }
.icon-sm { width: 44px; height: 44px; }
.icon-md { width: 64px; height: 64px; }
.icon-xl { width: 168px; height: 168px; }

/* ---------- Get / Download button ---------- */
.get {
  flex: none; display: inline-grid; place-items: center;
  min-width: 68px; height: 28px; padding: 0 16px;
  border-radius: 999px; background: var(--fill);
  color: var(--blue); font-weight: 700; font-size: 13px; letter-spacing: 0.02em;
  text-transform: uppercase; cursor: pointer;
  transition: background 0.15s, transform 0.1s;
}
.get:hover { background: var(--fill-strong); text-decoration: none; }
.get:active { transform: scale(0.96); }
.get-big {
  height: 34px; min-width: 120px; padding: 0 22px; font-size: 14px; text-transform: none; letter-spacing: 0;
  background: var(--blue); color: #fff;
}
.get-big:hover { background: var(--blue-hover); }
.get.loading { background: var(--fill); pointer-events: none; }
.ring { width: 18px; height: 18px; animation: spin 0.9s linear infinite; }
.ring circle { fill: none; stroke: var(--blue); stroke-width: 2.5; stroke-dasharray: 40 60; stroke-linecap: round; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Home ---------- */
.page-title { font-size: 34px; font-weight: 700; margin: 8px 0 20px; }
.section-title { font-size: 22px; font-weight: 700; margin: 40px 0 8px; }
.empty { color: var(--text-2); padding: 40px 0; }

.hero {
  position: relative; display: block; overflow: hidden; cursor: pointer;
  height: 420px; border-radius: 18px; color: #fff;
  background: linear-gradient(135deg, var(--a1), var(--a2));
  box-shadow: var(--shadow);
  transition: transform 0.25s cubic-bezier(0.2, 0.8, 0.2, 1), box-shadow 0.25s;
}
.hero:hover { transform: scale(1.008); }
.hero-copy { position: relative; z-index: 1; padding: 28px 32px; max-width: 520px; }
.eyebrow { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; opacity: 0.8; }
.hero h2 { font-size: 40px; font-weight: 800; margin: 4px 0 6px; line-height: 1.05; }
.hero p { margin: 0; font-size: 18px; opacity: 0.9; }
.hero-shot {
  position: absolute; right: -40px; bottom: -70px; width: min(64%, 640px);
  border-radius: 12px; box-shadow: 0 20px 60px rgba(0, 0, 0, 0.35);
  transform: rotate(-4deg);
  transition: transform 0.4s cubic-bezier(0.2, 0.8, 0.2, 1);
}
.hero:hover .hero-shot { transform: rotate(-3deg) translateY(-6px); }
.hero-bar {
  position: absolute; left: 0; right: 0; bottom: 0; z-index: 2;
  display: flex; align-items: center; gap: 12px; padding: 14px 20px;
  background: linear-gradient(90deg, color-mix(in srgb, var(--a1) 62%, #000), color-mix(in srgb, var(--a2) 62%, #000));
}
.hero-bar .row-sub { color: rgba(255, 255, 255, 0.75); }
.hero-bar .get { background: rgba(255, 255, 255, 0.92); color: var(--blue); }
.hero-bar .get:hover { background: #fff; }

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); column-gap: 28px; }
.row {
  display: flex; align-items: center; gap: 14px; padding: 12px 0; cursor: pointer;
  border-bottom: 0.5px solid var(--sep); border-radius: 4px; color: inherit;
}
.row:hover .row-name { color: var(--blue); }
.row-text { flex: 1; min-width: 0; }
.row-name { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row-sub { font-size: 13px; color: var(--text-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ---------- Detail ---------- */
.app-header { display: flex; align-items: center; gap: 28px; padding: 8px 0 24px; }
.app-head-text { min-width: 0; }
.app-header h1 { font-size: 30px; font-weight: 700; line-height: 1.15; }
.subtitle { margin: 2px 0 6px; font-size: 18px; color: var(--text-2); }
.dev-link { font-size: 14px; }
.actions { display: flex; align-items: center; gap: 10px; margin-top: 16px; }
.share {
  width: 34px; height: 34px; border-radius: 999px; border: 0; background: var(--fill);
  color: var(--blue); display: grid; place-items: center; cursor: pointer;
}
.share:hover { background: var(--fill-strong); }
.share svg { width: 18px; height: 18px; }
.price-note { font-size: 12px; color: var(--text-3); }

.badges {
  display: flex; overflow-x: auto; scrollbar-width: none;
  border-top: 0.5px solid var(--sep); border-bottom: 0.5px solid var(--sep);
  padding: 12px 0;
}
.badges::-webkit-scrollbar { display: none; }
.badge {
  flex: 1 0 120px; text-align: center; padding: 2px 12px;
  display: flex; flex-direction: column; align-items: center; gap: 2px;
}
.badge + .badge { border-left: 0.5px solid var(--sep); }
.badge-label { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; color: var(--text-3); }
.badge-value { font-size: 22px; font-weight: 700; color: var(--text-2); height: 30px; display: grid; place-items: center; }
.badge-value svg { width: 24px; height: 24px; fill: var(--text-2); }
.badge-sub { font-size: 12px; color: var(--text-3); max-width: 140px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.stars { display: inline-flex; gap: 1px; font-size: 12px; letter-spacing: 0; }
.star { position: relative; color: var(--fill-strong); }
.star > span { position: absolute; inset: 0; overflow: hidden; color: var(--text-2); }

.block { padding: 28px 0; border-bottom: 0.5px solid var(--sep); }
.block:last-child { border-bottom: 0; }
.block-title { font-size: 22px; font-weight: 700; margin-bottom: 14px; }

/* screenshots */
.shots-block { padding-top: 24px; }
.shots-wrap { position: relative; }
.shots {
  display: flex; gap: 16px; overflow-x: auto; scroll-snap-type: x mandatory;
  scrollbar-width: none; padding: 4px 2px 16px;
}
.shots::-webkit-scrollbar { display: none; }
.shot {
  flex: 0 0 min(560px, 82%); scroll-snap-align: start; padding: 0; border: 0;
  background: none; cursor: zoom-in; border-radius: 10px;
}
.shot img {
  display: block; width: 100%; aspect-ratio: 16 / 10; object-fit: cover;
  border-radius: 10px; border: 0.5px solid var(--sep); background: var(--bg-elev);
}
.shots-nav {
  position: absolute; top: calc(50% - 18px); transform: translateY(-50%); z-index: 2;
  width: 36px; height: 36px; border-radius: 999px; border: 0; cursor: pointer;
  background: var(--bar); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  box-shadow: var(--shadow); font-size: 24px; line-height: 1; color: var(--text);
  opacity: 0; transition: opacity 0.2s;
}
.shots-nav.prev { left: -14px; }
.shots-nav.next { right: -14px; }
.shots-wrap:hover .shots-nav:not(:disabled), .shots-nav:focus-visible { opacity: 1; }
.shots-nav:disabled { pointer-events: none; }
.platform { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--text-2); }
.platform svg { width: 18px; height: 14px; }

/* description */
.desc-block { display: grid; grid-template-columns: minmax(0, 1fr) 220px; column-gap: 40px; align-items: start; }
.desc { white-space: pre-line; grid-column: 1; }
.desc.collapsed { display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; overflow: hidden; }
.more {
  grid-column: 1; justify-self: end; border: 0; background: none; padding: 0;
  color: var(--blue); cursor: pointer; font-size: 14px; margin-top: -1.45em;
  box-shadow: -24px 0 16px var(--bg); background: var(--bg); padding-left: 4px;
}
.desc-side { grid-column: 2; grid-row: 1 / span 2; display: flex; flex-direction: column; gap: 2px; font-size: 14px; }
.side-link { margin-top: 10px; }
.ext { width: 10px; height: 10px; vertical-align: 0; }

/* ratings */
.rating-big { display: flex; align-items: center; gap: 14px; }
.rating-num { font-size: 56px; font-weight: 700; line-height: 1; color: var(--text-2); }
.rating-big .stars { font-size: 16px; }

/* what's new */
.whats-new { display: flex; justify-content: space-between; gap: 24px; }
.whats-new p { margin: 0; white-space: pre-line; }
.wn-meta { flex: none; display: flex; flex-direction: column; align-items: flex-end; font-size: 13px; color: var(--text-2); }

/* information */
.info { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px 28px; margin: 0; }
.info dt { font-size: 13px; color: var(--text-2); }
.info dd { margin: 2px 0 0; font-size: 14px; overflow-wrap: anywhere; }
.info > div { padding-bottom: 14px; border-bottom: 0.5px solid var(--sep); }
.info-links { display: flex; gap: 24px; margin-top: 20px; font-size: 14px; }

/* ---------- Lightbox ---------- */
.lightbox {
  position: fixed; inset: 0; z-index: 50; display: grid; place-items: center;
  background: rgba(0, 0, 0, 0.82); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  animation: fade 0.2s ease;
}
.lightbox[hidden] { display: none; }
@keyframes fade { from { opacity: 0; } }
.lightbox img { max-width: min(92vw, 1400px); max-height: 86vh; border-radius: 12px; box-shadow: 0 30px 80px rgba(0, 0, 0, 0.5); }
.lb-btn {
  position: absolute; border: 0; cursor: pointer; color: #fff;
  background: rgba(255, 255, 255, 0.14); border-radius: 999px;
  width: 44px; height: 44px; font-size: 26px; line-height: 1;
}
.lb-btn:hover { background: rgba(255, 255, 255, 0.24); }
.lb-close { top: 20px; right: 20px; font-size: 18px; }
.lb-prev { left: 20px; top: 50%; transform: translateY(-50%); }
.lb-next { right: 20px; top: 50%; transform: translateY(-50%); }

/* ---------- Toast ---------- */
.toast {
  position: fixed; left: 50%; bottom: 28px; z-index: 60;
  transform: translate(-50%, 20px); opacity: 0; pointer-events: none;
  background: var(--text); color: var(--bg); padding: 10px 18px; border-radius: 999px;
  font-size: 14px; font-weight: 500; box-shadow: var(--shadow);
  transition: opacity 0.2s, transform 0.25s cubic-bezier(0.2, 0.8, 0.2, 1);
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ---------- Responsive ---------- */
@media (max-width: 760px) {
  :root { --gutter: 16px; }
  .page-title { font-size: 28px; }
  .hero { height: 360px; }
  .hero h2 { font-size: 30px; }
  .hero-copy { padding: 22px; }
  .hero-shot { width: 92%; right: -16%; bottom: -10px; }
  .app-header { gap: 16px; align-items: flex-start; }
  .icon-xl { width: 104px; height: 104px; }
  .app-header h1 { font-size: 22px; }
  .subtitle { font-size: 15px; }
  .badge { flex-basis: 104px; }
  .desc-block { grid-template-columns: minmax(0, 1fr); }
  .desc-side { grid-column: 1; grid-row: auto; margin-top: 18px; }
  .info { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .whats-new { flex-direction: column-reverse; gap: 6px; }
  .wn-meta { flex-direction: row; justify-content: space-between; align-items: center; }
  .lb-prev, .lb-next { top: auto; bottom: 24px; transform: none; }
  .shots-nav { display: none; }
}
