
    /* Front end */
    #menu {
      background: linear-gradient(100deg, #04101bf8 0%, #071724e8 40%, #06131e80 72%, #06131e30),
        radial-gradient(circle at 28% 45%, #27cce812, transparent 38%)
    }

    /* Home screen only; other menus retain the existing shared controls. */
    #menu:has(> .home-screen) {
      background: transparent
    }

    .home-screen {
      position: absolute;
      inset: 0;
      overflow: auto;
      scrollbar-width: thin;
      scrollbar-color: #6e8e9c #09121b;
      background: linear-gradient(90deg, #04111ced 0%, #071725c9 37%, #06131e38 70%, #06131e12),
        linear-gradient(0deg, #04101aa0, transparent 30%, transparent 78%, #0617225c)
    }

    .home-layout {
      position: relative;
      min-height: 100%;
      display: grid;
      grid-template-rows: auto 1fr auto;
      grid-template-columns: minmax(0, 1fr);
      gap: 40px;
      padding: 26px 4.5vw
    }

    .home-screen .menu-frame {
      position: absolute;
      left: 3vw;
      top: 0;
      width: 22px;
      height: 100%;
      fill: none;
      stroke: #9fc9db38;
      stroke-width: 1;
      pointer-events: none;
      mask-image: linear-gradient(transparent, #000 16%, #000 85%, transparent)
    }

    .home-screen .menu-header {
      position: relative;
      display: flex;
      align-items: center;
      gap: 30px;
      min-height: 46px
    }

    .home-screen .menu-header:after,
    .home-screen .menu-footer:before {
      content: "";
      position: absolute;
      left: 58px;
      right: 0;
      height: 1px;
      background: linear-gradient(90deg, #93bbcd1f, transparent 45%, #93bbcd14);
      pointer-events: none
    }

    .home-screen .menu-header:after {
      bottom: -2px;
      right: 58%
    }

    .home-screen .brand {
      display: flex;
      align-items: center;
      gap: 16px;
      font: 10px var(--mono);
      letter-spacing: 1.6px;
      color: #a8cbd9
    }

    .home-screen .menu-emblem {
      width: 46px;
      height: 46px;
      flex-shrink: 0;
      fill: none;
      stroke: #a1d6e4;
      stroke-width: 1.3;
      filter: drop-shadow(0 0 6px #8ddff22a)
    }

    .home-screen .menu-emblem > circle:first-child {
      stroke: #93bbcd26;
      stroke-width: .7
    }

    .home-screen .menu-system,
    .home-screen .version {
      display: flex;
      align-items: center;
      gap: 16px;
      font: 9px var(--mono);
      letter-spacing: 1.5px;
      color: #92adb9;
      white-space: nowrap
    }

    .home-screen .menu-system:before,
    .home-screen .version:after,
    .home-screen .menu-progress:after {
      content: "";
      width: 30px;
      height: 1px;
      background: #a8cbd96b
    }

    .home-screen .version {
      margin-left: auto
    }

    .home-screen .menu-main {
      position: relative;
      align-self: stretch;
      display: flex;
      flex-direction: column;
      justify-content: space-between;
      width: 520px;
      max-width: 65vw;
      min-height: 0;
      margin: 0 0 0 1.4vw
    }

    .home-screen .wordmark {
      display: flex;
      flex-direction: column;
      font-family: Georgia, "Times New Roman", serif;
      font-weight: 400;
      font-size: clamp(52px, 4.7vw, 76px);
      line-height: .92;
      letter-spacing: -2px;
      margin: 0;
      text-shadow: 0 2px 18px #0008
    }

    .home-screen .wordmark-first {
      white-space: nowrap
    }

    .home-screen .wordmark-first b {
      margin-left: 5px;
      color: #f7c573;
      font: 18px/1 var(--mono);
      letter-spacing: 3px;
      vertical-align: middle
    }

    .home-screen .menu-tagline {
      font: italic 18px/1.45 Georgia, serif;
      color: #b8cbd3;
      margin: 12px 0 0;
      text-shadow: 0 2px 8px #000
    }

    .home-screen .menu-buttons {
      width: 414px;
      max-width: 100%;
      display: flex;
      flex-direction: column;
      gap: 10px
    }

    .home-screen .menu-buttons button {
      position: relative;
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 12px;
      text-align: left;
      border-radius: 6px 2px;
      min-height: 48px;
      padding: 12px 22px
    }

    .home-screen .menu-buttons button > span {
      font-size: 23px;
      font-weight: 400;
      line-height: 1;
      flex-shrink: 0
    }

    .home-screen .menu-buttons .primary {
      min-height: 50px
    }

    .home-screen .primary {
      font-size: 13px;
      letter-spacing: 1.6px;
      color: #edfaff !important;
      border-color: #55ddf2d0;
      background: linear-gradient(145deg, #1a4b61e8, #082131f2 60%, #12394af0);
      box-shadow: inset 0 1px #d8fcff59, inset 0 -8px 16px #03101c55,
        0 0 14px #00cfff38
    }

    .home-screen .primary:before {
      content: "";
      position: absolute;
      inset: -7px;
      pointer-events: none;
      background:
        linear-gradient(#83ecfa, #83ecfa) left top / 18px 1px no-repeat,
        linear-gradient(#83ecfa, #83ecfa) left top / 1px 20px no-repeat,
        linear-gradient(#83ecfa, #83ecfa) right top / 18px 1px no-repeat,
        linear-gradient(#83ecfa, #83ecfa) right top / 1px 20px no-repeat,
        linear-gradient(#83ecfa, #83ecfa) left bottom / 18px 1px no-repeat,
        linear-gradient(#83ecfa, #83ecfa) left bottom / 1px 20px no-repeat,
        linear-gradient(#83ecfa, #83ecfa) right bottom / 18px 1px no-repeat,
        linear-gradient(#83ecfa, #83ecfa) right bottom / 1px 20px no-repeat
    }

    .home-screen .primary:hover {
      filter: brightness(1.12)
    }

    .home-screen .secondary {
      font-size: 13px;
      color: #a9cddd;
      border-color: #7aa2b573;
      background: linear-gradient(115deg, #10202bae, #0a1720b8 55%, #25424b9e);
      box-shadow: inset 0 1px 1px #a4ccdc1a, 0 3px 14px #0003
    }

    .home-screen .secondary:hover {
      background: linear-gradient(115deg, #20485be8, #0c2938ee);
      border-color: #b5f7ff
    }

    .home-screen .menu-subnav {
      display: flex;
      align-items: center;
      margin-top: 14px;
      width: 414px;
      max-width: 100%
    }

    .home-screen .menu-subnav button {
      color: #a9d9e5;
      font: 9px var(--mono);
      letter-spacing: .5px;
      padding: 8px 12px;
      flex: 1;
      white-space: nowrap
    }

    .home-screen .menu-subnav button + button {
      border-left: 1px solid #90b6c526
    }

    .home-screen .menu-subnav button:hover {
      color: #f4ca88
    }

    .home-screen .menu-footer {
      position: relative;
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 24px;
      padding-top: 14px;
      color: #91a8b3;
      font: 10px var(--mono);
      letter-spacing: 1px
    }

    .home-screen .menu-footer:before {
      top: 0
    }

    .home-screen .menu-status,
    .home-screen .menu-progress {
      display: flex;
      align-items: center;
      gap: 18px
    }

    .home-screen .menu-beacon {
      position: relative;
      width: 38px;
      height: 38px;
      flex-shrink: 0;
      border: 1px solid #8ac1d321;
      border-radius: 50%;
      background: radial-gradient(circle, #9de8f2 0 3px, #a1e0ed33 4px, transparent 8px)
    }

    .home-screen .menu-beacon:before {
      content: "";
      position: absolute;
      inset: 9px;
      border: 1px solid #9de8f2b0;
      border-radius: 50%;
      box-shadow: 0 0 9px #72dbef26
    }

    .home-screen .menu-quote {
      position: absolute;
      right: 4.5vw;
      bottom: 11.5vh;
      width: 250px;
      text-align: right;
      color: #c3d0d4;
      font: italic 18px/1.5 Georgia, serif;
      text-shadow: 0 2px 8px #000
    }

    .home-screen .menu-quote small {
      display: flex;
      align-items: center;
      justify-content: flex-end;
      gap: 12px;
      font: 9px/3.6 var(--mono);
      letter-spacing: 1px;
      color: #e6b769
    }

    .home-screen .menu-quote small:before {
      content: "";
      width: 40px;
      height: 1px;
      background: #d8b06f99
    }

    @media(max-width:1150px) {
      .home-screen .menu-system,
      .home-screen .menu-quote {
        display: none
      }

      .home-screen .menu-progress:after {
        display: none
      }
    }

    @media(max-width:850px) {
      .home-layout {
        padding: 22px 5vw;
        gap: 28px
      }

      .home-screen .menu-main {
        max-width: 100%;
        margin: 0
      }

      .home-screen .wordmark {
        font-size: 70px
      }

      .home-screen .menu-tagline {
        font-size: 17px
      }

      .home-screen .brand {
        font-size: 8px;
        letter-spacing: 1px;
        gap: 10px
      }

      .home-screen .version,
      .home-screen .menu-footer {
        font-size: 8px
      }

      .home-screen .version:after {
        display: none
      }
    }

    @media(max-height:800px) and (min-width:601px) {
      .home-layout {
        gap: 20px;
        padding-top: 20px;
        padding-bottom: 20px
      }

      .home-screen .menu-main {
        margin-top: 0
      }

      .home-screen .menu-header {
        min-height: 40px
      }

      .home-screen .menu-emblem {
        width: 40px;
        height: 40px
      }

      .home-screen .menu-subnav {
        margin-top: 16px
      }

      .home-screen .menu-footer {
        padding-top: 10px
      }
    }

    @media(max-width:600px) {
      .home-screen .version,
      .home-screen .menu-progress {
        display: none
      }

      .home-screen .wordmark {
        font-size: clamp(44px, 15vw, 70px);
        letter-spacing: -2px
      }

      .home-screen .wordmark-first b {
        font-size: 14px
      }

      .home-screen .menu-tagline {
        font-size: 16px
      }

      .home-screen .menu-buttons button {
        padding: 14px 20px;
        font-size: 12px
      }

      .home-screen .menu-subnav button {
        font-size: 8px;
        padding: 8px
      }

      .home-screen .menu-status {
        gap: 10px;
        font-size: 7px;
        letter-spacing: .4px
      }

      .home-screen .menu-frame {
        left: 1vw;
        opacity: .5
      }
    }

    .subscreen {
      height: 100%;
      padding: 28px max(24px, 5vw);
      overflow: auto;
      scrollbar-color: #4edcf078 #06131e;
      background: linear-gradient(110deg, #04101bf8, #071724e5 48%, #06131eb8),
        radial-gradient(circle at 72% 35%, #2ddcf016, transparent 42%)
    }

    .subscreen > div {
      padding: 20px 24px;
      border: 1px solid #4edcf098;
      border-radius: 12px 3px;
      background: linear-gradient(145deg, #102d3de8, #05131ff4 68%);
      box-shadow: inset 0 1px #d8fcff35, inset 0 0 20px #21c5ed0c,
        0 0 10px #00cfff29, 0 18px 55px #0008
    }

    .sub-header {
      display: flex;
      align-items: center;
      justify-content: space-between;
      max-width: 910px;
      margin: 0 auto 18px;
      padding-bottom: 12px;
      border-bottom: 1px solid #4edcf044
    }

    .sub-header h1 {
      font: 300 30px/1.15 "Segoe UI", Arial, sans-serif;
      letter-spacing: .5px;
      margin: 5px 0
    }

    .sub-header p {
      color: var(--muted);
      margin: 0
    }

    .sub-header .back {
      margin-right: 15px
    }

    .launch-row {
      display: flex;
      align-items: center;
      gap: 12px;
      margin-top: 18px;
      flex-wrap: wrap
    }

    .battle-launch {
      flex-direction: column;
      align-items: stretch
    }

    select {
      background: linear-gradient(145deg, #153344, #071725) !important;
      border: 1px solid #48cfe990 !important;
      border-radius: 4px 1px;
      color: #e4f4f8 !important;
      padding: 10px 12px !important;
      outline: none;
      box-shadow: inset 0 1px #d8fcff1f
    }

    select:focus {
      border-color: #b5f7ff !important;
      box-shadow: 0 0 8px #00cfff35
    }

    .battle-note {
      font: 11px var(--mono);
      color: var(--muted)
    }

    .modal-shade {
      height: 100%;
      background: radial-gradient(circle at 50% 45%, #14364970, #030912dc 62%);
      backdrop-filter: blur(5px);
      display: flex;
      align-items: center;
      justify-content: center;
      padding: 18px;
      overflow: auto
    }

    .modal-card {
      position: relative;
      width: 540px;
      max-width: 96vw;
      max-height: 94dvh;
      padding: 26px;
      overflow: auto;
      scrollbar-width: thin;
      scrollbar-color: #4edcf080 #06131e;
      border: 1px solid #4edcf0ae;
      border-radius: 12px 3px;
      background: linear-gradient(145deg, var(--panel-lit), var(--panel-deep) 68%);
      box-shadow: inset 0 1px #d8fcff40, inset 0 0 22px #21c5ed10,
        0 0 12px #00cfff35, 0 24px 80px #000b
    }

    .modal-card:before {
      content: "";
      position: absolute;
      inset: 7px 7px auto;
      height: 1px;
      pointer-events: none;
      background: linear-gradient(90deg, #b9f8ff8c, #4edcf018 62%, transparent)
    }

    .modal-card.wide {
      width: 860px
    }

    .modal-card h1 {
      font: 300 30px/1.15 "Segoe UI", Arial, sans-serif;
      letter-spacing: .4px;
      margin: 8px 0 18px
    }

    .modal-card h2 {
      font: 300 23px "Segoe UI", Arial, sans-serif
    }

    .modal-card h3 {
      font: 11px var(--mono);
      letter-spacing: 1.5px;
      color: var(--gold);
      text-transform: uppercase;
      margin-top: 20px
    }

    .modal-card p {
      color: #b7cbd5;
      line-height: 1.58
    }

    .modal-card .btnstack {
      display: flex;
      flex-direction: column;
      gap: 7px
    }

    .screen .primary,
    .screen .secondary {
      min-height: 42px;
      border-radius: 5px 2px;
      box-shadow: inset 0 1px #d8fcff32, inset 0 -7px 14px #03101c48
    }

    .screen .primary {
      color: #f2fbff !important;
      border-color: #56dff3c5;
      background: linear-gradient(145deg, #1b4d63, #082131 62%, #123b4d);
      box-shadow: inset 0 1px #e2fdff5c, inset 0 -8px 16px #03101c50,
        0 0 10px #00cfff2b
    }

    .screen .primary:hover {
      border-color: #c4fbff;
      background: linear-gradient(145deg, #25657e, #0c3044);
      box-shadow: inset 0 0 14px #4edcf02e, 0 0 14px #00cfff3d
    }

    .screen .secondary {
      border-color: #48cfe98c;
      background: linear-gradient(145deg, #153344c9, #061725e8)
    }

    .screen .secondary:hover {
      border-color: #b5f7ff;
      background: linear-gradient(145deg, #20485bd8, #0b2938e8)
    }

    .settings-row {
      display: flex;
      align-items: center;
      justify-content: space-between;
      padding: 11px 0;
      border-bottom: 1px solid #4edcf02c;
      gap: 20px
    }

    .settings-row label {
      font-size: 13px
    }

    .settings-row label small {
      display: block;
      color: var(--muted);
      font-size: 11px
    }

    .settings-row input[type=range] {
      width: 140px;
      accent-color: var(--cyan)
    }

    .settings-row input[type=checkbox] {
      accent-color: var(--cyan);
      width: 18px;
      height: 18px
    }

    .help-grid {
      display: grid;
      grid-template-columns: 1fr 1fr;
      gap: 8px 24px
    }

    .help-line {
      font-size: 12px;
      color: #b7c7d2;
      padding: 6px 0;
      border-bottom: 1px solid #4edcf026;
      display: flex;
      justify-content: space-between;
      gap: 15px
    }

    .help-input {
      font: 10px var(--mono);
      color: #a5b8c8;
      max-width: 55%;
      text-align: right
    }

    .faction-options {
      display: grid;
      grid-template-columns: repeat(3, 1fr);
      gap: 8px;
      margin: 14px 0
    }

    .faction-option {
      border: 1px solid #48cfe966;
      border-radius: 7px 2px;
      background: linear-gradient(145deg, #153344a8, #061725d6);
      box-shadow: inset 0 1px #d8fcff1f;
      padding: 16px 12px;
      text-align: center
    }

    .faction-option:hover:not(:disabled) {
      border-color: #b5f7ff;
      background: linear-gradient(145deg, #20485bc8, #0b2938e8)
    }

    .faction-option.active {
      border-color: var(--gold);
      background: linear-gradient(145deg, #55442788, #112331e8);
      box-shadow: inset 0 0 14px #edb87513, 0 0 8px #edb87525
    }

    .faction-option.locked {
      opacity: .48;
      cursor: not-allowed;
      filter: grayscale(1)
    }

    .faction-option .sigil {
      font-size: 36px;
      color: var(--teal);
      display: block
    }

    .faction-option strong {
      display: block;
      font-size: 12px;
      margin: 7px 0
    }

    .faction-option small {
      color: var(--muted);
      font-size: 11px;
      line-height: 1.6
    }

    .unlock-notice {
      border-left: 2px solid var(--gold);
      color: var(--gold);
      font: 11px var(--mono);
      letter-spacing: .04em;
      padding: 10px 12px;
      background: #947b3420
    }

    .armory-grid {
      display: grid;
      grid-template-columns: repeat(2, 1fr);
      gap: 12px
    }

    .upgrade-card {
      border: 1px solid #48cfe966;
      border-radius: 8px 2px;
      padding: 18px;
      background: linear-gradient(145deg, #153344a8, #061725dc);
      box-shadow: inset 0 1px #d8fcff20
    }

    .upgrade-card .sigil {
      font-size: 27px;
      color: var(--gold)
    }

    .upgrade-card h3 {
      color: var(--ink);
      font-size: 12px;
      letter-spacing: 0;
      margin-top: 11px
    }

    .upgrade-card p {
      font-size: 12px;
      min-height: 45px
    }

    .upgrade-levels {
      display: flex;
      gap: 5px;
      margin-bottom: 18px
    }

    .upgrade-levels i {
      height: 4px;
      flex: 1;
      background: #314957;
      box-shadow: inset 0 1px #bff9ff1c
    }

    .upgrade-levels i.on {
      background: linear-gradient(90deg, #4edcf0, #a9f5ff);
      box-shadow: 0 0 6px #00cfff66
    }

    .result-stats {
      display: grid;
      grid-template-columns: repeat(3, 1fr);
      gap: 6px;
      padding: 0;
      margin: 18px 0
    }

    .result-stats > div {
      min-width: 0;
      padding: 12px 10px;
      border: 1px solid #48cfe94d;
      border-radius: 5px 2px;
      background: linear-gradient(145deg, #1533448f, #061725b8)
    }

    .result-stats > div:last-child {
      grid-column: 1 / -1
    }

    .result-stats strong {
      font: 23px var(--mono);
      display: block;
      color: var(--ink)
    }

    .result-stats span {
      font: 9px var(--mono);
      letter-spacing: 1px;
      color: #91aebc;
      overflow-wrap: anywhere
    }

    .result-stars {
      color: var(--gold);
      letter-spacing: 10px;
      font-size: 28px;
      margin-top: 8px
    }

    .subscreen .glass {
      border-color: #48cfe958;
      border-radius: 7px 2px;
      background: linear-gradient(145deg, #102b3ac9, #061521e8);
      box-shadow: inset 0 1px #d8fcff20
    }

    .upgrade-card .secondary {
      width: 100%;
      padding-inline: 10px
    }

    .modal-card:has(.result-stats) .btnstack {
      display: grid;
      grid-template-columns: repeat(3, minmax(0, 1fr))
    }

    .home-screen,
    .subscreen,
    .modal-card {
      scrollbar-width: thin;
      scrollbar-color: #4edcf080 #06131e
    }

    .home-screen::-webkit-scrollbar,
    .subscreen::-webkit-scrollbar,
    .modal-card::-webkit-scrollbar {
      width: 8px
    }

    .home-screen::-webkit-scrollbar-track,
    .subscreen::-webkit-scrollbar-track,
    .modal-card::-webkit-scrollbar-track {
      background: #06131e
    }

    .home-screen::-webkit-scrollbar-thumb,
    .subscreen::-webkit-scrollbar-thumb,
    .modal-card::-webkit-scrollbar-thumb {
      background: #2d8598;
      border: 2px solid #06131e;
      border-radius: 6px
    }

    @media(max-width:600px) {
      .home-screen .menu-main {
        padding: 0
      }

      .home-screen .wordmark {
        font-size: clamp(40px, 12.5vw, 52px)
      }

      .home-screen .menu-tagline {
        margin-top: 10px
      }

      .subscreen > div {
        padding: 16px
      }

      .modal-card:has(.result-stats) .btnstack {
        grid-template-columns: 1fr
      }

      .result-stats {
        grid-template-columns: repeat(2, minmax(0, 1fr))
      }
    }

    @media(max-width:360px) {
      .subscreen .settings-row,
      .modal-card .settings-row {
        align-items: stretch;
        flex-direction: column;
        gap: 6px
      }

      .subscreen .settings-row select,
      .modal-card .settings-row select {
        width: 100% !important;
        max-width: none
      }
    }

    @media(max-height:500px) and (min-width:601px) {
      .home-layout {
        grid-template-rows: auto 1fr;
        gap: 12px;
        padding-top: 14px;
        padding-bottom: 14px
      }

      .home-screen .menu-main {
        width: 470px
      }

      .home-screen .wordmark {
        font-size: 52px
      }

      .home-screen .menu-tagline {
        font-size: 15px;
        margin-top: 7px
      }

      .home-screen .menu-buttons {
        gap: 7px
      }

      .home-screen .menu-buttons button,
      .home-screen .menu-buttons .primary {
        min-height: 42px;
        padding: 9px 18px
      }

      .home-screen .menu-subnav {
        margin-top: 7px
      }

      .home-screen .menu-footer {
        display: none
      }

      .modal-shade {
        align-items: flex-start;
        padding-block: 10px
      }

      .modal-card {
        max-height: calc(100dvh - 20px);
        padding: 20px
      }

      .modal-card h1 {
        font-size: 24px;
        margin-bottom: 12px
      }

      .settings-row {
        padding-block: 7px
      }
    }
