/* ===== CHECK MÃ ĐẠI LÝ — Cyberpunk / hacker theme ===== */
:root {
  --bg: #02060d;
  --panel: rgba(4, 14, 26, 0.78);
  --panel-solid: #050f1c;
  --line: rgba(0, 240, 255, 0.35);
  --cyan: #00f0ff;
  --cyan-dim: #0aa7b8;
  --magenta: #ff2bd6;
  --acid: #39ff88;
  --red: #ff2e4d;
  --amber: #ffcc00;
  --text: #d8f6ff;
  --muted: #7fa6b8;
  --font: 'Chakra Petch', system-ui, sans-serif;
  --mono: 'JetBrains Mono', ui-monospace, Consolas, monospace;
  --cut: 14px;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body { min-height: 100%; }
body {
  font-family: var(--font);
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
input, select { font: inherit; color: inherit; }
a { color: inherit; text-decoration: none; }

/* ---------- Nền: ảnh hacker + lớp phủ neon + scanline ---------- */
.bg {
  position: fixed; inset: 0; z-index: -3;
  background: url('/assets/bg.jpg') center / cover no-repeat;
  filter: saturate(1.25) contrast(1.1) brightness(0.75);
  transform: scale(1.04);
  animation: bg-drift 24s ease-in-out infinite alternate;
}
.bg-overlay {
  position: fixed; inset: 0; z-index: -2;
  background:
    radial-gradient(ellipse at 50% 40%, transparent 0%, rgba(2, 6, 13, 0.55) 55%, rgba(2, 6, 13, 0.95) 100%),
    linear-gradient(180deg, rgba(0, 240, 255, 0.08), rgba(255, 43, 214, 0.06));
}
.scanlines {
  position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background: repeating-linear-gradient(0deg, rgba(0, 0, 0, 0.28) 0 1px, transparent 1px 3px);
  mix-blend-mode: multiply;
}
.scanlines::after {
  content: ''; position: absolute; left: 0; right: 0; height: 120px;
  background: linear-gradient(180deg, transparent, rgba(0, 240, 255, 0.07), transparent);
  animation: scan 6s linear infinite;
}
.grid-floor {
  position: fixed; left: -50%; right: -50%; bottom: -10vh; height: 45vh; z-index: -1; pointer-events: none;
  background:
    linear-gradient(transparent 0 calc(100% - 1px), rgba(0, 240, 255, 0.18) 0) 0 0 / 60px 60px,
    linear-gradient(90deg, transparent 0 calc(100% - 1px), rgba(0, 240, 255, 0.18) 0) 0 0 / 60px 60px;
  transform: perspective(500px) rotateX(62deg);
  mask-image: linear-gradient(transparent, #000 70%);
  -webkit-mask-image: linear-gradient(transparent, #000 70%);
  opacity: 0.55;
}

/* ---------- Bố cục trang chính ---------- */
.page {
  min-height: 100vh; min-height: 100dvh;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 22px; padding: 32px 16px;
}

.brand { display: flex; flex-direction: column; align-items: center; text-align: center; }
.brand-tag {
  display: block; font-family: var(--mono); font-size: 12px; letter-spacing: 0.3em;
  color: var(--acid); text-shadow: 0 0 8px rgba(57, 255, 136, 0.7); margin-bottom: 10px;
}
.brand-tag::before { content: '> '; }
.brand-tag .caret { animation: blink 1s steps(1) infinite; }

/* Tiêu đề glitch */
.glitch {
  position: relative; display: inline-block;
  font-size: clamp(30px, 7vw, 58px); font-weight: 700; letter-spacing: 0.06em; line-height: 1.05;
  color: #eaffff;
  text-shadow: 0 0 6px var(--cyan), 0 0 22px rgba(0, 240, 255, 0.65), 0 0 46px rgba(0, 240, 255, 0.35);
}
.glitch::before, .glitch::after {
  content: attr(data-text); position: absolute; inset: 0; pointer-events: none;
}
.glitch::before { color: var(--magenta); transform: translate(2px, 0); clip-path: inset(0 0 60% 0); animation: glitch-a 3.2s infinite steps(1); opacity: 0.85; }
.glitch::after { color: var(--cyan); transform: translate(-2px, 0); clip-path: inset(55% 0 0 0); animation: glitch-b 2.7s infinite steps(1); opacity: 0.85; }
.brand-sub { margin-top: 10px; font-family: var(--mono); font-size: 12px; color: var(--muted); letter-spacing: 0.18em; }

/* ---------- Panel / popup kiểu HUD góc cắt ---------- */
.hud {
  position: relative; width: 100%; max-width: 460px;
  padding: 26px 24px 22px;
  background:
    linear-gradient(135deg, rgba(0, 240, 255, 0.10), transparent 40%),
    linear-gradient(315deg, rgba(255, 43, 214, 0.10), transparent 40%),
    var(--panel);
  backdrop-filter: blur(10px) saturate(1.2);
  -webkit-backdrop-filter: blur(10px) saturate(1.2);
  clip-path: polygon(var(--cut) 0, 100% 0, 100% calc(100% - var(--cut)), calc(100% - var(--cut)) 100%, 0 100%, 0 var(--cut));
  box-shadow: inset 0 0 0 1px var(--line), inset 0 0 40px rgba(0, 240, 255, 0.08);
  animation: hud-in 0.45s cubic-bezier(0.2, 0.9, 0.3, 1.2) both;
}
/* viền neon chạy */
.hud::before {
  content: ''; position: absolute; inset: 0; pointer-events: none;
  padding: 1px;
  background: linear-gradient(90deg, var(--cyan), var(--magenta), var(--cyan)) 0 0 / 200% 100%;
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor; mask-composite: exclude;
  clip-path: inherit;
  animation: border-flow 4s linear infinite;
  opacity: 0.9;
}
/* góc ngắm */
.hud > .corner { position: absolute; width: 16px; height: 16px; border: 2px solid var(--cyan); filter: drop-shadow(0 0 4px var(--cyan)); }
.hud > .corner.tr { top: 6px; right: 6px; border-left: 0; border-bottom: 0; }
.hud > .corner.bl { bottom: 6px; left: 6px; border-right: 0; border-top: 0; }

.hud-head {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding-bottom: 14px; margin-bottom: 18px;
  border-bottom: 1px dashed rgba(0, 240, 255, 0.3);
}
.hud-title {
  font-size: 18px; font-weight: 700; letter-spacing: 0.14em; text-transform: uppercase;
  color: var(--cyan); text-shadow: 0 0 10px rgba(0, 240, 255, 0.7);
}
.hud-title small { display: block; margin-top: 2px; font-family: var(--mono); font-size: 10.5px; font-weight: 400; letter-spacing: 0.2em; color: var(--muted); text-shadow: none; }
.status-dot { display: inline-flex; align-items: center; gap: 6px; font-family: var(--mono); font-size: 11px; color: var(--acid); letter-spacing: 0.12em; }
.status-dot::before { content: ''; width: 8px; height: 8px; border-radius: 50%; background: var(--acid); box-shadow: 0 0 10px var(--acid); animation: pulse 1.4s ease-in-out infinite; }
.x-btn {
  width: 32px; height: 32px; display: grid; place-items: center; font-size: 16px;
  color: var(--muted); border: 1px solid rgba(0, 240, 255, 0.3);
  transition: color 0.15s, border-color 0.15s, box-shadow 0.15s;
}
.x-btn:hover { color: var(--magenta); border-color: var(--magenta); box-shadow: 0 0 12px rgba(255, 43, 214, 0.5); }

/* ---------- Form ---------- */
.field { margin-bottom: 16px; }
.field-label {
  display: flex; justify-content: space-between; align-items: baseline; gap: 8px;
  margin-bottom: 7px; font-size: 12.5px; font-weight: 600; letter-spacing: 0.16em; color: var(--text);
}
.field-label .idx { font-family: var(--mono); color: var(--magenta); margin-right: 6px; }
.field-error { font-family: var(--mono); font-size: 11px; letter-spacing: 0.02em; color: var(--red); text-shadow: 0 0 6px rgba(255, 46, 77, 0.6); }

.input {
  position: relative; display: flex; align-items: center; width: 100%;
  background: rgba(0, 12, 22, 0.85);
  border: 1px solid rgba(0, 240, 255, 0.35);
  transition: border-color 0.15s, box-shadow 0.15s;
}
.input::before { content: '>'; padding-left: 14px; font-family: var(--mono); color: var(--cyan); opacity: 0.8; }
.input input, .input .input-value {
  flex: 1; min-width: 0; height: 48px; padding: 0 14px 0 10px;
  background: transparent; border: 0; outline: none;
  font-family: var(--mono); font-size: 15px; letter-spacing: 0.04em; color: #eaffff; text-align: left;
}
.input .input-value { display: flex; align-items: center; white-space: nowrap; overflow: hidden; }
.input input::placeholder, .input .placeholder { color: #4f7383; }
.input:focus-within, .input.is-open { border-color: var(--cyan); box-shadow: 0 0 0 1px var(--cyan), 0 0 18px rgba(0, 240, 255, 0.35); }
.input.has-error { border-color: var(--red); box-shadow: 0 0 0 1px var(--red), 0 0 16px rgba(255, 46, 77, 0.35); animation: shake 0.35s; }
.input.has-error::before { color: var(--red); }
.input-btn {
  align-self: stretch; display: flex; align-items: center; padding: 0 16px; font-size: 12px; font-weight: 700; letter-spacing: 0.16em;
  color: var(--bg); background: var(--cyan);
  clip-path: polygon(10px 0, 100% 0, 100% 100%, 0 100%);
  transition: background 0.15s, box-shadow 0.15s;
}
.input-btn:hover { background: #7ff8ff; }
button.input { cursor: pointer; text-align: left; }
button.input:hover { border-color: var(--cyan); }

/* ---------- Nút chính ---------- */
.btn {
  position: relative; display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  min-height: 46px; padding: 0 22px;
  font-size: 14px; font-weight: 700; letter-spacing: 0.18em; text-transform: uppercase;
  clip-path: polygon(12px 0, 100% 0, 100% calc(100% - 12px), calc(100% - 12px) 100%, 0 100%, 0 12px);
  transition: transform 0.12s, box-shadow 0.15s, filter 0.15s;
  overflow: hidden;
}
.btn:active { transform: translateY(1px) scale(0.99); }
.btn:disabled { cursor: default; }
.btn-primary {
  color: #001014;
  background: linear-gradient(90deg, var(--cyan), #7af9ff 50%, var(--cyan));
  box-shadow: 0 0 24px rgba(0, 240, 255, 0.45);
}
.btn-primary:hover:not(:disabled) { filter: brightness(1.12); box-shadow: 0 0 34px rgba(0, 240, 255, 0.75); }
.btn-primary::after {
  content: ''; position: absolute; top: 0; bottom: 0; left: -40%; width: 30%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.7), transparent);
  transform: skewX(-20deg); animation: sheen 2.8s ease-in-out infinite;
}
.btn-ghost { color: var(--text); background: rgba(0, 240, 255, 0.06); box-shadow: inset 0 0 0 1px rgba(0, 240, 255, 0.45); }
.btn-ghost:hover { color: var(--cyan); box-shadow: inset 0 0 0 1px var(--cyan), 0 0 16px rgba(0, 240, 255, 0.35); }
.btn-danger { color: #fff; background: linear-gradient(90deg, #c4002a, var(--red)); box-shadow: 0 0 24px rgba(255, 46, 77, 0.55); }
.btn-danger:hover { filter: brightness(1.1); }
.btn-acid { color: #00170a; background: linear-gradient(90deg, #20d86d, var(--acid)); box-shadow: 0 0 24px rgba(57, 255, 136, 0.5); }
.btn-acid:hover { filter: brightness(1.08); }
.btn-block { width: 100%; }

/* Nút check có thanh tiến trình */
.btn-check { width: 100%; min-height: 54px; font-size: 15px; margin-top: 6px; }
.btn-check .fill {
  position: absolute; inset: 0 auto 0 0; width: 0;
  background: repeating-linear-gradient(-45deg, rgba(0, 16, 20, 0.22) 0 8px, transparent 8px 16px), linear-gradient(90deg, var(--acid), var(--cyan));
  transition: width 0.12s linear;
}
.btn-check .label { position: relative; z-index: 1; }
.btn-check.is-loading { background: rgba(0, 30, 40, 0.9); color: #001014; box-shadow: inset 0 0 0 1px var(--cyan), 0 0 24px rgba(0, 240, 255, 0.35); }
.btn-check.is-loading .label { color: #f2ffff; text-shadow: 0 0 2px #000, 0 0 8px #000, 0 1px 0 #000; }
.btn-check.is-loading::after { display: none; }

.panel-foot { margin-top: 18px; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.sys-line { font-family: var(--mono); font-size: 10.5px; color: var(--muted); letter-spacing: 0.08em; }
.sys-line b { color: var(--acid); font-weight: 400; }
.socials { display: flex; gap: 10px; }
.social {
  width: 38px; height: 38px; display: grid; place-items: center;
  border: 1px solid rgba(0, 240, 255, 0.35); background: rgba(0, 240, 255, 0.05);
  transition: box-shadow 0.15s, border-color 0.15s, transform 0.15s;
}
.social img { width: 22px; height: 22px; object-fit: contain; }
.social:hover { border-color: var(--cyan); box-shadow: 0 0 14px rgba(0, 240, 255, 0.55); transform: translateY(-2px); }

/* ---------- Modal ---------- */
.overlay {
  position: fixed; inset: 0; z-index: 50;
  display: grid; place-items: center; padding: 16px;
  background: rgba(1, 4, 9, 0.72);
  backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px);
  animation: fade-in 0.2s ease both;
}
.overlay[hidden] { display: none; }
.overlay .hud { max-width: 420px; }
.modal-desc { font-size: 14px; line-height: 1.6; color: var(--muted); margin-bottom: 16px; }
.modal-desc strong { color: var(--cyan); font-weight: 600; }
.modal-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 18px; }

/* Ô OTP */
.otp-input input { font-size: 24px; letter-spacing: 0.45em; text-align: center; height: 58px; padding-right: 24px; }
.msg-error {
  margin-top: 10px; padding: 9px 12px; font-family: var(--mono); font-size: 12.5px; line-height: 1.5;
  color: #ffd3da; background: rgba(255, 46, 77, 0.12); border-left: 3px solid var(--red);
}
.msg-error[hidden] { display: none; }

/* Danh sách chọn trang */
.site-search { margin-bottom: 14px; }
.site-grid {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px;
  max-height: min(52vh, 380px); overflow-y: auto; padding-right: 4px;
  scrollbar-width: thin; scrollbar-color: var(--cyan-dim) transparent;
}
.site-item {
  padding: 12px 6px; font-family: var(--mono); font-size: 13px; font-weight: 600; letter-spacing: 0.06em;
  color: var(--text); background: rgba(0, 240, 255, 0.05); border: 1px solid rgba(0, 240, 255, 0.22);
  transition: all 0.12s;
}
.site-item:hover, .site-item:focus-visible { color: #001014; background: var(--cyan); border-color: var(--cyan); box-shadow: 0 0 16px rgba(0, 240, 255, 0.55); outline: none; }
.site-item.is-active { color: var(--magenta); border-color: var(--magenta); box-shadow: inset 0 0 12px rgba(255, 43, 214, 0.3); }
.site-empty { grid-column: 1 / -1; text-align: center; padding: 24px 0; font-family: var(--mono); font-size: 13px; color: var(--muted); }

/* Màn xâm nhập */
.terminal {
  height: 170px; overflow: hidden; padding: 12px 14px; margin-bottom: 16px;
  font-family: var(--mono); font-size: 12px; line-height: 1.7; color: var(--acid);
  background: rgba(0, 8, 4, 0.85); border: 1px solid rgba(57, 255, 136, 0.35);
  box-shadow: inset 0 0 24px rgba(57, 255, 136, 0.12);
  display: flex; flex-direction: column; justify-content: flex-end;
}
.terminal .ln { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; animation: type-in 0.25s steps(20) both; }
.terminal .ln.warn { color: var(--amber); }
.terminal .ln.cy { color: var(--cyan); }
.bar { position: relative; height: 12px; background: rgba(0, 240, 255, 0.08); border: 1px solid rgba(0, 240, 255, 0.4); overflow: hidden; }
.bar > i {
  position: absolute; inset: 0 auto 0 0; width: 0;
  background: repeating-linear-gradient(-45deg, rgba(0, 0, 0, 0.25) 0 6px, transparent 6px 12px), linear-gradient(90deg, var(--magenta), var(--cyan));
  box-shadow: 0 0 14px var(--cyan); transition: width 0.12s linear;
}
.bar-meta { display: flex; justify-content: space-between; margin-top: 8px; font-family: var(--mono); font-size: 12px; letter-spacing: 0.12em; color: var(--cyan); }
.warn-text { margin-top: 14px; text-align: center; font-size: 13px; font-weight: 700; letter-spacing: 0.14em; color: var(--amber); text-shadow: 0 0 10px rgba(255, 204, 0, 0.5); animation: flicker 2.4s infinite; }

/* Kết quả */
.result { text-align: center; }
.result-icon { width: 96px; height: 96px; margin: 4px auto 14px; display: grid; place-items: center; position: relative; }
.result-icon svg { width: 100%; height: 100%; overflow: visible; }
.result-icon::before {
  content: ''; position: absolute; inset: -10px; border-radius: 50%;
  border: 1px dashed currentColor; opacity: 0.5; animation: spin 12s linear infinite;
}
.result-safe { color: var(--acid); filter: drop-shadow(0 0 14px rgba(57, 255, 136, 0.7)); }
.result-danger { color: var(--red); filter: drop-shadow(0 0 14px rgba(255, 46, 77, 0.8)); }
.result-kicker { font-family: var(--mono); font-size: 12px; letter-spacing: 0.3em; color: var(--muted); margin-bottom: 8px; }
.result-pill {
  display: inline-block; padding: 12px 18px; margin: 4px 0 6px;
  font-size: 16px; font-weight: 700; letter-spacing: 0.08em; line-height: 1.35;
  clip-path: polygon(10px 0, 100% 0, 100% calc(100% - 10px), calc(100% - 10px) 100%, 0 100%, 0 10px);
}
.result-pill.safe { color: #00170a; background: var(--acid); box-shadow: 0 0 26px rgba(57, 255, 136, 0.6); }
.result-pill.danger { color: #fff; background: var(--red); box-shadow: 0 0 26px rgba(255, 46, 77, 0.7); animation: alarm 1.1s ease-in-out infinite; }
.result-meta { margin-top: 10px; font-family: var(--mono); font-size: 12.5px; color: var(--muted); }
.result-meta b { color: var(--text); font-weight: 600; }
.result-error { margin: 6px 0 4px; font-size: 14.5px; line-height: 1.6; color: #ffd3da; }
.hud.danger { box-shadow: inset 0 0 0 1px rgba(255, 46, 77, 0.6), inset 0 0 50px rgba(255, 46, 77, 0.18); }
.hud.danger::before { background: linear-gradient(90deg, var(--red), var(--amber), var(--red)) 0 0 / 200% 100%; }
.hud.danger > .corner { border-color: var(--red); filter: drop-shadow(0 0 4px var(--red)); }
.result .btn { margin-top: 20px; min-width: 200px; }

/* Toast */
.toast {
  position: fixed; right: 16px; bottom: 16px; z-index: 80; max-width: calc(100vw - 32px);
  padding: 11px 16px; font-family: var(--mono); font-size: 13px; color: var(--acid);
  background: rgba(0, 12, 6, 0.95); border: 1px solid var(--acid); box-shadow: 0 0 20px rgba(57, 255, 136, 0.35);
  animation: hud-in 0.3s both;
}
.toast[hidden] { display: none; }

/* ---------- Animations ---------- */
@keyframes bg-drift { from { transform: scale(1.04) translate(0, 0); } to { transform: scale(1.1) translate(-1.5%, -1%); } }
@keyframes scan { from { top: -120px; } to { top: 100%; } }
@keyframes blink { 50% { opacity: 0; } }
@keyframes pulse { 50% { opacity: 0.35; transform: scale(0.8); } }
@keyframes border-flow { to { background-position: 200% 0; } }
@keyframes sheen { 0%, 60% { left: -40%; } 100% { left: 130%; } }
@keyframes hud-in { from { opacity: 0; transform: translateY(14px) scale(0.97); filter: blur(4px); } to { opacity: 1; transform: none; filter: none; } }
@keyframes fade-in { from { opacity: 0; } }
@keyframes shake { 25% { transform: translateX(-5px); } 50% { transform: translateX(5px); } 75% { transform: translateX(-3px); } }
@keyframes type-in { from { max-width: 0; } to { max-width: 100%; } }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes alarm { 50% { box-shadow: 0 0 8px rgba(255, 46, 77, 0.4); filter: brightness(0.85); } }
@keyframes flicker { 0%, 19%, 21%, 62%, 64%, 100% { opacity: 1; } 20%, 63% { opacity: 0.35; } }
@keyframes glitch-a { 0%, 86%, 100% { transform: translate(2px, 0); clip-path: inset(0 0 60% 0); } 88% { transform: translate(-6px, -1px); clip-path: inset(10% 0 70% 0); } 92% { transform: translate(5px, 1px); clip-path: inset(40% 0 35% 0); } }
@keyframes glitch-b { 0%, 80%, 100% { transform: translate(-2px, 0); clip-path: inset(55% 0 0 0); } 83% { transform: translate(6px, 1px); clip-path: inset(70% 0 5% 0); } 90% { transform: translate(-4px, 0); clip-path: inset(30% 0 45% 0); } }

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

@media (max-width: 480px) {
  .hud { padding: 22px 16px 18px; }
  .site-grid { grid-template-columns: repeat(2, 1fr); }
  .panel-foot { flex-direction: column-reverse; align-items: flex-start; }
  .otp-input input { font-size: 20px; letter-spacing: 0.3em; }
}
