/* =========================================================
   ŻELBETONOWY GIEREK - STYLE & PRL RETRO ARCADE AESTHETICS
   ========================================================= */

:root {
  --bg-dark: #121316;
  --prl-red: #c01823;
  --prl-red-bright: #ff2b38;
  --prl-gold: #f4c430;
  --prl-gold-light: #ffea79;
  --concrete-grey: #7f8c8d;
  --concrete-dark: #34495e;
  --concrete-light: #bdc3c7;
  --pewex-blue: #1b4f72;
  --crt-scanline-color: rgba(18, 16, 16, 0.35);
  --font-retro: 'Press Start 2P', monospace, sans-serif;
  --font-display: 'VT323', monospace, sans-serif;
}

* {
  box-sizing: border-box;
  user-select: none;
  -webkit-user-select: none;
  margin: 0;
  padding: 0;
}

body {
  background-color: #08080a;
  background-image: radial-gradient(#1e1e24 15%, transparent 16%),
                    radial-gradient(#17171d 15%, transparent 16%);
  background-size: 40px 40px;
  background-position: 0 0, 20px 20px;
  color: #fff;
  font-family: var(--font-retro);
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
  overflow: hidden;
}

/* Cabinet Container */
.arcade-cabinet {
  position: relative;
  width: 100%;
  max-width: 920px;
  padding: 10px;
  background: linear-gradient(145deg, #2c1a1d, #191214);
  border: 4px solid #5a383d;
  border-radius: 12px;
  box-shadow: 0 0 35px rgba(192, 24, 35, 0.3), 
              0 20px 50px rgba(0, 0, 0, 0.9),
              inset 0 0 15px rgba(0, 0, 0, 0.8);
}

/* Screen Shell */
.crt-screen {
  position: relative;
  width: 100%;
  aspect-ratio: 900 / 650;
  background-color: #0b0c10;
  border: 4px solid #111;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: inset 0 0 40px rgba(0, 0, 0, 0.95);
}

/* CRT Scanlines and Vignette Overlay */
.scanlines {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(
    rgba(18, 16, 16, 0) 50%, 
    rgba(0, 0, 0, 0.35) 50%
  ), linear-gradient(
    90deg,
    rgba(255, 0, 0, 0.03),
    rgba(0, 255, 0, 0.01),
    rgba(0, 0, 255, 0.03)
  );
  background-size: 100% 4px, 6px 100%;
  pointer-events: none;
  z-index: 50;
  opacity: 0.85;
}

.vignette {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: radial-gradient(circle at center, transparent 65%, rgba(0, 0, 0, 0.75) 100%);
  pointer-events: none;
  z-index: 51;
}

/* Canvas */
#gameCanvas {
  display: block;
  width: 100%;
  height: 100%;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  background-color: #222;
}

/* Overlay Screen Common */
.overlay-screen {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(15, 17, 21, 0.94);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  align-items: center;
  padding: 25px 35px;
  z-index: 40;
  color: #fff;
  overflow-y: auto;
  transition: opacity 0.25s ease;
}

.overlay-screen.hidden {
  display: none !important;
}

/* Typography & Titles */
.prl-badge {
  font-size: 10px;
  letter-spacing: 2px;
  color: var(--prl-gold);
  background: rgba(192, 24, 35, 0.4);
  padding: 4px 14px;
  border-radius: 4px;
  border: 1px dashed var(--prl-gold);
  margin-bottom: 8px;
  display: inline-block;
}

.profile-pill {
  margin-top: 8px;
  background: rgba(28, 35, 45, 0.95);
  border: 2px solid var(--prl-gold);
  color: #fff;
  font-family: var(--font-retro);
  font-size: 9px;
  padding: 6px 14px;
  border-radius: 20px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  box-shadow: 0 0 12px rgba(241, 196, 15, 0.35);
  transition: transform 0.15s ease, background 0.15s ease, border-color 0.15s ease;
  touch-action: manipulation;
}

.profile-pill:hover, .profile-pill:active {
  transform: scale(1.04);
  background: #2c3e50;
  border-color: #f39c12;
}

.edit-pen {
  font-size: 11px;
}

.menu-header {
  text-align: center;
  margin-top: 10px;
}

.game-title {
  font-size: 32px;
  line-height: 1.25;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.glow-red {
  color: var(--prl-red-bright);
  text-shadow: 0 0 10px rgba(255, 43, 56, 0.8), 2px 2px 0px #000;
}

.glow-gold {
  color: var(--prl-gold);
  text-shadow: 0 0 12px rgba(244, 196, 48, 0.8), 2px 2px 0px #000;
}

.tagline {
  font-family: var(--font-display);
  font-size: 24px;
  color: #e0e0e0;
  margin-top: 5px;
  letter-spacing: 1px;
  text-shadow: 1px 1px 2px #000;
}

/* Gierek Preview Box */
.gierek-preview-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin: 10px 0;
}

#previewCanvas {
  width: 130px;
  height: 130px;
  background: rgba(0, 0, 0, 0.5);
  border: 3px solid var(--prl-gold);
  border-radius: 8px;
  box-shadow: 0 0 15px rgba(244, 196, 48, 0.3);
}

.quote-bubble {
  margin-top: 8px;
  font-family: var(--font-display);
  font-size: 20px;
  background: #2c3e50;
  color: #f1c40f;
  padding: 6px 16px;
  border-radius: 6px;
  border: 1px solid #e67e22;
  text-align: center;
  max-width: 500px;
  box-shadow: 2px 2px 0 #000;
}

/* Buttons */
.btn {
  font-family: var(--font-retro);
  font-size: 12px;
  padding: 12px 20px;
  margin: 5px;
  border: 3px solid;
  cursor: pointer;
  text-transform: uppercase;
  transition: transform 0.1s ease, filter 0.1s ease, box-shadow 0.1s ease;
  outline: none;
  box-shadow: 3px 3px 0px #000;
}

.btn:hover {
  transform: translateY(-2px);
  filter: brightness(1.15);
  box-shadow: 4px 4px 0px #000;
}

.btn:active {
  transform: translateY(2px);
  box-shadow: 1px 1px 0px #000;
}

.btn-primary {
  background: var(--prl-red);
  color: #fff;
  border-color: #ff6b6b;
  box-shadow: 0 0 10px rgba(192, 24, 35, 0.5), 3px 3px 0 #000;
}

.btn-secondary {
  background: #2c3437;
  color: #f0f0f0;
  border-color: #536467;
}

.btn-back {
  background: #34495e;
  color: #ecf0f1;
  border-color: #7f8c8d;
  font-size: 11px;
  margin-top: 15px;
}

.btn-small {
  font-size: 9px;
  padding: 8px 12px;
}

.pulse {
  animation: pulse-glow 1.6s infinite alternate;
}

@keyframes pulse-glow {
  0% { box-shadow: 0 0 5px rgba(255, 43, 56, 0.4), 3px 3px 0 #000; }
  100% { box-shadow: 0 0 20px rgba(255, 43, 56, 0.9), 3px 3px 0 #000; }
}

.menu-buttons {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
  max-width: 440px;
}

.menu-buttons .btn {
  width: 100%;
  text-align: center;
}

.menu-footer {
  font-size: 8px;
  color: #7f8c8d;
  letter-spacing: 1px;
  text-align: center;
  margin-top: 10px;
}

/* HUD System */
.hud {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 12px 18px;
  z-index: 30;
}

.hud.hidden {
  display: none !important;
}

.hud-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 8px;
  flex-wrap: wrap;
}

.hud-box {
  background: rgba(14, 16, 20, 0.85);
  border: 2px solid #555;
  border-radius: 4px;
  padding: 6px 12px;
  box-shadow: 2px 2px 0 rgba(0, 0, 0, 0.8);
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 120px;
}

.hud-label {
  font-size: 7px;
  color: #95a5a6;
  margin-bottom: 3px;
  letter-spacing: 1px;
}

.hud-value {
  font-size: 14px;
  color: #fff;
  font-weight: bold;
}

.gold-text {
  color: var(--prl-gold);
}

.trust-bar-container {
  width: 100px;
  height: 10px;
  background: #111;
  border: 1px solid #777;
  border-radius: 2px;
  overflow: hidden;
  margin-bottom: 2px;
}

.trust-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, #27ae60, #2ecc71);
  transition: width 0.2s ease, background 0.3s ease;
}

.trust-bar-fill.danger {
  background: linear-gradient(90deg, #c0392b, #e74c3c);
  animation: blink 0.5s infinite;
}

.trust-text {
  font-size: 9px;
  color: #2ecc71;
}

.hud-bottom {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
}

.hud-ability {
  background: rgba(14, 16, 20, 0.85);
  border: 2px solid #f39c12;
  border-radius: 4px;
  padding: 6px 12px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.ability-title {
  font-size: 8px;
  color: var(--prl-gold);
}

.ability-bar-container {
  width: 120px;
  height: 12px;
  background: #111;
  border: 1px solid #f39c12;
  border-radius: 2px;
  overflow: hidden;
}

.ability-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, #f39c12, #f1c40f);
  box-shadow: 0 0 8px rgba(241, 196, 15, 0.7);
  transition: width 0.15s ease;
}

.ability-hint {
  font-size: 8px;
  color: #aaa;
}

.ability-ready .ability-hint {
  color: #fff;
  animation: blink 0.6s infinite;
  text-shadow: 0 0 6px #f1c40f;
}

.hud-controls-hint {
  font-size: 7px;
  color: rgba(255, 255, 255, 0.5);
  letter-spacing: 1px;
}

/* Song Banner Popup */
.song-banner {
  position: absolute;
  top: 65px;
  left: 50%;
  transform: translateX(-50%) translateY(-100px);
  background: rgba(20, 24, 30, 0.95);
  border: 2px solid var(--prl-gold);
  padding: 6px 18px;
  border-radius: 20px;
  font-family: var(--font-display);
  font-size: 18px;
  color: var(--prl-gold-light);
  display: flex;
  align-items: center;
  gap: 8px;
  z-index: 35;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.8);
  pointer-events: none;
  transition: transform 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275), opacity 0.5s ease;
  opacity: 0;
}

.song-banner.show {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
}

.music-icon {
  animation: bounce-icon 0.8s infinite alternate ease-in-out;
}

@keyframes bounce-icon {
  0% { transform: translateY(0); }
  100% { transform: translateY(-4px) scale(1.1); }
}

/* Shop (Pewex) Styles */
.screen-header {
  text-align: center;
  margin-bottom: 12px;
}

.screen-header h2 {
  font-size: 15px;
  color: var(--prl-gold);
  text-shadow: 2px 2px 0 #000;
  margin-bottom: 6px;
}

.user-wallet {
  font-size: 11px;
  color: #ecf0f1;
  background: rgba(0, 0, 0, 0.5);
  display: inline-block;
  padding: 4px 12px;
  border-radius: 4px;
  border: 1px solid #777;
}

.shop-tabs {
  display: flex;
  gap: 6px;
  margin-bottom: 12px;
}

.shop-tab {
  font-family: var(--font-retro);
  font-size: 9px;
  padding: 8px 14px;
  background: #252b33;
  color: #95a5a6;
  border: 2px solid #454d58;
  cursor: pointer;
  border-radius: 4px 4px 0 0;
  transition: all 0.2s;
}

.shop-tab.active {
  background: #34495e;
  color: #f1c40f;
  border-color: #f1c40f;
  border-bottom-color: #34495e;
}

.shop-content {
  width: 100%;
  flex: 1;
  overflow-y: auto;
  padding: 8px;
  background: rgba(10, 12, 15, 0.6);
  border: 2px solid #34495e;
  border-radius: 4px;
}

.tab-pane {
  display: none;
}

.tab-pane.active {
  display: block;
}

.shop-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 12px;
}

.shop-card {
  background: #1c222b;
  border: 2px solid #4a5568;
  border-radius: 6px;
  padding: 10px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  box-shadow: 2px 2px 5px rgba(0,0,0,0.5);
  transition: border-color 0.2s;
}

.shop-card.selected {
  border-color: var(--prl-gold);
  background: #222c38;
}

.shop-card-preview {
  width: 100%;
  height: 90px;
  border-radius: 4px;
  margin-bottom: 8px;
  border: 1px solid #333;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
}

.shop-card-title {
  font-size: 10px;
  color: #fff;
  margin-bottom: 5px;
}

.shop-card-desc {
  font-family: var(--font-display);
  font-size: 16px;
  color: #a0aec0;
  line-height: 1.2;
  margin-bottom: 10px;
  flex-grow: 1;
}

.shop-card-action {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 6px;
}

.price-tag {
  font-size: 10px;
  color: var(--prl-gold);
  font-weight: bold;
}

.btn-buy {
  font-family: var(--font-retro);
  font-size: 8px;
  padding: 6px 10px;
  background: #27ae60;
  color: #fff;
  border: 2px solid #2ecc71;
  cursor: pointer;
}

.btn-buy:disabled {
  background: #555;
  border-color: #777;
  color: #aaa;
  cursor: not-allowed;
}

.btn-select {
  font-family: var(--font-retro);
  font-size: 8px;
  padding: 6px 10px;
  background: #2980b9;
  color: #fff;
  border: 2px solid #3498db;
  cursor: pointer;
}

.btn-selected {
  font-family: var(--font-retro);
  font-size: 8px;
  padding: 6px 10px;
  background: #e67e22;
  color: #fff;
  border: 2px solid #f39c12;
  cursor: default;
}

/* High Scores Table & Personal Best Card */
.online-status-badge {
  font-family: var(--font-display);
  font-size: 16px;
  color: #2ecc71;
  background: rgba(46, 204, 113, 0.15);
  border: 1px solid #2ecc71;
  padding: 3px 12px;
  border-radius: 12px;
  display: inline-block;
  margin-top: 4px;
  letter-spacing: 1px;
}

.personal-best-card {
  width: 100%;
  max-width: 650px;
  background: linear-gradient(135deg, rgba(39, 174, 96, 0.25), rgba(241, 196, 15, 0.2));
  border: 2px solid var(--prl-gold);
  border-radius: 6px;
  padding: 10px 14px;
  margin-bottom: 8px;
  box-shadow: 0 0 12px rgba(241, 196, 15, 0.3);
  text-align: center;
}

.pb-header {
  font-size: 10px;
  color: var(--prl-gold);
  margin-bottom: 6px;
  letter-spacing: 1px;
}

.pb-body {
  display: flex;
  justify-content: space-around;
  flex-wrap: wrap;
  gap: 8px;
  font-size: 9px;
}

.pb-stat span {
  color: #bdc3c7;
}

/* Tabs inside Leaderboard */
.leaderboard-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 6px;
  width: 100%;
  max-width: 650px;
}

.lb-tab {
  flex: 1;
  font-family: var(--font-retro);
  font-size: 8px;
  padding: 8px 10px;
  background: #1c222b;
  color: #95a5a6;
  border: 2px solid #4a5568;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.2s;
  text-align: center;
}

.lb-tab.active {
  background: #2c3e50;
  color: var(--prl-gold);
  border-color: var(--prl-gold);
  box-shadow: 0 0 8px rgba(241, 196, 15, 0.4);
}

.leaderboard-container {
  width: 100%;
  max-width: 650px;
  min-height: 240px;
  max-height: 48vh;
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  margin: 6px 0;
  border: 2px solid #555;
  background: rgba(14, 18, 24, 0.85);
  border-radius: 4px;
}

.leaderboard-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 9px;
  text-align: left;
}

.leaderboard-table th, .leaderboard-table td {
  padding: 8px 6px;
  border-bottom: 1px solid #2d3748;
  color: #fff;
  vertical-align: middle;
}

.leaderboard-table th {
  background: #1e2530;
  color: var(--prl-gold);
  position: sticky;
  top: 0;
  z-index: 2;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
}

.leaderboard-table tr:nth-child(even) {
  background: rgba(255, 255, 255, 0.04);
}

.leaderboard-player-row {
  background: rgba(241, 196, 15, 0.25) !important;
  border-left: 4px solid var(--prl-gold) !important;
  box-shadow: inset 0 0 8px rgba(241, 196, 15, 0.35);
}

.player-tag {
  background: var(--prl-gold);
  color: #000;
  font-size: 7px;
  padding: 2px 5px;
  border-radius: 3px;
  margin-left: 6px;
  font-weight: bold;
  display: inline-block;
  vertical-align: middle;
}

.user-tag {
  background: #3498db;
  color: #fff;
  font-size: 7px;
  padding: 2px 4px;
  border-radius: 3px;
  margin-left: 4px;
  display: inline-block;
}

.online-tag {
  background: #27ae60;
  color: #fff;
  font-size: 7px;
  padding: 2px 4px;
  border-radius: 3px;
  margin-left: 4px;
  display: inline-block;
}

/* Modal Overlay & PRL Worker ID Card */
.modal-overlay {
  background: rgba(8, 10, 14, 0.96) !important;
  z-index: 70 !important;
  display: flex !important;
  justify-content: center !important;
  align-items: center !important;
  padding: 20px !important;
}

.modal-overlay.hidden {
  display: none !important;
}

.prl-id-card {
  background: #1c222b;
  border: 4px solid var(--prl-red);
  border-radius: 10px;
  padding: 24px;
  max-width: 480px;
  width: 95%;
  box-shadow: 0 0 35px rgba(192, 24, 35, 0.7), inset 0 0 15px rgba(0,0,0,0.8);
  text-align: center;
  position: relative;
}

.id-stamp {
  font-size: 9px;
  color: var(--prl-gold);
  border: 1px dashed var(--prl-gold);
  padding: 3px 8px;
  display: inline-block;
  margin-bottom: 8px;
  letter-spacing: 1px;
}

.id-header h3 {
  font-size: 13px;
  color: var(--prl-red-bright);
  margin-bottom: 4px;
}

.id-sub {
  font-family: var(--font-display);
  font-size: 18px;
  color: var(--prl-gold);
  margin-bottom: 14px;
  letter-spacing: 1px;
}

.id-intro {
  font-family: var(--font-display);
  font-size: 18px;
  color: #ccc;
  line-height: 1.3;
  margin-bottom: 14px;
}

.id-field {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 14px;
  text-align: left;
}

.id-field label {
  font-size: 9px;
  color: var(--prl-gold);
}

.id-field input {
  font-family: var(--font-retro);
  font-size: 13px;
  padding: 10px;
  background: #0f1318;
  border: 2px solid var(--prl-gold);
  color: #fff;
  text-transform: uppercase;
  text-align: center;
  border-radius: 4px;
  outline: none;
}

.id-field input:focus {
  border-color: #ff6b6b;
  box-shadow: 0 0 10px rgba(255, 107, 107, 0.5);
}

.cookie-note {
  font-family: var(--font-display);
  font-size: 15px;
  color: #95a5a6;
  margin-bottom: 16px;
  line-height: 1.2;
}

/* Instructions */
.instructions-content {
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-width: 700px;
  overflow-y: auto;
  padding: 8px;
}

.instruction-card {
  background: #1a1e26;
  border-left: 4px solid var(--prl-red);
  padding: 12px;
  border-radius: 4px;
}

.instruction-card h3 {
  font-size: 11px;
  color: var(--prl-gold);
  margin-bottom: 6px;
}

.instruction-card p, .instruction-card li {
  font-family: var(--font-display);
  font-size: 18px;
  color: #ddd;
  line-height: 1.3;
}

.instruction-card ul {
  padding-left: 20px;
  margin-top: 5px;
}

/* Settings Form */
.settings-form {
  display: flex;
  flex-direction: column;
  gap: 15px;
  width: 100%;
  max-width: 500px;
  background: #181d24;
  padding: 20px;
  border: 2px solid #4a5568;
  border-radius: 6px;
}

.setting-item {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 9px;
}

.setting-item input[type="range"] {
  accent-color: var(--prl-red-bright);
}

.setting-item input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: var(--prl-red-bright);
}

.custom-music-box {
  border-top: 1px dashed #555;
  padding-top: 12px;
}

.small-text {
  font-family: var(--font-display);
  font-size: 15px;
  color: #aaa;
}

/* Pause & Game Over */
.pause-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.85);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 45;
}

.pause-overlay.hidden {
  display: none !important;
}

.pause-box, .game-over-box {
  background: #1e242d;
  border: 3px solid var(--prl-red);
  border-radius: 8px;
  padding: 25px 30px;
  text-align: center;
  max-width: 520px;
  width: 90%;
  box-shadow: 0 0 25px rgba(0,0,0,0.9);
}

.pause-box h2, .game-over-box h2 {
  font-size: 18px;
  margin-bottom: 12px;
}

.pause-box p, .game-over-box p {
  font-family: var(--font-display);
  font-size: 18px;
  color: #ccc;
  margin-bottom: 18px;
}

.pause-buttons {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.game-over-stats {
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid #444;
  padding: 12px;
  border-radius: 6px;
  margin-bottom: 15px;
}

.stat-row {
  display: flex;
  justify-content: space-between;
  font-size: 10px;
  padding: 5px 0;
  border-bottom: 1px solid #29303c;
}

.stat-row:last-child {
  border-bottom: none;
}

.name-entry {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 15px;
}

.name-entry label {
  font-size: 8px;
  color: var(--prl-gold);
}

.name-entry input {
  font-family: var(--font-retro);
  font-size: 12px;
  padding: 8px;
  text-align: center;
  background: #0f1318;
  border: 2px solid var(--prl-gold);
  color: #fff;
  text-transform: uppercase;
  outline: none;
}

/* Mobile Pause Button in HUD */
.mobile-pause-btn {
  display: none;
  font-family: var(--font-retro);
  font-size: 14px;
  background: rgba(30, 36, 44, 0.85);
  border: 2px solid var(--prl-gold);
  color: var(--prl-gold);
  border-radius: 6px;
  padding: 6px 12px;
  cursor: pointer;
  pointer-events: auto;
  touch-action: manipulation;
}

.mobile-drag-hint {
  position: absolute;
  top: 60px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(18, 22, 28, 0.85);
  border: 1px dashed var(--prl-gold);
  border-radius: 12px;
  padding: 4px 12px;
  font-family: var(--font-display);
  font-size: 16px;
  color: var(--prl-gold);
  pointer-events: none;
  z-index: 31;
  text-align: center;
  white-space: nowrap;
  animation: pulse-glow 2s infinite alternate;
  opacity: 0.9;
  transition: opacity 1s ease;
}

/* Mobile Controls Container */
.mobile-controls {
  position: absolute;
  bottom: 30px;
  left: 0;
  width: 100%;
  display: none;
  justify-content: space-between;
  align-items: center;
  padding: 0 16px;
  z-index: 32;
  pointer-events: none;
}

.mobile-dpad, .mobile-actions {
  display: flex;
  gap: 10px;
  pointer-events: auto;
}

.touch-btn {
  height: 52px;
  background: rgba(26, 34, 46, 0.88);
  border: 2px solid #5d6d7e;
  color: #fff;
  border-radius: 8px;
  display: flex;
  justify-content: center;
  align-items: center;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.6);
  transition: transform 0.08s ease, background 0.08s ease, border-color 0.08s ease;
}

.touch-btn:active, .touch-btn.active {
  transform: scale(0.92);
  background: rgba(41, 128, 185, 0.9);
  border-color: #3498db;
}

.touch-dir {
  width: 58px;
  font-size: 20px;
}

.touch-sprint {
  width: 68px;
  font-family: var(--font-retro);
  font-size: 9px;
  background: rgba(44, 62, 80, 0.88);
  border-color: #f39c12;
  color: var(--prl-gold-light);
}

.touch-sprint.active {
  background: #d35400 !important;
  border-color: #e67e22 !important;
}

.pomoze-btn {
  width: 90px;
  font-family: var(--font-retro);
  font-size: 9px;
  background: rgba(192, 24, 35, 0.9);
  border-color: #ff6b6b;
  color: #fff;
  box-shadow: 0 0 10px rgba(192, 24, 35, 0.6);
}

.pomoze-btn:active, .pomoze-btn.active {
  background: #e74c3c;
  transform: scale(0.92);
  box-shadow: 0 0 15px rgba(255, 43, 56, 0.9);
}

/* Comprehensive Mobile & Responsive Media Queries */
@media (max-width: 900px), (hover: none) and (pointer: coarse) {
  html, body {
    width: 100%;
    height: 100%;
    overflow: hidden;
    position: fixed;
  }

  body {
    padding: 0;
    margin: 0;
    background: #090a0d;
  }

  .arcade-cabinet {
    max-width: 100vw;
    width: 100vw;
    height: 100vh;
    height: 100dvh;
    padding: 0;
    margin: 0;
    border: none;
    border-radius: 0;
    box-shadow: none;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    overflow: hidden;
    box-sizing: border-box;
  }

  .crt-screen {
    width: 100%;
    max-width: 100vw;
    height: 100%;
    max-height: 100dvh;
    border: none;
    border-radius: 0;
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
    box-sizing: border-box;
  }

  #gameCanvas {
    width: 100%;
    height: 100%;
    max-width: 100vw;
    max-height: 100dvh;
    object-fit: contain; /* Never crop or overflow screen */
    touch-action: none;
    display: block;
  }

  .mobile-controls {
    display: flex;
    position: absolute;
    bottom: max(32px, env(safe-area-inset-bottom, 28px));
    left: 0;
    width: 100%;
    justify-content: space-between;
    align-items: center;
    padding: 0 16px;
    padding-bottom: env(safe-area-inset-bottom, 12px);
    box-sizing: border-box;
    z-index: 32;
    pointer-events: none;
  }

  .touch-dir {
    width: 58px;
    height: 54px;
    font-size: 20px;
  }

  .touch-sprint {
    width: 68px;
    height: 54px;
    font-size: 9px;
  }

  .pomoze-btn {
    width: 92px;
    height: 54px;
    font-size: 9px;
  }

  .mobile-pause-btn {
    display: inline-flex;
    padding: 4px 8px;
    font-size: 12px;
  }

  .hud-controls-hint {
    display: none;
  }

  .hud-top {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    gap: 4px;
    width: 100%;
    box-sizing: border-box;
  }

  .hud-box {
    flex: 1 1 auto;
    min-width: 55px;
    padding: 3px 5px;
  }

  .hud-label {
    font-size: 6px;
  }

  .hud-value {
    font-size: 10px;
  }

  .trust-bar-container {
    width: 55px;
    height: 8px;
  }

  .trust-text {
    font-size: 8px;
  }

  .hud-ability {
    padding: 3px 6px;
    gap: 5px;
  }

  .ability-title {
    font-size: 7px;
  }

  .ability-bar-container {
    width: 70px;
    height: 9px;
  }

  .ability-hint {
    display: none;
  }

  .game-title {
    font-size: 20px;
    letter-spacing: 0;
    word-break: break-word;
  }

  .tagline {
    font-size: 15px;
  }

  .overlay-screen {
    padding: 10px 12px;
    box-sizing: border-box;
    max-width: 100vw;
    overflow-x: hidden;
  }

  .btn {
    padding: 10px 12px;
    font-size: 9px;
    min-height: 42px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
  }

  .gierek-preview-box {
    margin: 4px 0;
  }

  #previewCanvas {
    width: 90px;
    height: 90px;
  }

  .quote-bubble {
    font-size: 15px;
    padding: 4px 8px;
    max-width: 95vw;
  }

  .shop-grid {
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .leaderboard-container {
    min-height: 220px;
    max-height: 45vh;
    overflow-x: auto;
    width: 100%;
  }

  .leaderboard-table {
    min-width: 480px;
    font-size: 8px;
  }

  .leaderboard-table th, .leaderboard-table td {
    padding: 6px 4px;
  }

  .lb-tab {
    font-size: 7px;
    padding: 6px 4px;
  }
}

@keyframes blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.3; }
}
