/* ==========================================================================
   TikSave – giao diện
   ========================================================================== */

:root {
  --bg: #f2f3f5;
  --surface: #ffffff;
  --surface-2: #f3f4f6;
  --surface-3: #e8eaee;
  --border: #e4e6ea;
  --text: #111318;
  --text-2: #3f4651;
  --text-3: #5b616b;
  --primary: #111318;
  --primary-hover: #2a2e36;
  --on-primary: #ffffff;
  --accent: #ea580c;
  --accent-soft: #ffedd5;
  --accent-strong: #c2410c;
  --accent-2: #e11d48;
  --danger: #c81e1e;
  --danger-soft: #fdecec;
  --success: #15803d;
  --shadow: 0 1px 2px rgba(16, 24, 40, 0.04), 0 10px 30px rgba(16, 24, 40, 0.06);
  --shadow-lg: 0 20px 50px rgba(16, 24, 40, 0.12);
  --radius: 20px;
  --radius-md: 14px;
  --radius-sm: 10px;
  --ring: 0 0 0 3px rgba(234, 88, 12, 0.3);
  --font: 'Be Vietnam Pro', system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  color-scheme: light;
}

[data-theme='dark'] {
  --bg: #0b0d10;
  --surface: #14171c;
  --surface-2: #1a1e25;
  --surface-3: #232831;
  --border: #262b34;
  --text: #eef0f3;
  --text-2: #c2c8d0;
  --text-3: #8d949e;
  --primary: #f4f5f7;
  --primary-hover: #dcdfe4;
  --on-primary: #0b0d10;
  --accent: #fb923c;
  --accent-soft: rgba(251, 146, 60, 0.14);
  --accent-strong: #fdba74;
  --accent-2: #fb7185;
  --danger: #f87171;
  --danger-soft: rgba(248, 113, 113, 0.12);
  --success: #4ade80;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.4), 0 10px 30px rgba(0, 0, 0, 0.3);
  --shadow-lg: 0 20px 50px rgba(0, 0, 0, 0.5);
  --ring: 0 0 0 3px rgba(251, 146, 60, 0.35);
  color-scheme: dark;
}

/* ---------- Reset ---------- */
*,
*::before,
*::after {
  box-sizing: border-box;
}
html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: 84px;
}
@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;
  }
  .spinner,
  .skeleton .sk,
  .dl-btn.is-loading .dl-go .icon {
    animation: none !important;
  }
}
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
img,
video,
svg {
  display: block;
  max-width: 100%;
}
a {
  color: inherit;
}
button,
input {
  font: inherit;
  color: inherit;
}
button {
  cursor: pointer;
}
h1,
h2,
h3,
h4,
p {
  margin: 0;
}
ul,
ol {
  margin: 0;
  padding: 0;
  list-style: none;
}
[hidden] {
  display: none !important;
}
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
#dl-input:focus-visible {
  outline: none;
}

.icon {
  width: 1.15em;
  height: 1.15em;
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

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

.container {
  width: 100%;
  max-width: 992px;
  margin: 0 auto;
  padding: 0 16px;
}

.card {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

/* ---------- Header ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 40;
  background: var(--bg);
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  -webkit-backdrop-filter: saturate(160%) blur(12px);
  backdrop-filter: saturate(160%) blur(12px);
}
.header-inner {
  display: flex;
  align-items: center;
  gap: 16px;
  height: 72px;
}
.logo {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  font-weight: 800;
  font-size: 22px;
  letter-spacing: -0.03em;
  flex: none;
}
.logo-mark {
  width: 32px;
  height: 32px;
}
.logo-text span {
  background: linear-gradient(90deg, #f97316, #c2410c);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.site-nav {
  display: flex;
  gap: 4px;
  margin: 0 auto;
}
.site-nav a {
  white-space: nowrap;
  text-decoration: none;
  color: var(--text-2);
  font-size: 15px;
  font-weight: 500;
  padding: 8px 12px;
  border-radius: 10px;
  transition: background 0.15s, color 0.15s;
}
.site-nav a:hover {
  background: var(--surface);
  color: var(--text);
}
.header-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: none;
}
.icon-btn {
  display: inline-grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border: 0;
  border-radius: 12px;
  background: transparent;
  color: var(--text-2);
  transition: background 0.15s, color 0.15s;
  text-decoration: none;
}
.icon-btn:hover {
  background: var(--surface);
  color: var(--text);
}
.icon-btn .icon {
  width: 20px;
  height: 20px;
}
[data-theme='dark'] .only-light,
[data-theme='light'] .only-dark,
html:not([data-theme]) .only-dark {
  display: none;
}
.nav-toggle {
  display: none;
}

.lang {
  position: relative;
}
.lang-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 40px;
  padding: 0 12px;
  border: 0;
  border-radius: 12px;
  background: transparent;
  color: var(--text-2);
  font-size: 15px;
  font-weight: 500;
}
.lang-btn:hover {
  background: var(--surface);
  color: var(--text);
}
.lang-menu {
  position: absolute;
  right: 0;
  top: calc(100% + 6px);
  min-width: 160px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: var(--shadow-lg);
  padding: 6px;
  z-index: 50;
}
.lang-menu button {
  display: flex;
  width: 100%;
  align-items: center;
  justify-content: space-between;
  padding: 9px 12px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  text-align: left;
  font-size: 15px;
}
.lang-menu button:hover,
.lang-menu button:focus-visible {
  background: var(--surface-2);
}
.lang-menu button[aria-checked='true'] {
  font-weight: 700;
}
.lang-menu button[aria-checked='true']::after {
  content: '✓';
  color: var(--accent);
}

/* ---------- Hero ---------- */
main {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 20px;
  padding-top: 8px;
  padding-bottom: 48px;
}
.hero {
  text-align: center;
  padding: 48px 40px 36px;
  position: relative;
  overflow: hidden;
}
.hero::before {
  content: '';
  position: absolute;
  inset: -40% -10% auto;
  height: 320px;
  background: radial-gradient(closest-side, rgba(249, 115, 22, 0.10), transparent),
    radial-gradient(closest-side at 70% 50%, rgba(251, 191, 36, 0.08), transparent);
  pointer-events: none;
}
.hero > * {
  position: relative;
}
.badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--surface-3);
  color: var(--text-2);
  border-radius: 999px;
  padding: 6px 14px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}
.badge .dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.hero h1 {
  margin-top: 18px;
  font-size: clamp(32px, 6vw, 48px);
  line-height: 1.1;
  font-weight: 800;
  letter-spacing: -0.035em;
}
.hero-sub {
  margin: 12px auto 0;
  max-width: 620px;
  color: var(--text-2);
  font-size: 16.5px;
}

.dl-form {
  display: flex;
  gap: 10px;
  margin: 30px auto 0;
  max-width: 880px;
  padding: 10px;
  background: var(--surface-2);
  border-radius: 18px;
  border: 1px solid var(--border);
}
.input-wrap {
  position: relative;
  flex: 1;
  min-width: 0;
}
.input-icon {
  position: absolute;
  left: 16px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-3);
  pointer-events: none;
}
#dl-input {
  width: 100%;
  height: 52px;
  border: 1px solid transparent;
  border-radius: 12px;
  background: var(--surface-3);
  padding: 0 44px 0 46px;
  font-size: 16px;
  outline: none;
  transition: border-color 0.15s, background 0.15s, box-shadow 0.15s;
}
#dl-input::placeholder {
  color: var(--text-3);
}
#dl-input:focus {
  background: var(--surface);
  border-color: var(--accent);
  box-shadow: var(--ring);
}
.clear-btn {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--text-3);
}
.clear-btn:hover {
  background: var(--surface-2);
  color: var(--text);
}
.paste-btn {
  display: grid;
  place-items: center;
  width: 52px;
  height: 52px;
  flex: none;
  border: 0;
  border-radius: 12px;
  background: var(--accent-soft);
  color: var(--accent);
  transition: transform 0.1s, filter 0.15s;
}
.paste-btn:hover {
  filter: brightness(0.96);
}
.paste-btn:active,
.submit-btn:active {
  transform: scale(0.97);
}
.paste-btn .icon {
  width: 22px;
  height: 22px;
}
.submit-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  height: 52px;
  min-width: 140px;
  padding: 0 26px;
  border: 0;
  border-radius: 12px;
  background: var(--primary);
  color: var(--on-primary);
  font-weight: 700;
  font-size: 16px;
  transition: background 0.15s, transform 0.1s;
  flex: none;
}
.submit-btn:hover {
  background: var(--primary-hover);
}
.submit-btn:disabled {
  cursor: progress;
  opacity: 0.85;
}
.spinner {
  display: none;
  width: 18px;
  height: 18px;
  border: 2.5px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
.is-loading .spinner {
  display: inline-block;
}
@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.alert {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  max-width: 880px;
  margin: 14px auto 0;
  padding: 12px 16px;
  border-radius: 12px;
  background: var(--danger-soft);
  color: var(--danger);
  text-align: left;
  font-size: 15px;
  font-weight: 500;
}
.alert .icon {
  margin-top: 3px;
}

.chips {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px 18px;
  margin-top: 22px;
  color: var(--text-3);
  font-size: 14px;
  font-weight: 500;
}
.chips li {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.chips .icon {
  color: var(--accent);
}

/* ---------- Kết quả ---------- */
.result {
  scroll-margin-top: 8px;
}
.result-card {
  display: grid;
  grid-template-columns: 260px 1fr;
  gap: 28px;
  padding: 24px;
  animation: rise 0.35s ease both;
}
@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}
.result-media {
  min-width: 0;
}
.cover {
  position: relative;
  aspect-ratio: 3 / 4;
  border-radius: 16px;
  overflow: hidden;
  background: var(--surface-3);
}
.cover-img,
.cover-video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  background: #000;
}
.cover-video {
  object-fit: contain;
}
.cover-badge {
  position: absolute;
  left: 10px;
  bottom: 10px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.62);
  color: #fff;
  font-size: 13px;
  font-weight: 600;
}
.cover-badge .icon {
  width: 14px;
  height: 14px;
}
.cover-play {
  position: absolute;
  inset: 0;
  margin: auto;
  width: 64px;
  height: 64px;
  border: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.92);
  color: #111;
  display: grid;
  place-items: center;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
  transition: transform 0.15s;
}
.cover-play:hover {
  transform: scale(1.07);
}
.cover-play .icon {
  width: 26px;
  height: 26px;
  fill: currentColor;
  stroke: none;
  margin-left: 4px;
}
.img-missing {
  display: grid;
  place-items: center;
  color: var(--text-3);
  background: var(--surface-3);
}
img.broken {
  visibility: hidden;
}

.result-info {
  display: flex;
  flex-direction: column;
  gap: 14px;
  min-width: 0;
}
.author {
  display: flex;
  align-items: center;
  gap: 12px;
}
.avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  object-fit: cover;
  background: var(--surface-3);
  flex: none;
}
.avatar.img-missing .icon {
  width: 18px;
}
.author-text {
  display: flex;
  flex-direction: column;
  min-width: 0;
  flex: 1;
  line-height: 1.35;
}
.author-text strong {
  font-size: 16px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.author-text span {
  color: var(--text-3);
  font-size: 14px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.caption {
  color: var(--text-2);
  font-size: 15px;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  display: -webkit-box;
  -webkit-line-clamp: 4;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.stats {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 18px;
  color: var(--text-3);
  font-size: 14px;
  font-weight: 600;
}
.stats li {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.music {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text-3);
  font-size: 14px;
  min-width: 0;
}
.music span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dl-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 4px;
}
.dl-btn {
  display: flex;
  align-items: center;
  gap: 14px;
  width: 100%;
  padding: 12px 16px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  text-decoration: none;
  text-align: left;
  transition: border-color 0.15s, background 0.15s, transform 0.1s;
}
.dl-btn:hover {
  border-color: var(--text-3);
  background: var(--surface-2);
}
.dl-btn:active {
  transform: scale(0.99);
}
.dl-btn.primary {
  background: var(--primary);
  border-color: var(--primary);
  color: var(--on-primary);
}
.dl-btn.primary:hover {
  background: var(--primary-hover);
}
.dl-btn:disabled {
  cursor: progress;
  opacity: 0.8;
}
.dl-ico {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  flex: none;
  border-radius: 12px;
  background: var(--surface-3);
  color: var(--text);
}
.dl-btn.primary .dl-ico {
  background: rgba(255, 255, 255, 0.14);
  color: inherit;
}
[data-theme='dark'] .dl-btn.primary .dl-ico {
  background: rgba(0, 0, 0, 0.08);
}
.dl-btn[data-kind='mp3'] .dl-ico {
  background: var(--accent-soft);
  color: var(--accent);
}
.dl-text {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-width: 0;
  line-height: 1.35;
}
.dl-label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  font-size: 15.5px;
}
.dl-sub {
  font-size: 13px;
  opacity: 0.72;
}
.q-badge {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.04em;
  padding: 1px 7px;
  border-radius: 6px;
  background: var(--accent-strong);
  color: #fff;
}
[data-theme='dark'] .q-badge {
  color: #431407;
}
.dl-go {
  display: grid;
  place-items: center;
  opacity: 0.8;
}
.dl-btn.is-loading .dl-go .icon {
  animation: bob 0.9s ease-in-out infinite;
}
@keyframes bob {
  50% {
    transform: translateY(3px);
  }
}
.hint {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  font-size: 13.5px;
  color: var(--text-3);
}
.hint .icon {
  margin-top: 3px;
}
.btn-ghost {
  align-self: flex-start;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 14px;
  border: 0;
  border-radius: 12px;
  background: var(--surface-2);
  color: var(--text-2);
  font-weight: 600;
  font-size: 14.5px;
}
.btn-ghost:hover {
  background: var(--surface-3);
  color: var(--text);
}

/* Lưới ảnh */
.gallery-wrap {
  grid-column: 1 / -1;
}
.gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 10px;
}
.tile {
  position: relative;
  aspect-ratio: 3 / 4;
  border-radius: 12px;
  overflow: hidden;
  background: var(--surface-3);
}
.tile-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.tile-num {
  position: absolute;
  left: 8px;
  top: 8px;
  min-width: 24px;
  height: 24px;
  padding: 0 7px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.6);
  color: #fff;
  font-size: 12px;
  font-weight: 700;
}
.tile-dl {
  position: absolute;
  right: 8px;
  bottom: 8px;
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.94);
  color: #111;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.25);
  transition: transform 0.15s;
}
.tile-dl:hover {
  transform: scale(1.06);
}

/* Skeleton */
.skeleton .sk {
  border-radius: 12px;
  background: linear-gradient(90deg, var(--surface-2) 0%, var(--surface-3) 50%, var(--surface-2) 100%);
  background-size: 200% 100%;
  animation: shimmer 1.2s linear infinite;
}
.sk-cover {
  aspect-ratio: 3 / 4;
  border-radius: 16px !important;
}
.sk-line {
  height: 14px;
}
.sk-line.w40 {
  width: 40%;
}
.sk-line.w70 {
  width: 70%;
}
.sk-line.w90 {
  width: 90%;
}
.sk-btn {
  height: 62px;
  border-radius: 14px !important;
}
@keyframes shimmer {
  to {
    background-position: -200% 0;
  }
}

/* ---------- Lịch sử ---------- */
.history {
  padding: 18px 20px;
}
.history-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}
.history-head h2 {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 16px;
}
.btn-text {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 0;
  background: transparent;
  color: var(--text-3);
  font-size: 14px;
  padding: 6px 8px;
  border-radius: 8px;
}
.btn-text:hover {
  color: var(--danger);
  background: var(--danger-soft);
}
.history-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(260px, 100%), 1fr));
  gap: 8px;
}
.history-list > li {
  min-width: 0;
}
.history-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: transparent;
  text-align: left;
  font-size: 14px;
  min-width: 0;
}
.history-item:hover {
  background: var(--surface-2);
}
.history-item .icon {
  color: var(--text-3);
}
.history-title {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.history-author {
  color: var(--text-3);
  font-size: 13px;
  max-width: 40%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ---------- Thông báo ---------- */
.notice {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 14px 20px;
  border-radius: 16px;
  background: var(--surface);
  box-shadow: var(--shadow);
  color: var(--text-2);
  font-size: 14.5px;
}
.notice .icon {
  margin-top: 3px;
  color: var(--text-3);
}

/* ---------- Giới thiệu + cập nhật ---------- */
.two-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}
.panel {
  padding: 24px;
}
.panel h2 {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 17px;
  font-weight: 700;
  margin-bottom: 14px;
}
.panel p {
  color: var(--text-2);
  font-size: 15px;
}
.panel p + p {
  margin-top: 10px;
}
.updates {
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-height: 300px;
  overflow-y: auto;
  padding-right: 4px;
}
.updates li {
  display: flex;
  gap: 12px;
  padding: 12px 14px;
  border-radius: 12px;
  background: var(--surface-2);
  font-size: 14.5px;
  color: var(--text-2);
}
.updates time {
  flex: none;
  color: var(--accent-strong);
  font-weight: 600;
  font-size: 13px;
  padding-top: 1px;
  min-width: 64px;
}

/* ---------- Các section ---------- */
.section {
  margin-top: 28px;
}
.section-title {
  font-size: clamp(22px, 3.4vw, 28px);
  font-weight: 800;
  letter-spacing: -0.025em;
  text-align: center;
}
.section-lead {
  text-align: center;
  color: var(--text-3);
  margin-top: 6px;
}
.steps {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin-top: 22px;
  counter-reset: step;
}
.step {
  padding: 24px;
}
.step-num {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background: var(--primary);
  color: var(--on-primary);
  font-weight: 800;
  font-size: 18px;
  margin-bottom: 14px;
}
.step h3,
.feature h3 {
  font-size: 17px;
  font-weight: 700;
  margin-bottom: 6px;
}
.step p,
.feature p {
  color: var(--text-2);
  font-size: 15px;
}
.sub-title {
  margin-top: 28px;
  font-size: 18px;
  font-weight: 700;
  text-align: center;
}
.devices {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin-top: 16px;
}
.device {
  display: flex;
  gap: 14px;
  padding: 20px;
}
.device > .icon {
  width: 24px;
  height: 24px;
  color: var(--accent);
  margin-top: 2px;
}
.device h4 {
  font-size: 16px;
  margin-bottom: 4px;
}
.device p {
  font-size: 14.5px;
  color: var(--text-2);
}

.features {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin-top: 22px;
}
.feature {
  padding: 24px;
}
.f-ico {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 14px;
  background: var(--accent-soft);
  color: var(--accent);
  margin-bottom: 14px;
}
.f-ico .icon {
  width: 22px;
  height: 22px;
}

.faq {
  margin-top: 22px;
  padding: 8px 24px;
}
.faq details {
  border-bottom: 1px solid var(--border);
}
.faq details:last-child {
  border-bottom: 0;
}
.faq summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 0;
  font-weight: 600;
  font-size: 16px;
  cursor: pointer;
  list-style: none;
}
.faq summary::-webkit-details-marker {
  display: none;
}
.faq summary .icon {
  color: var(--text-3);
  transition: transform 0.2s;
}
.faq details[open] summary .icon {
  transform: rotate(180deg);
}
.faq details p {
  padding: 0 0 18px;
  color: var(--text-2);
  font-size: 15px;
}

/* ---------- Footer ---------- */
.site-footer {
  border-top: 1px solid var(--border);
  padding: 28px 0 calc(28px + env(safe-area-inset-bottom));
  color: var(--text-3);
  font-size: 14px;
}
.footer-inner {
  display: flex;
  flex-direction: column;
  gap: 8px;
  text-align: center;
}
.footer-brand strong {
  color: var(--text);
}
.footer-brand a {
  color: var(--text-2);
}
.footer-disclaimer {
  font-size: 13px;
  max-width: 720px;
  margin: 0 auto;
}

/* ---------- Toast ---------- */
.toast {
  position: fixed;
  left: 0;
  right: 0;
  margin-inline: auto;
  width: fit-content;
  bottom: calc(24px + env(safe-area-inset-bottom));
  transform: translateY(20px);
  max-width: calc(100% - 32px);
  text-align: center;
  padding: 12px 18px;
  border-radius: 14px;
  background: var(--primary);
  color: var(--on-primary);
  font-size: 14.5px;
  font-weight: 600;
  box-shadow: var(--shadow-lg);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s, transform 0.2s;
  z-index: 200;
}
.toast.show {
  opacity: 1;
  transform: translateY(0);
}
.toast[data-type='error'] {
  background: #b91c1c;
  color: #fff;
}

/* ---------- Trang phụ (điều khoản, 404) ---------- */
.page {
  padding: 40px;
}
.page h1 {
  font-size: clamp(26px, 4.5vw, 36px);
  font-weight: 800;
  letter-spacing: -0.03em;
}
.page .muted {
  color: var(--text-3);
  margin-top: 6px;
  font-size: 14px;
}
.page h2 {
  font-size: 20px;
  margin: 28px 0 10px;
}
.page ul {
  list-style: disc;
  padding-left: 22px;
  color: var(--text-2);
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.page .btn-primary {
  display: inline-flex;
  margin-top: 28px;
  padding: 12px 20px;
  border-radius: 12px;
  background: var(--primary);
  color: var(--on-primary);
  font-weight: 700;
  text-decoration: none;
}
.nf {
  text-align: center;
  padding: 64px 24px;
}
.nf-code {
  font-size: clamp(64px, 14vw, 110px);
  font-weight: 800;
  letter-spacing: -0.05em;
  line-height: 1;
  background: linear-gradient(90deg, #f97316, #c2410c);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.nf p {
  color: var(--text-2);
  margin-top: 10px;
}

/* ==========================================================================
   Responsive
   ========================================================================== */
@media (max-width: 880px) {
  .two-col,
  .steps,
  .devices {
    grid-template-columns: 1fr;
  }
  .features {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 860px) {
  .header-inner {
    height: 64px;
    gap: 8px;
  }
  .nav-toggle {
    display: inline-grid;
  }
  .site-nav {
    position: absolute;
    left: 16px;
    right: 16px;
    top: 64px;
    flex-direction: column;
    gap: 2px;
    padding: 8px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 16px;
    box-shadow: var(--shadow-lg);
    display: none;
  }
  .site-nav.open {
    display: flex;
  }
  .site-nav a {
    padding: 12px 14px;
  }
  .site-nav a:hover {
    background: var(--surface-2);
  }
  .header-actions {
    margin-left: auto;
  }
}

@media (max-width: 760px) {
  #lang-current {
    display: none;
  }
  .lang-btn {
    padding: 0 10px;
  }

  .hero {
    padding: 32px 16px 26px;
  }
  .hero-sub {
    font-size: 15.5px;
  }
  .dl-form {
    flex-wrap: wrap;
    padding: 8px;
    gap: 8px;
  }
  .input-wrap {
    flex-basis: 100%;
  }
  .submit-btn {
    flex: 1;
  }
  .chips {
    gap: 8px 14px;
    font-size: 13.5px;
  }

  .result-card {
    grid-template-columns: 1fr;
    gap: 18px;
    padding: 16px;
  }
  .result-card .cover {
    max-width: 300px;
    margin: 0 auto;
  }
  .result-card.is-photo .cover {
    max-width: 220px;
  }
  .gallery {
    grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
    gap: 8px;
  }
  .panel,
  .step,
  .feature {
    padding: 20px;
  }
  .faq {
    padding: 4px 18px;
  }
  .page {
    padding: 24px 18px;
  }
}

@media (max-width: 520px) {
  .features {
    grid-template-columns: 1fr;
  }
  .history-list {
    grid-template-columns: minmax(0, 1fr);
  }
  .logo {
    font-size: 20px;
  }
}

.sprite {
  position: absolute;
  width: 0;
  height: 0;
  overflow: hidden;
}
.nf-actions .btn-primary {
  display: inline-flex;
  margin-top: 24px;
  padding: 12px 20px;
  border-radius: 12px;
  background: var(--primary);
  color: var(--on-primary);
  font-weight: 700;
  text-decoration: none;
}
