/* ========== GLOBAL LOCK (prevents Safari scroll / bounce) ========== */

html, body{
  height: 100%;
  overscroll-behavior: none;
}

body{
  margin: 0;
  overflow: hidden;
  position: fixed;
  width: 100%;
  touch-action: none;
  background: #0a0a0a;
  color: #e6e6e6;
  font-family: monospace;
    font-family: "Courier New", Courier, monospace;
}

/* ========== LAYOUT ========== */

.shell{
  height: 100%;
  display: grid;
  place-items: center;
  padding-bottom: calc(74px + env(safe-area-inset-bottom));
}

.playfield{
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding-bottom: 10px;
}

/* ========== CANVAS ========== */

canvas{
  display: block;
  margin: 0 auto;
  background: #120a08;
  image-rendering: pixelated;
  touch-action: none;
  width: min(92vw, 512px);
  height: auto;
}

/* ========== UI TEXT (ROUND / INTEGRITY) ========== */

.ui{
  position: absolute;
  top: 10px;
  left: 50%;
  transform: translateX(-50%);
  text-align: center;
  font-size: 14px;
  letter-spacing: 1px;
  pointer-events: none;
}

#status{
  margin-bottom: 4px;
  opacity: 0.85;
}

#integrity{
  font-size: 12px;
  opacity: 0.6;
}

/* ========== INSTRUCTION UNDER GAME ========== */

.instructionBlock{
  margin-top: 8px;
  max-width: min(92vw, 512px);
  text-align: center;
  pointer-events: none;
}

.instruction{
  font-size: 11px;
  line-height: 1.35;
  color: rgba(230,230,230,0.62);
  padding: 0 8px;
}

.instructionSub{
  margin-top: 4px;
  font-size: 10px;
  line-height: 1.3;
  color: rgba(230,230,230,0.45);
  padding: 0 8px;
}

/* ========== WIN PANEL ========== */

.ascendPanel{
  position: absolute;
  inset: 0;
  display: grid;
  align-content: center;
  justify-items: center;
  gap: 10px;
  background: rgba(0,0,0,0.54);
  text-align: center;
  padding: 24px;
  z-index: 20;
}

.ascendTitle{
  font-size: 18px;
  letter-spacing: 1px;
  color: rgba(230,230,230,0.96);
}

.ascendCode{
  font-size: 14px;
  letter-spacing: 1px;
  color: rgba(255,107,61,0.96);
}

.ascendNote{
  max-width: 320px;
  font-size: 12px;
  line-height: 1.4;
  color: rgba(230,230,230,0.78);
}

.executeBtn{
  display: inline-block;
  margin-top: 2px;
  padding: 10px 18px;
  border: 1px solid rgba(255,255,255,0.16);
  border-radius: 12px;
  background: rgba(255,255,255,0.08);
  color: rgba(255, 107, 61, 0.95);
  text-decoration: none;
  font-weight: 700;
  letter-spacing: 1px;
}

.executeBtn:hover{
  background: rgba(255,255,255,0.14);
  text-decoration: underline;
}

/* ========== FIXED FOOTER ========== */

.footer{
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 8px 14px calc(10px + env(safe-area-inset-bottom));
  background: linear-gradient(to top, rgba(0,0,0,0.65), rgba(0,0,0,0.10));
  pointer-events: none;
}

.hintRow{
  width: 100%;
  text-align: center;
  pointer-events: auto;
}

.hintSmall{
  margin-top: 8px;
  font-size: 11px;
  color: rgba(230,230,230,0.55);
  max-width: 560px;
  margin-left: auto;
  margin-right: auto;
  padding: 0 6px;
  line-height: 1.35;
  white-space: normal;
  word-break: break-word;
}

.hidden{
  display: none;
}

/* ========== START OVERLAY ========== */

.overlay{
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  background: rgba(0,0,0,0.78);
  z-index: 50;
}

.overlay.hidden{
  display: none;
}

.panel{
  width: min(420px, calc(100% - 40px));
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 14px;
  background: rgba(255,255,255,0.05);
  padding: 20px 18px;
  text-align: center;
  backdrop-filter: blur(4px);
}

.title{
  font-size: 14px;
  letter-spacing: 1px;
  margin-bottom: 12px;
}

.msg{
  font-size: 13px;
  color: rgba(230,230,230,0.75);
  margin-bottom: 14px;
}

.startBtn{
  width: 100%;
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: 12px;
  padding: 10px 12px;
  background: rgba(255,255,255,0.08);
  color: #e6e6e6;
  cursor: pointer;
  font-size: 14px;
  font-weight: 700;
  transition: background 140ms ease, border 140ms ease;
}

.startBtn:hover{
  background: rgba(255,255,255,0.14);
  border-color: rgba(255,255,255,0.25);
}

/* ========== OPTIONAL: subtle CRT vibe ========== */

body::after{
  content:"";
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: 0.04;
  mix-blend-mode: overlay;
  background-image:
    repeating-linear-gradient(
      to bottom,
      rgba(255,255,255,0.03) 0px,
      rgba(255,255,255,0.03) 1px,
      transparent 2px,
      transparent 3px
    );
}
