.page,
#app {
  position: relative;
  z-index: 1;
}

:root {
  --chrome-h: 92px;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
}

.glass {
  border: 1px solid var(--line);
  background: var(--glass-bg);
  box-shadow: var(--shadow), var(--inner-glow);
  backdrop-filter: var(--blur);
  -webkit-backdrop-filter: var(--blur);
  isolation: isolate;
}

body {
  overflow-x: hidden;
}

body::-webkit-scrollbar { display: none; }
body { -ms-overflow-style: none; scrollbar-width: none; }

#sky {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background-image:
    radial-gradient(1.2px 1.2px at 12% 18%, rgba(255,255,255,.85), transparent),
    radial-gradient(1.6px 1.6px at 28% 62%, rgba(210,230,255,.7), transparent),
    radial-gradient(1px 1px at 48% 8%, rgba(255,255,255,.6), transparent),
    radial-gradient(2px 2px at 71% 34%, rgba(255,240,200,.8), transparent),
    radial-gradient(1px 1px at 86% 78%, rgba(200,220,255,.65), transparent),
    radial-gradient(1.4px 1.4px at 9% 88%, rgba(255,255,255,.55), transparent),
    radial-gradient(1px 1px at 58% 52%, rgba(180,200,255,.5), transparent),
    radial-gradient(1.8px 1.8px at 39% 91%, rgba(255,255,255,.7), transparent),
    url("../storage/system/system_background.webp");
  background-size:
    170px 170px,
    230px 210px,
    140px 190px,
    280px 260px,
    200px 150px,
    310px 240px,
    120px 160px,
    260px 300px,
    420px 420px;
  background-repeat: repeat;
  opacity: 0.55;
  mix-blend-mode: screen;
}

#main {
  animation: fadeIn 0.8s ease both;
  padding: calc(var(--chrome-h) + 28px) 0 80px;
}

body[data-view="surface"] #main {
  padding-top: calc(var(--chrome-h) + 12px);
  padding-bottom: 12px;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

body[data-view="surface"] {
  overflow: hidden;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.container {
  width: min(920px, calc(100% - 32px));
  margin: 0 auto;
}

.row { display: flex; flex-wrap: wrap; }
.col-12 { width: 100%; }

.title-block { padding: 0; }

#chrome {
  position: fixed;
  top: 12px;
  left: 0;
  right: 0;
  margin: 0 auto;
  width: min(920px, calc(100% - 24px));
  z-index: 40;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 12px;
  pointer-events: none;
}

#chrome > * {
  pointer-events: auto;
}

#title-slot:empty,
#pager-slot:empty {
  display: none;
}

#pager-slot {
  align-self: flex-end;
  max-width: 100%;
}

#pager-slot .anchors-wrap {
  width: max-content;
  max-width: 100%;
  margin: 0;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 10px 16px;
  min-height: 68px;
  border-radius: 22px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  flex: 1 1 0;
  text-decoration: none;
}

.brand-copy {
  display: flex;
  flex-direction: column;
  min-width: 0;
  overflow: hidden;
}

.brand.is-object .brand-copy {
  flex-direction: column-reverse;
}

.brand-mark {
  width: 34px;
  height: 34px;
  flex: 0 0 auto;
  border: 1px solid var(--glass-highlight);
  border-radius: 13px;
  background:
    radial-gradient(circle at 30% 22%, rgb(255 255 255 / 85%), transparent 18%),
    linear-gradient(105deg, var(--accent-from), var(--accent-mid) 52%, var(--accent-to));
  box-shadow: 0 14px 34px var(--glass-accent-shadow), var(--inner-glow);
}

.brand-mark[hidden] {
  display: none;
}

.brand strong {
  display: block;
  margin: 0;
  font-size: 15px;
  letter-spacing: -0.02em;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.brand small {
  display: block;
  color: var(--muted);
  font-size: 12px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.brand.is-object strong {
  font-size: clamp(16px, 2.2vw, 20px);
  font-weight: 700;
  letter-spacing: -0.03em;
}

.brand.is-object small {
  margin-bottom: 2px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.crumbs {
  position: fixed;
  top: auto;
  left: auto;
  right: max(12px, env(safe-area-inset-right));
  bottom: max(12px, env(safe-area-inset-bottom));
  z-index: 60;
  display: flex;
  align-items: center;
  gap: 2px;
  width: max-content;
  max-width: calc(100vw - 24px);
  margin: 0;
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 12px;
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  pointer-events: auto;
}

.crumbs[hidden] {
  display: none;
}

.crumbs a {
  color: var(--muted);
  text-decoration: none;
  padding: 2px 4px;
  border-radius: 6px;
}

.crumbs a:hover {
  color: var(--text);
  background: var(--glass-bg-hover);
}

.crumb-sep {
  color: var(--muted);
  opacity: 0.45;
  padding: 0 2px;
  user-select: none;
}

#view-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: 0 0 auto;
}

#view-actions:empty {
  display: none;
}

#view-actions .button {
  padding: 8px 12px;
  font-size: 13px;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 0 0 auto;
}

.icon-button {
  width: 42px;
  height: 42px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 0;
  flex: 0 0 auto;
}

.icon-button svg {
  width: 22px;
  height: 22px;
  display: block;
  flex: none;
}

.theme-switcher {
  position: relative;
  display: inline-flex;
  align-items: center;
  flex: 0 0 auto;
  margin: 0;
  padding: 0.3rem;
  border: none;
  min-inline-size: auto;
  border-radius: 9999px;
  background: var(--switcher-track);
  backdrop-filter: blur(22px) saturate(var(--glass-saturation));
  -webkit-backdrop-filter: blur(22px) saturate(var(--glass-saturation));
  box-shadow:
    inset 0 1px 2px rgba(255, 255, 255, calc(0.55 * var(--glass-reflex-light))),
    inset 0 -1px 2px rgba(0, 0, 0, calc(0.12 * var(--glass-reflex-dark))),
    0 4px 18px var(--glass-shadow);
}

.theme-switcher::after {
  content: "";
  position: absolute;
  top: 0.3rem;
  left: 0.3rem;
  width: 2.35rem;
  height: 2.35rem;
  border-radius: 50%;
  background: var(--switcher-thumb);
  backdrop-filter: blur(14px) saturate(var(--glass-saturation));
  -webkit-backdrop-filter: blur(14px) saturate(var(--glass-saturation));
  box-shadow:
    inset 0 1px 2px rgba(255, 255, 255, calc(0.65 * var(--glass-reflex-light))),
    inset 0 -1px 2px rgba(0, 0, 0, calc(0.1 * var(--glass-reflex-dark))),
    0 2px 10px rgba(0, 0, 0, calc(0.12 * var(--glass-reflex-dark)));
  transition: transform 0.5s cubic-bezier(0.34, 1.45, 0.64, 1);
  pointer-events: none;
  z-index: 0;
}

.theme-switcher:has(.theme-switcher__input[data-option="2"]:checked)::after {
  transform: translateX(2.35rem);
}

.theme-switcher__option {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2.35rem;
  height: 2.35rem;
  cursor: pointer;
  border-radius: 50%;
}

.theme-switcher__input {
  position: absolute;
  width: 0;
  height: 0;
  opacity: 0;
  pointer-events: none;
}

.theme-switcher__icon {
  width: 1.15rem;
  height: 1.15rem;
  color: var(--switcher-icon);
  transition: color 0.35s ease, transform 0.35s cubic-bezier(0.34, 1.45, 0.64, 1);
}

.theme-switcher:has(.theme-switcher__input[data-option="1"]:checked) .theme-switcher__option:first-of-type .theme-switcher__icon,
.theme-switcher:has(.theme-switcher__input[data-option="2"]:checked) .theme-switcher__option:last-of-type .theme-switcher__icon {
  color: var(--switcher-icon-active);
  transform: scale(1.08);
}

#title-slot .title-block.container {
  width: 100%;
  margin: 0;
}

#title-slot .title-panel .liquidGlass-text {
  padding: 12px 18px;
}

#title-slot h1 {
  font-size: clamp(1.2rem, 3vw, 1.75rem);
}

#title-slot .kicker {
  margin: 0 0 4px;
}

#title-slot .title-actions {
  margin-top: 10px;
}

.kicker {
  display: block;
  margin: 0 0 12px;
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

h1, h2, h3, h4 {
  margin: 0;
  letter-spacing: -0.04em;
  font-weight: 650;
}

h1 {
  font-size: clamp(2rem, 6vw, 3.4rem);
  line-height: 1.05;
}

h2 { font-size: 1.45rem; }
h3, h4 { font-size: 1.2rem; }

.muted, .text-secondary { color: var(--muted); }
.text-small { font-size: 14px; line-height: 1.45; margin: 6px 0; color: var(--text); }
.ms-3 { margin-left: 0.75rem; }
.mb-3 { margin-bottom: 0.75rem; }
.mt-5 { margin-top: 2rem; }

.text-ok, .text-primary { color: var(--ok); }
.text-warn, .text-warning { color: var(--warn); }
.text-danger { color: var(--danger); }
.text-white, .text-light { color: var(--text); }

hr {
  border: 0;
  border-bottom: 1px solid var(--line);
  margin: 28px 0;
}

/* --- Liquid glass (paneles chrome) --- */
.liquidGlass-wrapper {
  position: relative;
  display: flex;
  overflow: hidden;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  isolation: isolate;
  transform: translateZ(0);
}

.liquidGlass-effect {
  position: absolute;
  z-index: 0;
  inset: 0;
  backdrop-filter: var(--blur);
  -webkit-backdrop-filter: var(--blur);
  overflow: hidden;
  border-radius: inherit;
}

.liquidGlass-tint {
  z-index: 1;
  position: absolute;
  inset: 0;
  background: var(--glass-bg);
  border-radius: inherit;
}

.liquidGlass-shine {
  position: absolute;
  inset: 0;
  z-index: 2;
  overflow: hidden;
  border-radius: inherit;
  box-shadow: var(--inner-glow);
  pointer-events: none;
}

.liquidGlass-text {
  z-index: 3;
  position: relative;
  width: 100%;
  color: var(--text);
}

.home-panel .liquidGlass-text,
.title-panel .liquidGlass-text,
.data-panel .liquidGlass-text {
  padding: 22px 24px;
}

.anchors-panel {
  width: max-content;
  max-width: 100%;
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-width: none;
}

.anchors-panel::-webkit-scrollbar {
  display: none;
}

.anchors-panel .liquidGlass-text {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: 4px 6px;
  padding: 8px 12px;
  white-space: nowrap;
  width: max-content;
}

.anchors-panel .anchor-link,
.anchors-panel .pager-gap {
  flex: 0 0 auto;
}

.anchors-wrap {
  position: static;
  top: auto;
  z-index: auto;
  margin: 0;
  width: max-content;
  max-width: 100%;
}

.title-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  cursor: pointer;
  padding: 10px 16px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--glass-bg);
  color: var(--text);
  text-decoration: none;
  font: inherit;
  box-shadow:
    inset 0 1px 2px rgba(255, 255, 255, calc(0.55 * var(--glass-reflex-light))),
    inset 0 -1px 2px rgba(0, 0, 0, calc(0.12 * var(--glass-reflex-dark))),
    0 4px 18px var(--glass-shadow);
  backdrop-filter: var(--blur);
  -webkit-backdrop-filter: var(--blur);
  transition: background-color 0.35s ease, transform 0.35s cubic-bezier(0.34, 1.45, 0.64, 1), border-color 0.35s ease;
}

.button:hover {
  border-color: var(--glass-accent-border);
  background: var(--glass-bg-hover);
  transform: translateY(-1px);
}

.button.primary {
  background: linear-gradient(105deg, var(--accent-from), var(--accent-mid) 50%, var(--accent-to));
  color: #0b1220;
  border-color: var(--glass-accent-border);
  font-weight: 700;
  box-shadow: 0 8px 26px var(--glass-accent-shadow), var(--inner-glow);
}

.btn-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
}

.anchor-link {
  color: var(--text);
  text-decoration: none;
  min-width: 28px;
  height: 28px;
  padding: 0 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  text-align: center;
  font-variant-numeric: tabular-nums;
  opacity: 0.75;
}

.anchor-link:hover,
.anchor-link.is-active {
  opacity: 1;
  color: var(--text);
  background: var(--glass-bg-hover);
}

.anchor-link.is-active {
  border: 1px solid var(--glass-accent-border);
  box-shadow: 0 0 16px var(--glass-accent-shadow);
}

.pager-gap {
  opacity: 0.45;
  padding: 0 2px;
  user-select: none;
}

.body-row {
  position: relative;
  padding: 56px 0;
  scroll-margin-top: calc(var(--chrome-h) + 16px);
}
.body-row .idx {
  position: absolute;
  left: 0;
  top: 8px;
  text-decoration: none;
  opacity: 0.55;
  font-size: 13px;
  color: var(--muted);
}

.info-item-container { margin: 0 auto; cursor: pointer; width: fit-content; max-width: 100%; }
.orb, .sprite {
  margin: 0 auto;
  display: block;
}
.orb {
  border-radius: 50%;
  transition: transform 0.25s ease;
}
.sprite img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  mix-blend-mode: screen;
  pointer-events: none;
  user-select: none;
}
.sprite-dust {
  border-radius: 0;
  height: auto !important;
  width: min(100%, 520px) !important;
}
.sprite-dust img { object-fit: cover; }
.orb-dust {
  border-radius: 0;
  height: 28px !important;
  width: min(100%, 520px) !important;
  filter: blur(0.4px);
}
.orb-galaxy { border-radius: 50%; filter: blur(0.3px); }
.spin-slow { animation: spin 140s linear infinite; }
@keyframes spin { to { transform: rotate(-360deg); } }

.orb-wrap { position: relative; margin: 0 auto; overflow: visible; }
.uni-light {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0;
  height: 0;
  pointer-events: none;
  animation: flicker 2.4s ease-in-out infinite;
}
@keyframes flicker {
  0%, 100% { opacity: 0.35; }
  50% { opacity: 0.9; }
}

.star-cluster {
  display: flex;
  gap: 8px;
  justify-content: center;
  align-items: center;
  max-width: 160px;
  margin: 0 auto;
}

.info-item {
  visibility: hidden;
  position: fixed;
  top: calc(var(--chrome-h) + 8px);
  right: 12px;
  width: min(400px, calc(100% - 24px));
  max-height: calc(100dvh - var(--chrome-h) - 20px);
  z-index: 45;
  overflow: hidden;
}

.info-glass {
  padding: 16px 18px 14px;
  border-radius: 22px;
  border: 1px solid color-mix(in srgb, var(--info-accent, var(--line)) 45%, var(--line));
  background:
    linear-gradient(180deg, color-mix(in srgb, var(--info-accent, transparent) 16%, transparent), transparent 42%),
    color-mix(in srgb, var(--page-bg) 78%, transparent);
  box-shadow: var(--shadow), var(--inner-glow), 0 0 40px color-mix(in srgb, var(--info-accent, transparent) 22%, transparent);
  backdrop-filter: var(--blur);
  -webkit-backdrop-filter: var(--blur);
  max-height: calc(100dvh - var(--chrome-h) - 20px);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.element_info_container {
  flex: 1 1 auto;
  min-height: 0;
  max-height: none;
  overflow-y: auto;
  scrollbar-width: thin;
}
.element_info_container::-webkit-scrollbar { width: 6px; }
.element_info_container::-webkit-scrollbar-thumb {
  background: color-mix(in srgb, var(--info-accent, var(--muted)) 50%, transparent);
  border-radius: 99px;
}

.info-glass .btn-row {
  flex: 0 0 auto;
  margin-top: 10px;
  padding-top: 4px;
}

.el-bars {
  height: 120px;
  width: 100%;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  margin-bottom: 10px;
  border-radius: 12px;
}
.el-bar { height: 100%; min-height: 4px; }
.el-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 4px 8px; font-size: 13px; }
.el-name { color: var(--muted); }

.planet-hero { margin-top: 24px; }
.star-section { margin-top: 80px; }

.home-wrap {
  width: min(680px, calc(100% - 40px));
  margin: 6vh auto 0;
}
.lede {
  margin: 16px 0 24px;
  color: var(--muted);
  font-size: 1.05rem;
  line-height: 1.55;
  max-width: 46ch;
}
.seed-label {
  display: block;
  color: var(--muted);
  font-size: 12px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  margin-bottom: 8px;
}
.seed-row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.glass-input {
  flex: 1;
  min-width: 180px;
  background: var(--glass-bg);
  border: 1px solid var(--line);
  color: var(--text);
  font: inherit;
  font-size: 1.05rem;
  padding: 10px 14px;
  border-radius: 999px;
  box-shadow: var(--inner-glow);
  outline: none;
}
.glass-input:focus {
  border-color: var(--glass-accent-border);
}

.element-glyph {
  width: 160px;
  height: 160px;
  margin: 18px auto;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 84px;
  position: relative;
  overflow: visible;
}
.element-glyph img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  mix-blend-mode: screen;
  pointer-events: none;
}
.element-glyph span { position: relative; z-index: 1; }
.recipe-row { display: flex; gap: 12px; justify-content: center; margin-top: 8px; }

.surface-wrap {
  position: relative;
  width: 100%;
  flex: 1 1 auto;
  min-height: 240px;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}
.surface-stage {
  transform-origin: center center;
  will-change: transform;
}
.planet_surface {
  margin: 0 auto;
  display: grid;
  transform: rotateX(60deg) rotateZ(45deg);
  transform-style: preserve-3d;
}
.planet_surface .tile {
  width: 50px;
  height: 50px;
  position: relative;
  overflow: visible;
  margin: 0;
  padding: 0;
}
.planet_surface .tile img {
  max-width: none;
  transform: rotateZ(315deg);
  position: absolute;
  top: -105px;
  left: -65px;
  width: 118px;
  height: 197px;
  pointer-events: none;
  user-select: none;
  mix-blend-mode: lighten;
}
.planet_surface .tile:hover {
  outline: 2px solid var(--glass-accent-border);
}

@media (max-width: 800px) {
  #chrome {
    top: 8px;
    width: calc(100% - 16px);
    gap: 8px;
  }
  #pager-slot {
    align-self: stretch;
    display: flex;
    justify-content: flex-end;
  }
  #pager-slot .anchors-wrap {
    max-width: 100%;
  }
  .topbar {
    flex-wrap: wrap;
    min-height: 0;
    padding: 8px 10px;
    gap: 8px;
  }
  .brand:not(.is-object) small { display: none; }
  #view-actions .button { padding: 6px 10px; font-size: 12px; }
  .crumbs {
    right: max(8px, env(safe-area-inset-right));
    bottom: max(8px, env(safe-area-inset-bottom));
    padding: 5px 10px;
    font-size: 11px;
  }
  .body-row { padding: 28px 0; }
  .info-item {
    left: 8px;
    right: 8px;
    width: auto;
    top: auto;
    bottom: 8px;
    max-height: min(58dvh, calc(100dvh - var(--chrome-h) - 16px));
  }
  .info-glass {
    max-height: min(58dvh, calc(100dvh - var(--chrome-h) - 16px));
    border-radius: 18px;
    padding: 14px 14px 12px;
  }
  .text-small { font-size: 13px; }
  .planet-hero { margin-top: 8px; }
  .star-section { margin-top: 40px; }
  .home-wrap { margin: 3vh auto 0; width: min(680px, calc(100% - 24px)); }
  .container { width: min(920px, calc(100% - 20px)); }
}

@media (max-width: 520px) {
  #view-actions { gap: 6px; }
}

@media (prefers-reduced-motion: reduce) {
  #main { animation: none; }
  .spin-slow, .uni-light { animation: none; }
}
