:root{
  --viewport-radius: 24px;
  --viewport-inner-radius: 18px;

  --viewport-perimeter-inset-top: 12px;
  --viewport-perimeter-inset-right: 12px;
  --viewport-perimeter-inset-bottom: 12px;
  --viewport-perimeter-inset-left: 12px;

  --viewport-frame-inset-top: 16px;
  --viewport-frame-inset-right: 16px;
  --viewport-frame-inset-bottom: 16px;
  --viewport-frame-inset-left: 16px;

  --viewport-line: rgba(255,255,255,0.042);
  --viewport-line-soft: rgba(255,255,255,0.022);
  --viewport-line-bottom: rgba(255,255,255,0.052);

  --viewport-gold: rgba(200,161,43,0.22);
  --viewport-gold-soft: rgba(200,161,43,0.14);
  --viewport-shadow: rgba(0,0,0,0.14);

  --viewport-surface-top: rgba(24,22,23,0.90);
  --viewport-surface-bottom: rgba(14,13,15,0.968);

  --viewport-overlay-top: rgba(255,255,255,0.010);
  --viewport-overlay-side: rgba(255,255,255,0.006);

  --viewport-shade-left: rgba(0,0,0,.24);
  --viewport-shade-mid: rgba(0,0,0,.03);
  --viewport-shade-right: rgba(0,0,0,.20);
  --viewport-shade-bottom: rgba(0,0,0,.08);

  --viewport-toolbar-gap: 6px;
  --viewport-toolbar-pad: 10px;
  --viewport-toolbar-z: 8;

  --viewport-tool-height: 31px;
  --viewport-tool-pad-x: 10px;
  --viewport-tool-radius: 10px;

  --viewport-tool-bg:
    linear-gradient(180deg, rgba(255,255,255,.014), rgba(255,255,255,.004)),
    linear-gradient(180deg, rgba(11,13,17,.88), rgba(8,10,14,.95));
  --viewport-tool-border: rgba(255,255,255,.06);
  --viewport-tool-shadow:
    inset 0 1px 0 rgba(255,255,255,.026),
    inset 0 0 0 1px rgba(255,255,255,.008);

  --page-brand-1: rgba(32,24,18,0.18);
  --page-brand-2: rgba(16,14,16,0.72);
  --page-brand-border: rgba(206,185,148,0.10);
  --page-brand-ring: rgba(206,185,148,0.028);

  --page-neutral-1: rgba(18,18,20,0.46);
  --page-neutral-2: rgba(10,10,12,0.78);
  --page-neutral-border: rgba(255,255,255,0.05);
}

/* =========================================================
   VIEWPORT
   actual housed display surface
   ========================================================= */

.shell-viewport{
  position: relative;
  min-width: 0;
  min-height: 0;
  width: 100%;
  height: 100%;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: minmax(0, 1fr);
  align-items: stretch;
  justify-items: stretch;
  overflow: hidden;
  isolation: isolate;
  border-radius: var(--viewport-radius);
  border: 1px solid rgba(255,255,255,0.042);
  background:
    linear-gradient(180deg, var(--viewport-surface-top), var(--viewport-surface-bottom));
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.022),
    inset 0 0 0 1px rgba(255,255,255,0.008),
    inset 0 0 0 2px rgba(0,0,0,0.08);
  cursor: default;
}

.shell-viewport a,
.shell-viewport button,
.shell-viewport input,
.shell-viewport textarea,
.shell-viewport select,
.shell-viewport label{
  cursor: auto;
}

.shell-viewport::before{
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 2;
  background:
    linear-gradient(180deg, var(--viewport-overlay-top), transparent 11%),
    linear-gradient(90deg, var(--viewport-overlay-side), transparent 8%, transparent 92%, var(--viewport-overlay-side));
}

.shell-viewport::after{
  content: "";
  position: absolute;
  inset:
    var(--viewport-perimeter-inset-top)
    var(--viewport-perimeter-inset-right)
    var(--viewport-perimeter-inset-bottom)
    var(--viewport-perimeter-inset-left);
  border-radius: var(--viewport-inner-radius);
  border: 1px solid var(--viewport-line);
  border-bottom-color: var(--viewport-line-bottom);
  pointer-events: none;
  z-index: 3;
}

/* =========================================================
   VIEWPORT TOOLBAR
   overlay utility, not structural frame
   ========================================================= */

.shell-viewport-toolbar{
  position: absolute;
  top: var(--viewport-toolbar-pad);
  right: var(--viewport-toolbar-pad);
  z-index: var(--viewport-toolbar-z);
  display: inline-flex;
  align-items: center;
  gap: var(--viewport-toolbar-gap);
  pointer-events: auto;
}

.shell-viewport-tool{
  appearance: none;
  -webkit-appearance: none;
  border: 1px solid var(--viewport-tool-border);
  background: var(--viewport-tool-bg);
  box-shadow: var(--viewport-tool-shadow);
  min-height: var(--viewport-tool-height);
  padding: 0 var(--viewport-tool-pad-x);
  border-radius: var(--viewport-tool-radius);
  color: rgba(255,255,255,.92);
  font: inherit;
  font-size: 10px;
  letter-spacing: .03em;
  text-transform: uppercase;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  white-space: nowrap;
  cursor: pointer;
  transition:
    transform .14s ease,
    background .18s ease,
    border-color .18s ease,
    box-shadow .18s ease,
    color .18s ease,
    filter .18s ease;
}

.shell-viewport-tool:hover,
.shell-viewport-tool:focus-visible{
  transform: translateY(-1px);
  outline: none;
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,.03),
    0 6px 14px rgba(0,0,0,.14);
}

/* =========================================================
   SCREEN TREATMENT
   restrained perimeter + corner language
   ========================================================= */

.shell-viewport-frame{
  position: absolute;
  inset:
    var(--viewport-frame-inset-top)
    var(--viewport-frame-inset-right)
    var(--viewport-frame-inset-bottom)
    var(--viewport-frame-inset-left);
  border-radius: calc(var(--viewport-inner-radius) - 2px);
  pointer-events: none;
  z-index: 4;
}

.shell-viewport-frame::before,
.shell-viewport-frame::after{
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
}

.shell-viewport-frame::before{
  border: 1px solid var(--viewport-line-soft);
  border-bottom-color: rgba(255,255,255,0.032);
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.010),
    inset 0 0 0 1px var(--viewport-shadow);
}

.shell-viewport-frame::after{
  background:
    linear-gradient(var(--viewport-gold), var(--viewport-gold)) top 10px left 10px / 14px 1px no-repeat,
    linear-gradient(var(--viewport-gold), var(--viewport-gold)) top 10px left 10px / 1px 14px no-repeat,
    linear-gradient(var(--viewport-gold), var(--viewport-gold)) top 10px right 10px / 14px 1px no-repeat,
    linear-gradient(var(--viewport-gold), var(--viewport-gold)) top 10px right 10px / 1px 14px no-repeat,
    linear-gradient(var(--viewport-gold-soft), var(--viewport-gold-soft)) bottom 10px left 10px / 14px 1px no-repeat,
    linear-gradient(var(--viewport-gold-soft), var(--viewport-gold-soft)) bottom 10px left 10px / 1px 14px no-repeat,
    linear-gradient(var(--viewport-gold-soft), var(--viewport-gold-soft)) bottom 10px right 10px / 14px 1px no-repeat,
    linear-gradient(var(--viewport-gold-soft), var(--viewport-gold-soft)) bottom 10px right 10px / 1px 14px no-repeat;
  opacity: .54;
}

/* =========================================================
   VIEWPORT SHADE
   resolved chamber without burying edges
   ========================================================= */

.shell-viewport-shade{
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  background:
    radial-gradient(1100px 700px at 28% 36%, rgba(28,22,18,0.02), rgba(0,0,0,.32) 76%),
    linear-gradient(90deg, var(--viewport-shade-left), var(--viewport-shade-mid) 52%, var(--viewport-shade-right)),
    linear-gradient(180deg, transparent 72%, var(--viewport-shade-bottom));
}

.shell-viewport-shade::after{
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(180deg, rgba(255,255,255,0.006), rgba(0,0,0,0.08)),
    radial-gradient(circle at 50% 0%, rgba(206,185,148,0.014), transparent 24%);
}

/* =========================================================
   PAGE SCROLL AREA
   only scrolling region
   ========================================================= */

.shell-page-scroll{
  position: relative;
  z-index: 2;
  grid-column: 1 / 2;
  grid-row: 1 / 2;
  align-self: stretch;
  justify-self: stretch;
  width: 100%;
  height: 100%;
  min-width: 0;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  overscroll-behavior-y: contain;
  overscroll-behavior-x: none;
  -webkit-overflow-scrolling: touch;
  touch-action: pan-y;
  scrollbar-width: none;
  -ms-overflow-style: none;
  padding: 44px 0 10px;
}

.shell-page-scroll::-webkit-scrollbar{
  width: 0;
  height: 0;
  display: none;
}

.shell-page{
  position: relative;
  z-index: 2;
  width: 100%;
  min-width: 0;
  min-height: 100%;
  box-sizing: border-box;
  padding: 0 10px 16px;
}

/* =========================================================
   PAGE WELL
   subordinate to the viewport display
   ========================================================= */

.index-stage{
  position: relative;
  width: 100%;
  min-height: auto;
  margin: 0 !important;
  padding: 8px !important;
  border-radius: 22px;
  background:
    linear-gradient(180deg, var(--page-brand-1), var(--page-brand-2));
  border: 1px solid var(--page-brand-border);
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.020),
    inset 0 0 0 1px var(--page-brand-ring);
}

.index-stage--neutral,
.shell-page.is-neutral .index-stage{
  background:
    linear-gradient(180deg, var(--page-neutral-1), var(--page-neutral-2));
  border-color: var(--page-neutral-border);
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.020),
    inset 0 0 0 1px rgba(255,255,255,0.012);
}

.index-stage::before{
  content: "";
  position: absolute;
  inset: 6px;
  border-radius: 16px;
  border: 1px solid rgba(255,255,255,0.020);
  pointer-events: none;
}

.index-stage__media,
.index-stage__body{
  width: 100%;
  box-sizing: border-box;
}

.index-stage__media{
  margin: 0 0 8px 0 !important;
}

.index-stage__body{
  margin: 0 !important;
  padding: 0 8px 4px 8px;
}

/* =========================================================
   EXPANDED VIEWER MODE
   same display logic, larger screen
   ========================================================= */

.shell-viewport.is-expanded{
  position: fixed;
  inset: 18px;
  z-index: 140;
  width: auto;
  height: auto;
  border-radius: 24px;
  background:
    linear-gradient(180deg, rgba(24,22,23,.96), rgba(14,13,15,.985));
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.026),
    inset 0 0 0 1px rgba(255,255,255,0.010),
    0 20px 46px rgba(0,0,0,.22),
    0 0 0 1px rgba(126,173,255,.10);
}

.shell-viewport.is-expanded .shell-page-scroll{
  height: 100%;
  padding-top: 48px;
  padding-bottom: 12px;
}

.shell-viewport.is-expanded .shell-viewport-toolbar{
  z-index: 12;
}

.shell-viewport-backdrop{
  position: fixed;
  inset: 0;
  z-index: 130;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  background: rgba(0,0,0,.56);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  transition: opacity .18s ease, visibility .18s ease;
}

body.viewport-expanded .shell-viewport-backdrop{
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

/* =========================================================
   TOOL HOVER STATES
   ========================================================= */

.shell-viewport-tool--expand:hover,
.shell-viewport-tool--expand:focus-visible,
.shell-viewport-tool--close:hover,
.shell-viewport-tool--close:focus-visible{
  background: linear-gradient(180deg, #6f5331, #4f3920);
  border-color: rgba(184,154,92,.28);
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,.04),
    0 0 0 1px rgba(184,154,92,.08),
    0 0 16px rgba(111,83,49,.16);
}

.shell-viewport-tool--mute:hover,
.shell-viewport-tool--mute:focus-visible,
.shell-viewport-tool--play:hover,
.shell-viewport-tool--play:focus-visible{
  background: linear-gradient(180deg, #5f7287, #46586b);
  border-color: rgba(190,215,240,.28);
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,.04),
    0 0 0 1px rgba(190,215,240,.08),
    0 0 16px rgba(95,114,135,.16);
}

/* =========================================================
   BREAKPOINTS
   ========================================================= */

@media (max-width: 820px){
  .shell-viewport{
    border-radius: 20px;
  }

  .shell-viewport::after{
    inset: 10px;
    border-radius: 14px;
  }

  .shell-viewport-frame{
    inset: 13px;
    border-radius: 14px;
  }

  .shell-page-scroll{
    padding-top: 42px;
    padding-bottom: 10px;
  }

  .shell-page{
    padding: 0 8px 48px;
  }

  .index-stage{
    padding: 6px !important;
    border-radius: 20px;
  }

  .index-stage::before{
    inset: 4px;
    border-radius: 14px;
  }

  .index-stage__media{
    margin-bottom: 6px !important;
  }

  .index-stage__body{
    padding: 0 6px 2px 6px;
  }

  .shell-viewport.is-expanded{
    inset: 10px;
    border-radius: 18px;
  }

  .shell-viewport-toolbar{
    top: 8px;
    right: 8px;
  }
}

@media (max-width: 480px){
  .shell-viewport{
    border-radius: 18px;
  }

  .shell-viewport::after{
    inset: 8px;
    border-radius: 12px;
  }

  .shell-viewport-frame{
    inset: 10px;
    border-radius: 12px;
  }

  .shell-viewport-frame::after{
    background:
      linear-gradient(var(--viewport-gold), var(--viewport-gold)) top 8px left 8px / 12px 1px no-repeat,
      linear-gradient(var(--viewport-gold), var(--viewport-gold)) top 8px left 8px / 1px 12px no-repeat,
      linear-gradient(var(--viewport-gold), var(--viewport-gold)) top 8px right 8px / 12px 1px no-repeat,
      linear-gradient(var(--viewport-gold), var(--viewport-gold)) top 8px right 8px / 1px 12px no-repeat,
      linear-gradient(var(--viewport-gold-soft), var(--viewport-gold-soft)) bottom 8px left 8px / 12px 1px no-repeat,
      linear-gradient(var(--viewport-gold-soft), var(--viewport-gold-soft)) bottom 8px left 8px / 1px 12px no-repeat,
      linear-gradient(var(--viewport-gold-soft), var(--viewport-gold-soft)) bottom 8px right 8px / 12px 1px no-repeat,
      linear-gradient(var(--viewport-gold-soft), var(--viewport-gold-soft)) bottom 8px right 8px / 1px 12px no-repeat;
  }

  .shell-page{
    padding: 0 8px 44px;
  }

  .index-stage{
    padding: 8px !important;
    border-radius: 22px;
  }

  .index-stage::before{
    inset: 6px;
    border-radius: 16px;
  }

  .index-stage__body{
    padding: 0 8px 6px 8px;
  }

  .shell-viewport-toolbar{
    gap: 4px;
  }

  .shell-viewport-tool{
    min-height: 29px;
    padding-inline: 8px;
    font-size: 9px;
  }

  .shell-viewport.is-expanded{
    inset: 8px;
  }
}
/* =========================================================
   MOBILE PATCH — VIEWPORT / CHAMBER
   ========================================================= */

@media (max-width: 820px){
  .shell-viewport{
    border-radius: 18px;
  }

  .shell-viewport::after{
    inset: 8px;
    border-radius: 12px;
  }

  .shell-viewport-frame{
    inset: 10px;
    border-radius: 12px;
  }

  .shell-page-scroll{
    padding-top: 38px;
    padding-bottom: 8px;
  }

  .shell-page{
    padding: 0 6px 24px;
  }

  .index-stage{
    padding: 5px !important;
    border-radius: 18px;
  }

  .index-stage::before{
    inset: 4px;
    border-radius: 12px;
  }

  .index-stage__media{
    margin-bottom: 5px !important;
  }

  .index-stage__body{
    padding: 0 5px 2px 5px;
  }

  .shell-viewport-toolbar{
    top: 6px;
    right: 6px;
    gap: 4px;
  }

  .shell-viewport-tool{
    min-height: 27px;
    padding-inline: 7px;
    font-size: 8.5px;
    border-radius: 8px;
  }

  .shell-viewport.is-expanded{
    inset: 8px;
    border-radius: 16px;
  }
}

@media (max-width: 480px){
  .shell-viewport{
    border-radius: 16px;
  }

  .shell-viewport::after{
    inset: 7px;
    border-radius: 11px;
  }

  .shell-viewport-frame{
    inset: 9px;
    border-radius: 11px;
  }

  .shell-page-scroll{
    padding-top: 36px;
    padding-bottom: 8px;
  }

  .shell-page{
    padding: 0 5px 20px;
  }

  .index-stage{
    padding: 5px !important;
    border-radius: 16px;
  }

  .index-stage::before{
    inset: 4px;
    border-radius: 11px;
  }

  .index-stage__body{
    padding: 0 5px 4px 5px;
  }

  .shell-viewport-tool{
    min-height: 26px;
    padding-inline: 6px;
    font-size: 8px;
  }

  .shell-viewport.is-expanded{
    inset: 6px;
  }
}