@font-face {
  font-family: Vazirmatn;
  src: url('menu-fonts/Vazirmatn.woff2') format('woff2');
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
}

#game-menu {
  position: absolute;
  inset: 0;
  z-index: 2;
  display: flex;
  flex-direction: column;
  container-type: inline-size;
  overflow: hidden;
  color: #f2f4f1;
  background: #10171c;
  font-family: Vazirmatn, 'Noto Sans Arabic', Tahoma, sans-serif;
  line-height: 1.62;
  --accent: #8ce3c3;
  --muted: #b9c9d0;
  --line: #81969f65;
  --panel: #111d24f0;
}
#game-menu[hidden], #game-menu [hidden], #touch-controls[hidden] { display: none; }
#game-menu[data-overlay] { background: #0c1014bb; }
#game-menu * { box-sizing: border-box; }
.menu-screen { min-height: 0; flex: 1; overflow: auto; font-size: clamp(13px, 1.55cqw, 22px); }
.menu-screen :is(h1, h2, h3, p, blockquote) { margin: 0; }
.menu-screen h2 { font-size: clamp(25px, 4.15cqw, 64px); line-height: 1.24; }
.menu-screen h3 { font-size: clamp(15px, 2cqw, 30px); line-height: 1.35; }
.menu-kicker { color: var(--accent); font-weight: bold; }
.menu-screen button, #menu-hub button, #touch-controls button {
  font: inherit;
  font-weight: bold;
  color: #f2f5f2;
  cursor: pointer;
  min-height: 44px;
  border: 1px solid var(--line, #61768c);
  border-radius: 5px;
  padding: .4em .78em;
  background: linear-gradient(165deg, #283640, #162127 80%);
  line-height: 1.35;
  touch-action: manipulation;
}
.menu-screen button:not(:disabled):hover, #menu-hub button:hover { border-color: var(--accent); }
.menu-screen button:disabled { opacity: .67; cursor: default; }
#game-menu :is(button, input, select, summary):focus-visible { outline: 2px solid #b2ffe2; outline-offset: 2px; }
.menu-screen button.menu-primary {
  min-height: clamp(44px, 5.1cqw, 76px);
  background: linear-gradient(155deg, #b7f8df, #71d6b3 62%, #48b995);
  border: 1px solid #b6f0dc;
  border-bottom: 3px solid #246d5c;
  color: #09241d;
}
.menu-screen button.menu-primary:not(:disabled):hover { background: linear-gradient(165deg, #d1ffef, #53edb4 75%, #39d7a4); }
.menu-screen button.menu-primary:disabled { background: #34444a; border-color: #697780; color: #dcdfdf; }
.menu-status { color: #ffd49a; font-size: .88em; }
.menu-status:empty { display: none; }
.ui-row { display: flex; align-items: center; justify-content: space-between; gap: .6em; }
.ui-pill {
  border: 1px solid #6f938788; border-radius: 4px; padding: .12em .48em;
  color: #c3efde; background: #0e1d21; font-size: .79em; white-space: nowrap;
}

#menu-hub {
  position: relative; z-index: 1; display: flex; flex: none; align-items: center; justify-content: space-between;
  gap: .8em; padding: clamp(4px, .62cqw, 12px) 3.4cqw;
  color: #f1f7f3; border-bottom: 1px solid #87b2b052;
  background: linear-gradient(155deg, #1b2d36, #101b24 43%, #0d151d 83%);
  box-shadow: 0 5px 24px #0006; font-size: clamp(12px, 1.35cqw, 20px);
}
.hub-tabs, .hub-tools { display: flex; gap: .35em; align-items: center; }
#menu-hub button { min-height: clamp(44px, 4cqw, 60px); white-space: nowrap; }
#menu-hub .hub-brand {
  display: flex; align-items: center; gap: .55em; background: none; padding-inline: .15em .65em;
  border: 1px solid transparent; font-size: clamp(17px, 2.28cqw, 36px); font-weight: 900; color: #f9fdfb;
}
#menu-hub .hub-brand .signal-icon {
  padding: .33em; border: 1px solid #8ce3c35e; border-radius: 6px;
  background: linear-gradient(145deg, #29564c90, #10252d); font-size: .7em;
}
.signal-icon { display: inline-flex; align-items: end; justify-content: center; gap: .13em; color: var(--accent); }
.signal-icon i { display: block; width: .16em; height: .48em; background: currentColor; border-radius: 1px; }
.signal-icon i:nth-child(2) { height: .64em; }
.signal-icon i:nth-child(3) { height: .81em; }
.signal-icon i:nth-child(4) { height: .98em; }
#menu-hub .hub-tabs [aria-current='page'] {
  border-color: #78ddbb77; color: #b0f4d9; background: linear-gradient(160deg, #294a4a, #182b33);
  box-shadow: inset 0 -2px var(--accent);
}
#menu-hub .hub-tabs button[data-locked] { color: #9aa3a6; border-style: dashed; filter: saturate(.4); }
#menu-hub .hub-tabs button[data-locked]::before { content: '🔒'; margin-inline-end: .3em; font-size: .78em; filter: grayscale(1) brightness(1.4); }
#menu-hub .hub-tools button { display: grid; place-items: center; width: clamp(44px, 3.75cqw, 58px); padding: 0; font-size: 1.23em; }
#fullscreen-status { position: absolute; inset: 100% auto auto 3cqw; margin: 0; padding: .5em .7em; background: #142128; }

.menu-home { position: relative; isolation: isolate; background: #10171d; }
.menu-home::before {
  content: ''; position: absolute; inset: 0; z-index: -1;
  background: linear-gradient(180deg, #0d1923f7 0%, #14252fd9 44%, #0b121afc 100%),
    url('campaign-art/market-silence.webp') center 39% / cover;
}
.campaign-home {
  display: grid; grid-template-rows: auto minmax(170px, 1fr) auto;
  align-content: stretch; gap: clamp(10px, 1cqw, 17px); min-height: 100%; height: 100%;
  padding: clamp(8px, 1.2cqw, 21px) 3.4cqw clamp(10px, 1.45cqw, 24px);
}
.campaign-heading, .campaign-total { display: flex; align-items: end; justify-content: space-between; gap: 1em; }
.campaign-heading > div:first-child { padding-inline-start: .65em; border-inline-start: 2px solid var(--accent); }
.campaign-heading h1 { color: #f5fafb; font-size: clamp(22px, 3.3cqw, 54px); font-weight: 900; line-height: 1.2; }
.campaign-heading p, .campaign-total { color: var(--muted); font-size: max(11px, .77em); }
.campaign-heading p { color: #ddba82; }
.campaign-total {
  display: grid; justify-items: stretch; gap: .3em; min-width: min(24%, 185px); padding: .35em .68em .48em;
  border: 1px solid #88b3ae43; border-radius: 6px; background: #101c24b8;
}
.campaign-total span { color: #deeceb; }
.campaign-total progress { width: 100%; }
#game-menu progress { height: .3em; border: 0; border-radius: 3px; appearance: none; background: #a6bac537; }
#game-menu progress::-webkit-progress-bar { background: #a6bac537; border-radius: 3px; }
#game-menu progress::-webkit-progress-value { background: #7af3c7; border-radius: 3px; }
#game-menu progress::-moz-progress-bar { background: #7af3c7; border-radius: 3px; }
.campaign-carousel {
  display: grid; align-items: center; grid-template-columns: auto minmax(0, 1fr) auto;
  min-height: 0; gap: clamp(5px, .7cqw, 12px);
}
.menu-screen button.carousel-arrow {
  width: clamp(44px, 3.8cqw, 64px); padding: 0 0 .1em;
  min-height: clamp(44px, 4.7cqw, 75px); color: #d9f2ee; font: normal clamp(30px, 4cqw, 56px) / .85 Tahoma, sans-serif;
  border: 1px solid #7d9a9d83; background: linear-gradient(145deg, #233947, #121f29);
  box-shadow: inset 0 1px #c7dfdf16, 0 3px 8px #0006;
}
.campaign-cards {
  isolation: isolate; position: relative; align-self: stretch;
  display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.73fr) minmax(0, 1fr);
  align-items: center; grid-template-rows: minmax(0, 1fr);
  gap: clamp(6px, 1.03cqw, 17px); touch-action: pan-y;
}
.campaign-cards::before {
  content: ''; position: absolute; z-index: -1; inset: 3% 13%;
  background: var(--campaign-backdrop) center / cover; opacity: .26; filter: blur(25px) brightness(1.15);
}
.campaign-cards[data-locked='true']::before { filter: grayscale(1) blur(25px); }
.menu-screen button.campaign-card {
  --cut: polygon(0 0, calc(100% - var(--corner)) 0, 100% var(--corner), 100% 100%, var(--corner) 100%, 0 calc(100% - var(--corner)));
  --corner: clamp(8px, 1.65cqw, 26px);
  position: relative; isolation: isolate; grid-row: 1; width: 100%; height: 87%;
  padding: 0; min-width: 0; overflow: hidden; text-align: start; border: 0; border-radius: 0;
  touch-action: pan-y; background: #70808b; clip-path: var(--cut);
}
.menu-screen button.campaign-card[data-slot='main'] {
  z-index: 1; grid-column: 2; height: 100%;
  background: linear-gradient(150deg, #d1fff0 0%, #88e4c1 34%, #368d7c 74%, #c6a878 100%);
}
.campaign-card[data-slot='previous'] { grid-column: 1; }
.campaign-card[data-slot='next'] { grid-column: 3; }
.campaign-card-art {
  position: absolute; inset: 1px; z-index: -1; clip-path: var(--cut);
  background: linear-gradient(0deg, #080e15 0%, #0a141de6 13%, #0a141d54 36%, transparent 65%, #0b141c28 100%),
    var(--chapter-art) center 43% / cover;
}
.campaign-card[data-slot='main'] .campaign-card-art { inset: 2px; }
.campaign-card[data-locked='true'] .campaign-card-art { filter: grayscale(1) brightness(.68); }
.campaign-card[data-locked='true'] .campaign-card-copy small { color: #c6c9ca; }
.campaign-card[data-locked='true'] .chapter-badge { color: #e4e6e7; background: #1d1f21ed; border-color: #a1a5a775; }
.menu-screen button.campaign-card[data-slot='main'][data-locked='true'] { background: #a3a7ab; }
.campaign-card-lock { display: none; }
.campaign-card[data-locked='true'] .campaign-card-lock {
  display: block; position: absolute; inset: 0; margin: auto; pointer-events: none;
  width: 1.55em; height: 1.55em; border: 1px solid #aeb1b491; border-radius: 50%;
  background: #151719e8; color: #eef0f1; font-size: clamp(27px, 3.8cqw, 64px);
}
.campaign-card-lock::before, .campaign-card-lock::after { content: ''; position: absolute; left: 50%; transform: translateX(-50%); }
.campaign-card-lock::before {
  top: .33em; width: .48em; height: .46em; border: .08em solid currentColor;
  border-bottom: 0; border-radius: .32em .32em 0 0;
}
.campaign-card-lock::after {
  top: .65em; width: .72em; height: .51em; border-radius: .09em;
  background: radial-gradient(circle, #25282a 0 .075em, transparent .09em) currentColor;
}
.menu-screen .campaign-card:hover, #game-menu .campaign-card:focus-visible { background: #b7ffdf; }
.campaign-card:focus-visible .campaign-card-art { inset: 4px; }
.chapter-badge {
  display: inline-block; position: absolute; top: 6%; inset-inline-start: 8%;
  border: 1px solid #8cd3b47d; border-radius: 3px; padding: .11em .65em; color: #ceffec; background: #102328df;
  font-size: max(10px, .73em); line-height: 1.45;
}
.campaign-card-copy { position: absolute; inset: auto 6% 6%; display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: end; gap: .1em .4em; }
.campaign-card-copy small { grid-column: span 2; color: var(--chapter-tone); font-size: max(10px, .7em); }
.campaign-card-copy strong {
  color: #fff; font-size: clamp(13px, 1.95cqw, 36px); line-height: 1.32; text-shadow: 0 2px 5px #000;
  overflow: hidden; white-space: nowrap; text-overflow: ellipsis;
}
.campaign-card[data-slot='main'] .campaign-card-copy strong { font-size: clamp(21px, 3.42cqw, 61px); font-weight: 900; }
.chapter-count { color: #d8eceb; font-size: max(10px, .65em); white-space: nowrap; }
.campaign-card-copy progress { grid-column: span 2; width: 100%; margin-top: .34em; }
.campaign-card[data-locked='true'] .campaign-card-copy progress { visibility: hidden; }
.campaign-dock {
  display: grid; grid-template-columns: 1fr 1fr minmax(0, 1.58fr) 1fr 1fr;
  gap: clamp(5px, .74cqw, 12px); align-items: stretch; padding-top: clamp(6px, .7cqw, 12px);
  border-top: 1px solid #88b8ba46;
}
.menu-screen .campaign-dock .dock-link {
  display: flex; align-items: center; gap: .48em; min-width: 0;
  padding: .42em .62em; text-align: start; border-top-color: #7c9fa86e;
  background: linear-gradient(145deg, #243d48, #16252e 72%);
  box-shadow: inset 0 1px #cfe5ea11;
}
.dock-dossier .dock-icon { color: #edcc94; }
.dock-records .dock-icon { color: #a7cbe4; }
.dock-link b, .dock-link small { display: block; }
.dock-link b { font-size: max(11px, .87em); color: #f0f5f5; }
.dock-link small { color: #baccd0; font-size: max(10px, .64em); margin-top: .22em; }
.dock-icon {
  display: inline-grid; place-items: center; flex: none; width: 1.75em; aspect-ratio: 1;
  background: #c3eaed18; border: 1px solid #bfdfe054; border-radius: 4px;
  color: #bdffea; font-size: 1.24em;
}
.dock-icon.signal-icon { display: inline-flex; align-items: center; }
.dock-icon.signal-icon i { align-self: end; margin-bottom: .29em; }
.campaign-cta { display: grid; gap: .2em; min-width: 0; align-items: center; text-align: center; }
.campaign-cta small { display: block; color: #d1dfdf; font-size: max(10px, .7em); line-height: 1.35; }
.menu-screen #campaign-action {
  display: flex; align-items: center; justify-content: center; gap: .65em; width: 100%; padding-inline: .45em;
  clip-path: polygon(5% 0, 97% 0, 100% 19%, 100% 82%, 95% 100%, 3% 100%, 0 81%, 0 18%);
  font-size: clamp(15px, 1.8cqw, 31px); font-weight: 900;
}
#campaign-action:focus-visible { box-shadow: inset 0 0 0 3px #fff; }
.cta-arrow { font-size: 1.23em; line-height: .9; }

.menu-page {
  --briefing-gold: #f2bb7a;
  isolation: isolate; position: relative; padding: clamp(13px, 2.4cqw, 36px) 4cqw;
  background: radial-gradient(ellipse at 8% 0%, #28474a 0%, transparent 62%),
    linear-gradient(152deg, #122127, #090e13 82%);
  scrollbar-color: #42626a #101b21;
}
.menu-header {
  display: flex; justify-content: space-between; align-items: center; gap: 1em;
  margin-bottom: .85em; padding-block-end: .6em; border-block-end: 1px solid #8da7ab3b;
}
.menu-header h2 { line-height: 1.2; text-wrap: balance; }
.menu-header .menu-kicker { display: block; margin-block-end: .15em; color: var(--briefing-gold); font-size: .82em; }
.menu-header button { flex: none; }
.menu-header [data-action='back'] {
  display: inline-flex; align-items: center; justify-content: center; gap: .4em;
  background: linear-gradient(150deg, #25383d, #101a21); color: #e8f4f1; border-color: #7b9a9d7a;
}
.menu-header [data-action='back']::after { content: '\203A'; font-size: 1.4em; line-height: .9; direction: ltr; }
.chapter-art { background: var(--chapter-art) center 42% / cover no-repeat; }
#chapter-spotlight {
  position: absolute; inset: 0 auto 0 0; width: 70%; z-index: -1;
  mask-image: linear-gradient(90deg, #000 30%, #000a 67%, transparent);
  filter: brightness(.72) saturate(.82);
}
.menu-chapters:has(.mission-grid button:first-child[data-state='قفل']) #chapter-spotlight { filter: grayscale(1) brightness(.54); }
.operation-card {
  min-width: 0; padding: clamp(10px, 1.25cqw, 20px);
  background: linear-gradient(155deg, #23363bf0, #101a21f5 75%); border: 1px solid #6e8c9275;
  border-radius: 8px; box-shadow: 0 8px 22px #060b10a0, inset 0 1px #b9edf015;
}
.chapter-layout { display: grid; grid-template-columns: minmax(0, 1.7fr) minmax(0, 1fr); align-items: start; gap: clamp(8px, 1.5cqw, 22px); }
.chapter-intro { grid-column: 2; grid-row: 1; border-block-start: 2px solid var(--briefing-gold); }
.chapter-intro h3, .dossier-agent h3 { color: var(--briefing-gold); }
.chapter-intro p, .loadout-kit p, .dossier-layout p { margin-top: .55em; color: #d5e4e4; font-size: .95em; line-height: 1.65; }
.mission-board { grid-column: 1; grid-row: 1; border-block-start: 2px solid var(--accent); }
.mission-board-header { flex-wrap: wrap; margin-bottom: .62em; }
.mission-board-header strong { font-size: 1.03em; }
.mission-board-header .ui-pill { color: #caffeb; background: #123931; border-color: #6ec2a674; }
.mission-grid { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: clamp(4px, .55cqw, 9px); }
.menu-screen .mission-grid button {
  position: relative; display: grid; align-content: center; justify-items: center;
  gap: .08em; padding: .16em 0; min-height: clamp(44px, 4.05cqw, 62px); border-radius: 5px;
  background: linear-gradient(146deg, #2b4849, #17292e); border-color: #688e8d;
}
.mission-grid strong { color: inherit; font-size: 1.12em; line-height: 1.1; }
.mission-grid small { font-size: max(10px, .64em); color: #a9bfbe; }
.menu-screen .mission-grid [data-state='قفل'] { color: #b4c1c4; background: #10191f; border-color: #43565c; }
.menu-screen .mission-grid [data-state='کامل'] { color: #affce1; background: #153b34; border-color: #498f78; }
.menu-screen .mission-grid [data-state='کامل'] small { color: #b2edcf; }
.menu-screen .mission-grid [aria-pressed='true'] {
  background: linear-gradient(145deg, #544329, #2f2a23); color: #fff0db; border-color: var(--briefing-gold);
  box-shadow: inset 0 2px var(--briefing-gold), 0 0 12px #e8ac6328;
}
.menu-screen .mission-grid [aria-pressed='true'] small { color: #edd4ab; }
.ui-tabs button[aria-pressed='true'], #tool-equip[aria-pressed='true'] { background: #254439; color: #bdffe5; border-color: var(--accent); }
.mission-copy { display: grid; gap: .36em; margin-top: .72em; padding-block-start: .65em; border-block-start: 1px solid #83aaac45; }
.mission-copy .ui-row { flex-wrap: wrap; }
.mission-copy .ui-pill { color: var(--briefing-gold); background: #1f211e; border-color: #9d785050; }
.mission-copy p:empty { display: none; }
#mission-brief { color: #d9e6e5; font-size: .91em; }
#mission-goal { color: #a7f4d8; font-weight: bold; font-size: .86em; }
.mission-actions, .ui-tabs { display: flex; align-items: center; gap: .32em; }
.mission-actions { justify-content: space-between; gap: .6em; margin-top: .18em; }
.mission-actions .menu-primary { min-height: 44px; flex: 1; max-width: 58%; }
.ui-tabs button { font-size: .85em; padding-inline: .6em; }

.menu-loadout { background: linear-gradient(110deg, #0b181ddd, #142228f4), url('campaign-art/silent-bus.webp') center 54% / cover; }
.loadout-layout { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); gap: .65em; max-width: 1140px; margin-inline: auto; }
.loadout-feature, .loadout-kit {
  display: grid; align-items: center; gap: .65em; border-inline-start: 3px solid var(--briefing-gold);
  background: radial-gradient(ellipse at 30% 45%, #46514bcf, #171f21e8 75%), url('assets/hud/surface.webp') center / cover;
}
.loadout-feature { grid-template-columns: minmax(0, 1fr) minmax(0, 1.5fr); }
.loadout-kit { grid-template-columns: clamp(23px, 5.4cqw, 70px) minmax(0, 1fr); border-inline-start-color: var(--accent); }
.loadout-kit img { width: 100%; }
.loadout-kit h3 { color: var(--briefing-gold); }
.loadout-kit button { margin-top: .65em; }
.weapon-copy p { margin-block-start: .45em; line-height: 1.45; color: #dedbd0; font-size: .88em; }
#weapon-options { display: grid; grid-column: 1 / -1; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: .6em; }
.menu-screen #weapon-options button {
  min-width: 0; padding: 0; overflow: hidden; border-radius: 6px;
  background: linear-gradient(155deg, #333e3ce8, #161e21f0 76%); border-color: #8d9d937e;
}
.menu-screen #weapon-options button[data-locked] img { opacity: .65; }
#weapon-options button[data-locked] .weapon-art::after {
  content: ''; position: absolute; inset-block-start: 5px; inset-inline-start: 5px;
  width: 16px; height: 16px; border-radius: 3px;
  background: #172025 url('assets/hud/lock.webp') center / 86% no-repeat;
}
.menu-screen #weapon-options button[aria-pressed='true'] {
  border-color: var(--briefing-gold); color: #fce6be; background: linear-gradient(155deg, #48413a, #202321 78%);
  box-shadow: inset 0 2px var(--briefing-gold);
}
.weapon-name { display: block; padding: .4em .2em; border-block-start: 1px solid #bcc5b133; font-size: .9em; }
.weapon-art { position: relative; display: block; height: clamp(48px, 8.5cqw, 110px); padding: 4px 7%; }
.weapon-art img, #weapon-feature-art { display: block; width: 100%; height: 100%; object-fit: contain; }
#weapon-feature-art { height: clamp(64px, 11cqw, 170px); }
.menu-dossier { background: linear-gradient(270deg, #0c181df5 15%, #14252cbd 61%, #1018204c), url('campaign-art/market-silence.webp') left 37% / cover; }
.dossier-layout { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(0, 1fr); gap: .8em; max-width: 960px; }
.dossier-summary { border-block-start: 2px solid var(--accent); }
.dossier-agent { border-block-start: 2px solid var(--briefing-gold); }
.dossier-agent blockquote { margin-top: .65em; border-inline-start: 2px solid var(--briefing-gold); padding-inline-start: .65em; color: #efdbbe; }
.archive-list, .record-list { display: grid; gap: .6em; max-width: 1100px; }
.archive-list summary { cursor: pointer; color: #e5f3ef; }
.archive-list details[open] { border-inline-start: 2px solid var(--accent); }
.archive-list small, .record-list small { color: var(--muted); }
.archive-list summary small { margin-inline-start: .55em; color: #abdbcf; }
.archive-list p { color: #d5e0e1; margin-top: .55em; padding-top: .45em; border-top: 1px solid #78999c4d; }
.archive-list p strong { display: block; color: #a4eed5; font-size: .83em; }
.archive-locked, .record-row { display: flex; align-items: center; flex-wrap: wrap; gap: .65em 1em; }
.archive-locked { background: #142126b5; color: #b7c6c7; }
.record-row { border-inline-start: 2px solid #67978c; }
.record-row strong { flex: 1; min-width: min(100%, 14em); }
.record-row > span { color: #baecdf; }

.menu-options { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .55em; margin-bottom: .8em; }
.menu-options label, .controls-options article {
  min-width: 0; background: linear-gradient(145deg, #25393e, #142127);
  border: 1px solid #68858b7a; padding: .56em .72em; border-radius: 6px;
}
.settings-options label { display: flex; align-items: center; justify-content: space-between; gap: .5em; cursor: pointer; }
.settings-options label:focus-within { border-color: var(--accent); }
.settings-options input { accent-color: var(--accent); margin: 0; min-height: 32px; }
.settings-options select { font: inherit; color: #f1f6f3; background: #101b22; border: 1px solid #7c9da4; border-radius: 5px; min-height: 34px; max-width: 53%; padding-inline: .5em; }
.settings-options input[type='range'] { width: 42%; direction: ltr; }
.settings-options input[type='checkbox'] { min-width: 20px; }
.control-map { margin: .3em 0 0; display: grid; grid-template-columns: auto 1fr; gap: .35em .7em; }
.control-map dt { color: #aee9d1; }
.control-map dd { margin: 0; }
.controls-options h3 { color: var(--briefing-gold); }
.control-map dd bdi { padding: .05em .24em; background: #10232a; border: 1px solid #81a7ad55; border-radius: 3px; white-space: nowrap; }
.game-credits { color: var(--muted); }
.game-credits summary { cursor: pointer; }
.game-credits p { margin-top: .65em; }
.game-credits a { color: #a4f1d9; }

.menu-modal { display: grid; place-items: center; }
.menu-modal[data-screen='over'] { --modal-border: #db9579; }
.menu-modal[data-screen='results'] { --modal-border: #f2bb7a; }
.menu-panel {
  width: min(87cqw, 620px); max-height: calc(100% - 14px); overflow: auto; padding: clamp(12px, 2.15cqw, 34px);
  background: linear-gradient(145deg, #3a4847c2, #151f24eb 72%), url('assets/hud/surface.webp') center / cover;
  border: 1px solid #7cabaa84; border-block-start: 3px solid var(--modal-border, var(--accent)); border-radius: 9px;
  box-shadow: 0 18px 50px #020609cf, inset 0 1px #a6d8d027;
}
.menu-panel .menu-kicker { color: var(--modal-border, var(--accent)); }
.menu-panel h2 { font-size: clamp(23px, 3.6cqw, 51px); margin-bottom: .38em; }
.menu-panel p { margin-bottom: .4em; }
#result-message { margin-bottom: .75em; padding-inline-start: .65em; color: #d4e9df; border-inline-start: 2px solid #7dae9c; }
#result-message:empty { display: none; }
.menu-actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .45em; }
.menu-actions > .menu-primary { grid-column: 1 / -1; }
.menu-actions > button:last-child:nth-child(even) { grid-column: 1 / -1; }

@container (max-width: 760px) {
  .menu-page .menu-header { padding-block-end: .36em; }
  .menu-page .menu-header h2 { font-size: clamp(19px, 3.1cqw, 28px); }
  .menu-page .menu-header .menu-kicker { margin: 0; }
  .chapter-layout, .dossier-layout { gap: 8px; }
  .operation-card { padding: 9px; }
  .mission-copy { padding-block-start: .46em; margin-top: .55em; }
  .menu-panel h2 { font-size: clamp(20px, 3.3cqw, 28px); }
}

@container (min-width: 548px) and (max-width: 640px) {
  .chapter-layout { grid-template-columns: minmax(0, 1fr); }
  .chapter-intro { grid-column: 1; grid-row: 2; }
  .mission-grid { grid-template-columns: repeat(10, minmax(0, 1fr)); }
}

@media (prefers-reduced-motion: no-preference) {
  .menu-screen button, #menu-hub button, #ld-go {
    transition: border-color 150ms ease, color 150ms ease, translate 120ms ease-out;
  }
  .menu-screen button:not(:disabled):not(.campaign-card):active,
  #menu-hub button:not(:disabled):active, #ld-go:active { translate: 0 2px; }
  .campaign-card:active .campaign-card-art { opacity: .88; }
  .campaign-card-art { transition: opacity 120ms ease-out; }
  .campaign-card[data-slot='main'][data-locked='false'] .campaign-card-art::after {
    content: ''; position: absolute; inset: 0 auto 0 0; width: 46%; pointer-events: none;
    background: linear-gradient(108deg, transparent 15%, #b4ffe86b 50%, transparent 85%);
    animation: campaign-card-sweep 440ms ease-out both;
  }
  #loading-screen:not([hidden]) .ld-panel { animation: mission-loading-enter 240ms ease-out both; }
  #loading-screen:not([hidden]) #ld-go:not([hidden]) { animation: mission-loading-enter 180ms ease-out both; }
}
@keyframes campaign-card-sweep {
  from { transform: translateX(225%); opacity: 0; }
  35% { opacity: .72; }
  to { transform: translateX(-110%); opacity: 0; }
}
@keyframes mission-loading-enter {
  from { transform: translateY(8px); opacity: .45; }
  to { transform: translateY(0); opacity: 1; }
}

#touch-controls {
  --touch-size: clamp(44px, min(7.6vw, 14.2vh), 72px);
  --fire-size: max(68px, calc(var(--touch-size) * 1.38));
  --touch-edge: clamp(9px, 2.6vh, 18px);
  --touch-border: #aebdb2a8;
  --touch-highlight: #ebc18b;
  --touch-top: #324142eb;
  --touch-bottom: #111a20f7;
  position: absolute; z-index: 1; inset: 0; pointer-events: none;
  font: 700 13px Vazirmatn, Tahoma, sans-serif;
}
#touch-controls button {
  position: relative; display: grid; place-items: center; min-width: 44px; min-height: 44px;
  width: var(--touch-size); height: var(--touch-size); padding: 0; touch-action: none;
  pointer-events: auto; user-select: none; -webkit-tap-highlight-color: transparent;
  background: linear-gradient(155deg, var(--touch-top), var(--touch-bottom) 78%);
  border: 1px solid var(--touch-border); border-radius: 9px;
  box-shadow: inset 0 2px #f4f4dc22, 0 2px 4px #060d129c;
}
#touch-controls button img { position: absolute; inset: 0; margin: auto; width: 69%; height: 69%; object-fit: contain; pointer-events: none; }
#touch-controls .touch-right [data-touch='fire'] {
  grid-area: 2 / 2;
  width: var(--fire-size); height: var(--fire-size); border-radius: 27%;
  background: radial-gradient(ellipse at 47% 31%, #aa682544, transparent 70%), linear-gradient(154deg, #563f2aee, #201a19fa 85%);
  border: 1.5px solid var(--touch-highlight);
  box-shadow: inset 0 0 0 3px #f7c57538, inset 0 2px #ffd38e44, 0 3px 6px #130f0cbf;
}
#touch-controls button[data-touch='fire'] img { width: 86%; height: 86%; }
#touch-controls button:is([data-touch='KeyZ'], [data-touch='KeyX'], [data-touch='KeyG'], [data-touch='KeyH']) img { width: 82%; height: 82%; }
#touch-controls button:is([data-held], [data-alert]) { border-color: #ffe1a1; box-shadow: inset 0 0 0 1px #ffd585aa, inset 0 0 16px #edbe7544; }
#touch-controls .touch-right [data-touch='fire'][data-held] {
  border-color: #ffe8b8; background-color: #b47941;
  box-shadow: inset 0 0 0 3px #ffd9949c, inset 0 0 22px #ffb75349, 0 1px 5px #130f0cbf;
}
#touch-controls button[data-empty] img { opacity: .5; }
#touch-controls button[data-locked] { border-color: #a5afa878; }
#touch-controls button[data-locked] img { opacity: .38; }
#touch-controls button[data-locked]:is([data-touch='KeyZ'], [data-touch='KeyX']) img { opacity: .57; }
#touch-controls button[data-locked][data-touch='KeyQ'] img { opacity: .82; }
#touch-controls button[data-locked][data-touch='KeyQ']::after { opacity: .54; }
#touch-controls button[data-locked]::before {
  content: ''; position: absolute; z-index: 1; top: 3px; right: 3px; width: 15px; height: 15px;
  border-radius: 3px; background: #192124 url('assets/hud/lock.webp') center / 90% no-repeat;
}
#touch-controls [data-touch='ArrowRight'] img { transform: scaleX(-1); }
#touch-controls [data-touch='KeyQ'] { width: 100%; grid-column: 1 / -1; height: max(44px, calc(var(--touch-size) * .76)); }
#touch-controls [data-touch='KeyQ'] img { width: calc(100% - 36px); height: 94%; right: 22px; }
#touch-controls [data-touch='KeyQ']::after {
  content: ''; position: absolute; inset: 0 5px 0 auto; margin: auto 0; width: 20px; height: 20px;
  background: url('assets/hud/switch.webp') center / contain no-repeat;
}
#touch-controls .touch-pause {
  position: absolute; top: var(--touch-edge); left: var(--touch-edge);
  width: max(44px, calc(var(--touch-size) * .76)); height: max(44px, calc(var(--touch-size) * .76));
}
.touch-quantity {
  position: absolute; inset: -4px -4px auto auto; min-width: 18px; padding: 1px 3px;
  color: #fff0ca; background: #1e282a; border: 1px solid #a9b5a6; border-radius: 5px; pointer-events: none;
}
.touch-quantity:empty { display: none; }
.touch-group { position: absolute; bottom: var(--touch-edge); display: grid; grid-template-columns: repeat(2, var(--touch-size)); align-items: end; gap: clamp(5px, 1vw, 9px); }
.touch-left { left: var(--touch-edge); }
.touch-right { right: var(--touch-edge); grid-template-columns: var(--touch-size) var(--fire-size); }
.touch-right [data-touch='KeyR'] { justify-self: end; }
#touch-controls[data-left-handed] .touch-left { right: var(--touch-edge); left: auto; }
#touch-controls[data-left-handed] .touch-right { left: var(--touch-edge); right: auto; direction: rtl; }
#game { touch-action: none; }

#touch-controls [hidden] { display: none; }
#touch-controls .touch-medkit { position: absolute; bottom: calc(100% + 7px); inset-inline-end: 0; width: max(44px, calc(var(--touch-size) * .74)); height: max(44px, calc(var(--touch-size) * .74)); }
#touch-controls[data-layout='1'] { --touch-border: #dbb375b5; }
#touch-controls[data-layout='2'] { --touch-border: #a6c8a4b5; --touch-top: #344537eb; }
#touch-controls[data-layout='2'] .touch-left { bottom: calc(var(--touch-edge) + 12px); }
#touch-controls[data-layout='3'] { --touch-border: #91d1c5b5; --touch-top: #2d4445eb; }
#touch-controls[data-layout='3'] button { border-radius: 15px; }
#touch-controls[data-layout='4'] { --touch-border: #b7a6dfb5; --touch-top: #403849eb; }

@container (max-width: 770px) {
  .campaign-card-copy { column-gap: .28em; }
  .dock-icon { width: 1.4em; font-size: 1.08em; }
  .dock-link small { line-height: 1.23; }
  .campaign-heading h1 { font-size: clamp(20px, 3.3cqw, 29px); }
  #menu-hub .hub-tabs button { padding-inline: .56em; }
}
@media (orientation: landscape) and (max-height: 420px) {
  .campaign-home { grid-template-rows: auto minmax(120px, 1fr) auto; }
  .campaign-heading p, .campaign-total { line-height: 1.26; }
  .menu-page { padding-block: 11px; }
  .menu-header { margin-bottom: .45em; }
  .menu-panel { padding: 12px; }
}
@media (orientation: landscape) and (max-height: 350px) {
  .campaign-home { grid-template-rows: auto minmax(93px, 1fr) auto; padding-block: 6px; gap: 4px; }
  .campaign-heading h1 { font-size: max(18px, 3cqw); }
  .campaign-heading p { font-size: 10px; }
  .campaign-dock .dock-link { padding-inline: .32em; }
  .dock-link small { font-size: 10px; }
}

/* achievements: a summary, then a card for each with its badge in the tier reached, the next goal and four tier pips */
.ach-summary { display: flex; flex-wrap: wrap; align-items: center; gap: .4em 1.4em; max-width: 1100px; margin-bottom: .6em; border-inline-start: 3px solid #f2c24e; }
.ach-summary strong { font-size: 1.25em; color: #f2c24e; }
.ach-summary span { color: var(--muted); }
.ach-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 330px), 1fr)); gap: .6em; max-width: 1100px; }
.ach-card { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: .3em .8em; border-inline-start: 3px solid var(--tier); }
.ach-badge { width: 2.3em; height: 2.3em; border-radius: 50%; background: radial-gradient(circle at 35% 30%, #ffffff88, transparent 44%), var(--tier); box-shadow: inset 0 -3px 6px #0007; }
.ach-card[data-tier='0'] .ach-badge { opacity: .45; }
.ach-copy { display: grid; gap: .15em; min-width: 0; }
.ach-copy small { color: var(--muted); }
.ach-bar { display: block; height: 6px; background: #ffffff1a; border-radius: 4px; overflow: hidden; }
.ach-bar b { display: block; height: 100%; background: linear-gradient(270deg, #218b6b, #a6ffd8); border-radius: 4px; }
.ach-side { display: grid; justify-items: end; gap: .25em; }
.ach-pips { display: flex; gap: 3px; }
.ach-pips i { width: .62em; height: .62em; border-radius: 50%; }
.ach-side em { font-style: normal; font-size: .9em; color: var(--muted); white-space: nowrap; }

/* Stars: a mission's best on its button, this run's on the results */
.mission-grid .mission-stars { display: block; font-size: max(9px, .6em); letter-spacing: .08em; color: #ffd36a; line-height: 1; min-height: 1em; text-shadow: 0 0 6px #0008; }
.mission-grid button[data-stars='0'] .mission-stars { visibility: hidden; }
.result-stars { margin: .2em 0 0; font-size: clamp(26px, 3.4cqw, 44px); letter-spacing: .14em; color: #ffd36a; text-shadow: 0 0 14px #ffb30066, 0 2px 0 #0009; line-height: 1.1; }
.result-stars:empty, .result-star-note:empty { display: none; }
.result-star-note { margin: .1em 0 .4em; font-size: .86em; color: #e7d9b4; }
