:root {
  --gate-gold: #e8c36f;
  --gate-gold-bright: #fff0b0;
  --gate-gold-deep: #8c6122;
  --gate-cyan: #83eced;
  --gate-cyan-deep: #1d7180;
  --gate-purple: #6f3d92;
  --gate-purple-deep: #211027;
  --gate-ivory: #f4ead4;
  --gate-void: #020205;
  --gate-panel: rgba(9, 6, 14, 0.9);
  --gate-pointer-x: 0;
  --gate-pointer-y: 0;
}

body.system-gate-pending {
  overflow-x: hidden;
  background: var(--gate-void);
}

body.system-gate-pending > .oracle-header,
body.system-gate-pending > .oracle-shell {
  display: none;
}

.system-gate[hidden] {
  display: none;
}

.system-gate {
  position: relative;
  z-index: 1000;
  min-height: 100svh;
  overflow: hidden;
  padding:
    max(18px, env(safe-area-inset-top))
    clamp(12px, 2.1vw, 32px)
    max(22px, env(safe-area-inset-bottom));
  color: var(--gate-ivory);
  background:
    radial-gradient(circle at 50% 44%, rgba(76, 40, 93, 0.18), transparent 30%),
    radial-gradient(circle at 16% 42%, rgba(31, 118, 135, 0.13), transparent 31%),
    radial-gradient(circle at 84% 40%, rgba(139, 73, 170, 0.18), transparent 32%),
    linear-gradient(180deg, #05030a 0%, #020205 66%, #040207 100%);
  isolation: isolate;
}

.system-gate::before,
.system-gate::after {
  position: absolute;
  inset: 0;
  z-index: -5;
  content: "";
  pointer-events: none;
}

.system-gate::before {
  opacity: 0.48;
  background-image:
    radial-gradient(circle, rgba(232, 195, 111, 0.58) 0 0.7px, transparent 1.5px),
    radial-gradient(circle, rgba(131, 236, 237, 0.38) 0 0.7px, transparent 1.4px),
    radial-gradient(circle, rgba(255, 255, 255, 0.18) 0 0.6px, transparent 1.2px);
  background-position: 0 0, 47px 71px, 23px 17px;
  background-size: 127px 127px, 181px 181px, 83px 83px;
}

.system-gate::after {
  opacity: 0.34;
  background:
    repeating-radial-gradient(
      ellipse at 50% 50%,
      transparent 0 58px,
      rgba(232, 195, 111, 0.055) 59px 60px,
      transparent 61px 105px
    );
  transform: translate(
    calc(var(--gate-pointer-x) * -10px),
    calc(var(--gate-pointer-y) * -7px)
  );
  transition: transform 240ms ease-out;
}

.system-gate__quantum-field {
  position: absolute;
  inset: 0;
  z-index: -2;
  width: 100%;
  height: 100%;
  pointer-events: none;
  opacity: 0;
  filter: saturate(1.05);
  transition: opacity 1.4s ease, filter 700ms ease;
}

.system-gate[data-gate-phase="awake"] .system-gate__quantum-field,
.system-gate[data-gate-phase="opening"] .system-gate__quantum-field {
  opacity: 0.94;
}

.system-gate__quantum-field--opening {
  filter: saturate(1.28) brightness(1.18);
}

.system-gate__aurora {
  position: absolute;
  top: 24%;
  z-index: -4;
  width: min(42vw, 610px);
  height: 58%;
  border-radius: 50%;
  pointer-events: none;
  opacity: 0.46;
  filter: blur(76px);
  animation: sovereign-aurora-breathe 8s ease-in-out infinite alternate;
}

.system-gate__aurora--kagome {
  left: -15%;
  background: radial-gradient(circle, rgba(65, 206, 226, 0.35), rgba(40, 102, 133, 0.08) 48%, transparent 70%);
}

.system-gate__aurora--solomon {
  right: -14%;
  background: radial-gradient(circle, rgba(163, 83, 199, 0.36), rgba(214, 163, 76, 0.09) 48%, transparent 72%);
  animation-delay: -3.4s;
}

.system-gate__manuscript-frame {
  position: absolute;
  inset: clamp(7px, 1.1vw, 16px);
  z-index: 8;
  border: 1px solid rgba(232, 195, 111, 0.38);
  box-shadow:
    inset 0 0 0 4px rgba(5, 3, 8, 0.78),
    inset 0 0 0 5px rgba(232, 195, 111, 0.14),
    inset 0 0 54px rgba(0, 0, 0, 0.72);
  pointer-events: none;
}

.system-gate__manuscript-frame::before,
.system-gate__manuscript-frame::after {
  position: absolute;
  left: 50%;
  width: min(48vw, 620px);
  height: 1px;
  content: "";
  background: linear-gradient(90deg, transparent, rgba(232, 195, 111, 0.52), transparent);
  transform: translateX(-50%);
}

.system-gate__manuscript-frame::before {
  top: 7px;
}

.system-gate__manuscript-frame::after {
  bottom: 7px;
}

.system-gate__corner {
  position: absolute;
  width: clamp(35px, 4vw, 62px);
  aspect-ratio: 1;
  border-color: rgba(232, 195, 111, 0.72);
  filter: drop-shadow(0 0 8px rgba(232, 195, 111, 0.24));
}

.system-gate__corner::before,
.system-gate__corner::after {
  position: absolute;
  content: "";
  border: 1px solid rgba(232, 195, 111, 0.48);
  border-radius: 50%;
}

.system-gate__corner::before {
  inset: 8%;
}

.system-gate__corner::after {
  inset: 28%;
  border-style: dashed;
}

.system-gate__corner--tl {
  top: -1px;
  left: -1px;
  border-top: 2px solid;
  border-left: 2px solid;
}

.system-gate__corner--tr {
  top: -1px;
  right: -1px;
  border-top: 2px solid;
  border-right: 2px solid;
}

.system-gate__corner--bl {
  bottom: -1px;
  left: -1px;
  border-bottom: 2px solid;
  border-left: 2px solid;
}

.system-gate__corner--br {
  right: -1px;
  bottom: -1px;
  border-right: 2px solid;
  border-bottom: 2px solid;
}

.system-gate__shell {
  position: relative;
  z-index: 2;
  width: min(1500px, 100%);
  margin-inline: auto;
}

.system-gate__header {
  max-width: 910px;
  margin: 0 auto clamp(18px, 2.2vh, 30px);
  text-align: center;
  opacity: 0;
  transform: translateY(-12px);
  transition: opacity 900ms ease 120ms, transform 900ms ease 120ms;
}

.system-gate[data-gate-phase="awake"] .system-gate__header,
.system-gate[data-gate-phase="opening"] .system-gate__header {
  opacity: 1;
  transform: translateY(0);
}

.system-gate__eyebrow,
.system-entry__type,
.system-gate__status-label,
.system-gate__ad-label {
  color: var(--gate-cyan);
  font-family: ui-monospace, "SFMono-Regular", Menlo, monospace;
  font-size: clamp(0.58rem, 0.7vw, 0.7rem);
  letter-spacing: 0.2em;
  text-transform: uppercase;
}

.system-gate__header h1 {
  margin: 4px 0 0;
  color: transparent;
  font-family: "YuMincho", "Yu Mincho", "Hiragino Mincho ProN", "Iowan Old Style", serif;
  font-size: clamp(2.65rem, 6vw, 6.1rem);
  font-weight: 500;
  line-height: 1.02;
  letter-spacing: 0.08em;
  background:
    linear-gradient(180deg, #fff7cc 0%, #e8c36f 32%, #b57c2c 66%, #f4d48b 100%);
  background-clip: text;
  -webkit-background-clip: text;
  filter: drop-shadow(0 0 18px rgba(232, 195, 111, 0.2));
}

.system-gate__title-en {
  margin: 7px 0 0;
  color: rgba(232, 195, 111, 0.92);
  font-family: "Iowan Old Style", "Times New Roman", serif;
  font-size: clamp(0.78rem, 1.45vw, 1.22rem);
  letter-spacing: 0.42em;
}

.system-gate__title-rule {
  display: block;
  width: min(390px, 64vw);
  height: 1px;
  margin: 14px auto 12px;
  background: linear-gradient(90deg, transparent, var(--gate-gold), transparent);
  box-shadow: 0 0 12px rgba(232, 195, 111, 0.34);
}

.system-gate__lead {
  max-width: 760px;
  margin: 0 auto;
  color: rgba(244, 234, 212, 0.76);
  font-family: "YuMincho", "Yu Mincho", "Hiragino Mincho ProN", serif;
  font-size: clamp(0.82rem, 1.25vw, 1rem);
  line-height: 1.85;
  letter-spacing: 0.06em;
}

.system-gate__portals {
  display: grid;
  grid-template-areas: "kagome seal solomon";
  grid-template-columns: minmax(280px, 1fr) minmax(220px, 0.62fr) minmax(300px, 1.08fr);
  gap: clamp(16px, 2vw, 32px);
  align-items: center;
}
