/* ---------------------------------------------------------------------------
   Pixel Operator — Jayvee Enaguas (HarvettFox96), CC0 1.0. Self-hosted on
   purpose: a Google Fonts link fails from file:// and offline, and the canvas
   would silently fall back to browser monospace at a different width.
   The engine only ever asks for 8px, 16px or 24px — the design size and its
   whole multiples. Anything between those resamples and goes soft.
--------------------------------------------------------------------------- */
@font-face {
  font-family: 'SlagPix';
  src: url('../assets/fonts/pixel_operator/PixelOperator8.ttf') format('truetype');
  font-weight: normal;
  font-style: normal;
  font-display: block;
}
@font-face {
  font-family: 'SlagPix';
  src: url('../assets/fonts/pixel_operator/PixelOperator8-Bold.ttf') format('truetype');
  font-weight: bold;
  font-style: normal;
  font-display: block;
}
/* Registered for anything that ever needs columns to line up — odds boards,
   keypad readouts, price lists. Nothing uses it yet. */
@font-face {
  font-family: 'SlagMono';
  src: url('../assets/fonts/pixel_operator/PixelOperatorMono8.ttf') format('truetype');
  font-weight: normal;
  font-style: normal;
  font-display: block;
}
@font-face {
  font-family: 'SlagMono';
  src: url('../assets/fonts/pixel_operator/PixelOperatorMono8-Bold.ttf') format('truetype');
  font-weight: bold;
  font-style: normal;
  font-display: block;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: #1a1a1a;
}

#gameCanvas {
  display: block;
  position: absolute;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
}

/* Loading Overlay Styles */

#loadingOverlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: radial-gradient(circle at center, #1a1a1a 0%, #0a0a0a 100%);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: #ffffff;
  font-family: 'SlagPix', ui-monospace, system-ui, sans-serif;
  transition: opacity 0.5s ease, visibility 0.5s ease;
}

.loading-container {
  text-align: center;
  padding: 1.5rem 2rem;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.03);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: 0 15px 30px rgba(0, 0, 0, 0.6);
  max-width: 360px;
  width: 90%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.2rem;
}

.loading-title {
  font-family: 'SlagPix', ui-monospace, monospace;
  font-size: clamp(1rem, 3.4vw, 1.3rem);
  font-weight: 700;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: #ffffff;
  margin: 0;
  text-shadow: 0 0 10px rgba(255, 255, 255, 0.2);
}

/* A real bar. There is a lot to fetch on a first visit and an endless spinner
   gives the player no way to tell a slow line from a broken game. */
.loading-bar {
  width: 100%;
  height: 8px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.14);
  overflow: hidden;
}

.loading-bar-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #c9a227, #ffee88);
  transition: width 0.25s ease-out;
}

.loading-note {
  font-size: 0.7rem;
  letter-spacing: 0.04em;
  line-height: 1.5;
  color: rgba(255, 255, 255, 0.38);
  margin: 0;
}

.loading-text {
  font-size: 0.9rem;
  font-weight: 400;
  letter-spacing: 0.08em;
  color: rgba(255, 255, 255, 0.7);
  margin: 0;
  font-variant-numeric: tabular-nums;
}

@keyframes pulse {
  0%, 100% { opacity: 0.6; }
  50% { opacity: 1; }
}

/* --- Portrait notice ------------------------------------------------------
   The canvas is a fixed 16:9. On a phone held upright it letterboxes down to a
   strip about a fifth of the screen tall, which is unplayable. Gated on a
   coarse pointer so a narrow desktop window never trips it. */
#rotateNotice { display: none; }

@media (orientation: portrait) and (pointer: coarse) {
  #rotateNotice {
    display: flex;
    position: fixed;
    inset: 0;
    z-index: 9998;
    align-items: center;
    justify-content: center;
    background: #0d0c0b;
    color: rgba(255, 255, 255, 0.82);
    font-family: 'SlagPix', ui-monospace, monospace;
    text-align: center;
    padding: 2rem;
  }
  .rotate-inner p {
    font-size: 1rem;
    letter-spacing: 0.06em;
    margin-top: 1.4rem;
  }
  .rotate-phone {
    width: 54px;
    height: 92px;
    margin: 0 auto;
    border: 3px solid rgba(255, 238, 136, 0.85);
    border-radius: 8px;
    animation: rotate-hint 2.4s ease-in-out infinite;
  }
  @keyframes rotate-hint {
    0%, 30%   { transform: rotate(0deg); }
    55%, 100% { transform: rotate(-90deg); }
  }
}
