:root {
  --ink: #140c1e;
  --paper: #fff6e0;
  --accent: #ff3ea5;
  --accent-dark: #c41f77;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  overflow: hidden;
  background: #140c1e radial-gradient(circle at 50% 0%, #2c1b44 0%, #140c1e 70%);
  color: var(--paper);
  font-family: "Courier New", ui-monospace, monospace;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior: none;
}

.wrap {
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: max(6px, env(safe-area-inset-top)) 6px max(6px, env(safe-area-inset-bottom));
}

#game {
  display: block;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  border: 4px solid #3a2550;
  box-shadow: 0 0 0 4px var(--ink), 0 10px 30px rgba(0, 0, 0, 0.6);
  touch-action: none;
  cursor: pointer;
}

.hint {
  margin: 0;
  font-size: 12px;
  letter-spacing: 0.5px;
  text-align: center;
  opacity: 0.85;
  max-width: 460px;
}

.hint b { color: var(--accent); }

/* On phones the canvas takes the whole screen and the keyboard hints go away. */
@media (pointer: coarse), (max-height: 620px) {
  .hint { display: none; }
  .wrap { padding: 0; gap: 0; }
  #game { border-width: 0; box-shadow: none; }
}

/* ------------------------------------------------------------------ dialog */
.dialog {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: rgba(10, 6, 16, 0.82);
  z-index: 10;
}

.dialog.hidden { display: none; }

.dialog__box {
  width: min(360px, 100%);
  padding: 20px 18px 18px;
  background: var(--paper);
  color: var(--ink);
  border: 4px solid var(--ink);
  box-shadow: 0 0 0 4px #3a2550, 0 16px 40px rgba(0, 0, 0, 0.55);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.dialog__title {
  margin: 0;
  font-size: 26px;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--accent-dark);
}

.dialog__hint {
  margin: 0;
  font-size: 13px;
  opacity: 0.75;
}

.dialog__input {
  font-family: inherit;
  font-size: 22px;
  letter-spacing: 3px;
  text-transform: uppercase;
  padding: 12px 10px;
  border: 3px solid var(--ink);
  background: #fffdf6;
  color: var(--ink);
  width: 100%;
  min-height: 52px;
}

.dialog__input::placeholder {
  color: #b9ab8e;
  letter-spacing: 3px;
}

.dialog__input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(255, 62, 165, 0.25);
}

.dialog__error {
  margin: 0;
  min-height: 16px;
  font-size: 13px;
  color: #c0182f;
}

.dialog__row {
  display: flex;
  gap: 10px;
}

.btn {
  flex: 1;
  font-family: inherit;
  font-size: 15px;
  text-transform: uppercase;
  letter-spacing: 1px;
  padding: 12px 10px;
  min-height: 48px;
  border: 3px solid var(--ink);
  background: #e9dcc0;
  color: var(--ink);
  cursor: pointer;
}

.btn:active { transform: translateY(2px); }

.btn--go {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent-dark);
}

body.dialog-open #game { filter: saturate(0.6) brightness(0.8); }
