:root {
  --brand-glow: #00f0ff;
  --brand-gold: #e4ca8b;
  --brand-gold-deep: #bfa56f;
  --glass: rgba(0, 15, 30, 0.72);
  --glass-strong: rgba(0, 10, 22, 0.9);
  --text: #dae0e5;
  --muted: rgba(218, 224, 229, 0.65);
  --line: rgba(0, 240, 255, 0.3);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
}

body {
  position: relative;
  min-height: 100vh;
  overflow-x: hidden;
  padding-bottom: 100px;
  background: #000310;
  color: var(--brand-gold);
  font-family: "Courier New", monospace;
  text-align: center;
}

body,
main {
  display: flex;
  flex-direction: column;
  align-items: center;
}

main {
  position: relative;
  z-index: 10;
  width: 100%;
}

a {
  color: var(--brand-gold);
  text-decoration: none;
  transition: color 0.3s ease, text-shadow 0.3s ease, background-color 0.3s ease;
}

a:hover {
  color: var(--brand-glow);
  text-shadow: 0 0 10px var(--brand-glow);
}

a:focus-visible,
button:focus-visible {
  outline: 2px solid var(--brand-glow);
  outline-offset: 4px;
}

.skip-link {
  position: fixed;
  top: 12px;
  left: 12px;
  z-index: 999;
  padding: 10px 14px;
  transform: translateY(-180%);
  border: 1px solid var(--brand-glow);
  border-radius: 6px;
  background: #000310;
  color: #fff;
}

.skip-link:focus {
  transform: translateY(0);
}

canvas {
  position: fixed;
  inset: 0;
  z-index: -3;
  width: 100%;
  height: 100%;
}

#matrix {
  z-index: -2;
  opacity: 0.5;
}

/*
 * O wrapper centraliza o portal. Cada anel gira sozinho, sem misturar
 * translate e rotate no mesmo transform. É o mesmo princípio validado
 * no Stargate publicado.
 */
.phantom-rings {
  position: fixed;
  top: 50%;
  left: 50%;
  z-index: 0;
  width: min(88vw, 760px);
  aspect-ratio: 1;
  transform: translate(-50%, -50%);
  pointer-events: none;
}

.phantom-ring {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  opacity: 0.2;
  filter: drop-shadow(0 0 12px rgba(126, 231, 255, 0.12));
}

.phantom-ring-outer {
  animation: phantom-clockwise 150s linear infinite;
}

.phantom-ring-inner {
  inset: 18%;
  width: 64%;
  height: 64%;
  opacity: 0.13;
  animation: phantom-counter 110s linear infinite;
}

@keyframes phantom-clockwise {
  to { transform: rotate(360deg); }
}

@keyframes phantom-counter {
  to { transform: rotate(-360deg); }
}

.portal-header {
  position: sticky;
  top: 0;
  z-index: 90;
  width: 100%;
  padding: 22px 20px 18px;
  border-bottom: 1px solid rgba(228, 202, 139, 0.45);
  background: rgba(0, 3, 16, 0.88);
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.28);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}

.portal-header h1 {
  position: relative;
  z-index: 1;
  color: var(--brand-glow);
  font-size: clamp(2.15rem, 5vw, 3rem);
  line-height: 1.05;
  text-shadow: 0 0 20px var(--brand-glow), 0 0 40px #0077ff;
}

.portal-header p {
  margin-top: 8px;
  color: var(--brand-gold);
  font-size: 0.78rem;
  letter-spacing: 0.06em;
}

.side-info-container {
  position: relative;
  z-index: 20;
  display: flex;
  flex-flow: row wrap;
  align-items: stretch;
  justify-content: center;
  width: 100%;
  max-width: 1200px;
  margin: 30px auto 40px;
  padding: 0 20px;
  gap: 20px;
}

.glass-panel {
  flex: 1;
  min-width: 300px;
  max-width: 560px;
  padding: 15px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(0, 15, 30, 0.6);
  box-shadow: 0 0 20px rgba(0, 255, 255, 0.1);
  color: var(--brand-glow);
  text-align: left;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.panel-title {
  display: flex;
  justify-content: space-between;
  margin-bottom: 10px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--line);
  font-weight: bold;
}

.time-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: 8px 12px;
  font-size: 11px;
}

.time-grid div:nth-child(odd) {
  color: var(--muted);
  font-weight: bold;
  text-transform: uppercase;
}

.geo-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 10px;
  font-size: 11px;
}

.geo-row strong {
  display: block;
  margin-bottom: 2px;
  color: rgba(218, 224, 229, 0.6);
  font-size: 10px;
  text-transform: uppercase;
}

.geo-row span {
  color: var(--text);
  word-break: break-word;
}

.secure-uplink {
  margin-top: 10px;
  color: #39ff14;
  font-size: 9px;
  font-weight: bold;
  letter-spacing: 1px;
  text-align: center;
}

.box {
  position: relative;
  z-index: 10;
  width: 90%;
  max-width: 680px;
  margin-top: 30px;
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--glass);
  box-shadow: 0 0 20px rgba(0, 255, 255, 0.2);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.portal-directory {
  margin-top: 0;
}

.portal-featured {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: 15px 18px;
  border: 1px solid rgba(228, 202, 139, 0.36);
  border-radius: 8px;
  background: rgba(228, 202, 139, 0.06);
  font-weight: bold;
}

.portal-featured span {
  color: var(--brand-gold);
  font-size: 1.05rem;
}

.portal-featured small {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: normal;
}

.portal-group {
  margin-top: 28px;
  padding-top: 24px;
  border-top: 1px solid rgba(228, 202, 139, 0.23);
}

.portal-group h2 {
  margin-bottom: 12px;
  color: var(--brand-glow);
  font-size: 0.86rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.portal-list {
  list-style: none;
}

.portal-list li {
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 4px 0;
}

.portal-list a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  max-width: 100%;
  padding: 5px 8px;
  font-size: clamp(1rem, 0.96rem + 0.16vw, 1.08rem);
  line-height: 1.4;
}

.portal-list a::before {
  flex: 0 0 auto;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--brand-glow);
  box-shadow: 0 0 8px rgba(0, 240, 255, 0.6);
  content: "";
}

.portal-list a[aria-current="page"] {
  color: #fff;
  text-shadow: 0 0 10px rgba(0, 240, 255, 0.75);
}

.portal-list a[aria-current="page"]::after {
  color: var(--brand-glow);
  font-size: 0.7rem;
  letter-spacing: 0.08em;
  content: "ATUAL";
}

/* Enterprise preservada com as mesmas dimensões e animações da página vigente. */
#enterprise {
  display: block;
  width: 220px;
  margin: 30px auto;
  opacity: 0.85;
  z-index: 5;
  animation: float 8s ease-in-out infinite, enterpriseGlow 3s ease-in-out infinite alternate;
}

@keyframes float {
  0%, 100% { transform: translate(0, 0); }
  50% { transform: translate(0, -20px); }
}

@keyframes enterpriseGlow {
  from { filter: drop-shadow(0 0 8px #00f0ff) drop-shadow(0 0 16px #0077ff); }
  to { filter: drop-shadow(0 0 16px #00f0ff) drop-shadow(0 0 32px #0077ff); }
}

.ecosystem-overview {
  max-width: 860px;
  margin-top: 6px;
  text-align: left;
}

.ecosystem-overview .eyebrow {
  margin-bottom: 9px;
  color: var(--brand-glow);
  font-size: 0.72rem;
  font-weight: bold;
  letter-spacing: 0.14em;
}

.ecosystem-overview h2 {
  color: var(--brand-gold);
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(1.35rem, 3vw, 1.85rem);
  line-height: 1.2;
}

.ecosystem-copy {
  display: grid;
  gap: 16px;
  margin-top: 20px;
}

.ecosystem-copy p {
  color: var(--text);
  font-family: Arial, Helvetica, sans-serif;
  font-size: 0.98rem;
  line-height: 1.65;
}

.footer {
  position: fixed;
  right: 0;
  bottom: 10px;
  left: 0;
  z-index: 80;
  width: 100%;
  color: #a3f3ff;
  font-size: 12px;
  text-align: center;
  pointer-events: none;
}

.cookie {
  position: fixed;
  right: 18px;
  bottom: 42px;
  z-index: 110;
  max-width: min(390px, calc(100vw - 36px));
  padding: 10px 12px;
  border: 1px solid var(--brand-gold-deep);
  border-radius: 7px;
  background: var(--glass-strong);
  color: var(--text);
  font-size: 12px;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.35);
}

.cookie button {
  margin-left: 8px;
  padding: 4px 10px;
  border: 1px solid var(--brand-glow);
  border-radius: 4px;
  background: transparent;
  color: var(--brand-glow);
  font: inherit;
  cursor: pointer;
}

@media (max-width: 1000px) {
  .side-info-container {
    flex-direction: column;
    align-items: center;
  }

  .glass-panel {
    width: 100%;
    max-width: 600px;
  }
}

@media (max-width: 620px) {
  body {
    padding-bottom: calc(96px + env(safe-area-inset-bottom));
  }

  .portal-header {
    padding: 18px 16px 15px;
  }

  .portal-header h1 {
    font-size: 2rem;
  }

  .portal-header p {
    font-size: 0.7rem;
    line-height: 1.45;
  }

  .side-info-container {
    margin-top: 22px;
    padding-inline: 14px;
  }

  .glass-panel {
    min-width: 0;
  }

  .box {
    width: calc(100% - 28px);
    padding: 18px 14px;
  }

  .portal-list a {
    font-size: 1rem;
  }

  .phantom-rings {
    width: 94vw;
  }

  .ecosystem-overview {
    text-align: left;
  }

  .footer {
    bottom: calc(8px + env(safe-area-inset-bottom));
    padding-inline: 12px;
  }
}

@media (prefers-color-scheme: light) {
  body {
    background: #f4f5f7;
    color: #1a1c1e;
  }

  .portal-header {
    border-bottom-color: rgba(191, 165, 111, 0.52);
    background: rgba(244, 245, 247, 0.91);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.08);
  }

  .portal-header h1,
  .panel-title,
  .portal-group h2,
  .ecosystem-overview .eyebrow {
    color: #bfa56f;
    text-shadow: none;
  }

  .portal-header p {
    color: #666;
  }

  .box,
  .glass-panel {
    border-color: rgba(191, 165, 111, 0.45);
    background: rgba(255, 255, 255, 0.92);
    box-shadow: 0 4px 18px rgba(0, 0, 0, 0.06);
    color: #1a1c1e;
  }

  .panel-title,
  .portal-group {
    border-color: rgba(191, 165, 111, 0.3);
  }

  a,
  .portal-featured span,
  .ecosystem-overview h2 {
    color: #1a1c1e;
  }

  a:hover {
    color: #8a6a34;
    text-shadow: none;
  }

  .portal-list a[aria-current="page"] {
    color: #8a6a34;
    text-shadow: none;
  }

  .portal-list a::before {
    background: #bfa56f;
    box-shadow: 0 0 8px rgba(191, 165, 111, 0.55);
  }

  .time-grid div,
  .geo-row strong,
  .geo-row span,
  #geo-content {
    color: #1a1c1e;
  }

  .time-grid div:nth-child(odd),
  .geo-row strong,
  .portal-featured small {
    color: #666;
  }

  /* Restaura o contraste dos horários que recebem branco pelo JavaScript. */
  html body #chronos-display.time-grid div[style*="color:#fff"] {
    color: #1a1c1e !important;
  }

  .ecosystem-copy p {
    color: #34383d;
  }

  canvas#stars {
    filter: invert(1) sepia(1) saturate(1.35) brightness(0.85) opacity(0.16);
  }

  canvas#matrix {
    filter: invert(1) sepia(1) saturate(1.35) brightness(0.85) opacity(0.2);
  }

  .phantom-ring {
    opacity: 0.11;
    filter: none;
  }

  .phantom-ring-inner {
    opacity: 0.08;
  }

  .footer {
    color: #666;
  }

  .cookie {
    background: #fff;
    color: #1a1c1e;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  .phantom-ring,
  #enterprise {
    animation: none !important;
  }

  a {
    transition: none;
  }
}
