:root {
  --blue: #2338f0;
  --ink: #0d1033;
  --paper: #fbfaf5;
  --sand: #f0eee4;
  --yellow: #ffd23f;
  --display: "Bricolage Grotesque", system-ui, -apple-system, "Segoe UI", sans-serif;
  --text: "Newsreader", Georgia, "Times New Roman", serif;
}

* { box-sizing: border-box; }

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--text);
  font-size: 1.125rem;
  line-height: 1.6;
}

a { color: inherit; }

:focus-visible {
  outline: 3px solid var(--blue);
  outline-offset: 3px;
}

.hero :focus-visible,
.footer :focus-visible {
  outline-color: var(--yellow);
}

.wrap {
  width: 100%;
  max-width: 920px;
  margin: 0 auto;
  padding: 0 20px;
}

/* ---------- Hero ---------- */

.hero {
  position: relative;
  display: flex;
  flex-direction: column;
  min-height: min(92vh, 760px);
  background: var(--blue);
  color: #fff;
  overflow: hidden;
}

.bar {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px clamp(20px, 5vw, 56px);
}

.brand {
  font-family: var(--display);
  font-weight: 700;
  font-size: 1.05rem;
  letter-spacing: 0.01em;
  text-decoration: none;
}

.bar nav {
  display: flex;
  gap: 22px;
}

.bar nav a {
  font-family: var(--display);
  font-weight: 500;
  font-size: 0.98rem;
  text-decoration: none;
  opacity: 0.9;
}

.bar nav a:hover {
  opacity: 1;
  text-decoration: underline;
  text-underline-offset: 5px;
}

.hero-copy {
  position: relative;
  z-index: 2;
  margin-top: auto;
  padding: clamp(24px, 6vw, 64px) clamp(20px, 5vw, 56px) clamp(120px, 22vw, 220px);
}

.hero h1 {
  margin: 0;
  font-family: var(--display);
  font-weight: 800;
  font-stretch: 85%;
  font-size: clamp(4.2rem, 17vw, 12rem);
  line-height: 0.88;
  letter-spacing: -0.035em;
}

.hero h1 span { display: block; }
.hero h1 span:last-child { color: var(--yellow); }

.lede {
  max-width: 28ch;
  margin: 22px 0 28px;
  font-size: clamp(1.25rem, 3vw, 1.6rem);
  line-height: 1.3;
}

.wave {
  position: absolute;
  left: 0;
  bottom: 0;
  z-index: 1;
  display: block;
  width: 100%;
  height: clamp(120px, 24vw, 240px);
}

/* ---------- Buttons ---------- */

.button {
  display: inline-block;
  padding: 14px 26px;
  border-radius: 999px;
  background: var(--yellow);
  color: var(--ink);
  font-family: var(--display);
  font-weight: 700;
  font-size: 1rem;
  text-decoration: none;
  transition: transform 0.15s ease;
}

.button:hover { transform: translateY(-2px); }

.app .button {
  background: var(--blue);
  color: #fff;
}

/* ---------- Sections ---------- */

.section { padding: clamp(56px, 9vw, 96px) 0; }

.section h2 {
  margin: 0 0 12px;
  font-family: var(--display);
  font-weight: 800;
  font-size: clamp(2rem, 6vw, 3.2rem);
  line-height: 1;
  letter-spacing: -0.02em;
}

.intro { margin: 0 0 24px; max-width: 56ch; }

.note {
  margin: 20px 0 0;
  font-size: 1rem;
  opacity: 0.8;
}

/* ---------- App cards (main screen) ---------- */

:root { --star: #f5a300; }

.sr {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.app-list {
  display: grid;
  gap: 18px;
}

.app {
  position: relative;
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 20px 22px;
  background: #fff;
  border: 2px solid var(--ink);
  border-radius: 20px;
  box-shadow: 6px 6px 0 var(--ink);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.app:hover {
  transform: translate(-2px, -2px);
  box-shadow: 8px 8px 0 var(--blue);
}

.app:has(.app-open:focus-visible) {
  outline: 3px solid var(--blue);
  outline-offset: 4px;
}

.app-body {
  flex: 1 1 auto;
  min-width: 0;
}

.app-name {
  margin: 0;
  font-family: var(--display);
  font-weight: 700;
  font-size: 1.6rem;
  line-height: 1.1;
}

/* The whole card is clickable: the button stretches over it. */
.app-open {
  padding: 0;
  margin: 0;
  border: 0;
  background: none;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.app-open:focus-visible { outline: none; }

.app-open::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
}

.app-meta {
  margin: 4px 0 6px;
  font-family: var(--display);
  font-size: 0.9rem;
  opacity: 0.7;
}

.app-desc { margin: 0 0 8px; }

.app-stats {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 2px 14px;
  font-family: var(--display);
  font-size: 0.9rem;
  font-weight: 600;
}

.rate-star { color: var(--star); }
.rate-n { font-weight: 500; opacity: 0.65; }
.dl { font-weight: 500; opacity: 0.7; }

.app-go {
  flex: none;
  font-family: var(--display);
  font-size: 2.2rem;
  line-height: 1;
  color: var(--blue);
}

/* ---------- App icon ---------- */

.icon {
  flex: none;
  display: grid;
  place-items: center;
  width: 64px;
  height: 64px;
  border: 2px solid var(--ink);
  border-radius: 18px;
  overflow: hidden;
  background: var(--sand);
  color: var(--yellow);
  font-family: var(--display);
  font-weight: 800;
  font-size: 1.9rem;
}

.icon.icon-letter { background: var(--blue); }

.icon img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.icon-lg {
  width: 76px;
  height: 76px;
  border-radius: 22px;
  font-size: 2.3rem;
}

/* ---------- Static star display (supports 4.6 etc.) ---------- */

.stars-static {
  --pct: calc(var(--rating, 0) / 5 * 100%);
  display: inline-block;
  font-size: 1.3rem;
  letter-spacing: 2px;
  line-height: 1;
  background: linear-gradient(90deg, var(--star) var(--pct), #cfd2e0 var(--pct));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: transparent;
}

/* ---------- Popup card ---------- */

html.sheet-open { overflow: hidden; }

.sheet {
  width: min(640px, calc(100vw - 24px));
  max-width: none;
  max-height: none;
  margin: auto;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--ink);
  overflow: visible;
}

.sheet::backdrop { background: rgba(13, 16, 51, 0.62); }
.sheet[open]::backdrop { animation: sheet-fade 0.2s ease; }

.sheet-frame {
  position: relative;
  display: flex;
  flex-direction: column;
  max-height: calc(100vh - 24px);
  max-height: calc(100dvh - 24px);
  background: #fff;
  border: 2px solid var(--ink);
  border-radius: 24px;
  box-shadow: 8px 8px 0 var(--blue);
  overflow: hidden;
}

.sheet[open] .sheet-frame { animation: sheet-pop 0.22s ease; }

@keyframes sheet-fade { from { opacity: 0; } }
@keyframes sheet-pop {
  from { opacity: 0; transform: translateY(16px) scale(0.98); }
}

.sheet-card {
  flex: 1 1 auto;
  min-height: 0;
  padding: 18px 22px 26px;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.sheet-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.pill {
  padding: 6px 14px;
  border: 2px solid var(--ink);
  border-radius: 999px;
  background: #fff;
  color: var(--ink);
  font-family: var(--display);
  font-weight: 700;
  font-size: 0.85rem;
  cursor: pointer;
}

.pill:hover { background: var(--sand); }

.pill-solid { background: var(--yellow); }
.pill-solid:hover { background: #ffdf6b; }

.sheet-head {
  display: flex;
  align-items: center;
  gap: 14px;
}

.sheet-id {
  flex: 1 1 auto;
  min-width: 0;
}

.sheet-title {
  margin: 0;
  font-family: var(--display);
  font-weight: 800;
  font-size: clamp(1.5rem, 5vw, 2rem);
  line-height: 1.05;
  letter-spacing: -0.01em;
}

.sheet-meta {
  margin: 3px 0 4px;
  font-family: var(--display);
  font-size: 0.88rem;
  opacity: 0.7;
}

.sheet .button {
  background: var(--blue);
  color: #fff;
  border: 0;
  cursor: pointer;
}

.sheet-head .button { flex: none; }

.sheet-terms {
  margin: 12px 0 0;
  font-size: 0.8rem;
  line-height: 1.4;
  color: #6a6e85;
}

.sheet-terms a {
  color: inherit;
  text-underline-offset: 2px;
}

.sheet h3 {
  margin: 0 0 8px;
  font-family: var(--display);
  font-weight: 700;
  font-size: 1.2rem;
}

.sheet-about { margin-top: 22px; }
.sheet-about p { margin: 0 0 12px; }

.sheet-feedback {
  margin-top: 26px;
  padding-top: 20px;
  border-top: 2px dashed rgba(13, 16, 51, 0.18);
}

.fb-summary {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 14px;
  margin-bottom: 16px;
}

.fb-score {
  font-family: var(--display);
  font-weight: 800;
  font-size: 2.8rem;
  line-height: 1;
}

.fb-count {
  margin: 4px 0 0;
  font-family: var(--display);
  font-size: 0.9rem;
  opacity: 0.7;
}

.fb-none {
  margin: 0;
  opacity: 0.75;
}

/* ---------- Written reviews ---------- */

.sheet h3.reviews-title { margin: 26px 0 10px; }

.stars-static.sm {
  font-size: 1rem;
  letter-spacing: 1px;
}

.review {
  padding: 14px 0;
  border-top: 1px solid rgba(13, 16, 51, 0.14);
}

.review-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 12px;
  font-family: var(--display);
  font-size: 0.88rem;
}

.review-name { font-weight: 700; }
.review-date { opacity: 0.6; }

.review-text {
  margin: 6px 0 0;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.review-reply {
  margin-top: 10px;
  padding: 10px 14px;
  border-left: 4px solid var(--blue);
  border-radius: 0 12px 12px 0;
  background: var(--sand);
  font-size: 0.95rem;
}

.review-reply strong {
  display: block;
  margin-bottom: 2px;
  font-family: var(--display);
  font-size: 0.82rem;
  color: var(--blue);
}

.review-reply p {
  margin: 0;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.reviews-note {
  margin: 0;
  opacity: 0.7;
}

.reviews-more { margin-top: 6px; }

/* ---------- Screenshot row ---------- */

.shots {
  min-width: 0;
  margin-bottom: 0;
}

.sheet .shots { margin-top: 18px; }

.shots-track {
  display: flex;
  gap: 14px; /* keep in sync with GAP in script.js */
  padding: 6px 4px 12px;
  overflow-x: auto;
  overscroll-behavior-x: contain;
  scroll-snap-type: x mandatory;
  scroll-padding: 0 4px;
  scrollbar-width: thin;
  scrollbar-color: var(--ink) transparent;
  -webkit-overflow-scrolling: touch;
}

.shots-track img {
  flex: none;
  height: clamp(220px, 52vw, 340px);
  width: auto;
  max-width: none;
  aspect-ratio: auto 9 / 19.5;
  border: 2px solid var(--ink);
  border-radius: 16px;
  background: var(--sand);
  scroll-snap-align: start;
}

.shots-controls {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 6px;
}

.shots-controls button {
  padding: 8px 14px;
  border: 2px solid var(--ink);
  border-radius: 999px;
  background: var(--yellow);
  color: var(--ink);
  font-family: var(--display);
  font-weight: 700;
  font-size: 0.9rem;
  cursor: pointer;
}

.shots-controls button:hover { background: #ffdf6b; }

.shots-controls .shots-toggle {
  margin-left: auto;
  background: transparent;
}

.shots-controls .shots-toggle:hover { background: var(--sand); }

/* ---------- Feedback panel (slides over the popup) ---------- */

.feedback-panel {
  position: absolute;
  inset: 0;
  z-index: 2;
  padding: 18px 22px 26px;
  overflow-y: auto;
  background: #fff;
}

.feedback-panel h3 {
  margin: 0;
  font-family: var(--display);
  font-weight: 800;
  font-size: clamp(1.5rem, 5vw, 1.9rem);
  line-height: 1.1;
}

.fb-sub {
  margin: 6px 0 0;
  font-size: 0.95rem;
  opacity: 0.75;
}

.fb-stars {
  margin: 20px 0 0;
  padding: 0;
  border: 0;
}

.fb-stars legend {
  padding: 0;
  margin-bottom: 6px;
  font-family: var(--display);
  font-weight: 700;
}

.stars {
  position: relative;
  display: inline-flex;
  flex-direction: row-reverse;
  gap: 4px;
}

.stars input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.stars label {
  padding: 2px;
  font-size: 2.6rem;
  line-height: 1;
  color: #cfd2e0;
  cursor: pointer;
  transition: color 0.1s ease, transform 0.1s ease;
}

.stars input:checked ~ label,
.stars label:hover,
.stars label:hover ~ label { color: var(--star); }

.stars label:hover { transform: scale(1.08); }

.stars input:focus-visible + label {
  border-radius: 8px;
  outline: 3px solid var(--blue);
  outline-offset: 2px;
}

.fb-label {
  display: block;
  margin: 20px 0 6px;
  font-family: var(--display);
  font-weight: 700;
}

.fb-form textarea,
.fb-form input[type="text"] {
  display: block;
  width: 100%;
  padding: 12px 14px;
  border: 2px solid var(--ink);
  border-radius: 14px;
  background: #fff;
  color: var(--ink);
  font: inherit;
  line-height: 1.5;
  resize: vertical;
}

.fb-form textarea:focus-visible,
.fb-form input[type="text"]:focus-visible {
  outline: 3px solid var(--blue);
  outline-offset: 2px;
}

.fb-meta {
  margin: 6px 0 0;
  font-size: 0.8rem;
  color: #6a6e85;
}

.fb-actions {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-top: 18px;
}

.fb-actions .button:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.fb-status {
  min-height: 1.4em;
  margin: 0;
  font-size: 0.95rem;
}

@media (prefers-reduced-motion: reduce) {
  .app,
  .stars label,
  .sheet[open]::backdrop,
  .sheet[open] .sheet-frame { transition: none; animation: none; }
  .app:hover { transform: none; }
}

/* ---------- Install steps ---------- */

.install { background: var(--sand); }

.steps {
  display: grid;
  gap: 24px;
  margin: 28px 0 0;
  padding: 0;
  list-style: none;
  counter-reset: step;
}

.steps li {
  display: grid;
  grid-template-columns: auto 1fr;
  column-gap: 20px;
  counter-increment: step;
}

.steps li::before {
  content: counter(step);
  grid-row: span 2;
  font-family: var(--display);
  font-weight: 800;
  font-size: 3rem;
  line-height: 1;
  color: var(--blue);
}

.steps h3 {
  margin: 0;
  font-family: var(--display);
  font-weight: 700;
  font-size: 1.3rem;
}

.steps p { margin: 4px 0 0; }

/* ---------- Footer ---------- */

.footer {
  padding: 36px 0;
  background: var(--ink);
  color: #fff;
}

.footer-row {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px 24px;
}

.footer p { margin: 0; }

.footer-name {
  font-family: var(--display);
  font-weight: 700;
  font-size: 1.2rem;
}

.footer-note {
  font-size: 0.95rem;
  opacity: 0.85;
}

/* ---------- License page ---------- */

.legal-bar {
  padding: 20px clamp(20px, 5vw, 56px);
  background: var(--blue);
  color: #fff;
}

.legal-bar a {
  font-family: var(--display);
  font-weight: 700;
  text-decoration: none;
}

.legal { padding: 48px 0 72px; }

.legal h1 {
  margin: 0 0 8px;
  font-family: var(--display);
  font-weight: 800;
  font-size: clamp(2rem, 6vw, 3rem);
  line-height: 1.05;
  letter-spacing: -0.02em;
}

.legal h2 {
  margin: 36px 0 8px;
  font-family: var(--display);
  font-weight: 700;
  font-size: 1.35rem;
}

.legal p,
.legal li { max-width: 70ch; }

.legal ol,
.legal ul { padding-left: 1.4em; }

.legal .caps { font-size: 0.98rem; }

@media (max-width: 520px) {
  .bar nav { gap: 14px; }

  .app {
    gap: 14px;
    padding: 16px;
    box-shadow: 4px 4px 0 var(--ink);
  }
  .app:hover { box-shadow: 5px 5px 0 var(--blue); }
  .app-name { font-size: 1.4rem; }
  .app-go { display: none; }
  .icon { width: 56px; height: 56px; border-radius: 16px; font-size: 1.6rem; }

  .sheet { width: calc(100vw - 16px); }
  .sheet-frame { box-shadow: 5px 5px 0 var(--blue); border-radius: 20px; }
  .sheet-card { padding: 16px 16px 22px; }
  .feedback-panel { padding: 16px 16px 22px; }
  .icon-lg { width: 62px; height: 62px; border-radius: 18px; font-size: 1.9rem; }
  .sheet-head { gap: 10px; }
  .sheet-head .button { padding: 11px 16px; font-size: 0.95rem; }
  .stars label { font-size: 2.3rem; }
}
