/* 16-segment word game — LAN v1. Palette from main.py:17-20. */

html, body {
  margin: 0;
  height: 100%;
  background: rgb(16, 18, 24);
  overflow-x: hidden; /* allow vertical scroll (e.g. to the input when the
                         keyboard opens) instead of shrinking the layout */
}

body {
  font-family: monospace;
}

/* All text is monospace, everywhere (DOM elements and form controls too) */
* {
  font-family: monospace;
}

#game {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  height: 100lvh; /* stable height: doesn't shrink when the keyboard opens */
  display: block;
  touch-action: manipulation; /* no double-tap zoom delay on phones */
}

/* Landscape/desktop: the guess box is overlaid on the canvas at the same
   virtual coords as pygame's input_rect (main.py:247); main.js positions it
   from the letterbox transform. Enter key submits — there is no button. */
#controls {
  position: fixed;
  inset: 0;
  pointer-events: none;
}
#controls > * { pointer-events: auto; }

#guess {
  position: fixed;
  box-sizing: border-box;
  background: transparent;
  color: rgb(230, 230, 230);
  border: 4px solid rgb(120, 120, 120);
  border-radius: 0;
  padding: 0 8px;
  font-family: monospace;
  text-align: center; /* centre the typed guess in the box */
  min-width: 44px;
  min-height: 44px;
}
#guess::placeholder { color: rgb(120, 120, 120); }
#guess:focus { outline: none; }

/* Portrait/phones: control bar below the canvas; the canvas draws the
   900x1400 portrait layout (reference rows, progress word, big display). */
body.portrait {
  display: flex;
  flex-direction: column;
}
body.portrait #game {
  position: static;
  flex: none;
  width: 100vw;
  height: calc(100vh - 64px);
  height: calc(100lvh - 64px); /* stable: no shrink when the keyboard opens */
}
body.portrait #controls {
  /* Floated by main.js (positionControls) over the canvas's bottom
     letterbox band, at layout.controlsY, so the gap between the answer
     word and the ENTER WORD box equals the gap between the big grid and
     the answer word. */
  position: fixed;
  left: 0;
  right: 0;
  top: 0; /* set from JS on every resize */
  pointer-events: auto;
  flex: none;
  height: 64px;
  box-sizing: border-box;
  display: flex;
  justify-content: center; /* centre the guess box in the bar */
  padding: 6px;
  background: transparent; /* sits over the canvas letterbox band */
}

/* End-of-round popup: centered card showing the EC_completed.png artwork
   (1110x1259) with the numbers overlaid at the artwork's placeholder-box
   centers (percentages baked into index.html). container-type lets the
   numbers scale with the card via cqw units. */
#endcard {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.65);
}
#endcard[hidden] { display: none; }
#endcard-panel {
  position: relative;
  container-type: inline-size;
  width: min(80vw, 79.4vh); /* 1110/1259 aspect: keep the whole image on screen */
}
#endcard-panel img { display: block; width: 100%; height: auto; }
.ec-num {
  position: absolute;
  transform: translate(-50%, -50%);
  font-weight: bold;
  color: rgb(230, 230, 230);
  text-align: center;
  font-size: 4.8vw; font-size: 6cqw; /* top-row boxes: ~8.5cqw tall in the artwork */
}
.ec-num-sm { font-size: 2.6vw; font-size: 3.2cqw; } /* bottom-row boxes: ~5.4cqw tall */

/* First-visit info popup: full-screen dim overlay with the how-to-play image
   at 80% of the screen width. Stays until the first tap anywhere (the overlay
   covers the canvas, so the tap never reaches the game). */
#intro-popup {
  position: fixed;
  inset: 0;
  z-index: 30; /* above #endcard (20) */
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.65);
  cursor: pointer;
}
#intro-popup[hidden] { display: none; }
#intro-popup img {
  width: 80vw;
  max-height: 90vh;
  object-fit: contain;
}
body.portrait #guess-form {
  display: flex;
  flex: none;
  width: 230px; /* just wide enough for 12 monospace letters at 28px */
  height: 100%;
}
body.portrait #guess {
  position: static;
  flex: 1;
  width: 100%;
  height: 100%;
  font-size: 28px;
  border-width: 4px;
}

/* Footer copyright notice: pinned to the bottom edge of the screen. In
   portrait it sits in the 64px strip below the canvas; in landscape it
   overlays the canvas's empty bottom letterbox band. Never intercepts
   taps and stays below the popups. */
#site-footer {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 2px;
  z-index: 10; /* below #endcard (20) and #intro-popup (30) */
  text-align: center;
  font-size: 11px;
  color: rgb(120, 120, 120);
  pointer-events: none;
}
#site-footer a {
  pointer-events: auto; /* footer itself never intercepts taps, links do */
  color: rgb(160, 160, 160);
}

/* SEO-only text on the game screen: real content for crawlers, invisible
   on the fullscreen canvas. */
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  border: 0;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  overflow: hidden;
  white-space: nowrap;
}

/* Static info pages (how-to-play.html, about.html). */
.page {
  max-width: 720px;
  margin: 0 auto;
  padding: 24px 16px 64px;
  color: rgb(230, 230, 230);
  font-size: 15px;
  line-height: 1.55;
}
.page h1 { font-size: 22px; }
.page a { color: rgb(150, 190, 255); }
.page nav { margin-top: 28px; font-size: 13px; }
.page nav a { margin-right: 16px; }
