* { box-sizing: border-box; }
body {
  margin: 0;
  background: #0d1117;
  color: #e6edf3;
  font-family: "Courier New", monospace;
  display: flex;
  justify-content: center;
}
#wrap { width: 840px; padding: 16px; text-align: center; position: relative; }
#stage { position: relative; width: 800px; margin: 0 auto; }
h1 { margin: 8px 0 0; letter-spacing: 1px; }
#tagline { opacity: 0.7; margin: 4px 0 12px; }
#hud {
  display: flex; gap: 16px; justify-content: center;
  background: #161b22; border: 1px solid #30363d;
  padding: 8px; margin-bottom: 8px; font-size: 15px;
}
#game {
  background: #111;
  border: 2px solid #30363d;
  image-rendering: pixelated;
  width: 800px; height: 600px;
  touch-action: none;
}
#overlay {
  position: absolute; left: -40px; right: -40px; top: -30px; bottom: -30px;
  display: flex; align-items: flex-start; justify-content: center;
  overflow-y: auto;
  background: rgba(0,0,0,0.86); z-index: 10;
}
#overlay.hidden { display: none; }
#overlayBox {
  background: #161b22; border: 2px solid #58a6ff;
  padding: 18px 24px; width: 720px; max-width: 96%;
  margin: auto;
}
#controls { font-size: 13px; opacity: 0.9; }
#records { margin-top: 12px; font-size: 13px; line-height: 1.5; }
#touch { display: none; }
body.touch #touch {
  display: flex; justify-content: space-between; align-items: center;
  margin: 8px auto 0;
}
#joy {
  width: 120px; height: 120px; border: 2px solid #30363d; border-radius: 50%;
  background: #161b22; position: relative; touch-action: none;
}
#stick {
  width: 48px; height: 48px; border-radius: 50%;
  background: #58a6ff; position: absolute; left: 36px; top: 36px;
}
#tbtns { display: flex; gap: 8px; }
#tbtns button { padding: 16px 14px; font-size: 14px; margin-top: 0; touch-action: none; }
#game, #mascot, #paperdoll, #joy { touch-action: none; }
.menuHead { display: flex; gap: 14px; align-items: center; justify-content: center; }
.menuHead h2 { margin: 0; }
.tagline { opacity: 0.8; font-style: italic; }
.menuMain { display: flex; gap: 16px; align-items: flex-start; justify-content: center; margin-top: 12px; }
.menuBtns { min-width: 320px; }
.menuSide { display: flex; flex-direction: column; align-items: center; gap: 8px; }
.menuSide #records { margin-top: 0; font-size: 12px; text-align: center; }
button.big { display: block; width: 100%; margin: 8px 0; font-size: 17px; }
button.back { background: #30363d; margin-top: 12px; }
button.back:hover { background: #484f58; }
.screen { animation: fadein 0.25s ease; }
@keyframes fadein { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; } }
#mascot { background: transparent; border: none; width: 160px; height: 208px; }
.menuHead h2 { margin: 0; font-size: 22px; }
#logo { width: 64px; height: 64px; border: 2px solid #58a6ff; }
button.big { display: block; width: 100%; margin: 8px 0; font-size: 17px; padding: 12px 20px; transition: transform 0.12s ease, background 0.12s ease; }
button.big.pressed { transform: scale(0.94); background: #f0b429; color: #000; }
#controls { font-size: 12px; opacity: 0.85; margin: 8px 0 0; }
.dim { opacity: 0.7; font-size: 13px; }
.cat { margin: 8px 0 4px; font-size: 13px; opacity: 0.85; text-transform: uppercase; letter-spacing: 1px; }
.blocks { display: grid; grid-template-columns: repeat(4, 68px); gap: 10px; justify-content: center; min-height: 60px; margin: 4px 0 8px; }
.tab { background: #0d1117; border: 2px solid #30363d; color: #e6edf3; padding: 8px 14px; font-size: 14px; font-family: inherit; cursor: pointer; margin: 0; }
.tab.sel { border-color: #58a6ff; box-shadow: 0 0 8px #58a6ff; }
.block { width: 68px; height: 60px; background: #0d1117; border: 2px solid #30363d; cursor: pointer; padding: 0; margin: 0; display: flex; align-items: center; justify-content: center; font-size: 22px; color: #888; }
.block.sel { border-color: #58a6ff; box-shadow: 0 0 8px #58a6ff; color: #fff; }
.block canvas { image-rendering: pixelated; }
#nickInput { width: 200px; text-align: center; font-size: 15px; font-family: inherit; background: #0d1117; color: #fff; border: 1px solid #30363d; padding: 8px; margin-bottom: 8px; }
#controls-touch { display: none; }
body.touch #controls-touch { display: inline; }
body.touch #controls-pc { display: none; }
body.touch #set-touch { display: block; }
body.touch #set-pc { display: none; }
.row { display: flex; gap: 8px; justify-content: center; margin: 8px 0; }
#roomCode { width: 90px; text-align: center; font-size: 16px; font-family: inherit; background: #0d1117; color: #fff; border: 1px solid #30363d; padding: 8px; text-transform: uppercase; }
#bandana { font-size: 14px; font-family: inherit; background: #0d1117; color: #fff; border: 1px solid #30363d; padding: 6px; }
#overlayBox.wide .menuBtns { flex: 1; min-width: 0; }
#overlayBox.wide #mascot { display: none; }
#paperdoll { width: 100%; max-width: 540px; height: auto; border: 1px solid #30363d; background: #0d1117; cursor: pointer; display: block; margin: 0 auto; }
#roomMsg { min-height: 20px; color: #ffcc00; }
#roomList { max-height: 130px; overflow-y: auto; margin: 6px 0; }
.room { display: flex; justify-content: space-between; align-items: center; background: #0d1117; border: 1px solid #30363d; padding: 6px 10px; margin: 4px 0; }
.room button { margin: 0; padding: 6px 12px; font-size: 13px; }
#roomWho { margin: 6px 0; font-size: 14px; }
label { display: block; margin: 8px 0; }
#overlayBox { max-width: 640px; }
button {
  background: #238636; color: #fff; border: 0;
  padding: 12px 24px; font-size: 16px; cursor: pointer;
  font-family: inherit; margin-top: 8px;
}
button:hover { background: #2ea043; }
#foot { opacity: 0.5; font-size: 12px; margin-top: 12px; }
