/* ==========================================================================
   sinmarca — minimal downloader
   ========================================================================== */

:root {
  --bg: #05060a;
  --line: rgba(255, 255, 255, 0.09);
  --line-strong: rgba(255, 255, 255, 0.16);
  --text: #f5f7fc;
  --muted: #a2aabc;
  --muted-2: #737d92;
  --cyan: #25f4ee;
  --pink: #fe2c55;
  --violet: #8b5cf6;
  --font-body: "Inter", "Segoe UI", system-ui, -apple-system, sans-serif;
  --font-display: "Sora", "Inter", "Segoe UI", sans-serif;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --shadow-card: 0 40px 100px -50px rgba(0, 0, 0, 0.9);
}

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

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  margin: 0;
  background:
    radial-gradient(900px 520px at 50% -12%, rgba(254, 44, 85, 0.16), transparent 64%),
    radial-gradient(760px 500px at 96% 4%, rgba(37, 244, 238, 0.08), transparent 62%),
    radial-gradient(800px 600px at 4% 100%, rgba(139, 92, 246, 0.1), transparent 64%),
    var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.022) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.022) 1px, transparent 1px);
  background-size: 64px 64px;
  mask-image: radial-gradient(ellipse 85% 55% at 50% 0%, #000 8%, transparent 76%);
}

::selection {
  background: rgba(254, 44, 85, 0.4);
  color: #fff;
}

img,
svg,
video {
  display: block;
  max-width: 100%;
}

button,
input {
  font: inherit;
  color: inherit;
}

a {
  color: inherit;
}

h1,
h2,
h3,
p {
  margin: 0;
}

[hidden] {
  display: none !important;
}

:focus-visible {
  outline: 2px solid var(--cyan);
  outline-offset: 3px;
  border-radius: 4px;
}

.wrap {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 1100px;
  margin-inline: auto;
  padding-inline: 24px;
}

.sprite {
  position: absolute;
  width: 0;
  height: 0;
  overflow: hidden;
}

.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;
  top: 12px;
  left: 12px;
  z-index: 200;
  padding: 10px 16px;
  border-radius: 10px;
  background: var(--cyan);
  color: #041014;
  font-weight: 600;
  text-decoration: none;
  opacity: 0;
  pointer-events: none;
  transform: translateY(-180%);
  transition: transform 0.2s var(--ease), opacity 0.2s;
}

.skip-link:focus {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}

.grad {
  background: linear-gradient(102deg, var(--cyan) 0%, #a9f8f4 28%, #f4a3c0 68%, var(--pink) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

/* ==========================================================================
   Top bar
   ========================================================================== */

.topbar {
  position: relative;
  z-index: 5;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  background: rgba(5, 6, 10, 0.5);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}

.topbar-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 66px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 10px;
  color: #07080d;
  background: linear-gradient(135deg, var(--cyan), #7b8cff 52%, var(--pink));
  box-shadow:
    0 8px 20px -10px rgba(37, 244, 238, 0.5),
    inset 0 1px 0 rgba(255, 255, 255, 0.4);
}

.brand-mark svg {
  width: 19px;
  height: 19px;
}

.brand-word {
  font-family: var(--font-display);
  font-size: 1.18rem;
  font-weight: 700;
  letter-spacing: -0.04em;
}

.brand-word span {
  color: var(--pink);
}

.header-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 6px 11px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.03);
  color: #cbd4e4;
  font-size: 0.72rem;
  font-weight: 500;
  letter-spacing: 0.02em;
}

.pulse {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--cyan);
  box-shadow: 0 0 0 0 rgba(37, 244, 238, 0.5);
  animation: pulse 2.6s var(--ease) infinite;
}

/* ==========================================================================
   Hero + form
   ========================================================================== */

main {
  display: flex;
  flex: 1;
  flex-direction: column;
  justify-content: center;
  width: 100%;
}

.hero {
  max-width: 780px;
  margin-inline: auto;
  padding: clamp(38px, 6vw, 66px) 0 0;
  text-align: center;
}

.hero h1 {
  font-family: var(--font-display);
  font-size: clamp(2.15rem, 4.6vw, 3.45rem);
  font-weight: 700;
  letter-spacing: -0.048em;
  line-height: 1.04;
}

.lede {
  max-width: 560px;
  margin: 16px auto 0;
  color: var(--muted);
  font-size: 0.98rem;
  line-height: 1.6;
}

.download-form {
  display: flex;
  gap: 8px;
  max-width: 700px;
  margin: 28px auto 0;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: linear-gradient(160deg, rgba(20, 24, 35, 0.94), rgba(10, 12, 19, 0.94));
  box-shadow:
    0 30px 70px -45px rgba(0, 0, 0, 0.95),
    inset 0 1px 0 rgba(255, 255, 255, 0.05);
  backdrop-filter: blur(14px);
  transition: border-color 0.25s, box-shadow 0.25s;
}

.download-form:focus-within {
  border-color: rgba(37, 244, 238, 0.42);
  box-shadow:
    0 0 0 4px rgba(37, 244, 238, 0.07),
    0 30px 70px -45px rgba(0, 0, 0, 0.95),
    inset 0 1px 0 rgba(255, 255, 255, 0.06);
}

.field {
  display: flex;
  flex: 1;
  align-items: center;
  gap: 10px;
  min-width: 0;
  padding-left: 10px;
}

.field-icon {
  flex: none;
  width: 18px;
  height: 18px;
  color: var(--muted-2);
}

.field input {
  width: 100%;
  min-width: 0;
  height: 50px;
  border: 0;
  background: transparent;
  color: var(--text);
  font-size: 0.94rem;
  outline: none;
}

.field input::placeholder {
  color: #6c7688;
  opacity: 1;
}

.field input:-webkit-autofill {
  -webkit-text-fill-color: var(--text);
  box-shadow: 0 0 0 1000px #0d1018 inset;
}

.paste-btn {
  display: inline-flex;
  flex: none;
  align-items: center;
  gap: 6px;
  padding: 7px 11px;
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.055);
  color: #d4dbe9;
  font-size: 0.76rem;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.2s, border-color 0.2s, color 0.2s;
}

.paste-btn svg {
  width: 14px;
  height: 14px;
}

.paste-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.18);
  color: #fff;
}

.btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  border: 0;
  border-radius: 13px;
  background: linear-gradient(118deg, #fe2c55 0%, #ff4869 52%, #ff6a5e 100%);
  color: #fff;
  font-family: var(--font-display);
  font-size: 0.94rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  text-decoration: none;
  cursor: pointer;
  box-shadow:
    0 14px 34px -14px rgba(254, 44, 85, 0.7),
    inset 0 1px 0 rgba(255, 255, 255, 0.22);
  transition: transform 0.2s var(--ease), filter 0.2s, box-shadow 0.2s;
}

.btn-primary:hover {
  transform: translateY(-1px);
  filter: brightness(1.06);
}

.btn-primary:active {
  transform: translateY(0);
}

.submit-btn {
  flex: none;
  height: 50px;
  padding: 0 22px;
}

.submit-btn .btn-arrow {
  width: 17px;
  height: 17px;
  transition: transform 0.2s;
}

.submit-btn:hover .btn-arrow {
  transform: translateX(2px);
}

.spinner {
  display: none;
  width: 15px;
  height: 15px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

.download-form.is-loading .spinner {
  display: block;
}

.download-form.is-loading .btn-arrow {
  display: none;
}

.download-form.is-loading .submit-btn {
  pointer-events: none;
  filter: saturate(0.8);
}

.form-hint {
  margin-top: 12px;
  color: var(--muted-2);
  font-size: 0.75rem;
  line-height: 1.5;
}

.form-error {
  max-width: 700px;
  margin: 12px auto 0;
  padding: 10px 13px;
  border: 1px solid rgba(254, 44, 85, 0.23);
  border-radius: 10px;
  background: rgba(254, 44, 85, 0.08);
  color: #ff9db1;
  font-size: 0.82rem;
  line-height: 1.45;
  text-align: left;
}

/* ==========================================================================
   Result section
   ========================================================================== */

.result-section {
  padding: clamp(30px, 5vw, 46px) 0 0;
  scroll-margin-top: 20px;
}

.loading-card,
.error-card {
  display: flex;
  align-items: center;
  gap: 20px;
  max-width: 760px;
  margin: 0 auto;
  padding: 22px 26px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: linear-gradient(155deg, rgba(255, 255, 255, 0.06), rgba(255, 255, 255, 0.02));
  box-shadow: var(--shadow-card);
  overflow: hidden;
}

.loading-card {
  position: relative;
}

.loading-card::after {
  content: "";
  position: absolute;
  bottom: 0;
  left: 0;
  width: 38%;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--cyan), var(--pink), transparent);
  animation: scan 1.8s linear infinite;
}

.loader {
  display: flex;
  flex: none;
  align-items: flex-end;
  justify-content: center;
  gap: 3px;
  width: 50px;
  height: 50px;
  padding: 12px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 14px;
  background: linear-gradient(150deg, rgba(37, 244, 238, 0.15), rgba(254, 44, 85, 0.14));
}

.loader span {
  width: 4px;
  border-radius: 3px;
  background: linear-gradient(180deg, var(--cyan), var(--pink));
  animation: equalize 0.9s ease-in-out infinite;
}

.loader span:nth-child(1) {
  height: 12px;
  animation-delay: -0.2s;
}

.loader span:nth-child(2) {
  height: 22px;
  animation-delay: -0.45s;
}

.loader span:nth-child(3) {
  height: 16px;
  animation-delay: -0.1s;
}

.loading-copy h2 {
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.loading-copy p {
  margin-top: 4px;
  color: var(--muted);
  font-size: 0.83rem;
}

.error-card {
  border-color: rgba(254, 44, 85, 0.24);
  background: linear-gradient(155deg, rgba(254, 44, 85, 0.1), rgba(255, 255, 255, 0.02));
}

.error-icon {
  display: grid;
  flex: none;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: rgba(254, 44, 85, 0.14);
  color: #ff8098;
}

.error-icon svg {
  width: 21px;
  height: 21px;
}

.error-copy h2 {
  font-family: var(--font-display);
  font-size: 0.98rem;
  font-weight: 600;
}

.error-copy p {
  margin-top: 4px;
  color: #d7aab4;
  font-size: 0.84rem;
  line-height: 1.5;
}

.btn-ghost {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex: none;
  margin-left: auto;
  padding: 9px 14px;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.05);
  color: var(--text);
  font-size: 0.82rem;
  font-weight: 500;
  white-space: nowrap;
  cursor: pointer;
  transition: background 0.2s, border-color 0.2s;
}

.btn-ghost svg {
  width: 14px;
  height: 14px;
}

.btn-ghost:hover {
  background: rgba(255, 255, 255, 0.09);
  border-color: rgba(255, 255, 255, 0.24);
}

/* --- Result card --- */

.result-card {
  position: relative;
  display: grid;
  grid-template-columns: 276px minmax(0, 1fr);
  gap: clamp(22px, 3.4vw, 36px);
  max-width: 980px;
  margin: 0 auto;
  padding: clamp(18px, 2.6vw, 28px);
  border: 1px solid var(--line);
  border-radius: 26px;
  background: linear-gradient(155deg, rgba(255, 255, 255, 0.065), rgba(255, 255, 255, 0.018) 62%);
  box-shadow: var(--shadow-card);
  overflow: hidden;
  animation: rise 0.45s var(--ease) both;
}

.result-card::before {
  content: "";
  position: absolute;
  top: -180px;
  right: -100px;
  width: 400px;
  height: 360px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(139, 92, 246, 0.16), transparent 68%);
  pointer-events: none;
}

.result-preview {
  position: relative;
  min-width: 0;
}

.preview-stage {
  position: relative;
  aspect-ratio: 9 / 16;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 18px;
  background: #000;
}

.preview-stage video {
  position: relative;
  z-index: 1;
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #000;
}

.preview-poster-bg {
  position: absolute;
  inset: -24px;
  z-index: 2;
  width: calc(100% + 48px);
  height: calc(100% + 48px);
  object-fit: cover;
  filter: blur(32px) brightness(0.28) saturate(1.15);
  pointer-events: none;
}

.preview-poster {
  position: absolute;
  inset: 0;
  z-index: 4;
  width: 100%;
  height: 100%;
  object-fit: contain;
  pointer-events: none;
}

.preview-skeleton {
  position: absolute;
  inset: 0;
  z-index: 3;
  background:
    linear-gradient(110deg, transparent 25%, rgba(255, 255, 255, 0.055) 37%, transparent 50%) 0 0 / 220% 100%,
    linear-gradient(160deg, #171029, #2a1126 55%, #10121c);
  animation: shimmer 1.6s linear infinite;
}

.preview-play {
  position: absolute;
  top: 50%;
  left: 50%;
  z-index: 5;
  display: grid;
  place-items: center;
  width: 58px;
  height: 58px;
  border: 1px solid rgba(255, 255, 255, 0.34);
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.14);
  color: #fff;
  backdrop-filter: blur(10px);
  transform: translate(-50%, -50%);
  cursor: pointer;
  transition: transform 0.2s var(--ease), background 0.2s, opacity 0.2s;
}

.preview-play svg {
  width: 23px;
  height: 23px;
  margin-left: 3px;
}

.preview-play:hover {
  background: rgba(255, 255, 255, 0.24);
  transform: translate(-50%, -50%) scale(1.05);
}

.preview-play.is-hidden {
  visibility: hidden;
  opacity: 0;
  pointer-events: none;
}

.quality-chip,
.resolution-chip {
  position: absolute;
  z-index: 6;
  padding: 5px 8px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 7px;
  background: rgba(5, 6, 10, 0.68);
  color: var(--cyan);
  font-size: 0.64rem;
  font-weight: 600;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  backdrop-filter: blur(10px);
}

.quality-chip {
  top: 10px;
  left: 10px;
}

.resolution-chip {
  top: 10px;
  right: 10px;
  color: #e3e9f5;
  letter-spacing: 0.02em;
  text-transform: none;
}

.preview-note {
  margin-top: 9px;
  color: var(--muted-2);
  font-size: 0.68rem;
  line-height: 1.45;
  text-align: center;
}

.image-gallery {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.gallery-item {
  position: relative;
  aspect-ratio: 3 / 4;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #11131c;
}

.gallery-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.35s var(--ease);
}

.gallery-item:hover img {
  transform: scale(1.045);
}

.gallery-num {
  position: absolute;
  top: 7px;
  left: 7px;
  padding: 2px 6px;
  border-radius: 5px;
  background: rgba(5, 6, 10, 0.7);
  color: #fff;
  font-size: 0.62rem;
  font-weight: 600;
  backdrop-filter: blur(6px);
}

.gallery-dl {
  position: absolute;
  right: 7px;
  bottom: 7px;
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 8px;
  background: rgba(5, 6, 10, 0.68);
  color: #fff;
  backdrop-filter: blur(6px);
}

.gallery-dl svg {
  width: 14px;
  height: 14px;
}

/* --- Result info --- */

.result-info {
  display: flex;
  flex-direction: column;
  min-width: 0;
  padding: 3px 0;
}

.result-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.result-kicker {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: #a8f5f2;
  font-size: 0.68rem;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.kicker-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--cyan);
  box-shadow: 0 0 10px rgba(37, 244, 238, 0.7);
}

.result-kind {
  padding: 4px 8px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.035);
  color: var(--muted);
  font-size: 0.62rem;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.author {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 16px;
}

.avatar-wrap {
  position: relative;
  flex: none;
  width: 46px;
  height: 46px;
  overflow: hidden;
  border: 1px solid var(--line-strong);
  border-radius: 50%;
  background: #171a24;
}

.avatar-wrap img {
  position: relative;
  z-index: 1;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.avatar-wrap img.is-broken {
  display: none;
}

.avatar-fallback {
  position: absolute;
  inset: 0;
  z-index: 0;
  display: grid;
  place-items: center;
  background: linear-gradient(140deg, #1f3b45, #2b163c 55%, #401523);
  color: #dfe9f5;
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 600;
  text-transform: uppercase;
}

.author-copy {
  min-width: 0;
}

.author-name {
  overflow: hidden;
  font-family: var(--font-display);
  font-size: 0.96rem;
  font-weight: 600;
  letter-spacing: -0.015em;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.author-handle {
  margin-top: 2px;
  overflow: hidden;
  color: var(--muted);
  font-size: 0.79rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.icon-link {
  display: grid;
  flex: none;
  place-items: center;
  width: 34px;
  height: 34px;
  margin-left: auto;
  border: 1px solid var(--line);
  border-radius: 50%;
  color: var(--muted);
  transition: background 0.2s, color 0.2s, border-color 0.2s;
}

.icon-link svg {
  width: 15px;
  height: 15px;
}

.icon-link:hover {
  border-color: var(--line-strong);
  background: rgba(255, 255, 255, 0.06);
  color: #fff;
}

.caption {
  display: -webkit-box;
  margin-top: 14px;
  overflow: hidden;
  color: #c9d1e0;
  font-size: 0.89rem;
  line-height: 1.55;
  overflow-wrap: anywhere;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
  line-clamp: 3;
}

.caption.is-expanded {
  display: block;
  overflow: visible;
  -webkit-line-clamp: unset;
  line-clamp: unset;
}

.caption .token {
  color: #9fe9f2;
}

.caption-toggle {
  align-self: flex-start;
  margin-top: 4px;
  padding: 0;
  border: 0;
  background: none;
  color: var(--cyan);
  font-size: 0.74rem;
  font-weight: 500;
  cursor: pointer;
}

.caption-toggle:hover {
  text-decoration: underline;
}

.meta {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-top: 14px;
}

.meta-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 9px;
  border: 1px solid rgba(255, 255, 255, 0.07);
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.04);
  color: var(--muted);
  font-size: 0.7rem;
  font-weight: 500;
}

.meta-chip svg {
  width: 12px;
  height: 12px;
  color: var(--muted-2);
}

.actions {
  display: flex;
  flex-direction: column;
  gap: 9px;
  margin-top: 22px;
}

.btn-download {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 11px 14px;
  overflow: hidden;
  border-radius: 14px;
  color: #fff;
  text-align: left;
  text-decoration: none;
}

.btn-download::after {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  left: -70%;
  width: 46%;
  background: linear-gradient(100deg, transparent, rgba(255, 255, 255, 0.2), transparent);
  transform: skewX(-18deg);
  transition: left 0.55s var(--ease);
}

.btn-download:hover::after {
  left: 120%;
}

.download-icon {
  display: grid;
  flex: none;
  place-items: center;
  width: 39px;
  height: 39px;
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.17);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.14);
}

.download-icon svg {
  width: 18px;
  height: 18px;
}

.download-copy {
  flex: 1;
  min-width: 0;
}

.download-copy strong {
  display: block;
  font-family: var(--font-display);
  font-size: 0.93rem;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.download-copy small {
  display: block;
  margin-top: 1px;
  color: rgba(255, 255, 255, 0.8);
  font-size: 0.68rem;
}

.download-arrow {
  flex: none;
  width: 17px;
  height: 17px;
  opacity: 0.8;
}

.action-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 9px;
}

.btn-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.04);
  color: #dfe6f3;
  font-size: 0.78rem;
  font-weight: 500;
  text-decoration: none;
  transition: background 0.2s, border-color 0.2s, transform 0.2s;
}

.btn-secondary svg {
  width: 14px;
  height: 14px;
  color: var(--muted);
}

.btn-secondary:hover {
  border-color: var(--line-strong);
  background: rgba(255, 255, 255, 0.075);
  transform: translateY(-1px);
}

.compat-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border: 1px dashed rgba(255, 255, 255, 0.16);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.02);
  color: #cfd8e7;
  text-decoration: none;
  transition: background 0.2s, border-color 0.2s;
}

.compat-link:hover {
  border-color: rgba(37, 244, 238, 0.35);
  background: rgba(37, 244, 238, 0.045);
}

.compat-icon {
  display: grid;
  flex: none;
  place-items: center;
  width: 27px;
  height: 27px;
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.055);
  color: var(--muted);
}

.compat-icon svg {
  width: 13px;
  height: 13px;
}

.compat-copy {
  flex: 1;
  min-width: 0;
}

.compat-copy strong {
  display: block;
  font-family: var(--font-display);
  font-size: 0.74rem;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.compat-copy small {
  display: block;
  margin-top: 1px;
  color: var(--muted-2);
  font-size: 0.65rem;
}

.compat-arrow {
  flex: none;
  width: 14px;
  height: 14px;
  color: var(--muted-2);
}

.result-footer {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  margin-top: 16px;
}

.text-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 0;
  border: 0;
  background: none;
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 500;
  cursor: pointer;
  transition: color 0.2s;
}

.text-btn svg {
  width: 14px;
  height: 14px;
}

.text-btn:hover {
  color: #fff;
}

.result-note {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: auto;
  padding-top: 14px;
  color: var(--muted-2);
  font-size: 0.68rem;
}

.result-note svg {
  flex: none;
  width: 12px;
  height: 12px;
  color: rgba(37, 244, 238, 0.7);
}

/* --- Photo carousel --- */

.result-card.is-photo {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.result-card.is-photo .result-info {
  display: contents;
}

.result-card.is-photo .result-head {
  order: 1;
}

.result-card.is-photo .author {
  order: 2;
  margin-top: 4px;
}

.result-card.is-photo .caption {
  order: 3;
  margin-top: 0;
}

.result-card.is-photo .caption-toggle {
  order: 4;
}

.result-card.is-photo .meta {
  order: 5;
  margin-top: 0;
}

.result-card.is-photo .result-preview {
  order: 6;
  width: 100%;
  max-width: none;
  margin: 0;
}

.result-card.is-photo .actions {
  order: 7;
  max-width: 600px;
  margin-top: 2px;
}

.result-card.is-photo .result-footer {
  order: 8;
  margin-top: 0;
}

.result-card.is-photo .result-note {
  order: 9;
  margin-top: 0;
}

.result-card.is-photo .image-gallery {
  grid-template-columns: repeat(auto-fill, minmax(145px, 1fr));
  gap: 10px;
}

.result-card.is-photo .preview-note {
  margin-top: 8px;
  text-align: left;
}

/* ==========================================================================
   Footer + toast
   ========================================================================== */

.legal {
  position: relative;
  z-index: 1;
  max-width: 1100px;
  margin: 48px auto 0;
  padding: 18px 24px 26px;
  border-top: 1px solid rgba(255, 255, 255, 0.05);
  color: #5e687b;
  font-size: 0.68rem;
  line-height: 1.6;
  text-align: center;
}

.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  z-index: 150;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 11px 16px;
  border: 1px solid rgba(255, 255, 255, 0.13);
  border-radius: 11px;
  background: #12151f;
  box-shadow: 0 20px 50px -20px rgba(0, 0, 0, 0.9);
  color: #e8edf7;
  font-size: 0.81rem;
  opacity: 0;
  pointer-events: none;
  transform: translateX(-50%) translateY(16px);
  transition: opacity 0.25s, transform 0.25s var(--ease);
}

.toast svg {
  width: 16px;
  height: 16px;
  color: var(--cyan);
}

.toast.is-visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ==========================================================================
   Animations
   ========================================================================== */

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(14px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes pulse {
  0% {
    box-shadow: 0 0 0 0 rgba(37, 244, 238, 0.45);
  }
  70% {
    box-shadow: 0 0 0 8px rgba(37, 244, 238, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(37, 244, 238, 0);
  }
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

@keyframes equalize {
  0%,
  100% {
    transform: scaleY(0.55);
  }
  50% {
    transform: scaleY(1);
  }
}

@keyframes shimmer {
  to {
    background-position: -220% 0, 0 0;
  }
}

@keyframes scan {
  from {
    transform: translateX(-100%);
  }
  to {
    transform: translateX(350%);
  }
}

/* ==========================================================================
   iPhone shortcut guide
   ========================================================================== */

.legal a {
  color: #9fe9f2;
  text-decoration: none;
  border-bottom: 1px solid rgba(159, 233, 242, 0.3);
}

.legal a:hover {
  border-bottom-color: #9fe9f2;
}

.guide {
  max-width: 840px;
  padding-top: clamp(32px, 5vw, 52px);
}

.guide-back {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--muted);
  font-size: 0.78rem;
  text-decoration: none;
}

.guide-back:hover {
  color: #fff;
}

.guide-kicker {
  margin-top: 26px;
  color: var(--cyan);
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.guide h1 {
  margin-top: 10px;
  font-family: var(--font-display);
  font-size: clamp(1.9rem, 4.4vw, 3rem);
  font-weight: 700;
  letter-spacing: -0.045em;
  line-height: 1.06;
}

.guide .lede {
  margin: 14px 0 0;
  text-align: left;
}

.guide-flow {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-top: 24px;
  padding: 13px 15px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.03);
  color: #d6deec;
  font-size: 0.78rem;
}

.guide-flow span {
  padding: 4px 8px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.035);
}

.guide-flow b {
  color: var(--muted-2);
  font-weight: 400;
}

.guide-step {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr);
  gap: 18px;
  padding: 24px 0;
  border-top: 1px solid rgba(255, 255, 255, 0.07);
}

.guide-step:first-of-type {
  margin-top: 28px;
  border-top: 0;
}

.step-number {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border: 1px solid rgba(37, 244, 238, 0.2);
  border-radius: 9px;
  background: rgba(37, 244, 238, 0.07);
  color: var(--cyan);
  font-family: var(--font-display);
  font-size: 0.82rem;
  font-weight: 600;
}

.guide-step > div {
  min-width: 0;
}

.guide-step h2 {
  font-family: var(--font-display);
  font-size: 1.02rem;
  font-weight: 600;
  letter-spacing: -0.015em;
}

.guide-step p {
  margin-top: 8px;
  color: var(--muted);
  font-size: 0.86rem;
  line-height: 1.62;
}

.guide-step ol {
  margin-top: 10px;
  padding-left: 20px;
  list-style: decimal;
  color: var(--muted);
  font-size: 0.86rem;
  line-height: 1.65;
}

.guide-step li {
  margin-top: 6px;
  padding-left: 3px;
}

.guide-step li::marker {
  color: var(--muted-2);
}

.guide-step strong {
  color: #e6ecf7;
  font-weight: 500;
}

.action {
  display: inline-block;
  padding: 1px 6px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 5px;
  background: rgba(255, 255, 255, 0.045);
  color: #dbe4f3;
  font-family: var(--font-body);
  font-size: 0.78em;
  line-height: 1.4;
  white-space: normal;
}

.guide-note {
  margin-top: 14px;
  padding: 12px 14px;
  border: 1px solid rgba(254, 44, 85, 0.18);
  border-radius: 10px;
  background: rgba(254, 44, 85, 0.05);
  color: #d7aab4;
  font-size: 0.8rem;
  line-height: 1.55;
}

.guide-note strong {
  color: #ffd5dd;
}

.guide-code {
  display: block;
  margin-top: 10px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.24);
  color: #cfe9f1;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.72rem;
  line-height: 1.55;
  overflow-wrap: anywhere;
}

.guide-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 32px 0 0;
}

.guide-actions a {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 11px 15px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.04);
  color: #e1e8f5;
  font-size: 0.82rem;
  font-weight: 500;
  text-decoration: none;
}

.guide-actions a:hover {
  border-color: var(--line-strong);
  background: rgba(255, 255, 255, 0.075);
}

.guide-actions a.primary {
  border: 0;
  background: linear-gradient(118deg, #fe2c55, #ff6a5e);
  color: #fff;
}

.guide-actions svg {
  width: 15px;
  height: 15px;
}

/* ==========================================================================
   Responsive
   ========================================================================== */

@media (max-width: 900px) {
  .result-card {
    grid-template-columns: 250px minmax(0, 1fr);
  }
}

@media (max-width: 820px) {
  .result-card {
    grid-template-columns: minmax(0, 1fr);
  }

  .result-preview {
    width: 100%;
    max-width: 320px;
    margin: 0 auto;
  }

  .result-info {
    padding: 0 2px 4px;
  }

  .actions {
    margin-top: 20px;
  }
}

@media (max-width: 640px) {
  .wrap {
    padding-inline: 18px;
  }

  .topbar-inner {
    height: 60px;
  }

  .hero {
    padding-top: 36px;
  }

  .hero h1 {
    font-size: clamp(2rem, 10vw, 2.7rem);
  }

  .lede {
    font-size: 0.92rem;
  }

  .download-form {
    flex-direction: column;
    padding: 7px;
    border-radius: 16px;
  }

  .field {
    padding: 0 4px 0 8px;
  }

  .field input {
    height: 46px;
    font-size: 0.9rem;
  }

  .submit-btn {
    width: 100%;
    height: 48px;
  }

  .paste-btn {
    padding: 8px 10px;
    font-size: 0;
    gap: 0;
  }

  .paste-btn svg {
    width: 16px;
    height: 16px;
  }

  .form-hint {
    font-size: 0.7rem;
  }

  .result-section {
    padding-top: 26px;
  }

  .result-card {
    padding: 14px;
    border-radius: 21px;
  }

  .result-preview {
    max-width: 300px;
  }

  .preview-stage {
    border-radius: 15px;
  }

  .result-info {
    padding: 0 4px 6px;
  }

  .caption {
    font-size: 0.86rem;
  }

  .btn-download {
    padding: 11px 12px;
  }

  .download-icon {
    width: 36px;
    height: 36px;
  }

  .action-row {
    grid-template-columns: minmax(0, 1fr);
  }

  .loading-card,
  .error-card {
    flex-wrap: wrap;
    padding: 19px;
  }

  .error-card .btn-ghost {
    width: 100%;
    margin-left: 0;
    justify-content: center;
  }

  .result-card.is-photo .result-info {
    display: contents;
  }

  .result-card.is-photo .image-gallery {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .legal {
    margin-top: 36px;
    padding-bottom: 22px;
  }

  .guide {
    padding-top: 30px;
  }

  .guide-step {
    grid-template-columns: 34px minmax(0, 1fr);
    gap: 12px;
    padding: 20px 0;
  }

  .step-number {
    width: 30px;
    height: 30px;
    font-size: 0.76rem;
  }

  .guide-step h2 {
    font-size: 0.97rem;
  }

  .guide-step ol,
  .guide-step p {
    font-size: 0.82rem;
  }

  .toast {
    right: 16px;
    bottom: 16px;
    left: 16px;
    justify-content: center;
    transform: translateY(16px);
  }

  .toast.is-visible {
    transform: translateY(0);
  }
}

@media (max-width: 380px) {
  .brand-word {
    font-size: 1.08rem;
  }

  .header-pill {
    padding: 5px 9px;
    font-size: 0.66rem;
  }

  .field-icon {
    display: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
