:root{
  --shell-window-pad: 24px;
  --shell-max: 1440px;
  --shell-center-bias-x: 0px;

  --shell-line: rgba(255,255,255,0.05);
  --shell-line-2: rgba(255,255,255,0.08);
  --shell-line-3: rgba(126,173,255,0.22);

  --shell-text: #edf4ff;
  --shell-muted: #9eb2ce;

  --shell-blue: #5da9ff;
  --shell-gold: #d7ae49;

  --shell-radius: 24px;
  --shell-radius-lg: 30px;
  --shell-radius-md: 18px;
  --shell-radius-sm: 12px;
  --shell-radius-xs: 10px;

  --shell-shadow: 0 24px 70px rgba(0,0,0,0.42);
  --shell-shadow-strong: 0 32px 90px rgba(0,0,0,0.52);

  --shell-inset-x: 18px;
  --shell-inset-y: 16px;
  --shell-gap-y: 10px;
  --shell-main-gap: 10px;

  --shell-edge-width: 10px;
  --shell-edge-radius: 16px;

  --shell-transition: 180ms ease;

  --crown-bg:
    linear-gradient(180deg, rgba(20,22,27,.96) 0%, rgba(12,14,18,.985) 100%);
  --crown-border: rgba(184,154,92,.18);
  --crown-border-strong: rgba(184,154,92,.28);
  --crown-highlight: rgba(255,255,255,.06);
  --crown-shadow:
    inset 0 1px 0 rgba(255,255,255,.04),
    0 14px 34px rgba(0,0,0,.28);

  --crest-title: #f3f5f9;
  --crest-subtitle: rgba(214,220,230,.72);
  --crest-meta: rgba(226,231,238,.78);
  --crest-meta-soft: rgba(214,220,230,.62);

  --crest-accent: #b89a5c;
  --crest-accent-soft: rgba(184,154,92,.18);
  --crest-accent-glow: rgba(184,154,92,.12);

  --crown-radius: 22px;
  --crown-inner-radius: 18px;
  --crown-band-radius: 16px;
  --dock-radius: 16px;
  --emblem-radius: 16px;
}

*,
*::before,
*::after{
  box-sizing: border-box;
}

html,
body{
  width: 100%;
  height: 100%;
  margin: 0;
}

html{
  scroll-behavior: smooth;
}

body.shell-body{
  min-height: 100dvh;
  height: 100dvh;
  margin: 0;
  overflow: hidden;
  display: grid;
  place-items: center;
  color: var(--shell-text);
  font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background:
    radial-gradient(circle at top, rgba(26,50,94,0.24), transparent 32%),
    radial-gradient(circle at top right, rgba(215,174,73,0.05), transparent 24%),
    #05070d;
  padding: var(--shell-window-pad);
}

body.shell-lock{
  overflow: hidden;
}

a{
  color: inherit;
  text-decoration: none;
}

/* =========================================================
   APP + FRAME
   ========================================================= */

.shell-app{
  width: min(
    var(--shell-max),
    calc(100vw - (var(--shell-window-pad) * 2))
  );
  height: min(
    calc(100dvh - (var(--shell-window-pad) * 2)),
    100%
  );
  min-width: 0;
  min-height: 0;
  margin: 0;
}

.shell-frame{
  position: relative;
  width: 100%;
  height: 100%;
  min-width: 0;
  min-height: 0;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  gap: var(--shell-gap-y);
  padding: var(--shell-inset-y) var(--shell-inset-x);
  border-radius: var(--shell-radius-lg);
  overflow: hidden;
  isolation: isolate;
  border: 1px solid var(--shell-line-2);
  background:
    linear-gradient(180deg, rgba(255,255,255,0.018), rgba(255,255,255,0.006)),
    linear-gradient(180deg, rgba(10,18,34,0.985), rgba(7,14,28,0.965));
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.035),
    0 0 0 1px rgba(0,0,0,0.5),
    var(--shell-shadow-strong);
}

.shell-frame::before{
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  background:
    linear-gradient(180deg, rgba(255,255,255,0.028), transparent 12%),
    linear-gradient(90deg, rgba(255,255,255,0.012), transparent 10%, transparent 90%, rgba(255,255,255,0.012));
  z-index: 1;
}

.shell-frame::after{
  content: "";
  position: absolute;
  inset: 10px;
  border-radius: calc(var(--shell-radius-lg) - 8px);
  border: 1px solid rgba(255,255,255,0.045);
  pointer-events: none;
  z-index: 1;
}

/* =========================================================
   SHELL TOPBAND / CROWN
   ========================================================= */

.shell-topband{
  position: relative;
  z-index: 30;
  min-height: 0;
  margin: 0;
  padding: 0;
}

.shell-topband__inner{
  width: 100%;
  min-width: 0;
  max-width: none;
  margin: 0;
  padding: 8px 0 0;
}

.shell-crown{
  position: relative;
  width: 100%;
  min-width: 0;
  padding: 6px;
  border-radius: var(--crown-radius);
  background: var(--crown-bg);
  border: 1px solid rgba(255,255,255,.08);
  box-shadow: var(--crown-shadow);
  overflow: hidden;
  isolation: isolate;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
}

.shell-crown::before{
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  padding: 1px;
  background:
    linear-gradient(
      180deg,
      rgba(255,255,255,.10),
      rgba(184,154,92,.22),
      rgba(255,255,255,.04)
    );
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  pointer-events: none;
}

.shell-crown::after{
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background:
    linear-gradient(180deg, rgba(255,255,255,.04), transparent 34%),
    repeating-linear-gradient(
      180deg,
      transparent 0,
      transparent 8px,
      rgba(255,255,255,.012) 9px
    );
  opacity: .36;
  pointer-events: none;
  z-index: 0;
}

.shell-crown__main,
.shell-crown__controls,
.shell-crown__utilities{
  position: relative;
  z-index: 1;
  min-width: 0;
}

.shell-crown__main{
  min-width: 0;
  align-self: center;
}

.shell-crown__controls{
  justify-self: end;
  align-self: center;
  min-width: 0;
  display: inline-grid;
  grid-auto-flow: column;
  grid-auto-columns: max-content;
  align-items: center;
  gap: 8px;
  padding: 0;
  background: none;
  border: 0;
  box-shadow: none;
}

.shell-crown__controls::before{
  display: none;
}

.shell-crown__utilities{
  display: none;
}

/* =========================================================
   CREST BAND
   ========================================================= */

.crest{
  position: relative;
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr);
  align-items: center;
  column-gap: 11px;
  width: 100%;
  min-width: 0;
  margin: 0;
  padding: 9px 14px;
  border-radius: var(--crown-band-radius);
  background:
    radial-gradient(120% 140% at 14% 18%, rgba(184,154,92,.08), transparent 48%),
    linear-gradient(180deg, rgba(255,255,255,.026), rgba(255,255,255,.010)),
    linear-gradient(180deg, rgba(14,16,22,.92), rgba(10,12,17,.96));
  border: 1px solid rgba(184,154,92,.14);
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,.04),
    inset 0 -1px 0 rgba(0,0,0,.12),
    inset 0 0 0 1px rgba(255,255,255,.012);
  overflow: hidden;
}

.crest::before{
  content: "";
  position: absolute;
  inset: 6px;
  border-radius: calc(var(--crown-band-radius) - 4px);
  border: 1px solid rgba(184,154,92,.10);
  pointer-events: none;
}

.crest::after{
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: linear-gradient(180deg, rgba(255,255,255,.03), transparent 24%);
  pointer-events: none;
  z-index: 0;
}

.crest > *{
  position: relative;
  z-index: 1;
}

.crest__corners,
.crest__corners::before,
.crest__corners::after{
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
}

.crest__corners::before,
.crest__corners::after{
  content: "";
  background-repeat: no-repeat;
  background-size: 12px 12px;
  opacity: .18;
}

.crest__corners::before{
  background-image:
    linear-gradient(var(--crest-accent), var(--crest-accent)),
    linear-gradient(var(--crest-accent), var(--crest-accent)),
    linear-gradient(var(--crest-accent), var(--crest-accent)),
    linear-gradient(var(--crest-accent), var(--crest-accent));
  background-position:
    top 9px left 9px,
    top 9px left 9px,
    top 9px right 9px,
    top 9px right 9px;
  background-size:
    12px 1px,
    1px 12px,
    12px 1px,
    1px 12px;
}

.crest__corners::after{
  background-image:
    linear-gradient(var(--crest-accent), var(--crest-accent)),
    linear-gradient(var(--crest-accent), var(--crest-accent)),
    linear-gradient(var(--crest-accent), var(--crest-accent)),
    linear-gradient(var(--crest-accent), var(--crest-accent));
  background-position:
    bottom 9px left 9px,
    bottom 9px left 9px,
    bottom 9px right 9px,
    bottom 9px right 9px;
  background-size:
    12px 1px,
    1px 12px,
    12px 1px,
    1px 12px;
}

/* =========================================================
   EMBLEM
   ========================================================= */

.crest__emblem{
  grid-column: 1;
  justify-self: start;
  align-self: center;
  position: relative;
  display: grid;
  place-items: center;
  width: 35px;
  height: 35px;
  border-radius: var(--emblem-radius);
  background:
    radial-gradient(120% 120% at 20% 20%, rgba(184,154,92,.10), transparent 55%),
    linear-gradient(180deg, rgba(255,255,255,.03), rgba(255,255,255,.01)),
    linear-gradient(180deg, rgba(12,14,18,.86), rgba(8,10,13,.94));
  border: 1px solid rgba(184,154,92,.20);
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,.05),
    inset 0 -1px 0 rgba(0,0,0,.12),
    inset 0 0 0 1px rgba(255,255,255,.012);
}

.crest__emblem::before{
  content: "";
  position: absolute;
  inset: 5px;
  border-radius: 9px;
  border: 1px solid rgba(184,154,92,.14);
  pointer-events: none;
}

.crest__sigil{
  position: relative;
  width: 8px;
  height: 8px;
  transform: rotate(45deg);
  border: 1px solid rgba(184,154,92,.58);
  background:
    linear-gradient(180deg, rgba(184,154,92,.30), rgba(184,154,92,.08));
  box-shadow:
    0 0 0 1px rgba(255,255,255,.04) inset,
    0 0 12px rgba(184,154,92,.10);
}

.crest__sigil::before{
  content: "";
  position: absolute;
  inset: 50%;
  width: 2px;
  height: 2px;
  transform: translate(-50%, -50%) rotate(-45deg);
  border-radius: 1px;
  background: var(--crest-accent);
}

/* =========================================================
   INSCRIPTION
   ========================================================= */

.crest__inscription{
  grid-column: 2;
  min-width: 0;
  display: flex;
  align-items: center;
}

.crest__title{
  margin: 0;
  font-size: 1.02rem;
  line-height: 1.02;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--crest-title);
  font-weight: 700;
  text-align: left;
  text-shadow: 0 6px 14px rgba(0,0,0,.16);
}

.crest__subtitle{
  margin: 0;
  font-size: .58rem;
  line-height: 1;
  letter-spacing: .10em;
  text-transform: uppercase;
  color: var(--crest-subtitle);
  text-align: left;
}

/* =========================================================
   COMMAND BUTTONS
   ========================================================= */

.shell-crown-action,
.shell-utility{
  width: auto;
  min-width: 0;
}

.shell-crown-action .btn__face{
  min-height: 32px;
  padding: 0 10px;
  border-radius: 10px;
  border-color: rgba(255,255,255,.08);
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,.05),
    inset 0 0 0 1px rgba(255,255,255,.015);
  white-space: nowrap;
}

.shell-utility .btn__face{
  min-height: 32px;
  padding: 0 10px;
  border-radius: 10px;
  border-color: rgba(255,255,255,.065);
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,.04),
    inset 0 0 0 1px rgba(255,255,255,.012);
  white-space: nowrap;
}

.shell-crown-action:hover,
.shell-utility:hover{
  transform: translateY(-1px);
}

.shell-crown-action--workspace:hover .btn__face,
.crest-access__btn--workspace:hover .btn__face{
  background: linear-gradient(180deg, #5f7287, #46586b);
  border-color: rgba(190,215,240,.32);
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,.07),
    0 0 0 1px rgba(190,215,240,.10),
    0 0 16px rgba(95,114,135,.18);
}

.shell-crown-action--engine:hover .btn__face,
.crest-access__btn--engine:hover .btn__face{
  background: linear-gradient(180deg, #c8a12b, #a88433);
  border-color: rgba(255,230,140,.34);
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,.07),
    0 0 0 1px rgba(255,230,140,.10),
    0 0 16px rgba(200,161,43,.18);
}

/* =========================================================
   MAIN BODY / CHASSIS
   ========================================================= */

.shell-main{
  position: relative;
  min-height: 0;
  display: grid;
  grid-template-columns: var(--shell-edge-width) minmax(0, 1fr) var(--shell-edge-width);
  gap: var(--shell-main-gap);
  overflow: hidden;
  padding-bottom: 6px;
  margin: 0;
}

.shell-main > .shell-edge,
.shell-main > .shell-viewport{
  min-height: 0;
}

.shell-edge{
  position: relative;
  min-height: 100%;
  border-radius: var(--shell-edge-radius);
  background:
    linear-gradient(180deg, rgba(255,255,255,0.024), rgba(255,255,255,0.006));
  border: 1px solid rgba(255,255,255,0.03);
  overflow: hidden;
}

.shell-edge::before{
  content: "";
  position: absolute;
  top: 18px;
  bottom: 18px;
  left: 50%;
  width: 1px;
  transform: translateX(-50%);
  background: linear-gradient(180deg, transparent, rgba(93,169,255,0.22), transparent);
}

.shell-edge--left::after,
.shell-edge--right::after{
  content: "";
  position: absolute;
  top: 22px;
  left: 50%;
  width: 7px;
  height: 7px;
  transform: translateX(-50%);
  border-radius: 999px;
  background: rgba(93,169,255,0.28);
  box-shadow: 0 0 0 3px rgba(93,169,255,0.04);
}

/* =========================================================
   SHELL WINDOWS
   ========================================================= */

.shell-window{
  position: absolute;
  top: 96px;
  bottom: 18px;
  padding: 18px;
  border: 1px solid var(--shell-line-3);
  border-radius: 24px;
  background:
    linear-gradient(180deg, rgba(255,255,255,0.028), rgba(255,255,255,0.01)),
    rgba(10,20,39,0.94);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  box-shadow: var(--shell-shadow);
  overflow: hidden;
  display: grid;
  grid-template-rows: auto 1fr;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition:
    opacity var(--shell-transition),
    transform var(--shell-transition),
    visibility var(--shell-transition);
  z-index: 30;
}

.shell-window--nav{
  left: 16px;
  width: min(430px, calc(100% - 32px));
  transform: translateX(-16px);
}

.shell-window--modules{
  left: 50%;
  width: min(520px, calc(100% - 32px));
  transform: translateX(-50%) translateY(10px);
}

.shell-window--credits{
  right: 16px;
  width: min(360px, calc(100% - 32px));
  bottom: 74px;
  transform: translateX(16px);
}

.shell-window.is-open{
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

.shell-window--nav.is-open,
.shell-window--credits.is-open{
  transform: translateX(0);
}

.shell-window--modules.is-open{
  transform: translateX(-50%) translateY(0);
}

.shell-window-head{
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}

.shell-window-title{
  margin: 0;
  font-size: 1.02rem;
  font-weight: 700;
}

.shell-window-subtitle{
  margin: 4px 0 0;
  color: var(--shell-muted);
  font-size: 0.88rem;
  line-height: 1.4;
}

.shell-window-body{
  overflow-y: auto;
  min-height: 0;
  padding-right: 4px;
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,0.12) transparent;
}

.shell-window-body::-webkit-scrollbar{
  width: 10px;
}

.shell-window-body::-webkit-scrollbar-thumb{
  background: rgba(255,255,255,0.12);
  border-radius: 999px;
}

/* =========================================================
   INTERIOR
   ========================================================= */

.shell-section{
  display: grid;
  gap: 10px;
  margin-top: 18px;
}

.shell-section:first-child{
  margin-top: 0;
}

.shell-section-label{
  font-size: 0.74rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--shell-muted);
}

.shell-link-list{
  display: grid;
  gap: 10px;
}

.shell-link{
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  border-radius: 16px;
  border: 1px solid rgba(255,255,255,0.06);
  background: rgba(255,255,255,0.024);
  transition:
    background var(--shell-transition),
    border-color var(--shell-transition),
    transform var(--shell-transition);
}

.shell-link:hover,
.shell-link:focus-visible{
  background: rgba(255,255,255,0.05);
  border-color: var(--shell-line-3);
  outline: none;
}

.shell-link:active{
  transform: translateY(1px);
}

.shell-link.is-active{
  background: rgba(93,169,255,0.10);
  border-color: rgba(93,169,255,0.28);
}

.shell-link-copy{
  min-width: 0;
}

.shell-link-title{
  display: block;
  font-weight: 600;
}

.shell-link-meta{
  display: block;
  margin-top: 3px;
  color: var(--shell-muted);
  font-size: 0.84rem;
}

.shell-card{
  padding: 16px;
  border-radius: 18px;
  border: 1px solid rgba(255,255,255,0.06);
  background: rgba(255,255,255,0.024);
}

.shell-card-title{
  margin: 0 0 8px;
  font-size: 0.96rem;
  font-weight: 700;
}

.shell-card-text{
  margin: 0;
  color: var(--shell-muted);
  font-size: 0.9rem;
  line-height: 1.5;
}

.shell-inline-actions{
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 14px;
}

.shell-badge{
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 11px;
  border-radius: 999px;
  background: rgba(215,174,73,0.14);
  border: 1px solid rgba(215,174,73,0.24);
  color: #f4dfad;
  font-size: 0.8rem;
  font-weight: 600;
  margin-bottom: 10px;
}

/* =========================================================
   REMOVE OLD SYSTEM
   ========================================================= */

.shell-chrome,
.shell-identity,
.shell-access,
.shell-brand-band,
.shell-brand-subtitle,
.shell-rail-link,
.shell-topband__language,
.shell-topband__identity,
.shell-topband__ops,
.shell-topband__system,
.shell-opsbox{
  display: none !important;
}

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

@media (min-width: 720px){
  .shell-topband__inner{
    padding: 8px 0 0;
  }

  .shell-crown{
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 10px;
    padding: 6px;
  }

  .crest{
    grid-template-columns: 44px minmax(0, 1fr);
    column-gap: 11px;
    padding: 9px 14px;
  }

  .crest__emblem{
    width: 35px;
    height: 35px;
  }

  .crest__sigil{
    width: 8px;
    height: 8px;
  }
}

@media (max-width: 1100px){
  .shell-main{
    grid-template-columns: 10px minmax(0, 1fr) 10px;
  }
}

@media (max-width: 820px){
  body.shell-body{
    padding: 8px;
    display: grid;
    grid-template-columns: 1fr;
    align-items: start;
    justify-items: stretch;
  }

  .shell-app{
    width: 100%;
    height: calc(100dvh - 16px);
    margin: 0;
  }

  .shell-frame{
    height: 100%;
    min-height: 0;
    padding: 8px;
    gap: 6px;
    border-radius: 16px;
  }

  .shell-frame::after{
    inset: 6px;
    border-radius: 12px;
  }

  .shell-topband__inner{
    padding-top: 6px;
  }

  .shell-crown{
    grid-template-columns: 1fr;
    padding: 6px;
    gap: 6px;
    border-radius: 14px;
  }

  .shell-main{
    grid-template-columns: 1fr;
    gap: 6px;
    padding-bottom: 0;
  }

  .shell-main > .shell-edge{
    display: none;
  }

  .shell-window{
    top: auto;
    left: 8px !important;
    right: 8px !important;
    bottom: 8px;
    width: auto;
    max-height: min(34dvh, 250px);
    padding: 9px;
    border-radius: 14px;
  }

  .shell-window--nav,
  .shell-window--modules,
  .shell-window--credits{
    bottom: 8px;
  }

  .shell-window--modules{
    transform: translateY(10px);
  }

  .shell-window--modules.is-open,
  .shell-window--nav.is-open,
  .shell-window--credits.is-open{
    transform: translateY(0);
  }

  .shell-window-head{
    gap: 6px;
    margin-bottom: 7px;
  }

  .shell-window-title{
    font-size: 0.84rem;
  }

  .shell-window-subtitle{
    margin-top: 2px;
    font-size: 0.72rem;
    line-height: 1.25;
  }

  .shell-window-body{
    padding-right: 2px;
  }

  .shell-section{
    gap: 5px;
    margin-top: 8px;
  }

  .shell-section-label{
    font-size: 0.62rem;
    letter-spacing: 0.1em;
  }

  .shell-link-list{
    gap: 4px;
  }

  .shell-link{
    min-height: 32px;
    padding: 7px 9px;
    gap: 6px;
    border-radius: 10px;
  }

  .shell-link-title{
    font-size: 0.76rem;
    line-height: 1.05;
  }

  .shell-link-meta{
    margin-top: 1px;
    font-size: 0.68rem;
    line-height: 1.15;
  }

  .shell-card{
    padding: 9px;
    border-radius: 12px;
  }

  .shell-card-title{
    font-size: 0.82rem;
    margin-bottom: 5px;
  }

  .shell-card-text{
    font-size: 0.76rem;
    line-height: 1.35;
  }
}

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

  .shell-crown{
    border-radius: 16px;
  }

  .shell-window{
    max-height: min(30dvh, 220px);
    padding: 8px;
  }

  .shell-link{
    min-height: 30px;
    padding: 6px 8px;
  }
}

@media (prefers-reduced-motion: reduce){
  .shell-crown,
  .crest,
  .crest::before,
  .crest::after,
  .crest__sigil,
  .shell-crown-action,
  .shell-utility,
  .shell-window,
  .shell-link{
    transition: none !important;
  }
}
.shell-overlay[aria-hidden="true"] {
  pointer-events: none;
}

.shell-overlay__backdrop[aria-hidden="true"] {
  opacity: 0;
  visibility: hidden;
}

.shell-overlay__backdrop[aria-hidden="false"] {
  opacity: 1;
  visibility: visible;
}