/* =========================================================
   My App Zone — styles
   Brand colours: black/navy, white, blue (actions), green (highlights)
   ========================================================= */

:root {
  --black: #060b18;          /* text on light */
  --navy: #010a23;           /* matches the logo background exactly */
  --navy-2: #071336;
  --white: #ffffff;
  --blue: #0b6bff;           /* primary buttons, links, interactive */
  --blue-dark: #0553d1;
  --blue-soft: #e8f1ff;
  --green: #12b76a;          /* highlights, success, selected */
  --green-dark: #067647;
  --green-soft: #e6f8ef;

  --text: #0b1220;
  --muted: #566176;
  --line: #e4e9f2;
  --bg: #f6f8fc;

  --radius: 20px;
  --shadow-sm: 0 1px 2px rgba(6, 11, 24, .06), 0 4px 14px rgba(6, 11, 24, .05);
  --shadow-lg: 0 18px 44px rgba(6, 11, 24, .14);
  --font: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: var(--font);
  color: var(--text);
  background: var(--bg);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}
img { max-width: 100%; display: block; }
[hidden] { display: none !important; }
h1, h2, h3, p { margin: 0; }
a { color: var(--blue); }

.container { width: min(1200px, 100% - 2 * clamp(16px, 4vw, 32px)); margin-inline: auto; }

.sr-only {
  position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.skip-link {
  position: absolute; left: 12px; top: -60px; z-index: 50;
  background: var(--blue); color: var(--white); padding: 10px 16px; border-radius: 10px;
  text-decoration: none; font-weight: 600; transition: top .2s;
}
.skip-link:focus { top: 12px; }

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

/* =========================================================
   Splash screen
   ========================================================= */
#splash {
  position: fixed; inset: 0; z-index: 1000;
  display: none; place-items: center;
  background: var(--navy);
  transition: opacity .7s ease, transform .7s cubic-bezier(.4, 0, .2, 1), visibility 0s linear .7s;
}
.splash-on #splash { display: grid; }
.splash-on { overflow: hidden; }          /* no scrolling behind the splash */

.splash__inner { display: grid; justify-items: center; gap: clamp(14px, 3vh, 26px); }

.splash__logo {
  width: clamp(190px, 46vmin, 320px);
  height: auto; aspect-ratio: 1;
  opacity: 0; transform: scale(.82); filter: blur(10px);
}
.splash__bar {
  width: clamp(150px, 32vmin, 230px); height: 4px; border-radius: 4px;
  background: rgba(255, 255, 255, .12); overflow: hidden; opacity: 0;
}
.splash__bar span {
  display: block; height: 100%; border-radius: inherit;
  background: linear-gradient(90deg, var(--green), var(--blue));
  transform: scaleX(0); transform-origin: left center;
}

/* animation only starts when main.js adds .splash-run (so it is in sync with the 3s timer) */
#splash.splash-run .splash__logo {
  animation: logo-in 1s cubic-bezier(.2, .8, .2, 1) .1s forwards,
             logo-float 3.2s ease-in-out 1.1s infinite;
}
#splash.splash-run .splash__bar { animation: fade-in .5s ease .6s forwards; }
#splash.splash-run .splash__bar span { animation: bar-fill 3s linear forwards; }

#splash.splash-leave {
  opacity: 0; transform: scale(1.04); visibility: hidden; pointer-events: none;
}

@keyframes logo-in {
  to { opacity: 1; transform: scale(1); filter: blur(0); }
}
@keyframes logo-float {
  0%, 100% { transform: translateY(0) scale(1); }
  50%      { transform: translateY(-6px) scale(1); }
}
@keyframes fade-in { to { opacity: 1; } }
@keyframes bar-fill { to { transform: scaleX(1); } }

/* main page fades in right after the splash */
#app.page-reveal { animation: page-in .8s cubic-bezier(.2, .8, .2, 1) both; }
@keyframes page-in { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }

/* =========================================================
   Header
   ========================================================= */
.site-header {
  position: sticky; top: 0; z-index: 20;
  background: var(--navy);               /* solid, so the logo's own background blends in perfectly */
  border-bottom: 1px solid rgba(255, 255, 255, .08);
}
.site-header__inner { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 72px; padding-block: 6px; }

.brand { display: inline-flex; align-items: center; gap: 12px; text-decoration: none; color: var(--white); }
.brand__logo { width: 56px; height: 56px; flex: none; }
.brand__name { font-size: clamp(1.1rem, 3.6vw, 1.4rem); font-weight: 800; letter-spacing: -.01em; }
.brand__name span { color: #19a0ff; }

.header-badge {
  display: inline-flex; align-items: center; gap: 8px;
  font-size: .8rem; font-weight: 600; color: rgba(255, 255, 255, .85);
  padding: 7px 14px; border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, .16); background: rgba(255, 255, 255, .05);
}
.header-badge i, .chip i { width: 8px; height: 8px; border-radius: 50%; background: var(--green); box-shadow: 0 0 0 4px rgba(18, 183, 106, .22); }

/* =========================================================
   Hero + search
   ========================================================= */
.hero {
  position: relative; isolation: isolate; overflow: hidden;
  background: var(--navy); color: var(--white);
  padding: clamp(40px, 8vw, 84px) 0 clamp(78px, 11vw, 120px);
  text-align: center;
}
.hero::before, .hero::after {
  content: ""; position: absolute; z-index: -1; border-radius: 50%; filter: blur(70px); pointer-events: none;
}
.hero::before { width: 460px; height: 460px; left: -140px; top: -180px; background: rgba(11, 107, 255, .38); }
.hero::after  { width: 380px; height: 380px; right: -120px; bottom: -190px; background: rgba(18, 183, 106, .22); }

.eyebrow {
  display: inline-block; font-size: .8rem; font-weight: 700; letter-spacing: .12em; text-transform: uppercase;
  color: var(--green); margin-bottom: 14px;
}
.hero h1 { font-size: clamp(2rem, 6.2vw, 3.6rem); line-height: 1.1; letter-spacing: -.025em; font-weight: 800; text-wrap: balance; }
.hero h1 em {
  font-style: normal;
  background: linear-gradient(90deg, #19a0ff, var(--blue)); -webkit-background-clip: text; background-clip: text; color: transparent;
}
.hero__sub { margin: 16px auto 0; max-width: 560px; color: rgba(255, 255, 255, .72); font-size: clamp(.98rem, 2.4vw, 1.12rem); }

.search {
  position: relative; display: flex; align-items: center;
  width: min(680px, 100%); margin: clamp(26px, 5vw, 38px) auto 0;
  background: var(--white); border-radius: 999px; padding: 0 18px;
  box-shadow: 0 18px 50px rgba(0, 0, 0, .35);
  border: 2px solid transparent; transition: border-color .2s, box-shadow .2s;
}
.search:focus-within { border-color: var(--green); box-shadow: 0 18px 50px rgba(0, 0, 0, .35), 0 0 0 5px rgba(18, 183, 106, .25); }
.search__icon { color: var(--blue); flex: none; }
.search input {
  flex: 1; min-width: 0; height: clamp(54px, 8vw, 62px); border: 0; background: transparent;
  padding: 0 12px; font: inherit; font-size: 1.05rem; color: var(--text); outline: none;
  -webkit-appearance: none; appearance: none;
}
.search input::placeholder { color: #8a94a8; }
.search input::-webkit-search-cancel-button { display: none; }
.search__clear {
  display: grid; place-items: center; width: 34px; height: 34px; flex: none;
  border: 0; border-radius: 50%; background: var(--blue-soft); color: var(--blue); cursor: pointer;
  transition: background .15s;
}
.search__clear:hover { background: #d3e5ff; }
.search__hint {
  flex: none; margin-left: 8px; font: 600 .8rem var(--font); color: #8a94a8;
  border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 7px; padding: 2px 8px;
}
.search:focus-within .search__hint, .search.has-value .search__hint { display: none; }
@media (hover: none), (max-width: 700px) { .search__hint { display: none; } }

/* =========================================================
   Showcase
   ========================================================= */
.showcase {
  position: relative; margin-top: -34px;
  background: var(--bg); border-radius: 34px 34px 0 0;
  padding: clamp(30px, 5vw, 52px) 0 clamp(56px, 8vw, 96px);
  min-height: 46vh;
}
.showcase__head { display: flex; align-items: center; gap: 12px; margin-bottom: 24px; }
.showcase__head h2 { font-size: clamp(1.4rem, 3.4vw, 1.8rem); font-weight: 800; letter-spacing: -.015em; color: var(--black); }
.count {
  font-size: .85rem; font-weight: 700; color: var(--green-dark);
  background: var(--green-soft); padding: 4px 12px; border-radius: 999px;
}
.count:empty { display: none; }

.grid {
  display: grid; gap: clamp(14px, 2.4vw, 24px);
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 270px), 1fr));
}
.grid:empty { display: none; }

/* ---------- App card (reusable) ---------- */
.card {
  display: flex; flex-direction: column; gap: 10px;
  background: var(--white); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 22px; box-shadow: var(--shadow-sm);
  transition: transform .25s cubic-bezier(.2, .8, .2, 1), box-shadow .25s, border-color .25s;
  animation: card-in .5s cubic-bezier(.2, .8, .2, 1) both;
  animation-delay: calc(var(--i, 0) * 45ms);
}
.card:hover { transform: translateY(-5px); box-shadow: var(--shadow-lg); border-color: #bcd5ff; }
.card__top { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; margin-bottom: 6px; }
.card__icon {
  position: relative; width: 64px; height: 64px; border-radius: 16px; overflow: hidden; flex: none;
  background: var(--navy); box-shadow: inset 0 0 0 1px rgba(6, 11, 24, .06);
}
.card__icon img { width: 100%; height: 100%; object-fit: cover; }
.card__initial {
  position: absolute; inset: 0; display: grid; place-items: center;
  color: var(--white); font-weight: 800; font-size: 1.7rem;
  background: linear-gradient(135deg, var(--blue), var(--navy-2));
}
.card__icon img:not([hidden]) + .card__initial { display: none; }

.chip {
  display: inline-flex; align-items: center; gap: 7px; font-size: .75rem; font-weight: 700;
  color: var(--green-dark); background: var(--green-soft); padding: 4px 11px 4px 9px; border-radius: 999px;
}
.chip i { width: 7px; height: 7px; box-shadow: none; }

.card__title { font-size: 1.15rem; font-weight: 800; letter-spacing: -.01em; color: var(--black); overflow-wrap: anywhere; }
.card__desc {
  color: var(--muted); font-size: .95rem; flex: 1;
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden;
  min-height: 4.4em;
}
.card__btn { margin-top: 10px; width: 100%; }

@keyframes card-in { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 46px; padding: 0 22px; border-radius: 14px; border: 1.5px solid transparent;
  font: inherit; font-weight: 700; font-size: .98rem; text-decoration: none; cursor: pointer;
  transition: background .18s, transform .18s, box-shadow .18s, color .18s, border-color .18s;
}
.btn--primary { background: var(--blue); color: var(--white); box-shadow: 0 8px 18px rgba(11, 107, 255, .28); }
.btn--primary:hover { background: var(--blue-dark); transform: translateY(-1px); }
.btn--primary:active { transform: translateY(0); }
.btn--primary svg { transition: transform .18s; }
.btn--primary:hover svg { transform: translate(2px, -2px); }
.btn--primary[aria-disabled="true"] {
  background: #e9edf5; color: #7b8598; box-shadow: none; cursor: not-allowed; pointer-events: none;
}
.btn--ghost { background: var(--white); color: var(--blue); border-color: #bcd5ff; }
.btn--ghost:hover { background: var(--blue-soft); }

/* ---------- Empty states ---------- */
.empty {
  display: grid; justify-items: center; text-align: center; gap: 10px;
  padding: clamp(40px, 8vw, 72px) 20px;
  background: var(--white); border: 2px dashed #cfd9ea; border-radius: 28px;
  animation: card-in .5s ease both;
}
.empty[hidden] { display: none; }
.empty__art {
  display: grid; place-items: center; width: 84px; height: 84px; border-radius: 24px;
  color: var(--blue); background: var(--blue-soft); margin-bottom: 6px;
}
.empty h3 { font-size: 1.3rem; font-weight: 800; color: var(--black); }
.empty p { color: var(--muted); max-width: 420px; }
.empty .btn { margin-top: 10px; }

/* =========================================================
   Footer
   ========================================================= */
.site-footer { background: var(--navy); color: rgba(255, 255, 255, .7); padding: 30px 0; }
.site-footer__inner { display: flex; align-items: center; justify-content: space-between; gap: 14px 24px; flex-wrap: wrap; }
.brand--footer .brand__logo { width: 44px; height: 44px; }
.brand--footer .brand__name { font-size: 1.05rem; }
.site-footer p { font-size: .9rem; }

/* ---------- Owner tools ---------- */
.header-actions { display: flex; align-items: center; gap: 12px; }
.btn--sm { min-height: 40px; padding: 0 16px; border-radius: 12px; font-size: .92rem; }
.btn--text { background: transparent; color: var(--muted); border-color: transparent; }
.btn--text:hover { color: #c0262d; }
.card__top .card__icon { margin-right: auto; }
.card__owner { display: flex; gap: 8px; margin-left: 8px; }
.card__top .chip { order: 2; }
.card__owner { order: 3; }
.icon-btn {
  display: inline-grid; place-items: center; width: 40px; height: 40px; border-radius: 12px;
  border: 1px solid var(--line); background: var(--white); color: var(--muted); cursor: pointer;
  transition: background .15s, color .15s, border-color .15s;
}
.icon-btn:hover { color: var(--blue); border-color: #bcd5ff; background: var(--blue-soft); }
.icon-btn--danger:hover { color: #c0262d; border-color: #f3c3c6; background: #fdeced; }
.icon-btn--confirm { width: auto; padding: 0 12px; font: 700 .82rem var(--font); color: #fff; background: #c0262d; border-color: #c0262d; }
.icon-btn--confirm:hover { color: #fff; background: #a51d24; border-color: #a51d24; }

.modal { position: fixed; inset: 0; z-index: 900; display: grid; place-items: center; padding: 16px; }
.modal__backdrop { position: absolute; inset: 0; background: rgba(1, 10, 35, .66); -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px); }
.modal__panel {
  position: relative; width: min(520px, 100%); max-height: calc(100% - 8px); overflow-y: auto;
  background: var(--white); color: var(--text); border-radius: 24px; padding: 24px;
  box-shadow: 0 30px 80px rgba(0, 0, 0, .45); display: grid; gap: 16px;
  animation: card-in .3s cubic-bezier(.2, .8, .2, 1) both;
}
.modal__head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.modal__head h2 { font-size: 1.35rem; font-weight: 800; letter-spacing: -.01em; }
.modal__foot { display: flex; justify-content: flex-end; gap: 10px; flex-wrap: wrap; }
.field { display: grid; gap: 6px; min-width: 0; }
.field label { font-weight: 700; font-size: .92rem; }
.field label b { color: var(--green-dark); }
.field input[type="text"], .field input[type="url"], .field textarea {
  width: 100%; font: inherit; font-size: 1rem; color: var(--text); background: var(--white);
  border: 1.5px solid #cfd9ea; border-radius: 12px; padding: 11px 14px; resize: vertical;
  transition: border-color .15s, box-shadow .15s;
}
.field input:focus, .field textarea:focus { outline: none; border-color: var(--blue); box-shadow: 0 0 0 4px rgba(11, 107, 255, .18); }
.field small { color: var(--muted); font-size: .82rem; }
.field.invalid input { border-color: #c0262d; }
.icon-pick { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.icon-pick__preview {
  position: relative; width: 64px; height: 64px; border-radius: 16px; overflow: hidden; flex: none;
  display: grid; place-items: center; color: #fff; font-weight: 800; font-size: 1.7rem;
  background: linear-gradient(135deg, var(--blue), var(--navy-2));
}
.icon-pick__preview img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.icon-pick__actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.icon-pick__actions label { cursor: pointer; }
#f-icon:focus-visible + label { outline: 3px solid var(--green); outline-offset: 3px; }
.form-error { color: #a51d24; background: #fdeced; border: 1px solid #f3c3c6; border-radius: 12px; padding: 10px 14px; font-size: .92rem; }

.toast {
  position: fixed; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom, 0px)); z-index: 950;
  transform: translateX(-50%); max-width: calc(100% - 32px);
  background: var(--navy); color: #fff; padding: 12px 20px; border-radius: 14px; font-weight: 600; font-size: .95rem;
  box-shadow: var(--shadow-lg); animation: card-in .3s ease both;
}
.toast::before { content: ""; display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--green); margin-right: 10px; }
@media (max-width: 520px) {
  .modal { align-items: end; padding: 0; }
  .modal__panel { border-radius: 24px 24px 0 0; width: 100%; padding-bottom: calc(24px + env(safe-area-inset-bottom, 0px)); }
  .modal__foot .btn { flex: 1; }
}


.link-btn { background: none; border: 0; padding: 4px 2px; font: inherit; font-size: .88rem; color: rgba(255,255,255,.62); cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }
.link-btn:hover { color: #fff; }
.site-footer__links { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; }
.modal__note { color: var(--muted); font-size: .92rem; }
.modal__ok { color: var(--green-dark); background: var(--green-soft); border: 1px solid #b7e8cf; border-radius: 12px; padding: 10px 14px; font-size: .92rem; }

/* =========================================================
   Small screens
   ========================================================= */
@media (max-width: 520px) {
  .header-badge { display: none; }
  .site-header__inner { min-height: 66px; }
  .brand__logo { width: 50px; height: 50px; }
  .card { padding: 18px; }
  .showcase { border-radius: 26px 26px 0 0; margin-top: -28px; }
  .site-footer__inner { justify-content: center; text-align: center; }
}

/* =========================================================
   Reduced motion — keep the 3s splash, drop the movement
   ========================================================= */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  #splash.splash-run .splash__logo { animation: fade-in .6s ease forwards; transform: none; filter: none; }
  #splash.splash-run .splash__bar span { animation-duration: 3s; }
  #splash { transition-duration: .4s; }
  #splash.splash-leave { transform: none; }
  #app.page-reveal, .card, .empty { animation: none; }
  .card:hover { transform: none; }
}
