/* RAISave v5.1 — futuristic rebuild, tasteful glow */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg: #0a0b0f;
  --surface: #12141a;
  --surface2: #1a1d25;
  --border: rgba(255,255,255,.07);
  --border-soft: rgba(255,255,255,.045);
  --text: #f2f4f8;
  --muted: #a0a6b3;
  --faint: #626876;
  --accent: #5b8cff;
  --accent2: #9d7bff;
  --gold: #d4b896;
  --green: #3fd08a;
  --paper: #f6f3ec;
  --ink: #23252c;
  --radius: 16px;
  --glow: 0 0 28px rgba(91,140,255,.22);
  --shadow-lg: 0 24px 64px rgba(0,0,0,.5);
}

/* Light theme */
[data-theme="light"] {
  --bg: #f6f7f9;
  --surface: #ffffff;
  --surface2: #eef0f4;
  --border: rgba(0,0,0,.08);
  --border-soft: rgba(0,0,0,.05);
  --text: #1a1d24;
  --muted: #5a6270;
  --faint: #8a91a0;
  --accent: #3b6fe0;
  --accent2: #7b5cf0;
  --glow: 0 0 28px rgba(59,111,224,.15);
  --shadow-lg: 0 24px 64px rgba(0,0,0,.12);
}

[data-theme="light"] body::before { opacity: .4; }

/* Light theme contrast fixes */
[data-theme="light"] {
  --gold: #9a7b4f;
}
[data-theme="light"] .input-row {
  background: var(--surface);
  box-shadow: 0 12px 40px rgba(0,0,0,.1), inset 0 1px 0 rgba(255,255,255,.6);
}
[data-theme="light"] .input-row:focus-within {
  box-shadow: 0 12px 40px rgba(0,0,0,.1), 0 0 40px rgba(59,111,224,.15), inset 0 1px 0 rgba(255,255,255,.6);
}
[data-theme="light"] .hero-badge {
  border-color: rgba(154,123,79,.35);
  background: rgba(154,123,79,.08);
}
[data-theme="light"] .hero h1 .grad {
  background: linear-gradient(120deg, #2f5fd0 0%, #6a4fd0 45%, #b07a3a 100%);
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent;
}
[data-theme="light"] .hint { color: #d33; }
[data-theme="light"] #btn-dl {
  background: linear-gradient(135deg, #2f5fd0 0%, #5b4fd6 55%, #7b5cf0 100%);
  background-size: 180% 180%;
}

html { scroll-behavior: smooth; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-size: 16px;
  line-height: 1.55;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

/* Animated ambient background */
body::before {
  content: "";
  position: fixed; inset: 0; z-index: -2;
  background:
    radial-gradient(ellipse 55% 35% at 20% 0%, rgba(77,124,255,.1), transparent 70%),
    radial-gradient(ellipse 45% 35% at 85% 15%, rgba(139,92,246,.09), transparent 70%),
    radial-gradient(ellipse 50% 40% at 50% 115%, rgba(77,124,255,.07), transparent 70%);
}
.orb {
  position: fixed; z-index: -1; border-radius: 50%;
  filter: blur(90px); opacity: .5; pointer-events: none;
}
.orb-1 { width: 420px; height: 420px; top: -140px; left: -120px; background: rgba(77,124,255,.14); animation: drift 22s ease-in-out infinite alternate; }
.orb-2 { width: 360px; height: 360px; top: 30%; right: -140px; background: rgba(139,92,246,.12); animation: drift 26s ease-in-out infinite alternate-reverse; }
@keyframes drift {
  from { transform: translate(0,0) scale(1); }
  to { transform: translate(60px,40px) scale(1.12); }
}
@media (prefers-reduced-motion: reduce) {
  .orb { animation: none; }
  .hero-badge .dot { animation: none; }
}

.wrap { width: min(720px, calc(100% - 40px)); margin-inline: auto; }

a { color: inherit; text-decoration: none; }
button { font: inherit; cursor: pointer; border: 0; background: none; color: inherit; }
img { display: block; max-width: 100%; }

/* Topbar */
.topbar {
  position: sticky; top: 0; z-index: 50;
  background: rgba(8,9,13,.85);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}
.topbar-in { display: flex; align-items: center; justify-content: space-between; height: 64px; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 17px; letter-spacing: -.02em; }
.brand img { border-radius: 8px; box-shadow: var(--glow); }
[data-theme="light"] .brand img { background: #12141a; padding: 3px; }
[data-theme="light"] .topbar { background: rgba(255,255,255,.85); }
.nav { display: flex; gap: 22px; font-size: 14px; color: var(--muted); }
.nav a { transition: color .15s; }
.nav a:hover { color: var(--text); }

/* Hero */
.hero { padding: 72px 0 48px; text-align: center; position: relative; }
.hero-badge {
  display: inline-flex; align-items: center; gap: 9px;
  padding: 8px 16px; margin-bottom: 24px;
  border: 1px solid rgba(212,184,150,.22); border-radius: 999px;
  background: rgba(212,184,150,.06);
  color: var(--gold); font-size: 11px; font-weight: 700; letter-spacing: .14em;
}
.hero-badge .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--green); box-shadow: 0 0 10px var(--green); animation: pulse 2.4s infinite; }
@keyframes pulse { 50% { opacity: .4; } }
.hero h1 {
  font-size: clamp(34px, 6.5vw, 52px); font-weight: 800; letter-spacing: -.035em; line-height: 1.08;
}
.hero h1 .grad {
  background: linear-gradient(120deg, #8ba6ff 0%, #c4a5ff 45%, #e8c9a0 100%);
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent;
}
.hero .sub { color: var(--muted); margin-top: 16px; font-size: 16.5px; font-weight: 400; letter-spacing: .01em; }

/* Form */
#dl-form { margin-top: 36px; display: flex; flex-direction: column; gap: 16px; align-items: center; }
.input-row {
  display: flex; gap: 4px; align-items: center;
  width: 100%; max-width: 520px; padding: 7px 7px 7px 18px;
  background: rgba(18,20,26,.75);
  border: 1px solid var(--border);
  border-radius: 20px;
  box-shadow: 0 12px 40px rgba(0,0,0,.4), inset 0 1px 0 rgba(255,255,255,.05);
  transition: border-color .25s, box-shadow .3s;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}
.input-row:focus-within {
  border-color: rgba(139,123,255,.45);
  box-shadow: 0 12px 40px rgba(0,0,0,.4), 0 0 40px rgba(139,123,255,.12), inset 0 1px 0 rgba(255,255,255,.07);
}
.input-ico { color: var(--gold); font-size: 16px; flex: 0 0 auto; opacity: .8; }
.input-row input {
  flex: 1; min-width: 0; height: 50px;
  background: transparent; color: var(--text);
  border: 0; font-size: 15.5px; padding: 0 4px; letter-spacing: .01em;
}
.input-row input:focus { outline: none; }
.input-row input::placeholder { color: var(--faint); }
.icon-btn.inside {
  width: 42px; height: 42px; flex: 0 0 42px;
  display: grid; place-items: center;
  border-radius: 13px; color: var(--muted);
  font-size: 18px;
  transition: background .18s, color .18s, transform .12s;
}
.icon-btn.inside:hover { background: rgba(212,184,150,.1); color: var(--gold); }
.icon-btn.inside:active { transform: scale(.9); }
.icon-btn.inside[hidden] { display: none; }
#btn-dl {
  display: inline-flex; align-items: center; gap: 12px;
  height: 54px; padding: 0 38px;
  border-radius: 16px;
  background: linear-gradient(135deg, #5b8cff 0%, #8b7bff 55%, #b48bff 100%);
  background-size: 180% 180%;
  color: #fff; font-weight: 750; font-size: 16px; letter-spacing: .02em;
  box-shadow: 0 8px 28px rgba(91,140,255,.35), inset 0 1px 0 rgba(255,255,255,.22), inset 0 -1px 0 rgba(0,0,0,.15);
  transition: transform .14s, box-shadow .25s, background-position .5s;
}
#btn-dl:hover { box-shadow: 0 10px 36px rgba(91,140,255,.5), inset 0 1px 0 rgba(255,255,255,.25); background-position: 90% 50%; transform: translateY(-1px); }
#btn-dl:active { transform: translateY(0) scale(.98); }
#btn-dl:disabled { opacity: .65; cursor: wait; transform: none; }
#btn-dl .arr { font-size: 19px; transition: transform .25s; }
#btn-dl:hover .arr { transform: translateX(5px); }
.hint { min-height: 22px; margin-top: 10px; font-size: 13px; color: #ff8484; }
.hint:empty { display: none; }

/* Preview zone */
.preview-zone { margin-top: 44px; display: flex; flex-direction: column; align-items: center; gap: 28px; }
.preview-zone[hidden] { display: none; }

/* Polaroid */
.polaroid {
  position: relative;
  width: min(320px, 84vw);
  background: linear-gradient(165deg, #faf8f3 0%, #f0ece2 100%);
  border-radius: 10px;
  padding: 14px 14px 0;
  transform: rotate(-1.2deg);
  box-shadow:
    0 2px 8px rgba(0,0,0,.5),
    0 18px 50px rgba(0,0,0,.45),
    0 0 80px rgba(212,184,150,.07);
  transition: transform .35s cubic-bezier(.22,.61,.36,1), box-shadow .35s;
}
.polaroid:hover {
  transform: rotate(0deg) translateY(-4px);
  box-shadow:
    0 4px 12px rgba(0,0,0,.5),
    0 24px 64px rgba(0,0,0,.5),
    0 0 100px rgba(212,184,150,.1);
}
.polaroid-photo {
  position: relative;
  aspect-ratio: 1 / 1;
  background: #0c0d11;
  border-radius: 3px;
  overflow: hidden;
}
.polaroid-photo img, .polaroid-photo video {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  object-fit: cover;
  /* Disable long-press / hold on preview images (we have our own download button) */
  -webkit-touch-callout: none;
  user-select: none;
  -webkit-user-select: none;
}
.polaroid-empty {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  color: var(--faint); font-size: 13px; padding: 20px; text-align: center;
}
.polaroid-cap { padding: 14px 4px 16px; color: var(--ink); }
.polaroid-meta strong {
  display: block; font-size: 13px; font-weight: 700;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.polaroid-meta small { color: #888; font-size: 12px; }
.polaroid-nav {
  position: absolute; left: 0; right: 0; bottom: 58px;
  display: flex; align-items: center; justify-content: center; gap: 12px;
  pointer-events: none;
}
.polaroid-nav[hidden] { display: none; }
.polaroid-nav button {
  pointer-events: auto;
  width: 36px; height: 36px; border-radius: 50%;
  background: rgba(0,0,0,.6); color: #fff;
  font-size: 19px; line-height: 1;
  display: grid; place-items: center;
  backdrop-filter: blur(6px);
  transition: transform .12s;
}
.polaroid-nav button:active { transform: scale(.9); }
.polaroid-nav span {
  background: rgba(0,0,0,.6); color: #fff;
  font-size: 12px; font-weight: 600;
  padding: 5px 12px; border-radius: 20px;
  backdrop-filter: blur(6px);
}
.pv-play {
  position: absolute; inset: 0; margin: auto;
  width: 68px; height: 68px; border-radius: 50%;
  background: rgba(255,255,255,.95); color: #111;
  font-size: 24px; display: grid; place-items: center;
  padding-left: 4px;
  box-shadow: 0 8px 28px rgba(0,0,0,.4);
  transition: transform .15s;
}
.pv-play:hover { transform: scale(1.08); }

/* Download options — elegant */
.dl-options { display: flex; flex-direction: column; gap: 10px; width: min(330px, 84vw); }
.dl-opt {
  display: flex; align-items: center; justify-content: space-between; gap: 14px;
  padding: 15px 17px; width: 100%;
  background: rgba(18,20,26,.7); border: 1px solid var(--border);
  border-radius: var(--radius); font-size: 14px; text-align: left;
  backdrop-filter: blur(8px);
  transition: border-color .2s, transform .15s, box-shadow .2s;
}
.dl-opt:hover {
  border-color: rgba(212,184,150,.35);
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(0,0,0,.3);
}
.dl-opt:active { transform: translateY(0); }
.dl-opt .lbl { min-width: 0; flex: 1; }
.dl-opt .lbl b { display: block; font-weight: 650; letter-spacing: .01em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 100%; }
.dl-opt .lbl small { color: var(--muted); font-size: 12px; letter-spacing: .03em; text-transform: uppercase; }
.dl-opt .go { color: var(--gold); font-weight: 700; white-space: nowrap; font-size: 13.5px; letter-spacing: .02em; }
.dl-opt .thumb { width: 48px; height: 48px; border-radius: 8px; object-fit: cover; flex-shrink: 0; background: var(--card); }
.dl-opt.dl-all {
  background: linear-gradient(135deg, rgba(77,124,255,.18), rgba(168,85,247,.14));
  border-color: rgba(77,124,255,.45);
}
.dl-opt.dl-all .go { color: var(--accent); }
.dl-opt:disabled { opacity: .6; cursor: wait; }

/* Platforms */
.platforms { padding: 40px 0; border-top: 1px solid var(--border); }
.platforms h2, .faq h2 { font-size: 21px; font-weight: 750; margin-bottom: 18px; letter-spacing: -.01em; }
.plat-list { list-style: none; display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.plat-list li {
  display: flex; align-items: center; gap: 12px;
  padding: 15px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); font-size: 14px;
  transition: border-color .15s, transform .12s;
}
.plat-list li.live:hover { border-color: rgba(77,124,255,.4); transform: translateY(-2px); }
.plat-list .pi {
  width: 40px; height: 40px; flex: 0 0 40px;
  display: grid; place-items: center;
  border-radius: 11px; font-size: 18px; font-weight: 800;
  background: var(--surface2);
}
.plat-list li.live .pi { background: rgba(77,124,255,.12); }
.plat-list b { display: block; font-size: 14px; }
.plat-list span { display: block; color: var(--muted); font-size: 12px; }
.plat-list em {
  margin-left: auto;
  font-style: normal; font-size: 11px; font-weight: 700;
  color: var(--green); background: rgba(53,211,154,.1);
  padding: 4px 10px; border-radius: 20px;
  border: 1px solid rgba(53,211,154,.2);
}
.plat-list li:not(.live) { opacity: .5; }
.plat-list li:not(.live) .soon { margin-left: auto; font-size: 11px; color: var(--faint); }

/* FAQ */
.faq { padding: 8px 0 52px; }
.faq details {
  border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--surface); margin-bottom: 8px;
  transition: border-color .15s;
}
.faq details[open] { border-color: rgba(77,124,255,.3); }
.faq summary { padding: 15px; cursor: pointer; font-weight: 600; font-size: 15px; list-style: none; display: flex; justify-content: space-between; align-items: center; }
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: "+"; color: var(--accent); font-size: 20px; font-weight: 400; }
.faq details[open] summary::after { content: "−"; }
.faq details p { padding: 0 15px 15px; color: var(--muted); font-size: 14px; }

/* Footer */
footer { border-top: 1px solid var(--border); padding: 30px 0 22px; background: rgba(0,0,0,.2); }
.foot-in { display: flex; justify-content: space-between; gap: 20px; flex-wrap: wrap; }
.foot-in strong { font-size: 17px; letter-spacing: -.01em; }
.foot-in p { color: var(--muted); font-size: 13px; margin-top: 8px; max-width: 280px; }
.foot-links { display: flex; gap: 18px; font-size: 14px; color: var(--muted); align-items: flex-start; }
.foot-links a:hover { color: var(--text); }
.foot-bottom {
  display: flex; justify-content: space-between; gap: 10px;
  margin-top: 22px; padding-top: 18px;
  border-top: 1px solid var(--border);
  color: var(--faint); font-size: 12px;
}

@media (max-width: 560px) {
  .plat-list { grid-template-columns: 1fr; }
  .nav { display: none; }
  .input-row { flex-wrap: wrap; }
  .input-row input { flex: 1 1 100%; order: -1; }
  .icon-btn { flex: 1; }
  #btn-dl { flex: 2; }
}

/* Search results */
.search-zone { margin-top: 26px; }
.search-grid {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px;
}
.search-empty { color: var(--muted); text-align: center; grid-column: 1 / -1; padding: 30px 0; }
.pin-card {
  position: relative; border-radius: 14px; overflow: hidden;
  background: rgba(255,255,255,.03); border: 1px solid var(--border);
  transition: transform .18s ease, border-color .18s ease;
}
.pin-card:hover { transform: translateY(-3px); border-color: rgba(77,124,255,.4); }
.pin-card img { width: 100%; aspect-ratio: 3/4; object-fit: cover; display: block; background: #111; }
.pin-badge {
  position: absolute; top: 8px; right: 8px; font-size: 12px;
  background: rgba(0,0,0,.65); color: #fff; border-radius: 8px; padding: 3px 8px;
}
.pin-meta { padding: 8px 10px 2px; }
.pin-meta small { color: var(--faint); font-size: 11px; }
.pin-actions { display: flex; gap: 6px; padding: 8px 10px 10px; }
.pin-actions button {
  flex: 1; font-size: 11px; font-weight: 600; padding: 7px 4px; border-radius: 9px;
  border: 1px solid var(--border); background: rgba(255,255,255,.04); color: var(--text); cursor: pointer;
}
.pin-actions .pin-dl {
  background: linear-gradient(135deg, rgba(77,124,255,.25), rgba(168,85,247,.2));
  border-color: rgba(77,124,255,.5);
}
.pin-actions button:hover { border-color: rgba(77,124,255,.6); }

@media (max-width: 720px) {
  .search-grid { grid-template-columns: repeat(3, 1fr); gap: 10px; }
}
@media (max-width: 480px) {
  .search-grid { grid-template-columns: repeat(2, 1fr); gap: 8px; }
}

/* YouTube badge overlay (non-playable thumbnail) */
.pv-ytbadge {
  position: absolute; inset: 0; margin: auto;
  width: fit-content; height: fit-content;
  display: grid; place-items: center;
  pointer-events: none;
  filter: drop-shadow(0 4px 12px rgba(0,0,0,.5));
  opacity: .92;
}

/* Theme toggle button */
.theme-btn {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 50%;
  width: 36px; height: 36px;
  font-size: 18px;
  cursor: pointer;
  display: grid; place-items: center;
  transition: transform .2s, background .2s;
}
.theme-btn:hover { transform: scale(1.1); }

/* Input icon button */
.input-ico-btn {
  background: none; border: none;
  font-size: 20px; color: var(--muted);
  cursor: pointer; padding: 4px;
  transition: color .2s, transform .2s;
}
.input-ico-btn:hover { color: var(--accent); transform: translate(1px, -1px); }

/* How to use + Features sections */
.howto, .features { padding: 64px 0 8px; }
.howto h2, .features h2 { font-size: 28px; font-weight: 700; letter-spacing: -0.5px; }
.section-desc { color: var(--muted); margin: 8px 0 28px; font-size: 15px; }
.steps { list-style: none; display: grid; gap: 16px; }
.steps li { display: flex; gap: 16px; align-items: flex-start; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; }
.step-num { flex-shrink: 0; width: 40px; height: 40px; border-radius: 50%; background: var(--accent); color: #fff; display: grid; place-items: center; font-weight: 700; font-size: 18px; }
.steps li div b { display: block; font-size: 16px; margin-bottom: 4px; }
.steps li div span { color: var(--muted); font-size: 14px; }
.feat-grid { list-style: none; display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 16px; }
.feat-grid li { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; }
.feat-grid li b { display: block; font-size: 15px; margin-bottom: 6px; }
.feat-grid li span { color: var(--muted); font-size: 14px; }
@media (max-width: 640px) {
  .howto, .features { padding: 48px 0 8px; }
}

/* Prevent image save via long-press/drag */
.polaroid-photo img {
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  user-select: none;
  pointer-events: auto;
}
.polaroid-photo {
  -webkit-touch-callout: none;
  user-select: none;
}
