/* Shared site nav + responsive shell */
.top {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-start;
  gap: .75rem 1.25rem;
  align-items: center;
  padding: .85rem 1.25rem;
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(8px);
  position: sticky;
  top: 0;
  z-index: 40;
  background: rgba(12, 18, 16, 0.92);
}
.top-bar {
  display: flex;
  align-items: center;
  gap: .75rem;
  flex: 0 1 auto;
  min-width: 0;
}
.brand {
  display: flex;
  gap: .75rem;
  align-items: center;
  min-width: 0;
}
.brand h1 {
  margin: 0;
  font-size: clamp(1.05rem, 2.5vw, 1.35rem);
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  letter-spacing: .02em;
  font-weight: 800;
}
.brand p {
  margin: .15rem 0 0;
  color: var(--muted);
  font-size: .8rem;
  line-height: 1.3;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.mark {
  width: 44px;
  height: 44px;
  flex: 0 0 44px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  overflow: hidden;
  background: transparent;
}
.mark img,
img.mark {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

.site-nav {
  display: flex;
  flex-wrap: wrap;
  gap: .35rem;
  align-items: center;
  flex: 1 1 auto;
  justify-content: center;
}
.site-nav a {
  text-decoration: none;
  color: var(--muted);
  font-weight: 650;
  font-size: .9rem;
  padding: .45rem .85rem;
  border-radius: 8px;
  border: 1px solid transparent;
  white-space: nowrap;
}
.site-nav a:hover {
  color: var(--text);
  background: rgba(255,255,255,.04);
  border-color: var(--line);
}
.site-nav a.active {
  color: #b8f5d4;
  background: rgba(47,155,106,.18);
  border-color: #2f9b6a;
}

.nav-toggle {
  display: none;
  appearance: none;
  border: 1px solid var(--line);
  background: #18241e;
  width: 42px;
  height: 42px;
  border-radius: 10px;
  padding: 0;
  cursor: pointer;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
  margin-left: auto;
}
.nav-toggle span {
  display: block;
  width: 18px;
  height: 2px;
  background: var(--text);
  border-radius: 2px;
  transition: transform .18s ease, opacity .18s ease;
}
body.nav-open .nav-toggle span:nth-child(1) {
  transform: translateY(7px) rotate(45deg);
}
body.nav-open .nav-toggle span:nth-child(2) { opacity: 0; }
body.nav-open .nav-toggle span:nth-child(3) {
  transform: translateY(-7px) rotate(-45deg);
}

.top-actions {
  display: flex;
  gap: .55rem;
  align-items: flex-end;
  flex-wrap: wrap;
  flex: 0 0 auto;
  margin-left: auto;
}
.key-box {
  display: grid;
  gap: .25rem;
  font-size: .75rem;
  color: var(--muted);
}
.key-box input {
  background: #0e1613;
  border: 1px solid var(--line);
  color: var(--text);
  border-radius: 8px;
  padding: .55rem .7rem;
  min-width: 140px;
  width: min(200px, 42vw);
  max-width: 100%;
}

.wrap {
  max-width: 1100px;
  margin: 0 auto;
  padding: 1rem 1rem 2.5rem;
  display: grid;
  gap: 1rem;
}
.stats {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: .75rem;
}

a.btn {
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.btn { touch-action: manipulation; }

@media (max-width: 960px) {
  .stats { grid-template-columns: repeat(3, 1fr); }
  .grid-2 { grid-template-columns: 1fr; }
  .duel { grid-template-columns: 1fr; }
  .vs-col { flex-direction: row; min-width: 0; }
}

@media (max-width: 760px) {
  .top {
    flex-direction: column;
    align-items: stretch;
    padding: .7rem .85rem;
  }
  .top-bar { width: 100%; }
  .nav-toggle { display: inline-flex; }
  .site-nav,
  .top-actions {
    display: none;
    width: 100%;
    margin-left: 0;
  }
  body.nav-open .site-nav,
  body.nav-open .top-actions {
    display: flex;
  }
  .site-nav {
    flex-direction: column;
    align-items: stretch;
    justify-content: flex-start;
    gap: .3rem;
    padding: .35rem 0 .15rem;
    border-top: 1px solid var(--line);
  }
  .site-nav a {
    padding: .7rem .85rem;
    font-size: 1rem;
  }
  .top-actions {
    flex-direction: column;
    align-items: stretch;
    gap: .55rem;
    padding-top: .35rem;
    border-top: 1px solid var(--line);
  }
  .top-actions .btn,
  .top-actions .key-box,
  .top-actions .key-box input {
    width: 100%;
    min-width: 0;
  }
  .brand p { display: none; }

  /* —— Nội dung dưới menu —— */
  .wrap,
  .layout {
    width: 100%;
    max-width: 100%;
    padding: .65rem .6rem 1.75rem;
    gap: .75rem;
    overflow-x: hidden;
  }
  .panel {
    padding: .75rem .7rem .85rem;
    border-radius: 12px;
    max-width: 100%;
    overflow: hidden;
  }
  .panel h2 { font-size: .98rem; }
  .muted { font-size: .84rem; line-height: 1.4; }

  .stats {
    grid-template-columns: repeat(2, 1fr);
    gap: .5rem;
  }
  .stats article,
  .layout .stats .stat {
    padding: .65rem .7rem;
  }
  .stats strong,
  .layout .stats .stat b {
    font-size: 1.15rem;
  }

  .row {
    flex-direction: column;
    align-items: stretch;
    gap: .5rem;
    margin-bottom: .65rem;
  }
  .row > *,
  .row > input,
  .row > select,
  .row > .btn,
  .row > .file-lab,
  .row > label,
  .row > .switch {
    width: 100% !important;
    min-width: 0 !important;
    max-width: 100% !important;
    flex: none !important;
  }
  .row > .btn {
    justify-content: center;
    min-height: 44px;
  }
  .checks {
    flex-direction: column;
    align-items: stretch;
    gap: .55rem;
  }
  .checks .switch,
  .checks .chk {
    width: 100%;
  }
  .file-lab {
    width: 100%;
  }
  .file-lab input[type="file"] {
    width: 100%;
    max-width: 100%;
    font-size: .78rem;
  }
  input,
  select,
  textarea {
    width: 100% !important;
    min-width: 0 !important;
    max-width: 100% !important;
    font-size: 16px; /* tránh iOS zoom */
  }

  .table-wrap {
    max-width: 100%;
    max-height: min(55vh, 400px);
    overflow: auto;
    -webkit-overflow-scrolling: touch;
    border-radius: 10px;
  }
  .table-wrap table {
    min-width: 0;
    width: 100%;
  }
  /* Top nghi vấn (trang chủ): ẩn Signals + Related */
  .wrap .table-wrap th:nth-child(6),
  .wrap .table-wrap td:nth-child(6),
  .wrap .table-wrap th:nth-child(7),
  .wrap .table-wrap td:nth-child(7) {
    display: none;
  }
  table { font-size: .78rem; }
  th, td { padding: .4rem .35rem; }

  .row.between {
    flex-direction: column;
    align-items: stretch;
  }
  .row.between > h2 { margin-bottom: .15rem; }

  .duel {
    grid-template-columns: 1fr;
    gap: .75rem;
  }
  .vs-col {
    flex-direction: row;
    flex-wrap: wrap;
    justify-content: center;
    min-width: 0;
    width: 100%;
  }
  .verdict-banner {
    font-size: .88rem;
    width: 100%;
  }
  .avt-frame {
    max-width: 100%;
    margin: 0;
  }
  .person-card { max-width: 100%; }
  .duel.single { grid-template-columns: 1fr; }
  .related-row { justify-content: flex-start; }
  .box {
    font-size: .72rem;
    padding: .65rem;
    max-width: 100%;
  }
  .scan-progress { padding: .7rem .75rem; }
  .scan-progress-head {
    flex-direction: column;
    align-items: flex-start;
    gap: .25rem;
  }
  .grid-2 { grid-template-columns: 1fr; gap: .85rem; }
}

@media (max-width: 420px) {
  .stats { grid-template-columns: 1fr 1fr; }
  .mark {
    width: 40px;
    height: 40px;
    flex-basis: 40px;
  }
  .wrap,
  .layout {
    padding: .55rem .45rem 1.5rem;
  }
}

