@import url("https://fonts.googleapis.com/css2?family=Orbitron:wght@500;700;900&family=Sora:wght@400;600;700&display=swap");

:root {
  --bg-base: #050607;
  --bg-soft: #0f151c;
  --line: rgba(255, 255, 255, 0.14);
  --text-main: #e9f4ff;
  --text-dim: #9ab0c7;
  --accent-hot: #ff542f;
  --accent-cool: #00c8ff;
  --accent-lime: #35df95;
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html,
body {
  margin: 0;
  min-height: 100%;
  overflow-x: clip;
  background:
    radial-gradient(circle at 20% 18%, rgba(0, 200, 255, 0.23), transparent 32%),
    radial-gradient(circle at 78% 14%, rgba(255, 84, 47, 0.26), transparent 32%),
    linear-gradient(155deg, #050607 0%, #0f151d 50%, #050709 100%);
  color: var(--text-main);
  font-family: "Sora", "Segoe UI", sans-serif;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.025) 1px, transparent 1px);
  background-size: 36px 36px;
  mask-image: radial-gradient(circle at center, black 30%, transparent 100%);
}

img,
video {
  max-width: 100%;
}

.portal-shell {
  width: min(1160px, calc(100% - 1.5rem));
  margin: clamp(0.8rem, 4vw, 3.2rem) auto;
  display: grid;
  gap: 1.1rem;
}

.hero,
.status-card,
.gallery-card {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 1rem;
  background: linear-gradient(145deg, rgba(15, 21, 28, 0.92), rgba(8, 10, 14, 0.94));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
  padding: 1.2rem;
}

.hero {
  position: relative;
  overflow: hidden;
}

.hero::after {
  content: "";
  position: absolute;
  right: -8rem;
  top: -8rem;
  width: 22rem;
  height: 22rem;
  border-radius: 999px;
  background: radial-gradient(circle at center, rgba(0, 200, 255, 0.28), transparent 65%);
  pointer-events: none;
}

.badge {
  display: inline-flex;
  padding: 0.28rem 0.64rem;
  border: 1px solid rgba(0, 200, 255, 0.38);
  border-radius: 999px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 0.7rem;
  color: #95dbff;
}

h1,
h2 {
  margin: 0;
  font-family: "Orbitron", "Arial Narrow", sans-serif;
  letter-spacing: 0.02em;
}

h1 {
  margin-top: 0.68rem;
  font-size: clamp(2rem, 5.2vw, 4.2rem);
  line-height: 0.98;
  max-width: 13ch;
}

h2 {
  font-size: clamp(1.1rem, 2.5vw, 1.7rem);
}

.subhead {
  margin: 0.58rem 0 0;
  color: var(--text-dim);
  max-width: 75ch;
}

.build-form {
  margin-top: 1.2rem;
  display: grid;
  gap: 0.5rem;
}

.build-form label {
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.11em;
  color: #b7cbde;
}

.input-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: stretch;
  gap: 0.6rem;
}

.input-row input {
  width: 100%;
  min-width: 0;
  min-height: 3.2rem;
  border-radius: 0.65rem;
  border: 1px solid rgba(255, 255, 255, 0.24);
  padding: 0 0.9rem;
  font-size: 1.02rem;
  color: var(--text-main);
  background: rgba(255, 255, 255, 0.06);
}

.input-row input,
.input-row button {
  font: inherit;
}

.input-row input:focus {
  outline: none;
  border-color: rgba(0, 200, 255, 0.76);
  box-shadow: 0 0 0 3px rgba(0, 200, 255, 0.22);
}

.input-row button {
  min-height: 3.2rem;
  border: none;
  border-radius: 0.65rem;
  padding: 0 1.1rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 700;
  color: #fff;
  background: linear-gradient(135deg, var(--accent-hot), var(--accent-cool));
  cursor: pointer;
}

.input-row button:disabled {
  opacity: 0.55;
  cursor: wait;
}

.status-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  flex-wrap: wrap;
  gap: 0.8rem;
}

#status-text {
  margin: 0;
  color: #cae6ff;
  font-size: 0.95rem;
  min-width: 0;
  max-width: 100%;
  text-align: right;
  overflow-wrap: anywhere;
}

.engine-wrap {
  margin-top: 0.9rem;
  margin-bottom: 0.9rem;
  display: grid;
  place-items: center;
  min-height: 180px;
  position: relative;
}

.engine-core,
.engine-ring {
  position: absolute;
  border-radius: 999px;
}

.engine-core {
  width: 56px;
  height: 56px;
  background: radial-gradient(circle at 35% 35%, #7be7ff, #008ec0 55%, #005d84);
  box-shadow: 0 0 40px rgba(0, 200, 255, 0.25);
  transform: scale(1);
  transition: transform 0.3s ease;
}

.engine-ring {
  border: 1px solid rgba(255, 255, 255, 0.24);
}

.ring-a {
  width: 104px;
  height: 104px;
}

.ring-b {
  width: 146px;
  height: 146px;
}

.stage-text {
  margin-top: 170px;
  color: var(--text-dim);
  font-size: 0.92rem;
  text-align: center;
}

body.is-building .engine-core {
  animation: pulse-core 1.2s ease-in-out infinite;
}

body.is-building .ring-a {
  animation: spin-ring 2.8s linear infinite;
}

body.is-building .ring-b {
  animation: spin-ring-reverse 4.2s linear infinite;
}

.logs {
  margin: 0;
  min-height: 7rem;
  max-height: 16rem;
  overflow: auto;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  word-break: break-word;
  border-radius: 0.65rem;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(0, 0, 0, 0.45);
  padding: 0.8rem;
  color: #c7d7ea;
  font-family: "JetBrains Mono", "Consolas", monospace;
  font-size: 0.8rem;
  line-height: 1.45;
}

.empty-state {
  color: var(--text-dim);
}

.gallery-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  flex-wrap: wrap;
  gap: 0.8rem;
}

.gallery-head p {
  margin: 0;
  color: var(--text-dim);
  font-size: 0.85rem;
}

.gallery-grid {
  margin-top: 0.9rem;
  display: grid;
  gap: 0.8rem;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
}

.gallery-item {
  display: grid;
  text-decoration: none;
  color: inherit;
  border: 1px solid rgba(53, 223, 149, 0.24);
  border-radius: 0.8rem;
  overflow: hidden;
  background: rgba(7, 12, 10, 0.5);
  transition: transform 0.18s ease, border-color 0.18s ease;
}

.gallery-item:hover {
  transform: translateY(-2px);
  border-color: rgba(53, 223, 149, 0.5);
}

.gallery-item img {
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
}

.gallery-meta {
  padding: 0.66rem 0.72rem 0.72rem;
}

.gallery-title {
  margin: 0;
  font-family: "Orbitron", sans-serif;
  font-size: 0.92rem;
  color: var(--accent-lime);
  text-transform: uppercase;
  overflow-wrap: anywhere;
}

.gallery-date {
  margin: 0.24rem 0 0;
  color: var(--text-dim);
  font-size: 0.74rem;
  overflow-wrap: anywhere;
}

.hidden {
  display: none;
}

@keyframes pulse-core {
  0% { transform: scale(1); box-shadow: 0 0 32px rgba(0, 200, 255, 0.22); }
  50% { transform: scale(1.12); box-shadow: 0 0 46px rgba(255, 84, 47, 0.27); }
  100% { transform: scale(1); box-shadow: 0 0 32px rgba(0, 200, 255, 0.22); }
}

@keyframes spin-ring {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

@keyframes spin-ring-reverse {
  from { transform: rotate(360deg); }
  to { transform: rotate(0deg); }
}

@media (max-width: 1024px) {
  h1 {
    font-size: clamp(1.9rem, 6.5vw, 3.2rem);
    max-width: 15ch;
  }

  .gallery-grid {
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  }
}

@media (max-width: 760px) {
  .portal-shell {
    width: min(calc(100% - 1rem), 620px);
    margin-top: 1rem;
    margin-bottom: 1rem;
  }

  .input-row {
    grid-template-columns: 1fr;
  }

  .gallery-head {
    display: grid;
    gap: 0.3rem;
  }

  #status-text {
    text-align: left;
  }

  .hero,
  .status-card,
  .gallery-card {
    padding: 1rem;
    border-radius: 0.85rem;
  }

  h1 {
    font-size: clamp(1.7rem, 9vw, 2.7rem);
    max-width: 16ch;
  }

  .input-row button {
    width: 100%;
    min-height: 3.3rem;
  }

  .logs {
    min-height: 6rem;
    max-height: 11rem;
    font-size: 0.74rem;
  }

  .engine-wrap {
    min-height: 150px;
  }

  .engine-core {
    width: 46px;
    height: 46px;
  }

  .ring-a {
    width: 88px;
    height: 88px;
  }

  .ring-b {
    width: 122px;
    height: 122px;
  }

  .stage-text {
    margin-top: 144px;
    font-size: 0.84rem;
    padding-inline: 0.7rem;
  }

  .gallery-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 420px) {
  .portal-shell {
    width: 100%;
    padding: 0.65rem;
    margin-top: 0.35rem;
    margin-bottom: 0.6rem;
    gap: 0.75rem;
  }

  .badge {
    font-size: 0.64rem;
  }

  .subhead {
    font-size: 0.92rem;
  }

  .build-form label {
    font-size: 0.74rem;
  }
}
