:root {
  --ink: #0b1f33;
  --ink-soft: #526577;
  --line: #c9d4dd;
  --paper: #edf2f5;
  --white: #ffffff;
  --saffron: #f3aa24;
  --danger: #b42318;
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  min-height: 100%;
  margin: 0;
}

body {
  overflow: hidden;
  color: var(--ink);
  background:
    linear-gradient(rgba(11, 31, 51, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(11, 31, 51, 0.035) 1px, transparent 1px),
    var(--paper);
  background-size: 28px 28px;
  font-family: "Aptos", "Segoe UI", sans-serif;
}

[hidden] {
  display: none !important;
}

.portal-shell,
.portal-frame {
  width: 100%;
  height: 100vh;
  height: 100dvh;
}

.portal-shell {
  position: relative;
  overflow: hidden;
}

.portal-frame {
  display: block;
  border: 0;
  background: var(--white);
}

.portal-state {
  position: absolute;
  z-index: 2;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  padding: 28px;
  text-align: center;
  background: rgba(237, 242, 245, 0.96);
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 60px;
  height: 60px;
  margin-bottom: 24px;
  color: var(--white);
  border-radius: 10px;
  background: var(--ink);
  font-size: 18px;
  font-weight: 800;
  letter-spacing: -0.04em;
}

.brand-mark.danger {
  background: var(--danger);
}

.state-kicker {
  color: #b25f00;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.portal-state h1 {
  max-width: 560px;
  margin: 12px 0 8px;
  font-size: clamp(28px, 5vw, 48px);
  line-height: 1.04;
  letter-spacing: -0.045em;
}

.portal-state p {
  max-width: 520px;
  margin: 0;
  color: var(--ink-soft);
  font-size: 14px;
  line-height: 1.6;
}

.progress-track {
  position: relative;
  overflow: hidden;
  width: min(280px, 70vw);
  height: 4px;
  margin-top: 28px;
  background: #d5dee5;
}

.progress-track span {
  position: absolute;
  inset-block: 0;
  width: 42%;
  background: var(--saffron);
  animation: loading 1.15s ease-in-out infinite;
}

.portal-error {
  background: var(--paper);
}

.error-actions {
  display: flex;
  gap: 10px;
  margin-top: 26px;
}

.error-actions button,
.error-actions a {
  min-height: 44px;
  padding: 12px 17px;
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--white);
  font: inherit;
  font-size: 12px;
  font-weight: 750;
  text-decoration: none;
  cursor: pointer;
}

.error-actions button {
  color: var(--white);
  border-color: var(--ink);
  background: var(--ink);
}

@keyframes loading {
  from {
    transform: translateX(-110%);
  }
  to {
    transform: translateX(340%);
  }
}

@media (max-width: 520px) {
  .portal-state {
    padding: 22px;
  }

  .error-actions {
    width: 100%;
    max-width: 320px;
    flex-direction: column;
  }
}

@media (prefers-reduced-motion: reduce) {
  .progress-track span {
    width: 100%;
    animation: none;
  }
}
