/* Palette, keep in sync with js/game.js PAL:
   deep blue #003FBA, light blue #34A1E5, white #FFFFFF, black #000000 */
@font-face {
  font-family: "Cooper Hewitt";
  src: url("../fonts/CooperHewitt-Bold.woff2") format("woff2");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

* { box-sizing: border-box; }
html, body {
  margin: 0;
  height: 100%;
  background: #003FBA;
  color: #000000;
  overflow: hidden;
  font-family: "Avenir Next", "Segoe UI", system-ui, sans-serif;
}
body { position: fixed; inset: 0; width: 100%; }

#view {
  display: block;
  width: 100%;
  height: 100%;
  background: #003FBA;
  touch-action: none;
  outline: none;
}

.chip {
  background: #FFFFFF;
  color: #000000;
  border: 3px solid #000000;
  border-radius: 14px;
  padding: 8px 12px;
  margin: 0;
}

h1, #score, button {
  font-family: "Cooper Hewitt", "Avenir Next", "Trebuchet MS", sans-serif;
  font-weight: 700;
}

#hud {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding: calc(12px + env(safe-area-inset-top)) 14px 0;
  pointer-events: none;
  gap: 10px;
}
.brand h1 {
  margin: 0;
  font-size: 22px;
  letter-spacing: -0.04em;
  line-height: 1;
}
#place {
  margin: 4px 0 0;
  font-size: 13px;
  letter-spacing: 0.01em;
}
.meters {
  display: flex;
  align-items: center;
  gap: 10px;
}
#hearts { display: flex; gap: 5px; }
#hearts i {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 2px solid #000000;
  background: #FFFFFF;
  display: block;
}
#hearts i.on { background: #003FBA; }
#score { font-size: 22px; line-height: 1; letter-spacing: -0.04em; }
#best { font-size: 11px; margin-top: 2px; }

#quest {
  position: fixed;
  left: 14px;
  top: calc(78px + env(safe-area-inset-top));
  font-size: 12px;
  border-radius: 999px;
  padding: 6px 12px;
  pointer-events: none;
}
#quest.done { background: #34A1E5; }

#line {
  position: fixed;
  left: 50%;
  top: calc(122px + env(safe-area-inset-top));
  transform: translateX(-50%);
  max-width: min(92vw, 540px);
  text-align: center;
  font-size: 15px;
  line-height: 1.35;
  pointer-events: none;
  z-index: 2;
}
#line:empty { display: none; }
/* any line can be tapped away (js/game.js clearLine) */
#line { pointer-events: auto; cursor: pointer; touch-action: none; }

#hint {
  position: fixed;
  left: 50%;
  bottom: calc(128px + env(safe-area-inset-bottom));
  transform: translateX(-50%);
  max-width: min(92vw, 440px);
  width: max-content;
  text-align: center;
  font-size: 14px;
  border-radius: 999px;
  padding: 6px 14px;
  pointer-events: none;
  z-index: 2;
}
#hint:empty { display: none; }

#pad {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 8px;
  padding: 8px 14px calc(12px + env(safe-area-inset-bottom));
  pointer-events: none;
  z-index: 3;
}
/* the stick is a floating analog joystick drawn on the canvas (js/game.js drawStick);
   this empty box just holds the pad's left edge */
.stick { width: 1px; height: 1px; pointer-events: none; }
.keys {
  margin: 0 0 18px;
  color: #FFFFFF;
  background: #003FBA;
  border: 2px solid #FFFFFF;
  border-radius: 999px;
  padding: 4px 12px;
  font-size: 12px;
  pointer-events: none;
  text-align: center;
  opacity: 0.85;
}
.acts { display: flex; gap: 8px; pointer-events: none; }
.acts button { pointer-events: auto; min-width: 84px; height: 64px; }
.acts button#btn-log { min-width: 64px; }

/* overlays: name picker, journal, dialogue */
.overlay {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 20, 60, 0.55);
  z-index: 10;
  padding: 18px;
}
.overlay[hidden] { display: none; }
.overlay.bottom { align-items: flex-end; background: transparent; pointer-events: none; }
.overlay.bottom .card { pointer-events: auto; margin-bottom: calc(150px + env(safe-area-inset-bottom)); }
.overlay .card {
  background: #FFFFFF;
  color: #000000;
  border: 3px solid #000000;
  border-radius: 18px;
  padding: 22px 24px;
  max-width: 420px;
  width: 100%;
  text-align: center;
  box-shadow: 8px 8px 0 rgba(0, 0, 0, 0.35);
}
.overlay .card.wide { max-width: 560px; text-align: left; }
.overlay .card h2 {
  font-family: "Cooper Hewitt", "Avenir Next", sans-serif;
  font-size: 30px;
  margin: 0 0 4px;
  letter-spacing: -0.04em;
}
.overlay .card p { margin: 6px 0; font-size: 15px; line-height: 1.4; }
.overlay .card label { display: block; font-size: 14px; margin: 14px 0 8px; }
.overlay .card input {
  width: 100%;
  font-size: 18px;
  padding: 10px 12px;
  border: 3px solid #000000;
  border-radius: 12px;
  font-family: inherit;
  margin-bottom: 12px;
}
.overlay .card input:focus { outline: 3px solid #34A1E5; }
#journal-list { max-height: 50vh; overflow-y: auto; margin: 8px 0 14px; }
.jq { border-top: 2px solid #000; padding: 10px 2px; }
.jq:first-child { border-top: none; }
.jq h3 { margin: 0 0 4px; font-size: 16px; font-family: "Cooper Hewitt", sans-serif; }
.jq h3 .st { font-size: 11px; background: #003FBA; color: #fff; border-radius: 999px; padding: 2px 8px; margin-left: 8px; vertical-align: middle; }
.jq h3 .st.done { background: #34A1E5; color: #000; }
.jq p { margin: 2px 0; font-size: 13px; }
.jq .prog { font-size: 12px; color: #003FBA; }
#dlg-name { font-family: "Cooper Hewitt", sans-serif; font-size: 14px; color: #003FBA; margin: 0 0 6px; text-transform: uppercase; letter-spacing: 0.06em; }
#dlg-text { font-size: 16px; line-height: 1.45; margin: 0; min-height: 48px; }
.dlg-next { text-align: right; font-size: 13px; color: #003FBA; margin: 8px 0 0; }

.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

button {
  appearance: none;
  border: 3px solid #000000;
  background: #FFFFFF;
  color: #000000;
  border-radius: 16px;
  font-size: 16px;
  letter-spacing: -0.03em;
  touch-action: none;
  user-select: none;
}
button:active, button.on { background: #34A1E5; }
button:focus-visible { outline: 3px solid #FFFFFF; outline-offset: 2px; }

@media (max-width: 760px) {
  .keys { display: none; }
  .brand h1, #score { font-size: 18px; }
  #line { top: auto; bottom: calc(196px + env(safe-area-inset-bottom)); }
}
