/* ============================================================
   SCHOOL ESCAPE - Mission 1
   Retro pixel-art styling. No external fonts or images.
   ============================================================ */

/* --- Limited colour palette, reused everywhere --- */
:root {
  --ink:        #11101c;  /* darkest  */
  --wall:       #2b2540;  /* dark purple */
  --wall-lit:   #3d3357;
  --teal:       #4f9d8a;  /* lockers */
  --amber:      #f2b45c;  /* evening light */
  --cream:      #ffeccf;  /* text */
  --red:        #d9455f;  /* student shirt / accents */
  --shadow:     #0a0912;
}

* {
  box-sizing: border-box;
}

html, body {
  height: 100%;
}

body {
  margin: 0;
  display: flex;
  align-items: center;
  justify-content: center;

  /* Evening sky behind the whole cabinet */
  background-color: var(--ink);
  background-image:
    radial-gradient(circle at 50% 0%, #3a2b4d 0%, #17142a 60%, #0a0912 100%);

  font-family: "Courier New", Courier, monospace;
  font-weight: bold;
  letter-spacing: 2px;
  color: var(--cream);

  /* Stops the page from scrolling when you tap Space */
  overflow: hidden;
  user-select: none;
}

/* --- The arcade cabinet that frames the game --- */
.cabinet {
  text-align: center;
  padding: 16px;
}

.title {
  margin: 0;
  font-size: 28px;
  letter-spacing: 6px;
  color: var(--amber);
  /* Chunky pixel-ish drop shadow (hard edges, no blur) */
  text-shadow: 3px 3px 0 var(--shadow), 6px 6px 0 rgba(0, 0, 0, 0.35);
}

.subtitle {
  margin: 6px 0 14px;
  font-size: 12px;
  letter-spacing: 4px;
  color: var(--teal);
}

/* --- Screen: holds the canvas and the overlays on top of it --- */
.screen {
  position: relative;
  display: inline-block;
  line-height: 0;                 /* removes the gap under the canvas */
  border: 4px solid var(--wall-lit);
  outline: 4px solid var(--ink);
  box-shadow: 0 0 0 8px #241f38, 0 14px 0 8px var(--shadow);
  background: var(--wall);
}

/* The canvas is 320x180 internally and blown up 3x.
   image-rendering: pixelated keeps every pixel a crisp square. */
#game {
  display: block;
  width: 960px;
  height: 540px;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  -ms-interpolation-mode: nearest-neighbor;
}

/* --- Overlays (start screen / game over screen) --- */
.overlay {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  line-height: 1.5;
  background: rgba(17, 16, 28, 0.78);
  text-align: center;
}

.overlay.hidden {
  display: none;
}

.overlay-big {
  margin: 0;
  font-size: 34px;
  letter-spacing: 8px;
  color: var(--amber);
  text-shadow: 3px 3px 0 var(--shadow);
}

.overlay-small {
  margin: 0;
  font-size: 15px;
  letter-spacing: 3px;
  color: var(--cream);
}

.overlay-tiny {
  margin: 0;
  font-size: 11px;
  letter-spacing: 3px;
  color: var(--teal);
}

/* Simple blinking "insert coin" style text */
.blink {
  animation: blink 1s steps(1, end) infinite;
}

@keyframes blink {
  0%, 60%  { opacity: 1; }
  61%, 100% { opacity: 0.15; }
}

/* --- Restart button, drawn to look like a pixel UI element --- */
.pixel-btn {
  margin-top: 4px;
  padding: 12px 26px;
  font-family: inherit;
  font-weight: bold;
  font-size: 15px;
  letter-spacing: 4px;
  color: var(--ink);
  background: var(--amber);
  border: 0;
  /* Hard-edged 3D bevel made only from box shadows */
  box-shadow:
    inset -4px -4px 0 rgba(0, 0, 0, 0.28),
    inset  4px  4px 0 rgba(255, 255, 255, 0.35),
    5px 5px 0 var(--shadow);
  cursor: pointer;
}

.pixel-btn:hover {
  background: #ffd089;
}

/* Pressing the button pushes it "into" the screen */
.pixel-btn:active {
  transform: translate(3px, 3px);
  box-shadow:
    inset -4px -4px 0 rgba(0, 0, 0, 0.28),
    inset  4px  4px 0 rgba(255, 255, 255, 0.35),
    2px 2px 0 var(--shadow);
}

.hint {
  margin: 16px 0 0;
  font-size: 11px;
  letter-spacing: 3px;
  color: #6b6390;
}

/* --- Shrink the screen on smaller displays so nothing gets cut off --- */
@media (max-width: 1020px) {
  #game { width: 640px; height: 360px; }
  .title { font-size: 22px; }
  .overlay-big { font-size: 24px; }
  .overlay-small { font-size: 12px; }
}

@media (max-height: 720px) {
  #game { width: 640px; height: 360px; }
}
