/* 🌊 Riptidee Web — liquid glass */

:root {
  --bg: #04050d;
  --ink: #eef2ff;
  --muted: rgba(238, 242, 255, .62);
  --faint: rgba(238, 242, 255, .38);
  --cyan: #26d4ff;
  --violet: #8b5cf6;
  --pink: #ff2e7e;
  --grad: linear-gradient(135deg, var(--cyan), var(--violet) 55%, var(--pink));
  --glass: rgba(255, 255, 255, .055);
  --glass-strong: rgba(255, 255, 255, .10);
  --stroke: rgba(255, 255, 255, .13);
  --stroke-soft: rgba(255, 255, 255, .07);
  --danger: #ff5c8a;
  --ok: #3ce8b0;
  --radius: 22px;
  --font-display: "Space Grotesk", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-body: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, sans-serif;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
[hidden] { display: none !important; }
html { color-scheme: dark; }
body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.5;
  min-height: 100dvh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  padding: calc(env(safe-area-inset-top)) calc(env(safe-area-inset-right)) calc(env(safe-area-inset-bottom)) calc(env(safe-area-inset-left));
}
::selection { background: rgba(139, 92, 246, .45); }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; -webkit-tap-highlight-color: transparent; }
input, select { font: inherit; color: inherit; }
img { max-width: 100%; display: block; }

/* ---------- animated aurora background ---------- */

.bg { position: fixed; inset: 0; z-index: -1; overflow: hidden; background:
  radial-gradient(120% 90% at 50% 0%, #0a0d22 0%, var(--bg) 55%); }
.blob { position: absolute; border-radius: 50%; filter: blur(80px); opacity: .5; will-change: transform; }
.b1 { width: 55vmax; height: 55vmax; left: -18vmax; top: -22vmax;
  background: radial-gradient(circle at 35% 35%, rgba(38, 212, 255, .55), transparent 65%);
  animation: drift1 38s ease-in-out infinite alternate; }
.b2 { width: 50vmax; height: 50vmax; right: -16vmax; bottom: -20vmax;
  background: radial-gradient(circle at 60% 60%, rgba(255, 46, 126, .45), transparent 65%);
  animation: drift2 46s ease-in-out infinite alternate; }
.b3 { width: 42vmax; height: 42vmax; left: 32%; top: 28%;
  background: radial-gradient(circle at 50% 50%, rgba(139, 92, 246, .42), transparent 65%);
  animation: drift3 52s ease-in-out infinite alternate; opacity: .42; }
@keyframes drift1 { to { transform: translate3d(9vmax, 7vmax, 0) scale(1.15); } }
@keyframes drift2 { to { transform: translate3d(-8vmax, -9vmax, 0) scale(1.12) rotate(20deg); } }
@keyframes drift3 { to { transform: translate3d(-10vmax, 6vmax, 0) scale(.9); } }
.noise { position: absolute; inset: -50%; opacity: .05; pointer-events: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='240' height='240'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2'/%3E%3C/filter%3E%3Crect width='240' height='240' filter='url(%23n)' opacity='0.7'/%3E%3C/svg%3E"); }

/* ---------- glass primitive ---------- */

.glass {
  background: var(--glass);
  border: 1px solid var(--stroke);
  border-radius: var(--radius);
  backdrop-filter: blur(22px) saturate(1.6);
  -webkit-backdrop-filter: blur(22px) saturate(1.6);
  box-shadow: 0 12px 40px rgba(1, 3, 12, .45), inset 0 1px 0 rgba(255, 255, 255, .09);
}

/* ---------- header ---------- */

.top {
  position: sticky; top: 12px; z-index: 50;
  max-width: 1040px; margin: 12px auto 0;
  width: calc(100% - 28px);
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 12px 10px 14px; border-radius: 20px;
}
.brand { display: flex; align-items: center; gap: 11px; }
.logo { width: 36px; height: 36px; border-radius: 10px; box-shadow: 0 4px 18px rgba(139, 92, 246, .5); }
.word { font-family: var(--font-display); font-weight: 700; font-size: 21px; letter-spacing: -.02em; }
.spark { background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }

.pill {
  display: inline-flex; align-items: center; gap: 2px;
  padding: 9px 16px; border-radius: 999px;
  background: var(--glass-strong); border: 1px solid var(--stroke);
  font-weight: 600; font-size: 14px;
  transition: transform .15s ease, background .2s ease, box-shadow .2s ease;
}
.pill:hover { background: rgba(255, 255, 255, .16); box-shadow: 0 0 22px rgba(139, 92, 246, .35); }
.pill:active { transform: scale(.96); }
.pill.small { padding: 7px 14px; font-size: 13px; }

/* ---------- hero ---------- */

main { max-width: 1040px; margin: 0 auto; padding: 0 14px 40px; }
.hero { text-align: center; padding: clamp(44px, 9vh, 92px) 0 8px; }
.hero h1 {
  font-family: var(--font-display);
  font-size: clamp(2.55rem, 7.2vw, 4.4rem);
  font-weight: 700; line-height: 1.04; letter-spacing: -.035em;
}
.hero h1 em {
  font-style: normal;
  background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent;
  filter: drop-shadow(0 0 24px rgba(139, 92, 246, .35));
}
.sub { color: var(--muted); max-width: 33em; margin: 18px auto 30px; font-size: 16px; }

.grabber {
  display: flex; align-items: center; gap: 8px;
  max-width: 680px; margin: 0 auto;
  padding: 9px 9px 9px 18px; border-radius: 22px;
  transition: box-shadow .25s ease, border-color .25s ease;
}
.grabber:focus-within {
  border-color: rgba(38, 212, 255, .45);
  box-shadow: 0 0 0 1.5px rgba(38, 212, 255, .35), 0 0 42px rgba(38, 212, 255, .18), 0 12px 40px rgba(1, 3, 12, .45);
}
.linkicon { width: 19px; height: 19px; color: var(--faint); flex: none; }
#urlInput {
  flex: 1; min-width: 0; background: none; border: 0; outline: 0;
  font-size: 16px; height: 46px; color: var(--ink);
}
#urlInput::placeholder { color: var(--faint); }

.iconbtn {
  width: 42px; height: 42px; flex: none;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 13px; background: var(--glass-strong); border: 1px solid var(--stroke-soft);
  transition: transform .15s ease, background .2s ease, color .2s ease;
  color: var(--muted);
}
.iconbtn svg { width: 18px; height: 18px; }
.iconbtn:hover { background: rgba(255, 255, 255, .17); color: var(--ink); }
.iconbtn:active { transform: scale(.92); }

.cta {
  display: inline-flex; align-items: center; gap: 7px;
  height: 46px; padding: 0 22px; flex: none;
  border-radius: 15px; background: var(--grad);
  color: #fff; font-weight: 700; font-size: 15px; letter-spacing: .01em;
  text-decoration: none;
  box-shadow: 0 6px 26px rgba(139, 92, 246, .5), inset 0 1px 0 rgba(255, 255, 255, .25);
  transition: transform .15s ease, filter .2s ease, box-shadow .2s ease;
}
.cta:hover { filter: brightness(1.12); box-shadow: 0 8px 34px rgba(255, 46, 126, .45), inset 0 1px 0 rgba(255, 255, 255, .25); }
.cta:active { transform: scale(.95); }
.cta .arrow { font-size: 17px; transition: transform .2s ease; }
.cta:hover .arrow { transform: translateY(2px); }
.cta.busy { pointer-events: none; filter: saturate(.6) brightness(.85); }
.cta.busy .arrow { animation: bob 1s ease-in-out infinite; }
@keyframes bob { 50% { transform: translateY(3px); } }

.chips { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin: 22px 0 4px; }
.chip {
  font-size: 12.5px; color: var(--muted); padding: 6px 13px; border-radius: 999px;
  background: rgba(255, 255, 255, .045); border: 1px solid var(--stroke-soft);
}

/* ---------- sections ---------- */

section h2 {
  font-family: var(--font-display); font-size: 19px; font-weight: 600; letter-spacing: -.015em;
  margin: 0 0 6px; display: flex; align-items: center; gap: 8px;
}
.jobs { margin-top: 40px; }
.library { margin-top: 48px; }
.count { color: var(--faint); font-weight: 500; font-size: 15px; }
.lib-note { color: var(--faint); font-size: 12.5px; margin-bottom: 14px; }

/* ---------- result card ---------- */

.job {
  display: flex; gap: 14px; align-items: center;
  padding: 14px 16px; border-radius: 19px;
  animation: rise .45s cubic-bezier(.2, .9, .25, 1) both;
  max-width: 680px; margin: 0 auto;
}
@keyframes rise { from { opacity: 0; transform: translateY(14px) scale(.98); } }
.job.error { border-color: rgba(255, 92, 138, .4); }
.job-thumb {
  width: 64px; height: 84px; flex: none; border-radius: 12px; overflow: hidden;
  background: linear-gradient(135deg, rgba(38, 212, 255, .18), rgba(139, 92, 246, .18), rgba(255, 46, 126, .18));
  position: relative;
}
.job-thumb img { width: 100%; height: 100%; object-fit: cover; }
.job-thumb.loading::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(100deg, transparent 30%, rgba(255, 255, 255, .14) 50%, transparent 70%);
  animation: shimmer 1.4s infinite;
}
@keyframes shimmer { from { transform: translateX(-100%); } to { transform: translateX(100%); } }
.job-body { flex: 1; min-width: 0; }
.job-title {
  font-weight: 600; font-size: 14.5px;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.job-status { font-size: 12.5px; color: var(--muted); margin: 3px 0 0; }
.job.error .job-status { color: var(--danger); }
.result-actions { margin-top: 10px; display: flex; gap: 10px; align-items: center; }
.small-cta { height: 40px; padding: 0 18px; font-size: 14px; border-radius: 13px; }
.job-x { align-self: flex-start; width: 32px; height: 32px; border-radius: 10px; font-size: 13px; }

/* ---------- library grid ---------- */

.lib-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.lib-tools { display: flex; gap: 8px; align-items: center; }
.search {
  height: 40px; padding: 0 15px; border-radius: 13px; outline: 0;
  width: 150px; transition: width .3s ease, box-shadow .25s ease;
  font-size: 14px;
}
.search:focus { width: 210px; box-shadow: 0 0 0 1.5px rgba(38, 212, 255, .35); }
.search::placeholder { color: var(--faint); }

.grid {
  display: grid; gap: 14px;
  grid-template-columns: repeat(auto-fill, minmax(164px, 1fr));
  margin-top: 4px;
}
.card {
  border-radius: 19px; overflow: hidden;
  animation: rise .45s cubic-bezier(.2, .9, .25, 1) both;
  display: flex; flex-direction: column;
}
.card-thumb {
  aspect-ratio: 3 / 4; position: relative; overflow: hidden;
  background: linear-gradient(160deg, rgba(38, 212, 255, .16), rgba(139, 92, 246, .16) 55%, rgba(255, 46, 126, .16));
}
.card-thumb img { width: 100%; height: 100%; object-fit: cover; transition: transform .4s ease; }
.card:hover .card-thumb img { transform: scale(1.05); }
.card-thumb .ghost-glyph {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  font-size: 40px; color: rgba(255, 255, 255, .8);
}
.card-thumb::after {
  content: ""; position: absolute; inset: 40% 0 0;
  background: linear-gradient(transparent, rgba(2, 3, 10, .82));
  pointer-events: none;
}
.badge {
  position: absolute; top: 9px; font-size: 10.5px; font-weight: 700; letter-spacing: .04em;
  padding: 4px 9px; border-radius: 999px; color: #fff; z-index: 2;
  background: rgba(2, 3, 10, .55); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
  border: 1px solid rgba(255, 255, 255, .14);
}
.badge.src { left: 9px; }
.badge.dur { right: 9px; font-variant-numeric: tabular-nums; }
.card-meta { position: absolute; left: 11px; right: 11px; bottom: 9px; z-index: 2; pointer-events: none; }
.card-title {
  font-size: 13px; font-weight: 600; line-height: 1.3;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
  text-shadow: 0 1px 6px rgba(0, 0, 0, .6);
}
.card-author { font-size: 11.5px; color: rgba(255, 255, 255, .75); text-shadow: 0 1px 6px rgba(0, 0, 0, .6); }
.card-actions { display: flex; border-top: 1px solid var(--stroke-soft); }
.card-actions button, .card-actions a {
  flex: 1; height: 40px; display: flex; align-items: center; justify-content: center;
  color: var(--muted); transition: background .2s ease, color .2s ease;
  text-decoration: none;
}
.card-actions button:hover, .card-actions a:hover { background: rgba(255, 255, 255, .09); color: var(--ink); }
.card-actions svg { width: 16.5px; height: 16.5px; }
.card-actions .confirm { color: var(--danger); font-size: 12px; font-weight: 700; }

.empty { text-align: center; padding: 48px 24px; color: var(--muted); border-style: dashed; }
.empty-art { font-size: 40px; margin-bottom: 10px; }

footer { text-align: center; color: var(--faint); font-size: 12.5px; padding: 26px 16px 40px; }

/* ---------- extras drawer ---------- */

.scrim {
  position: fixed; inset: 0; z-index: 80;
  background: rgba(2, 3, 10, .5);
  backdrop-filter: blur(5px); -webkit-backdrop-filter: blur(5px);
  opacity: 0; transition: opacity .3s ease;
}
.scrim.show { opacity: 1; }
.drawer {
  position: fixed; z-index: 90;
  top: 12px; right: 12px; bottom: 12px;
  width: min(400px, calc(100vw - 24px));
  border-radius: 24px; padding: 20px 20px 24px;
  overflow-y: auto; overscroll-behavior: contain;
  transform: translateX(calc(100% + 30px));
  transition: transform .45s cubic-bezier(.2, .9, .25, 1);
  background: rgba(10, 12, 26, .72);
}
.drawer.show { transform: translateX(0); }
.drawer-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 6px; }
.drawer-head h3 { font-family: var(--font-display); font-size: 20px; letter-spacing: -.02em; }
.group { margin-top: 22px; }
.group h4 {
  font-size: 11.5px; text-transform: uppercase; letter-spacing: .12em;
  color: var(--faint); margin-bottom: 10px; font-weight: 700;
}
.row {
  display: flex; align-items: center; justify-content: space-between; gap: 14px;
  padding: 11px 0; border-bottom: 1px solid var(--stroke-soft); cursor: pointer;
}
.row.plain { cursor: default; }
.row:last-of-type { border-bottom: 0; }
.row-text b { font-size: 14px; font-weight: 600; display: block; }
.row-text small { color: var(--muted); font-size: 12px; line-height: 1.45; display: block; margin-top: 2px; }

.switch { position: relative; flex: none; }
.switch input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.switch i {
  display: block; width: 46px; height: 28px; border-radius: 99px;
  background: rgba(255, 255, 255, .12); border: 1px solid var(--stroke);
  transition: background .25s ease; position: relative;
}
.switch i::after {
  content: ""; position: absolute; top: 2.5px; left: 3px;
  width: 21px; height: 21px; border-radius: 50%; background: #fff;
  box-shadow: 0 2px 6px rgba(0, 0, 0, .4);
  transition: transform .25s cubic-bezier(.2, .9, .25, 1);
}
.switch input:checked + i { background: var(--grad); border-color: transparent; }
.switch input:checked + i::after { transform: translateX(18px); }

.hint { color: var(--muted); font-size: 13px; margin-bottom: 10px; }
.hint.tiny { font-size: 11.5px; color: var(--faint); margin-top: 10px; }
.lan-pill {
  width: 100%; text-align: center; padding: 12px; border-radius: 13px;
  background: var(--glass-strong); border: 1px solid var(--stroke);
  font-family: ui-monospace, "SF Mono", Menlo, monospace; font-size: 14px;
  color: var(--cyan); transition: background .2s ease;
  overflow-wrap: anywhere;
}
.lan-pill:hover { background: rgba(255, 255, 255, .16); }
.qr { display: flex; justify-content: center; margin-top: 12px; }
.qr img { border-radius: 14px; border: 5px solid rgba(255, 255, 255, .9); width: 168px; height: 168px; }
.about { margin-top: 26px; color: var(--faint); font-size: 11.5px; text-align: center; }

/* ---------- toasts & confetti ---------- */

.toasts {
  position: fixed; left: 50%; transform: translateX(-50%);
  bottom: calc(20px + env(safe-area-inset-bottom)); z-index: 120;
  display: flex; flex-direction: column; gap: 8px; align-items: center;
  width: max-content; max-width: calc(100vw - 32px);
}
.toast {
  padding: 12px 18px; border-radius: 14px; font-size: 13.5px; font-weight: 500;
  background: rgba(14, 16, 32, .85); border: 1px solid var(--stroke);
  backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
  box-shadow: 0 10px 30px rgba(0, 0, 0, .5);
  animation: rise .35s cubic-bezier(.2, .9, .25, 1);
  max-width: 100%;
}
.toast.error { border-color: rgba(255, 92, 138, .5); color: #ffd4e1; }
.toast.ok { border-color: rgba(60, 232, 176, .45); color: #d2ffee; }
.toast.out { opacity: 0; transform: translateY(8px); transition: all .3s ease; }

#confetti { position: fixed; inset: 0; z-index: 110; pointer-events: none; }

/* ---------- responsive ---------- */

@media (max-width: 680px) {
  .hide-s { display: none; }
  .top { width: calc(100% - 20px); top: 8px; }
  main { padding: 0 10px 30px; }
  .grabber { flex-wrap: wrap; padding: 10px; }
  .grabber .linkicon { display: none; }
  #urlInput { flex-basis: 100%; order: -1; padding: 0 8px; height: 42px; }
  #pasteBtn { margin-left: auto; }
  .cta { flex: 1; justify-content: center; }
  .grid { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; }
  .search { width: 120px; }
  .search:focus { width: 150px; }
  .drawer {
    top: auto; left: 8px; right: 8px; bottom: 8px;
    width: auto; max-height: 84dvh;
    transform: translateY(calc(100% + 30px));
    padding-bottom: calc(24px + env(safe-area-inset-bottom));
  }
  .drawer.show { transform: translateY(0); }
  .job-thumb { width: 54px; height: 72px; }
}

@media (prefers-reduced-motion: reduce) {
  .blob, .job-thumb.loading::after, .cta.busy .arrow { animation: none !important; }
  * { transition-duration: .01ms !important; animation-duration: .01ms !important; }
}
