body[data-sector] {
  --scene-position: 47%;
  --scene-art: var(--portrait-art);
}

body[data-sector] #landscape { opacity: .16; }
body[data-sector="0"] #landscape { opacity: 0; }
body[data-sector]::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(ellipse at var(--scene-position) 37%, hsl(var(--sector-light) 81% 58% / .17), transparent 60%),
    linear-gradient(#04091045, #02060b45 46%, #03060da8),
    var(--scene-art) center var(--scene-position) / cover;
  z-index: 0;
}
@media (orientation: landscape) {
  body[data-sector="5"] { --scene-art: url("assets/benchmark/molten-metal-foundry.webp"); }
}
main { position: relative; }
.opening header .brand { visibility: hidden; }
.opening .arena {
  background: none;
  border: 0;
  box-shadow: none;
}
.opening #game { visibility: hidden; }
.opening .overlay {
  padding: 0;
  background: none;
  align-items: start;
}
.opening .panel {
  width: 100%;
  border: 0;
  border-radius: 0;
  box-shadow: none;
  background: linear-gradient(transparent 38%, #050a12e8 62%);
  justify-items: center;
  text-align: center;
  padding: 0 10px 12px;
}
.opening .intro-robot {
  order: -2;
  width: clamp(116px, 28dvh, 261px);
  height: auto;
  aspect-ratio: 1;
  filter: drop-shadow(0 13px 10px #000a) drop-shadow(0 0 20px #33c6ec38);
  animation: hangar-hover 4s ease-in-out infinite;
}
.opening .eyebrow { display: none; }
.opening #title {
  order: -3;
  width: 100%;
  margin: 8px auto 0;
  font: italic 950 clamp(27px, 7.8vw, 44px)/.98 system-ui, sans-serif;
  letter-spacing: -.065em;
  color: #ffbc4e;
  text-shadow: 0 2px #6e3208, 0 4px #100b06, 0 7px 18px #000;
}
.opening #play, .opening #board, .opening .hangar-tools button, .opening #settingsButton {
  border-radius: 3px;
  clip-path: polygon(9px 0,100% 0,100% calc(100% - 9px),calc(100% - 9px) 100%,0 100%,0 9px);
  border: 1px solid #81949c;
}
.opening #play, .opening #board { width: 100%; font-size: 12px; }
.opening #play { background: linear-gradient(#ffcf66,#d77b19); border-color: #fff29e; color: #150c06; }
.opening #board, .opening .hangar-tools button, .opening #settingsButton {
  background: linear-gradient(#405563,#202d39 48%,#121a24 49%,#243540);
  color: #f2f7fa;
}
.opening .hangar-tools { grid-template-columns: repeat(3,minmax(0,1fr)); }
.opening .panel p { color: #e3ebed; }
.abandoned-scrapyard .arena.running { border-color: #b38649; box-shadow: 0 0 0 2px #101821,0 0 24px #f89c3e40; }
body[data-sector] .stats {
  background: #101a24eb;
  border-block: 1px solid hsl(var(--sector-light) 41% 48%);
  padding: 5px 8px;
}
body[data-sector] .charge { background: #0b1620df; padding-inline: 7px; }
@keyframes hangar-hover { 50% { transform: translateY(-4px); } }
@media (max-height: 560px) {
  .opening .intro-robot { width: clamp(80px, 22dvh, 125px); }
}
@media (prefers-reduced-motion: reduce) {
  .opening .intro-robot { animation: none; }
}
.opening #title span {
  display: block;
  color: #dbe4ea;
  text-shadow: 0 2px #536575, 0 4px #111924, 0 7px 18px #000;
}
.opening .intro-robot {
  width: clamp(100px, 26dvh, 246px);
}
@media (max-height: 560px) {
  .opening .intro-robot { width: clamp(72px, 19dvh, 108px); }
}

/* Shared steel surfaces keep menu, gameplay and account screens in the same world. */
dialog, .overlay .panel {
  border: 1px solid #6c7d87;
  background-color: #0c1620;
  background-image: linear-gradient(145deg, #283d4b 0%, #101923 27%, #0b131d 78%, #1d2a34);
  box-shadow: inset 0 1px #d5e3ed55, inset 0 -2px #0009, 0 18px 50px #000b;
}
.opening .overlay .panel {
  background-image: linear-gradient(transparent 38%, #050a12e8 62%);
  background-color: transparent;
  border: 0;
  box-shadow: none;
}
.hangar-heading {
  border-bottom: 1px solid #8399a766;
  padding-bottom: 8px;
}
.hangar-heading h2, .level-up {
  text-shadow: 0 2px 2px #000;
}
body[data-sector] .arena.running {
  border-color: hsl(var(--sector-light) 43% 48%);
  box-shadow: 0 0 0 2px #101821, 0 0 24px hsl(var(--sector-light) 80% 49% / .22);
}
.level-up {
  border-radius: 4px;
  max-width: calc(100% - 20px);
  white-space: normal;
  background: linear-gradient(155deg, #364550, #111d28 55%);
}

#account .profile-hero {
  grid-template-columns: minmax(0, 1fr);
  gap: 4px;
  text-align: center;
  background:
    radial-gradient(ellipse at 50% 49%, #299abc48, transparent 46%),
    radial-gradient(ellipse at 50% 69%, #a3d5e64a 0 15%, #14232d 18% 22%, transparent 25%),
    repeating-linear-gradient(90deg, transparent 0 42px, #47728422 44px 45px),
    linear-gradient(165deg, #142733, #070d13);
}
#account .profile-hero canvas { height: clamp(104px, 21dvh, 168px); }
#account .profile-hero h3 { font-size: clamp(21px, 6vw, 31px); }
#account .profile-hero p { margin: 5px 0; }
#account .profile-section h3 { color: #ffd47c; }
#account .profile-stats dd { font-variant-numeric: tabular-nums; }
.preview-account-link a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  color: #ffce78;
}
[data-art-preview] :is(#guestNicknameForm, #accountForm, #accountModes) { display: none; }

.leaderboard li {
  margin-block: 4px;
  padding: 7px 8px;
  background: linear-gradient(105deg, #28404d, #111c26 62%);
  border-bottom-color: #587483;
}
.leaderboard li::marker { color: #bbd0dc; font-weight: 800; }
.leaderboard li:nth-child(-n+3)::marker { color: #ffca71; }

/* Machined control surfaces share the same amber and blue-grey steel as the yard. */
:root {
  --steel-edge: #758b96;
  --steel-face: linear-gradient(168deg, #3a4d59, #1a2833 44%, #111b25 46%, #263945);
}
.opening #title span {
  color: #e0edf4;
  text-shadow: 0 2px #71899a, 0 4px #24313b, 0 8px 18px #000;
}
.opening .intro-robot {
  background: radial-gradient(ellipse at 50% 78%, #7adaf04d, transparent 42%);
}
.hangar-heading h2, #settings h2 {
  margin: 0;
  font-size: clamp(20px, 6vw, 31px);
  letter-spacing: -.04em;
  color: #e5f3f9;
}
.hangar-heading {
  position: sticky;
  top: 0;
  z-index: 2;
  padding: 10px 10px 10px 14px;
  background: var(--steel-face);
  border-bottom: 2px solid #a9743a;
  box-shadow: 0 5px 12px #03080dee;
}
dialog .secondary, .btn-row .secondary, .overlay .secondary {
  border-radius: 4px;
  border: 1px solid var(--steel-edge);
  background: var(--steel-face);
  color: #ecf6fc;
  box-shadow: inset 0 1px #c9f0ff38, 0 3px #05090d;
}
#hangar .robot-preview {
  grid-template-columns: 1fr;
  gap: 4px;
  text-align: center;
  background:
    radial-gradient(ellipse at 50% 52%, #66bac779, transparent 37%),
    repeating-linear-gradient(90deg, transparent 0 36px, #729dac12 37px 39px),
    linear-gradient(155deg, #1f3442, #080f19 68%, #20303a);
  border-bottom: 2px solid #796147;
}
#hangar .robot-preview canvas {
  width: 100%;
  height: clamp(115px, 24dvh, 235px);
  object-fit: contain;
}
.robot-roster button {
  min-height: 44px;
  border-radius: 4px;
  background: var(--steel-face);
  border-color: #526a78;
}
.robot-roster button[aria-pressed="true"] {
  border-color: #ffce79;
  box-shadow: inset 0 -3px #d38b32;
}
#shopGrid .shop-item {
  border-radius: 3px;
  border-color: #5a7281;
  background: linear-gradient(165deg, #253c49, #0c1721 55%);
}
#shopGrid .shop-item canvas {
  background: radial-gradient(ellipse at 50% 68%, #569fa553, transparent 58%);
  border-bottom: 1px solid #69818b66;
}
.stats .value, #charge, .leaderboard li { font-variant-numeric: tabular-nums; }
.stats .label { color: #c0d4df; }
.level-up.show { box-shadow: 0 3px 14px #000c, inset 0 2px #e0b173; }
#continueOffer { border-color: #b58650; background: var(--steel-face); }
#settings input[type="range"] { accent-color: #ffc36d; }
#settings label { color: #d3e9f4; }
@media (max-width: 480px) {
  #hangar .robot-preview { padding: 5px 9px; }
}
#previewEnvironment select {
  width: 100%;
  min-height: 44px;
  margin-block: 5px 12px;
  border: 1px solid var(--steel-edge);
  border-radius: 4px;
  background: #172631;
  color: #e3f2f8;
  font: inherit;
}

body[data-sector]::after {
  content: "";
  position: fixed;
  inset: -10%;
  pointer-events: none;
  background:
    radial-gradient(2px 2px at 12% 73%, hsl(var(--sector-light) 87% 75% / .8) 40%, transparent 100%),
    radial-gradient(3px 2px at 19% 40%, hsl(var(--sector-light) 92% 79% / .73) 35%, transparent 100%),
    radial-gradient(3px 2px at 77% 58%, hsl(var(--sector-light) 85% 74% / .8) 40%, transparent 100%),
    radial-gradient(2px 2px at 87% 26%, hsl(var(--sector-light) 84% 74% / .7) 35%, transparent 100%);
  animation: drift-sparks var(--spark-speed, 6s) linear infinite;
}
main { z-index: 1; }
@keyframes drift-sparks {
  0% { transform: translateY(14px); opacity: 0; }
  22%, 72% { opacity: .64; }
  100% { transform: translateY(-42px); opacity: 0; }
}
@media (prefers-reduced-motion: reduce) {
  body[data-sector]::after { animation: none; }
}

.opening #title::after {
  content: "";
  display: block;
  width: min(38%, 128px);
  height: 4px;
  margin: 9px auto 0;
  background: repeating-linear-gradient(120deg, #c67f32 0 13px, #0c141b 13px 23px);
  border-block: 1px solid #ffcc6c77;
  transform: skewX(-24deg);
}
