:root {
  color-scheme: dark;
  --bg: #030712;
  --card: #080d1a;
  --card-hover: #0e1629;
  --card-inner: #050813;
  --border: #131d31;
  --border-light: #1e2d4a;
  --fg: #f1f5f9;
  --mute: #94a3b8;
  --dim: #50617a;
  --accent: #38bdf8;
  --accent-glow: rgba(56, 189, 248, 0.2);
  --accent-subtle: rgba(56, 189, 248, 0.08);
  --accent-border: rgba(56, 189, 248, 0.28);
  --accent-deep: #0284c7;
  --ok: #10b981;
  --ok-bg: rgba(16, 185, 129, 0.08);
  --ok-border: rgba(16, 185, 129, 0.22);
  --err: #f43f5e;
  --err-bg: rgba(244, 63, 94, 0.08);
  --err-border: rgba(244, 63, 94, 0.22);
  --warn: #fbbf24;
  --warn-bg: rgba(251, 191, 36, 0.08);
  --warn-border: rgba(251, 191, 36, 0.22);
  --info: #38bdf8;
  --sans: "Geist", Inter, system-ui, -apple-system, sans-serif;
  --mono: "Geist Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  box-sizing: border-box;
}

*, *::before, *::after {
  box-sizing: inherit;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
  scroll-padding-top: 76px;
}

body {
  min-height: 100vh;
  background-color: var(--bg);
  color: var(--fg);
  font: 14px/1.6 var(--sans);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  position: relative;
  overflow-x: hidden;
}

body.modal-open {
  overflow: hidden;
}

::selection {
  background: rgba(56, 189, 248, 0.25);
  color: #fff;
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.tech-grid {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background-image: 
    linear-gradient(rgba(56, 189, 248, 0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(56, 189, 248, 0.03) 1px, transparent 1px);
  background-size: 32px 32px;
  -webkit-mask-image: radial-gradient(ellipse 80% 60% at 50% 0%, black 30%, transparent 85%);
  mask-image: radial-gradient(ellipse 80% 60% at 50% 0%, black 30%, transparent 85%);
}

.ambient-glow {
  position: fixed;
  top: -160px;
  left: 50%;
  transform: translateX(-50%);
  width: 760px;
  height: 380px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(56, 189, 248, 0.12) 0%, rgba(37, 99, 235, 0.06) 45%, transparent 70%);
  filter: blur(80px);
  pointer-events: none;
  z-index: 0;
}

.wrap {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 20px;
  position: relative;
  z-index: 1;
}

.app-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(3, 7, 18, 0.85);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border);
}

.header-content {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  height: 60px;
}

.header-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
}

.brand-avatar-box {
  position: relative;
  width: 28px;
  height: 28px;
  border-radius: 8px;
  background: #0a1120;
  border: 1px solid var(--border-light);
  overflow: hidden;
  display: grid;
  place-items: center;
}

.brand-avatar {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.brand-pulse {
  position: absolute;
  bottom: -1px;
  right: -1px;
  width: 7px;
  height: 7px;
  background: var(--accent);
  border-radius: 50%;
  box-shadow: 0 0 8px var(--accent);
}

.brand-titles {
  display: flex;
  align-items: center;
  gap: 8px;
}

.brand-name {
  font-weight: 700;
  font-size: 14px;
  letter-spacing: -0.01em;
  color: var(--fg);
}

.brand-hub-tag {
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 600;
  color: var(--accent);
  background: var(--accent-subtle);
  border: 1px solid var(--accent-border);
  padding: 1px 6px;
  border-radius: 4px;
  letter-spacing: 0.04em;
}

.header-center {
  display: flex;
  align-items: center;
}

.status-indicator-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 10px;
  border-radius: 999px;
  background: var(--ok-bg);
  border: 1px solid var(--ok-border);
  font-family: var(--mono);
  font-size: 11px;
  color: var(--ok);
}

.indicator-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--ok);
  box-shadow: 0 0 8px var(--ok);
  animation: pulse-ring 2s infinite ease-in-out;
}

@keyframes pulse-ring {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(0.8); opacity: 0.5; }
}

.discord-action-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 32px;
  padding: 0 13px;
  border-radius: 6px;
  font: 500 13px var(--sans);
  text-decoration: none;
  background: #0d1527;
  color: var(--fg);
  border: 1px solid var(--border-light);
  cursor: pointer;
  transition: all 0.15s ease;
}

.discord-action-btn:hover {
  background: #141f38;
  border-color: var(--accent);
  color: #fff;
  box-shadow: 0 0 12px var(--accent-subtle);
  transform: translateY(-1px);
}

.hero-section {
  padding: 44px 0 28px;
}

.hero-topline {
  margin-bottom: 12px;
}

.terminal-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 9px;
  border-radius: 6px;
  background: rgba(56, 189, 248, 0.05);
  border: 1px solid var(--border);
  font: 600 11px/1 var(--mono);
  color: var(--mute);
  letter-spacing: 0.05em;
}

.terminal-badge svg {
  color: var(--accent);
}

.hero-title {
  margin: 0 0 10px;
  font-size: clamp(32px, 5vw, 48px);
  line-height: 1.1;
  letter-spacing: -0.04em;
  font-weight: 800;
  color: #fff;
}

.hero-accent {
  background: linear-gradient(135deg, #ffffff 40%, var(--accent) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.hero-desc {
  max-width: 60ch;
  color: var(--mute);
  font-size: 15px;
  line-height: 1.55;
  margin: 0 0 24px;
}

.metrics-dashboard {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-bottom: 24px;
}

.metric-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  transition: border-color 0.15s, background 0.15s, transform 0.15s;
}

.metric-card:hover {
  border-color: var(--border-light);
  background: var(--card-hover);
  transform: translateY(-1px);
}

.metric-head {
  display: flex;
  align-items: center;
  gap: 7px;
}

.metric-icon {
  width: 22px;
  height: 22px;
  border-radius: 5px;
  display: grid;
  place-items: center;
  background: #0d1526;
  border: 1px solid var(--border);
  color: var(--accent);
  flex-shrink: 0;
}

.metric-icon.icon-ok {
  color: var(--ok);
  background: var(--ok-bg);
  border-color: var(--ok-border);
}

.metric-icon.icon-err {
  color: var(--err);
  background: var(--err-bg);
  border-color: var(--err-border);
}

.metric-icon.icon-warn {
  color: var(--warn);
  background: var(--warn-bg);
  border-color: var(--warn-border);
}

.metric-name {
  font-size: 12px;
  font-weight: 500;
  color: var(--mute);
}

.metric-body {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
}

.metric-num {
  font: 700 22px/1.1 var(--mono);
  color: var(--fg);
}

.metric-num.num-ok { color: var(--ok); }
.metric-num.num-err { color: var(--err); }
.metric-num.num-warn { color: var(--warn); }

.status-pill-sub {
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 600;
  padding: 2px 6px;
  border-radius: 4px;
  text-transform: uppercase;
}

.status-pill-sub.ok {
  background: var(--ok-bg);
  border: 1px solid var(--ok-border);
  color: var(--ok);
}

.status-pill-sub.err {
  background: var(--err-bg);
  border: 1px solid var(--err-border);
  color: var(--err);
}

.status-pill-sub.warn {
  background: var(--warn-bg);
  border: 1px solid var(--warn-border);
  color: var(--warn);
}

.command-toolbar {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 12px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 10px;
}

.toolbar-search-row {
  display: flex;
  gap: 10px;
}

.search-field {
  position: relative;
  flex: 1;
}

.field-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--dim);
  pointer-events: none;
}

.search-input {
  width: 100%;
  height: 38px;
  padding: 0 40px 0 36px;
  background: var(--card-inner);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--fg);
  font: 13px/1.4 var(--sans);
  transition: all 0.15s ease;
}

.search-input::placeholder {
  color: var(--dim);
}

.search-input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-glow);
}

.field-kbd {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  padding: 2px 6px;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: #0d1527;
  color: var(--accent);
  font: 11px var(--mono);
  pointer-events: none;
}

.filter-select-wrap {
  flex-shrink: 0;
}

.filter-dropdown {
  height: 38px;
  padding: 0 14px;
  background: var(--card-inner);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--fg);
  font: 500 13px var(--sans);
  cursor: pointer;
  transition: border-color 0.15s ease;
}

.filter-dropdown:focus {
  outline: none;
  border-color: var(--accent);
}

.platform-segmented-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding-top: 4px;
  border-top: 1px solid rgba(56, 189, 248, 0.06);
}

.platform-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 30px;
  padding: 0 12px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--mute);
  border-radius: 6px;
  font: 500 12px/1 var(--sans);
  cursor: pointer;
  transition: all 0.15s ease;
}

.platform-btn svg {
  flex-shrink: 0;
  color: var(--dim);
  transition: color 0.15s;
}

.platform-btn:hover {
  background: rgba(56, 189, 248, 0.06);
  color: var(--fg);
}

.platform-btn:hover svg {
  color: var(--accent);
}

.platform-btn.active {
  background: #101c36;
  border-color: var(--accent-border);
  color: #fff;
  font-weight: 600;
  box-shadow: 0 0 10px rgba(56, 189, 248, 0.12);
}

.platform-btn.active svg {
  color: var(--accent);
}

.platform-section {
  margin-top: 36px;
}

.section-headline {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}

.section-badge {
  display: inline-flex;
  align-items: center;
  gap: 7px;
}

.badge-icon {
  display: grid;
  place-items: center;
  color: var(--accent);
}

.badge-title {
  font-size: 15px;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--fg);
}

.section-count-tag {
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 600;
  color: var(--accent);
  background: var(--card);
  border: 1px solid var(--border);
  padding: 2px 8px;
  border-radius: 999px;
}

.cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 14px;
}

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 0.22s ease, transform 0.22s ease, border-color 0.15s, background 0.15s;
}

.card.visible {
  opacity: 1;
  transform: translateY(0);
}

.card:hover {
  border-color: var(--border-light);
  background: var(--card-hover);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4), 0 0 15px rgba(56, 189, 248, 0.05);
}

.card.has-warning {
  border-color: var(--warn-border);
}

.card-header {
  display: flex;
  align-items: center;
  gap: 12px;
}

.card-avatar-box {
  width: 44px;
  height: 44px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--card-inner);
  overflow: hidden;
  flex-shrink: 0;
  display: grid;
  place-items: center;
}

.card-avatar-box img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.card-info {
  min-width: 0;
  flex: 1;
}

.card-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.card-name {
  font-size: 15px;
  font-weight: 700;
  color: var(--fg);
  letter-spacing: -0.01em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.rating-badge {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 2px 6px;
  background: rgba(56, 189, 248, 0.08);
  border: 1px solid var(--accent-border);
  border-radius: 4px;
  color: var(--accent);
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 600;
  flex-shrink: 0;
}

.card-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 4px;
}

.card-os-tag {
  font-family: var(--mono);
  font-size: 9px;
  font-weight: 600;
  color: var(--dim);
  background: var(--card-inner);
  border: 1px solid var(--border);
  padding: 1px 5px;
  border-radius: 3px;
}

.security-warning {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 5px 8px;
  background: var(--warn-bg);
  border: 1px solid var(--warn-border);
  border-radius: 6px;
  color: var(--warn);
  font: 500 11px/1 var(--sans);
}

.security-warning svg {
  flex-shrink: 0;
}

.version-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: auto;
  padding-top: 10px;
  border-top: 1px solid var(--border);
}

.version-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 6px 10px;
  border-radius: 6px;
  background: var(--card-inner);
  border: 1px solid var(--border);
}

.version-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  overflow: hidden;
}

.tier-chip {
  font-family: var(--mono);
  font-size: 9px;
  font-weight: 700;
  padding: 2px 5px;
  border-radius: 4px;
  letter-spacing: 0.05em;
  flex-shrink: 0;
}

.tier-chip.tier-global {
  background: rgba(56, 189, 248, 0.12);
  color: var(--accent);
  border: 1px solid var(--accent-border);
}

.tier-chip.tier-vng {
  background: rgba(99, 102, 241, 0.12);
  color: #a5b4fc;
  border: 1px solid rgba(99, 102, 241, 0.28);
}

.v-code {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--mute);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.status-indicator {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-family: var(--mono);
  font-size: 11px;
  white-space: nowrap;
}

.live-dot-mini {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  flex-shrink: 0;
}

.status-indicator.status-working {
  color: var(--ok);
}
.status-indicator.status-working .live-dot-mini {
  background: var(--ok);
  box-shadow: 0 0 6px var(--ok);
}

.status-indicator.status-down {
  color: var(--err);
}
.status-indicator.status-down .live-dot-mini {
  background: var(--err);
}

.status-indicator.status-updating {
  color: var(--warn);
}
.status-indicator.status-updating .live-dot-mini {
  background: var(--warn);
}

.action-btn {
  height: 30px;
  padding: 0 12px;
  border-radius: 6px;
  font: 600 12px/1 var(--sans);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  white-space: nowrap;
  transition: all 0.15s ease;
  flex-shrink: 0;
}

.action-btn.btn-primary {
  background: var(--accent);
  color: #030712;
  border: 1px solid var(--accent);
}

.action-btn.btn-primary:hover:not(:disabled) {
  background: #7dd3fc;
  border-color: #7dd3fc;
  box-shadow: 0 0 12px rgba(56, 189, 248, 0.35);
}

.action-btn.btn-vng {
  background: #0d1526;
  color: var(--fg);
  border: 1px solid var(--border-light);
}

.action-btn.btn-vng:hover:not(:disabled) {
  background: #15223c;
  border-color: var(--accent);
  color: #fff;
}

.action-btn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.empty-state {
  margin: 48px auto;
  max-width: 420px;
  text-align: center;
  padding: 36px 20px;
  border: 1px dashed var(--border-light);
  border-radius: 10px;
  background: var(--card);
}

.empty-icon-box {
  display: grid;
  place-items: center;
  color: var(--dim);
  margin-bottom: 12px;
}

.empty-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--fg);
  margin-bottom: 4px;
}

.empty-desc {
  font-size: 13px;
  color: var(--mute);
}

.app-footer {
  margin-top: 64px;
  padding: 32px 0 48px;
  border-top: 1px solid var(--border);
}

.footer-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
}

.footer-brand-mark {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  font-size: 14px;
  color: var(--fg);
}

.footer-brand-mark img {
  border-radius: 6px;
}

.footer-tagline {
  font-size: 12px;
  color: var(--dim);
  font-family: var(--mono);
}

.footer-bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  font-size: 12px;
  color: var(--dim);
}

.disclaimer {
  color: #334155;
}

.download-modal {
  position: fixed;
  inset: 0;
  z-index: 999;
  display: grid;
  place-items: center;
  background: rgba(3, 7, 18, 0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  padding: 20px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}

.download-modal.open {
  opacity: 1;
  pointer-events: auto;
}

.download-dialog {
  position: relative;
  width: 100%;
  max-width: 430px;
  background: var(--card);
  border: 1px solid var(--border-light);
  border-radius: 12px;
  padding: 24px;
  box-shadow: 0 24px 50px rgba(0, 0, 0, 0.9), 0 0 30px rgba(56, 189, 248, 0.08);
}

.modal-close {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--mute);
  cursor: pointer;
  font-size: 18px;
  line-height: 1;
  transition: all 0.15s ease;
}

.modal-close:hover {
  color: #fff;
  border-color: var(--accent);
  background: #0d1527;
}

.modal-badge {
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 700;
  color: var(--accent);
  letter-spacing: 0.06em;
  margin-bottom: 6px;
}

#download-title {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--fg);
  margin-bottom: 6px;
}

.modal-desc {
  font-size: 13px;
  color: var(--mute);
  margin-bottom: 18px;
}

.modal-target-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  background: var(--card-inner);
  border: 1px solid var(--border);
  border-radius: 8px;
  margin-bottom: 18px;
}

.target-logo {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  object-fit: cover;
  border: 1px solid var(--border);
}

.target-meta {
  display: flex;
  flex-direction: column;
}

.target-label {
  font-family: var(--mono);
  font-size: 10px;
  color: var(--dim);
}

.target-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--fg);
}

.modal-action-grid {
  display: grid;
  gap: 10px;
}

.modal-btn-option {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--card-inner);
  color: var(--fg);
  cursor: pointer;
  text-align: left;
  transition: all 0.15s ease;
}

.modal-btn-option:hover {
  border-color: var(--accent);
  background: #0d1527;
  transform: translateY(-1px);
}

.btn-opt-icon {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  background: #0f1a30;
  border: 1px solid var(--border-light);
  display: grid;
  place-items: center;
  color: var(--accent);
  flex-shrink: 0;
}

.btn-opt-copy {
  display: flex;
  flex-direction: column;
}

.btn-opt-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--fg);
}

.btn-opt-sub {
  font-size: 12px;
  color: var(--mute);
  margin-top: 2px;
}

.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(16px);
  background: #080d1a;
  border: 1px solid var(--border-light);
  color: var(--fg);
  padding: 8px 18px;
  border-radius: 999px;
  display: flex;
  align-items: center;
  gap: 8px;
  font: 500 13px var(--sans);
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.7), 0 0 15px rgba(56, 189, 248, 0.15);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
  z-index: 1000;
}

.toast.show {
  opacity: 1;
  pointer-events: auto;
  transform: translateX(-50%) translateY(0);
}

.toast-indicator {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 8px var(--accent);
}

@media (max-width: 860px) {
  .metrics-dashboard {
    grid-template-columns: repeat(2, 1fr);
  }
  .header-center {
    display: none;
  }
}

@media (max-width: 640px) {
  .wrap {
    padding: 0 14px;
  }
  .toolbar-search-row {
    flex-direction: column;
  }
  .filter-dropdown {
    width: 100%;
  }
  .cards-grid {
    grid-template-columns: 1fr;
  }
  .footer-top,
  .footer-bottom {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }
}

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