.portal-shell {
  position: relative;
  width: var(--container-width);
  margin: 18px auto 42px;
  display: grid;
  gap: var(--page-gap);
}

.page-enter {
  animation: fadeInUp 0.45s ease-out both;
}

.surface {
  position: relative;
  overflow: hidden;
  border: 1px solid var(--border-default);
  border-radius: var(--radius-lg);
  background: linear-gradient(180deg, rgba(17, 24, 39, 0.82), rgba(15, 23, 42, 0.92));
  box-shadow: var(--shadow-soft);
  backdrop-filter: blur(18px);
}

.surface::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(120deg, rgba(255, 255, 255, 0.06), transparent 40%);
}

.portal-topbar {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 18px;
  padding: 14px 18px;
}

.brand-block {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
}

.brand-mark {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-md);
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, rgba(59, 130, 246, 0.22), rgba(99, 102, 241, 0.22));
  border: 1px solid rgba(96, 165, 250, 0.3);
  box-shadow: 0 0 24px rgba(59, 130, 246, 0.18);
  font-family: var(--font-mono);
  font-size: 0.92rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  color: #dbeafe;
}

.brand-copy {
  min-width: 0;
}

.brand-eyebrow {
  margin: 0;
  color: var(--accent-hover);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.24em;
  text-transform: uppercase;
}

.brand-title {
  margin: 2px 0 0;
  font-family: var(--font-heading);
  font-size: 1.02rem;
  font-weight: 800;
}

.brand-subtitle {
  margin: 4px 0 0;
  color: var(--text-secondary);
  font-size: 0.8rem;
}

.stage-nav {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
}

.stage-link {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 34px;
  padding: 0 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-default);
  background: rgba(255, 255, 255, 0.03);
  text-decoration: none;
  color: var(--text-secondary);
  transition: all 0.2s ease;
}

.stage-link::after {
  content: "";
  position: absolute;
  left: 8px;
  right: 8px;
  bottom: -1px;
  height: 3px;
  border-radius: 999px;
  opacity: 0;
  transform: scaleX(0.72);
  transition: all 0.2s ease;
}

.stage-link:hover,
.stage-link.active {
  color: var(--text-primary);
  border-color: var(--border-hover);
  box-shadow: 0 0 0 1px var(--accent-glow), 0 10px 28px rgba(0, 0, 0, 0.18);
  transform: translateY(-1px);
}

.stage-link:hover::after,
.stage-link.active::after {
  opacity: 1;
  transform: scaleX(1);
}

.stage-link[data-stage="stage-a"]:hover,
.stage-link[data-stage="stage-a"].active {
  box-shadow: 0 0 0 1px rgba(245, 158, 11, 0.2), 0 8px 22px rgba(245, 158, 11, 0.18);
}

.stage-link[data-stage="stage-a"]::after {
  background: var(--stage-a);
  box-shadow: 0 0 12px rgba(245, 158, 11, 0.36);
}

.stage-link[data-stage="stage-b"]:hover,
.stage-link[data-stage="stage-b"].active {
  box-shadow: 0 0 0 1px rgba(16, 185, 129, 0.2), 0 8px 22px rgba(16, 185, 129, 0.18);
}

.stage-link[data-stage="stage-b"]::after {
  background: var(--stage-b);
  box-shadow: 0 0 12px rgba(16, 185, 129, 0.36);
}

.stage-link[data-stage="stage-c"]:hover,
.stage-link[data-stage="stage-c"].active {
  box-shadow: 0 0 0 1px rgba(99, 102, 241, 0.22), 0 8px 22px rgba(99, 102, 241, 0.18);
}

.stage-link[data-stage="stage-c"]::after {
  background: var(--stage-c);
  box-shadow: 0 0 12px rgba(99, 102, 241, 0.38);
}

.stage-link[data-stage="stage-d"]:hover,
.stage-link[data-stage="stage-d"].active {
  box-shadow: 0 0 0 1px rgba(236, 72, 153, 0.2), 0 8px 22px rgba(236, 72, 153, 0.18);
}

.stage-link[data-stage="stage-d"]::after {
  background: var(--stage-d);
  box-shadow: 0 0 12px rgba(236, 72, 153, 0.38);
}

.stage-dot {
  width: 9px;
  height: 9px;
  border-radius: 999px;
  flex: 0 0 9px;
}

.stage-dot.stage-a,
.module-card.stage-a .module-index,
.stage-badge.stage-a {
  background: var(--stage-a);
}

.stage-dot.stage-b,
.module-card.stage-b .module-index,
.stage-badge.stage-b {
  background: var(--stage-b);
}

.stage-dot.stage-c,
.module-card.stage-c .module-index,
.stage-badge.stage-c {
  background: var(--stage-c);
}

.stage-dot.stage-d,
.module-card.stage-d .module-index,
.stage-badge.stage-d {
  background: var(--stage-d);
}

.top-actions,
.hero-actions,
.metric-grid,
.quick-grid,
.module-grid,
.notice-actions,
.shortcut-row,
.page-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.top-actions {
  justify-content: flex-end;
}

.portal-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 36px;
  padding: 0 14px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  text-decoration: none;
  font-weight: 700;
  transition: all 0.2s ease;
}

.portal-btn.primary {
  color: white;
  background: linear-gradient(135deg, var(--accent-primary), #2563eb);
  box-shadow: 0 0 0 1px rgba(96, 165, 250, 0.18), 0 14px 30px rgba(37, 99, 235, 0.24);
}

.portal-btn.primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 0 24px var(--accent-glow), 0 16px 34px rgba(37, 99, 235, 0.3);
}

.portal-btn.secondary,
.portal-btn.ghost {
  color: var(--text-primary);
  border-color: var(--border-default);
  background: rgba(255, 255, 255, 0.04);
}

.portal-btn.secondary:hover,
.portal-btn.ghost:hover {
  border-color: var(--border-hover);
  background: rgba(255, 255, 255, 0.07);
}

.portal-btn.stage-a { box-shadow: 0 0 0 1px rgba(245, 158, 11, 0.18), 0 16px 34px rgba(245, 158, 11, 0.18); }
.portal-btn.stage-b { box-shadow: 0 0 0 1px rgba(16, 185, 129, 0.18), 0 16px 34px rgba(16, 185, 129, 0.18); }
.portal-btn.stage-c { box-shadow: 0 0 0 1px rgba(99, 102, 241, 0.2), 0 16px 34px rgba(99, 102, 241, 0.18); }
.portal-btn.stage-d { box-shadow: 0 0 0 1px rgba(236, 72, 153, 0.18), 0 16px 34px rgba(236, 72, 153, 0.16); }

.hero-shell {
  padding: 18px 20px;
}

.hero-inline {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}

.hero-main {
  min-width: 0;
  display: grid;
  gap: 6px;
}

.hero-title {
  margin: 0;
  font-family: var(--font-heading);
  font-size: clamp(1.6rem, 2.6vw, 2rem);
  line-height: 1.06;
  letter-spacing: -0.03em;
}

.hero-subtitle {
  max-width: 420px;
  margin: 0;
  color: var(--text-secondary);
  font-size: 0.94rem;
  line-height: 1.45;
}

.hero-side {
  display: grid;
  justify-items: end;
  gap: 10px;
}

.hero-meta-strip {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.hero-meta-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 30px;
  padding: 0 10px;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-size: 0.84rem;
  border: 1px solid rgba(156, 163, 175, 0.24);
  background: rgba(255, 255, 255, 0.02);
}

.hero-meta-pill strong {
  color: var(--text-primary);
  font-weight: 700;
}

.meta-dot {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  flex: 0 0 8px;
  background: var(--accent-primary);
  box-shadow: 0 0 10px rgba(59, 130, 246, 0.34);
}

.meta-dot.status {
  background: var(--success);
  box-shadow: 0 0 10px rgba(34, 197, 94, 0.34);
}

.hero-actions {
  margin-top: 0;
  justify-content: flex-end;
}

.hero-panel,
.notice-panel,
.metric-card,
.quick-card,
.module-card,
.auth-card,
.timeline-card,
.forbidden-card,
.empty-workspace {
  position: relative;
  z-index: 1;
  border: 1px solid var(--border-default);
  background: rgba(255, 255, 255, 0.04);
  border-radius: var(--radius-lg);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.03);
}

.hero-panel,
.notice-panel,
.auth-card,
.forbidden-card,
.empty-workspace {
  padding: 22px;
}

.hero-panel {
  padding: 0;
  border: 0;
  background: none;
  box-shadow: none;
}

.metric-grid,
.quick-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.quick-strip {
  padding: 8px 18px;
}

.quick-grid {
  align-items: center;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  padding-bottom: 2px;
}

.quick-card,
.module-card {
  overflow: hidden;
  text-decoration: none;
  transition: transform 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}

.quick-card {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 40px;
  padding: 0 0 10px;
  border: 0;
  border-bottom: 2px solid transparent;
  border-radius: 0;
  background: none;
  box-shadow: none;
}

.quick-card:hover,
.quick-card:focus-visible {
  transform: none;
  border-color: rgba(59, 130, 246, 0.9);
  box-shadow: none;
}

.module-card:hover,
.timeline-card:hover {
  transform: translateY(-3px);
  border-color: var(--border-hover);
  box-shadow: 0 18px 34px rgba(0, 0, 0, 0.24), 0 0 24px rgba(59, 130, 246, 0.08);
}

.quick-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  font-size: 1rem;
}

.quick-label {
  color: var(--text-secondary);
  font-size: 0.94rem;
  font-weight: 700;
}

.quick-card:hover .quick-label,
.quick-card:focus-visible .quick-label {
  color: var(--text-primary);
}

.card-kicker {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.76rem;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.card-title {
  margin: 12px 0 0;
  font-family: var(--font-heading);
  font-size: 1.24rem;
  font-weight: 700;
  line-height: 1.25;
}

.card-desc {
  margin: 12px 0 0;
  color: var(--text-secondary);
  font-size: 0.95rem;
  line-height: 1.8;
}

.card-footer {
  margin-top: 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  color: var(--text-muted);
  font-size: 0.92rem;
  font-weight: 700;
}

.stage-stack {
  display: grid;
  gap: 18px;
}

.stage-section {
  padding: 20px;
}

.stage-section-head {
  position: relative;
  z-index: 1;
  display: block;
  margin-bottom: 14px;
}

.stage-card {
  width: 100%;
  padding: 18px 18px 16px;
  border-radius: var(--radius-lg);
  border: 1px solid rgba(255, 255, 255, 0.06);
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.04), rgba(255, 255, 255, 0.02));
}

.stage-card.stage-a {
  border-left: 4px solid var(--stage-a);
  box-shadow: 0 0 16px rgba(245, 158, 11, 0.1);
}

.stage-card.stage-b {
  border-left: 4px solid var(--stage-b);
  box-shadow: 0 0 16px rgba(16, 185, 129, 0.1);
}

.stage-card.stage-c {
  border-left: 4px solid var(--stage-c);
  box-shadow: 0 0 16px rgba(99, 102, 241, 0.12);
}

.stage-card.stage-d {
  border-left: 4px solid var(--stage-d);
  box-shadow: 0 0 16px rgba(236, 72, 153, 0.12);
}

.stage-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 24px;
  padding: 0 10px;
  border-radius: var(--radius-sm);
  color: #fff;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  box-shadow: 0 0 12px rgba(255, 255, 255, 0.08);
}

.stage-title {
  margin: 10px 0 0;
  font-family: var(--font-heading);
  font-size: 1.36rem;
  font-weight: 800;
  line-height: 1.16;
}

.stage-summary {
  margin: 10px 0 0;
  color: var(--text-secondary);
  line-height: 1.65;
}

.stage-points {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
}

.tag {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 0 10px;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(156, 163, 175, 0.3);
  background: rgba(255, 255, 255, 0.03);
  color: var(--text-muted);
  font-size: 0.78rem;
  font-weight: 600;
}

.module-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.module-grid.compact {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.module-card {
  display: flex;
  flex-direction: column;
  min-height: 224px;
  padding: 18px;
}

.module-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.module-index {
  width: 38px;
  height: 38px;
  border-radius: var(--radius-sm);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-family: var(--font-mono);
  font-size: 0.9rem;
  font-weight: 800;
  box-shadow: 0 14px 28px rgba(0, 0, 0, 0.18);
}

.module-status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 0 10px;
  min-height: 24px;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(156, 163, 175, 0.3);
  background: rgba(255, 255, 255, 0.03);
  color: var(--text-muted);
  font-size: 0.76rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.module-title {
  margin: 16px 0 0;
  font-family: var(--font-heading);
  font-size: 1.22rem;
  font-weight: 700;
  line-height: 1.24;
}

.module-desc {
  margin: 10px 0 0;
  color: var(--text-secondary);
  line-height: 1.75;
  font-size: 0.94rem;
}

.module-stats {
  margin-top: auto;
  padding-top: 16px;
  display: flex;
  justify-content: space-between;
  gap: 10px;
  color: var(--text-muted);
  font-size: 0.75rem;
  line-height: 1.4;
}

.module-footer {
  margin-top: 8px;
  padding-top: 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  color: var(--text-muted);
  font-size: 0.9rem;
  font-weight: 700;
}

.module-arrow {
  font-family: var(--font-mono);
  color: var(--accent-hover);
}

.notice-title,
.auth-title,
.timeline-title,
.forbidden-title {
  margin: 0;
  font-family: var(--font-heading);
  font-size: 1.46rem;
  font-weight: 800;
}

.notice-copy,
.auth-copy,
.forbidden-copy {
  margin: 12px 0 0;
  color: var(--text-secondary);
  line-height: 1.9;
}

.notice-actions,
.page-actions {
  margin-top: 20px;
}

.notice-list {
  margin: 18px 0 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 10px;
}

.notice-list li {
  position: relative;
  padding-left: 18px;
  color: var(--text-secondary);
  line-height: 1.75;
}

.notice-list li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 11px;
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: var(--accent-primary);
  box-shadow: 0 0 18px var(--accent-glow);
}

.auth-wrap {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.auth-shell {
  width: min(1320px, 100%);
  display: grid;
  gap: var(--page-gap);
}

.auth-grid {
  display: grid;
  grid-template-columns: minmax(320px, 0.92fr) minmax(360px, 0.8fr);
  gap: 20px;
}

.auth-card,
.forbidden-card {
  padding: 28px;
}

.input-stack {
  display: grid;
  gap: 16px;
  margin-top: 22px;
}

.input-label {
  display: grid;
  gap: 8px;
  color: var(--text-secondary);
  font-size: 0.92rem;
  font-weight: 700;
}

.portal-input {
  width: 100%;
  min-height: 52px;
  padding: 0 16px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-default);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-primary);
  font: inherit;
  outline: none;
  transition: all 0.2s ease;
}

.portal-input::placeholder {
  color: var(--text-muted);
}

.portal-input:focus {
  border-color: rgba(96, 165, 250, 0.46);
  box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.14);
}

.auth-error {
  margin-top: 18px;
  padding: 12px 14px;
  border-radius: var(--radius-lg);
  border: 1px solid rgba(239, 68, 68, 0.18);
  background: rgba(239, 68, 68, 0.08);
  color: #fca5a5;
  font-size: 0.92rem;
}

.countdown-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 36px;
  padding: 0 14px;
  border-radius: var(--radius-sm);
  background: rgba(59, 130, 246, 0.12);
  border: 1px solid rgba(59, 130, 246, 0.22);
  color: #dbeafe;
  font-family: var(--font-mono);
  font-size: 0.88rem;
  font-weight: 700;
}

.timeline {
  display: grid;
  gap: 16px;
}

.timeline-step {
  display: grid;
  grid-template-columns: 68px minmax(0, 1fr);
  gap: 14px;
  align-items: start;
}

.timeline-index {
  width: 56px;
  height: 56px;
  border-radius: var(--radius-md);
  display: grid;
  place-items: center;
  background: rgba(59, 130, 246, 0.12);
  border: 1px solid rgba(59, 130, 246, 0.22);
  color: #dbeafe;
  font-family: var(--font-mono);
  font-size: 1rem;
  font-weight: 800;
}

.timeline-card {
  padding: 18px 20px;
}

.timeline-title {
  font-size: 1.12rem;
}

.timeline-copy {
  margin: 10px 0 0;
  color: var(--text-secondary);
  line-height: 1.8;
}

.timeline-points {
  margin: 12px 0 0;
  padding-left: 18px;
  color: var(--text-secondary);
  line-height: 1.8;
}

.forbidden-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 20px;
}

.empty-workspace h3 {
  margin: 0;
  font-size: 1.16rem;
}

.empty-workspace p {
  margin: 12px 0 0;
  color: var(--text-secondary);
  line-height: 1.8;
}

.mono {
  font-family: var(--font-mono);
}

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(18px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 1180px) {
  .auth-grid,
  .stage-section-head {
    grid-template-columns: 1fr;
  }

  .hero-inline {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
  }

  .hero-side {
    width: 100%;
    justify-items: start;
  }

  .hero-meta-strip,
  .hero-actions {
    justify-content: flex-start;
  }

  .module-grid,
  .module-grid.compact {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .portal-topbar {
    grid-template-columns: 1fr;
  }

  .stage-nav,
  .top-actions {
    justify-content: flex-start;
  }
}

@media (max-width: 720px) {
  .portal-shell,
  .auth-shell {
    width: min(100vw - 18px, 100%);
  }

  .hero-shell,
  .stage-section,
  .auth-card,
  .forbidden-card,
  .empty-workspace {
    padding: 22px 18px;
  }

  .hero-inline,
  .hero-side {
    gap: 14px;
  }

  .hero-actions {
    width: 100%;
    flex-wrap: wrap;
  }

  .quick-grid {
    flex-direction: column;
    align-items: flex-start;
  }

  .quick-card {
    width: 100%;
  }

  .module-grid,
  .module-grid.compact,
  .metric-grid {
    grid-template-columns: 1fr;
  }

  .timeline-step {
    grid-template-columns: 1fr;
  }
}
