:root {
  --bg-1: #040b12;
  --bg-2: #071821;
  --panel: rgba(8, 13, 20, 0.84);
  --panel-border: rgba(146, 171, 212, 0.12);
  --text: #edf5ff;
  --muted: rgba(224, 232, 242, 0.72);
  --brand-blue: #9ecaff;
  --ok: #7fe6b5;
  --warn: #ffd77d;
  --info: #9ac4ff;
  --track: rgba(255,255,255,0.08);
  --fill-1: #9ecbff;
  --fill-2: #eff7ff;
}

* {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  width: 100%;
  min-height: 100%;
  height: 100%;
  font-family: "Inter", sans-serif;
  background:
    radial-gradient(circle at 22% 16%, rgba(114, 167, 255, 0.1), transparent 16%),
    linear-gradient(180deg, var(--bg-2) 0%, var(--bg-1) 100%);
  color: var(--text);
}

body {
  min-height: 100vh;
  overflow: hidden;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  background-image:
    linear-gradient(rgba(255,255,255,0.018) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,0.018) 1px, transparent 1px);
  background-size: 30px 30px;
  mask-image: radial-gradient(circle at center, black 35%, transparent 100%);
  pointer-events: none;
}

.page-shell {
  width: 100%;
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 10px 12px;
}

.terminal-window {
  width: min(100%, 1500px);
  min-height: 310px;
  padding: 10px 14px 12px;
  border-radius: 20px;
  border: 1px solid rgba(255,255,255,0.04);
  background: rgba(8, 12, 17, 0.28);
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 8px 6px;
}

.brand-pill {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 7px 16px 7px 8px;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,0.05);
  background: rgba(255,255,255,0.02);
}

.brand-mark {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 0.96rem;
  font-weight: 900;
  color: #09141d;
  background: linear-gradient(135deg, #edf6ff, var(--brand-blue));
  box-shadow: 0 0 18px rgba(142, 188, 255, 0.35);
}

.brand-text {
  font-size: 0.86rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  color: var(--text);
}

.signal {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding-right: 6px;
}

.signal span {
  display: block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: rgba(255,255,255,0.35);
  animation: blinkDot 1.2s ease-in-out infinite;
}

.signal span:nth-child(2) { animation-delay: 0.15s; }
.signal span:nth-child(3) { animation-delay: 0.3s; }

.terminal-grid {
  display: grid;
  grid-template-columns: minmax(220px, 0.9fr) minmax(0, 2.4fr);
  gap: 10px;
  min-height: 220px;
  padding: 6px 6px 0;
}

.log-panel {
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  gap: 8px;
  padding: 10px 6px 4px 6px;
}

.log-line {
  font-size: 0.8rem;
  color: rgba(255,255,255,0.72);
  letter-spacing: 0.02em;
  white-space: nowrap;
}

.tag {
  display: inline-block;
  min-width: 42px;
  margin-right: 8px;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.tag.ok { color: var(--ok); }
.tag.warn { color: var(--warn); }
.tag.info { color: var(--info); }

.main-panel {
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  min-height: 160px;
  padding: 0 6px 0 0;
}

.status-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 6px;
  padding-left: 8px;
}

.status-label {
  color: rgba(255,255,255,0.76);
  font-size: 0.7rem;
  letter-spacing: 0.22em;
  font-weight: 700;
  text-transform: uppercase;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 40px;
  padding: 4px 7px;
  border-radius: 999px;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.04);
  font-size: 0.56rem;
  letter-spacing: 0.12em;
  color: rgba(255,255,255,0.74);
  font-weight: 700;
}

.headline-wrap {
  display: flex;
  align-items: center;
  min-height: 52px;
  padding-left: 8px;
}

.typewriter {
  display: inline-block;
  font-size: clamp(2rem, 3vw, 4.4rem);
  line-height: 0.9;
  letter-spacing: -0.08em;
  font-weight: 900;
  white-space: nowrap;
  background: linear-gradient(90deg, #edf5ff 0%, #dfeeff 30%, #b8d5ff 52%, #f4f8ff 76%, #ffffff 100%);
  background-size: 200% auto;
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  animation: gradientText 6s linear infinite;
}

.cursor {
  display: inline-block;
  width: 8px;
  height: 1em;
  margin-left: 6px;
  background: rgba(255,255,255,0.8);
  transform: translateY(4px);
  animation: blinkCursor 0.9s steps(1) infinite;
}

.loader-wrap {
  margin-top: 4px;
}

.loader-track {
  position: relative;
  width: 100%;
  height: 12px;
  border-radius: 999px;
  background: var(--track);
  overflow: hidden;
  border: 1px solid rgba(255,255,255,0.04);
}

.loader-fill {
  position: absolute;
  inset: 0 auto 0 0;
  width: 18%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--fill-1), #dfeeff 40%, var(--fill-2));
  box-shadow: 0 0 18px rgba(158, 203, 255, 0.5);
  animation: loadProgress 2.8s ease-in-out infinite alternate;
}

.loader-fill::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.7), transparent);
  transform: translateX(-120%);
  animation: sweep 1.7s linear infinite;
}

.bottom-row {
  margin-top: 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  color: var(--muted);
  font-size: 0.88rem;
  font-weight: 500;
  padding-left: 8px;
}

.loading-dots {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 7px;
  min-width: 72px;
}

.loading-dots i {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: rgba(255,255,255,0.35);
  animation: pulseDot 1.2s ease-in-out infinite;
}

.loading-dots i:nth-child(2) { animation-delay: 0.12s; }
.loading-dots i:nth-child(3) { animation-delay: 0.24s; }
.loading-dots i:nth-child(4) { animation-delay: 0.36s; }

@keyframes gradientText {
  0% { background-position: 0% 50%; }
  100% { background-position: 200% 50%; }
}

@keyframes loadProgress {
  0% { width: 18%; }
  50% { width: 46%; }
  100% { width: 74%; }
}

@keyframes sweep {
  0% { transform: translateX(-120%); }
  100% { transform: translateX(120%); }
}

@keyframes blinkDot {
  0%, 80%, 100% { opacity: 0.28; transform: scale(0.8); }
  40% { opacity: 1; transform: scale(1); }
}

@keyframes pulseDot {
  0%, 80%, 100% { opacity: 0.28; transform: scale(0.8); }
  40% { opacity: 1; transform: scale(1); }
}

@keyframes blinkCursor {
  0%, 50% { opacity: 1; }
  50.1%, 100% { opacity: 0; }
}

@media (max-width: 960px) {
  .terminal-grid {
    grid-template-columns: 1fr;
  }

  .log-panel {
    order: 2;
    padding-top: 4px;
  }

  .main-panel {
    order: 1;
  }
}

@media (max-width: 620px) {
  .brand-text {
    letter-spacing: 0.08em;
    font-size: 0.72rem;
  }

  .status-row,
  .bottom-row {
    flex-wrap: wrap;
  }

  .typewriter {
    font-size: clamp(1.8rem, 10vw, 4rem);
  }
}

@media (max-width: 520px) {
  body {
    overflow: auto;
  }

  .page-shell {
    padding: 8px;
  }

  .terminal-window {
    min-height: auto;
    padding: 10px 10px 12px;
    border-radius: 16px;
  }

  .topbar {
    padding: 0 4px 6px;
  }

  .brand-pill {
    gap: 8px;
    padding: 7px 12px 7px 8px;
  }

  .brand-mark {
    width: 24px;
    height: 24px;
    font-size: 0.82rem;
  }

  .brand-text {
    font-size: 0.68rem;
    letter-spacing: 0.1em;
  }

  .signal {
    gap: 6px;
    padding-right: 2px;
  }

  .signal span {
    width: 6px;
    height: 6px;
  }

  .terminal-grid {
    grid-template-columns: 1fr;
    gap: 8px;
    min-height: auto;
  }

  .log-panel {
    padding: 8px 4px 0;
    gap: 6px;
  }

  .log-line {
    font-size: 0.72rem;
    white-space: normal;
    line-height: 1.4;
  }

  .tag {
    min-width: 36px;
    font-size: 0.64rem;
  }

  .main-panel {
    min-height: auto;
    padding: 0 4px;
  }

  .status-row {
    margin-bottom: 4px;
  }

  .status-label {
    font-size: 0.6rem;
    letter-spacing: 0.14em;
  }

  .status-pill {
    min-width: 34px;
    font-size: 0.5rem;
  }

  .headline-wrap {
    min-height: 44px;
    padding-left: 4px;
  }

  .typewriter {
    font-size: clamp(1.8rem, 9vw, 3.2rem);
    white-space: normal;
    line-height: 1;
    letter-spacing: -0.07em;
  }

  .cursor {
    width: 7px;
    height: 0.9em;
    margin-left: 4px;
    transform: translateY(2px);
  }

  .bottom-row {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
    padding-left: 4px;
  }

  .loading-dots {
    min-width: 0;
  }
}
