/* ============================================================================
   Mafia Kills - WebGL loading screen
   Noir palette: gunmetal black, blood red, bone white.
   ========================================================================== */

html, body {
  padding: 0;
  margin: 0;
  width: 100%;
  height: 100%;
  background: #05060a;
  overflow: hidden;
}

body {
  font-family: "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
  color: #e8dcc0;
  -webkit-font-smoothing: antialiased;
}

#unity-container { position: absolute; }
#unity-container.unity-desktop { left: 50%; top: 50%; transform: translate(-50%, -50%); }
#unity-container.unity-mobile { position: fixed; width: 100%; height: 100%; }
.unity-mobile #unity-fullscreen-container { width: 100%; height: 100%; }

#unity-fullscreen-container { position: relative; }

#unity-canvas {
  position: absolute;
  width: 100%;
  height: 100%;
  background: #231F20;
}

/* ============================== Loading screen ============================ */

#mafia-loader {
  position: absolute;
  inset: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  opacity: 1;
  transition: opacity 0.6s ease;
}
#mafia-loader.mk-hidden { opacity: 0; pointer-events: none; }

/* Noir city backdrop, pushed down into shadow so the text reads cleanly. */
.mk-bg {
  position: absolute;
  inset: -3%;
  background: #05060a url('background.jpg') center 35% / cover no-repeat;
  filter: grayscale(35%) brightness(0.34) contrast(1.05);
  transform: scale(1.04);
}

.mk-vignette {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(120% 90% at 50% 42%, rgba(5, 6, 10, 0.15) 0%, rgba(5, 6, 10, 0.75) 58%, #05060a 100%),
    linear-gradient(180deg, rgba(5, 6, 10, 0.85) 0%, rgba(5, 6, 10, 0.25) 45%, rgba(5, 6, 10, 0.95) 100%);
}

/* Faint CRT scanlines for a film-noir projector feel. */
.mk-scanlines {
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(
    to bottom,
    rgba(0, 0, 0, 0) 0px,
    rgba(0, 0, 0, 0) 2px,
    rgba(0, 0, 0, 0.28) 3px,
    rgba(0, 0, 0, 0) 4px
  );
  opacity: 0.45;
  mix-blend-mode: multiply;
}

/* Slow sweeping light beam across the scene. */
.mk-scanbeam {
  position: absolute;
  top: -40%;
  left: -30%;
  width: 40%;
  height: 180%;
  background: linear-gradient(90deg, rgba(255, 60, 60, 0), rgba(255, 60, 60, 0.06), rgba(255, 60, 60, 0));
  transform: rotate(14deg);
  animation: mk-beam 7.5s linear infinite;
}

@keyframes mk-beam {
  0%   { transform: translateX(-30%) rotate(14deg); }
  100% { transform: translateX(360%) rotate(14deg); }
}

/* ------------------------------- Content column -------------------------- */

.mk-content {
  position: relative;
  z-index: 2;
  width: min(560px, 86vw);
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 24px;
}

/* --------------------------------- Emblem -------------------------------- */

.mk-emblem {
  position: relative;
  width: 200px;
  height: 200px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 22px;
}

.mk-logo {
  position: relative;
  z-index: 3;
  width: 132px;
  height: 132px;
  border-radius: 14px;
  object-fit: cover;
  box-shadow:
    0 0 0 1px rgba(232, 220, 192, 0.18),
    0 0 26px rgba(200, 31, 31, 0.45),
    0 10px 34px rgba(0, 0, 0, 0.75);
  animation: mk-logo-pulse 3.4s ease-in-out infinite;
}

@keyframes mk-logo-pulse {
  0%, 100% { box-shadow: 0 0 0 1px rgba(232,220,192,0.18), 0 0 22px rgba(200,31,31,0.35), 0 10px 34px rgba(0,0,0,0.75); }
  50%      { box-shadow: 0 0 0 1px rgba(232,220,192,0.28), 0 0 40px rgba(220,40,40,0.65), 0 10px 34px rgba(0,0,0,0.75); }
}

.mk-ring {
  position: absolute;
  border-radius: 50%;
  pointer-events: none;
}
.mk-ring--outer {
  width: 188px;
  height: 188px;
  border: 2px solid rgba(200, 31, 31, 0.55);
  border-top-color: rgba(255, 70, 70, 0.95);
  border-bottom-color: rgba(200, 31, 31, 0.2);
  animation: mk-spin 9s linear infinite;
}
.mk-ring--inner {
  width: 162px;
  height: 162px;
  border: 1px dashed rgba(232, 220, 192, 0.4);
  animation: mk-spin 14s linear infinite reverse;
}

@keyframes mk-spin { to { transform: rotate(360deg); } }

/* Crosshair ticks */
.mk-crosshair {
  position: absolute;
  background: rgba(255, 60, 60, 0.6);
  pointer-events: none;
}
.mk-crosshair--h { width: 200px; height: 1px; }
.mk-crosshair--v { width: 1px; height: 200px; }

/* --------------------------------- Title --------------------------------- */

.mk-title {
  margin: 0;
  font-family: Impact, Haettenschweiler, "Arial Narrow Bold", "Arial Black", sans-serif;
  font-size: clamp(30px, 6vw, 52px);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: #e8dcc0;
  text-shadow:
    0 2px 0 #1a0000,
    0 0 18px rgba(200, 31, 31, 0.55),
    0 6px 24px rgba(0, 0, 0, 0.9);
}

.mk-tagline {
  margin: 6px 0 26px;
  font-size: 13px;
  letter-spacing: 0.32em;
  text-transform: uppercase;
  color: #b03a3a;
  text-shadow: 0 0 12px rgba(200, 31, 31, 0.4);
}

/* ------------------------------ Progress bar ----------------------------- */

.mk-bar {
  position: relative;
  width: 100%;
  height: 12px;
  border-radius: 7px;
  background: linear-gradient(180deg, #0b0d13, #161922);
  border: 1px solid #2c303c;
  box-shadow: inset 0 2px 6px rgba(0, 0, 0, 0.85), 0 0 0 1px rgba(0, 0, 0, 0.4);
  overflow: hidden;
}

.mk-bar__fill {
  position: absolute;
  top: 0; left: 0; bottom: 0;
  width: 0%;
  border-radius: 7px;
  background: linear-gradient(90deg, #5c0d0d 0%, #b81a1a 45%, #ff4040 100%);
  box-shadow: 0 0 14px rgba(255, 60, 60, 0.7), inset 0 0 6px rgba(255, 160, 160, 0.5);
  transition: width 0.25s cubic-bezier(0.25, 0.8, 0.35, 1);
}
.mk-bar__fill::after {
  content: "";
  position: absolute;
  inset: 0;
  background-image: repeating-linear-gradient(
    -45deg,
    rgba(255, 255, 255, 0.14) 0px,
    rgba(255, 255, 255, 0.14) 8px,
    rgba(255, 255, 255, 0) 8px,
    rgba(255, 255, 255, 0) 16px
  );
  background-size: 200% 100%;
  animation: mk-stripes 0.9s linear infinite;
}

@keyframes mk-stripes {
  from { background-position: 0 0; }
  to   { background-position: -32px 0; }
}

.mk-bar__gloss {
  position: absolute;
  inset: 0;
  border-radius: 7px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.16), rgba(255, 255, 255, 0) 55%);
  pointer-events: none;
}

/* -------------------------------- Stats row ------------------------------ */

.mk-stats {
  width: 100%;
  margin-top: 12px;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  font-size: 12px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.mk-percent {
  font-family: Consolas, "SFMono-Regular", Menlo, monospace;
  font-size: 15px;
  font-weight: 700;
  color: #ff5252;
  text-shadow: 0 0 10px rgba(255, 60, 60, 0.5);
  min-width: 52px;
  text-align: left;
}

.mk-tip {
  flex: 1;
  text-align: right;
  color: #8b8f9a;
  opacity: 0.5;
  transform: translateY(2px);
  transition: opacity 0.35s ease, transform 0.35s ease;
}
.mk-tip--in { opacity: 1; transform: translateY(0); }

/* ------------------------------ Error screen ----------------------------- */

#mk-error {
  position: absolute;
  inset: 0;
  z-index: 30;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: radial-gradient(120% 100% at 50% 40%, rgba(30, 0, 0, 0.55), #05060a 75%);
  text-align: center;
}
#mk-error.mk-visible { display: flex; }

.mk-error__box { max-width: 460px; }
.mk-error__icon { font-size: 46px; color: #c81f1f; text-shadow: 0 0 22px rgba(200, 31, 31, 0.6); }
.mk-error__title {
  margin: 8px 0 10px;
  font-family: Impact, Haettenschweiler, "Arial Narrow Bold", "Arial Black", sans-serif;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: #e8dcc0;
}
.mk-error__msg { color: #d8d2c4; margin: 0 0 8px; word-break: break-word; }
.mk-error__hint { color: #7d818c; font-size: 13px; }

/* ------------------------------- Footer ---------------------------------- */

#unity-footer {
  position: relative;
  height: 40px;
  background: rgba(5, 6, 10, 0.92);
  border-top: 1px solid rgba(200, 31, 31, 0.28);
}
.unity-mobile #unity-footer { display: none; }

#unity-build-title {
  float: right;
  margin-right: 12px;
  line-height: 40px;
  font-size: 12px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: #6f747f;
}

#unity-fullscreen-button {
  cursor: pointer;
  float: right;
  width: 40px;
  height: 40px;
  background: url('fullscreen-button.png') no-repeat center;
  opacity: 0.55;
  transition: opacity 0.2s ease, background-color 0.2s ease;
}
#unity-fullscreen-button:hover { opacity: 1; background-color: rgba(200, 31, 31, 0.18); }

/* ------------------------------- Banners --------------------------------- */

#unity-warning {
  position: absolute;
  left: 50%;
  top: 5%;
  transform: translateX(-50%);
  width: min(640px, 92%);
  display: none;
  z-index: 40;
}

.mk-banner {
  margin-bottom: 8px;
  padding: 11px 14px;
  border-radius: 6px;
  font-size: 13px;
  line-height: 1.45;
  color: #e8dcc0;
  word-break: break-word;
  box-shadow: 0 8px 26px rgba(0, 0, 0, 0.6);
}
.mk-banner--warning {
  background: rgba(40, 32, 8, 0.95);
  border: 1px solid rgba(214, 176, 54, 0.6);
}
.mk-banner--error {
  background: rgba(58, 8, 8, 0.97);
  border: 1px solid rgba(230, 60, 60, 0.7);
}

/* ------------------------------ Responsive ------------------------------- */

@media (max-width: 520px) {
  .mk-emblem { width: 156px; height: 156px; margin-bottom: 16px; }
  .mk-logo { width: 104px; height: 104px; }
  .mk-ring--outer { width: 148px; height: 148px; }
  .mk-ring--inner { width: 126px; height: 126px; }
  .mk-crosshair--h { width: 156px; }
  .mk-crosshair--v { height: 156px; }
  .mk-tagline { font-size: 11px; margin-bottom: 20px; }
}

@media (prefers-reduced-motion: reduce) {
  .mk-ring, .mk-scanbeam, .mk-logo, .mk-bar__fill::after { animation: none; }
}
