:root {
  color-scheme: light;
  --bg: #fafaf8;
  --surface: rgba(255, 255, 255, 0.72);
  --surface-strong: rgba(255, 255, 255, 0.9);
  --ink: rgba(0, 0, 0, 0.87);
  --muted: rgba(0, 0, 0, 0.58);
  --line: rgba(0, 0, 0, 0.08);
  --line-strong: rgba(0, 0, 0, 0.14);
  --primary: #4f46e5;
  --primary-soft: rgba(79, 70, 229, 0.12);
  --shadow-soft: 0 12px 32px rgba(79, 70, 229, 0.08);
  --shadow-strong: 0 24px 64px rgba(79, 70, 229, 0.1);
  --radius-xl: 32px;
  --radius-lg: 24px;
  --radius-md: 18px;
  --radius-pill: 999px;
  --page-width: min(1160px, calc(100% - 32px));
  --font-body: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font-body);
  color: var(--ink);
  background:
    radial-gradient(circle at 0 0, rgba(79, 70, 229, 0.1), transparent 28%),
    linear-gradient(180deg, #fcfcfb 0%, #fafaf8 48%, #f7f7f5 100%);
}

body.modal-open {
  overflow: hidden;
}

img {
  display: block;
  max-width: 100%;
}

a {
  color: inherit;
  text-decoration: none;
}

button,
input {
  font: inherit;
}

button {
  border: 0;
  background: none;
  cursor: pointer;
}

.hidden {
  display: none !important;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.topbar {
  position: sticky;
  top: 14px;
  z-index: 20;
  width: var(--page-width);
  margin: 18px auto 0;
  padding: 12px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  border: 1px solid rgba(255, 255, 255, 0.58);
  border-radius: var(--radius-pill);
  background: rgba(255, 255, 255, 0.7);
  box-shadow: var(--shadow-soft);
  backdrop-filter: blur(18px);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.brand-badge {
  width: 42px;
  height: 42px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 14px;
  background: linear-gradient(135deg, var(--primary), #6d65ef);
  box-shadow: 0 12px 24px rgba(79, 70, 229, 0.22);
  flex: 0 0 auto;
}

.brand-logo {
  width: 24px;
  height: 24px;
}

.brand-copy {
  min-width: 0;
}

.brand-title {
  font-size: 1.02rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.topbar-nav {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
}

.nav-link {
  padding: 10px 14px;
  border-radius: var(--radius-pill);
  color: var(--muted);
  transition: color 180ms ease, background-color 180ms ease;
}

.nav-link:hover,
.nav-link:focus-visible {
  color: var(--ink);
  background: rgba(79, 70, 229, 0.08);
}

.page {
  width: var(--page-width);
  margin: 20px auto 56px;
}

.panel {
  border: 1px solid rgba(255, 255, 255, 0.54);
  border-radius: var(--radius-xl);
  background: var(--surface);
  box-shadow: var(--shadow-strong);
  backdrop-filter: blur(18px);
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 46px;
  padding: 0 18px;
  border-radius: var(--radius-pill);
  font-weight: 600;
  transition:
    transform 180ms ease,
    background-color 180ms ease,
    box-shadow 180ms ease,
    border-color 180ms ease,
    color 180ms ease;
}

.button:hover,
.button:focus-visible {
  transform: translateY(-1px);
}

.button.primary {
  color: #fff;
  background: linear-gradient(135deg, var(--primary), #6d65ef);
  box-shadow: 0 14px 24px rgba(79, 70, 229, 0.18);
}

.button.secondary {
  color: var(--ink);
  background: rgba(255, 255, 255, 0.78);
  border: 1px solid var(--line);
}

.button.secondary:hover,
.button.secondary:focus-visible {
  border-color: var(--line-strong);
}

.app-popover {
  position: relative;
}

.app-popover > summary {
  list-style: none;
}

.app-popover > summary::-webkit-details-marker {
  display: none;
}

.app-popover-trigger {
  user-select: none;
}

.app-popover[open] .app-popover-trigger {
  transform: translateY(-1px);
}

.app-popover-menu {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  z-index: 25;
  min-width: 230px;
  display: grid;
  gap: 6px;
  padding: 8px;
  border-radius: 20px;
  border: 1px solid rgba(255, 255, 255, 0.58);
  background: rgba(255, 255, 255, 0.92);
  box-shadow: var(--shadow-soft);
  backdrop-filter: blur(18px);
}

.app-popover-menu::before {
  content: "";
  position: absolute;
  top: -6px;
  right: 24px;
  width: 12px;
  height: 12px;
  background: rgba(255, 255, 255, 0.92);
  border-top: 1px solid rgba(255, 255, 255, 0.58);
  border-left: 1px solid rgba(255, 255, 255, 0.58);
  transform: rotate(45deg);
}

.app-popover-link {
  display: grid;
  gap: 2px;
  padding: 12px 14px;
  border-radius: 14px;
  color: var(--ink);
  transition: background-color 180ms ease, color 180ms ease;
}

.app-popover-link:hover,
.app-popover-link:focus-visible {
  background: rgba(79, 70, 229, 0.08);
}

.app-popover-link strong {
  font-size: 0.96rem;
  letter-spacing: -0.02em;
}

.app-popover-badge {
  display: inline-flex;
  align-items: center;
  margin-left: 6px;
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.06);
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 600;
  letter-spacing: 0;
  vertical-align: middle;
}

.app-popover-link span {
  color: var(--muted);
  font-size: 0.88rem;
}

.app-popover--tile {
  width: 100%;
}

.app-popover--tile .app-popover-menu {
  left: 0;
  right: 0;
  min-width: 0;
}

.app-popover--tile .app-popover-menu::before {
  left: 24px;
  right: auto;
}

.stage,
.section,
.footer {
  padding: 24px;
}

.section {
  margin-top: 20px;
}

.cloud-controls {
  display: grid;
  gap: 10px;
}

.glass-card {
  border: 1px solid rgba(255, 255, 255, 0.58);
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.68);
  box-shadow:
    0 10px 24px rgba(0, 0, 0, 0.04),
    0 18px 36px rgba(79, 70, 229, 0.05);
  backdrop-filter: blur(18px);
}

.search-card {
  min-height: 58px;
  padding: 0 14px 0 16px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.search-card svg {
  width: 20px;
  height: 20px;
  color: var(--primary);
  flex: 0 0 auto;
}

.search-card input {
  width: 100%;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--ink);
}

.search-card input::placeholder {
  color: rgba(0, 0, 0, 0.42);
}

.icon-button {
  width: 34px;
  height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  color: var(--muted);
  transition: background-color 180ms ease, color 180ms ease;
}

.icon-button:hover,
.icon-button:focus-visible {
  color: var(--ink);
  background: rgba(79, 70, 229, 0.08);
}

.controls-row {
  display: flex;
}

.age-card {
  width: 100%;
  min-height: 58px;
  padding: 12px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  text-align: left;
}

.age-card-icon,
.action-tile-icon {
  width: 34px;
  height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 12px;
  background: var(--primary-soft);
  color: var(--primary);
  flex: 0 0 auto;
}

.age-card-icon svg,
.age-card-chevron svg {
  width: 18px;
  height: 18px;
}

.age-card-copy {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.age-card-label {
  color: var(--muted);
  font-size: 0.82rem;
}

.age-card-copy strong {
  font-size: 1rem;
  letter-spacing: -0.02em;
}

.age-card-chevron {
  margin-left: auto;
  color: var(--muted);
  transition: transform 180ms ease;
}

.age-card[aria-expanded="true"] .age-card-chevron {
  transform: rotate(180deg);
}

.age-panel {
  padding: 14px 16px;
}

.age-panel-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: baseline;
  flex-wrap: wrap;
}

.age-panel-head strong {
  font-size: 0.94rem;
}

.age-panel-head span {
  color: var(--muted);
}

.age-range {
  width: 100%;
  margin: 14px 0 0;
  accent-color: var(--primary);
}

.age-range-scale {
  margin-top: 8px;
  display: flex;
  justify-content: space-between;
  color: var(--muted);
  font-size: 0.86rem;
}

.feed-status {
  margin: 12px 4px 0;
  color: var(--muted);
  font-size: 0.94rem;
}

.feed-status[data-tone="error"] {
  color: #a33642;
}

.cloud-surface {
  margin-top: 14px;
  padding: 14px;
  border-radius: 28px;
  background: rgba(255, 255, 255, 0.82);
  border: 1px solid rgba(255, 255, 255, 0.58);
}

.cloud-viewport {
  position: relative;
  min-height: 640px;
  border-radius: 24px;
  overflow: hidden;
  background:
    radial-gradient(circle at 15% 10%, rgba(79, 70, 229, 0.08), transparent 24%),
    radial-gradient(circle at 84% 16%, rgba(79, 70, 229, 0.08), transparent 20%),
    linear-gradient(180deg, rgba(250, 250, 248, 0.96), rgba(255, 255, 255, 0.98));
}

.cloud-canvas {
  position: relative;
  min-height: inherit;
}

.cloud-item {
  position: absolute;
  padding: 0;
  border: 0;
  background: transparent;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  letter-spacing: -0.04em;
  line-height: 1.04;
  color: rgba(0, 0, 0, 0.87);
  transform-origin: center;
  transition:
    color 180ms ease,
    opacity 180ms ease,
    transform 180ms ease,
    text-shadow 180ms ease;
}

.cloud-item.is-link {
  color: var(--primary);
}

.cloud-item:hover,
.cloud-item:focus-visible,
.cloud-item.is-active {
  color: var(--primary);
  opacity: 1 !important;
  transform: translateY(-1px) scale(1.015) rotate(var(--cloud-rotate, 0deg)) !important;
  text-shadow: 0 0 18px rgba(79, 70, 229, 0.14);
}

.empty-state {
  position: absolute;
  inset: 0;
  margin: auto;
  width: fit-content;
  height: fit-content;
  padding: 18px 22px;
  border-radius: 18px;
  text-align: center;
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid rgba(0, 0, 0, 0.06);
  box-shadow: var(--shadow-soft);
}

.empty-state h3 {
  margin: 0;
  font-size: 1rem;
  letter-spacing: -0.02em;
}

.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.section-head h2,
.modal-card h2 {
  margin: 0;
  font-size: clamp(1.4rem, 2.4vw, 1.8rem);
  letter-spacing: -0.04em;
  line-height: 1.02;
}

.section-copy {
  margin: 0;
  color: var(--muted);
  line-height: 1.6;
}

.section-copy.compact {
  font-size: 0.96rem;
}

.application-head {
  align-items: flex-end;
}

.section-copy-block {
  max-width: 34rem;
}

.application-copy {
  max-width: 34rem;
}

.section-actions {
  margin-top: 18px;
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.didacticiel-track {
  margin-top: 18px;
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(210px, 240px);
  gap: 12px;
  overflow-x: auto;
  padding-bottom: 6px;
  scroll-snap-type: x proximity;
  scrollbar-width: thin;
  scrollbar-color: rgba(79, 70, 229, 0.28) transparent;
}

.didacticiel-card {
  min-height: 120px;
  padding: 18px;
  border-radius: 20px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.82);
  scroll-snap-align: start;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.56),
    0 10px 24px rgba(0, 0, 0, 0.03);
}

.didacticiel-card h3 {
  margin: 0;
  font-size: 1rem;
  letter-spacing: -0.02em;
  line-height: 1.2;
}

.didacticiel-card p {
  margin: 8px 0 0;
  color: var(--muted);
  line-height: 1.55;
}

.footer {
  margin-top: 20px;
}

.footer-links {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.footer-links a {
  padding: 10px 14px;
  border-radius: var(--radius-pill);
  background: rgba(255, 255, 255, 0.78);
  border: 1px solid var(--line);
  color: var(--muted);
  transition: color 180ms ease, border-color 180ms ease;
}

.footer-links a:hover,
.footer-links a:focus-visible {
  color: var(--ink);
  border-color: var(--line-strong);
}

.footer-meta {
  margin: 14px 2px 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: grid;
  place-items: center;
  padding: 18px;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 17, 21, 0.38);
  backdrop-filter: blur(8px);
}

.modal-card {
  position: relative;
  width: min(640px, 100%);
  max-height: min(88vh, 760px);
  overflow: auto;
}

.modal-close {
  position: absolute;
  top: 14px;
  right: 14px;
}

.modal-body {
  padding: 24px;
}

.modal-description {
  margin: 12px 0 0;
  color: var(--muted);
  line-height: 1.62;
}

.modal-tags {
  margin-top: 14px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.modal-tag {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 0 12px;
  border-radius: var(--radius-pill);
  background: var(--primary-soft);
  border: 1px solid rgba(79, 70, 229, 0.12);
  font-size: 0.88rem;
}

.modal-actions {
  margin-top: 18px;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.action-tile {
  display: flex;
  gap: 12px;
  align-items: center;
  min-height: 68px;
  padding: 14px 16px;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.82);
  border: 1px solid var(--line);
  color: var(--ink);
  transition:
    transform 180ms ease,
    border-color 180ms ease,
    background-color 180ms ease;
}

.action-tile:hover,
.action-tile:focus-visible {
  transform: translateY(-1px);
  border-color: rgba(79, 70, 229, 0.2);
}

.action-tile.primary {
  background: linear-gradient(135deg, var(--primary), #6d65ef);
  border-color: transparent;
  color: #fff;
}

.action-tile.primary .action-tile-icon {
  background: rgba(255, 255, 255, 0.16);
  color: #fff;
}

.action-tile strong {
  font-size: 0.96rem;
  letter-spacing: -0.02em;
}

.modal-links-section {
  margin-top: 18px;
}

.modal-links {
  display: grid;
  gap: 10px;
}

.modal-link {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  min-height: 56px;
  padding: 12px 14px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.82);
  border: 1px solid var(--line);
}

.modal-link-copy {
  min-width: 0;
}

.modal-link-copy strong,
.modal-link-copy small {
  display: block;
}

.modal-link-copy strong {
  font-size: 0.95rem;
  letter-spacing: -0.02em;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.modal-link-copy small {
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.modal-link-arrow {
  color: var(--muted);
  font-size: 1.2rem;
}

@media (max-width: 900px) {
  .topbar {
    flex-direction: column;
    align-items: flex-start;
    border-radius: 28px;
  }

  .topbar-nav {
    width: 100%;
    justify-content: flex-start;
  }

  .cloud-viewport {
    min-height: 560px;
  }

  .application-head {
    align-items: baseline;
  }

  .modal-actions {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  :root {
    --page-width: calc(100% - 20px);
  }

  .page {
    margin: 16px auto 44px;
  }

  .topbar {
    top: 10px;
    margin-top: 10px;
  }

  .topbar-nav,
  .topbar-nav a,
  .button {
    width: 100%;
  }

  .topbar-nav .app-popover,
  .section-actions .app-popover {
    width: 100%;
  }

  .topbar-nav .app-popover-menu,
  .section-actions .app-popover-menu {
    left: 0;
    right: 0;
    min-width: 0;
  }

  .topbar-nav .app-popover-menu::before,
  .section-actions .app-popover-menu::before {
    left: 24px;
    right: auto;
  }

  .stage,
  .section,
  .footer,
  .modal-body {
    padding: 20px;
  }

  .cloud-surface {
    padding: 12px;
  }

  .cloud-viewport {
    min-height: 500px;
  }

  .section-actions {
    flex-direction: column;
    align-items: stretch;
  }

  .modal {
    padding: 10px;
  }
}
