/* Optical decoration stays behind the original text and controls. */
.ui-glass-definitions {
  position: absolute;
  width: 0;
  height: 0;
  overflow: hidden;
  pointer-events: none;
}

/* These hosts were static before decoration; their old offsets were inactive. */
body [data-ui-glass].ui-glass-anchor {
  position: relative !important;
  inset: auto !important;
  inset-inline: auto !important;
  inset-block: auto !important;
}
[data-ui-glass] { isolation: isolate; }

body [data-ui-glass="panel"] {
  background: rgb(248 250 253 / 30%) !important;
  -webkit-backdrop-filter: none !important;
  backdrop-filter: none !important;
  border-color: rgb(255 255 255 / 82%);
  box-shadow: 0 12px 40px rgb(28 43 65 / 7%), 0 1px 2px rgb(30 48 71 / 4%), inset 0 1px 0 rgb(255 255 255 / 90%);
}

.ui-glass-surface {
  position: absolute;
  inset: 0;
  z-index: -1;
  display: block;
  width: auto;
  height: auto;
  margin: 0;
  border-radius: inherit;
  pointer-events: none;
  background: linear-gradient(145deg, rgb(255 255 255 / 76%), rgb(249 251 253 / 55%) 46%, rgb(235 242 249 / 45%));
  -webkit-backdrop-filter: blur(16px) saturate(115%);
  backdrop-filter: blur(16px) saturate(115%);
  box-shadow: inset 0 1px 0 rgb(255 255 255 / 90%), inset 1px 0 0 rgb(255 255 255 / 48%), inset -1px -1px 0 rgb(110 137 167 / 14%);
}

.ui-glass-surface::after {
  position: absolute;
  inset: 0;
  content: "";
  border: 1px solid transparent;
  border-radius: inherit;
  background: linear-gradient(135deg, rgb(255 255 255 / 92%), rgb(255 255 255 / 28%) 34%, rgb(165 192 222 / 25%) 63%, rgb(255 255 255 / 65%)) border-box;
  -webkit-mask: linear-gradient(#fff 0 0) padding-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask: linear-gradient(#fff 0 0) padding-box, linear-gradient(#fff 0 0);
  mask-composite: exclude;
  pointer-events: none;
}

.ui-glass-surface.ui-glass-refracts {
  -webkit-backdrop-filter: var(--ui-glass-refraction) blur(3px) saturate(115%);
  backdrop-filter: var(--ui-glass-refraction) blur(3px) saturate(115%);
}

body [data-ui-glass="button"] > .ui-glass-surface {
  inset: 1px;
  background: linear-gradient(155deg, rgb(255 255 255 / 6%), transparent 48%, rgb(191 216 245 / 3%));
  -webkit-backdrop-filter: saturate(105%);
  backdrop-filter: saturate(105%);
  box-shadow: inset 0 1px 0 rgb(255 255 255 / 22%), inset 0 -1px 0 rgb(17 41 72 / 9%);
}
body [data-ui-glass="button"] > .ui-glass-surface.ui-glass-refracts {
  -webkit-backdrop-filter: var(--ui-glass-refraction) saturate(105%);
  backdrop-filter: var(--ui-glass-refraction) saturate(105%);
}
body [data-ui-glass="button"] > .ui-glass-surface::after {
  border-color: rgb(255 255 255 / 14%);
  background: none;
  opacity: 1;
}

/* The original radio remains the only source of selection state. */
body.ui-workspace .practice-modes[data-ui-glass-nav="mode"] > label {
  color: #637184;
  transition: color 160ms ease;
}
body.ui-workspace .practice-modes[data-ui-glass-nav="mode"] > label:has(input:checked) {
  color: #21578f;
  background: transparent;
  box-shadow: none;
}
[data-ui-glass-nav="mode"] > .ui-glass-indicator {
  background: linear-gradient(145deg, rgb(255 255 255 / 95%), rgb(242 247 253 / 83%));
  box-shadow: 0 2px 7px rgb(31 55 85 / 8%), inset 0 0 0 1px rgb(116 157 202 / 16%);
}

body [data-ui-glass-nav] {
  position: relative !important;
  inset: auto !important;
  inset-inline: auto !important;
  inset-block: auto !important;
  isolation: isolate;
}

.ui-glass-indicator {
  position: absolute;
  top: 0;
  left: 0;
  z-index: -1;
  display: block;
  pointer-events: none;
  background: linear-gradient(140deg, rgb(255 255 255 / 83%), rgb(237 244 251 / 72%));
  box-shadow: 0 2px 8px rgb(35 62 96 / 7%), inset 0 1px 0 rgb(255 255 255 / 85%);
}

.ui-glass-indicator[hidden] { display: none; }
.ui-glass-indicator .ui-glass-surface { background: linear-gradient(135deg, rgb(255 255 255 / 12%), transparent 54%, rgb(191 212 237 / 5%)); }
.ui-glass-indicator.ui-glass-settled {
  transition: transform 320ms cubic-bezier(.2, .8, .2, 1), width 320ms cubic-bezier(.2, .8, .2, 1), height 320ms cubic-bezier(.2, .8, .2, 1);
}

body [data-ui-glass-nav] .side-footer.active,
body [data-ui-glass-nav] .nav-item.active {
  background: transparent !important;
  box-shadow: none !important;
}

body.ui-workspace #sidebar [data-ui-glass-nav] .side-footer.active,
body.ui-workspace #sidebar [data-ui-glass-nav] .side-footer.active p,
body.ui-exam #sidebar [data-ui-glass-nav] .side-footer.active,
body.ui-exam #sidebar [data-ui-glass-nav] .side-footer.active p { color: #145895; }

body.ui-workspace #sidebar [data-ui-glass-nav] .side-footer.active img,
body.ui-exam #sidebar [data-ui-glass-nav] .side-footer.active img {
  filter: brightness(0) saturate(100%) opacity(.64);
}

[data-ui-glass-nav="light"] > .ui-glass-indicator {
  background: linear-gradient(145deg, rgb(255 255 255 / 94%), rgb(226 239 255 / 75%));
  box-shadow: 0 4px 14px rgb(42 92 156 / 9%), inset 0 1px 0 #fff;
}

@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  body [data-ui-glass="panel"] { background: #f6f9fe !important; }
  .ui-glass-surface { background: #f6f9fe; }
}

@media (prefers-reduced-transparency: reduce) {
  body [data-ui-glass="panel"] { background: #f6f9fe !important; }
  .ui-glass-surface,
  .ui-glass-surface.ui-glass-refracts,
  body [data-ui-glass="button"] > .ui-glass-surface,
  body [data-ui-glass="button"] > .ui-glass-surface.ui-glass-refracts {
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
  }
  [data-ui-glass="panel"] > .ui-glass-surface { background: #f6f9fe; }
  [data-ui-glass-nav="mode"] > .ui-glass-indicator { background: #fff; }
  .ui-glass-indicator { background: #e8f1ff; }
  [data-ui-glass-nav="light"] > .ui-glass-indicator { background: #e8f1ff; }
}

@media (prefers-reduced-motion: reduce) {
  .ui-glass-indicator.ui-glass-settled,
  body.ui-workspace .practice-modes[data-ui-glass-nav="mode"] > label { transition: none; }
}
