:root {
  --bg: #0b1020;
  --panel: rgba(0,0,0,0.6);
  --accent: #2ee6a3;
  --text: #dfefff;
}

/* ------------------------------------------------------------- */
/* BASE LAYOUT                                                   */
/* ------------------------------------------------------------- */

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  background: var(--bg);
  font-family: monospace;
  color: var(--text);
  overflow: hidden;
}

.hidden {
  display: none !important;
}

#game-wrapper {
  width: 100%;
  height: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
}

#c {
  width: 100%;
  max-width: 800px;
  height: auto;
  background: black;
  touch-action: none;
}

canvas {
  image-rendering: pixelated;
}

/* ------------------------------------------------------------- */
/* MOBILE D-PAD                                                  */
/* ------------------------------------------------------------- */

#control-bar {
  position: fixed;
  bottom: 12px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 12px;
  z-index: 9999;
}

#control-bar button {
  width: 48px;
  height: 48px;
  border-radius: 10px;
  font-size: 20px;
  font-weight: bold;
  border: none;
  background: rgba(255,255,255,0.22);
  color: white;
}

#btn-e {
  background: rgba(46,230,163,0.45);
  width: 55px !important;
  height: 55px !important;
  font-size: 22px !important;
}

/* Hide controls on desktop */
@media (pointer:fine) {
  #control-bar { display: none; }
}

/* ------------------------------------------------------------- */
/* UNIVERSAL MOBILE KEYBOARD BUTTON STYLE                        */
/* ------------------------------------------------------------- */

.mobile-kb button {
  background: #222;
  border: 1px solid #444;
  color: white;
  border-radius: 6px;
  padding: 6px 6px;
  font-size: 12px;
}

.mobile-kb button.wide {
  padding: 6px 6px;
  font-size: 12px;
}

/* Invisible placeholder key */
.mobile-kb button.blank {
  opacity: 0;
  pointer-events: none;
}

/* ------------------------------------------------------------- */
/* LANDSCAPE KEYBOARD (alphabetical, 19 keys per row)            */
/* ------------------------------------------------------------- */

#kb-landscape {
  position: fixed;
  bottom: 0;
  left: 0;
  width: 100%;
  background: transparent;
  padding: 6px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  z-index: 99999;
}

/* Top control row */
#kb-landscape .top-row {
  display: flex;
  align-items: center;
  gap: 6px;
}

#kb-landscape .kb-spacer {
  flex: 1;
}

/* Letter / number rows */
#kb-landscape .keys-row {
  display: flex;
  justify-content: center;
  gap: 6px;
}

/* Hide in portrait */
@media screen and (max-aspect-ratio: 11/10) {
  #kb-landscape {
    display: none !important;
  }
}

/* Hide on desktop */
@media (pointer:fine) {
  #kb-landscape {
    display: none !important;
  }
}

/* ------------------------------------------------------------- */
/* PORTRAIT KEYBOARD (compact 10-wide)                           */
/* ------------------------------------------------------------- */

#kb-portrait {
  position: fixed;
  bottom: 0;
  left: 0;
  width: 100%;
  background: transparent;
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 5px;
  z-index: 99999;
}

#kb-portrait .kb-row {
  display: flex;
  justify-content: center;
  gap: 5px;
}

/* Landscape hides portrait */
@media screen and (min-aspect-ratio: 11/10) {
  #kb-portrait {
    display: none !important;
  }
}

/* Hide on desktop */
@media (pointer:fine) {
  #kb-portrait {
    display: none !important;
  }
}
