:root {
  color-scheme: light;
  --bg: #f4f7ff;
  --bg-alt: #eef3ff;
  --surface: rgba(255, 255, 255, 0.8);
  --surface-strong: #ffffff;
  --surface-soft: rgba(240, 245, 255, 0.88);
  --border: rgba(68, 95, 168, 0.14);
  --border-strong: rgba(70, 105, 255, 0.24);
  --text: #112246;
  --muted: #62779d;
  --accent: #366cff;
  --accent-strong: #7b4fff;
  --accent-soft: rgba(54, 108, 255, 0.1);
  --success: #12ad83;
  --danger: #ed5f7a;
  --warning: #db9a20;
  --shadow: 0 22px 70px rgba(57, 88, 150, 0.14);
  --hero-shadow: 0 34px 90px rgba(75, 102, 166, 0.18);
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #060c17;
  --bg-alt: #09121f;
  --surface: rgba(10, 18, 34, 0.82);
  --surface-strong: #0f1a31;
  --surface-soft: rgba(15, 26, 48, 0.92);
  --border: rgba(154, 187, 255, 0.12);
  --border-strong: rgba(111, 166, 255, 0.22);
  --text: #eef4ff;
  --muted: #9bb0d2;
  --accent: #7ea2ff;
  --accent-strong: #b07cff;
  --accent-soft: rgba(126, 162, 255, 0.12);
  --success: #2dd3a4;
  --danger: #ff7f99;
  --warning: #f4b643;
  --shadow: 0 28px 92px rgba(0, 0, 0, 0.36);
  --hero-shadow: 0 40px 110px rgba(0, 0, 0, 0.42);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Segoe UI Variable", "Segoe UI", Inter, system-ui, sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at 10% 8%, rgba(67, 106, 255, 0.18), transparent 32%),
    radial-gradient(circle at 84% 18%, rgba(147, 93, 255, 0.14), transparent 28%),
    linear-gradient(145deg, var(--bg) 0%, var(--bg-alt) 100%);
  transition: background 220ms ease, color 220ms ease;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.03) 1px, transparent 1px);
  background-size: 32px 32px;
  mask-image: linear-gradient(180deg, rgba(255,255,255,0.3), transparent 85%);
}

button,
a,
input,
select {
  font: inherit;
}

a {
  color: inherit;
  text-decoration: none;
}

.hidden {
  display: none !important;
}

.site-backdrop {
  position: fixed;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(circle at 18% 22%, rgba(85, 123, 255, 0.18), transparent 26%),
    radial-gradient(circle at 82% 76%, rgba(124, 88, 255, 0.12), transparent 24%);
  filter: blur(12px);
}

.site-shell {
  width: min(1480px, calc(100% - 28px));
  margin: 0 auto;
  padding: 22px 0 54px;
}

.topbar,
.hero-copy,
.hero-panel,
.story-card,
.content-section,
.tips-section,
.access-section,
.portal-shell,
.sidebar-card,
.material-card,
.notification-item,
.modal-card {
  border: 1px solid var(--border);
  background: var(--surface);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.topbar {
  position: sticky;
  top: 16px;
  z-index: 20;
  border-radius: 999px;
  padding: 14px 18px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 18px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 14px;
}

.brand-mark {
  width: 46px;
  height: 46px;
  border-radius: 16px;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.72), transparent 52%),
    linear-gradient(135deg, var(--accent), var(--accent-strong));
  box-shadow: 0 16px 38px rgba(57, 104, 255, 0.24);
  position: relative;
}

.brand-mark::after {
  content: "";
  position: absolute;
  inset: 11px;
  border-radius: 11px;
  border: 2px solid rgba(255, 255, 255, 0.76);
}

.brand-copy {
  display: grid;
}

.brand-copy strong {
  letter-spacing: 0.18em;
  font-size: 1rem;
}

.brand-copy small,
.eyebrow,
.card-kicker {
  color: var(--muted);
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.nav-links,
.topbar-actions,
.hero-actions,
.hero-pills,
.access-actions,
.portal-actions,
.toolbar-tabs,
.toolbar-filters,
.footer-links,
.otp-actions,
.form-grid {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.nav-links a {
  padding: 9px 12px;
  color: var(--muted);
  border-radius: 999px;
}

.nav-links a:hover,
.footer-links a:hover {
  color: var(--text);
  background: var(--accent-soft);
}

.primary-button,
.ghost-button,
.theme-toggle,
.switch-tab,
.scope-tab,
.tiny-button,
.close-button {
  border-radius: 999px;
  border: 1px solid var(--border);
  cursor: pointer;
  transition: transform 180ms ease, box-shadow 220ms ease, border-color 220ms ease, background 220ms ease;
}

.primary-button,
.switch-tab.active,
.scope-tab.active {
  border-color: transparent;
  color: #ffffff;
  background: linear-gradient(135deg, var(--accent), var(--accent-strong));
  box-shadow: 0 16px 34px rgba(80, 96, 191, 0.24);
}

.primary-button,
.ghost-button,
.theme-toggle,
.switch-tab,
.scope-tab,
.tiny-button {
  padding: 12px 16px;
}

.ghost-button,
.theme-toggle,
.switch-tab,
.scope-tab,
.tiny-button,
.close-button,
.toolbar-filters input,
.toolbar-filters select,
.auth-form input,
.auth-form select {
  background: var(--surface-soft);
  color: var(--text);
}

.primary-button:hover,
.ghost-button:hover,
.theme-toggle:hover,
.switch-tab:hover,
.scope-tab:hover,
.tiny-button:hover,
.close-button:hover {
  transform: translateY(-2px);
}

.theme-toggle,
.close-button {
  color: var(--text);
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.12fr) minmax(360px, 0.88fr);
  gap: 28px;
  padding: 42px 0 24px;
  align-items: center;
}

.hero-copy,
.hero-panel,
.story-card,
.content-section,
.tips-section,
.access-section,
.portal-shell,
.modal-card {
  border-radius: 32px;
}

.hero-copy {
  padding: 38px;
}

.hero-copy h1,
.story-card h2,
.story-card h3,
.section-head h2,
.access-copy h2,
.portal-topbar h2,
.auth-head h2 {
  margin: 0;
  font-family: Georgia, "Times New Roman", serif;
  letter-spacing: -0.04em;
}

.hero-copy h1 {
  font-size: clamp(3rem, 5.6vw, 5.6rem);
  line-height: 0.95;
  margin-bottom: 18px;
}

.hero-copy p,
.story-card p,
.section-head p,
.access-copy p,
.hero-panel p,
.material-copy p,
.notification-item p,
.auth-head p,
.profile-meta,
.portal-topbar p,
.hero-mini-grid span {
  color: var(--muted);
  line-height: 1.7;
}

.hero-pills span,
.hero-badge,
.card-kicker,
.eyebrow,
.auth-flash,
.notify-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  width: fit-content;
  padding: 8px 12px;
  border-radius: 999px;
  background: var(--accent-soft);
}

.hero-visual {
  min-height: 100%;
}

.hero-panel {
  position: relative;
  padding: 28px;
  min-height: 420px;
  overflow: hidden;
  box-shadow: var(--hero-shadow);
  background:
    radial-gradient(circle at 80% 18%, rgba(92, 133, 255, 0.22), transparent 30%),
    radial-gradient(circle at 22% 85%, rgba(132, 91, 255, 0.16), transparent 26%),
    linear-gradient(160deg, rgba(255,255,255,0.14), rgba(255,255,255,0.04));
}

.hero-panel-glow {
  position: absolute;
  inset: auto -70px -80px auto;
  width: 220px;
  height: 220px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(95, 131, 255, 0.5), transparent 65%);
  filter: blur(22px);
}

.hero-panel h2 {
  margin: 18px 0 12px;
  font-size: clamp(2rem, 3vw, 2.8rem);
  max-width: 11ch;
}

.hero-mini-grid,
.content-grid,
.tips-grid,
.portal-grid,
.material-grid {
  display: grid;
  gap: 16px;
}

.hero-mini-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin-top: 26px;
}

.hero-mini-grid article,
.tip-card,
.news-card,
.material-card,
.notification-item {
  padding: 18px;
  border-radius: 22px;
  border: 1px solid var(--border);
  background: var(--surface-soft);
}

.story-grid {
  margin-top: 8px;
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(320px, 0.55fr);
  gap: 18px;
}

.story-card,
.content-section,
.tips-section,
.access-section,
.portal-shell {
  padding: 30px;
}

.content-section,
.tips-section,
.access-section,
.portal-shell {
  margin-top: 24px;
}

.section-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 18px;
  margin-bottom: 18px;
}

.section-badge {
  padding: 10px 16px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface-soft);
  color: var(--muted);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  white-space: nowrap;
}

.content-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.tips-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.news-card h3,
.tip-card h3,
.material-copy h3,
.sidebar-card strong {
  margin: 0 0 8px;
}

.news-card ul,
.tip-card ul {
  margin: 12px 0 0;
  padding-left: 18px;
  color: var(--muted);
}

.news-card li,
.tip-card li {
  margin-top: 6px;
}

.portal-shell {
  scroll-margin-top: 100px;
}

.portal-topbar {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: start;
  margin-bottom: 20px;
}

.portal-grid {
  grid-template-columns: minmax(260px, 0.34fr) minmax(0, 0.66fr);
}

.portal-sidebar {
  display: grid;
  gap: 16px;
}

.sidebar-card,
.material-card,
.notification-item {
  background: var(--surface-soft);
}

.profile-card,
.notify-card {
  padding: 18px;
  border-radius: 24px;
}

.profile-card strong {
  font-size: 1.3rem;
}

.profile-card span,
.profile-meta span,
.material-meta,
.notification-time,
.card-head button,
.hero-badge,
.auth-flash {
  color: var(--muted);
}

.profile-meta {
  display: grid;
  gap: 8px;
  margin-top: 14px;
}

.card-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  margin-bottom: 12px;
}

.notification-list {
  display: grid;
  gap: 12px;
  max-height: 520px;
  overflow: auto;
}

.notification-item {
  cursor: pointer;
}

.notification-item.is-unread {
  border-color: var(--border-strong);
  box-shadow: inset 0 0 0 1px rgba(70, 105, 255, 0.16);
}

.portal-toolbar {
  display: grid;
  gap: 14px;
  margin-bottom: 16px;
}

.toolbar-filters input,
.toolbar-filters select,
.auth-form input,
.auth-form select {
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 14px 16px;
  min-width: 0;
  flex: 1;
}

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

.material-card {
  display: grid;
  gap: 14px;
}

.material-top {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: start;
}

.material-copy h3 {
  font-size: 1.08rem;
}

.material-copy p {
  margin: 0;
}

.material-meta,
.notification-time,
.otp-meta,
.auth-flash {
  font-size: 0.9rem;
}

.notify-chip {
  font-size: 0.78rem;
  color: var(--accent);
}

.material-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.empty-state {
  padding: 28px;
  border-radius: 24px;
  border: 1px dashed var(--border-strong);
  text-align: center;
  color: var(--muted);
  background: var(--surface-soft);
}

.site-footer {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  margin-top: 28px;
  padding: 16px 4px 0;
  color: var(--muted);
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: grid;
  place-items: center;
  padding: 18px;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(8, 14, 26, 0.58);
  backdrop-filter: blur(8px);
}

.modal-card {
  position: relative;
  z-index: 1;
  width: min(760px, calc(100% - 10px));
  padding: 30px;
}

.auth-card {
  display: grid;
  gap: 16px;
}

.close-button {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  padding: 0;
}

.auth-head {
  max-width: 58ch;
}

.auth-switcher {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.auth-flash {
  color: var(--text);
  border: 1px solid var(--border);
}

.auth-flash.is-error {
  background: rgba(237, 95, 122, 0.1);
  color: var(--danger);
  border-color: rgba(237, 95, 122, 0.22);
}

.auth-flash.is-success {
  background: rgba(18, 173, 131, 0.1);
  color: var(--success);
  border-color: rgba(18, 173, 131, 0.2);
}

.auth-form {
  display: grid;
  gap: 14px;
}

.auth-form label {
  display: grid;
  gap: 8px;
  color: var(--text);
  font-weight: 600;
}

.form-grid.two-col > * {
  flex: 1 1 calc(50% - 6px);
}

.wide-button {
  justify-content: center;
}

.otp-card {
  width: min(520px, calc(100% - 12px));
}

.otp-actions {
  justify-content: space-between;
}

.reveal {
  opacity: 0;
  transform: translateY(18px);
  transition: opacity 600ms ease, transform 600ms ease;
}

.reveal.is-visible {
  opacity: 1;
  transform: none;
}

@media (max-width: 1080px) {
  .hero,
  .story-grid,
  .portal-grid {
    grid-template-columns: 1fr;
  }

  .content-grid,
  .tips-grid,
  .material-grid,
  .hero-mini-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .topbar,
  .section-head,
  .portal-topbar,
  .site-footer {
    flex-direction: column;
    align-items: stretch;
  }
}

@media (max-width: 720px) {
  .site-shell {
    width: min(100% - 16px, 1480px);
  }

  .topbar {
    border-radius: 28px;
    padding: 14px;
  }

  .nav-links {
    display: none;
  }

  .hero,
  .content-grid,
  .tips-grid,
  .hero-mini-grid,
  .material-grid {
    grid-template-columns: 1fr;
  }

  .hero-copy,
  .hero-panel,
  .story-card,
  .content-section,
  .tips-section,
  .access-section,
  .portal-shell,
  .modal-card {
    padding: 22px;
    border-radius: 24px;
  }

  .toolbar-filters,
  .portal-actions,
  .topbar-actions,
  .access-actions,
  .hero-actions,
  .footer-links,
  .otp-actions {
    flex-direction: column;
  }

  .form-grid.two-col > * {
    flex-basis: 100%;
  }
}

.space-shell {
  padding-bottom: 32px;
}

.portal-shell--standalone {
  margin-top: 52px;
}

.reader-open {
  overflow: hidden;
}

.reader-locked,
.reader-locked * {
  -webkit-user-select: none;
  user-select: none;
}

.reader-shell {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: grid;
  place-items: center;
  padding: 28px;
}

.reader-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(3, 8, 20, 0.74);
  backdrop-filter: blur(18px);
}

.reader-window {
  position: relative;
  width: calc(100vw - 14px);
  height: calc(100vh - 14px);
  border-radius: 18px;
  border: 1px solid var(--border-strong);
  background: var(--surface-strong);
  box-shadow: var(--hero-shadow);
  padding: 6px 6px 8px;
  display: grid;
  grid-template-rows: auto 1fr;
  gap: 6px;
}

.reader-topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  min-height: 40px;
  padding: 0 2px;
}

.reader-topbar h2 {
  margin: 0;
  font-family: Georgia, "Times New Roman", serif;
  letter-spacing: -0.04em;
  font-size: clamp(1rem, 1.45vw, 1.35rem);
  line-height: 1.1;
  max-width: calc(100% - 92px);
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.reader-message,
.reader-flash,
.reader-shield {
  color: var(--muted);
}

.reader-stage {
  position: relative;
  overflow: hidden;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: linear-gradient(180deg, rgba(13, 20, 35, 0.04), rgba(13, 20, 35, 0.12));
  min-height: 0;
}

.reader-topbar .ghost-button {
  padding: 8px 12px;
  min-width: 74px;
}

.reader-frame,
.reader-image,
.reader-text,
.reader-message,
.reader-shield {
  width: 100%;
  height: 100%;
}

.reader-frame {
  border: 0;
  background: #111723;
}

.reader-image {
  object-fit: contain;
  display: block;
  background: #111723;
}

.reader-text {
  margin: 0;
  padding: 28px;
  overflow: auto;
  white-space: pre-wrap;
  line-height: 1.8;
  color: var(--text);
}

.reader-message,
.reader-shield {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 24px;
  text-align: center;
  font-size: 1rem;
}

.reader-shield {
  background: rgba(5, 9, 20, 0.84);
  color: #f4f7ff;
  z-index: 2;
}

.reader-flash {
  padding: 12px 16px;
  border-radius: 16px;
  border: 1px solid rgba(237, 95, 122, 0.24);
  background: rgba(237, 95, 122, 0.1);
}

@media (max-width: 920px) {
  .reader-shell {
    padding: 12px;
  }

  .reader-window {
    width: calc(100vw - 8px);
    height: calc(100vh - 8px);
    padding: 4px;
    border-radius: 14px;
  }

  .reader-topbar {
    flex-direction: column;
    align-items: stretch;
    min-height: auto;
  }

  .reader-topbar h2 {
    max-width: 100%;
  }
}
