/* impeccable · macrostructure: ecosystem-index · tone: instrument-panel */
:root {
  /* Design Tokens */
  --bg: #090e1a;
  --bg-soft: #0e1626;
  --surface: #131e33;
  --surface-strong: #1a2a47;
  --ink: #f8fafc;
  --muted: #94a3b8;
  --muted-2: #7d8ca8;
  --line: rgba(255, 255, 255, 0.06);
  --line-strong: rgba(255, 255, 255, 0.12);
  --grid-line: rgba(148, 163, 184, 0.04);

  --accent: #2dd4bf; /* Teal - instrument readout */
  --accent-hover: #5eead4;
  --accent-soft: rgba(45, 212, 191, 0.1);
  --accent-blue: #3b82f6;
  --accent-blue-soft: rgba(59, 130, 246, 0.1);
  --accent-warm: #fbbf24; /* Amber */
  --accent-warm-soft: rgba(251, 191, 36, 0.1);

  --good: #10b981;
  --good-soft: rgba(16, 185, 129, 0.1);
  --warn: #f59e0b;
  --warn-soft: rgba(245, 158, 11, 0.1);
  --bad: #ef4444;
  --bad-soft: rgba(239, 68, 68, 0.1);

  --shadow: 0 8px 20px -12px rgba(0, 0, 0, 0.6);

  --font-sans: "Be Vietnam Pro", ui-sans-serif, system-ui, -apple-system, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;

  --radius-card: 16px;
  --radius-btn: 10px;
  --radius-input: 10px;

  --safe-top: env(safe-area-inset-top);
  --safe-bottom: env(safe-area-inset-bottom);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  overflow-x: clip;
}

body {
  margin: 0;
  min-height: 100vh;
  background-color: var(--bg);
  background-image:
    radial-gradient(circle at 12% -5%, rgba(45, 212, 191, 0.07), transparent 32%),
    radial-gradient(circle at 88% 4%, rgba(59, 130, 246, 0.05), transparent 28%),
    linear-gradient(rgba(148, 163, 184, 0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(148, 163, 184, 0.03) 1px, transparent 1px),
    linear-gradient(180deg, var(--bg), #04060b 80%);
  background-size: auto, auto, 44px 44px, 44px 44px, auto;
  color: var(--ink);
  font-family: var(--font-sans);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a {
  color: inherit;
  text-decoration: none;
  transition: color 0.2s ease, opacity 0.2s ease;
}

button, input, textarea {
  font-family: inherit;
}

/* Accessible Skip Link */
.skipLink {
  position: absolute;
  left: 16px;
  top: -80px;
  z-index: 200;
  padding: 12px 16px;
  border-radius: var(--radius-btn);
  background: var(--ink);
  color: var(--bg);
  font-weight: 800;
  transition: top 0.2s ease;
}

.skipLink:focus {
  top: 16px;
}

/* Layout Shell */
.shell {
  width: min(1180px, 100%);
  margin: 0 auto;
  padding: calc(24px + var(--safe-top)) 24px calc(48px + var(--safe-bottom));
  display: flex;
  flex-direction: column;
  gap: 72px;
}

/* Header & Nav */
.header-wrapper {
  display: flex;
  flex-direction: column;
}

.nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
  padding: 12px 0 28px;
  border-bottom: 1px solid var(--line);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  font-weight: 900;
  letter-spacing: -0.03em;
}

.brand span {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  background: var(--surface-strong);
  border: 1px solid var(--line-strong);
  color: var(--accent);
  font-size: 13px;
  font-weight: 800;
}

.brand strong {
  font-size: 18px;
  color: var(--ink);
}

.navlinks {
  display: flex;
  gap: 6px;
  align-items: center;
}

.navlinks a {
  min-height: 38px;
  display: inline-flex;
  align-items: center;
  padding: 0 14px;
  border-radius: 8px;
  color: var(--muted);
  font-weight: 600;
  font-size: 14px;
}

.navlinks a:hover, .navlinks a:focus-visible {
  background: rgba(255, 255, 255, 0.05);
  color: var(--ink);
  outline: none;
}

.navStatus {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 38px;
  padding: 0 14px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: rgba(9, 14, 26, 0.6);
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--muted);
}

.liveDot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--good);
  box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.5);
  animation: livePulse 2.4s ease-out infinite;
}

@keyframes livePulse {
  0% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.45); }
  70% { box-shadow: 0 0 0 6px rgba(16, 185, 129, 0); }
  100% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); }
}

.clock {
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.04em;
}

/* Hero Section */
.intro {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  gap: 48px;
  align-items: start;
  padding-top: 44px;
}

.kicker {
  margin: 0 0 14px;
  color: var(--accent);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  font-family: var(--font-mono);
}

.intro h1 {
  font-size: clamp(36px, 5.2vw, 60px);
  line-height: 1.06;
  letter-spacing: -0.035em;
  text-wrap: balance;
  margin: 0 0 20px;
  font-weight: 800;
}

.lead {
  font-size: clamp(16px, 1.8vw, 19px);
  line-height: 1.65;
  color: var(--muted);
  max-width: 640px;
  margin: 0;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 32px;
}

/* Interactive Components */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 48px;
  padding: 0 20px;
  border-radius: var(--radius-btn);
  background: var(--surface);
  border: 1px solid var(--line);
  color: var(--ink);
  font-weight: 700;
  font-size: 14px;
  cursor: pointer;
  transition: transform 0.1s ease, background 0.16s ease, border-color 0.16s ease;
}

.btn:hover {
  background: var(--surface-strong);
  border-color: rgba(255, 255, 255, 0.15);
}

.btn:active {
  transform: scale(0.97);
}

.btn:focus-visible, .appCard:focus-visible, .statusList a:focus-visible, .opsLink:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

.btn:disabled {
  cursor: not-allowed;
  opacity: 0.5;
  transform: none;
}

.btn.primary {
  background: var(--ink);
  color: var(--bg);
  border-color: var(--ink);
}

.btn.primary:hover {
  background: #ffffff;
}

.btn.quiet {
  background: transparent;
  border-color: transparent;
}

.btn.quiet:hover {
  background: rgba(255, 255, 255, 0.05);
}

.btn.ghost {
  background: transparent;
  border-color: var(--line);
}

.btn.ghost:hover {
  border-color: var(--muted);
  background: rgba(255, 255, 255, 0.02);
}

/* Operations Panel (Hero Right) */
.opsPanel {
  padding: 28px;
  border-radius: var(--radius-card);
  background: var(--surface);
  border: 1px solid var(--line);
  position: relative;
}

.opsPanel::before {
  content: "";
  position: absolute;
  top: -1px;
  left: 24px;
  right: 24px;
  height: 1px;
  background: linear-gradient(90deg, var(--accent), transparent 70%);
}

.opsTop {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--line);
}

.opsTop p {
  margin: 0;
}

.opsTop strong {
  font-size: 20px;
  letter-spacing: -0.03em;
  font-family: var(--font-mono);
  color: var(--accent);
}

.muted {
  color: var(--muted);
  font-size: 13px;
}

.opsList {
  display: grid;
  gap: 16px;
  margin: 20px 0 24px;
}

.opsList div {
  display: grid;
  gap: 4px;
}

.opsList dt {
  color: var(--muted-2);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-family: var(--font-mono);
}

.opsList dd {
  margin: 0;
  color: var(--ink);
  font-weight: 600;
  font-size: 14px;
  line-height: 1.4;
}

.opsLink {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  border-radius: var(--radius-btn);
  background: var(--accent-soft);
  border: 1px solid rgba(45, 212, 191, 0.15);
  color: var(--accent);
  font-weight: 700;
  font-size: 13px;
}

.opsLink:hover {
  background: rgba(45, 212, 191, 0.14);
  border-color: var(--accent);
}

/* Sections */
.section {
  display: flex;
  flex-direction: column;
  gap: 28px;
}

.sectionHead, .splitHead {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 24px;
  border-bottom: 1px solid var(--line);
  padding-bottom: 18px;
}

.vpsHead, .goldHead, .trendingHead {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 24px;
  border-bottom: 1px solid var(--line);
  padding-bottom: 18px;
}

.section h2 {
  margin: 0;
  font-size: clamp(24px, 3.2vw, 34px);
  line-height: 1.12;
  letter-spacing: -0.028em;
  font-weight: 800;
}

.sectionIntro, .signalIntro p, .bodyText {
  color: var(--muted);
  line-height: 1.65;
  margin: 0;
  max-width: 65ch;
  font-size: 15px;
}

.sectionIntro {
  max-width: 440px;
  text-align: right;
}

/* Application Grid - Bento Style */
.app-container {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.app-group-title {
  font-size: 13px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.15em;
  color: var(--muted-2);
  font-family: var(--font-mono);
  margin-bottom: 4px;
}

.appGrid {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: 16px;
}

.appCard {
  grid-column: span 6;
  min-height: 140px;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 20px;
  align-items: start;
  padding: 24px;
  border-radius: var(--radius-card);
  background: var(--surface);
  border: 1px solid var(--line);
  transition: transform 0.12s ease, background 0.16s ease, border-color 0.16s ease;
}

.appCard:hover {
  transform: translateY(-2px);
  background: var(--surface-strong);
  border-color: rgba(255, 255, 255, 0.12);
}

.appCard:active {
  transform: translateY(-1px);
}

.primaryApp {
  grid-column: span 12;
  background: var(--surface);
  border-color: rgba(45, 212, 191, 0.22);
}

.primaryApp:hover {
  border-color: rgba(45, 212, 191, 0.45);
}

.opsApp {
  grid-column: span 4;
  min-height: 120px;
  background: rgba(14, 22, 38, 0.6);
  padding: 20px;
  gap: 16px;
}

/* App Card Inner Details */
.appCard .icon {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--line);
  color: var(--muted);
  transition: color 0.16s ease, background 0.16s ease;
}

.appCard:hover .icon {
  background: rgba(255, 255, 255, 0.06);
  color: var(--accent);
}

.primaryApp:hover .icon {
  color: var(--accent);
  background: var(--accent-soft);
}

.appCard .icon svg {
  width: 20px;
  height: 20px;
}

.appCopy {
  display: grid;
  gap: 6px;
}

.appCopy strong {
  font-size: 18px;
  letter-spacing: -0.02em;
  color: var(--ink);
}

.primaryApp .appCopy strong {
  font-size: 22px;
  color: var(--ink);
}

.appCopy small {
  color: var(--muted);
  line-height: 1.5;
  font-size: 13.5px;
}

.appCard .open {
  align-self: center;
  display: inline-flex;
  min-height: 32px;
  align-items: center;
  padding: 0 14px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--line);
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  transition: all 0.16s ease;
}

.appCard:hover .open {
  background: var(--accent-soft);
  border-color: rgba(45, 212, 191, 0.2);
  color: var(--accent);
}

/* Signals Section */
.signalIntro {
  display: grid;
  grid-template-columns: 1fr 1.2fr;
  gap: 32px;
  align-items: end;
  border-bottom: 1px solid var(--line);
  padding-bottom: 32px;
}

.signalIntro h2 {
  font-size: clamp(24px, 3.2vw, 34px);
  margin: 0;
}

.signalIntro p:last-child {
  margin: 0;
  align-self: end;
}

/* VPS Status */
.trendingMeta {
  margin: 6px 0 0;
  font-size: 13px;
  color: var(--muted-2);
  font-weight: 600;
  font-family: var(--font-mono);
}

.vpsSource {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  padding: 0 12px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--line);
  color: var(--muted-2);
  font-size: 11px;
  font-weight: 700;
  font-family: var(--font-mono);
}

.vpsGrid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}

.vpsCard {
  padding: 20px;
  border-radius: var(--radius-card);
  background: var(--surface);
  border: 1px solid var(--line);
}

.vpsCard.warn {
  border-color: rgba(245, 158, 11, 0.3);
  background: linear-gradient(180deg, var(--surface), var(--warn-soft));
}

.vpsCard.high {
  border-color: rgba(239, 68, 68, 0.3);
  background: linear-gradient(180deg, var(--surface), var(--bad-soft));
}

.vpsCardTop {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
}

.vpsCardTop span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-family: var(--font-mono);
}

.vpsCardTop b {
  font-size: 28px;
  font-weight: 900;
  letter-spacing: -0.04em;
  font-family: var(--font-mono);
}

.vpsBar {
  height: 6px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
  overflow: hidden;
  margin: 16px 0 12px;
}

.vpsBar span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--accent);
}

.vpsCard.warn .vpsBar span {
  background: var(--warn);
}

.vpsCard.high .vpsBar span {
  background: var(--bad);
}

.vpsCard p {
  margin: 0;
  color: var(--muted-2);
  font-size: 12px;
  font-family: var(--font-mono);
}

/* VPS Logs Terminal */
.vpsLogsContainer {
  margin-top: 16px;
}

.vpsLogsContainer h3 {
  font-size: 12px;
  margin: 0 0 10px;
  color: var(--muted-2);
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-family: var(--font-mono);
}

#vps-hunter-logs {
  margin: 0;
  padding: 16px;
  border-radius: 12px;
  background: #040711;
  border: 1px solid var(--line);
  color: #a3b3cc;
  font-family: var(--font-mono);
  font-size: 12px;
  line-height: 1.6;
  overflow-x: auto;
  overflow-y: auto;
  max-height: 180px;
  min-height: 40px;
  white-space: pre-wrap;
  word-break: break-all;
  scrollbar-width: thin;
  scrollbar-color: var(--line) transparent;
}

/* Gold Watch */
.goldGrid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 20px;
}

.goldCard {
  position: relative;
  overflow: hidden;
  padding: 24px;
  border-radius: var(--radius-card);
  background: var(--surface);
  border: 1px solid rgba(251, 191, 36, 0.15);
}

.goldCard.local {
  border-color: rgba(59, 130, 246, 0.15);
}

.goldCardTop {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.goldCode {
  margin: 0 0 4px;
  color: var(--accent-warm);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.12em;
  font-family: var(--font-mono);
}

.goldCard.local .goldCode {
  color: var(--accent-blue);
}

.goldCard h3 {
  font-size: 20px;
  letter-spacing: -0.02em;
  margin: 0;
  font-weight: 800;
}

.goldBadge {
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--line);
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  font-family: var(--font-mono);
}

.goldPrice {
  font-size: clamp(32px, 4vw, 44px);
  font-weight: 900;
  letter-spacing: -0.04em;
  margin: 20px 0 6px;
  font-family: var(--font-mono);
  color: var(--ink);
}

.goldSub {
  color: var(--muted);
  font-size: 13px;
}

.goldChanges {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-top: 20px;
}

.goldChange {
  padding: 10px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--line);
  font-size: 11px;
  color: var(--muted-2);
  line-height: 1.4;
}

.goldChange b {
  display: block;
  color: var(--muted);
  margin-bottom: 2px;
  font-weight: 700;
}

.goldChange.up {
  color: #a7f3d0;
  border-color: rgba(16, 185, 129, 0.2);
  background: rgba(16, 185, 129, 0.04);
}

.goldChange.up b {
  color: var(--good);
}

.goldChange.down {
  color: #fecaca;
  border-color: rgba(239, 68, 68, 0.2);
  background: rgba(239, 68, 68, 0.04);
}

.goldChange.down b {
  color: var(--bad);
}

.goldChange.flat {
  color: var(--muted-2);
}

.goldSpark {
  width: 100%;
  height: 48px;
  margin-top: 24px;
}

.goldSpark polyline {
  fill: none;
  stroke: var(--accent-warm);
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.goldCard.local .goldSpark polyline {
  stroke: var(--accent-blue);
}

.goldFoot {
  grid-column: 1 / -1;
}

/* AI Test Section (Details) */
details.section {
  display: flex;
  flex-direction: column;
}

details.section summary::-webkit-details-marker {
  display: none;
}

details.section summary {
  display: flex;
  list-style: none;
  cursor: pointer;
  outline: none;
  user-select: none;
  justify-content: space-between;
  align-items: flex-end;
  gap: 24px;
  border-bottom: 1px solid var(--line);
  padding-bottom: 18px;
}

details.section .toggleIcon {
  font-size: 12px;
  color: var(--muted-2);
  transition: transform 0.2s ease, color 0.2s ease;
  margin-left: 10px;
  display: inline-block;
  vertical-align: middle;
}

details.section:hover .toggleIcon {
  color: var(--accent);
}

details.section[open] .toggleIcon {
  transform: rotate(90deg);
}

.aiTestContent {
  margin-top: 24px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.aiTestForm {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}

.aiTestForm label {
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-family: var(--font-mono);
}

.aiTestForm input, .aiTestForm textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: var(--radius-input);
  background: #040711;
  color: var(--ink);
  padding: 12px 14px;
  outline: none;
  transition: border-color 0.16s ease, box-shadow 0.16s ease;
}

.aiTestForm input:focus, .aiTestForm textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.aiPrompt {
  grid-column: 1 / -1;
}

.aiTestForm .btn {
  width: max-content;
}

.aiHint {
  grid-column: span 2;
  margin: 0;
  align-self: center;
  color: var(--muted-2);
  font-size: 12px;
  line-height: 1.5;
}

.terminalWrapper {
  position: relative;
  margin-top: 16px;
}

.terminalHeader {
  background: #0b0f19;
  border: 1px solid var(--line);
  border-bottom: none;
  border-radius: 12px 12px 0 0;
  padding: 8px 16px;
  font-family: var(--font-mono);
  font-size: 11.5px;
  color: var(--muted-2);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.miniBtnCopy {
  background: transparent;
  border: none;
  color: var(--muted-2);
  cursor: pointer;
  font-size: 11.5px;
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 2px 6px;
  border-radius: 4px;
  font-family: var(--font-mono);
}

.miniBtnCopy:hover {
  color: var(--accent);
  background: var(--accent-soft);
}

.aiTestResult {
  white-space: pre-wrap;
  word-break: break-word;
  margin: 0;
  padding: 20px;
  border-radius: 0 0 12px 12px;
  background: #040711;
  border: 1px solid var(--line);
  border-top: none;
  color: #cbd5e1;
  min-height: 120px;
  max-height: 380px;
  overflow: auto;
  font-family: var(--font-mono);
  font-size: 13px;
  line-height: 1.6;
}

.aiTestResult.error {
  color: #fca5a5;
  border-color: rgba(239, 68, 68, 0.2);
  background: rgba(239, 68, 68, 0.05);
}

/* GitHub Trending */
.trendingSelector {
  display: flex;
  gap: 2px;
  background: var(--bg-soft);
  border: 1px solid var(--line);
  padding: 3px;
  border-radius: var(--radius-input);
  margin-left: auto;
  align-items: stretch;
}

.btnPeriod {
  min-height: 28px;
  padding: 0 12px;
  border: none;
  background: transparent;
  color: var(--muted-2);
  font-weight: 700;
  font-size: 12.5px;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btnPeriod:hover {
  color: var(--ink);
  background: rgba(255, 255, 255, 0.04);
}

.btnPeriod.active {
  background: rgba(255, 255, 255, 0.08);
  color: var(--accent);
  font-weight: 800;
}

.trendingSelector .divider {
  width: 1px;
  background: var(--line);
  margin: 4px;
  align-self: stretch;
}

.btnTriggerAI {
  min-height: 28px;
  padding: 0 10px;
  border: none;
  background: transparent;
  color: var(--muted-2);
  font-weight: 700;
  font-size: 12px;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  gap: 4px;
}

.btnTriggerAI:hover:not(:disabled) {
  color: var(--accent);
  background: var(--accent-soft);
}

.btnTriggerAI:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btnTriggerAI.loading {
  animation: pulse 1.5s infinite;
}

@keyframes pulse {
  0% { opacity: 0.6; }
  50% { opacity: 1; }
  100% { opacity: 0.6; }
}

.trendingGrid {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.trendRepo {
  position: relative;
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr) auto;
  align-items: center;
  gap: 16px;
  padding: 16px 56px 16px 20px;
  border-radius: 12px;
  background: var(--surface);
  border: 1px solid var(--line);
  transition: transform 0.12s ease, background 0.16s ease, border-color 0.16s ease;
}

.trendRepo:hover {
  transform: translateX(2px);
  background: var(--surface-strong);
  border-color: rgba(255, 255, 255, 0.1);
}

.trendRank {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  background: var(--bg-soft);
  color: var(--muted);
  display: grid;
  place-items: center;
  font-size: 12px;
  font-weight: 800;
  font-family: var(--font-mono);
  border: 1px solid var(--line);
}

.trendRepoName {
  font-size: 15px;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--ink);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.trendRepoDesc {
  font-size: 13.5px;
  line-height: 1.5;
  color: var(--muted);
  margin-top: 4px;
}

.trendRepoReason {
  font-size: 12px;
  color: var(--accent-warm);
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 6px;
  font-weight: 600;
}

.sparkleIcon {
  flex: none;
}

.trendRepoMeta {
  display: flex;
  align-items: center;
  gap: 14px;
  font-size: 12px;
  color: var(--muted-2);
  font-family: var(--font-mono);
}

.trendLang {
  display: flex;
  align-items: center;
  gap: 6px;
}

.trendLangDot {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  display: inline-block;
}

.trendStat {
  display: inline-flex;
  align-items: center;
  gap: 3px;
}

.trendToday {
  font-weight: 700;
  color: var(--good);
}

.trendBadgeNew {
  display: inline-block;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.04em;
  padding: 1px 6px;
  border-radius: 4px;
  margin-left: 8px;
  vertical-align: middle;
  color: #fff;
  background: var(--accent);
  line-height: 1.6;
}

.trendBadgeHot {
  display: inline-block;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.04em;
  padding: 1px 6px;
  border-radius: 4px;
  margin-left: 8px;
  vertical-align: middle;
  color: #fff;
  background: var(--bad);
  line-height: 1.6;
}

.trendBadgeXịn {
  display: inline-block;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.04em;
  padding: 1px 6px;
  border-radius: 4px;
  margin-left: 8px;
  vertical-align: middle;
  color: #1a2a47;
  background: linear-gradient(90deg, #fbbf24, #f59e0b);
  line-height: 1.6;
}

.btnRepoAI {
  position: absolute;
  right: 16px;
  top: 50%;
  transform: translateY(-50%);
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--line);
  color: var(--muted-2);
  font-size: 12px;
  cursor: pointer;
  transition: all 0.2s ease;
  padding: 0;
  z-index: 2;
}

.btnRepoAI:hover {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: var(--accent);
}

.btnRepoAI.has-summary {
  color: var(--accent-warm);
  border-color: rgba(251, 191, 36, 0.2);
  background: rgba(251, 191, 36, 0.05);
}

.btnRepoAI.has-summary:hover {
  background: var(--accent-warm-soft);
  border-color: var(--accent-warm);
  color: var(--accent-warm);
}

.btnRepoAI.loading {
  animation: spin 1.2s linear infinite;
  cursor: not-allowed;
  background: transparent;
  border-color: var(--accent);
  color: var(--accent);
}

@keyframes spin {
  0% { transform: translateY(-50%) rotate(0deg); }
  100% { transform: translateY(-50%) rotate(360deg); }
}

/* Hugging Face trending */
.hfHead {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  flex-wrap: wrap;
}

/* summary.hfHead: bỏ marker mặc định, giữ cursor pointer */
summary.hfHead {
  cursor: pointer;
  list-style: none;
}
summary.hfHead::-webkit-details-marker {
  display: none;
}
summary.hfHead:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 4px;
  border-radius: 8px;
}

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

.hfTab {
  min-height: 28px;
  padding: 0 12px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--muted);
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  transition: color 0.15s ease, background 0.15s ease, border-color 0.15s ease;
}

.hfTab:hover {
  color: var(--ink);
  background: rgba(255, 255, 255, 0.04);
}

.hfTab.active {
  background: rgba(255, 255, 255, 0.08);
  color: var(--accent);
  border-color: rgba(255, 255, 255, 0.14);
}

.hfGrid {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.hfCard {
  position: relative;
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr) auto;
  align-items: center;
  gap: 16px;
  padding: 16px 20px;
  border-radius: 12px;
  background: var(--surface);
  border: 1px solid var(--line);
  transition: transform 0.12s ease, background 0.16s ease, border-color 0.16s ease;
}

.hfCard:hover {
  transform: translateX(2px);
  background: var(--surface-strong);
  border-color: rgba(255, 255, 255, 0.1);
}

.hfRank {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  background: var(--bg-soft);
  color: var(--muted);
  display: grid;
  place-items: center;
  font-size: 12px;
  font-weight: 800;
  font-family: var(--font-mono);
  border: 1px solid var(--line);
}

.hfMain {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 3px;
  min-width: 0;
}

.hfRepoName {
  font-size: 15px;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--ink);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 100%;
}

.hfUpdated {
  font-size: 12px;
  color: var(--muted-2);
}

.hfRepoDesc {
  font-size: 13.5px;
  line-height: 1.5;
  color: var(--muted);
  margin-top: 4px;
}

.hfRepoReason {
  font-size: 12px;
  color: var(--accent-warm);
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 6px;
  font-weight: 600;
}

.hfMeta {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 12px;
  color: var(--muted-2);
  font-family: var(--font-mono);
  flex-wrap: wrap;
  justify-content: flex-end;
}

.hfPipeline {
  font-size: 11px;
  font-weight: 700;
  color: var(--accent);
  background: rgba(255, 138, 0, 0.08);
  border: 1px solid rgba(255, 138, 0, 0.25);
  padding: 1px 7px;
  border-radius: 999px;
  white-space: nowrap;
}

.hfParam {
  font-size: 11px;
  color: var(--muted);
  white-space: nowrap;
}

.hfStat {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  white-space: nowrap;
}

.hfBadgeNew {
  display: inline-block;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.04em;
  padding: 1px 6px;
  border-radius: 4px;
  margin-left: 8px;
  vertical-align: middle;
  color: #fff;
  background: var(--accent);
  line-height: 1.6;
}

.hfBadgeGated {
  display: inline-block;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.04em;
  padding: 1px 6px;
  border-radius: 4px;
  margin-left: 8px;
  vertical-align: middle;
  color: #fff;
  background: var(--bad);
  line-height: 1.6;
}

/* About / Columns */
.twoCol {
  display: grid;
  grid-template-columns: 0.8fr 1.2fr;
  gap: 32px;
  align-items: start;
}

.twoCol h2 {
  margin: 0;
}

/* Endpoints Status Panel */
.statusPanel {
  display: grid;
  grid-template-columns: 0.7fr 1.3fr;
  gap: 32px;
  align-items: start;
}

.statusList {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}

.statusList a {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 44px;
  padding: 0 16px;
  border-radius: var(--radius-btn);
  background: var(--surface);
  border: 1px solid var(--line);
  color: var(--muted);
  font-weight: 600;
  font-size: 13.5px;
  font-family: var(--font-mono);
}

.statusList a:hover {
  border-color: rgba(255, 255, 255, 0.1);
  background: var(--surface-strong);
  color: var(--ink);
}

.dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--muted-2);
  flex: none;
}

.dot.ok {
  background: var(--good);
  box-shadow: 0 0 8px var(--good);
}

.dot.guarded {
  background: var(--warn);
  box-shadow: 0 0 8px var(--warn);
}

/* PIN Gate Lockscreen */
.pinGate {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: grid;
  place-items: center;
  padding: 24px;
  background-color: var(--bg);
  background-image:
    radial-gradient(circle at 50% 30%, rgba(45, 212, 191, 0.1), transparent 40%),
    linear-gradient(180deg, var(--bg), #04060b);
}

.pinGate[hidden] {
  display: none;
}

.pinBox {
  width: min(400px, 100%);
  padding: 36px;
  border-radius: 20px;
  background: var(--surface);
  border: 1px solid var(--line-strong);
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.pinBox h1 {
  margin: 0;
  font-size: 26px;
  font-weight: 900;
  letter-spacing: -0.03em;
  line-height: 1.1;
  color: var(--ink);
}

.pinBox p {
  margin: 0;
  color: var(--muted);
  font-size: 14.5px;
  line-height: 1.6;
}

.pinBox label {
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-weight: 800;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-family: var(--font-mono);
}

.pinBox input {
  width: 100%;
  min-height: 50px;
  border-radius: var(--radius-input);
  border: 1px solid var(--line);
  background: #040711;
  color: var(--ink);
  padding: 0 16px;
  outline: none;
  font-size: 18px;
  letter-spacing: 0.3em;
  text-align: center;
  transition: border-color 0.16s ease, box-shadow 0.16s ease;
}

.pinBox input::placeholder {
  letter-spacing: 0.3em;
  color: var(--muted-2);
}

.pinBox input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.pinBox .btn {
  width: 100%;
}

.pinError {
  min-height: 20px;
  color: var(--bad) !important;
  font-weight: 700;
  font-size: 13px;
  text-align: center;
  margin: 0 !important;
}

/* Anchors */
h2 .anchor {
  margin-left: 8px;
  color: var(--muted-2);
  font-size: 0.65em;
  font-weight: 400;
  opacity: 0;
  transition: opacity 0.2s ease, color 0.2s ease;
  user-select: none;
}

h2:hover .anchor {
  opacity: 0.6;
}

h2 .anchor:hover {
  opacity: 1;
  color: var(--accent);
}

/* FX Rates Section */
.fxSection {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.fxHead {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 24px;
  flex-wrap: wrap;
}

.fxHead h2 {
  margin: 0;
  font-size: clamp(24px, 3.2vw, 34px);
  font-weight: 800;
  letter-spacing: -0.028em;
  line-height: 1.2;
}

.fxGrid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 16px;
}

.fxCard {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-card);
  padding: 20px 24px;
  transition: border-color 0.2s ease, transform 0.1s ease;
}

.fxCard:hover {
  border-color: var(--line-strong);
  transform: translateY(-1px);
}

.fxCardError {
  border-color: var(--bad);
  background: linear-gradient(180deg, var(--bad-soft), var(--bg-soft));
}

.fxCardTop {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.fxSource {
  font-weight: 700;
  font-size: 14px;
  color: var(--ink);
}

.fxBadge {
  font-size: 10px;
  font-weight: 800;
  padding: 3px 8px;
  border-radius: 999px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.fxBadge.ok {
  background: var(--good-soft);
  color: var(--good);
  border: 1px solid rgba(16, 185, 129, 0.3);
}

.fxBadge.error {
  background: var(--bad-soft);
  color: var(--bad);
  border: 1px solid rgba(239, 68, 68, 0.3);
}

.fxPrice {
  font-size: 28px;
  font-weight: 900;
  font-family: var(--font-mono);
  color: var(--accent);
  line-height: 1.1;
  margin: 4px 0 4px;
}

.fxSub {
  font-size: 12px;
  color: var(--muted);
  margin: 0;
}

.fxDetailGrid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-top: 8px;
}

.fxDetail {
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 14px;
}

.fxDetailLabel {
  display: block;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted-2);
  margin-bottom: 8px;
}

.fxDetailValue {
  display: block;
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 600;
  color: var(--ink);
  margin: 4px 0;
}

.fxError {
  color: var(--bad);
  font-size: 12px;
  margin: 8px 0 0;
}

.fxFoot {
  margin-top: 16px !important;
  font-size: 12px;
  opacity: 0.6;
}

/* Footer */
footer {
  padding: 40px 0 0;
  border-top: 1px solid var(--line);
  text-align: center;
  color: var(--muted-2);
  font-size: 13px;
  font-family: var(--font-mono);
}

/* -- YouTube upload monitor -- */
.ytStats {
  display: flex;
  flex-direction: column;
  gap: 18px;
}
.ytTop {
  display: flex;
  justify-content: space-between;
  align-items: stretch;
  gap: 20px;
  flex-wrap: wrap;
}
.ytQuota {
  flex: 1 1 320px;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.ytQuotaLabel {
  display: flex;
  align-items: baseline;
  gap: 10px;
  font-size: 13px;
  color: var(--muted);
}
.ytQuotaLabel strong {
  color: var(--ink);
  font-size: 15px;
  font-family: var(--font-mono);
}
.ytBadge {
  display: inline-block;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.04em;
  padding: 2px 8px;
  border-radius: 4px;
  vertical-align: middle;
}
.ytBadge.open {
  background: var(--good-soft);
  color: var(--good);
}
.ytBadge.full {
  background: var(--accent-warm-soft);
  color: var(--accent-warm);
}
.ytBadge.new {
  background: var(--accent-soft);
  color: var(--accent-hover);
  margin-left: 8px;
  white-space: nowrap;
}
.ytBar {
  height: 10px;
  background: var(--bg-soft);
  border: 1px solid var(--line);
  border-radius: 999px;
  overflow: hidden;
}
.ytBarFill {
  height: 100%;
  background: linear-gradient(90deg, #14b8a6, var(--accent));
  border-radius: 999px;
  transition: width 0.5s cubic-bezier(0.22, 1, 0.36, 1);
}
@media (prefers-reduced-motion: reduce) {
  .ytBarFill {
    transition: none;
  }
}
.ytSub {
  margin: 0;
  font-size: 12.5px;
  color: var(--muted-2);
}
.ytSub time {
  font-family: var(--font-mono);
  color: var(--muted);
}
.ytSum {
  display: flex;
  gap: 12px;
}
.ytSumItem {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  min-width: 108px;
  padding: 12px 16px;
  background: linear-gradient(180deg, var(--surface), var(--bg-soft));
  border: 1px solid var(--line);
  border-radius: 12px;
}
.ytSumItem strong {
  font-size: 24px;
  line-height: 1.15;
  color: var(--ink);
  font-family: var(--font-mono);
}
.ytSumItem span {
  font-size: 11.5px;
  color: var(--muted-2);
  text-align: center;
}
.ytChart {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 10px;
  padding: 16px 14px 10px;
  background: linear-gradient(180deg, var(--surface), var(--bg-soft));
  border: 1px solid var(--line);
  border-radius: 12px;
}
.ytDay {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  min-width: 0;
}
.ytDayN {
  font-size: 11.5px;
  font-family: var(--font-mono);
  color: var(--muted);
}
.ytDayBar {
  width: 100%;
  max-width: 44px;
  height: 72px;
  display: flex;
  align-items: flex-end;
  background: transparent;
  position: relative;
}
.ytDayBar::after {
  content: "";
  width: 100%;
  height: var(--h, 0%);
  min-height: 3px;
  border-radius: 6px 6px 2px 2px;
  background: rgba(45, 212, 191, 0.55);
  transition: height 0.5s cubic-bezier(0.22, 1, 0.36, 1);
}
@media (prefers-reduced-motion: reduce) {
  .ytDayBar::after {
    transition: none;
  }
}
.ytDay.today .ytDayN {
  color: var(--accent-hover);
  font-weight: 700;
}
.ytDay.today .ytDayBar::after {
  background: linear-gradient(180deg, var(--accent-hover), var(--accent));
}
.ytDayL {
  font-size: 10.5px;
  color: var(--muted-2);
  font-family: var(--font-mono);
  white-space: nowrap;
}
.ytDay.today .ytDayL {
  color: var(--accent);
}
.ytList {
  list-style: none;
  margin: 0;
  padding: 0;
  border-top: 1px solid var(--line);
}
.ytRow {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 4px;
  border-bottom: 1px solid var(--line);
  font-size: 13px;
  min-height: 40px;
}
.ytRow a {
  color: var(--ink);
  text-decoration: none;
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 1;
  -webkit-box-orient: vertical;
  overflow-wrap: anywhere;
}
.ytRow a:hover {
  color: var(--accent-hover);
  text-decoration: underline;
  text-underline-offset: 3px;
}
.ytRow.fresh a {
  color: var(--accent-hover);
}
.ytTime {
  flex: none;
  font-size: 11.5px;
  color: var(--muted-2);
  font-family: var(--font-mono);
}

/* Responsive Overrides */
@media (max-width: 900px) {
  .ytSum {
    flex: 1 1 100%;
  }
  .ytChart {
    gap: 6px;
    padding: 12px 8px 8px;
  }
  .shell {
    gap: 56px;
  }
  .intro {
    grid-template-columns: 1fr;
    gap: 36px;
  }
  .opsPanel {
    max-width: none;
  }
  .sectionHead, .splitHead, .trendingHead, .goldHead, .vpsHead {
    flex-direction: column;
    align-items: flex-start;
    gap: 16px;
  }
  .sectionIntro {
    text-align: left;
    max-width: none;
  }
  .appGrid {
    grid-template-columns: 1fr;
  }
  .appCard, .primaryApp, .opsApp {
    grid-column: span 12;
  }
  .signalIntro, .twoCol, .statusPanel {
    grid-template-columns: 1fr;
    gap: 24px;
  }
  .vpsGrid, .goldGrid, .statusList {
    grid-template-columns: 1fr;
  }
  .trendRepo {
    grid-template-columns: 36px minmax(0, 1fr);
    padding-right: 50px;
  }
  .trendRepoMeta {
    grid-column: 2;
    flex-wrap: wrap;
    gap: 8px 12px;
    margin-top: 4px;
  }
  .aiTestForm {
    grid-template-columns: 1fr;
  }
  .aiHint {
    grid-column: span 1;
  }
  .trendingSelector {
    width: 100%;
    margin-top: 4px;
    justify-content: space-between;
  }
  .btnPeriod {
    flex: 1;
    text-align: center;
  }
  .trendRepo, .hfCard {
    grid-template-columns: 32px minmax(0, 1fr);
    gap: 12px;
    padding: 14px 14px;
  }
  .trendRepo {
    padding-right: 14px;
  }
  .trendRepoMeta, .hfMeta {
    grid-column: 2;
    justify-content: flex-start;
    margin-top: 2px;
  }
  .btnRepoAI {
    grid-column: 2;
    justify-self: start;
    margin-top: 6px;
    position: static;
    transform: none;
  }
  .hunterLog {
    max-height: 140px;
  }
}

@media (max-width: 560px) {
  .shell {
    padding-left: 16px;
    padding-right: 16px;
    gap: 56px;
  }
  .nav {
    flex-wrap: wrap;
    row-gap: 12px;
    padding-bottom: 16px;
  }
  .navStatus {
    margin-left: auto;
  }
  .navlinks {
    width: 100%;
    justify-content: flex-start;
    flex-wrap: wrap;
    gap: 4px;
  }
  .navlinks a {
    padding: 8px 12px;
    font-size: 13px;
    min-height: 40px;
  }
  .intro h1 {
    font-size: 30px;
  }
  .intro h2 {
    font-size: 16px;
  }
  .actions .btn {
    width: 100%;
    min-height: 46px;
  }
  .appCard {
    grid-template-columns: 1fr;
    gap: 14px;
  }
  .appCard .open {
    width: 100%;
    min-height: 44px;
  }
  .goldChanges {
    grid-template-columns: 1fr;
  }
  .goldPrice {
    font-size: 28px;
  }
  .trendRepo, .hfCard {
    padding: 12px 12px;
    gap: 10px;
    border-radius: 10px;
  }
  .trendRank, .hfRank {
    width: 26px;
    height: 26px;
    font-size: 11px;
  }
  .trendRepoName, .hfRepoName {
    font-size: 13.5px;
    word-break: break-word;
  }
  .hfRepoDesc {
    font-size: 12.5px;
  }
  .hfTab {
    flex: 1 1 auto;
    min-height: 42px;
    justify-content: center;
  }
  .btnRepoAI {
    width: 40px;
    height: 40px;
    font-size: 16px;
  }
  .btnPeriod {
    min-height: 44px;
  }
  .section {
    padding-top: 40px;
  }
  .statCards {
    grid-template-columns: 1fr;
  }
  .statusPanel {
    padding: 16px;
  }
  h2 {
    font-size: 20px;
  }
  .hfLatest, .trendingMeta {
    font-size: 12px;
  }
  .vpsCard {
    padding: 14px;
  }
  .statusList a {
    min-height: 42px;
    padding: 0 12px;
    gap: 8px;
  }
  .statusPanel {
    padding: 14px;
  }
  .goldPanel, .fxPanel {
    padding: 16px;
  }
}

/* Reduced Motion */
@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
  *, *::before, *::after {
    transition: none !important;
    animation: none !important;
  }
}
