:root {
  --bg: #f5f5f7;
  --surface: rgba(255, 255, 255, 0.78);
  --surface-solid: #ffffff;
  --surface-soft: #ececf1;
  --text: #111111;
  --muted: #73737a;
  --reading: #007aff;
  --study: #5856d6;
  --primary: var(--reading);
  --primary-press: #0066d6;
  --border: rgba(60, 60, 67, 0.16);
  /* Zone deja telechargee de la barre de progression. */
  --buffer-fill: rgba(60, 60, 67, 0.32);
  --error-bg: #fff1f0;
  --error-text: #b42318;
  --shadow: 0 24px 70px rgba(0, 0, 0, 0.12);
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #000000;
    --surface: rgba(28, 28, 30, 0.82);
    --surface-solid: #1c1c1e;
    --surface-soft: #2c2c2e;
    --text: #f5f5f7;
    --muted: #a1a1aa;
    --reading: #0a84ff;
    --study: #5e5ce6;
    --primary-press: #409cff;
    --border: rgba(235, 235, 245, 0.18);
    --buffer-fill: rgba(235, 235, 245, 0.34);
    --error-bg: #3a1714;
    --error-text: #ffb4ab;
    --shadow: none;
  }
}

/* La couleur d'accent suit le mode courant : bleu en lecture, indigo en etude. */
body[data-mode="study"] {
  --primary: var(--study);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
}

body {
  min-height: 100vh;
  min-height: 100dvh;
  overflow: hidden;
  overscroll-behavior: none;
  font-family: var(--font);
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

button,
select,
input {
  font: inherit;
}

button {
  -webkit-tap-highlight-color: transparent;
}

.app {
  width: min(100%, 520px);
  height: 100vh;
  height: 100dvh;
  margin: 0 auto;
  display: grid;
  grid-template-rows: auto 1fr;
  padding: max(14px, env(safe-area-inset-top)) 18px max(18px, env(safe-area-inset-bottom));
}

/* Le header reste visible sur le lecteur : le logo sert de retour a l'accueil. */
body[data-page="player"] .tagline {
  display: none;
}

.pull-refresh {
  position: fixed;
  top: max(8px, env(safe-area-inset-top));
  left: 50%;
  z-index: 80;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 38px;
  max-width: calc(100vw - 24px);
  padding: 0 14px;
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--text);
  background: var(--surface-solid);
  box-shadow: var(--shadow);
  font-size: 0.88rem;
  font-weight: 700;
  line-height: 1;
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, -58px);
  transition: opacity 140ms ease, transform 140ms ease;
}

.pull-refresh.visible {
  opacity: 1;
}

.pull-refresh.ready {
  border-color: var(--primary);
}

.pull-refresh.refreshing .pull-refresh-spinner {
  animation: pull-refresh-spin 700ms linear infinite;
}

.pull-refresh-spinner {
  width: 16px;
  height: 16px;
  flex: 0 0 auto;
  border: 2px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
}

@keyframes pull-refresh-spin {
  to {
    transform: rotate(360deg);
  }
}

.app-header {
  min-height: 58px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-mark {
  width: 46px;
  height: 46px;
  flex: 0 0 auto;
  border-radius: 12px;
  object-fit: cover;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.12);
}

/* Logo + titre : zone tactile de retour a l'accueil. */
.brand-home {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 4px;
  margin: -4px;
  border: 0;
  border-radius: 14px;
  color: inherit;
  background: transparent;
  text-align: left;
  cursor: pointer;
}

.brand-home:active {
  transform: scale(0.985);
}

.brand-home:focus-visible {
  outline: 3px solid rgba(0, 122, 255, 0.35);
  outline-offset: 2px;
}

.brand-copy {
  min-width: 0;
  flex: 1;
  display: grid;
}

.brand-title {
  font-size: 1.45rem;
  line-height: 1.04;
  font-weight: 760;
  letter-spacing: 0;
}

.dot {
  color: var(--primary);
}

.tagline {
  margin: 3px 0 0;
  overflow: hidden;
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.15;
  font-weight: 600;
  text-overflow: ellipsis;
}

.icon-btn,
.back-btn {
  width: 44px;
  height: 44px;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 999px;
  color: var(--text);
  background: var(--surface-soft);
  font-size: 1.2rem;
  font-weight: 700;
  cursor: pointer;
}

.settings-btn {
  color: #ffffff;
  background: #000000;
}

.app-main {
  min-height: 0;
  display: grid;
  grid-template-rows: 1fr auto auto;
  gap: 12px;
}

.app-page {
  min-height: 0;
}

.home-panel {
  min-height: 0;
  display: grid;
}

.home-panel {
  grid-template-rows: 1fr auto 1fr;
}

.home-spacer {
  min-height: 0;
}

.home-actions {
  display: grid;
  gap: 14px;
}

.apple-action {
  width: 100%;
  min-height: 76px;
  padding: 0 22px;
  border: 1px solid var(--border);
  border-radius: 18px;
  color: var(--text);
  background: var(--surface);
  box-shadow: 0 12px 34px rgba(0, 0, 0, 0.08);
  backdrop-filter: blur(18px);
  font-size: 1.18rem;
  line-height: 1.12;
  font-weight: 760;
  letter-spacing: 0;
  cursor: pointer;
}

.apple-action:active {
  transform: scale(0.985);
}

.home-action-with-info {
  position: relative;
  min-width: 0;
}

.home-action-with-info .apple-action {
  min-width: 0;
  padding-right: 62px;
}

.info-modal-btn {
  position: absolute;
  top: 50%;
  right: 14px;
  z-index: 10;
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--primary);
  background: var(--surface-solid);
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.08);
  font-size: 1rem;
  line-height: 1;
  font-weight: 820;
  cursor: pointer;
  transform: translateY(-50%);
}

.info-modal-btn:focus-visible,
.info-modal-close:focus-visible {
  outline: 3px solid rgba(0, 122, 255, 0.35);
  outline-offset: 2px;
}

.app-credit {
  justify-self: center;
  max-width: 330px;
  margin: 8px 8px 2px;
  color: var(--muted);
  text-align: center;
  font-size: 0.76rem;
  line-height: 1.25;
  font-weight: 620;
}

.primary-action {
  color: #ffffff;
  border-color: transparent;
  background: var(--primary);
}

/* Boutons "Continuer" de l'accueil : titre + sous-titre, couleur du mode. */
.resume-action {
  display: grid;
  align-content: center;
  gap: 4px;
  padding: 12px 22px;
  text-align: left;
  color: #ffffff;
  border-color: transparent;
}

.resume-action.reading-action {
  background: var(--reading);
}

.resume-action.study-action {
  background: var(--study);
}

.resume-title {
  font-size: 1.18rem;
  line-height: 1.12;
  font-weight: 760;
}

.resume-subtitle {
  font-size: 0.98rem;
  line-height: 1.1;
  font-weight: 620;
  opacity: 0.85;
}

/* Segmented control Ancien | Nouveau au-dessus de la liste des livres. */
.segmented {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 3px;
  padding: 3px;
  border-radius: 13px;
  background: var(--surface-soft);
}

.segmented-btn {
  min-height: 40px;
  border: 0;
  border-radius: 10px;
  color: var(--text);
  background: transparent;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
}

.segmented-btn.active {
  background: var(--surface-solid);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

/* Item de liste riche : titre, référence, durée estimée. */
.choice-btn.rich-choice {
  display: grid;
  align-content: center;
  gap: 5px;
  min-height: 84px;
  padding: 12px 18px;
}

.choice-main {
  overflow-wrap: anywhere;
  font-size: 1.08rem;
  line-height: 1.1;
  font-weight: 760;
}

.choice-sub {
  color: var(--muted);
  font-size: 0.88rem;
  line-height: 1.15;
  font-weight: 620;
}

.choice-time {
  color: var(--primary);
  font-size: 0.94rem;
  line-height: 1.1;
  font-weight: 730;
}

.choice-btn.all-choice {
  border-color: color-mix(in srgb, var(--primary) 45%, transparent);
  background: color-mix(in srgb, var(--primary) 8%, var(--surface-solid));
}

.page-lead {
  margin: 0;
  color: var(--muted);
  font-size: 0.95rem;
  line-height: 1.25;
  font-weight: 620;
}

.page-topbar {
  min-height: 48px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.page-topbar h2 {
  margin: 0;
  font-size: 1.2rem;
  line-height: 1.1;
  font-weight: 760;
}

.settings-panel h2,
.passage-panel h2 {
  margin: 0;
  font-size: clamp(2rem, 9vw, 3.1rem);
  line-height: 1.02;
  font-weight: 780;
  letter-spacing: 0;
}

.settings-panel,
.passage-panel,
.choice-page,
.player-card,
.error-card {
  min-width: 0;
  max-width: 100%;
  border: 1px solid var(--border);
  border-radius: 22px;
  background: var(--surface);
  box-shadow: 0 16px 50px rgba(0, 0, 0, 0.08);
  backdrop-filter: blur(18px);
}

.settings-panel,
.passage-panel,
.choice-page {
  min-height: 0;
  padding: 14px;
}

.settings-panel {
  height: 100%;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  gap: 14px;
}

.choice-page {
  display: grid;
  grid-template-rows: auto 1fr;
  gap: 14px;
}

/* Pages avec un element intercale (segmented control, phrase d'intro). */
#book-page {
  grid-template-rows: auto auto 1fr;
}

#depth-page {
  grid-template-rows: auto auto 1fr;
}

.depth-choice-list {
  min-height: 0;
  display: grid;
  align-content: start;
  gap: 12px;
  overflow-y: auto;
}

.depth-choice-btn {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  width: 100%;
  min-height: 66px;
  padding: 0 18px;
  border: 1px solid var(--border);
  border-radius: 16px;
  color: var(--text);
  background: var(--surface-solid);
  text-align: left;
  cursor: pointer;
}

.depth-choice-btn.preferred {
  border-color: var(--primary);
  background: color-mix(in srgb, var(--primary) 10%, var(--surface-solid));
}

.depth-choice-name,
.depth-choice-time {
  font-size: 1.06rem;
  font-weight: 760;
}

.depth-choice-time {
  color: var(--primary);
  white-space: nowrap;
}

.large-choice-list,
.choice-list,
.start-picker {
  min-height: 0;
  display: grid;
  align-content: center;
  gap: 12px;
}

.choice-list {
  align-content: start;
  overflow-y: auto;
  padding-right: 2px;
}

.choice-btn {
  width: 100%;
  min-height: 58px;
  padding: 0 18px;
  border: 1px solid var(--border);
  border-radius: 16px;
  color: var(--text);
  background: var(--surface-solid);
  text-align: left;
  font-size: 1.08rem;
  font-weight: 720;
  cursor: pointer;
}

.choice-field {
  display: grid;
  gap: 8px;
  margin-top: 14px;
  color: var(--text);
  font-size: 1rem;
  font-weight: 700;
}

.choice-help {
  display: block;
  color: var(--muted);
  font-size: 0.84rem;
  line-height: 1.25;
  font-weight: 600;
}

.choice-field select,
.choice-field input,
#book-select {
  width: 100%;
  min-height: 56px;
  padding: 0 16px;
  border: 0;
  border-radius: 14px;
  color: var(--text);
  background: var(--surface-soft);
  font-weight: 720;
}

#search-form {
  height: 100%;
  min-height: 0;
  display: grid;
  grid-template-rows: auto auto 1fr;
  gap: 12px;
}

.field-row label {
  display: none;
}

#book-select {
  font-size: clamp(1.2rem, 5.8vw, 1.7rem);
}

#book-select:focus,
.choice-field select:focus,
.choice-field input:focus,
.apple-action:focus-visible,
.back-btn:focus-visible {
  outline: 3px solid rgba(0, 122, 255, 0.35);
  outline-offset: 2px;
}

.settings-grid {
  min-height: 0;
  display: grid;
  align-content: start;
  gap: 12px;
  overflow-y: auto;
  padding: 0 2px max(8px, env(safe-area-inset-bottom)) 0;
}

.speed-field span {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.speed-field strong {
  color: var(--primary);
  font-size: 0.95rem;
  font-weight: 760;
}

.choice-field input[type="range"] {
  width: 100%;
  min-height: 34px;
  padding: 0;
  accent-color: var(--primary);
}

.paragraph-picker {
  min-height: 0;
}

.paragraph-list {
  height: 100%;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
  overflow-y: auto;
  padding-right: 2px;
}

.paragraph-section {
  display: grid;
  gap: 8px;
}

.paragraph-section-title {
  margin: 0 2px;
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.1;
  font-weight: 730;
}

.paragraph-btn {
  width: 100%;
  min-width: 0;
  display: grid;
  align-content: center;
  gap: 7px;
  min-height: 104px;
  padding: 12px 14px;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 16px;
  color: var(--text);
  background: var(--surface-solid);
  text-align: left;
  cursor: pointer;
}

.paragraph-btn:active,
.paragraph-btn.active {
  border-color: rgba(0, 122, 255, 0.5);
  background: rgba(0, 122, 255, 0.08);
}

.paragraph-range {
  color: var(--primary);
  font-size: 0.96rem;
  line-height: 1.05;
  font-weight: 730;
}

.paragraph-label {
  overflow-wrap: anywhere;
  font-size: clamp(1.06rem, 4.7vw, 1.36rem);
  line-height: 1.08;
  font-weight: 760;
}

.paragraph-meta {
  color: var(--muted);
  font-size: 0.86rem;
  line-height: 1.12;
  font-weight: 620;
}

[hidden] {
  display: none !important;
}

.player-card {
  width: 100%;
  min-height: 0;
  min-width: 0;
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto auto auto;
  align-content: stretch;
  padding: 24px 18px;
  gap: 18px;
}

.player-status {
  min-height: 0;
  min-width: 0;
  max-width: 100%;
  display: grid;
  align-content: center;
  justify-items: center;
  gap: 12px;
  margin-bottom: 0;
  text-align: center;
}

.playlist {
  display: none;
}

.player-label {
  display: block;
  max-width: 100%;
  margin: 0;
  color: var(--muted);
  overflow-wrap: anywhere;
  word-break: break-word;
  font-size: 1.7rem;
  line-height: 1.08;
  font-weight: 720;
}

.display-ref {
  max-width: 100%;
  margin: 0;
  overflow-wrap: anywhere;
  word-break: break-word;
  hyphens: auto;
  font-size: 3.2rem;
  line-height: 1.02;
  font-weight: 780;
}

.player-state {
  margin: 3px 0 0;
  color: var(--muted);
  font-size: 0.94rem;
  font-weight: 620;
}

.current-ref-card {
  min-width: 0;
  display: grid;
  gap: 3px;
  padding: 12px 14px;
  border-radius: 16px;
  background: var(--surface-soft);
  text-align: center;
}

.current-ref-card span {
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.1;
  font-weight: 730;
  text-transform: uppercase;
}

.current-ref-card strong {
  color: var(--text);
  overflow-wrap: anywhere;
  font-size: 1.08rem;
  line-height: 1.2;
  font-weight: 760;
}


.player-progress {
  min-width: 0;
  display: grid;
  gap: 8px;
}

.audio-progress-shell {
  position: relative;
  min-width: 0;
  height: 28px;
}

.audio-progress-track {
  position: absolute;
  left: 0;
  right: 0;
  top: 50%;
  height: 6px;
  overflow: hidden;
  border-radius: 999px;
  background: var(--surface-soft);
  transform: translateY(-50%);
}

.audio-progress-buffer,
.audio-progress-played {
  position: absolute;
  inset: 0 auto 0 0;
  width: 0%;
  border-radius: inherit;
}

.audio-progress-buffer {
  background: var(--buffer-fill);
}

.audio-progress-played {
  background: var(--primary);
}

.audio-progress {
  --progress-percent: 0%;
  /* Deuxieme niveau facon YouTube : ce qui est deja telecharge. */
  --buffer-percent: 0%;
  position: absolute;
  inset: 0;
  z-index: 2;
  width: 100%;
  height: 28px;
  margin: 0;
  appearance: none;
  -webkit-appearance: none;
  background: transparent;
  cursor: pointer;
  /* Sans cela, Safari iOS interprete le glissement horizontal comme un scroll
     de page : le drag est interrompu et la puce revient a sa position. */
  touch-action: none;
}

.audio-progress:disabled {
  cursor: default;
  opacity: 0.5;
}

/* Trois zones : lu (accent), telecharge (gris moyen), a venir (gris clair). */
.audio-progress::-webkit-slider-runnable-track {
  height: 6px;
  border-radius: 999px;
  background: transparent;
}

.audio-progress::-webkit-slider-thumb {
  width: 22px;
  height: 22px;
  margin-top: -8px;
  appearance: none;
  border: 3px solid #ffffff;
  border-radius: 999px;
  background: var(--primary);
  box-shadow: 0 5px 14px rgba(0, 0, 0, 0.18);
}

.audio-progress::-moz-range-track {
  height: 6px;
  border-radius: 999px;
  background: transparent;
}

.audio-progress::-moz-range-progress {
  height: 6px;
  border-radius: 999px;
  background: transparent;
}

.audio-progress::-moz-range-thumb {
  width: 18px;
  height: 18px;
  border: 3px solid #ffffff;
  border-radius: 999px;
  background: var(--primary);
  box-shadow: 0 5px 14px rgba(0, 0, 0, 0.18);
}

.progress-times {
  display: flex;
  justify-content: space-between;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 680;
  font-variant-numeric: tabular-nums;
}

.player-controls {
  min-width: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(64px, 1.35fr) minmax(0, 1fr);
  gap: 8px;
}

.control-btn {
  min-width: 0;
  min-height: 52px;
  border: 0;
  border-radius: 14px;
  color: var(--text);
  background: var(--surface-soft);
  font-weight: 720;
  cursor: pointer;
}

.control-btn:disabled {
  opacity: 0.38;
  cursor: default;
}

.nav-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: 0 8px;
  overflow: hidden;
  font-size: 0.9rem;
}

.nav-btn span:not([aria-hidden="true"]) {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.nav-btn span[aria-hidden="true"] {
  font-size: 1.25rem;
  line-height: 1;
}

.play-btn {
  position: relative;
  overflow: hidden;
  color: #ffffff;
  background: var(--primary);
  font-size: 1.35rem;
}

.play-btn span {
  position: relative;
  z-index: 1;
}

.play-btn:not(.preparing) span {
  display: block;
  width: 22px;
  height: 22px;
  margin: 0 auto;
  font-size: 0;
}

.play-btn:not(.preparing) span::before,
.play-btn:not(.preparing) span::after {
  content: "";
  position: absolute;
  top: 50%;
  background: currentColor;
  transform: translateY(-50%);
}

.play-btn:not(.is-playing):not(.preparing) span::before {
  left: 5px;
  width: 0;
  height: 0;
  background: transparent;
  border-top: 11px solid transparent;
  border-bottom: 11px solid transparent;
  border-left: 15px solid currentColor;
}

.play-btn:not(.is-playing):not(.preparing) span::after {
  display: none;
}

.play-btn.is-playing:not(.preparing) span::before,
.play-btn.is-playing:not(.preparing) span::after {
  width: 6px;
  height: 20px;
  border-radius: 2px;
}

.play-btn.is-playing:not(.preparing) span::before {
  left: 4px;
}

.play-btn.is-playing:not(.preparing) span::after {
  right: 4px;
}

.play-btn.preparing {
  background: rgba(0, 122, 255, 0.32);
}

.play-btn.preparing::before {
  content: "";
  position: absolute;
  inset: 0;
  background: var(--primary);
  transform-origin: left center;
  animation: preparing-fill 1.35s ease-in-out infinite;
}

@keyframes preparing-fill {
  0% {
    transform: scaleX(0.08);
    opacity: 0.45;
  }
  55% {
    transform: scaleX(0.72);
    opacity: 0.9;
  }
  100% {
    transform: scaleX(1);
    opacity: 0.25;
  }
}

/* Le retour a l'accueil se fait par le logo du header, pas par un bouton bas. */
#stop-btn {
  grid-column: 1 / -1;
}

.error-card {
  padding: 12px;
  background: var(--error-bg);
  border-color: rgba(180, 35, 24, 0.28);
  box-shadow: none;
}

.error-card p {
  margin: 0;
  color: var(--error-text);
  font-size: 0.98rem;
  font-weight: 700;
}

.info-modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 110;
  display: grid;
  place-items: center;
  padding: max(18px, env(safe-area-inset-top)) max(18px, env(safe-area-inset-right))
    max(18px, env(safe-area-inset-bottom)) max(18px, env(safe-area-inset-left));
  background: rgba(0, 0, 0, 0.28);
}

.info-modal-backdrop[hidden] {
  display: none;
}

.info-modal {
  position: relative;
  width: min(100%, 380px);
  display: grid;
  gap: 10px;
  padding: 22px 20px 18px;
  border: 1px solid var(--border);
  border-radius: 18px;
  color: var(--text);
  background: var(--surface-solid);
  box-shadow: var(--shadow);
}

.info-modal h2 {
  margin: 0;
  padding-right: 42px;
  font-size: 1.2rem;
  line-height: 1.12;
  font-weight: 780;
}

.info-modal p {
  margin: 0;
  font-size: 0.96rem;
  line-height: 1.38;
  font-weight: 620;
}

.info-modal-meta {
  color: var(--muted);
  font-size: 0.78rem !important;
  line-height: 1.3 !important;
}

.info-modal-close {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 999px;
  color: var(--text);
  background: var(--surface-soft);
  font-size: 1.35rem;
  line-height: 1;
  font-weight: 650;
  cursor: pointer;
}

.install-banner {
  position: fixed;
  left: max(12px, env(safe-area-inset-left));
  right: max(12px, env(safe-area-inset-right));
  top: max(12px, env(safe-area-inset-top));
  z-index: 100;
  width: min(100% - 24px, 520px);
  margin: 0 auto;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  padding: 12px;
  border: 1px solid var(--border);
  background: var(--surface-solid);
  border-radius: 18px;
  box-shadow: var(--shadow);
  animation: install-banner-drop 220ms ease-out;
}

.install-banner[hidden] {
  display: none;
}

@keyframes install-banner-drop {
  from {
    opacity: 0;
    transform: translateY(-18px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.install-banner-icon {
  width: 44px;
  height: 44px;
  flex: 0 0 auto;
  border-radius: 22%;
}

.install-banner-copy {
  min-width: 0;
  display: grid;
  gap: 2px;
}

.install-banner-copy strong {
  overflow: hidden;
  font-size: 0.98rem;
  line-height: 1.1;
  font-weight: 760;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.install-banner-copy span {
  color: var(--muted);
  font-size: 0.86rem;
  line-height: 1.2;
  font-weight: 600;
}

.install-banner-actions {
  display: flex;
  gap: 8px;
}

.secondary-btn,
.primary-btn {
  flex: 1;
  min-height: 52px;
  padding: 0 14px;
  border-radius: 14px;
  font-weight: 760;
  cursor: pointer;
}

.secondary-btn {
  color: var(--text);
  background: transparent;
  border: 1px solid var(--border);
}

.primary-btn {
  color: #ffffff;
  background: var(--primary);
  border: 0;
}

@media (max-width: 430px) {
  .install-banner {
    grid-template-columns: auto minmax(0, 1fr);
  }

  .install-banner-actions {
    grid-column: 1 / -1;
  }
}

@media (max-height: 700px) {
  .app {
    padding-top: max(8px, env(safe-area-inset-top));
    padding-bottom: max(8px, env(safe-area-inset-bottom));
  }

  .app-header {
    min-height: 46px;
  }

  .brand-mark {
    width: 38px;
    height: 38px;
  }

  .tagline {
    display: none;
  }

  .apple-action {
    min-height: 66px;
  }

  .paragraph-btn {
    min-height: 88px;
  }

  .player-card {
    padding: 18px 14px;
    gap: 14px;
  }

  .display-ref {
    font-size: 2.45rem;
  }

  .player-label {
    font-size: 1.35rem;
  }
}

@media (max-width: 430px) {
  .player-card {
    padding: 20px 14px;
    gap: 15px;
  }

  .display-ref {
    font-size: 2.45rem;
  }

  .player-label {
    font-size: 1.35rem;
  }
}

@media (min-width: 680px) {
  .app {
    padding-top: 28px;
    padding-bottom: 28px;
  }

  .display-ref {
    font-size: 4rem;
  }

  .player-label {
    font-size: 2.1rem;
  }
}

body[data-page="player"][data-mode="study"] .display-ref {
  font-size: 1.75rem;
  line-height: 1.12;
  font-weight: 760;
}

body[data-page="player"][data-mode="study"] .player-label {
  font-size: 1.08rem;
  line-height: 1.12;
}

@media (max-width: 430px), (max-height: 700px) {
  body[data-page="player"][data-mode="study"] .display-ref {
    font-size: 1.35rem;
  }

  body[data-page="player"][data-mode="study"] .player-label {
    font-size: 0.98rem;
  }
}

@media (min-width: 680px) {
  body[data-page="player"][data-mode="study"] .display-ref {
    font-size: 2.15rem;
  }

  body[data-page="player"][data-mode="study"] .player-label {
    font-size: 1.22rem;
  }
}
