/* Home and DEX share one camera track. No cursor parallax. */
.rooftop-viewport {
  --roof-duration: 700ms;
  position: relative;
  width: 100vw;
  overflow: hidden;
  isolation: isolate;
  background: #031322;
  height: var(--roof-height, auto);
}
.rooftop-track {
  position: relative;
  width: 200vw;
  display: flex;
  align-items: flex-start;
  transform: translate3d(0, 0, 0);
  transition: transform var(--roof-duration) cubic-bezier(.65, 0, .25, 1);
}
.rooftop-viewport[data-rooftop-scene="dex"] .rooftop-track { transform: translate3d(-100vw, 0, 0); }
.rooftop-viewport:not(.is-ready) .rooftop-track { transition: none; }
.rooftop-track > .landing,
.rooftop-track > .dex-page { flex: 0 0 100vw; width: 100vw; min-width: 0; }
.rooftop-track > .landing { z-index: 1; }
.rooftop-track > .landing .city-bg {
  /* The unchanged original covers the home view. Only its last edge blends. */
  -webkit-mask-image: linear-gradient(90deg, #000 0 93%, transparent 98.3%);
  mask-image: linear-gradient(90deg, #000 0 93%, transparent 98.3%);
}
.rooftop-track > .landing .city-shade {
  -webkit-mask-image: linear-gradient(90deg, #000 0 94%, transparent 100%);
  mask-image: linear-gradient(90deg, #000 0 94%, transparent 100%);
}
.rooftop-panorama {
  --roof-art-height: max(650px, 100svh);
  position: absolute;
  z-index: 0;
  left: 94vw;
  top: calc(var(--roof-art-height) * -.0175);
  width: 106vw;
  height: calc(var(--roof-art-height) * 1.035);
  pointer-events: none;
  /* The 21:9 outpaint covers a wide desktop without scaling up the rail gap.
     Use the same 3.5% vertical overscan as Home; keep the two rails distinct.
     The original Home artwork is unchanged, with only a 6vw seam overlap. */
  background: url('./assets/city-rooftop-right-v3-wide.png') left center / cover no-repeat;
  filter: saturate(1.08) contrast(1.02) brightness(1.01);
}
.dex-page {
  position: relative;
  z-index: 1;
  min-height: max(650px, 100svh);
  color: #edf7fa;
  background: linear-gradient(180deg, rgba(1, 8, 18, .1), transparent 40%, rgba(1, 8, 18, .13));
}
.dex-content {
  width: min(91vw, 1500px);
  margin: 0 auto;
  min-height: max(650px, 100svh);
  padding: max(100px, 11vh) 0 22px;
  display: flex;
  flex-direction: column;
}
.dex-header { display: flex; justify-content: space-between; align-items: center; gap: 20px; margin-bottom: 28px; }
.dex-back {
  display: inline-flex; align-items: center; gap: 12px; min-height: 40px; padding: 0 17px;
  font-size: 12px; color: #e3f8ff; border: 1px solid rgba(75, 216, 242, .5); border-radius: 22px;
  background: linear-gradient(180deg, #102438, #06121f);
  box-shadow: inset 0 1px 0 rgba(175, 240, 255, .1), 0 0 14px rgba(44, 215, 249, .1);
  transition: border-color .2s, box-shadow .2s;
}
.dex-back:hover { border-color: var(--cyan); box-shadow: 0 0 17px rgba(44, 215, 249, .24); }
.dex-back > span { color: var(--cyan); font-size: 23px; transition: transform .2s; }
.dex-back:hover > span { transform: translateX(-4px); }
.dex-location, .dex-eyebrow, .dex-footer {
  font-size: 10px; font-weight: 700; letter-spacing: .14em; color: #b7d8e4;
}
.dex-location {
  display: flex; align-items: center; gap: 12px; min-height: 36px; padding: 0 15px;
  border: 1px solid rgba(242, 95, 220, .3); border-radius: 6px; background: rgba(5, 16, 31, .94);
}
.dex-location i { width: 5px; height: 5px; border-radius: 50%; background: var(--cyan); box-shadow: 0 0 8px var(--cyan); }
.dex-workspace {
  display: grid; grid-template-columns: minmax(270px, .95fr) minmax(0, 3fr);
  gap: clamp(24px, 2.3vw, 40px); align-items: stretch;
  min-height: clamp(460px, calc(100svh - 236px), 690px);
}
/* Reuse the actual Home artwork. Nine-slice preserves the corner proportions;
   the small outset compensates for the PNG's transparent outer margins. */
.dex-panel { position: relative; isolation: isolate; min-width: 0; padding: 24px; }
.dex-panel::before {
  content: ''; position: absolute; z-index: -1; inset: -25px -4px -43px; pointer-events: none;
  border: solid transparent; border-width: 48px 30px 54px;
  border-image: url('./assets/panel-new.png') 190 180 220 fill stretch;
  filter: drop-shadow(0 14px 20px rgba(0, 5, 14, .3));
}
.dex-overview { display: flex; flex-direction: column; }
.dex-identity {
  display: flex; align-items: center; gap: 10px; padding-bottom: 18px; margin-bottom: 22px;
  border-bottom: 1px solid rgba(76, 199, 226, .23);
}
.dex-identity img {
  flex: 0 0 42px; width: 42px; height: 42px; object-fit: cover; border-radius: 50%;
  border: 1px solid rgba(165, 255, 208, .85); box-shadow: 0 0 12px rgba(79, 248, 185, .18);
}
.dex-eyebrow { color: #e6f5f9; margin: 0; font-size: 9px; letter-spacing: .045em; line-height: 1.65; }
.dex-eyebrow span { color: #82b9c9; font-size: 8px; letter-spacing: .065em; }
.dex-overview h1 { margin: 0; font-size: clamp(38px, 3.7vw, 61px); line-height: .98; letter-spacing: -.055em; font-weight: 900; }
.dex-overview h1 > span { color: var(--green); text-shadow: 0 0 20px rgba(138,255,41,.18), 0 2px 8px #051820; }
.dex-overview h1 em { display: inline-block; font-size: .49em; font-style: normal; letter-spacing: .14em; margin-top: 12px; }
.dex-intro { color: #c2d8e1; font-size: 13px; line-height: 1.7; margin: 20px 0 24px; }
.dex-price-block {
  display: grid; gap: 9px; padding: 17px 0 18px;
  border-top: 1px solid rgba(116, 208, 230, .25); border-bottom: 1px solid rgba(116, 208, 230, .16);
  margin-bottom: auto;
}
.dex-price-block > span { font-size: 10px; font-weight: 700; letter-spacing: .14em; color: #89d8e8; }
.dex-price-block strong { font-size: clamp(23px, 2.1vw, 32px); font-weight: 700; overflow-wrap: anywhere; font-variant-numeric: tabular-nums; }
.dex-price-block small { font-size: 11px; line-height: 1.5; color: #b5c8d6; }
[data-dex-change].is-positive { color: var(--green); }
[data-dex-change].is-negative { color: #ff7ab7; }
.dex-action {
  display: flex; justify-content: space-between; align-items: center; gap: 12px;
  min-height: 45px; padding: 12px 15px; margin-top: 22px; font-size: 12px; font-weight: 700;
  border: 1px solid rgba(115, 255, 169, .7); border-radius: 12px;
  background: linear-gradient(180deg, #0b3036, #061726); color: #d4ffb8;
  box-shadow: inset 0 1px 0 rgba(162, 255, 224, .12), 0 0 13px rgba(37, 221, 184, .1);
  transition: background .2s, box-shadow .2s;
}
.dex-action:hover { background: #12383b; box-shadow: 0 0 18px rgba(87,255,163,.24); }
.dex-external {
  display: flex; justify-content: space-between; gap: 12px; margin-top: 10px; min-height: 40px; align-items: center;
  font-size: 11px; color: #d0e5ee; padding: 11px 15px; border-radius: 12px;
  border: 1px solid rgba(207, 99, 239, .44); background: #081425;
}
.dex-external:hover, .dex-chart-note a:hover { color: var(--cyan); }
.dex-chart-area { min-width: 0; display: flex; flex-direction: column; }
.dex-chart-heading {
  min-height: 38px; display: flex; justify-content: space-between; align-items: center; gap: 12px;
  font-size: 11px; font-weight: 700; letter-spacing: .11em; color: #dcf5fc;
  padding-bottom: 13px; margin-bottom: 14px; border-bottom: 1px solid rgba(76, 199, 226, .23);
}
.dex-chart-heading > span:first-child { min-width: 0; overflow-wrap: anywhere; }
.dex-chart-heading b { display: inline-block; font-size: 10px; color: #98d4de; margin-left: 9px; }
.dex-status {
  flex-shrink: 0; font-size: 9px; letter-spacing: .06em; color: #b1cbd7; white-space: nowrap;
  padding: 7px 10px; border: 1px solid rgba(91, 174, 194, .32); border-radius: 5px; background: #081726;
}
.dex-status.is-live { color: var(--green); }
.dex-chart-surface {
  flex: 1; min-height: 260px;
  position: relative; overflow: hidden; border-radius: 6px 6px 0 0;
  border: 1px solid rgba(102, 221, 236, .26);
  background: #06121e;
  box-shadow: inset 0 1px 20px rgba(0, 4, 14, .25);
}
.dex-chart-surface iframe { position: absolute; inset: 0; width: 100%; height: 100%; display: block; border: 0; background: #07111c; }
.dex-chart-surface iframe[hidden] { display: none; }
.dex-empty {
  position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 25px; text-align: center;
  background-image: linear-gradient(rgba(92,160,185,.045) 1px, transparent 1px), linear-gradient(90deg, rgba(92,160,185,.045) 1px, transparent 1px);
  background-size: 72px 58px;
}
.dex-empty[hidden] { display: none; }
.dex-empty-icon { font-size: 40px; color: #6dc4d2; line-height: 1; margin-bottom: 20px; }
.dex-empty strong { font-size: clamp(17px, 1.65vw, 23px); font-weight: 500; letter-spacing: -.02em; }
.dex-empty p { font-size: 13px; line-height: 1.6; max-width: 360px; color: #b1c7d2; }
.dex-empty small { margin-top: 14px; font-size: 11px; letter-spacing: .025em; color: #89a6b5; }
.dex-metrics {
  display: grid; grid-template-columns: repeat(3, 1fr); margin: 0;
  background: #081927; border: 1px solid rgba(102, 221, 236, .26); border-top: 0; border-radius: 0 0 6px 6px;
}
.dex-metrics > div { padding: 15px 20px; }
.dex-metrics > div + div { border-left: 1px solid rgba(126,201,220,.12); }
.dex-metrics dt { font-size: 9px; font-weight: 700; letter-spacing: .1em; color: #91d0df; }
.dex-metrics dd { margin: 7px 0 0; font-size: 18px; font-weight: 700; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.dex-chart-note { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px; margin: 14px 0 0; color: #a1bfce; font-size: 10px; line-height: 1.4; }
.dex-chart-note a { color: #d4edf3; margin-left: 5px; }
.dex-footer { display: flex; justify-content: space-between; gap: 12px; margin-top: auto; padding-top: 25px; font-size: 9px; }
.dex-footer > span { padding: 7px 11px; background: rgba(4, 15, 28, .92); border: 1px solid rgba(83, 171, 200, .22); border-radius: 5px; }
.dex-page a:focus-visible { outline: 2px solid var(--cyan); outline-offset: 4px; }

@media (max-width: 1179px), (max-height: 649px) {
  .rooftop-track > .landing { grid-template-columns: minmax(0, 1fr); padding-top: 86px; }
  .rooftop-track > .landing .hero-panel--new { min-width: 0; right: auto; top: auto; }
  .rooftop-track > .landing .city-bg,
  .rooftop-track > .landing .city-shade,
  .rooftop-track > .landing .city-neon-overlay {
    position: absolute;
    bottom: auto;
    height: max(650px, 100svh);
  }
  .dex-content { width: 91vw; padding-top: 96px; }
  .dex-workspace { grid-template-columns: minmax(250px, .95fr) minmax(0, 3fr); gap: 24px; }
  .dex-panel { padding: 23px 20px; }
  .dex-overview h1 { font-size: 44px; }
}
@media (min-width: 851px) and (max-height: 800px) {
  .dex-content { padding-top: 92px; padding-bottom: 16px; }
  .dex-header { margin-bottom: 20px; }
  .dex-panel { padding: 20px; }
  .dex-identity { padding-bottom: 12px; margin-bottom: 16px; }
  .dex-overview h1 { font-size: clamp(38px, 3.4vw, 50px); }
  .dex-intro { font-size: 12px; margin: 16px 0 18px; }
  .dex-price-block { padding: 13px 0 14px; gap: 7px; }
  .dex-action { min-height: 44px; margin-top: 16px; }
  .dex-footer { padding-top: 18px; }
}
@media (max-width: 850px) {
  .dex-content { width: 90vw; padding-top: 87px; }
  .dex-header { margin-bottom: 24px; }
  .dex-location { display: none; }
  .dex-workspace { display: flex; flex-direction: column; gap: 28px; align-items: stretch; min-height: 0; }
  .dex-overview { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 18px; align-items: center; }
  .dex-identity { grid-column: 1 / -1; padding-bottom: 13px; margin: 0; }
  .dex-eyebrow { font-size: 10px; }
  .dex-intro { display: none; }
  .dex-overview h1 { font-size: clamp(32px, 6vw, 44px); }
  .dex-overview h1 em { font-size: .44em; }
  .dex-price-block { padding: 0 0 0 16px; border: 0; border-left: 1px solid rgba(116, 208, 230, .25); margin: 0; gap: 7px; }
  .dex-price-block strong { font-size: 22px; }
  .dex-action, .dex-external { min-height: 44px; margin: 0; font-size: 11px; padding: 11px; gap: 6px; }
  .dex-chart-surface { flex: none; height: 390px; }
  .dex-chart-heading { gap: 8px; font-size: 10px; }
  .dex-chart-heading b { margin-left: 5px; }
  .dex-status { font-size: 8px; padding: 6px 7px; }
  .dex-metrics > div { padding: 14px 10px; }
  .dex-metrics dt { font-size: 8px; line-height: 1.5; letter-spacing: .04em; }
  .dex-metrics dd { font-size: 14px; }
  .dex-footer { letter-spacing: .05em; font-size: 8px; line-height: 1.5; }
}
@media (max-width: 380px) {
  .dex-overview { column-gap: 12px; }
  .dex-action, .dex-external { grid-column: 1 / -1; }
  .dex-metrics > div { padding: 12px 7px; }
  .dex-chart-heading { align-items: flex-start; }
  .dex-chart-heading b { display: block; margin: 5px 0 0; }
}
@media (prefers-reduced-motion: reduce) {
  .rooftop-track { transition: none; }
}
