:root {
  --crown-bg:
    linear-gradient(180deg, rgba(17,19,23,.972) 0%, rgba(10,12,16,.992) 100%);
  --crown-border: rgba(184,154,92,.12);
  --crown-border-strong: rgba(184,154,92,.18);
  --crown-highlight: rgba(255,255,255,.03);
  --crown-shadow:
    inset 0 1px 0 rgba(255,255,255,.025),
    0 8px 18px rgba(0,0,0,.18);

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

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

  --crown-radius: 18px;
  --crown-inner-radius: 14px;
  --crown-band-radius: 12px;
  --emblem-radius: 11px;

  --crest-pad-x: 14px;
  --crest-pad-y: 9px;

  /* shared shell control sizing */
  --shell-control-height: 31px;
  --shell-control-pad-x: 10px;
  --shell-control-radius: 10px;
  --shell-control-font-size: 10px;
  --shell-control-letter: .03em;

  /* integrated crest access */
  --crest-access-gap: 6px;
  --crest-access-label-size: 8px;
  --crest-access-label-letter: .14em;
  --crest-access-label-color: rgba(210,220,235,.58);

  --crest-access-border: rgba(255,255,255,.055);
  --crest-access-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));
  --crest-access-shadow:
    inset 0 1px 0 rgba(255,255,255,.028),
    inset 0 0 0 1px rgba(255,255,255,.008);

  /* hover associations */
  --hover-workspace-bg: linear-gradient(180deg, #5f7287, #46586b);
  --hover-workspace-border: rgba(190,215,240,.28);

  --hover-engine-bg: linear-gradient(180deg, #c8a12b, #a88433);
  --hover-engine-border: rgba(255,230,140,.30);

  --hover-pattern-bg: linear-gradient(180deg, #6f5331, #4f3920);
  --hover-pattern-border: rgba(184,154,92,.28);
}

/* =========================================================
   ACCESSIBILITY
   ========================================================= */

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* =========================================================
   CROWN STRIP
   ========================================================= */

.shell-crown-strip {
  width: 100%;
  min-width: 0;
  display: grid;
  align-items: center;
}

.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,.05);
  box-shadow: var(--crown-shadow);
  overflow: hidden;
  isolation: isolate;
  display: grid;
  align-items: center;
}

.shell-crown::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  padding: 1px;
  background:
    linear-gradient(
      180deg,
      rgba(255,255,255,.06),
      rgba(184,154,92,.12),
      rgba(255,255,255,.02)
    );
  -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,.014), transparent 26%);
  opacity: .34;
  pointer-events: none;
  z-index: 0;
}

/* =========================================================
   COMMAND PLATE
   ========================================================= */

.crest {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr);
  align-items: center;
  column-gap: 11px;
  width: 100%;
  min-width: 0;
  margin: 0;
  padding: var(--crest-pad-y) var(--crest-pad-x);
  border-radius: var(--crown-band-radius);
  background:
    radial-gradient(100% 120% at 10% 18%, rgba(184,154,92,.035), transparent 38%),
    linear-gradient(180deg, rgba(255,255,255,.012), rgba(255,255,255,.003)),
    linear-gradient(180deg, rgba(13,15,20,.94), rgba(9,11,15,.975));
  border: 1px solid rgba(184,154,92,.08);
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,.02),
    inset 0 -1px 0 rgba(0,0,0,.08);
  overflow: hidden;
}

.crest--with-access {
  grid-template-columns: 44px minmax(0, 1fr) auto;
  align-items: center;
}

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

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

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

/* =========================================================
   CORNER DETAIL
   ========================================================= */

.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;
  opacity: .12;
}

.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 8px left 8px,
    top 8px left 8px,
    top 8px right 8px,
    top 8px right 8px;
  background-size:
    9px 1px,
    1px 9px,
    9px 1px,
    1px 9px;
}

.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 8px left 8px,
    bottom 8px left 8px,
    bottom 8px right 8px,
    bottom 8px right 8px;
  background-size:
    9px 1px,
    1px 9px,
    9px 1px,
    1px 9px;
}

/* =========================================================
   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(110% 110% at 20% 20%, rgba(184,154,92,.055), transparent 50%),
    linear-gradient(180deg, rgba(255,255,255,.014), rgba(255,255,255,.004)),
    linear-gradient(180deg, rgba(11,13,17,.88), rgba(8,10,13,.95));
  border: 1px solid rgba(184,154,92,.12);
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,.025),
    inset 0 -1px 0 rgba(0,0,0,.08);
}

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

.crest__sigil {
  position: relative;
  width: 8px;
  height: 8px;
  transform: rotate(45deg);
  border: 1px solid rgba(184,154,92,.42);
  background:
    linear-gradient(180deg, rgba(184,154,92,.18), rgba(184,154,92,.04));
  box-shadow:
    0 0 0 1px rgba(255,255,255,.015) inset,
    0 0 6px rgba(184,154,92,.05);
}

.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__line {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-width: 0;
}

.crest__identity {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  flex: 0 1 auto;
  min-width: 0;
  white-space: nowrap;
}

.crest__title,
.crest__subtitle {
  margin: 0;
  display: inline-flex;
  align-items: center;
  line-height: 1;
  text-transform: uppercase;
  text-align: left;
}

.crest__title {
  font-size: 1.02rem;
  letter-spacing: .07em;
  color: var(--crest-title);
  font-weight: 700;
  text-shadow: 0 3px 8px rgba(0,0,0,.12);
}

.crest__subtitle {
  font-size: .58rem;
  letter-spacing: .10em;
  color: var(--crest-subtitle);
  font-weight: 600;
}

.crest__divider {
  width: 1px;
  height: 11px;
  background: rgba(184,154,92,.24);
  box-shadow: 0 0 6px rgba(184,154,92,.04);
  flex: 0 0 1px;
}

/* =========================================================
   OPS CLUSTER
   ========================================================= */

.crest__ops-inline {
  display: inline-flex;
  align-items: center;
  justify-content: flex-start;
  gap: 6px;
  flex: 1 1 auto;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
}

.crest__ops-label,
.crest__ops-sub {
  margin: 0;
  display: inline-flex;
  align-items: center;
  line-height: 1;
  text-transform: uppercase;
}

.crest__ops-label {
  font-size: .56rem;
  letter-spacing: .08em;
  color: rgba(226,231,238,.64);
  font-weight: 700;
  flex: 0 0 auto;
}

.crest__ops-sub {
  font-size: .52rem;
  letter-spacing: .05em;
  color: rgba(214,220,230,.42);
  font-weight: 600;
  flex: 0 0 auto;
}

.crest__ops-dot {
  width: 3px;
  height: 3px;
  border-radius: 999px;
  background: var(--crest-accent);
  box-shadow: 0 0 4px rgba(184,154,92,.10);
  flex: 0 0 auto;
}

/* =========================================================
   TAPER
   ========================================================= */

.crest__taper {
  flex: 1 1 auto;
  min-width: 48px;
  height: 8px;
  align-self: center;
  margin-left: 2px;
  opacity: .62;
  background:
    linear-gradient(90deg, rgba(184,154,92,.12), rgba(184,154,92,0)) center top / 100% 1px no-repeat,
    linear-gradient(90deg, rgba(255,255,255,.035), rgba(255,255,255,0)) center bottom / 72% 1px no-repeat;
  position: relative;
}

.crest__taper::after {
  content: "";
  position: absolute;
  right: 0;
  top: 50%;
  width: 14px;
  height: 14px;
  transform: translateY(-50%);
  background:
    radial-gradient(circle, rgba(184,154,92,.05) 0%, rgba(184,154,92,0) 72%);
  pointer-events: none;
}

/* =========================================================
   CREST ACCESS
   inline label + buttons on one line
   ========================================================= */

.crest-access {
  grid-column: 3;
  justify-self: end;
  align-self: center;
  min-width: 0;
  margin-left: 10px;

  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.crest-access__label {
  display: inline-flex;
  align-items: center;
  margin: 0;
  font-size: var(--crest-access-label-size);
  font-weight: 700;
  letter-spacing: var(--crest-access-label-letter);
  text-transform: uppercase;
  text-align: left;
  color: var(--crest-access-label-color);
  white-space: nowrap;
  line-height: 1;
}

.crest-access__track {
  display: inline-grid;
  grid-template-columns: repeat(2, auto);
  gap: var(--crest-access-gap);
  align-items: center;
  min-width: 0;
}

.crest-access__btn {
  display: inline-flex;
  min-width: 0;
  text-decoration: none;
  color: inherit;
  transition:
    transform .14s ease,
    background .18s ease,
    border-color .18s ease,
    color .18s ease,
    box-shadow .18s ease;
}

.crest-access__btn .btn__face {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: var(--shell-control-height);
  padding: 0 var(--shell-control-pad-x);
  border-radius: var(--shell-control-radius);
  border: 1px solid var(--crest-access-border);
  background: var(--crest-access-bg);
  box-shadow: var(--crest-access-shadow);
  white-space: nowrap;
  text-align: center;
  font-size: var(--shell-control-font-size);
  letter-spacing: var(--shell-control-letter);
}

.crest-access__btn:hover {
  transform: translateY(-1px);
}

.crest-access__btn--workspace:hover .btn__face,
.crest-access__btn--workspace:focus-visible .btn__face {
  background: var(--hover-workspace-bg);
  border-color: var(--hover-workspace-border);
  box-shadow:
    var(--crest-access-shadow),
    0 0 0 1px rgba(190,215,240,.08),
    0 0 14px rgba(95,114,135,.14);
}

.crest-access__btn--engine:hover .btn__face,
.crest-access__btn--engine:focus-visible .btn__face {
  background: var(--hover-engine-bg);
  border-color: var(--hover-engine-border);
  box-shadow:
    var(--crest-access-shadow),
    0 0 0 1px rgba(255,230,140,.08),
    0 0 14px rgba(200,161,43,.14);
}

/* =========================================================
   MOBILE
   ========================================================= */

@media (max-width: 719px) {
  .shell-crown {
    padding: 5px;
    border-radius: 16px;
  }

  .crest {
    grid-template-columns: 30px minmax(0, 1fr);
    column-gap: 8px;
    padding: 8px 10px;
    border-radius: 11px;
  }

  .crest--with-access {
    grid-template-columns: 30px minmax(0, 1fr);
    align-items: start;
  }

  .crest::before {
    inset: 4px;
  }

  .crest__corners::before,
  .crest__corners::after {
    opacity: .10;
  }

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

  .crest__emblem::before {
    inset: 4px;
  }

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

  .crest__line {
    gap: 6px;
    align-items: flex-start;
  }

  .crest__inscription {
    align-items: flex-start;
  }

  .crest__identity {
    gap: 6px;
    flex-wrap: wrap;
  }

  .crest__title {
    font-size: .82rem;
    letter-spacing: .045em;
  }

  .crest__subtitle {
    font-size: .48rem;
    letter-spacing: .07em;
  }

  .crest__divider {
    height: 9px;
  }

  .crest__ops-inline {
    gap: 5px;
    flex-wrap: wrap;
    white-space: normal;
  }

  .crest__ops-label,
  .crest__ops-sub {
    font-size: .46rem;
    letter-spacing: .04em;
  }

  .crest__ops-dot {
    width: 3px;
    height: 3px;
  }

  .crest__taper {
    display: none;
  }

  .crest-access {
    grid-column: 1 / -1;
    justify-self: stretch;
    margin: 8px 0 0;
    display: grid;
    gap: 6px;
  }

  .crest-access__label {
    justify-content: center;
  }

  .crest-access__track {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 6px;
    width: 100%;
  }

  .crest-access__btn {
    width: 100%;
  }

  .crest-access__btn .btn__face {
    width: 100%;
    min-height: 31px;
    padding-inline: 9px;
  }
}

/* =========================================================
   TABLET / DESKTOP
   ========================================================= */

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

  .crest--with-access {
    grid-template-columns: 44px minmax(0, 1fr) auto;
  }

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

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

@media (max-width: 980px) {
  .crest-access {
    margin-left: 8px;
    gap: 6px;
  }

  .crest-access__track {
    gap: 5px;
  }

  .crest-access__btn .btn__face {
    min-height: 30px;
    padding-inline: 9px;
  }
}

@media (max-width: 420px) {
  .crest-access__track {
    grid-template-columns: 1fr;
  }
}

@media (min-width: 1100px) {
  .shell-crown {
    padding: 6px;
  }

  .crest {
    padding: 9px 15px;
  }

  .crest__title {
    font-size: 1.04rem;
  }

  .crest__ops-label {
    font-size: .57rem;
  }

  .crest__ops-sub {
    font-size: .53rem;
  }

  .crest__taper {
    min-width: 88px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .shell-crown,
  .crest,
  .crest::before,
  .crest::after,
  .crest__sigil,
  .crest__taper,
  .crest-access__btn {
    transition: none !important;
  }
}
/* =========================================================
   MOBILE PATCH — COMMAND PLATE / CREST
   ========================================================= */

@media (max-width: 719px) {
  .shell-crown {
    padding: 4px;
    border-radius: 14px;
  }

  .crest {
    grid-template-columns: 28px minmax(0, 1fr);
    column-gap: 7px;
    padding: 7px 9px;
    border-radius: 10px;
  }

  .crest--with-access {
    grid-template-columns: 28px minmax(0, 1fr);
    align-items: start;
  }

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

  .crest__emblem::before {
    inset: 4px;
  }

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

  .crest__line {
    gap: 5px;
  }

  .crest__identity {
    gap: 5px;
  }

  .crest__title {
    font-size: 0.76rem;
    letter-spacing: 0.04em;
  }

  .crest__subtitle {
    font-size: 0.44rem;
    letter-spacing: 0.06em;
  }

  .crest__divider {
    height: 8px;
  }

  .crest__ops-inline {
    gap: 4px;
  }

  .crest__ops-label,
  .crest__ops-sub {
    font-size: 0.42rem;
    letter-spacing: 0.035em;
  }

  .crest-access {
    grid-column: 1 / -1;
    justify-self: stretch;
    margin-top: 5px;
    gap: 5px;
  }

  .crest-access__label {
    font-size: 7px;
    letter-spacing: 0.12em;
  }

  .crest-access__track {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 5px;
    width: 100%;
  }

  .crest-access__btn {
    width: 100%;
  }

  .crest-access__btn .btn__face {
    width: 100%;
    min-height: 28px;
    padding-inline: 8px;
    font-size: 9px;
    letter-spacing: 0.02em;
    border-radius: 9px;
  }
}

@media (max-width: 420px) {
  .crest-access__track {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .crest__title {
    font-size: 0.72rem;
  }

  .crest__subtitle {
    font-size: 0.42rem;
  }

  .crest-access__btn .btn__face {
    min-height: 27px;
    padding-inline: 7px;
    font-size: 8.5px;
  }
}