:root {
  --bg: #ffffff;
  --text: #1d1d1f;
  --text2: #6e6e73;
  --hairline: #d2d2d7;
  --blue: #007aff;
  --fill: #f2f2f7;
  --icon-border: rgba(0, 0, 0, 0.08);
  --on-blue: #ffffff;
  --gl: max(20px, env(safe-area-inset-left, 0px));
  --gr: max(20px, env(safe-area-inset-right, 0px));
  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #000000;
    --text: #f5f5f7;
    --text2: #98989d;
    --hairline: #38383a;
    --blue: #0a84ff;
    --fill: #1c1c1e;
    --icon-border: rgba(255, 255, 255, 0.12);
  }
}

*, *::before, *::after { box-sizing: border-box; }

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, "SF Pro Text", "SF Pro Display", system-ui, "Helvetica Neue", Arial, sans-serif;
  font-size: 17px;
  line-height: 1.3;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

a { color: var(--blue); text-decoration: none; -webkit-tap-highlight-color: transparent; }
a:active, button:active, summary:active { opacity: 0.6; }
button { font-family: inherit; -webkit-tap-highlight-color: transparent; }
:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; border-radius: 6px; }
:disabled:active { opacity: 1; }

.page {
  max-width: 980px;
  margin: 0 auto;
  padding: calc(env(safe-area-inset-top, 0px) + 12px) var(--gr) calc(env(safe-area-inset-bottom, 0px) + 48px) var(--gl);
}

[hidden] { display: none !important; }

/* Titres */
.large-title {
  margin: 28px 0 0;
  font-size: 34px;
  line-height: 41px;
  font-weight: 700;
  letter-spacing: 0.37px;
}
.large-sub {
  margin: 2px 0 0;
  font-size: 15px;
  line-height: 20px;
  color: var(--text2);
}

/* Icône */
.icon {
  display: block;
  flex: none;
  width: 60px;
  height: 60px;
  border-radius: 22.37%;
  border: 1px solid var(--icon-border);
  background: var(--fill);
  object-fit: cover;
}

/* Bouton OBTENIR */
.get {
  appearance: none;
  -webkit-appearance: none;
  position: relative;
  flex: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 28px;
  padding: 0 16px;
  border: 0;
  border-radius: 14px;
  background: var(--fill);
  color: var(--blue);
  font-size: 15px;
  font-weight: 700;
  line-height: 1;
  text-transform: uppercase;
  text-decoration: none;
  cursor: pointer;
}
.get::before { content: ""; position: absolute; top: -8px; bottom: -8px; left: -4px; right: -4px; }
.get:disabled { color: var(--text2); opacity: 0.55; cursor: default; }
.get-lg { height: 32px; padding: 0 24px; border-radius: 16px; }

/* Bandeaux */
.banner {
  margin: 20px 0 0;
  padding: 14px 16px;
  border-radius: 14px;
  background: var(--fill);
}
.banner-title { margin: 0; font-size: 15px; line-height: 20px; font-weight: 600; }
.banner-text { margin: 2px 0 0; font-size: 15px; line-height: 20px; color: var(--text2); }
.banner-link {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  margin-top: 2px;
  font-size: 15px;
  font-weight: 600;
}

/* Catalogue */
.list { list-style: none; margin: 20px 0 0; padding: 0; }
.row {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 0;
}
.row::after {
  content: "";
  position: absolute;
  left: 76px;
  right: 0;
  bottom: 0;
  height: 1px;
  background: var(--hairline);
}
.row-link {
  display: flex;
  align-items: center;
  gap: 16px;
  flex: 1;
  min-width: 0;
  min-height: 60px;
  color: inherit;
}
.row-text { min-width: 0; }
.row-name, .row-sub, .row-meta {
  display: block;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.row-name { font-size: 17px; line-height: 22px; font-weight: 600; }
.row-sub { font-size: 14px; line-height: 18px; color: var(--text2); }
.row-meta { font-size: 13px; line-height: 17px; color: var(--text2); }

@media (min-width: 720px) {
  .large-title { margin-top: 48px; }
  .list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: 40px; }
}

/* Écran centré (erreurs, état vide) */
.notice { padding: 72px 0 24px; text-align: center; }
.notice-title { margin: 0; font-size: 22px; line-height: 28px; font-weight: 700; }
.notice-text { margin: 8px auto 0; max-width: 420px; font-size: 15px; line-height: 21px; color: var(--text2); }
.notice .btn { margin-top: 20px; }

/* Boutons principaux */
.btn {
  appearance: none;
  -webkit-appearance: none;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 50px;
  padding: 0 24px;
  border: 0;
  border-radius: 25px;
  background: var(--blue);
  color: var(--on-blue);
  font-size: 17px;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
}
.btn-secondary { background: var(--fill); color: var(--blue); }
@media (min-width: 720px) { .btn { width: auto; min-width: 280px; display: inline-flex; } }

/* Fiche */
.back {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  margin-left: -4px;
  padding: 0 4px;
  font-size: 17px;
}
.app-head { display: flex; gap: 20px; margin-top: 4px; }
.app-head .icon { width: 118px; height: 118px; }
.app-head-text { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.app-name { margin: 0; font-size: 22px; line-height: 26px; font-weight: 700; overflow-wrap: anywhere; }
.app-sub { margin: 2px 0 0; font-size: 15px; line-height: 20px; color: var(--text2); overflow-wrap: anywhere; }
.app-dev { margin: 2px 0 0; font-size: 13px; line-height: 17px; color: var(--text2); }
.app-actions { margin-top: auto; padding-top: 10px; display: flex; align-items: center; gap: 12px; }

@media (min-width: 720px) {
  .app-head .icon { width: 150px; height: 150px; }
  .app-name { font-size: 28px; line-height: 34px; }
  .app-sub { font-size: 17px; line-height: 22px; }
}

.facts {
  display: flex;
  margin: 24px calc(-1 * var(--gr)) 0 calc(-1 * var(--gl));
  padding: 4px var(--gr) 4px var(--gl);
  overflow-x: auto;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}
.facts::-webkit-scrollbar { display: none; }
.fact {
  flex: none;
  min-width: 104px;
  padding: 0 22px;
  border-left: 1px solid var(--hairline);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  text-align: center;
  white-space: nowrap;
}
.fact:first-child { padding-left: 0; border-left: 0; }
.fact:last-child { padding-right: 0; }
.fact-label { font-size: 12px; line-height: 14px; font-weight: 600; letter-spacing: 0.3px; text-transform: uppercase; color: var(--text2); }
.fact-value { font-size: 20px; line-height: 24px; font-weight: 600; color: var(--text2); }
.fact-sub { font-size: 12px; line-height: 14px; color: var(--text2); }

.section { margin-top: 24px; padding-top: 20px; border-top: 1px solid var(--hairline); }
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.section-title { margin: 0; font-size: 22px; line-height: 28px; font-weight: 700; }

.shots {
  display: flex;
  gap: 12px;
  margin: 0 calc(-1 * var(--gr)) 0 calc(-1 * var(--gl));
  padding: 0 var(--gr) 0 var(--gl);
  scroll-padding: 0 var(--gl);
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}
.shots::-webkit-scrollbar { display: none; }
.shot {
  flex: none;
  height: 400px;
  width: auto;
  aspect-ratio: auto 9 / 19.5;
  border-radius: 20px;
  border: 1px solid var(--icon-border);
  background: var(--fill);
  scroll-snap-align: start;
}

.release { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; font-size: 15px; line-height: 20px; color: var(--text2); }
.release-version { font-weight: 600; }
.body-text { margin: 8px 0 0; font-size: 15px; line-height: 21px; white-space: pre-line; overflow-wrap: anywhere; }
.clamp-text {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: var(--lines, 4);
  line-clamp: var(--lines, 4);
  overflow: hidden;
}
.is-open .clamp-text { display: block; -webkit-line-clamp: unset; line-clamp: unset; overflow: visible; }
.more {
  display: block;
  min-height: 44px;
  margin: 0 0 0 auto;
  padding: 0 0 0 16px;
  border: 0;
  background: none;
  color: var(--blue);
  font-size: 15px;
  cursor: pointer;
}
.is-open .more { display: none; }

.history { margin-top: 4px; }
.history summary {
  display: flex;
  align-items: center;
  gap: 6px;
  min-height: 44px;
  color: var(--blue);
  font-size: 15px;
  cursor: pointer;
  list-style: none;
}
.history summary::-webkit-details-marker { display: none; }
.history summary::after {
  content: "";
  width: 7px;
  height: 7px;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: rotate(45deg) translateY(-2px);
}
.history[open] summary::after { transform: rotate(-135deg) translateY(-1px); }
.history-list { list-style: none; margin: 0; padding: 0; }
.history-item { padding: 12px 0; border-top: 1px solid var(--hairline); }

.info { margin: 0; }
.info-row {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  padding: 12px 0;
  border-bottom: 1px solid var(--hairline);
  font-size: 15px;
  line-height: 20px;
}
.info-row:last-child { border-bottom: 0; }
.info dt { flex: none; color: var(--text2); }
.info dd { margin: 0; min-width: 0; text-align: right; overflow-wrap: anywhere; }

/* Enregistrement */
.steps { list-style: none; margin: 24px 0 0; padding: 0; counter-reset: step; background: var(--fill); border-radius: 16px; }
.step {
  position: relative;
  display: flex;
  align-items: flex-start;
  gap: 16px;
  padding: 16px;
  font-size: 17px;
  line-height: 22px;
}
.step + .step::before {
  content: "";
  position: absolute;
  top: 0;
  left: 60px;
  right: 0;
  height: 1px;
  background: var(--hairline);
}
.step-num {
  flex: none;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--blue);
  color: var(--on-blue);
  font-size: 17px;
  font-weight: 700;
}
.step-text { min-width: 0; padding-top: 4px; }
.step-text strong { font-weight: 600; }
.lede { margin: 12px 0 0; font-size: 17px; line-height: 23px; color: var(--text2); }
.cta { margin-top: 24px; }
.footnote { margin: 12px 0 0; font-size: 13px; line-height: 18px; color: var(--text2); text-align: center; }

.copy-box { margin-top: 20px; padding: 16px; border-radius: 16px; background: var(--fill); }
.copy-box p { margin: 0; font-size: 17px; line-height: 22px; font-weight: 600; }
.copy-field {
  display: block;
  width: 100%;
  margin: 12px 0;
  padding: 12px;
  border: 1px solid var(--hairline);
  border-radius: 10px;
  background: var(--bg);
  color: var(--text);
  font-family: inherit;
  font-size: 15px;
}

.status { display: flex; flex-direction: column; align-items: center; padding-top: 56px; text-align: center; }
.check, .spinner { width: 72px; height: 72px; }
.check { color: #34c759; }
.spinner {
  border: 4px solid var(--hairline);
  border-top-color: var(--blue);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .spinner { animation-duration: 4s; } }
.status h1 { margin: 24px 0 0; font-size: 28px; line-height: 34px; font-weight: 700; }
.status p { margin: 8px 0 0; max-width: 360px; font-size: 17px; line-height: 23px; color: var(--text2); }
.status .btn { margin-top: 28px; max-width: 360px; }
