:root {
  --bg: #0a0d21;
  --accent: #7c5cff;
  --accent2: #00d4ff;
  --pink: #ff5ca8;
  --text: #f2f3ff;
  --muted: #a7abd0;
  --danger: #ff5c7a;
  --radius: 22px;
  --glass: rgba(255,255,255,.09);
  --glass-border: rgba(255,255,255,.18);
}
* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  overflow-x: hidden;
}
/* --- animated aurora backdrop (the colour the glass blurs) --- */
body::before {
  content: "";
  position: fixed; inset: -20%;
  z-index: -1;
  background:
    radial-gradient(560px 420px at 18% 12%, rgba(124,92,255,.55), transparent 65%),
    radial-gradient(520px 420px at 85% 18%, rgba(0,212,255,.38), transparent 65%),
    radial-gradient(640px 520px at 55% 92%, rgba(255,92,168,.30), transparent 65%),
    radial-gradient(900px 700px at 50% 50%, #141a3d 0%, var(--bg) 75%);
  filter: blur(28px) saturate(130%);
  animation: aurora 26s ease-in-out infinite alternate;
}
@keyframes aurora {
  from { transform: translate3d(-2%, -1%, 0) scale(1); }
  50%  { transform: translate3d(2%, 2%, 0) scale(1.06); }
  to   { transform: translate3d(-1%, 3%, 0) scale(1.03); }
}
.topbar { position: relative; z-index: 200; text-align: center; padding: 42px 16px 10px; animation: rise .7s ease both; }
.logo { font-size: 2.1rem; font-weight: 800; letter-spacing: -.02em; text-shadow: 0 4px 30px rgba(124,92,255,.45); }
.logo a { color: var(--text); text-decoration: none; }
.tagline { color: var(--muted); margin: 6px 0 0; }
.wrap { max-width: 640px; margin: 0 auto; padding: 16px; display: grid; gap: 16px; }
/* --- liquid glass cards --- */
.card {
  background: linear-gradient(135deg, rgba(255,255,255,.14), rgba(255,255,255,.05) 45%, rgba(255,255,255,.08));
  -webkit-backdrop-filter: blur(18px) saturate(160%);
  backdrop-filter: blur(18px) saturate(160%);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: 0 20px 40px rgba(0,0,0,.35), inset 0 1px 0 rgba(255,255,255,.25), inset 0 -1px 0 rgba(255,255,255,.05);
  animation: rise .6s ease both;
}
.wrap > .card:nth-child(2) { animation-delay: .07s; }
.wrap > .card:nth-child(3) { animation-delay: .14s; }
.wrap > .card:nth-child(4) { animation-delay: .21s; }
.wrap > .card:nth-child(5) { animation-delay: .28s; }
@keyframes rise {
  from { opacity: 0; transform: translateY(16px) scale(.99); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  .card, .nav, input[type="url"], input[type="text"], input[type="email"], textarea, select { background: rgba(24,28,56,.92); }
}
.input-card label, .meta label { font-weight: 600; display: block; margin-bottom: 8px; }
.row { position: relative; }
input[type="url"], input[type="text"], input[type="email"], textarea, select {
  width: 100%;
  padding: 13px 14px;
  border-radius: 14px;
  border: 1px solid rgba(255,255,255,.16);
  background: rgba(255,255,255,.07);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  color: var(--text);
  font-size: 1rem;
  margin-bottom: 12px;
  font-family: inherit;
  transition: border-color .2s ease, box-shadow .2s ease, background .2s ease;
}
textarea { min-height: 140px; resize: vertical; }
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: rgba(124,92,255,.65);
  box-shadow: 0 0 0 4px rgba(124,92,255,.22), inset 0 1px 0 rgba(255,255,255,.15);
  background: rgba(255,255,255,.1);
}
input::placeholder { color: rgba(167,171,208,.75); }
select option { color: #14162e; }
.badge {
  position: absolute; right: 10px; top: 12px;
  font-size: .75rem; font-weight: 700; text-transform: uppercase;
  padding: 4px 10px; border-radius: 999px;
  background: linear-gradient(90deg, var(--accent), var(--accent2));
  color: #0b0d20;
  box-shadow: 0 4px 14px rgba(0,212,255,.35);
}
/* --- glass gradient button with a travelling sheen --- */
button {
  position: relative; overflow: hidden;
  width: 100%;
  padding: 13px;
  border: 1px solid rgba(255,255,255,.25); border-radius: 14px;
  font-size: 1rem; font-weight: 700; cursor: pointer;
  background: linear-gradient(90deg, var(--accent), var(--accent2));
  color: #0b0d20;
  box-shadow: 0 12px 26px rgba(124,92,255,.35), inset 0 1px 0 rgba(255,255,255,.5);
  transition: transform .18s ease, filter .18s ease, box-shadow .18s ease;
}
button:not(.linkbtn)::after {
  content: "";
  position: absolute; top: 0; bottom: 0; width: 45%; left: -60%;
  background: linear-gradient(100deg, transparent, rgba(255,255,255,.55), transparent);
  transform: skewX(-20deg);
  animation: sheen 4.5s ease-in-out infinite;
}
@keyframes sheen {
  0%, 55% { left: -60%; }
  85%, 100% { left: 130%; }
}
button:hover { filter: brightness(1.1); transform: translateY(-1px); box-shadow: 0 16px 32px rgba(124,92,255,.42), inset 0 1px 0 rgba(255,255,255,.5); }
button:active { transform: translateY(0) scale(.99); }
button:disabled { opacity: .6; cursor: wait; }
.hint, .muted { color: var(--muted); font-size: .85rem; }
.hidden { display: none !important; }
#spinner { text-align: center; color: var(--muted); padding: 12px; animation: pulse 1.2s ease-in-out infinite; }
@keyframes pulse { 0%, 100% { opacity: .45; } 50% { opacity: 1; } }
.error { border-color: var(--danger); color: #ffb3c2; }
#result { display: flex; gap: 18px; align-items: flex-start; }
#result img {
  width: 150px; border-radius: 16px; object-fit: cover;
  border: 1px solid rgba(255,255,255,.2);
  box-shadow: 0 12px 26px rgba(0,0,0,.4);
}
#result .meta { flex: 1; }
#result h2 { margin: 0 0 6px; font-size: 1.05rem; }
#result p { margin: 4px 0; }
#result select { margin: 8px 0 12px; }
#history { list-style: none; padding: 0; margin: 0 0 10px; }
#history li { padding: 8px 6px; border-bottom: 1px solid rgba(255,255,255,.07); font-size: .9rem; border-radius: 8px; transition: background .2s ease; }
#history li:hover { background: rgba(255,255,255,.06); }
#history small { color: var(--muted); }
.linkbtn { background: none; border: none; box-shadow: none; color: var(--muted); width: auto; padding: 4px 0; font-weight: 400; overflow: visible; }
.linkbtn:hover { transform: none; filter: none; box-shadow: none; color: var(--text); }
.how ol { margin: 8px 0 0; padding-left: 20px; color: var(--muted); }
.how li { margin: 6px 0; }
footer { text-align: center; color: var(--muted); font-size: .8rem; padding: 24px 12px 40px; }
@media (max-width: 520px) {
  #result { flex-direction: column; align-items: stretch; }
  #result img { width: 100%; max-height: 260px; }
}

/* --- glass pill nav, articles, footer (content pages) --- */
.nav {
  margin-top: 16px;
  display: inline-flex; flex-wrap: wrap; gap: 2px; justify-content: center;
  padding: 6px;
  border-radius: 999px;
  background: rgba(255,255,255,.08);
  -webkit-backdrop-filter: blur(16px) saturate(160%);
  backdrop-filter: blur(16px) saturate(160%);
  border: 1px solid var(--glass-border);
  box-shadow: 0 10px 26px rgba(0,0,0,.3), inset 0 1px 0 rgba(255,255,255,.22);
}
.nav a {
  color: var(--muted); text-decoration: none; font-size: .95rem; font-weight: 600;
  padding: 7px 13px; border-radius: 999px;
  transition: background .2s ease, color .2s ease;
}
.nav a:hover { color: var(--text); background: rgba(255,255,255,.14); }
.article h1 { font-size: 1.5rem; margin: 0 0 6px; }
.article h2 { font-size: 1.15rem; margin: 22px 0 8px; }
.article p, .article li { color: #ccd0f2; line-height: 1.65; font-size: .98rem; }
.article ul, .article ol { padding-left: 22px; }
.article li { margin: 5px 0; }
.article a { color: var(--accent2); }
.article .date { color: var(--muted); font-size: .85rem; margin-top: 0; }
.postlist { list-style: none; padding: 0; margin: 0; }
.postlist li { padding: 12px 0; border-bottom: 1px solid rgba(255,255,255,.07); }
.postlist a { font-weight: 700; font-size: 1.02rem; }
.postlist p { margin: 4px 0 0; }
footer .flinks { margin-bottom: 8px; display: flex; flex-wrap: wrap; gap: 6px 16px; justify-content: center; }
footer .flinks a { color: var(--muted); text-decoration: none; transition: color .2s ease; }
footer .flinks a:hover { color: var(--text); }
.faq h4 { margin: 16px 0 4px; }
.faq p { margin: 0; color: var(--muted); line-height: 1.6; font-size: .95rem; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* TikTok photo-post gallery — SnapTik-style: two per row, numbered,
   big download button under each picture. Lives BELOW the result card
   as its own block so it can never squeeze in beside it. */
.photo-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; margin-top: 14px; }
@media (min-width: 900px) { .photo-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.photo-item { position: relative; display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.photo-item img { width: 100%; max-width: 100%; height: auto; object-fit: cover; aspect-ratio: 3/4; border-radius: 16px; border: 1px solid rgba(255,255,255,.2); box-shadow: 0 12px 26px rgba(0,0,0,.4); display: block; }
.photo-num { position: absolute; top: 8px; left: 8px; min-width: 28px; height: 28px; padding: 0 6px; border-radius: 999px; background: rgba(10,10,25,.72); color: #fff; font-weight: 700; font-size: .9rem; display: flex; align-items: center; justify-content: center; }
.photo-dl { display: block; text-align: center; padding: 13px 8px; border-radius: 14px; background: linear-gradient(90deg, var(--accent), var(--accent2)); color: #0b0d20; font-weight: 700; font-size: 1rem; text-decoration: none; border: 1px solid rgba(255,255,255,.25); box-shadow: 0 12px 26px rgba(124,92,255,.35), inset 0 1px 0 rgba(255,255,255,.5); }
.photo-dl:hover { filter: brightness(1.1); }

/* Layout safety: nothing may stretch the page wider than the screen */
html, body { overflow-x: clip; }
#result .meta { min-width: 0; }
#result h2 { overflow-wrap: anywhere; }

h1.logo { margin: 0; }

/* --- steps guide (homepage) --- */
.steps-guide h2 { margin: 0 0 18px; font-size: 1.3rem; }
.step { display: flex; gap: 16px; }
.step-rail { display: flex; flex-direction: column; align-items: center; }
.step-ico { position: relative; width: 56px; height: 56px; flex: 0 0 auto; border-radius: 50%; background: var(--glass); border: 1px solid var(--glass-border); display: flex; align-items: center; justify-content: center; }
.step:not(:last-child) .step-rail::after { content: ""; width: 2px; flex: 1 1 auto; min-height: 30px; margin-top: 6px; background: linear-gradient(var(--accent), var(--accent2)); opacity: .45; border-radius: 2px; }
.step-num { position: absolute; top: -6px; right: -6px; width: 22px; height: 22px; border-radius: 50%; background: linear-gradient(135deg, var(--accent), var(--accent2)); color: #fff; font-size: .8rem; font-weight: 700; display: flex; align-items: center; justify-content: center; }
.step-body h3 { margin: 14px 0 4px; font-size: 1.08rem; }
.step-body p { margin: 0 0 24px; color: var(--muted); }
.step:last-child .step-body p { margin-bottom: 4px; }

/* --- language switcher --- */
.lang-wrap { position: absolute; top: 14px; right: 14px; z-index: 300; text-align: left; }
.lang-btn { background: var(--glass); border: 1px solid var(--glass-border); color: var(--text); border-radius: 999px; padding: 8px 14px; font-size: .92rem; cursor: pointer; backdrop-filter: blur(8px); }
.lang-btn:hover { border-color: var(--accent); }
.lang-caret { opacity: .7; font-size: .75rem; }
.lang-menu { z-index: 301; position: absolute; top: calc(100% + 8px); right: 0; min-width: 190px; max-height: 320px; overflow: auto; background: rgba(16,20,48,.96); border: 1px solid var(--glass-border); border-radius: 14px; padding: 6px; box-shadow: 0 18px 40px rgba(0,0,0,.45); }
.lang-item { display: block; width: 100%; text-align: left; background: none; border: 0; color: var(--text); padding: 9px 12px; border-radius: 9px; font-size: .95rem; cursor: pointer; }
.lang-item:hover { background: var(--glass); }
.lang-item.active { background: linear-gradient(135deg, var(--accent), var(--accent2)); color: #fff; }
[dir="rtl"] .lang-wrap { right: auto; left: 14px; }
[dir="rtl"] .lang-menu { right: auto; left: 0; }
[dir="rtl"] .lang-item { text-align: right; }
