/* Dialogue font: Kinuta Reiwa Kana. Drop your licensed copy into the fonts/ folder as
   KinutaReiwaKana.otf (or .ttf / .woff2). If it's installed on the computer it is used automatically.
   Until then the text falls back to a serif font. */
@font-face {
  font-family: "KinutaFile";
  src: local("Kinuta Reiwa Kana"), local("KinutaReiwaKana"),
       url("fonts/KinutaReiwaKana.woff2") format("woff2"),
       url("fonts/KinutaReiwaKana.otf") format("opentype"),
       url("fonts/KinutaReiwaKana.ttf") format("truetype");
  font-display: swap;
}

:root {
  --dialogue-font: "Kinuta Reiwa Kana", "kinuta-reiwa-kana", "kinuta-reiwa-kana-std", "KinutaFile", Georgia, "Times New Roman", serif;
  --red: #cc0100;
  --ink: #000;
  --paper: #fff;
  /* Cursors: closed eye normally, open (bloodshot) eye over anything clickable. Hotspot = centre of the eye. */
  --cursor-eye: url(images/cursors/eye.png) 25 15, auto;
  --cursor-eye-open: url(images/cursors/eye-open.png) 25 15, pointer;
}

html, body { margin: 0; height: 100%; background: #000; overflow: hidden; }
body { display: flex; align-items: center; justify-content: center; cursor: var(--cursor-eye); }

/* High-DPI screens get the sharper 2x cursor images where supported. */
@supports (cursor: image-set(url(a.png) 1x)) {
  :root {
    --cursor-eye: image-set(url(images/cursors/eye.png) 1x, url(images/cursors/eye@2x.png) 2x) 25 15, auto;
    --cursor-eye-open: image-set(url(images/cursors/eye-open.png) 1x, url(images/cursors/eye-open@2x.png) 2x) 25 15, pointer;
  }
}

/* The stage keeps your artwork's aspect ratio and scales to fit the window. (Set the ratio in game-data.js.) */
#stage {
  position: relative;
  background: #000;
  overflow: hidden;
  user-select: none;
  font-family: Georgia, "Times New Roman", serif;
  container-type: inline-size;
  cursor: var(--cursor-eye);
}
#bg { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: fill; pointer-events: none; }
#bg-inline { position: absolute; inset: 0; pointer-events: none; }
#bg-inline svg { width: 100%; height: 100%; display: block; }
#hotspots { position: absolute; inset: 0; }

.hotspot { position: absolute; cursor: var(--cursor-eye-open); box-sizing: border-box; }
body.debug .hotspot { outline: 2px dashed #0f0; background: rgba(0, 255, 0, .12); }
body.debug .hotspot::after {
  content: attr(data-id); position: absolute; left: 2px; top: 2px;
  font: 12px monospace; color: #0f0; background: rgba(0,0,0,.6); padding: 1px 3px;
}

#timer {
  position: absolute; top: 2.5%; right: 2%;
  font-size: 3cqw; color: var(--paper); background: var(--ink);
  padding: .3cqw 1.4cqw; font-variant-numeric: tabular-nums; letter-spacing: .15cqw;
}

#back {
  position: absolute; top: 2.5%; left: 2%;
  font: inherit; font-size: 2cqw; color: var(--paper); background: var(--ink);
  border: .2cqw solid var(--paper); padding: .4cqw 1.5cqw;
  cursor: var(--cursor-eye-open);
}
#back:hover { color: var(--red); }

#dialogue {
  position: absolute; left: 24%; right: 24%; bottom: 3.5%;
  min-height: 7%; box-sizing: border-box;
  background: rgba(0, 0, 0, .9); color: var(--paper);
  border: .15cqw solid var(--paper);
  padding: .8cqw 1.5cqw; cursor: var(--cursor-eye-open);
}
/* Name tag: its own box sitting directly on top of the dialogue box, sharing the top border line. */
#dialogue-who {
  position: absolute; left: 1.5cqw; bottom: 100%;
  background: rgba(0, 0, 0, .9); border: .15cqw solid var(--paper);
  padding: .4cqw 1.1cqw .45cqw;
  font-family: var(--dialogue-font); font-weight: bold; color: var(--red); font-size: 1.05cqw; letter-spacing: .12cqw; text-transform: uppercase;
  line-height: 1.2;
}
#dialogue-who:empty { display: none; }
#dialogue-text { font-family: var(--dialogue-font); font-size: 1.45cqw; line-height: 1.4; }
#dialogue-hint { font-family: var(--dialogue-font); position: absolute; right: 1cqw; bottom: .4cqw; font-size: .8cqw; opacity: .55; }

#debug-readout {
  position: absolute; left: 1%; top: 1%; font: 13px monospace; color: #0f0;
  background: rgba(0,0,0,.75); padding: 6px 8px; border-radius: 4px; pointer-events: none; z-index: 5;
}
.draw-box { position: absolute; border: 2px solid #ff0; background: rgba(255,255,0,.15); pointer-events: none; }

#begin { position:absolute; inset:0; z-index:20; background:#000; color:#fff; display:flex; align-items:center; justify-content:center;
  font-family:"Montserrat Alternates","Georgia",serif; font-weight:600; font-size:1.7cqw; letter-spacing:.25cqw; cursor:var(--cursor-eye-open); }

/* Red pulsing border shown while the "people coming" sound plays. */
#pulse { position:absolute; inset:0; z-index:4; pointer-events:none; box-sizing:border-box;
  border:.5cqw solid #cc0100; box-shadow: inset 0 0 7cqw 1.5cqw #cc0100; opacity:0; }

/* Black overlay used for quick fade transitions between scenes. */
#fade { position:absolute; inset:0; z-index:15; background:#000; opacity:0; pointer-events:none; }

/* "You got caught" screen. */
#lose { position:absolute; inset:0; z-index:30; background:#000; color:#fff; display:flex; flex-direction:column;
  align-items:center; justify-content:center; gap:3cqw; cursor:var(--cursor-eye); }
#lose[hidden] { display:none; }
#lose-text { white-space:pre-line; line-height:1.6; margin:0; font-family:var(--dialogue-font); font-size:2.6cqw; letter-spacing:.1cqw; text-align:center; padding:0 6cqw; }
#lose-text span { display:block; }
#lose-text .sub { font-size:2.1cqw; }
#lose-exit { font:inherit; font-family:var(--dialogue-font); font-size:1.6cqw; color:#fff; background:#000; border:.15cqw solid #fff;
  padding:.6cqw 2.4cqw; cursor:var(--cursor-eye-open); }
#lose-exit:hover { color:var(--red); border-color:var(--red); }

/* "You escaped" screen: fades to white, then the words appear. */
#escape { position:absolute; inset:0; z-index:35; background:#fff; color:#000; display:flex; flex-direction:column;
  align-items:center; justify-content:center; gap:1.6cqw; text-align:center; }
#escape[hidden] { display:none; }
#escape > * { opacity:0; transition:opacity 1.2s ease; }
#escape.shown > * { opacity:1; }
#escape-title { font-family:var(--dialogue-font); font-size:4cqw; letter-spacing:.12cqw; }
#escape-sub { font-family:var(--dialogue-font); font-size:1.7cqw; letter-spacing:.1cqw; }
#escape-btn { margin-top:2cqw; font:inherit; font-family:var(--dialogue-font); font-size:1.6cqw; color:#000; background:#fff;
  border:.15cqw solid #000; padding:.6cqw 2.4cqw; cursor:var(--cursor-eye-open); }
#escape-btn:hover { color:var(--red); border-color:var(--red); }
