:root {
  --portal-bg: #07100b;
  --portal-ink: #f5ead2;
  --portal-muted: #c9b992;
  --portal-green: #78b86b;
  --portal-green-strong: #9bdc7e;
  --portal-wood: #6d4726;
  --portal-wood-dark: #2d1b11;
  --portal-gold: #d8ad55;
}

body {
  min-height: 100vh;
  background:
    radial-gradient(circle at 14% 18%, rgba(116, 176, 94, 0.22), transparent 28%),
    radial-gradient(circle at 86% 10%, rgba(216, 173, 85, 0.16), transparent 24%),
    linear-gradient(135deg, rgba(4, 9, 6, 0.90), rgba(18, 26, 16, 0.96)),
    var(--portal-bg);
  color: var(--portal-ink);
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(90deg, rgba(255, 255, 255, 0.025) 1px, transparent 1px),
    linear-gradient(rgba(255, 255, 255, 0.018) 1px, transparent 1px);
  background-size: 42px 42px;
  mask-image: radial-gradient(circle at center, black, transparent 82%);
}

.portal-shell {
  width: min(1120px, calc(100vw - 32px));
  padding: 34px 0 42px;
}

.portal-shell .topbar {
  position: relative;
  align-items: center;
  padding: clamp(22px, 4vw, 36px);
  border: 1px solid rgba(150, 113, 57, 0.68);
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(45, 27, 17, 0.92), rgba(18, 27, 16, 0.86)),
    rgba(15, 18, 14, 0.94);
  box-shadow:
    0 24px 70px rgba(0, 0, 0, 0.42),
    inset 0 0 0 1px rgba(245, 234, 210, 0.06);
  overflow: hidden;
}

.portal-shell .topbar::before,
.portal-shell .topbar::after {
  content: "";
  position: absolute;
  pointer-events: none;
}

.portal-shell .topbar::before {
  inset: 0;
  background:
    radial-gradient(circle at 12% 90%, rgba(120, 184, 107, 0.17), transparent 34%),
    repeating-linear-gradient(98deg, rgba(255, 255, 255, 0.035) 0 2px, transparent 2px 16px);
  mix-blend-mode: screen;
  opacity: 0.62;
}

.portal-shell .topbar::after {
  right: -72px;
  bottom: -92px;
  width: 310px;
  height: 310px;
  border: 22px solid rgba(120, 184, 107, 0.18);
  border-radius: 50%;
  box-shadow: inset 0 0 48px rgba(120, 184, 107, 0.12);
}

.portal-shell .topbar > * {
  position: relative;
  z-index: 1;
}

.portal-shell .eyebrow {
  color: var(--portal-green-strong);
  text-shadow: 0 1px 0 rgba(0, 0, 0, 0.65);
}

.portal-shell h1 {
  max-width: 720px;
  color: #fff5dc;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(36px, 6vw, 66px);
  text-shadow: 0 4px 18px rgba(0, 0, 0, 0.55);
}

.portal-shell h2 {
  color: #fff0cf;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(24px, 3vw, 34px);
}

.portal-shell .lede {
  max-width: 710px;
  color: var(--portal-muted);
}

.portal-shell .stats span,
.portal-shell .badge {
  border-color: rgba(141, 105, 53, 0.78);
  background:
    linear-gradient(180deg, rgba(81, 55, 31, 0.72), rgba(35, 24, 15, 0.72)),
    rgba(17, 22, 15, 0.72);
  color: #f0dfbd;
}

.portal-shell .global-message {
  min-height: 48px;
  margin: 18px 0;
  padding: 14px 16px;
  border: 1px solid rgba(120, 184, 107, 0.4);
  border-radius: 8px;
  background: rgba(11, 20, 13, 0.78);
  color: #d8e7ca;
}

.portal-shell .panel {
  border: 1px solid rgba(150, 113, 57, 0.68);
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(33, 24, 16, 0.94), rgba(13, 20, 13, 0.94)),
    rgba(16, 19, 15, 0.94);
  box-shadow:
    0 18px 54px rgba(0, 0, 0, 0.34),
    inset 0 0 0 1px rgba(255, 255, 255, 0.04);
}

.portal-shell .form-panel,
.portal-shell .preview-panel {
  position: relative;
  overflow: hidden;
}

.portal-shell .form-panel::before,
.portal-shell .preview-panel::before,
.portal-download::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(90deg, rgba(255, 255, 255, 0.035), transparent 34%),
    repeating-linear-gradient(110deg, rgba(116, 82, 42, 0.11) 0 7px, transparent 7px 18px);
  opacity: 0.72;
}

.portal-shell .form-panel > *,
.portal-shell .preview-panel > *,
.portal-download > * {
  position: relative;
  z-index: 1;
}

.portal-shell label {
  color: #dfcfac;
}

.portal-shell input,
.portal-shell select {
  border-color: rgba(153, 114, 55, 0.74);
  background: rgba(7, 11, 8, 0.72);
  color: #fff4d8;
  box-shadow: inset 0 1px 10px rgba(0, 0, 0, 0.32);
}

.portal-shell input:focus,
.portal-shell select:focus,
.portal-shell button:focus-visible {
  outline: 2px solid var(--portal-green-strong);
  outline-offset: 3px;
}

.portal-shell button,
.portal-shell .portal-link {
  border: 1px solid rgba(216, 173, 85, 0.42);
  border-radius: 8px;
  font-family: Georgia, "Times New Roman", serif;
  letter-spacing: 0;
}

.portal-shell .primary {
  background:
    linear-gradient(180deg, rgba(140, 103, 52, 0.98), rgba(78, 50, 27, 0.98)),
    var(--portal-wood);
  color: #fff3d0;
  text-shadow: 0 2px 2px rgba(0, 0, 0, 0.55);
}

.portal-shell .ghost {
  background:
    linear-gradient(180deg, rgba(55, 77, 42, 0.92), rgba(28, 45, 25, 0.92)),
    #20351d;
  color: #ecf5dc;
}

.portal-shell .primary:hover,
.portal-shell .ghost:hover {
  filter: brightness(1.08);
}

.portal-download {
  position: relative;
  overflow: hidden;
  margin-top: 20px;
}

.portal-download p {
  color: var(--portal-muted);
}

.portal-download .portal-link {
  width: fit-content;
  margin-top: 16px;
}

.portal-shell .summary div {
  border-color: rgba(150, 113, 57, 0.55);
  background: rgba(8, 14, 10, 0.62);
}

.portal-shell .summary span {
  color: var(--portal-green-strong);
}

.portal-shell .summary strong {
  color: #fff2d0;
}

@media (max-width: 760px) {
  .portal-shell {
    width: min(100vw - 20px, 100%);
    padding-top: 18px;
  }

  .portal-shell .topbar {
    padding: 20px;
  }

  .portal-shell .stats {
    max-width: 100%;
  }
}
