:root {
  --bg: #071018;
  --text: #f4f7fb;
  --muted: rgba(255,255,255,0.74);
  --line: rgba(255,255,255,0.16);
  --glass: rgba(15, 22, 32, 0.28);
  --glass-strong: rgba(10, 16, 24, 0.64);
  --shadow: 0 18px 55px rgba(0,0,0,0.40);
  --radius: 24px;
  --safe-top: max(16px, env(safe-area-inset-top));
  --safe-right: max(16px, env(safe-area-inset-right));
  --safe-bottom: max(16px, env(safe-area-inset-bottom));
  --safe-left: max(16px, env(safe-area-inset-left));
}

* { box-sizing: border-box; }
html, body {
  height: 100%;
  min-height: 100%;
}
html {
  -webkit-text-size-adjust: 100%;
}
body {
  margin: 0;
  font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
  color: var(--text);
  background: var(--bg);
  overscroll-behavior: none;
}
body.randy-daha-immersive-home,
body.modal-open {
  overflow: hidden;
}
a { color: inherit; text-decoration: none; }
button, input, textarea, select { font: inherit; }
img { max-width: 100%; height: auto; display: block; }

.site-bg,
.site-overlay {
  position: fixed;
  inset: 0;
}
.site-bg {
  z-index: 0;
  background-position: center center;
  background-repeat: no-repeat;
  background-size: cover;
  transform: translateZ(0);
}
.site-overlay {
  z-index: 1;
  background:
    linear-gradient(180deg, rgba(0,0,0,0.18), rgba(0,0,0,0.36)),
    radial-gradient(circle at top right, rgba(255,153,0,0.14), transparent 40%),
    radial-gradient(circle at left center, rgba(0,190,255,0.10), transparent 45%);
}
.glass {
  background: var(--glass);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
}

.app-shell,
.default-page-shell {
  position: relative;
  z-index: 2;
}
.app-shell--viewport {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  gap: 14px;
  min-height: 100vh;
  min-height: 100svh;
  min-height: 100dvh;
  height: 100vh;
  height: 100svh;
  height: 100dvh;
  padding: var(--safe-top) var(--safe-right) var(--safe-bottom) var(--safe-left);
  overflow: hidden;
}
.shell-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  border-radius: 20px;
  padding: 12px 18px;
  min-height: 68px;
}
.shell-header--top-only {
  flex-wrap: wrap;
}
.brand-block {
  min-width: 0;
}
.brand-kicker {
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.brand-subtitle {
  margin-top: 4px;
  color: var(--muted);
  font-size: 0.93rem;
}
.top-nav {
  min-width: 0;
}
.top-nav .menu {
  list-style: none;
  display: flex;
  gap: 6px;
  margin: 0;
  padding: 0;
  flex-wrap: wrap;
  justify-content: flex-end;
}
.top-nav li {
  margin: 0;
}
.top-nav a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  padding: 8px 12px;
  border-radius: 999px;
  color: #fff;
  border: 1px solid transparent;
  background: transparent;
  transition: background .2s ease, border-color .2s ease, transform .2s ease;
}
.top-nav a:hover,
.top-nav a:focus-visible {
  background: rgba(255,255,255,0.12);
  border-color: rgba(255,255,255,0.20);
  transform: translateY(-1px);
}

.shell-main--empty {
  min-height: 0;
  pointer-events: none;
}

.content-rail-wrap {
  border-radius: 20px;
  padding: 12px 12px 10px;
  min-height: 164px;
  max-height: min(36vh, 280px);
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
}
.content-rail-wrap--footer {
  overflow: hidden;
  margin-bottom: clamp(10px, 2vh, 24px);
}
.rail-heading {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: baseline;
  color: var(--muted);
  padding: 2px 4px 10px;
}
.rail-heading span {
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  font-size: 0.82rem;
}
.rail-heading small {
  font-size: 0.8rem;
}
.content-rail {
  display: flex;
  gap: 12px;
  overflow-x: auto;
  overflow-y: hidden;
  min-height: 0;
  padding: 2px 2px 8px;
  scroll-snap-type: x proximity;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-x: contain;
  overscroll-behavior-y: none;
  touch-action: pan-x;
}
.content-rail::-webkit-scrollbar,
.modal-panel::-webkit-scrollbar {
  height: 10px;
  width: 10px;
}
.content-rail::-webkit-scrollbar-thumb,
.modal-panel::-webkit-scrollbar-thumb {
  background: rgba(255,255,255,0.24);
  border-radius: 999px;
}
.rail-card {
  cursor: pointer;
  min-width: clamp(200px, 24vw, 260px);
  max-width: clamp(200px, 24vw, 260px);
  min-height: 112px;
  padding: 14px;
  border-radius: 18px;
  text-align: left;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 10px;
  border: 1px solid rgba(255,255,255,0.16);
  background: rgba(255,255,255,0.08);
  color: #fff;
  scroll-snap-align: start;
  transition: background .2s ease, transform .2s ease, border-color .2s ease;
}
.rail-card strong {
  display: block;
  font-size: 1rem;
  line-height: 1.15;
}
.rail-card-type,
.rail-card-meta,
.rail-empty {
  color: var(--muted);
}
.rail-card:hover,
.rail-card:focus-visible {
  background: rgba(255,255,255,0.14);
  border-color: rgba(255,255,255,0.24);
  transform: translateY(-2px);
}
.rail-empty {
  padding: 16px 4px;
}

.default-page-shell {
  display: grid;
  grid-template-rows: auto 1fr;
  min-height: 100vh;
  min-height: 100svh;
  min-height: 100dvh;
  padding: var(--safe-top) var(--safe-right) var(--safe-bottom) var(--safe-left);
}
.shell-header--static,
.page-panel {
  margin: 0 0 16px;
}
.page-panel {
  border-radius: 28px;
  padding: 28px;
  max-width: 980px;
  width: 100%;
  max-height: calc(100dvh - 132px);
  overflow: auto;
}

.modal-layer {
  position: fixed;
  inset: 0;
  z-index: 60;
}
.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(5, 8, 12, 0.58);
}
.modal-panel {
  position: absolute;
  left: 50%;
  top: max(6vh, var(--safe-top));
  transform: translateX(-50%);
  width: min(1040px, calc(100vw - var(--safe-left) - var(--safe-right) - 24px));
  max-height: calc(100dvh - var(--safe-top) - var(--safe-bottom) - 32px);
  overflow: auto;
  border-radius: 28px;
  padding: 22px;
  -webkit-overflow-scrolling: touch;
}
.modal-close {
  position: sticky;
  top: 0;
  margin-left: auto;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,0.18);
  background: rgba(255,255,255,0.08);
  color: #fff;
  cursor: pointer;
  z-index: 2;
}
.panel-kicker {
  margin: 0 0 12px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 0.76rem;
  color: rgba(255,255,255,0.78);
}
.panel-template h2,
.page-panel h1 {
  margin: 0 0 14px;
  font-size: clamp(1.8rem, 3.5vw, 3.6rem);
  line-height: 1;
}
.panel-template p,
.panel-template li,
.panel-body,
.page-panel {
  color: rgba(255,255,255,0.92);
  line-height: 1.68;
}
.panel-image {
  margin: 20px 0;
}
.panel-image img {
  width: 100%;
  border-radius: 18px;
}
.modal-templates {
  display: none;
}

@media (max-width: 980px) {
  .shell-header {
    align-items: flex-start;
  }
  .top-nav .menu {
    justify-content: flex-start;
  }
  .content-rail-wrap {
    max-height: min(40vh, 300px);
  }
}

@media (max-width: 720px) {
  .app-shell--viewport {
    gap: 10px;
  }
  .shell-header {
    padding: 12px 14px;
    min-height: auto;
  }
  .brand-kicker {
    font-size: 0.92rem;
  }
  .brand-subtitle {
    font-size: 0.82rem;
  }
  .top-nav .menu {
    gap: 4px;
  }
  .top-nav a {
    min-height: 34px;
    padding: 6px 10px;
    font-size: 0.92rem;
  }
  .content-rail-wrap {
    min-height: 148px;
    max-height: min(34vh, 240px);
    padding: 10px 10px 8px;
  }
  .rail-heading {
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
  }
  .rail-card {
    min-width: min(72vw, 250px);
    max-width: min(72vw, 250px);
    min-height: 102px;
  }
  .modal-panel {
    top: max(10px, var(--safe-top));
    width: calc(100vw - var(--safe-left) - var(--safe-right) - 12px);
    max-height: calc(100dvh - var(--safe-top) - var(--safe-bottom) - 12px);
    padding: 16px;
    border-radius: 20px;
  }
}

@media (max-width: 480px) {
  .app-shell--viewport {
    padding: var(--safe-top) max(10px, env(safe-area-inset-right)) var(--safe-bottom) max(10px, env(safe-area-inset-left));
  }
  .shell-header {
    border-radius: 16px;
  }
  .brand-subtitle {
    display: none;
  }
  .content-rail-wrap {
    min-height: 136px;
    max-height: min(32vh, 210px);
    border-radius: 16px;
  }
  .rail-card {
    min-width: 76vw;
    max-width: 76vw;
    padding: 12px;
  }
  .rail-card strong {
    font-size: 0.96rem;
  }
}
