@import url('https://fonts.googleapis.com/css2?family=Russo+One&family=Share+Tech+Mono&display=swap');

:root {
  --bg: #0a0b08;
  --panel: linear-gradient(180deg, #1e221b 0%, #141711 100%);
  --accent: #c9b27a;
  --accent-strong: #e0cfa1;
  --text: #e1dfd6;
  --muted: #9b9582;
  --danger: #b1554a;
  --edge: #2c3026;
  --shadow: 0 12px 24px rgba(0, 0, 0, 0.55), inset 0 0 0 1px rgba(255,255,255,0.04);
  --radius: 2px;
  --menu-rail-width: clamp(300px, 27vw, 560px);
  --menu-art-scale: 1.18;
  --menu-art-max: 2600px;
  --menu-art-max-h: 92vh;
  --uiScale: 1;
  --ui-scale: 1;
  --baseW: 1920;
  --baseH: 1080;
  --modal-scale: 0.6;
  --hud-side-scale: 0.5;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  width: 100%;
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: 'Russo One', 'Share Tech Mono', system-ui, sans-serif;
  overflow: hidden;
  letter-spacing: 0.04em;
}

#game-wrap {
  position: relative;
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: #000;
}

#game {
  position: absolute;
  display: block;
}

.hidden { display: none !important; }

#ui-root {
  position: absolute;
  top: 0;
  left: 0;
  width: calc(var(--baseW) * 1px);
  height: calc(var(--baseH) * 1px);
  transform: scale(var(--uiScale));
  transform-origin: top left;
  z-index: 10;
  pointer-events: none;
}

#ui-root > * {
  pointer-events: auto;
}

#menuOverlay {
  position: absolute;
  inset: 0;
  display: block;
  z-index: 20;
  overflow: hidden;
}

#menuVideo {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  filter: saturate(0.82) brightness(0.62) contrast(1.02);
}

.menu-center-art {
  position: absolute;
  top: 0;
  right: var(--menu-rail-width);
  bottom: 0;
  left: 0;
  display: grid;
  place-items: center;
  pointer-events: none;
  z-index: 0;
  overflow: visible;
}

.menu-center-art img {
  width: min(calc((100% - var(--menu-rail-width)) * var(--menu-art-scale)), var(--menu-art-max));
  max-height: var(--menu-art-max-h);
  object-fit: contain;
  filter: drop-shadow(0 18px 34px rgba(0,0,0,0.65));
  opacity: 0.96;
  transform: translateX(3%);
}


.grain-layer {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background-image:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120' viewBox='0 0 120 120'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.8' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='120' height='120' filter='url(%23n)' opacity='0.24'/%3E%3C/svg%3E");
  mix-blend-mode: overlay;
  opacity: 0.45;
}

.vignette-layer {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: radial-gradient(140% 140% at 50% 50%, rgba(0,0,0,0) 55%, rgba(0,0,0,0.65) 100%);
}


.menu-rail {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  width: var(--menu-rail-width);
  min-width: 420px;
  background:
    linear-gradient(180deg, rgba(18, 22, 29, 0.96) 0%, rgba(10, 13, 18, 0.94) 100%),
    radial-gradient(120% 60% at 50% -10%, rgba(104, 162, 255, 0.16) 0%, rgba(104, 162, 255, 0) 65%);
  border-left: 1px solid rgba(255,255,255,0.12);
  box-shadow: -22px 0 48px rgba(0,0,0,0.55), inset 1px 0 0 rgba(255,255,255,0.06);
  backdrop-filter: blur(8px);
}

.menu-rail::before {
  content: '';
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(135deg, rgba(255,255,255,0.06) 0 2px, transparent 2px 16px),
    linear-gradient(0deg, rgba(255,255,255,0.03), rgba(255,255,255,0.0) 30%);
  background-size: 18px 18px, 100% 100%;
  mix-blend-mode: soft-light;
  opacity: 0.65;
}

.menu-rail::after {
  content: '';
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  width: 2px;
  background: linear-gradient(180deg, rgba(140, 196, 255, 0.0), rgba(140, 196, 255, 0.35), rgba(140, 196, 255, 0.0));
}

.menu-rail-inner {
  position: relative;
  z-index: 1;
  height: 100%;
  display: flex;
  flex-direction: column;
  padding: clamp(30px, 5.2vh, 56px) clamp(22px, 2.4vw, 40px);
  gap: 24px;
}

.menu-brand {
  margin-bottom: 4px;
}

.menu-kicker {
  font-size: clamp(12px, 1vw, 14px);
  color: #9fb1ca;
  letter-spacing: 0.24em;
  text-transform: uppercase;
}

.game-title {
  text-align: left;
  margin: 8px 0 0;
  font-size: clamp(42px, 3.5vw, 60px);
  line-height: 0.98;
  letter-spacing: 0.08em;
  color: #eef4ff;
  text-shadow: 0 8px 18px rgba(0,0,0,0.55);
}

.menu-actions {
  display: grid;
  gap: 12px;
}

.btn {
  width: 100%;
  padding: 28px 32px;
  border: 2px solid var(--edge);
  background:
    linear-gradient(180deg, rgba(36, 38, 29, 0.9), rgba(22, 23, 18, 0.95)),
    repeating-linear-gradient(135deg, rgba(255,255,255,0.04) 0, rgba(255,255,255,0.04) 6px, transparent 6px, transparent 12px);
  color: var(--text);
  font-size: 32px;
  letter-spacing: 0.08em;
  cursor: pointer;
  text-transform: uppercase;
  transition: transform 120ms ease, box-shadow 120ms ease, border-color 120ms ease;
  border-radius: var(--radius);
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.05), 0 10px 22px rgba(0,0,0,0.45);
}

.btn:hover {
  border-color: #4a4e3f;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.06), 0 12px 26px rgba(0,0,0,0.55);
}

.btn:active {
  transform: translateY(2px);
  background:
    linear-gradient(180deg, rgba(18, 19, 14, 0.95), rgba(10, 10, 8, 0.95)),
    repeating-linear-gradient(135deg, rgba(0,0,0,0.18) 0, rgba(0,0,0,0.18) 6px, transparent 6px, transparent 12px);
  box-shadow: inset 0 0 0 1px rgba(0,0,0,0.55);
}

.btn.primary { background: linear-gradient(180deg, #2b3025, #1b1d16); border-color: #3c3f32; }
.btn.secondary { background: linear-gradient(180deg, #24271d, #161810); color: var(--muted); }
.btn.full { width: 100%; }
.btn.arrow { width: auto; min-width: 168px; padding: 24px 24px; font-size: 34px; }
.btn.toggle { width: 260px; font-size: 30px; padding: 24px 26px; }
.btn.chip { width: auto; padding: 22px 28px; font-size: 28px; }
.btn.chip.active { border-color: #4a4e3f; color: var(--text); box-shadow: inset 0 0 0 1px rgba(255,255,255,0.08); }

.btn.menu-btn {
  text-align: left;
  font-size: clamp(18px, 1.45vw, 24px);
  padding: 18px 20px;
  border: 2px solid #3c3f32;
  background: linear-gradient(180deg, #2b3025, #1b1d16);
  color: var(--text);
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.05), 0 10px 22px rgba(0,0,0,0.45);
}

#playBtn.btn.menu-btn {
  border-color: #566147;
  background: linear-gradient(180deg, #39412f, #23291b);
  color: #efe8d0;
}

.btn.menu-btn:hover {
  transform: translateX(-4px);
  border-color: #697554;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.06), 0 14px 24px rgba(0,0,0,0.52);
  color: #f3ecd8;
}

.difficulty-block {
  margin-top: 48px;
  text-align: center;
}

.difficulty-block .label {
  font-size: 18px;
  color: var(--muted);
  letter-spacing: 0.18em;
}

.difficulty-row {
  margin-top: 32px;
  display: inline-flex;
  align-items: center;
  gap: 32px;
  padding: 20px 28px;
  background: linear-gradient(180deg, #1b1f19, #11130f);
  border: 1px solid var(--edge);
  border-radius: var(--radius);
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.03), 0 10px 18px rgba(0,0,0,0.4);
}

#difficultyValue {
  min-width: 300px;
  display: inline-block;
  text-align: center;
  color: var(--text);
  letter-spacing: 0.2em;
  font-size: clamp(22px, 1.7vw, 34px);
}

#difficultyValue .diff-sub {
  display: block;
  font-size: 0.6em;
  letter-spacing: 0.28em;
  color: var(--muted);
  margin-bottom: 6px;
}

#difficultyValue .diff-main {
  display: block;
  font-size: 1em;
  letter-spacing: 0.2em;
}

#difficultyValue.diff-long .diff-main {
  font-size: 0.75em;
  letter-spacing: 0.12em;
  line-height: 1.05;
}

#difficultyValue.diff-long {
  font-size: clamp(22px, 1.7vw, 30px);
}

#settingsModal {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  background: rgba(4, 8, 12, 0.65);
  z-index: 30;
  backdrop-filter: blur(3px);
}

#menuInfoModal {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  background: rgba(4, 8, 12, 0.65);
  z-index: 31;
  backdrop-filter: blur(3px);
}

#difficultyModal {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  background: rgba(4, 8, 12, 0.75);
  z-index: 30;
  backdrop-filter: blur(3px);
}

#worldConfirmModal {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  background: rgba(4, 8, 12, 0.72);
  z-index: 65;
  backdrop-filter: blur(3px);
}

.world-confirm-panel {
  width: min(760px, 64vw);
  text-align: center;
  display: grid;
  justify-items: center;
}

.world-confirm-panel h2 {
  margin-bottom: 10px;
}

.world-confirm-panel .menu-info-modal-body {
  text-align: center;
  margin-bottom: 18px;
  font-size: clamp(20px, 1.3vw, 26px);
}

.world-confirm-actions {
  width: min(520px, 100%);
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

#difficultyModal .modal-panel {
  display: grid;
  justify-items: center;
  text-align: center;
}

#difficultyModal h2 {
  font-size: clamp(30px, 2.1vw, 44px);
  margin-bottom: 16px;
}

#difficultyModal .difficulty-row {
  width: min(700px, 78vw);
  justify-content: space-between;
  padding: 18px 24px;
  gap: 14px;
  box-sizing: border-box;
}

#difficultyModal #difficultyValue {
  flex: 1;
  font-size: clamp(20px, 1.5vw, 30px);
}

#difficultyModal .btn.arrow {
  margin: 0;
  font-size: clamp(18px, 1.3vw, 22px);
}

#difficultyModal .btn.full {
  width: min(700px, 78vw);
  box-sizing: border-box;
  font-size: clamp(18px, 1.4vw, 22px);
}

#loadingOverlay {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  background: rgba(6, 8, 6, 0.65);
  z-index: 40;
  backdrop-filter: blur(2px);
}

.loading-card {
  width: min(620px, 88vw);
  padding: 30px 32px 34px;
  background: linear-gradient(180deg, #171c16 0%, #0e120f 100%);
  border: 2px solid #2b2f24;
  box-shadow: 0 16px 32px rgba(0,0,0,0.6), inset 0 0 0 1px rgba(255,255,255,0.03);
  text-align: center;
}

.loading-title {
  font-size: clamp(20px, 3vw, 28px);
  letter-spacing: 0.22em;
  color: #e7e2d3;
}

.loading-bar {
  margin-top: 18px;
  height: 12px;
  background: #0a0b08;
  border: 1px solid #2b2f24;
  overflow: hidden;
}

.loading-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #bca76d, #f1e2b5);
  transition: width 0.2s ease;
}

.loading-pct {
  margin-top: 12px;
  font-size: 22px;
  letter-spacing: 0.2em;
  color: #d6cfbd;
}

.modal-panel {
  width: min(1080px, 88vw);
  background: linear-gradient(180deg, #101722 0%, #0b1018 100%);
  border: 2px solid var(--edge);
  box-shadow: var(--shadow), 0 0 0 2px rgba(0, 0, 0, 0.35);
  padding: clamp(32px, 2.7vw, 52px) clamp(34px, 2.9vw, 56px) clamp(36px, 3vw, 60px);
  position: relative;
  border-radius: var(--radius);
  max-height: min(900px, 90vh);
  overflow: auto;
  transform: scale(var(--modal-scale));
  transform-origin: center center;
}

.modal-panel::after {
  content: '';
  position: absolute;
  inset: 10px;
  border: 1px solid rgba(255,255,255,0.04);
  pointer-events: none;
}

.modal-panel h2 {
  margin: 0 0 20px;
  letter-spacing: 0.18em;
  color: var(--text);
  font-size: clamp(32px, 2.4vw, 50px);
}

.menu-info-modal-panel {
  width: min(1080px, 88vw);
}

.menu-info-lang {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: center;
  margin-bottom: 18px;
}

.menu-info-lang .lang-btn {
  min-width: 80px;
  text-align: center;
}

.menu-info-lang .lang-btn.active {
  border-color: #697554;
  color: #f3ecd8;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.08), 0 10px 20px rgba(0,0,0,0.45);
}

.menu-rank-strip {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: clamp(6px, 1.2vw, 14px);
  margin: 18px 0 26px;
  flex-wrap: nowrap;
}

#menuInfoModal .menu-rank-strip {
  display: none;
}

#menuInfoModal.show-ranks .menu-rank-strip {
  display: flex;
}

.menu-rank-strip img {
  width: clamp(90px, 11vw, 144px);
  height: auto;
  object-fit: contain;
  filter: drop-shadow(0 6px 12px rgba(0,0,0,0.55));
}

.menu-info-modal-kicker {
  margin-bottom: 10px;
  font-size: clamp(13px, 0.9vw, 16px);
  letter-spacing: 0.2em;
  color: var(--muted);
}

.menu-info-modal-body {
  font-family: 'Share Tech Mono', 'Russo One', system-ui, sans-serif;
  font-size: clamp(16px, 1.15vw, 22px);
  line-height: 1.5;
  letter-spacing: 0.03em;
  color: #ddd6c0;
  text-transform: none;
  margin-bottom: 24px;
}

.setting-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: #171a14;
  border: 1px solid var(--edge);
  padding: 18px 24px;
  margin-bottom: 12px;
  border-radius: var(--radius);
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.02);
  font-size: clamp(18px, 1.2vw, 26px);
}

.graphics-group {
  display: flex;
  gap: 14px;
}

.modal-panel .btn {
  font-size: clamp(22px, 1.5vw, 30px);
  padding: 18px 22px;
}

.modal-panel .btn.arrow {
  min-width: 144px;
  padding: 16px 18px;
}

.modal-panel .btn.toggle {
  width: 220px;
}

.modal-panel .btn.chip {
  padding: 14px 18px;
  font-size: clamp(18px, 1.1vw, 24px);
}

#hud {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 15;
}

/* Global 50% downscale for side HUD blocks (game scene untouched) */
#scoreBox,
#weaponSwitch {
  scale: var(--hud-side-scale);
  transform-origin: top left;
}

#killCounter,
#comboBox,
#rankBox,
#healthBox,
#repairBox {
  scale: var(--hud-side-scale);
  transform-origin: top right;
}

.hud-box {
  position: absolute;
  top: 58px;
  padding: clamp(16px, 2vw, 26px) clamp(18px, 2.2vw, 32px);
  min-width: clamp(240px, 26vw, 360px);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  font-size: clamp(18px, 2.4vw, 24px);
  background:
    linear-gradient(180deg, rgba(28,30,24,0.92) 0%, rgba(12,12,10,0.96) 100%),
    repeating-linear-gradient(135deg, rgba(255,255,255,0.05) 0, rgba(255,255,255,0.05) 6px, transparent 6px, transparent 12px);
  box-shadow: 0 18px 32px rgba(0,0,0,0.65), inset 0 0 0 2px rgba(255,255,255,0.05);
  border: 3px solid #26271f;
  clip-path: polygon(0 0, 90% 0, 100% 12%, 100% 100%, 10% 100%, 0 88%);
  color: #f0ede2;
}

.hud-label {
  display: block;
  font-size: clamp(16px, 1.8vw, 20px);
  color: #cfc8b1;
  letter-spacing: 0.22em;
  margin-bottom: 8px;
}

.hud-value {
  display: block;
  font-size: clamp(36px, 3.6vw, 58px);
  font-weight: 800;
  letter-spacing: 0.14em;
  color: #f0efe6;
}

#scoreBox { left: 24px; }

#rankBox {
  position: absolute;
  right: 48px;
  top: calc(18px + 2cm);
  width: clamp(320px, 38vw, 460px);
  height: clamp(320px, 38vw, 460px);
  display: grid;
  place-items: center;
  z-index: 25;
  overflow: visible;
  background: transparent;
}

/* World 2 (Berlin): rank aligned to top row, a bit more right */
#rankBox.rank-world2 {
  top: 58px;
  right: 24px;
}

#rankBox .rank-label {
  position: absolute;
  top: -20px;
  left: 50%;
  transform: translateX(-50%);
  font-size: clamp(33px, 3.6vw, 51px);
  letter-spacing: 0.22em;
  color: #f0ede2;
  text-shadow: 0 6px 12px rgba(0,0,0,0.6);
  background: linear-gradient(180deg, rgba(24,26,20,0.9), rgba(12,12,10,0.9));
  padding: 8px 16px;
  border: 2px solid #2b2f24;
  box-shadow: 0 10px 18px rgba(0,0,0,0.5), inset 0 0 0 1px rgba(255,255,255,0.04);
  clip-path: polygon(0 0, 90% 0, 100% 20%, 100% 100%, 10% 100%, 0 80%);
}

#rankBox img {
  width: 85%;
  height: 85%;
  object-fit: contain;
  filter: drop-shadow(0 10px 18px rgba(0,0,0,0.6));
}

.kills-box {
  right: 24px;
  left: auto;
  top: 58px;
  width: clamp(240px, 26vw, 360px);
  min-width: clamp(240px, 26vw, 360px);
  padding-top: clamp(16px, 2vw, 26px);
  padding-bottom: clamp(16px, 2vw, 26px);
  display: none;
}

.rank-flash {
  position: absolute;
  inset: -12%;
  background: radial-gradient(circle, rgba(240,240,240,0.95) 0%, rgba(240,240,240,0.0) 68%);
  opacity: 0;
  transform: scale(0.9);
  transition: opacity 140ms ease, transform 140ms ease;
  pointer-events: none;
  filter: blur(2px);
}

.rank-pulse {
  animation: rankPulse 0.9s ease;
}

.rank-pulse .rank-flash {
  opacity: 1;
  transform: scale(1.05);
  animation: rankFlash 0.35s ease;
}

.rank-max {
  filter: drop-shadow(0 0 26px rgba(235,235,235,0.8)) drop-shadow(0 0 60px rgba(235,235,235,0.55));
}

@keyframes rankPulse {
  0% { transform: scale(1.22); }
  28% { transform: scale(1.06); }
  65% { transform: scale(1.0); }
  100% { transform: scale(1.0); }
}

@keyframes rankFlash {
  0% { opacity: 1; }
  100% { opacity: 0; }
}

#comboBox {
  left: auto;
  right: 24px;
  top: calc(clamp(290px, 34vh, 410px) + 4cm);
  transform: none;
  min-width: clamp(260px, 30vw, 440px);
  padding: clamp(16px, 2vw, 28px) clamp(22px, 2.6vw, 36px);
  font-size: clamp(34px, 4vw, 54px);
  font-weight: 900;
  letter-spacing: 0.18em;
  color: #f7e2a0;
  background:
    linear-gradient(180deg, #2b1b0a, #0e0904),
    repeating-linear-gradient(135deg, rgba(255,255,255,0.06) 0, rgba(255,255,255,0.06) 8px, transparent 8px, transparent 16px);
  border: 3px solid #4a3a18;
  clip-path: polygon(0 0, 90% 0, 100% 18%, 100% 100%, 12% 100%, 0 85%);
  box-shadow: 0 22px 38px rgba(0,0,0,0.65), inset 0 0 0 2px rgba(255,255,255,0.05);
  opacity: 0;
  transform-origin: center;
}

/* World 1: combo placed ~1cm below kills panel */
#comboBox.combo-under-kills {
  top: 160px;
  right: 24px;
  left: auto;
  transform-origin: top right;
}

/* World 2 (Berlin): combo aligned under rank (~1cm gap), same right edge */
#comboBox.combo-under-rank {
  top: 300px;
  right: 24px;
  left: auto;
  transform-origin: top right;
}

.combo-hit {
  animation: comboPunch 0.45s cubic-bezier(0.1, 1.6, 0.3, 1);
}

@keyframes comboPunch {
  0% { transform: scale(0.9); text-shadow: 0 0 0 rgba(0,0,0,0.3); }
  18% { transform: scale(1.22) rotate(-1deg); text-shadow: 0 6px 18px rgba(0,0,0,0.45); }
  36% { transform: scale(1.1) rotate(1deg); }
  60% { transform: scale(1.04); }
  100% { transform: scale(1); }
}

#healthBox {
  position: absolute;
  right: 28px;
  bottom: 24px;
  display: flex;
  align-items: center;
  gap: 20px;
  color: #f2e9dc;
  font-family: 'Russo One', 'Share Tech Mono', system-ui, sans-serif;
  font-size: clamp(38px, 3.6vw, 50px);
  letter-spacing: 0.08em;
  text-shadow: 0 2px 6px rgba(0,0,0,0.55);
  z-index: 9000;
}

#repairBox {
  position: absolute;
  right: 28px;
  bottom: 110px;
  display: grid;
  grid-template-columns: 134px auto;
  grid-template-rows: auto auto;
  align-items: center;
  gap: 12px 20px;
  color: #c9c2ae;
  font-family: 'Russo One', 'Share Tech Mono', system-ui, sans-serif;
  z-index: 9000;
}

.repair-icon {
  width: 134px;
  height: 134px;
  display: grid;
  place-items: center;
  border: 2px solid #5b5647;
  background: linear-gradient(145deg, #2c2a22, #1a1813);
  box-shadow: inset 0 0 10px rgba(0,0,0,0.5), 0 6px 14px rgba(0,0,0,0.45);
  font-size: 68px;
  color: #9d9786;
  grid-row: 1 / span 2;
}

.repair-text {
  font-size: clamp(26px, 2.8vw, 36px);
  letter-spacing: 0.08em;
}

.repair-meter {
  width: 360px;
  height: 24px;
  border: 2px solid #5b5647;
  background: #1a1914;
  box-shadow: inset 0 0 8px rgba(0,0,0,0.6), 0 6px 12px rgba(0,0,0,0.4);
  position: relative;
  overflow: hidden;
}

.repair-fill {
  position: absolute;
  left: 0;
  bottom: 0;
  width: 0%;
  height: 100%;
  background: linear-gradient(180deg, #c8b060, #8f7a3d);
  transition: width 180ms linear;
  opacity: 0.35;
}

.repair-ready .repair-icon {
  color: #f0d27a;
  border-color: #e7c86a;
  background: radial-gradient(circle at 40% 35%, rgba(255,235,160,0.9), rgba(100,70,10,0.35) 55%, rgba(30,20,6,0.8) 100%);
  box-shadow:
    inset 0 0 18px rgba(255,235,160,0.75),
    0 0 24px rgba(255,220,120,0.7),
    0 0 50px rgba(255,200,80,0.6);
}

.repair-ready .repair-fill {
  opacity: 1;
}

.repair-ready {
  animation: repairPulse 1.1s ease-in-out infinite;
  filter: drop-shadow(0 0 18px rgba(255,210,90,0.7));
}

@keyframes repairPulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.03); }
}

#healthBox .health-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 134px;
  height: 134px;
  border: 2px solid #b10f1a;
  color: #ffe8e8;
  background: linear-gradient(145deg, #4b0f12, #2a0607);
  box-shadow: inset 0 0 6px rgba(255,70,70,0.45), 0 4px 10px rgba(0,0,0,0.4);
  font-size: 106px;
}

#healthValue {
  min-width: 144px;
  text-align: right;
}

#aimDot {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 5px;
  height: 5px;
  background: var(--accent);
  transform: translate(-50%, -50%);
  box-shadow: 0 0 16px rgba(56,224,255,0.65);
}

#weaponSwitch {
  position: absolute;
  left: 24px;
  bottom: 24px;
  top: auto;
  transform: none;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  align-items: center;
  gap: 10px;
  width: clamp(240px, 26vw, 360px);
  min-width: clamp(240px, 26vw, 360px);
  background:
    linear-gradient(180deg, rgba(28,30,24,0.92) 0%, rgba(12,12,10,0.96) 100%),
    repeating-linear-gradient(135deg, rgba(255,255,255,0.05) 0, rgba(255,255,255,0.05) 6px, transparent 6px, transparent 12px);
  padding: clamp(16px, 2vw, 26px) clamp(18px, 2.2vw, 32px);
  border: 3px solid #26271f;
  box-shadow: 0 18px 32px rgba(0,0,0,0.65), inset 0 0 0 2px rgba(255,255,255,0.05);
  clip-path: polygon(0 0, 90% 0, 100% 12%, 100% 100%, 10% 100%, 0 88%);
  color: #f0ede2;
}

#weaponSwitch .switch-key {
  width: 100%;
  aspect-ratio: 1 / 1;
  height: auto;
  display: grid;
  place-items: center;
  border: 2px solid #3c3b31;
  color: #f2f0e8;
  background: linear-gradient(180deg, #1a1c15, #0c0d08);
  box-shadow: inset 0 0 0 2px rgba(255,255,255,0.04), 0 10px 20px rgba(0,0,0,0.5);
  font-weight: 800;
  font-size: clamp(34px, 3.4vw, 48px);
  clip-path: polygon(0 0, 88% 0, 100% 16%, 100% 100%, 12% 100%, 0 84%);
}

#weaponSwitch img {
  width: 100%;
  aspect-ratio: 1 / 1;
  height: auto;
  object-fit: contain;
  padding: 4px;
  opacity: 0.38;
  filter: drop-shadow(0 4px 12px rgba(0,0,0,0.6));
  transition: opacity 140ms ease, filter 140ms ease, transform 140ms ease;
  border: 2px solid #2f2f26;
  background: rgba(12,12,10,0.8);
  clip-path: polygon(0 0, 88% 0, 100% 16%, 100% 100%, 12% 100%, 0 84%);
}

#weaponSwitch img.active {
  opacity: 1;
  filter: drop-shadow(0 0 12px rgba(255,210,120,0.6));
  transform: scale(1.06);
}

button:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.promotion-overlay {
  position: absolute;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 50;
  background: rgba(0,0,0,0.55);
  color: #f7f3e2;
  font-family: 'Russo One','Share Tech Mono',sans-serif;
  text-transform: uppercase;
  pointer-events: none;
}

/* Gameplay sepia / film look (not applied to menu) */
body.sepia-mode #game {
  filter: sepia(1) saturate(0.4) contrast(1.05) brightness(0.9);
  animation: cam-jitter 1.4s infinite steps(2);
}

body.sepia-mode #hud {
  filter: none;
}

body.sepia-mode::before,
body.sepia-mode::after {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 5;
}

/* Vinetácia na pozadí */
body.sepia-mode::before {
  background: radial-gradient(125% 125% at 50% 45%, rgba(0,0,0,0) 50%, rgba(0,0,0,0.55) 100%);
  mix-blend-mode: multiply;
}

/* Silné filmové zrno */
body.sepia-mode::after {
  background-image:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140' viewBox='0 0 140 140'%3E%3Cfilter id='g'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='1.8' numOctaves='5' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='140' height='140' filter='url(%23g)' opacity='0.9'/%3E%3C/svg%3E");
  background-size: 140px 140px;
  background-repeat: repeat;
  mix-blend-mode: multiply;
  opacity: 0.78;
  animation: grain-shift 0.28s steps(8) infinite;
}

#mapScreen {
  position: absolute;
  inset: 0;
  display: none;
  z-index: 60;
}
#mapScreen video {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.map-half {
  position: absolute;
  top: 0;
  width: 50%;
  height: 100%;
  cursor: pointer;
}
.map-left { left: 0; }
.map-right { right: 0; }
#pauseOverlay {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.65);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 70;
  padding: 24px;
}
#pauseOverlay .panel {
  background: linear-gradient(180deg,#1b1d16,#0d0f0a);
  border: 3px solid #303026;
  padding: 64px 72px;
  clip-path: polygon(0 0, 90% 0, 100% 12%, 100% 100%, 10% 100%, 0 88%);
  box-shadow: 0 16px 32px rgba(0,0,0,0.65), inset 0 0 0 2px rgba(255,255,255,0.05);
  color: #f0ede2;
  font-family: 'Russo One','Share Tech Mono',sans-serif;
  text-transform: uppercase;
  display: grid;
  gap: 24px;
  min-width: 560px;
}
#pauseOverlay button {
  padding: 22px 26px;
  background: linear-gradient(180deg,#24271d,#14150f);
  border: 2px solid #38382d;
  color: #f0ede2;
  letter-spacing: 0.16em;
  cursor: pointer;
  clip-path: polygon(0 0, 92% 0, 100% 14%, 100% 100%, 8% 100%, 0 86%);
  font-size: 18px;
}

@keyframes cam-jitter {
  0%   { transform: translate3d(0,0,0) scale(1); }
  15%  { transform: translate3d(2px,-2px,0) scale(1.001); }
  35%  { transform: translate3d(-2px,2px,0) scale(0.999); }
  55%  { transform: translate3d(3px,-1px,0) scale(1.002); }
  75%  { transform: translate3d(-3px,1px,0) scale(1.001); }
  100% { transform: translate3d(0,0,0) scale(1); }
}

@keyframes grain-shift {
  0%   { transform: translate3d(0,0,0); opacity: 0.70; background-position: 0 0; }
  12%  { transform: translate3d(2px,-3px,0); opacity: 0.82; background-position: -40px 22px; }
  25%  { transform: translate3d(-3px,3px,0); opacity: 0.74; background-position: 30px -18px; }
  37%  { transform: translate3d(4px,-1px,0); opacity: 0.86; background-position: -25px 35px; }
  50%  { transform: translate3d(-4px,2px,0); opacity: 0.76; background-position: 18px 12px; }
  62%  { transform: translate3d(2px,0,0); opacity: 0.80; background-position: -32px -28px; }
  75%  { transform: translate3d(-2px,2px,0); opacity: 0.78; background-position: 26px 26px; }
  87%  { transform: translate3d(3px,-2px,0); opacity: 0.84; background-position: -18px 8px; }
  100% { transform: translate3d(0,0,0); opacity: 0.78; background-position: 0 0; }
}

@media (max-width: 1400px) {
  :root {
    --menu-rail-width: clamp(360px, 34vw, 640px);
    --menu-art-scale: 1.1;
    --menu-art-max-h: 88vh;
  }
}

@media (max-width: 1100px) {
  :root {
    --menu-rail-width: clamp(320px, 38vw, 520px);
    --menu-art-scale: 1.0;
    --menu-art-max-h: 82vh;
  }
}

@media (max-width: 768px) {
  :root {
    --menu-rail-width: min(100%, 560px);
    --menu-art-scale: 0.92;
    --menu-art-max-h: 75vh;
    --modal-scale: 1;
    --hud-side-scale: 1;
  }
  .modal-panel {
    width: min(96vw, 680px);
    padding: 26px 20px 30px;
  }
  .modal-panel h2 {
    margin-bottom: 16px;
    font-size: clamp(28px, 7.4vw, 40px);
  }
  .menu-info-modal-kicker {
    font-size: clamp(12px, 3vw, 16px);
    margin-bottom: 8px;
  }
  .menu-info-modal-body {
    font-size: clamp(15px, 3.9vw, 20px);
    margin-bottom: 18px;
    line-height: 1.5;
  }
  .menu-info-lang {
    gap: 6px;
    margin-bottom: 12px;
  }
  .menu-info-lang .lang-btn {
    min-width: 62px;
  }
  .setting-row {
    padding: 14px 12px;
    margin-bottom: 10px;
    font-size: clamp(16px, 4.4vw, 22px);
  }
  .difficulty-row {
    margin-top: 16px;
    gap: 12px;
    padding: 14px 12px;
    width: 100%;
    justify-content: space-between;
  }
  #difficultyValue {
    min-width: 140px;
    font-size: clamp(18px, 5.2vw, 26px);
  }
  .modal-panel .btn {
    font-size: clamp(18px, 5vw, 24px);
    padding: 16px 14px;
  }
  .modal-panel .btn.arrow {
    min-width: 82px;
    padding: 12px 10px;
    font-size: clamp(20px, 5.6vw, 28px);
  }
  .modal-panel .btn.toggle {
    width: 120px;
  }
  .modal-panel .btn.chip {
    padding: 11px 14px;
    font-size: 16px;
  }
  .world-confirm-panel {
    width: min(94vw, 680px);
  }
  .world-confirm-actions {
    width: 100%;
    gap: 10px;
  }
  .graphics-group {
    gap: 6px;
    flex-wrap: wrap;
    justify-content: flex-end;
  }
  .menu-rail {
    width: min(100%, 560px);
    min-width: 0;
  }
  .menu-rail-inner {
    padding: 28px 20px;
    gap: 18px;
  }
  .game-title {
    font-size: clamp(38px, 9vw, 52px);
  }
  .btn.menu-btn {
    padding: 18px 16px;
    font-size: 18px;
  }
  #weaponSwitch {
    left: 12px;
    bottom: 12px;
    top: auto;
    gap: 8px;
    padding: 10px;
    width: clamp(180px, 40vw, 260px);
    min-width: 0;
  }
  .hud-box { font-size: 13px; padding: 10px 12px; }
  #comboBox { top: calc(170px + 4cm); }
  #rankBox {
    right: 24px;
    top: calc(10px + 2cm);
    width: 240px;
    height: 240px;
  }
  #rankBox .rank-label {
    font-size: 24px;
  }
  #healthBox {
    right: 16px;
    bottom: 16px;
    gap: 14px;
    font-size: clamp(28px, 5.5vw, 38px);
  }
  #repairBox {
    right: 16px;
    bottom: 152px;
    grid-template-columns: 100px auto;
    gap: 10px 14px;
  }
  .repair-icon {
    width: 100px;
    height: 100px;
    font-size: 52px;
  }
  .repair-meter {
    width: 260px;
    height: 20px;
  }
  #healthBox .health-icon {
    width: 115px;
    height: 115px;
    font-size: 86px;
  }
}
