:root {
  --cream: #f7f1e4;
  --paper: #fffdf8;
  --paper-strong: #fff;
  --navy: #0a2742;
  --navy-soft: #35516a;
  --muted: #667889;
  --orange: #f36f21;
  --orange-dark: #d9560c;
  --orange-pale: #fff1e6;
  --blue-pale: #e7f3fb;
  --green: #18784a;
  --green-pale: #e7f7ef;
  --red: #a93832;
  --red-pale: #fff0ee;
  --line: rgba(217, 204, 180, 0.75);
  --line-strong: #d4c6ad;
  --shadow-sm: 0 10px 30px rgba(10, 39, 66, 0.08);
  --shadow-lg: 0 28px 80px rgba(10, 39, 66, 0.16);
  --radius-sm: 14px;
  --radius: 22px;
  --radius-lg: 32px;
  --glass: rgba(255, 253, 248, 0.72);
  --font: "DM Sans", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --display: "Syne", "DM Sans", ui-sans-serif, system-ui, sans-serif;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  overflow-x: hidden;
  min-height: 100vh;
  background: var(--cream);
  color: var(--navy);
  font: 16px/1.55 var(--font);
  text-rendering: optimizeLegibility;
}
a { color: inherit; }
button, input, textarea, select { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; cursor: pointer; }
button:focus-visible, a:focus-visible, input:focus-visible, textarea:focus-visible, select:focus-visible {
  outline: 3px solid rgba(243, 111, 33, 0.4);
  outline-offset: 3px;
}
.hidden { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
.skip-link { position: fixed; z-index: 1000; left: 16px; top: -80px; padding: 10px 15px; border-radius: 10px; background: var(--navy); color: white; }
.skip-link:focus { top: 12px; }

.ambient { position: fixed; inset: 0; z-index: -1; overflow: hidden; pointer-events: none; }
.orb { position: absolute; border-radius: 50%; filter: blur(40px); opacity: .55; }
.orb-a { width: 42vw; height: 42vw; left: -12vw; top: -10vw; background: radial-gradient(circle, rgba(243,111,33,.35), transparent 70%); animation: drift 18s ease-in-out infinite; }
.orb-b { width: 36vw; height: 36vw; right: -10vw; top: 18vh; background: radial-gradient(circle, rgba(56,140,200,.28), transparent 70%); animation: drift 22s ease-in-out infinite reverse; }
.orb-c { width: 28vw; height: 28vw; left: 30vw; bottom: -8vw; background: radial-gradient(circle, rgba(24,120,74,.18), transparent 70%); animation: drift 26s ease-in-out infinite; }
.grid-glow {
  position: absolute; inset: 0;
  background-image:
    linear-gradient(rgba(14,49,82,.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(14,49,82,.03) 1px, transparent 1px);
  background-size: 48px 48px;
  mask-image: radial-gradient(ellipse at center, black 20%, transparent 75%);
}

.page-shell { width: min(1220px, calc(100% - 40px)); margin: 0 auto; position: relative; z-index: 1; }
.glass {
  background: rgba(255, 253, 248, 0.94);
  border: 1px solid rgba(255,255,255,.75);
  box-shadow: var(--shadow-sm);
}
/* Blur only on chrome that is not a form host (Safari breaks <select> under backdrop-filter). */
.site-header.glass {
  background: var(--glass);
  backdrop-filter: blur(16px) saturate(1.2);
  -webkit-backdrop-filter: blur(16px) saturate(1.2);
}

.site-header {
  position: sticky; top: 12px; z-index: 50;
  min-height: 72px; margin-top: 12px;
  display: flex; align-items: center; justify-content: space-between; gap: 18px;
  padding: 10px 14px 10px 12px; border-radius: 20px;
}
.brand { display: inline-flex; align-items: center; gap: 11px; text-decoration: none; letter-spacing: -0.02em; }
.brand-mark {
  width: 44px; height: 44px; display: grid; place-items: center; border-radius: 14px;
  background: rgba(255,255,255,.9); border: 1px solid var(--line); box-shadow: var(--shadow-sm);
}
.brand img { width: 32px; height: 32px; object-fit: contain; }
.brand strong, .brand small { display: block; }
.brand strong { font-family: var(--display); font-size: 15px; font-weight: 800; }
.brand small { color: var(--orange-dark); font-size: 11px; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; }
.header-actions, .site-nav, .locale-switcher { display: flex; align-items: center; }
.header-actions { gap: 12px; }
.site-nav { gap: 2px; }
.site-nav a {
  min-height: 40px; display: inline-flex; align-items: center; padding: 0 12px;
  border-radius: 12px; text-decoration: none; color: var(--navy-soft); font-size: 13px; font-weight: 700;
}
.site-nav a:hover, .site-nav a.active {
  background: rgba(255,255,255,.88); color: var(--navy);
  box-shadow: 0 2px 12px rgba(10,39,66,.08);
}
.site-nav a.active { color: var(--orange-dark); }
.locale-switcher { gap: 2px; padding: 3px; border: 1px solid var(--line-strong); border-radius: 11px; background: rgba(255,255,255,.65); }
.locale-switcher button { width: 36px; height: 32px; border: 0; border-radius: 8px; background: transparent; color: var(--muted); font-size: 12px; font-weight: 900; }
.locale-switcher button[aria-pressed="true"] { background: var(--navy); color: white; box-shadow: 0 2px 7px rgba(14,49,82,.22); }

.hero { position: relative; z-index: 2; padding: 56px 0 36px; overflow: visible; }
.hero--marketplace {
  min-height: auto; display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(280px, .85fr);
  align-items: center; gap: 48px;
}
.hero-copy { position: relative; z-index: 3; max-width: 720px; }
.hero-actions a, .hero-actions .button { position: relative; z-index: 4; }
.eyebrow {
  margin: 0 0 12px; color: var(--orange-dark); font-size: 12px; font-weight: 900;
  letter-spacing: .16em; text-transform: uppercase;
}
h1, h2, h3, p { overflow-wrap: break-word; }
h1 {
  margin: 0; font-family: var(--display);
  font-size: clamp(40px, 6.2vw, 72px); line-height: .98; letter-spacing: -.04em; font-weight: 800;
}
h2 { margin: 0; font-family: var(--display); font-size: clamp(24px, 3vw, 36px); line-height: 1.08; letter-spacing: -.03em; font-weight: 750; }
h3 { margin: 0; font-family: var(--display); }
.lede { max-width: 640px; margin: 20px 0 0; color: var(--navy-soft); font-size: clamp(16px, 1.8vw, 19px); line-height: 1.65; }
.hero-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; margin-top: 26px; }
.hero-stats { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 28px; }
.stat-pill {
  display: grid; gap: 2px; min-width: 110px; padding: 12px 14px; border-radius: 16px;
  background: rgba(255,255,255,.7); border: 1px solid var(--line); box-shadow: var(--shadow-sm);
}
.stat-pill strong { font-family: var(--display); font-size: 20px; font-weight: 800; }
.stat-pill span { color: var(--muted); font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; }

.button, button:not(.icon-button):not([data-locale]):not(.cat-chip) {
  min-height: 48px; display: inline-flex; align-items: center; justify-content: center;
  border: 1px solid transparent; border-radius: 14px; padding: 0 18px;
  background: var(--orange); color: white; font-weight: 800; text-decoration: none;
  box-shadow: 0 10px 24px rgba(243,111,33,.22);
}
.button:hover, button:not(.icon-button):not([data-locale]):not(.cat-chip):hover { background: var(--orange-dark); }
.button:disabled, button:disabled { opacity: .52; cursor: not-allowed; box-shadow: none; }
.button--glow {
  background: linear-gradient(135deg, #ff8a3d, #f36f21 45%, #e85a12);
  box-shadow: 0 12px 32px rgba(243,111,33,.35), 0 0 0 1px rgba(255,255,255,.2) inset;
}
.button--glow:hover { filter: brightness(1.05); }
.button--ghost, .button--quiet, .secondary {
  background: rgba(255,255,255,.85) !important; color: var(--navy) !important;
  border-color: var(--line-strong) !important; box-shadow: none !important;
}
.button--ghost:hover, .button--quiet:hover, .secondary:hover { background: var(--orange-pale) !important; }
.text-link { color: var(--navy); font-weight: 800; text-underline-offset: 4px; }

/* Decorative only: never steal clicks from hero CTAs, chips, or filters. */
.hero-visual {
  position: relative; z-index: 1; min-height: 280px;
  pointer-events: none; isolation: isolate;
}
.hero-frame {
  position: relative; overflow: hidden; border-radius: 28px; aspect-ratio: 16/10;
  border: 1px solid rgba(255,255,255,.7); box-shadow: var(--shadow-lg);
  transform: perspective(900px) rotateY(-4deg) rotateX(2deg);
  pointer-events: none;
}
.hero-art { display: block; width: 100%; height: 100%; object-fit: cover; pointer-events: none; }
.hero-shine {
  position: absolute; inset: 0;
  background: linear-gradient(120deg, transparent 30%, rgba(255,255,255,.28) 48%, transparent 62%);
  animation: shine 5.5s ease-in-out infinite;
  pointer-events: none;
}
.float-chip {
  position: absolute; z-index: 2; padding: 10px 14px; border-radius: 999px;
  background: rgba(255,253,248,.92); border: 1px solid var(--line); box-shadow: var(--shadow-lg);
  font-family: var(--display); font-size: 13px; font-weight: 800;
  pointer-events: none;
}
.float-chip--a { left: 4%; top: 14%; animation: floaty 4.5s ease-in-out infinite; color: var(--orange-dark); }
.float-chip--b { right: 4%; top: 42%; animation: floaty 5.2s ease-in-out infinite .4s; }
.float-chip--c { left: 14%; bottom: 8%; animation: floaty 4.8s ease-in-out infinite .8s; color: var(--green); }

.category-rail {
  position: relative; z-index: 5;
  display: flex; flex-wrap: nowrap; gap: 8px;
  padding: 10px 4px 12px; margin: 0 0 8px;
  overflow-x: auto; -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
}
.cat-chip {
  flex: 0 0 auto;
  min-height: 44px !important; min-width: 44px; padding: 0 16px !important;
  border-radius: 999px !important;
  border: 1px solid var(--line-strong) !important;
  background: #fffef9 !important;
  color: var(--navy-soft) !important;
  font-size: 13px !important; font-weight: 750 !important;
  box-shadow: 0 2px 8px rgba(10,39,66,.06) !important;
  cursor: pointer !important;
  position: relative; z-index: 6;
  pointer-events: auto !important;
  touch-action: manipulation;
}
.cat-chip:hover { background: var(--orange-pale) !important; color: var(--navy) !important; }
.cat-chip.active {
  background: var(--navy) !important; color: white !important; border-color: var(--navy) !important;
  box-shadow: 0 8px 18px rgba(10,39,66,.18) !important;
}

.catalogue { position: relative; z-index: 5; scroll-margin-top: 90px; padding: 28px 0 80px; }
.section-heading { display: flex; align-items: end; justify-content: space-between; gap: 20px; }
.supporting { margin: 9px 0 0; color: var(--muted); }
.toolbar {
  position: relative; z-index: 6;
  margin: 22px 0 22px; display: grid; grid-template-columns: minmax(0,1fr) 180px 150px;
  gap: 10px; padding: 12px; border-radius: 18px;
  /* Solid surface: backdrop-filter here breaks native <select> on iOS/Safari. */
  background: #fffef9 !important;
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
}
.toolbar input, .toolbar select, textarea {
  width: 100%; border: 1px solid var(--line-strong); border-radius: 14px;
  background: #fff; color: var(--navy);
  position: relative; z-index: 7;
  pointer-events: auto;
  font-size: 16px; /* stops iOS zoom-on-focus */
}
.toolbar input, .toolbar select { min-height: 48px; padding: 0 14px; }
.toolbar select {
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='none' stroke='%23667889' stroke-width='2' stroke-linecap='round'%3E%3Cpath d='m4 6 4 4 4-4'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 36px;
  cursor: pointer;
}
.search-field { position: relative; z-index: 7; }
.search-field svg {
  position: absolute; width: 18px; height: 18px; left: 15px; top: 15px;
  fill: none; stroke: var(--muted); stroke-width: 2; stroke-linecap: round;
  pointer-events: none;
}
.search-field input { padding-left: 44px; }

.featured-slot { margin-bottom: 18px; }
.featured-card {
  display: grid; grid-template-columns: minmax(180px, 280px) minmax(0,1fr);
  gap: 0; overflow: hidden; border-radius: var(--radius-lg);
  border: 1px solid rgba(255,255,255,.65); background: rgba(255,253,248,.9);
  box-shadow: var(--shadow-lg); min-height: 220px;
}
.featured-card .cover { min-height: 220px; height: 100%; }
.featured-card .cover-icon { width: 78px; height: 78px; border-radius: 24px; }
.featured-card .cover-icon svg { width: 40px; height: 40px; }
.featured-card .body { display: flex; flex-direction: column; padding: 28px; position: relative; z-index: 2; }
.featured-card h3 { font-size: clamp(24px, 3vw, 34px); margin: 10px 0 8px; }
.featured-card p { flex: 1; color: var(--muted); margin: 0 0 18px; }
.featured-badge {
  align-self: flex-start; padding: 5px 10px; border-radius: 999px;
  background: linear-gradient(135deg, #ffd93d, #f36f21); color: #4a2308;
  font-size: 11px; font-weight: 900; letter-spacing: .06em; text-transform: uppercase;
}

.app-grid {
  min-height: 260px; display: grid;
  grid-template-columns: repeat(3, minmax(0,1fr)); gap: 16px;
}
.app-card, .panel, .state-card {
  border: 1px solid rgba(217,204,180,.7);
  background: rgba(255,253,248,.88);
  box-shadow: var(--shadow-sm);
}
.app-card {
  position: relative; z-index: 1; min-width: 0; min-height: 340px; display: flex; flex-direction: column;
  padding: 0; border-radius: var(--radius); overflow: hidden; isolation: isolate;
  background: #fffef9;
}
.app-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 24px 50px rgba(10,39,66,.14);
  border-color: rgba(243,111,33,.35);
}
.app-card .cover {
  position: relative; height: 132px; overflow: hidden;
  display: grid; place-items: center;
}
.app-card .cover::after {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background:
    radial-gradient(circle at 18% 20%, rgba(255,255,255,.35), transparent 42%),
    linear-gradient(180deg, transparent 40%, rgba(10,39,66,.18));
}
.cover-pattern {
  position: absolute; inset: 0; opacity: 1; pointer-events: none;
  background-size: 24px 24px;
}
.cover--flashcard {
  background:
    radial-gradient(circle at 80% 20%, rgba(255,255,255,.35), transparent 40%),
    linear-gradient(145deg, #ffb36a 0%, #f36f21 48%, #0e3152 100%);
}
.cover--quiz {
  background:
    radial-gradient(circle at 20% 80%, rgba(255,255,255,.28), transparent 42%),
    linear-gradient(145deg, #7ec8ef 0%, #2f86b5 48%, #0e3152 100%);
}
.cover--dialogue {
  background:
    radial-gradient(circle at 70% 30%, rgba(255,255,255,.3), transparent 45%),
    linear-gradient(145deg, #8fe0b4 0%, #1f9a5c 48%, #0e3152 100%);
}
.cover--matcher {
  background:
    radial-gradient(circle at 30% 25%, rgba(255,255,255,.32), transparent 42%),
    linear-gradient(145deg, #d2b4ff 0%, #7a54d4 48%, #0e3152 100%);
}
.cover--story {
  background:
    radial-gradient(circle at 75% 70%, rgba(255,255,255,.28), transparent 45%),
    linear-gradient(145deg, #ffe08a 0%, #e6a31c 48%, #0e3152 100%);
}
.cover--custom {
  background:
    radial-gradient(circle at 50% 20%, rgba(255,255,255,.3), transparent 40%),
    linear-gradient(145deg, #ff9eaa 0%, #d25066 48%, #0e3152 100%);
}
.cover-pattern {
  background-image:
    radial-gradient(circle at 12% 22%, rgba(255,255,255,.22) 0 2px, transparent 3px),
    radial-gradient(circle at 78% 58%, rgba(255,255,255,.16) 0 3px, transparent 4px),
    linear-gradient(115deg, transparent 42%, rgba(255,255,255,.1) 50%, transparent 58%);
}
.cover-icon {
  position: relative; z-index: 2;
  width: 64px; height: 64px; border-radius: 20px;
  display: grid; place-items: center;
  background: rgba(255,255,255,.22); border: 1px solid rgba(255,255,255,.42);
  box-shadow: 0 10px 24px rgba(10,39,66,.18);
  color: white;
}
.cover-icon svg { width: 32px; height: 32px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.cover-label {
  position: absolute; left: 12px; bottom: 12px; z-index: 2;
  padding: 5px 10px; border-radius: 999px;
  background: rgba(255,255,255,.92); color: var(--navy);
  font-size: 11px; font-weight: 850; letter-spacing: .04em; text-transform: uppercase;
  box-shadow: 0 4px 12px rgba(10,39,66,.12);
  pointer-events: none;
}
.cover-glyph { display: none; }
.app-card .body { display: flex; flex-direction: column; flex: 1; padding: 16px 18px 18px; position: relative; z-index: 2; }
.app-card h3 { margin: 10px 0 6px; font-size: 18px; line-height: 1.25; letter-spacing: -.02em; }
.app-card .body > p {
  flex: 1; margin: 0 0 14px; color: var(--muted); font-size: 13px; line-height: 1.45;
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden;
}
.app-card .card-actions { position: relative; z-index: 3; }
.app-card .card-actions a,
.app-card .card-actions button { pointer-events: auto; touch-action: manipulation; }
.tag {
  align-self: flex-start; padding: 5px 10px; border-radius: 999px;
  background: var(--orange-pale); color: #9d420e; font-size: 11px; font-weight: 900;
  letter-spacing: .05em; text-transform: uppercase;
}
.meta { display: flex; gap: 12px; margin-bottom: 14px; color: var(--muted); font-size: 12px; font-weight: 650; }
.card-actions { display: grid; grid-template-columns: 1fr auto auto; gap: 7px; }
.card-actions .button, .card-actions button { min-height: 42px !important; padding: 0 12px !important; box-shadow: none !important; }
.empty {
  grid-column: 1/-1; min-height: 240px; display: grid; place-items: center;
  border: 1px dashed var(--line-strong); border-radius: var(--radius);
  background: rgba(255,255,255,.42); color: var(--muted); text-align: center; padding: 35px;
}
.skeleton {
  min-height: 320px; border-radius: var(--radius);
  background: linear-gradient(100deg, rgba(255,255,255,.45) 20%, rgba(255,255,255,.9) 40%, rgba(255,255,255,.45) 60%);
  background-size: 220% 100%; border: 1px solid var(--line); animation: shimmer 1.5s infinite linear;
}

/* Library */
.library { padding-bottom: 80px; }
.hero--library { max-width: 760px; padding-bottom: 28px; }
.library-layout {
  display: grid; grid-template-columns: 300px minmax(0,1fr); gap: 18px; align-items: start;
}
.lib-sidebar { padding: 22px; border-radius: var(--radius); position: sticky; top: 100px; }
.lib-sidebar .account-chip { display: inline-block; margin: 12px 0 0; max-width: 100%; }
.lib-cta { width: 100%; margin-top: 12px; }
.lib-grid {
  display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 14px; margin-top: 16px;
}
.lib-card {
  display: flex; flex-direction: column; min-height: 200px; padding: 0; overflow: hidden;
  border-radius: var(--radius); border: 1px solid rgba(217,204,180,.75);
  background: rgba(255,253,248,.92); box-shadow: var(--shadow-sm);
}
.lib-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-lg); }
.lib-card .cover { height: 100px; position: relative; display: grid; place-items: center; }
.lib-card .cover-icon { width: 52px; height: 52px; border-radius: 16px; }
.lib-card .cover-icon svg { width: 26px; height: 26px; }
.lib-card .body { flex: 1; display: flex; flex-direction: column; padding: 16px; gap: 8px; }
.lib-card h3 { font-size: 18px; }
.lib-card .meta-line { color: var(--muted); font-size: 12px; }
.lib-card .actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: auto; padding-top: 8px; }
.lib-card .actions .button { flex: 1; min-width: 100px; }

/* Builder */
.builder { max-width: 1040px; margin: 0 auto; padding-bottom: 90px; }
.hero--builder { max-width: 830px; padding-bottom: 36px; }
.hero--builder h1 { font-size: clamp(38px, 5.5vw, 62px); }
.state-card { display: flex; align-items: flex-start; gap: 20px; padding: 27px; border-radius: var(--radius); }
.state-card h2 { font-size: 26px; }
.state-card p { margin: 8px 0 18px; color: var(--muted); }
.state-copy { flex: 1; }
.state-icon { flex: 0 0 54px; width: 54px; height: 54px; display: grid; place-items: center; border-radius: 17px; background: var(--blue-pale); }
.state-icon svg { width: 27px; fill: none; stroke: var(--navy); stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.state-icon--warning { background: var(--red-pale); }
.state-icon--warning svg { stroke: var(--red); }
.spinner { flex: 0 0 34px; width: 34px; height: 34px; border: 3px solid var(--line); border-top-color: var(--orange); border-radius: 50%; animation: spin .8s linear infinite; }
.privacy-note { margin: 12px 0 0 !important; font-size: 12px; }
.builder-layout { display: grid; grid-template-columns: 300px minmax(0,1fr); gap: 18px; align-items: start; }
.account-column { display: grid; gap: 18px; }
.panel { padding: 22px; border-radius: var(--radius); }
.panel-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 15px; }
.panel-heading h2 { font-size: 26px; }
.account-chip {
  max-width: 160px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  padding: 6px 10px; border-radius: 999px; background: var(--blue-pale); color: var(--navy-soft);
  font-size: 11px; font-weight: 800;
}
.quota-grid { display: grid; gap: 10px; margin-top: 18px; }
.quota-grid > div {
  position: relative; display: grid; grid-template-columns: 12px 1fr; column-gap: 10px;
  padding: 14px; border-radius: 14px; background: #fffaf0;
}
.quota-grid strong { grid-column: 2; font-size: 22px; line-height: 1.1; font-family: var(--display); }
.quota-grid span:last-child { grid-column: 2; margin-top: 3px; color: var(--muted); font-size: 12px; }
.quota-icon { grid-row: 1/3; width: 10px; height: 10px; margin-top: 6px; border-radius: 50%; background: var(--orange); }
.quota-icon--blue { background: #3988b8; }
.quota-icon--green { background: var(--green); }
.guidance-panel { background: rgba(234,244,251,.72); }
.guidance-panel h3 { font-size: 17px; }
.guidance-panel ul { margin: 13px 0 0; padding-left: 19px; color: var(--navy-soft); font-size: 13px; }
.guidance-panel li + li { margin-top: 7px; }
.build-panel form { display: grid; gap: 17px; }
.build-panel textarea, dialog textarea { min-height: 190px; resize: vertical; padding: 16px; line-height: 1.6; }
.character-count { color: var(--muted); font-size: 12px; }
.form-footer { display: flex; align-items: center; justify-content: space-between; gap: 18px; }
.form-footer p { max-width: 410px; margin: 0; color: var(--muted); font-size: 12px; }
.my-apps-panel { grid-column: 1/-1; }
.my-app-row {
  display: grid; grid-template-columns: minmax(0,1fr) auto; gap: 14px; align-items: center;
  padding: 16px 0; border-top: 1px solid var(--line);
}
.my-app-row:first-child { margin-top: 12px; }
.my-app-row strong { display: block; }
.my-app-meta { color: var(--muted); font-size: 12px; }
.my-app-actions { display: flex; gap: 7px; }
.notice { margin-top: 17px; padding: 14px 16px; border-left: 4px solid var(--orange); border-radius: 10px; background: var(--orange-pale); color: #75401d; }
.notice--success { border-color: var(--green); background: var(--green-pale); color: var(--green); }
.notice--error { border-color: var(--red); background: var(--red-pale); color: var(--red); }

.site-footer {
  min-height: 110px; display: flex; align-items: center; justify-content: center; gap: 10px;
  border-top: 1px solid var(--line); color: var(--muted); text-align: center; font-size: 12px;
}
.site-footer img { width: 25px; height: 25px; object-fit: contain; opacity: .75; }
dialog {
  width: min(560px, calc(100% - 32px)); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 25px; background: var(--paper); color: var(--navy); box-shadow: var(--shadow-lg);
}
dialog::backdrop { background: rgba(10,39,66,.45); backdrop-filter: blur(4px); }
dialog form { display: grid; gap: 14px; }
.icon-button { width: 38px; height: 38px; border: 0; border-radius: 10px; background: transparent; color: var(--muted); font-size: 24px; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; }
.noscript { margin: 20px; padding: 14px; background: white; text-align: center; }

@keyframes spin { to { transform: rotate(360deg); } }
@keyframes shimmer { to { background-position-x: -220%; } }
@keyframes drift {
  0%, 100% { transform: translate(0, 0) scale(1); }
  50% { transform: translate(3%, 4%) scale(1.06); }
}
@keyframes floaty {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-10px); }
}
@keyframes shine {
  0%, 100% { transform: translateX(-40%); opacity: 0; }
  40% { opacity: 1; }
  70% { transform: translateX(40%); opacity: 0; }
}
@keyframes rise {
  from { opacity: 0; transform: translateY(18px); }
  to { opacity: 1; transform: translateY(0); }
}

@media (prefers-reduced-motion: no-preference) {
  .app-card, .lib-card, .button, button, a, .cat-chip, .featured-card {
    transition: transform .2s ease, background-color .2s ease, color .2s ease, box-shadow .2s ease, border-color .2s ease, filter .2s ease;
  }
  .reveal { animation: rise .7s ease both; }
  .app-card { animation: rise .45s ease both; }
  .app-card:nth-child(1) { animation-delay: .02s; }
  .app-card:nth-child(2) { animation-delay: .06s; }
  .app-card:nth-child(3) { animation-delay: .1s; }
  .app-card:nth-child(4) { animation-delay: .14s; }
  .app-card:nth-child(5) { animation-delay: .18s; }
  .app-card:nth-child(6) { animation-delay: .22s; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .orb, .hero-shine, .float-chip { animation: none !important; }
  .hero-frame { transform: none; }
  *, *::before, *::after {
    animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important;
  }
}

@media (max-width: 980px) {
  .hero--marketplace { grid-template-columns: 1fr; min-height: auto; gap: 28px; }
  .hero-frame { transform: none; }
  .app-grid, .lib-grid { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .library-layout, .builder-layout { grid-template-columns: 1fr; }
  .lib-sidebar { position: static; }
  .featured-card { grid-template-columns: 1fr; }
  .featured-card .cover { min-height: 140px; }
}
@media (max-width: 720px) {
  .page-shell { width: min(100% - 24px, 1220px); }
  .site-header { top: 8px; padding: 10px; }
  .header-actions { align-items: flex-end; flex-direction: column-reverse; gap: 8px; }
  .site-nav a { min-height: 40px; padding: 0 8px; font-size: 12px; }
  .brand strong { display: none; }
  .hero { padding-top: 36px; }
  .hero-visual { min-height: 0; max-width: 100%; }
  .toolbar { grid-template-columns: 1fr 1fr; }
  .search-field { grid-column: 1/-1; }
  .float-chip { display: none; }
  .form-footer { align-items: stretch; flex-direction: column; }
  .my-app-row { grid-template-columns: 1fr; }
  .app-card .cover { height: 120px; }
}
@media (max-width: 520px) {
  .page-shell { width: 100%; max-width: 100%; padding-inline: 12px; }
  .site-header { flex-direction: column; align-items: stretch; gap: 10px; }
  .header-actions { width: 100%; display: grid; grid-template-columns: minmax(0,1fr) auto; align-items: center; gap: 7px; }
  .site-nav { min-width: 0; display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 2px; }
  .site-nav a {
    min-width: 0; min-height: 44px; padding: 4px 2px; font-size: 11px;
    text-align: center; white-space: normal; line-height: 1.15;
  }
  .app-grid, .lib-grid, .toolbar { grid-template-columns: 1fr; }
  .search-field { grid-column: auto; }
  h1 { font-size: clamp(32px, 9vw, 38px); }
  .hero-actions, .my-app-actions, .lib-card .actions { flex-direction: column; align-items: stretch; }
  .card-actions { grid-template-columns: 1fr 1fr; }
  .card-actions .button { grid-column: 1/-1; min-height: 48px !important; }
  .state-icon { display: none; }
  .category-rail { margin-inline: -4px; padding-inline: 4px; }
  .cat-chip { min-height: 44px !important; font-size: 13px !important; }
}
