:root {
  --brand: #22c55e;
  --brand-rgb: 34, 197, 94;
}

html {
  scroll-padding-top: 5.5rem;
}

@media (prefers-reduced-motion: no-preference) {
  html {
    scroll-behavior: smooth;
  }
}

body {
  background: #050505;
  color: #fff;
  font-family: Inter, system-ui, sans-serif;
}

::selection {
  background: rgba(var(--brand-rgb), .35);
}

.glass {
  background: rgba(10, 10, 10, .72);
  border: 1px solid rgba(255, 255, 255, .10);
  box-shadow: 0 20px 80px rgba(0, 0, 0, .35);
  backdrop-filter: blur(18px);
}

.soft-border {
  border: 1px solid rgba(255, 255, 255, .10);
}

.glow {
  box-shadow: 0 0 80px rgba(var(--brand-rgb), .08);
}

.grid-bg {
  background-image:
    linear-gradient(rgba(255, 255, 255, .025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, .025) 1px, transparent 1px);
  background-size: 42px 42px;
  mask-image: linear-gradient(to bottom, black 0%, transparent 85%);
}

.container-custom {
  width: 100%;
  max-width: 1280px;
  margin-inline: auto;
  padding-inline: clamp(1.25rem, 4vw, 3rem);
}

.edge-container {
  width: 100%;
  padding-inline: clamp(1.25rem, 4vw, 3.5rem);
}

/* Botões */
.btn-primary {
  background: var(--brand);
  color: #04130a;
  transition: transform .15s ease, box-shadow .15s ease, background .15s ease;
}

.btn-primary:hover {
  background: #4ade80;
  box-shadow: 0 8px 30px rgba(var(--brand-rgb), .25);
}

.btn-primary:active {
  transform: scale(.98);
}

.icon-tile {
  background: rgba(var(--brand-rgb), .10);
  border: 1px solid rgba(var(--brand-rgb), .25);
  color: var(--brand);
}

/* Menu lateral */
.side-link {
  display: flex;
  align-items: center;
  gap: .875rem;
  border-radius: .9rem;
  padding: .8rem 1rem;
  font-size: .9rem;
  font-weight: 600;
  color: rgba(255, 255, 255, .75);
  transition: background .15s ease, color .15s ease;
}

.side-link:hover {
  background: rgba(255, 255, 255, .06);
  color: #fff;
}

/* Menu desktop */
.nav-link {
  border-radius: .75rem;
  padding: .5rem .85rem;
  font-size: .875rem;
  font-weight: 600;
  color: rgba(255, 255, 255, .55);
  transition: color .15s ease, background .15s ease;
}

.nav-link:hover,
.nav-link.active {
  color: #fff;
}

.nav-link.active {
  background: rgba(var(--brand-rgb), .10);
  color: var(--brand);
}

body.menu-open {
  overflow: hidden;
}

/* Acessibilidade */
:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 2px;
}

.skip-link {
  position: fixed;
  left: 1rem;
  top: -4rem;
  z-index: 100;
  border-radius: .75rem;
  background: var(--brand);
  padding: .6rem 1rem;
  font-weight: 700;
  color: #04130a;
  transition: top .15s ease;
}

.skip-link:focus {
  top: 1rem;
}

/* Interações */
.js .reveal {
  opacity: 0;
  transform: translateY(18px);
  transition: opacity .6s ease, transform .6s ease;
  transition-delay: var(--d, 0s);
}

.js .reveal.in {
  opacity: 1;
  transform: none;
}

.spot {
  position: relative;
  overflow: hidden;
  transition: border-color .2s ease, transform .2s ease;
}

.spot::before {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(320px circle at var(--mx, 50%) var(--my, 0%), rgba(var(--brand-rgb), .12), transparent 70%);
  opacity: 0;
  transition: opacity .25s ease;
  pointer-events: none;
}

.spot:hover {
  border-color: rgba(var(--brand-rgb), .35);
  transform: translateY(-2px);
}

.spot:hover::before {
  opacity: 1;
}

.pulse-dot {
  animation: pulse-dot 2s ease-out infinite;
}

@keyframes pulse-dot {
  0% { box-shadow: 0 0 0 0 rgba(var(--brand-rgb), .6); }
  100% { box-shadow: 0 0 0 10px rgba(var(--brand-rgb), 0); }
}

/* Painel demonstrativo (seção Para devs) */
.pn-root {
  background: #0e0e11;
  border: 1px solid rgba(255, 255, 255, .08);
  box-shadow: 0 30px 100px rgba(0, 0, 0, .5);
}

.pn-side {
  background: #0b0b0d;
  border-right: 1px solid rgba(255, 255, 255, .06);
}

.pn-group {
  padding: .9rem .75rem .35rem;
  font-size: .75rem;
  font-weight: 600;
  color: rgba(255, 255, 255, .4);
}

.pn-item {
  display: flex;
  width: 100%;
  align-items: center;
  gap: .75rem;
  border-radius: .6rem;
  padding: .5rem .75rem;
  text-align: left;
  font-weight: 500;
  color: rgba(255, 255, 255, .8);
  transition: background .15s ease, color .15s ease;
}

.pn-item i {
  width: 1rem;
  text-align: center;
  font-size: .8rem;
}

.pn-item:hover {
  background: rgba(255, 255, 255, .05);
}

.pn-item.active {
  background: rgba(255, 255, 255, .06);
  color: #3b82f6;
}

.pn-card {
  min-width: 0;
  background: #17171a;
  border: 1px solid rgba(255, 255, 255, .06);
  border-radius: 1.1rem;
}

.pn-pill {
  display: inline-flex;
  max-width: 100%;
  align-items: center;
  gap: .5rem;
  border-radius: .8rem;
  background: #17171a;
  border: 1px solid rgba(255, 255, 255, .06);
  padding: .6rem 1rem;
  color: rgba(255, 255, 255, .9);
}

.pn-pill i {
  color: rgba(255, 255, 255, .75);
}

.pn-btn {
  border-radius: .6rem;
  padding: .55rem 1.1rem;
  font-size: .875rem;
  font-weight: 700;
  color: #fff;
  transition: filter .15s ease, opacity .15s ease, transform .1s ease;
}

.pn-btn:hover:not(:disabled) {
  filter: brightness(1.2);
}

.pn-btn:active:not(:disabled) {
  transform: scale(.96);
}

.pn-btn:disabled {
  cursor: not-allowed;
  opacity: .35;
}

.pn-start { background: #15803d; }
.pn-restart { background: #26263a; }
.pn-stop { background: #991b1b; }

.pn-status {
  display: inline-flex;
  align-items: center;
  gap: .45rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, .05);
  padding: .25rem .7rem;
  font-size: .7rem;
  font-weight: 600;
  color: rgba(255, 255, 255, .6);
}

.pn-dot {
  width: .5rem;
  height: .5rem;
  border-radius: 50%;
  background: #71717a;
}

.pn-status[data-state="running"] .pn-dot { background: var(--brand); }
.pn-status[data-state="starting"] .pn-dot,
.pn-status[data-state="stopping"] .pn-dot { background: #f59e0b; animation: blink .8s ease-in-out infinite; }

@keyframes blink {
  50% { opacity: .25; }
}

.pn-stat {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1rem 1.25rem;
}

.pn-ico {
  display: flex;
  width: 2.75rem;
  height: 2.75rem;
  flex-shrink: 0;
  align-items: center;
  justify-content: center;
  border-radius: .8rem;
}

.pn-label {
  display: block;
  font-size: .8rem;
  font-weight: 600;
  color: rgba(255, 255, 255, .85);
}

.pn-val {
  display: block;
  font-size: 1.15rem;
  font-weight: 700;
}

.pn-term {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: .72rem;
  line-height: 1.15rem;
  scrollbar-width: thin;
}

.pn-banner {
  margin: .25rem 0 0;
  width: max-content;
  max-width: 100%;
  font-size: clamp(.55rem, 2.4vw, .95rem);
  line-height: 1.05;
  background: linear-gradient(180deg, #a855f7 0%, #38bdf8 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.pn-ver {
  margin-bottom: .5rem;
  font-size: .68rem;
  color: rgba(255, 255, 255, .3);
}

.pn-line {
  display: flex;
  gap: .6rem;
  white-space: pre-wrap;
  word-break: break-word;
}

.pn-time { flex-shrink: 0; color: rgba(255, 255, 255, .3); }
.pn-lvl { width: 2.6rem; flex-shrink: 0; font-weight: 700; }
.pn-lvl.INFO { color: #22d3ee; }
.pn-lvl.OK { color: #84cc16; }
.pn-lvl.WARN { color: #fbbf24; }
.pn-lvl.ERR { color: #f87171; }
.pn-lvl.CMD { color: #a78bfa; }

.pn-input {
  border-top: 1px solid rgba(255, 255, 255, .06);
}

.pn-input input:disabled {
  cursor: not-allowed;
  opacity: .5;
}

.pn-chart {
  display: flex;
  gap: .5rem;
  height: 7.5rem;
}

.pn-y {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-width: 3.6rem;
  text-align: right;
  font-size: .62rem;
  color: rgba(255, 255, 255, .4);
}

.pn-chart svg {
  flex: 1;
  min-width: 0;
  height: 100%;
  overflow: visible;
}

.pn-chart .grid { stroke: rgba(255, 255, 255, .12); stroke-width: 1; vector-effect: non-scaling-stroke; }
.pn-chart .line { fill: none; stroke: #3b82f6; stroke-width: 2; stroke-linejoin: round; vector-effect: non-scaling-stroke; }
.pn-chart .area { fill: rgba(99, 102, 241, .35); }

.pn-toast {
  position: absolute;
  left: 50%;
  bottom: 1rem;
  z-index: 5;
  max-width: calc(100% - 2rem);
  transform: translate(-50%, 1rem);
  border: 1px solid rgba(var(--brand-rgb), .4);
  border-radius: .8rem;
  background: #0b0b0d;
  padding: .6rem 1rem;
  font-size: .8rem;
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s ease, transform .2s ease;
}

.pn-toast.show {
  opacity: 1;
  transform: translate(-50%, 0);
}

@media (max-width: 639px) {
  .pn-time { display: none; }
  .pn-stat { gap: .6rem; padding: .8rem; }
  .pn-ico { width: 2.2rem; height: 2.2rem; border-radius: .65rem; }
  .pn-val { font-size: .95rem; white-space: nowrap; }
  .pn-label { font-size: .7rem; }
  .pn-y { min-width: 3rem; }
}

/* FAQ */
.faq summary {
  cursor: pointer;
  list-style: none;
}

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

.faq details[open] summary i {
  transform: rotate(45deg);
  color: var(--brand);
}

.faq summary i {
  transition: transform .2s ease, color .2s ease;
}

.faq details[open] {
  border-color: rgba(var(--brand-rgb), .35);
}

/* Cookies */
dialog.dlg {
  margin: auto;
  width: calc(100% - 2rem);
  max-width: 30rem;
  border: 1px solid rgba(255, 255, 255, .12);
  border-radius: 1.5rem;
  background: #0a0a0a;
  padding: 0;
  color: #fff;
}

dialog.dlg::backdrop {
  background: rgba(0, 0, 0, .7);
  backdrop-filter: blur(4px);
}

.switch {
  position: relative;
  flex-shrink: 0;
  width: 2.75rem;
  height: 1.5rem;
  appearance: none;
  border-radius: 999px;
  background: rgba(255, 255, 255, .15);
  cursor: pointer;
  transition: background .2s ease;
}

.switch::after {
  content: "";
  position: absolute;
  left: .2rem;
  top: .2rem;
  width: 1.1rem;
  height: 1.1rem;
  border-radius: 50%;
  background: #fff;
  transition: transform .2s ease;
}

.switch:checked {
  background: var(--brand);
}

.switch:checked::after {
  transform: translateX(1.25rem);
  background: #04130a;
}

.switch:disabled {
  cursor: not-allowed;
  opacity: .6;
}

/* Páginas legais */
.legal h2 {
  margin-top: 2.5rem;
  margin-bottom: .75rem;
  font-size: 1.35rem;
  font-weight: 700;
  letter-spacing: -.02em;
}

.legal h3 {
  margin-top: 1.5rem;
  margin-bottom: .5rem;
  font-weight: 700;
  color: rgba(255, 255, 255, .9);
}

.legal p,
.legal li {
  line-height: 1.75;
  color: rgba(255, 255, 255, .62);
}

.legal p {
  margin-top: .75rem;
}

.legal ul {
  margin-top: .75rem;
  padding-left: 1.25rem;
  list-style: disc;
}

.legal li {
  margin-top: .35rem;
}

.legal li::marker {
  color: var(--brand);
}

.legal a:not(.btn-primary) {
  color: var(--brand);
  text-underline-offset: 3px;
}

.legal a:not(.btn-primary):hover {
  text-decoration: underline;
}

.legal strong {
  color: #fff;
}

.legal .table-wrap {
  margin-top: 1rem;
  overflow-x: auto;
  border: 1px solid rgba(255, 255, 255, .10);
  border-radius: 1rem;
}

.legal table {
  width: 100%;
  min-width: 34rem;
  border-collapse: collapse;
  font-size: .875rem;
}

.legal th,
.legal td {
  border-bottom: 1px solid rgba(255, 255, 255, .08);
  padding: .75rem 1rem;
  text-align: left;
  vertical-align: top;
  color: rgba(255, 255, 255, .62);
}

.legal th {
  color: #fff;
  font-weight: 700;
}

.legal tr:last-child td {
  border-bottom: 0;
}

/* Dado legal ainda não preenchido em script.js */
.legal-missing {
  border-radius: .35rem;
  background: rgba(250, 204, 21, .15);
  padding: 0 .3rem;
  color: #facc15 !important;
}

@media (prefers-reduced-motion: reduce) {
  #sideMenu,
  #menuOverlay,
  .js .reveal,
  .spot,
  .pulse-dot {
    transition: none !important;
    animation: none !important;
  }

  .js .reveal {
    opacity: 1;
    transform: none;
  }
}
