:root{
  /* home gradient */
  --bg: #0e4a51;
  --bg2: #0b3f46;

  --panel: rgba(255, 255, 255, 0.10);
  --panel2: rgba(255, 255, 255, 0.08);
  --stroke: rgba(255, 255, 255, 0.10);

  --muted: rgba(255, 255, 255, 0.52);
  --accent: #d2b06a;

  --radius: 10px;
  --shadow: 0 10px 22px rgba(0, 0, 0, 0.22);

  /* v4 palette for environments */
  --topbar-bg: rgb(9, 54, 59);
  --topbar-bevel: rgb(18, 75, 81);
  --page-bg: rgb(14, 73, 79);

  --sidebar-bg: rgb(28, 83, 90);

  --rule: rgb(31, 84, 87);

  --gold: rgb(184, 168, 116);
  --gold-dim: rgba(184, 168, 116, 0.35);
  --brown: rgb(141, 124, 95); /* for stars */

  --nav-text: rgb(128, 168, 176);

  --text-strong: rgba(255,255,255,0.88);
  --text: rgba(255,255,255,0.62);
  --text-dim: rgba(255,255,255,0.30);
  --text-mid: rgba(255,255,255,0.55);

  /* sidebar text */
  --side-title: rgba(255,255,255,0.65);
  --side-title-inactive: rgba(255,255,255,0.55);
  --side-item: rgba(255,255,255,0.55);
  --side-item-small: rgba(255,255,255,0.55);

  /* layout */
  --sidebarW: 320px;
  --sidebarWide: 360px;

  /* navbar reduced by 20% (height + sizes that live in base css) */
  --topH: 62px;

  --docPadLeft: 44px;

  /* scale environments list only */
  --ui-scale: 0.9;

  /* typography */
  --font-serif: ui-serif, Georgia, "Times New Roman", Times, serif;
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body{
  margin: 0;
  overflow-x: hidden;
  background: linear-gradient(180deg, var(--bg) 0%, var(--bg2) 100%);
  color: var(--text);
  font-family: var(--font-serif);
}

.page{
  min-height: 100vh;
  background: linear-gradient(180deg, var(--bg) 0%, var(--bg2) 100%);
}

/* top bar: float */
.topbar{
  height: var(--topH);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 22px;
  background: var(--topbar-bg);
  border-bottom: 1px solid rgba(0,0,0,0.20);
  position: sticky;
  top: 0;
  z-index: 1000;
}

/* bevel strip beneath top bar */
.topbar::after{
  content:"";
  position: absolute;
  left: 0;
  right: 0;
  bottom: -5px;
  height: 5px;
  background: var(--topbar-bevel);
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.05),
    inset 0 -1px 0 rgba(0,0,0,0.25);
}

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

.brand-icon{
  position: relative;
  width: 43px;
  height: 43px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.10);
  border: 1px solid rgba(255, 255, 255, 0.10);
  display: grid;
  place-items: center;
  overflow: hidden;
}

.brand-text{
  font-size: 27px;
  font-weight: 700;
  color: var(--accent);
}

.brand-link{ text-decoration: none; }

.nav{
  display: flex;
  gap: 27px;
  align-items: center;
  font-size: 16px;
  color: var(--nav-text);
}

.nav-link{
  text-decoration: none;
  color: var(--nav-text);
  padding: 8px 2px;
}

.nav-link:hover{ color: rgba(200, 220, 224, 0.95); }

/* shared app layout shell */
.content{
  flex: 1;
  display: grid;
  grid-template-columns: var(--sidebarW) 1fr;
  gap: 0;
  min-height: calc(100vh - var(--topH));
  background: var(--page-bg);
}

/* scale ONLY the environments list page */
.content.env-page{
  zoom: var(--ui-scale);
}

@supports not (zoom: 1){
  .content.env-page{
    transform: scale(var(--ui-scale));
    transform-origin: top left;
    width: calc(100% / var(--ui-scale));
  }
}

/* sidebar: float and do not get cut off */
.sidebar{
  background: linear-gradient(
    to right,
    var(--page-bg) 0px,
    var(--page-bg) 14px,
    var(--sidebar-bg) 14px,
    var(--sidebar-bg) calc(100% - 14px),
    var(--page-bg) calc(100% - 14px),
    var(--page-bg) 100%
  );

  position: sticky;
  top: var(--topH);
  align-self: start;

  height: 110vh;
  overflow: auto;

  padding: 30px 14px;
}

/* gold bars inside the sidebar */
.sidebar::before{
  content:"";
  position: absolute;
  top: 0;
  left: 14px;
  width: 3px;
  height: 100%;
  background: var(--gold);
  opacity: 0.55;
  pointer-events: none;
}

.sidebar::after{
  content:"";
  position: absolute;
  top: 0;
  right: 14px;
  width: 3px;
  height: 100%;
  background: var(--gold);
  opacity: 0.55;
  pointer-events: none;
}

.sidebar.wide { width: var(--sidebarWide); }
.sidebar.wide { grid-column: 1; }
.sidebar.wide + .main { grid-column: 2; }

/* keep content off the gold bars */
.side-section{
  margin-bottom: 24px;
  margin-left: 10px;
  margin-right: 10px;
}

/* divider between sections (shorter line) */
.side-section + .side-section{
  position: relative;
  padding-top: 18px;
  margin-top: 18px;
}

.side-section + .side-section::before{
  content:"";
  position: absolute;
  top: 0;
  right: 5px;
  width: 90%;
  max-width: 300px;
  height: 3px;
  background: var(--side-title-inactive);
  opacity: 0.9;
}

.side-title{
  font-size: 22px;
  font-weight: 500;
  color: var(--side-title);
  margin: 10px;
  margin-left: 20px;
}

.side-title.inactive {
  color: var(--side-title-inactive);
}

.side-item{
  display: block;
  padding: 4px 0;
  margin-left: 10px;
  font-size: 19px;
  color: var(--side-item);
  text-decoration: none;
}

.side-item.small{
  font-size: 18px;
  color: var(--side-item-small);
  padding-left: 24px;
}

.side-item:hover{ color: rgba(255,255,255,0.65); }

.side-item.is-active{ color: rgba(255,255,255,0.86); }

/* shared main */
.main{
  padding: 24px 26px;
  position: relative;
  overflow: auto;
  background: var(--page-bg);
}

/* global flash toasts */
.flash-wrap{
  position: fixed;
  top: calc(var(--topH) + 14px);
  left: 50%;
  transform: translateX(-50%);
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 12px;
  width: min(760px, calc(100vw - 32px));
  pointer-events: none;
}

.flash{
  pointer-events: auto;
  padding: 16px 18px;
  border-radius: 14px;
  background: rgba(0,0,0,0.60);
  border: 1px solid rgba(255,255,255,0.22);
  color: rgba(255,255,255,0.95);
  backdrop-filter: blur(6px);

  text-align: center;
  font-size: 18px;
  line-height: 1.25;

  cursor: pointer;
  opacity: 1;
  transform: translateY(0);
  transition: opacity 400ms ease, transform 400ms ease;
}

.flash.is-hiding{
  opacity: 0;
  transform: translateY(-6px);
}

.flash-success{ border-color: rgba(120,255,170,0.35); }
.flash-error{ border-color: rgba(255,120,120,0.35); }
.flash-warning{ border-color: rgba(255,210,120,0.35); }
.flash-info{ border-color: rgba(160,200,255,0.35); }

/* safety: prevent horizontal overflow */
img, canvas, svg, video { max-width: 100%; }