/* The Thang Tool — lớp làm đẹp + giao diện khoá key (không đụng layout gốc) */

:root {
  --neon-2: 278 96% 72%;
}

html { scroll-behavior: smooth; }

html.tt-locked, html.tt-locked body { overflow: hidden !important; }

/* ------------------------------------------------------------- scrollbar */
* { scrollbar-width: thin; scrollbar-color: hsl(var(--neon) / .55) transparent; }
::-webkit-scrollbar { width: 9px; height: 9px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, hsl(var(--neon) / .65), hsl(var(--cyan) / .5));
  border-radius: 99px;
  border: 2px solid transparent;
  background-clip: padding-box;
}
::-webkit-scrollbar-thumb:hover {
  background: linear-gradient(180deg, hsl(var(--neon) / .95), hsl(var(--cyan) / .8));
  background-clip: padding-box;
}

/* ---------------------------------------------------------------- panels */
.panel {
  box-shadow:
    0 26px 70px -52px #000,
    inset 0 1px 0 rgba(255, 255, 255, .09);
  transition: border-color .28s ease, box-shadow .38s ease, transform .38s ease;
}
@media (hover: hover) {
  .panel:hover {
    border-color: hsl(var(--neon) / .3);
    box-shadow:
      0 30px 80px -50px hsl(var(--neon) / .55),
      inset 0 1px 0 rgba(255, 255, 255, .14);
  }
}

/* --------------------------------------------------------------- buttons */
.btn { transition: transform .15s ease, box-shadow .28s ease, background .18s ease, border-color .18s ease, filter .18s ease; }
.btn-primary {
  background-image: linear-gradient(135deg, hsl(var(--neon)) 0%, hsl(var(--cyan)) 100%);
  box-shadow: 0 16px 38px -20px hsl(var(--neon) / .95), inset 0 1px 0 rgba(255, 255, 255, .25);
}
.btn-primary:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 20px 44px -18px hsl(var(--neon) / 1), inset 0 1px 0 rgba(255, 255, 255, .3);
}
.btn:focus-visible, .field:focus-visible, a:focus-visible {
  outline: 2px solid hsl(var(--neon) / .75);
  outline-offset: 2px;
}

/* ----------------------------------------------------------------- fields */
.field {
  background: linear-gradient(180deg, rgba(12, 15, 23, .92), rgba(9, 11, 18, .96));
}
.field:focus, .field:focus-visible {
  box-shadow:
    0 0 0 4px hsl(var(--neon) / .15),
    0 0 26px -8px hsl(var(--neon) / .45);
}

/* ------------------------------------------------------------------ chips */
.chip { backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); }
.badge { letter-spacing: .02em; }

/* ---------------------------------------------------------------- console */
.console {
  box-shadow: inset 0 0 70px -34px hsl(var(--neon) / .55);
}

/* ============================================================ key note gate */
.tt-gate {
  position: fixed;
  inset: 0;
  z-index: 2147483000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 22px;
  background:
    radial-gradient(900px 520px at 50% -8%, hsl(var(--neon) / .26), transparent 62%),
    radial-gradient(700px 420px at 50% 112%, hsl(var(--danger) / .12), transparent 66%),
    rgba(4, 6, 12, .88);
  backdrop-filter: blur(16px) saturate(130%);
  -webkit-backdrop-filter: blur(16px) saturate(130%);
  animation: ttGateIn .32s ease both;
}

@keyframes ttGateIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes ttCardIn {
  from { opacity: 0; transform: translateY(14px) scale(.975); }
  to { opacity: 1; transform: none; }
}

@keyframes ttPulse {
  0%, 100% { box-shadow: 0 0 0 0 hsl(var(--danger) / .38), inset 0 1px 0 rgba(255, 255, 255, .2); }
  50% { box-shadow: 0 0 0 14px hsl(var(--danger) / 0), inset 0 1px 0 rgba(255, 255, 255, .2); }
}

.tt-gate-card {
  position: relative;
  width: min(520px, 100%);
  padding: 34px 26px 26px;
  border-radius: 26px;
  text-align: center;
  overflow: hidden;
  background: linear-gradient(168deg, rgba(255, 255, 255, .085), rgba(255, 255, 255, .02) 55%, rgba(255, 255, 255, .045));
  border: 1px solid rgba(255, 255, 255, .13);
  box-shadow:
    0 46px 120px -52px hsl(var(--neon) / .9),
    0 10px 40px -24px #000,
    inset 0 1px 0 rgba(255, 255, 255, .14);
  animation: ttCardIn .38s cubic-bezier(.21, .9, .28, 1) both;
}

.tt-gate-card::before {
  content: "";
  position: absolute;
  left: -12%;
  right: -12%;
  top: -46%;
  height: 78%;
  background: radial-gradient(closest-side, hsl(var(--neon) / .42), transparent 72%);
  filter: blur(26px);
  pointer-events: none;
}

.tt-gate-card::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 26px;
  padding: 1px;
  background: linear-gradient(140deg, hsl(var(--neon) / .55), transparent 42%, hsl(var(--cyan) / .35));
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  pointer-events: none;
}

.tt-gate-badge {
  position: relative;
  width: 74px;
  height: 74px;
  margin: 0 auto 18px;
  display: grid;
  place-items: center;
  border-radius: 24px;
  color: hsl(var(--danger));
  background: linear-gradient(160deg, hsl(var(--danger) / .26), hsl(var(--neon) / .18));
  border: 1px solid hsl(var(--danger) / .42);
  animation: ttPulse 2.6s ease-in-out infinite;
}

.tt-gate-badge svg { width: 36px; height: 36px; }

.tt-gate-title {
  position: relative;
  margin: 0 0 12px;
  font-size: 1.16rem;
  font-weight: 800;
  line-height: 1.35;
  letter-spacing: .01em;
  background: linear-gradient(100deg, #fff, hsl(var(--neon-soft)), hsl(var(--cyan)));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.tt-gate-sub {
  position: relative;
  margin: 0 auto 18px;
  max-width: 380px;
  font-size: .92rem;
  line-height: 1.65;
  color: rgba(255, 255, 255, .8);
}

.tt-gate-meta {
  position: relative;
  display: inline-block;
  margin: 0 0 18px;
  padding: .38rem .8rem;
  border-radius: 999px;
  font-size: .76rem;
  color: hsl(var(--muted));
  background: rgba(255, 255, 255, .06);
  border: 1px solid rgba(255, 255, 255, .1);
}
.tt-gate-meta b { color: #fff; font-weight: 700; }

.tt-gate-btn {
  position: relative;
  width: 100%;
  min-height: 50px;
  margin: 0 0 12px;
  border: 0;
  border-radius: 14px;
  cursor: pointer;
  font-family: inherit;
  font-size: .95rem;
  font-weight: 800;
  letter-spacing: .01em;
  color: #fff;
  background: linear-gradient(135deg, hsl(var(--neon)) 0%, hsl(var(--neon-2)) 52%, hsl(var(--cyan)) 100%);
  box-shadow: 0 20px 46px -22px hsl(var(--neon) / 1), inset 0 1px 0 rgba(255, 255, 255, .3);
  transition: transform .16s ease, box-shadow .28s ease, filter .2s ease;
}

.tt-gate-btn:hover { transform: translateY(-1px); filter: brightness(1.06); }
.tt-gate-btn:active { transform: translateY(1px) scale(.995); }

.tt-gate-hint {
  position: relative;
  font-size: .76rem;
  line-height: 1.6;
  color: hsl(var(--muted) / .95);
}

.tt-gate--dev .tt-gate-badge {
  color: hsl(var(--cyan));
  background: linear-gradient(160deg, hsl(var(--cyan) / .24), hsl(var(--neon) / .16));
  border-color: hsl(var(--cyan) / .4);
  animation: none;
}

@media (max-width: 420px) {
  .tt-gate-card { padding: 28px 18px 22px; border-radius: 22px; }
  .tt-gate-title { font-size: 1.05rem; }
  .tt-gate-badge { width: 64px; height: 64px; border-radius: 20px; margin-bottom: 14px; }
  .tt-gate-badge svg { width: 30px; height: 30px; }
}

/* ================================================== v2 · chi tiết tinh tế */
body {
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

::selection { background: hsl(var(--neon) / .38); color: #fff; }

/* thẻ panel: ánh sáng mềm phía trên, viền sáng dần khi hover */
.panel {
  background-image: linear-gradient(180deg, rgba(255, 255, 255, .05), rgba(255, 255, 255, 0) 42%);
  background-blend-mode: screen;
}

/* nút chính: vệt sáng quét khi hover, phản hồi rõ khi bấm */
.btn { position: relative; overflow: hidden; }
.btn-primary { letter-spacing: .012em; }
.btn-primary::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(105deg, transparent 36%, rgba(255, 255, 255, .42) 50%, transparent 64%);
  transform: translateX(-130%);
  transition: transform .72s cubic-bezier(.3, .7, .3, 1);
  pointer-events: none;
}
.btn-primary:hover:not(:disabled)::after { transform: translateX(130%); }
.btn:active:not(:disabled) { transform: translateY(1px) scale(.997); }

/* ô nhập: con trỏ + viền trong sáng hơn */
.field { caret-color: hsl(var(--neon-soft)); }
.field::placeholder { color: rgba(255, 255, 255, .34); }
.field:hover:not(:focus) { border-color: rgba(255, 255, 255, .18); }

/* nhãn trạng thái */
.badge {
  text-transform: uppercase;
  letter-spacing: .05em;
  font-weight: 700;
}

/* console: dòng dễ đọc, không chói */
.console { line-height: 1.62; }
.console::selection, .console *::selection { background: hsl(var(--cyan) / .3); color: #fff; }

/* vùng cuộn ngang (bảng, tab) mượt trên điện thoại */
.console, .panel { -webkit-overflow-scrolling: touch; }

/* điện thoại: nút dễ bấm hơn, chữ không bị iOS tự phóng to */
@media (max-width: 640px) {
  .btn { min-height: 44px; }
  input, textarea, select { font-size: 16px; }
}

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: .001ms !important; transition-duration: .001ms !important; }
}
