/* ===== Nền tảng ===== */
*,
*::before,
*::after { box-sizing: border-box; }

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

body {
  margin: 0;
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.55;
  color: var(--text);
  background: var(--bg);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
}

main { flex: 1; }

a { color: inherit; }

img, svg { display: block; }

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

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

.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;
}

:focus-visible { outline: 3px solid color-mix(in srgb, var(--brand) 55%, transparent); outline-offset: 2px; }

/* ===== Header ===== */
.site-header {
  position: sticky; top: 0; z-index: 40;
  background: color-mix(in srgb, var(--surface) 82%, transparent);
  backdrop-filter: saturate(160%) blur(14px);
  -webkit-backdrop-filter: saturate(160%) blur(14px);
  border-bottom: 1px solid var(--border);
}
.site-header__inner {
  display: flex; align-items: center; gap: 16px; height: 64px;
}
.brand {
  display: flex; align-items: center; gap: 10px; text-decoration: none; flex-shrink: 0;
}
.brand__logo { height: 38px; width: auto; }
.brand__divider { width: 1px; height: 26px; background: var(--border); }
.brand__text { display: flex; flex-direction: column; line-height: 1.1; }
.brand__name { font-weight: 800; letter-spacing: 0.04em; font-size: 15px; }
.brand__name span { color: var(--brand-text); }
.brand__sub { font-size: 11px; line-height: 1.25; color: var(--text-muted); letter-spacing: 0.02em; font-weight: 600; }
.site-footer__brand img { height: 32px; width: auto; margin-bottom: 6px; }

.nav { display: flex; gap: 4px; margin-left: 16px; align-items: center; }
.nav a, .nav__tools {
  text-decoration: none; padding: 8px 12px; border-radius: 999px;
  color: var(--text-muted); font-weight: 600; font-size: 14px; white-space: nowrap;
  transition: background 0.15s, color 0.15s;
}
.nav a:hover { color: var(--text); background: var(--surface-2); }
.nav a[aria-current="page"] { color: var(--brand-text); background: var(--brand-soft); }

.header-actions { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.theme-toggle svg { width: 18px; height: 18px; color: var(--brand-text); }

@media (max-width: 720px) {
  .brand__sub, .brand__divider { display: none; }
  .brand__logo { height: 28px; }
  .header-actions .header-cta { display: none; }
}

/* ===== Nút bấm ===== */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: 1px solid var(--border); background: var(--surface); color: var(--text);
  padding: 9px 14px; border-radius: 999px; font-weight: 600; font-size: 14px;
  cursor: pointer; text-decoration: none; white-space: nowrap;
  transition: background 0.15s, border-color 0.15s, transform 0.1s, box-shadow 0.15s;
}
.btn:hover { background: var(--surface-2); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn svg { width: 18px; height: 18px; flex-shrink: 0; }

.btn--primary {
  background: var(--brand-gradient); border-color: transparent; color: var(--on-brand); font-weight: 700;
  box-shadow: 0 6px 18px color-mix(in srgb, var(--brand) 32%, transparent);
}
.btn--primary:hover { background: var(--brand-gradient); filter: brightness(1.06) saturate(1.1); box-shadow: 0 8px 24px color-mix(in srgb, var(--brand) 42%, transparent); }

.btn--dark { background: var(--ink); border-color: var(--ink); color: #fff; }
.btn--dark:hover { background: var(--ink-soft); }
:root[data-theme="dark"] .btn--dark { border-color: var(--border); }

.btn--ghost { background: transparent; border-color: transparent; }
.btn--ghost:hover { background: var(--surface-2); }

.btn--sm { padding: 6px 10px; font-size: 13px; }
.btn--sm svg { width: 16px; height: 16px; }
.btn--lg { padding: 13px 22px; font-size: 16px; }

.icon-btn {
  width: 40px; height: 40px; padding: 0; border-radius: 999px;
}

/* ===== Card ===== */
.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow);
}

/* ===== Footer ===== */
.site-footer {
  margin-top: 48px; background: var(--ink); color: #c9d1e6;
}
.site-footer__inner {
  display: flex; flex-wrap: wrap; gap: 12px 24px; align-items: center; justify-content: space-between;
  padding-top: 24px; padding-bottom: 24px; font-size: 14px;
}
.site-footer a { color: #fff; text-decoration: none; font-weight: 600; }
.site-footer a:hover { color: var(--brand-green); }
.site-footer .brand__name { color: #fff; }
.site-footer__bar { height: 4px; background: linear-gradient(90deg, var(--brand-green), var(--brand-blue)); }

/* ===== Trang chủ ===== */
.hero {
  position: relative; overflow: hidden;
  background:
    radial-gradient(600px 300px at 85% 10%, color-mix(in srgb, var(--brand-blue) 45%, transparent), transparent 70%),
    radial-gradient(500px 260px at 0% 100%, color-mix(in srgb, var(--brand-green) 28%, transparent), transparent 70%),
    var(--ink);
  color: #fff;
}
.hero__inner { padding-top: 64px; padding-bottom: 72px; max-width: 760px; }
.eyebrow {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 6px 12px; border-radius: 999px; font-size: 13px; font-weight: 600;
  background: rgba(255, 255, 255, 0.1); border: 1px solid rgba(255, 255, 255, 0.18);
}
.eyebrow::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--brand-green); }
.hero h1 {
  font-size: clamp(30px, 5vw, 52px); line-height: 1.12; margin: 18px 0 14px; letter-spacing: -0.02em;
}
.hero h1 em { font-style: normal; background: linear-gradient(90deg, var(--brand-green), #33b8f5); -webkit-background-clip: text; background-clip: text; color: transparent; }
.hero p { font-size: 17px; color: #c9d1e6; margin: 0 0 28px; max-width: 600px; }
.hero__actions { display: flex; flex-wrap: wrap; gap: 12px; }
.hero .btn:not(.btn--primary) { background: rgba(255, 255, 255, 0.08); border-color: rgba(255, 255, 255, 0.2); color: #fff; }
.hero .btn:not(.btn--primary):hover { background: rgba(255, 255, 255, 0.16); }

.section { padding-top: 48px; }
.section__head { display: flex; align-items: end; justify-content: space-between; gap: 16px; margin-bottom: 20px; }
.section h2 { font-size: 24px; margin: 0; letter-spacing: -0.01em; }
.section__desc { color: var(--text-muted); margin: 4px 0 0; }

.tool-grid {
  display: grid; gap: 16px;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
}
.tool-card {
  position: relative; display: flex; flex-direction: column; gap: 10px;
  padding: 22px; text-decoration: none; color: inherit;
  transition: transform 0.18s, box-shadow 0.18s, border-color 0.18s;
}
a.tool-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); border-color: color-mix(in srgb, var(--brand) 45%, var(--border)); }
.tool-card__icon {
  width: 48px; height: 48px; border-radius: 14px; display: grid; place-items: center;
  background: var(--brand-soft); color: var(--brand-text);
}
.tool-card__icon svg { width: 26px; height: 26px; }
.tool-card h3 { margin: 4px 0 0; font-size: 18px; }
.tool-card p { margin: 0; color: var(--text-muted); font-size: 14px; }
.tool-card__cta { margin-top: auto; padding-top: 6px; color: var(--brand-text); font-weight: 700; font-size: 14px; }
.tool-card--soon { opacity: 0.72; }
.tool-card--soon .tool-card__icon { background: var(--surface-2); color: var(--text-muted); }
.badge {
  position: absolute; top: 16px; right: 16px;
  font-size: 12px; font-weight: 700; padding: 3px 10px; border-radius: 999px;
  background: var(--surface-2); color: var(--text-muted);
}
.badge--live { background: var(--brand-soft); color: var(--brand-text); }

.features { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.feature { padding: 20px; display: flex; gap: 14px; align-items: flex-start; }
.feature__icon { width: 40px; height: 40px; flex-shrink: 0; border-radius: 12px; display: grid; place-items: center; background: var(--ink); color: var(--brand-green); }
.feature__icon svg { width: 22px; height: 22px; }
.feature h3 { margin: 0 0 2px; font-size: 16px; }
.feature p { margin: 0; color: var(--text-muted); font-size: 14px; }

/* ===== Trang công cụ ===== */
.tool-head { padding-top: 28px; padding-bottom: 8px; }
.breadcrumb { font-size: 13px; color: var(--text-muted); display: flex; gap: 6px; align-items: center; }
.breadcrumb a { text-decoration: none; }
.breadcrumb a:hover { color: var(--brand-text); }
.tool-head h1 { margin: 6px 0 4px; font-size: clamp(24px, 3.4vw, 32px); letter-spacing: -0.02em; }
.tool-head p { margin: 0; color: var(--text-muted); }

.wheel-layout {
  display: grid; gap: 20px; padding-top: 16px;
  grid-template-columns: minmax(0, 1fr) 380px;
  align-items: start;
}
@media (max-width: 960px) {
  .wheel-layout { grid-template-columns: minmax(0, 1fr); }
}

/* Khu vực vòng quay */
.stage {
  position: relative; padding: 20px 16px 24px;
  display: flex; flex-direction: column; align-items: center; gap: 16px;
  background:
    radial-gradient(circle at 50% 45%, color-mix(in srgb, var(--brand) 10%, transparent), transparent 60%),
    var(--surface);
}
.stage__title {
  margin: 0; text-align: center; font-size: clamp(18px, 2.6vw, 24px); font-weight: 800;
  max-width: 100%; overflow-wrap: anywhere;
}
.stage__toolbar { position: absolute; top: 12px; right: 12px; display: flex; gap: 6px; }

.wheel-wrap {
  position: relative; width: min(100%, 560px); aspect-ratio: 1;
  user-select: none; -webkit-user-select: none;
}
.wheel-wrap canvas {
  width: 100%; height: 100%; display: block; cursor: pointer;
  border-radius: 50%;
  filter: drop-shadow(0 18px 30px rgba(15, 27, 61, 0.25));
}
.wheel-pointer {
  position: absolute; top: -6px; left: 50%; width: 44px; height: 54px;
  transform: translateX(-50%); transform-origin: 50% 20%; z-index: 2;
  filter: drop-shadow(0 4px 6px rgba(0, 0, 0, 0.3));
  pointer-events: none;
}
.wheel-pointer.tick { animation: pointer-tick 0.12s ease-out; }
@keyframes pointer-tick {
  0% { transform: translateX(-50%) rotate(0); }
  40% { transform: translateX(-50%) rotate(-14deg); }
  100% { transform: translateX(-50%) rotate(0); }
}
.wheel-hub {
  position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);
  width: 22%; aspect-ratio: 1; border-radius: 50%; z-index: 2;
  border: 5px solid #fff;
  background: var(--brand-gradient);
  color: var(--on-brand); font-weight: 800; font-size: clamp(13px, 2.6vw, 20px); letter-spacing: 0.06em;
  cursor: pointer; box-shadow: 0 8px 22px rgba(0, 0, 0, 0.3), inset 0 -4px 10px rgba(0, 0, 0, 0.2);
  transition: transform 0.15s;
}
.wheel-hub:hover { transform: translate(-50%, -50%) scale(1.05); }
.wheel-hub:active { transform: translate(-50%, -50%) scale(0.97); }
.wheel-hub:disabled { cursor: progress; }

.stage__hint { margin: 0; font-size: 13px; color: var(--text-muted); text-align: center; }
.stage__hint kbd {
  font-family: inherit; font-size: 12px; padding: 1px 6px; border-radius: 6px;
  border: 1px solid var(--border); background: var(--surface-2);
}
@media (hover: none) { .stage__hint { display: none; } }
.stage__actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; }

/* Chế độ toàn màn hình */
.stage:fullscreen {
  border-radius: 0; border: 0; justify-content: center;
  background:
    radial-gradient(circle at 50% 45%, color-mix(in srgb, var(--brand-blue) 35%, transparent), transparent 60%),
    radial-gradient(circle at 20% 90%, color-mix(in srgb, var(--brand-green) 18%, transparent), transparent 50%),
    var(--ink);
  color: #fff;
}
.stage:fullscreen .wheel-wrap { width: min(88vh, 92vw); }
.stage:fullscreen .stage__title { font-size: clamp(22px, 3.4vw, 40px); }
.stage:fullscreen .stage__hint, .stage:fullscreen .stage__actions { display: none; }
.stage:fullscreen .btn { background: rgba(255, 255, 255, 0.1); border-color: rgba(255, 255, 255, 0.2); color: #fff; }

/* Bảng điều khiển */
.panel { overflow: hidden; display: flex; flex-direction: column; }
.tabs { display: flex; padding: 6px; gap: 4px; background: var(--surface-2); border-bottom: 1px solid var(--border); }
.tab {
  flex: 1; border: 0; background: transparent; padding: 9px 8px; border-radius: 10px;
  font-weight: 700; font-size: 14px; color: var(--text-muted); cursor: pointer; white-space: nowrap;
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
}
.tab:hover { color: var(--text); }
.tab[aria-selected="true"] { background: var(--surface); color: var(--brand-text); box-shadow: var(--shadow); }
.tab .count {
  font-size: 12px; min-width: 22px; padding: 1px 6px; border-radius: 999px;
  background: var(--brand-soft); color: var(--brand-text);
}
.tab-panel { padding: 16px; display: flex; flex-direction: column; gap: 12px; }
.tab-panel[hidden] { display: none; }

.panel-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.panel-label { font-weight: 700; font-size: 14px; }
.muted { color: var(--text-muted); font-size: 13px; }

.entries {
  width: 100%; min-height: 300px; resize: vertical;
  padding: 12px 14px; border-radius: var(--radius-sm);
  border: 1px solid var(--border); background: var(--surface-2);
  line-height: 1.7; font-size: 15px;
}
.entries:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 20%, transparent); background: var(--surface); }
.entries:disabled { opacity: 0.7; }

.chip-row { display: flex; flex-wrap: wrap; gap: 6px; }

/* Vòng quay mẫu */
.templates { display: flex; flex-direction: column; gap: 8px; padding-bottom: 14px; border-bottom: 1px solid var(--border); }
.template-row { display: flex; flex-wrap: wrap; gap: 6px; }
.template-chip {
  --c: var(--brand);
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 12px; border-radius: 999px; cursor: pointer;
  font-size: 13px; font-weight: 700; line-height: 1.3;
  border: 1px solid color-mix(in srgb, var(--c) 35%, transparent);
  background: color-mix(in srgb, var(--c) 12%, var(--surface));
  color: color-mix(in srgb, var(--c) 78%, var(--text));
  transition: background 0.15s, color 0.15s, transform 0.1s, box-shadow 0.15s;
}
.template-chip:hover { background: color-mix(in srgb, var(--c) 22%, var(--surface)); }
.template-chip:active { transform: translateY(1px); }
.template-chip[aria-pressed="true"] {
  background: var(--c); border-color: var(--c); color: #fff;
  box-shadow: 0 4px 12px color-mix(in srgb, var(--c) 35%, transparent);
}
.template-chip:disabled { opacity: 0.5; cursor: not-allowed; }
:root[data-theme="dark"] .template-chip:not([aria-pressed="true"]) { color: color-mix(in srgb, var(--c) 55%, #fff); }

/* Danh sách kết quả */
.results { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; max-height: 420px; overflow: auto; }
.results li {
  display: grid; grid-template-columns: 34px 1fr auto; align-items: center; gap: 10px;
  padding: 10px 12px; border-radius: var(--radius-sm); background: var(--surface-2);
}
.results li:first-child { background: var(--brand-soft); }
.results .idx {
  width: 28px; height: 28px; border-radius: 8px; display: grid; place-items: center;
  background: var(--ink); color: #fff; font-weight: 700; font-size: 13px;
}
.results li:first-child .idx { background: var(--brand-gradient); color: var(--on-brand); }
.results .name { font-weight: 700; overflow-wrap: anywhere; }
.results .time { font-size: 12px; color: var(--text-muted); }
.empty {
  text-align: center; padding: 32px 12px; color: var(--text-muted); font-size: 14px;
  border: 1px dashed var(--border); border-radius: var(--radius-sm);
}

/* Cài đặt */
.field { display: flex; flex-direction: column; gap: 6px; }
.field label, .field .field__label { font-weight: 700; font-size: 14px; }
.input, .select {
  width: 100%; padding: 10px 12px; border-radius: var(--radius-sm);
  border: 1px solid var(--border); background: var(--surface-2);
}
.input:focus, .select:focus { outline: none; border-color: var(--brand); background: var(--surface); }

.range-row { display: flex; align-items: center; gap: 12px; }
.range-row output { min-width: 44px; text-align: right; font-weight: 700; color: var(--brand-text); }
input[type="range"] { flex: 1; accent-color: var(--brand); }

.switch {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 10px 0; border-top: 1px solid var(--border); cursor: pointer;
}
.switch__text strong { display: block; font-size: 14px; }
.switch__text span { font-size: 13px; color: var(--text-muted); }
.switch input { position: absolute; opacity: 0; pointer-events: none; }
.switch__ui {
  position: relative; width: 44px; height: 26px; flex-shrink: 0; border-radius: 999px;
  background: var(--border); transition: background 0.2s;
}
.switch__ui::after {
  content: ""; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px;
  border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25); transition: transform 0.2s;
}
.switch input:checked + .switch__ui { background: var(--brand); }
.switch input:checked + .switch__ui::after { transform: translateX(18px); }
.switch input:focus-visible + .switch__ui { outline: 3px solid color-mix(in srgb, var(--brand) 55%, transparent); outline-offset: 2px; }

.palette-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(100px, 1fr)); gap: 8px; }
.palette-opt {
  border: 2px solid var(--border); border-radius: var(--radius-sm); padding: 8px; background: var(--surface);
  cursor: pointer; display: flex; flex-direction: column; gap: 6px; font-size: 12px; font-weight: 600; text-align: left;
}
.palette-opt[aria-pressed="true"] { border-color: var(--brand); box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 18%, transparent); }
.palette-opt__sw { display: flex; height: 18px; border-radius: 6px; overflow: hidden; }
.palette-opt__sw i { flex: 1; }

/* ===== Hộp thoại kết quả ===== */
.winner-dialog {
  border: 0; padding: 0; border-radius: 24px; width: min(92vw, 460px);
  background: var(--surface); color: var(--text); box-shadow: var(--shadow-lg);
  overflow: hidden;
}
.winner-dialog::backdrop { background: rgba(10, 16, 34, 0.6); backdrop-filter: blur(4px); }
.winner-dialog[open] { animation: pop 0.35s cubic-bezier(0.2, 1.4, 0.4, 1); }
@keyframes pop { from { transform: scale(0.85); opacity: 0; } to { transform: scale(1); opacity: 1; } }
.winner-dialog__top {
  padding: 26px 24px 22px; text-align: center; color: #fff;
  background:
    radial-gradient(320px 160px at 90% 0%, color-mix(in srgb, var(--brand-blue) 60%, transparent), transparent 70%),
    radial-gradient(300px 150px at 0% 100%, color-mix(in srgb, var(--brand-green) 40%, transparent), transparent 70%),
    var(--ink);
  border-bottom: 4px solid transparent;
  border-image: linear-gradient(90deg, var(--brand-green), var(--brand-blue)) 1;
}
.winner-dialog__label { color: var(--brand-green); font-size: 13px; font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase; opacity: 0.9; }
.winner-dialog__name {
  margin: 8px 0 0; font-size: clamp(26px, 6vw, 40px); font-weight: 800; line-height: 1.15; overflow-wrap: anywhere;
}
.winner-dialog__body { padding: 18px 20px 20px; display: flex; flex-direction: column; gap: 12px; }
.winner-dialog__meta { text-align: center; margin: 0; color: var(--text-muted); font-size: 14px; }
.winner-dialog__actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.winner-dialog__actions .btn--primary { grid-column: 1 / -1; }

/* ===== Thông báo nhỏ ===== */
.toast-host {
  position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%); z-index: 100;
  display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none;
  width: calc(100% - 32px); max-width: 420px;
}
.toast {
  background: var(--ink); color: #fff; padding: 10px 16px; border-radius: 12px;
  font-size: 14px; font-weight: 600; box-shadow: var(--shadow-lg);
  animation: toast-in 0.25s ease-out;
  border-left: 4px solid var(--brand-green);
}
.toast.out { opacity: 0; transform: translateY(8px); transition: 0.25s; }
@keyframes toast-in { from { opacity: 0; transform: translateY(10px); } }

.confetti-canvas {
  position: fixed; inset: 0; width: 100vw; height: 100vh; max-width: none; max-height: none;
  margin: 0; padding: 0; border: 0; background: transparent; overflow: visible;
  pointer-events: none; z-index: 2147483000;
}

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

/* =========================================================
   Công cụ xử lý file (ảnh, PDF, video)
   ========================================================= */
.file-layout {
  display: grid; gap: 20px; padding-top: 16px;
  grid-template-columns: minmax(0, 1fr) 340px; align-items: start;
}
@media (max-width: 960px) { .file-layout { grid-template-columns: minmax(0, 1fr); } }
.file-main { padding: 16px; display: flex; flex-direction: column; gap: 14px; }
.file-side { padding: 16px; display: flex; flex-direction: column; gap: 14px; position: sticky; top: 80px; }
@media (max-width: 960px) { .file-side { position: static; } }

.privacy-note {
  display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; border-radius: var(--radius-sm);
  background: var(--brand-soft); color: var(--text); font-size: 13px;
}
.privacy-note svg { width: 18px; height: 18px; flex-shrink: 0; color: var(--brand-text); margin-top: 1px; }

.dropzone {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px;
  min-height: 190px; padding: 24px 16px; text-align: center; cursor: pointer;
  border: 2px dashed color-mix(in srgb, var(--brand) 45%, var(--border)); border-radius: var(--radius);
  background: color-mix(in srgb, var(--brand) 4%, var(--surface));
  transition: background 0.15s, border-color 0.15s, transform 0.15s;
}
.dropzone:hover, .dropzone.is-over { background: var(--brand-soft); border-color: var(--brand); }
.dropzone.is-over { transform: scale(1.01); }
.dropzone__icon {
  width: 52px; height: 52px; border-radius: 16px; display: grid; place-items: center;
  background: var(--brand-gradient); color: var(--on-brand); margin-bottom: 4px;
}
.dropzone__icon svg { width: 26px; height: 26px; }
.dropzone__title { font-weight: 800; font-size: 16px; }
.dropzone__hint { color: var(--text-muted); font-size: 13px; max-width: 460px; }
.dropzone__btn { margin-top: 8px; pointer-events: none; }
.dropzone--compact { min-height: 0; padding: 14px; flex-direction: row; gap: 12px; }
.dropzone--compact .dropzone__icon { width: 38px; height: 38px; border-radius: 12px; margin: 0; }
.dropzone--compact .dropzone__icon svg { width: 20px; height: 20px; }
.dropzone--compact .dropzone__btn { margin: 0 0 0 auto; }
@media (max-width: 560px) { .dropzone--compact .dropzone__hint { display: none; } }

.list-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.list-head .panel-label { font-size: 15px; }

.file-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.file-row {
  display: grid; grid-template-columns: 52px minmax(0, 1fr) auto; gap: 12px; align-items: center;
  padding: 10px; border-radius: var(--radius-sm); background: var(--surface-2); border: 1px solid var(--border);
}
.file-row__thumb {
  width: 52px; height: 52px; border-radius: 8px; object-fit: cover; background: var(--border);
  display: grid; place-items: center; color: var(--text-muted); font-size: 11px; font-weight: 700;
}
.file-row__name { font-weight: 700; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-row__meta { font-size: 12.5px; color: var(--text-muted); display: flex; flex-wrap: wrap; gap: 4px 10px; margin-top: 2px; }
.file-row__actions { display: flex; gap: 6px; align-items: center; }
.saving { font-weight: 800; color: #0a8f5b; }
.saving.is-worse { color: #c2410c; }
:root[data-theme="dark"] .saving { color: #3ee0a0; }
:root[data-theme="dark"] .saving.is-worse { color: #fb923c; }
.status-err { color: #d92d20; font-weight: 600; }
:root[data-theme="dark"] .status-err { color: #ff7a6e; }
@media (max-width: 560px) {
  .file-row { grid-template-columns: 44px minmax(0, 1fr); }
  .file-row__thumb { width: 44px; height: 44px; }
  .file-row__actions { grid-column: 1 / -1; justify-content: flex-end; }
}

.spinner {
  width: 16px; height: 16px; border-radius: 50%; display: inline-block; vertical-align: -3px;
  border: 2px solid color-mix(in srgb, var(--brand) 25%, transparent); border-top-color: var(--brand);
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.seg { display: flex; flex-wrap: wrap; gap: 4px; padding: 4px; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--border); }
.seg button {
  flex: 1 1 auto; border: 0; background: transparent; padding: 7px 10px; border-radius: 9px; cursor: pointer;
  font-weight: 700; font-size: 13px; color: var(--text-muted); white-space: nowrap;
}
.seg button:hover:not(:disabled) { color: var(--text); }
.seg button[aria-pressed="true"] { background: var(--surface); color: var(--brand-text); box-shadow: var(--shadow); }
.seg button:disabled { opacity: 0.4; cursor: not-allowed; }
.field__help { font-size: 12.5px; color: var(--text-muted); margin: 0; }

.progress { height: 10px; border-radius: 999px; background: var(--surface-2); overflow: hidden; border: 1px solid var(--border); }
.progress__bar { height: 100%; width: 0; background: var(--brand-gradient); transition: width 0.25s; }

.summary {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; text-align: center;
}
.summary div { padding: 10px 6px; border-radius: var(--radius-sm); background: var(--surface-2); }
.summary strong { display: block; font-size: 16px; }
.summary span { font-size: 12px; color: var(--text-muted); }

/* Lưới ảnh có thể sắp xếp (ảnh sang PDF) */
.thumb-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(132px, 1fr)); gap: 10px; list-style: none; margin: 0; padding: 0; }
.thumb-card {
  position: relative; border-radius: var(--radius-sm); background: var(--surface-2); border: 1px solid var(--border);
  padding: 8px; display: flex; flex-direction: column; gap: 6px; cursor: grab;
}
.thumb-card.is-dragging { opacity: 0.4; }
.thumb-card.is-target { outline: 2px dashed var(--brand); outline-offset: 2px; }
.thumb-card img { width: 100%; aspect-ratio: 3 / 4; object-fit: contain; background: #fff; border-radius: 6px; pointer-events: none; }
.thumb-card__no {
  position: absolute; top: 12px; left: 12px; min-width: 24px; height: 24px; padding: 0 6px; border-radius: 999px;
  background: var(--ink); color: #fff; font-size: 12px; font-weight: 800; display: grid; place-items: center;
}
.thumb-card__name { font-size: 12px; color: var(--text-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.thumb-card__actions { display: flex; justify-content: space-between; gap: 4px; }
.thumb-card__actions .btn { padding: 4px 8px; }

.video-preview { width: 100%; max-height: 360px; border-radius: var(--radius-sm); background: #000; }
.info-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 8px; }
.info-grid div { padding: 10px 12px; border-radius: var(--radius-sm); background: var(--surface-2); }
.info-grid span { display: block; font-size: 12px; color: var(--text-muted); }
.info-grid strong { font-size: 14px; overflow-wrap: anywhere; }
.alert {
  padding: 10px 12px; border-radius: var(--radius-sm); font-size: 13.5px;
  background: color-mix(in srgb, #f59e0b 14%, var(--surface)); border: 1px solid color-mix(in srgb, #f59e0b 40%, transparent);
}
.alert--error { background: color-mix(in srgb, #ef4444 12%, var(--surface)); border-color: color-mix(in srgb, #ef4444 40%, transparent); }
[hidden] { display: none !important; }


/* =========================================================
   Bài viết hướng dẫn / SEO bên dưới mỗi công cụ
   ========================================================= */
.article {
  margin-top: 28px; padding: clamp(20px, 4vw, 44px);
  font-size: 16px; line-height: 1.75;
}
.article > * { max-width: 780px; margin-left: auto; margin-right: auto; }
.article h2 {
  font-size: clamp(20px, 2.6vw, 26px); line-height: 1.3; letter-spacing: -0.01em;
  margin-top: 36px; margin-bottom: 12px; scroll-margin-top: 84px;
}
.article > h2:first-child { margin-top: 0; font-size: clamp(22px, 3vw, 30px); }
.article h3 { font-size: 18px; margin: 24px auto 8px; }
.article p { margin-top: 0; margin-bottom: 14px; }
.article__lead { font-size: 17px; color: var(--text-muted); }
.article ul, .article ol { padding-left: 22px; margin-top: 0; margin-bottom: 16px; }
.article li { margin-bottom: 8px; }
.article li::marker { color: var(--brand-text); font-weight: 700; }
.article a:not(.btn):not(.related__item) { color: var(--brand-text); text-underline-offset: 3px; }
.article kbd {
  font-family: inherit; font-size: 13px; padding: 1px 6px; border-radius: 6px;
  border: 1px solid var(--border); background: var(--surface-2);
}
.article .steps { list-style: none; padding: 0; counter-reset: step; }
.article .steps li {
  position: relative; padding: 12px 14px 12px 56px; margin-bottom: 10px;
  border-radius: var(--radius-sm); background: var(--surface-2); counter-increment: step;
}
.article .steps li::before {
  content: counter(step); position: absolute; left: 14px; top: 12px;
  width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center;
  background: var(--brand-gradient); color: var(--on-brand); font-weight: 800; font-size: 14px; line-height: 1;
}

.toc {
  padding: 16px 20px; border-radius: var(--radius-sm); margin-bottom: 8px;
  background: var(--brand-soft); border: 1px solid color-mix(in srgb, var(--brand) 25%, transparent);
}
.toc strong { display: block; margin-bottom: 6px; }
.toc ol { margin: 0; }
.toc li { margin-bottom: 2px; }
.article .toc a { text-decoration: none; }
.article .toc a:hover { text-decoration: underline; }

.table-wrap { overflow-x: auto; margin-bottom: 16px; border: 1px solid var(--border); border-radius: var(--radius-sm); }
.article table { width: 100%; border-collapse: collapse; font-size: 15px; min-width: 520px; }
.article th, .article td { padding: 10px 14px; text-align: left; vertical-align: top; border-bottom: 1px solid var(--border); }
.article th { background: var(--surface-2); font-size: 14px; }
.article tr:last-child td { border-bottom: 0; }

.faq { display: flex; flex-direction: column; gap: 8px; margin-bottom: 8px; }
.faq details { border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface); }
.faq summary {
  cursor: pointer; padding: 14px 44px 14px 16px; font-weight: 700; position: relative; list-style: none;
}
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after {
  content: "+"; position: absolute; right: 16px; top: 50%; transform: translateY(-50%);
  font-size: 22px; font-weight: 400; color: var(--brand-text);
}
.faq details[open] summary::after { content: "−"; }
.faq details[open] summary { border-bottom: 1px solid var(--border); }
.faq details p { margin: 0; padding: 12px 16px 14px; color: var(--text-muted); }

.related { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 10px; margin-bottom: 8px; }
.related__item {
  display: flex; flex-direction: column; gap: 2px; padding: 14px 16px; text-decoration: none; color: inherit;
  border-radius: var(--radius-sm); border: 1px solid var(--border); background: var(--surface-2);
  transition: border-color 0.15s, transform 0.15s;
}
.related__item:hover { border-color: var(--brand); transform: translateY(-2px); }
.related__item strong { color: var(--brand-text); font-size: 15px; }
.related__item span { font-size: 13px; color: var(--text-muted); line-height: 1.5; }

.article-cta {
  margin-top: 32px; padding: 20px 22px; border-radius: var(--radius); color: #fff;
  display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap;
  background:
    radial-gradient(300px 140px at 100% 0%, color-mix(in srgb, var(--brand-blue) 55%, transparent), transparent 70%),
    radial-gradient(260px 120px at 0% 100%, color-mix(in srgb, var(--brand-green) 35%, transparent), transparent 70%),
    var(--ink);
}
.article-cta div { flex: 1 1 320px; }
.article-cta strong { display: block; font-size: 17px; margin-bottom: 2px; }
.article-cta span { font-size: 14px; color: #c9d6e6; line-height: 1.6; }
.article th:first-child, .article td:first-child { white-space: nowrap; }

/* Nhãn thông tin đã xóa (công cụ xóa nhãn AI) */
.tags { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; width: 100%; margin-top: 4px; }
.tags__label { font-size: 12px; color: var(--text-muted); margin-right: 2px; }
.tag {
  font-size: 11.5px; font-weight: 700; padding: 2px 8px; border-radius: 999px;
  background: var(--surface); border: 1px solid var(--border); color: var(--text-muted);
}
.tag--ai { background: color-mix(in srgb, #7c5cff 14%, var(--surface)); border-color: color-mix(in srgb, #7c5cff 40%, transparent); color: #6d4ae6; }
.tag--warn { background: color-mix(in srgb, #f59e0b 14%, var(--surface)); border-color: color-mix(in srgb, #f59e0b 40%, transparent); color: #b45309; }
.tag--ok { background: color-mix(in srgb, #10b981 12%, var(--surface)); border-color: color-mix(in srgb, #10b981 40%, transparent); color: #047857; }
:root[data-theme="dark"] .tag--ai { color: #b3a1ff; }
:root[data-theme="dark"] .tag--warn { color: #fbbf24; }
:root[data-theme="dark"] .tag--ok { color: #34d399; }
.check-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; font-size: 13.5px; }
.check-list li { position: relative; padding-left: 24px; }
.check-list li::before {
  content: "✓"; position: absolute; left: 0; top: 1px; width: 17px; height: 17px; border-radius: 50%;
  display: grid; place-items: center; font-size: 11px; font-weight: 800;
  background: var(--brand-gradient); color: var(--on-brand);
}

/* Menu "Công cụ" */
.nav__tools {
  border: 0; background: transparent; cursor: pointer; font: inherit; font-weight: 600; font-size: 14px;
  display: inline-flex; align-items: center; gap: 4px;
}
.nav__tools svg { width: 16px; height: 16px; transition: transform 0.2s; }
.nav__tools:hover { color: var(--text); background: var(--surface-2); }
.nav__tools[aria-expanded="true"] svg { transform: rotate(180deg); }
.nav__tools[aria-expanded="true"], .nav__tools[data-active="true"] { color: var(--brand-text); background: var(--brand-soft); }
.tools-menu {
  position: absolute; left: 0; right: 0; top: 100%;
  background: var(--surface); border-bottom: 1px solid var(--border); box-shadow: var(--shadow-lg);
  padding: 14px 0 18px; max-height: calc(100vh - 64px); overflow: auto;
}
.tools-menu__grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 6px; }
.tools-menu__item {
  display: flex; gap: 12px; align-items: center; padding: 10px 12px; border-radius: 12px; text-decoration: none; color: inherit;
}
.tools-menu__item:hover { background: var(--surface-2); }
.tools-menu__item[aria-current="page"] { background: var(--brand-soft); }
.tools-menu__item strong { display: block; font-size: 14.5px; }
.tools-menu__item small { display: block; font-size: 12.5px; color: var(--text-muted); }
.tools-menu__icon {
  width: 40px; height: 40px; flex-shrink: 0; border-radius: 12px; display: grid; place-items: center;
  background: var(--brand-soft); color: var(--brand-text);
}
.tools-menu__icon svg { width: 22px; height: 22px; }
@media (max-width: 720px) {
  .nav { margin-left: auto; }
  .nav__home { display: none; }
  .header-actions { margin-left: 4px; }
}
.site-footer__tools {
  display: flex; flex-wrap: wrap; gap: 6px 16px; padding-bottom: 22px; font-size: 13.5px; color: #93a8bf;
}
.site-footer__tools a { font-weight: 500 !important; color: #c9d6e6 !important; }
.site-footer__tools a:hover { color: var(--brand-green) !important; }

/* Tạo mã QR */
.qr-fields { display: flex; flex-direction: column; gap: 12px; }
.qr-fields textarea.input { resize: vertical; min-height: 96px; }
.qr-colors { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.color-field {
  display: inline-flex; align-items: center; gap: 10px; padding: 6px 12px 6px 6px; border-radius: 12px;
  border: 1px solid var(--border); background: var(--surface-2); font-weight: 700; font-size: 14px; cursor: pointer;
}
.color-field input { width: 36px; height: 36px; border: 0; padding: 0; border-radius: 8px; background: none; cursor: pointer; }
.color-field input::-webkit-color-swatch-wrapper { padding: 0; }
.color-field input::-webkit-color-swatch { border: 1px solid var(--border); border-radius: 8px; }
.qr-preview {
  border-radius: var(--radius-sm); padding: 12px; border: 1px solid var(--border);
  background-color: #fff;
  background-image: linear-gradient(45deg, #eef3f8 25%, transparent 25%), linear-gradient(-45deg, #eef3f8 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #eef3f8 75%), linear-gradient(-45deg, transparent 75%, #eef3f8 75%);
  background-size: 16px 16px; background-position: 0 0, 0 8px, 8px -8px, -8px 0;
}
.qr-preview canvas { width: 100%; height: auto; display: block; aspect-ratio: 1; }
.qr-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }

/* Tạo link UTM */
.utm-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 12px; }
.utm-grid .chip-row { gap: 2px; }
.utm-grid .chip-row .btn { padding: 3px 8px; font-size: 12px; color: var(--text-muted); }
.req { color: #d92d20; }
.utm-result {
  padding: 12px; border-radius: var(--radius-sm); background: var(--surface-2); border: 1px solid var(--border);
  min-height: 64px; display: flex; align-items: center;
}
.utm-link { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 13px; word-break: break-all; line-height: 1.6; }
.utm-q { color: var(--brand-text); font-weight: 600; }
.utm-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.utm-actions .btn[aria-disabled="true"] { opacity: 0.5; pointer-events: none; }
.utm-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; max-height: 460px; overflow: auto; }
.utm-list li:not(.empty) {
  display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 8px; align-items: center;
  padding: 10px; border-radius: var(--radius-sm); background: var(--surface-2); border: 1px solid var(--border);
}
.utm-list__place { font-weight: 700; font-size: 13.5px; grid-column: 1 / -1; }
.utm-list .utm-link { font-size: 12px; }
.article code { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 0.88em; padding: 1px 6px; border-radius: 6px; background: var(--surface-2); word-break: break-all; }

/* Xóa watermark */
.wm-toolbar { display: flex; flex-wrap: wrap; gap: 10px 16px; align-items: center; justify-content: space-between; margin-top: 10px; }
.wm-size { flex: 1 1 220px; max-width: 320px; }
.wm-stage {
  display: flex; justify-content: center; align-items: center; padding: 10px; border-radius: var(--radius-sm);
  background-color: #fff; border: 1px solid var(--border); margin-top: 8px;
  background-image: linear-gradient(45deg, #eef3f8 25%, transparent 25%), linear-gradient(-45deg, #eef3f8 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #eef3f8 75%), linear-gradient(-45deg, transparent 75%, #eef3f8 75%);
  background-size: 16px 16px; background-position: 0 0, 0 8px, 8px -8px, -8px 0;
}
.wm-stage canvas { display: block; max-width: 100%; touch-action: none; cursor: crosshair; border-radius: 4px; }
.wm-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
#btnCompare { user-select: none; -webkit-user-select: none; }
.mini-steps { margin: 0; padding-left: 20px; font-size: 13.5px; display: flex; flex-direction: column; gap: 4px; }

.btn--wrap { white-space: normal; text-align: center; line-height: 1.35; }
