:root {
  --bg: #f1f5f9;
  --surface: #ffffff;
  --subtle: #f8fafc;
  --border: #e2e8f0;
  --border-strong: #cbd5e1;
  --text: #0f172a;
  --muted: #475569;
  --soft: #64748b;
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --teal: #0d9488;
  --radius-xl: 22px;
  --radius-lg: 16px;
  --radius-md: 12px;
  --shadow-sm: 0 2px 10px rgba(15, 23, 42, 0.05);
  --shadow-md: 0 12px 30px rgba(15, 23, 42, 0.09);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  min-height: 100%;
  font-family: "Segoe UI", system-ui, -apple-system, BlinkMacSystemFont, Roboto, Arial, sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at 10% 6%, rgba(37, 99, 235, 0.13), transparent 36%),
    radial-gradient(circle at 90% 10%, rgba(13, 148, 136, 0.12), transparent 36%),
    var(--bg);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

.portal-shell {
  max-width: 1180px;
  margin: 0 auto;
  padding: 24px 20px 36px;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

/* Hero */
.portal-hero {
  background: linear-gradient(135deg, #0f172a 0%, #1e3a8a 60%, #0f766e 100%);
  color: #ffffff;
  border-radius: var(--radius-xl);
  padding: 26px 28px;
  box-shadow: var(--shadow-md);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 22px;
  flex-wrap: wrap;
}

.hero-brand {
  display: flex;
  align-items: center;
  gap: 18px;
  max-width: 720px;
}

.hero-logo {
  width: 58px;
  height: 58px;
  flex-shrink: 0;
}

.hero-logo svg {
  width: 100%;
  height: 100%;
  display: block;
}

.hero-eyebrow {
  display: inline-block;
  font-size: 0.74rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #7dd3fc;
  margin-bottom: 4px;
}

.portal-hero h1 {
  margin: 0;
  font-size: 1.65rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1.2;
}

.hero-desc {
  margin: 7px 0 0;
  font-size: 0.94rem;
  color: rgba(241, 245, 249, 0.88);
}

.hero-stats {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.stat-box {
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.2);
  backdrop-filter: blur(8px);
  border-radius: 14px;
  padding: 12px 18px;
  min-width: 132px;
  text-align: center;
}

.stat-box strong {
  display: block;
  font-size: 1.35rem;
  font-weight: 800;
  line-height: 1.15;
}

.stat-box span {
  font-size: 0.76rem;
  color: rgba(226, 232, 240, 0.9);
}

/* Controls Bar */
.controls-bar {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 14px 16px;
  box-shadow: var(--shadow-sm);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
}

.grade-tabs {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.grade-tab {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 2px solid var(--border);
  background: var(--subtle);
  color: var(--text);
  border-radius: 12px;
  padding: 10px 15px;
  font-size: 0.92rem;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
  transition: transform 0.14s ease, border-color 0.16s ease, background 0.16s ease, color 0.16s ease, box-shadow 0.16s ease;
}

.grade-tab:hover {
  border-color: #94a3b8;
  background: #ffffff;
  transform: translateY(-1px);
}

.grade-tab.is-active {
  background: linear-gradient(135deg, #2563eb, #0284c7);
  border-color: transparent;
  color: #ffffff;
  box-shadow: 0 6px 16px rgba(37, 99, 235, 0.25);
}

.tab-count {
  font-size: 0.74rem;
  font-weight: 700;
  min-width: 22px;
  height: 22px;
  padding: 0 7px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #e2e8f0;
  color: #334155;
}

.tab-count.has-items {
  background: #dcfce7;
  color: #166534;
}

.grade-tab.is-active .tab-count {
  background: rgba(255, 255, 255, 0.24);
  color: #ffffff;
}

.search-box {
  display: flex;
  align-items: center;
  gap: 9px;
  background: var(--subtle);
  border: 1.5px solid var(--border-strong);
  border-radius: 12px;
  padding: 8px 12px;
  min-width: 240px;
  flex: 1;
  max-width: 320px;
  color: var(--soft);
  transition: border-color 0.16s ease, box-shadow 0.16s ease;
}

.search-box:focus-within {
  border-color: var(--primary);
  background: #ffffff;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.14);
}

.search-box svg {
  width: 17px;
  height: 17px;
  flex-shrink: 0;
}

.search-box input {
  border: none;
  outline: none;
  background: transparent;
  width: 100%;
  font-size: 0.9rem;
  font-family: inherit;
  color: var(--text);
}

/* Catalog Section */
.catalog-section {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.section-header h2 {
  margin: 0;
  font-size: 1.25rem;
  font-weight: 800;
  letter-spacing: -0.01em;
}

.section-subtitle {
  margin: 3px 0 0;
  font-size: 0.9rem;
  color: var(--muted);
}

.sim-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 18px;
}

.sim-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 18px;
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
}

.sim-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-md);
  border-color: #93c5fd;
}

.sim-banner {
  position: relative;
  height: 152px;
  padding: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  background: linear-gradient(135deg, #0f172a 0%, #1e293b 55%, #1e3a8a 100%);
}

.sim-banner svg {
  width: 100%;
  max-width: 280px;
  height: auto;
}

.sim-grade-badge {
  position: absolute;
  top: 12px;
  left: 12px;
  background: rgba(255, 255, 255, 0.94);
  color: #1e3a8a;
  font-size: 0.74rem;
  font-weight: 800;
  padding: 4px 10px;
  border-radius: 999px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.sim-status-badge {
  position: absolute;
  top: 12px;
  right: 12px;
  background: rgba(16, 185, 129, 0.22);
  color: #6ee7b7;
  border: 1px solid rgba(16, 185, 129, 0.45);
  font-size: 0.72rem;
  font-weight: 700;
  padding: 3px 9px;
  border-radius: 999px;
}

.sim-body {
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  flex: 1;
}

.sim-meta-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
}

.sim-unit {
  font-size: 0.74rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--teal);
}

.sim-outcome-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.02em;
  padding: 3px 9px;
  border-radius: 999px;
  background: #eff6ff;
  color: #1d4ed8;
  border: 1px solid #bfdbfe;
  white-space: nowrap;
}

.sim-title {
  margin: 0;
  font-size: 1.12rem;
  font-weight: 800;
  color: var(--text);
  line-height: 1.3;
}

.sim-desc {
  margin: 0;
  font-size: 0.88rem;
  color: var(--muted);
  flex: 1;
}

.sim-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 2px;
}

.sim-tag {
  font-size: 0.74rem;
  font-weight: 600;
  padding: 3px 9px;
  border-radius: 999px;
  background: var(--subtle);
  border: 1px solid var(--border);
  color: var(--muted);
}

.sim-footer {
  padding: 0 18px 18px;
}

.btn-launch {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  text-decoration: none;
  background: linear-gradient(135deg, #2563eb, #0284c7);
  color: #ffffff;
  font-size: 0.92rem;
  font-weight: 700;
  padding: 11px 16px;
  border-radius: 12px;
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.25);
  transition: transform 0.14s ease, box-shadow 0.16s ease, background 0.16s ease;
}

.btn-launch:hover {
  background: linear-gradient(135deg, #1d4ed8, #0369a1);
  box-shadow: 0 7px 18px rgba(37, 99, 235, 0.34);
  transform: translateY(-1px);
}

.btn-launch svg {
  width: 18px;
  height: 18px;
}

/* Empty State */
.empty-state {
  background: var(--surface);
  border: 2px dashed var(--border-strong);
  border-radius: var(--radius-lg);
  padding: 40px 24px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}

.empty-state[hidden] {
  display: none;
}

.empty-icon {
  width: 56px;
  height: 56px;
}

.empty-state h3 {
  margin: 4px 0 0;
  font-size: 1.08rem;
  font-weight: 700;
}

.empty-state p {
  margin: 0;
  max-width: 440px;
  font-size: 0.9rem;
  color: var(--muted);
}

.btn-outline {
  margin-top: 8px;
  border: 1.5px solid var(--primary);
  background: #eff6ff;
  color: var(--primary-dark);
  font-size: 0.88rem;
  font-weight: 700;
  font-family: inherit;
  padding: 9px 16px;
  border-radius: 10px;
  cursor: pointer;
  transition: background 0.16s ease, color 0.16s ease;
}

.btn-outline:hover {
  background: var(--primary);
  color: #ffffff;
}

/* Footer */
.portal-footer {
  margin-top: auto;
  padding-top: 14px;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  font-size: 0.82rem;
  color: var(--soft);
}

@media (max-width: 720px) {
  .portal-shell {
    padding: 14px 12px 24px;
  }

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

  .portal-hero h1 {
    font-size: 1.32rem;
  }

  .search-box {
    max-width: none;
    width: 100%;
  }

  .sim-grid {
    grid-template-columns: 1fr;
  }
}
