* { 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: fixed; inset: 0;
  display: flex; align-items: flex-start; justify-content: center;
  overflow-y: auto; padding: 24px 12px;
  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; }
button.mini-gray { background: #30363d; font-size: 12px; padding: 6px 12px; margin-top: 10px; opacity: 0.8; }
button.mini-gray:hover { background: #484f58; }
button.mini-gray.armed { background: #7a1f1f; opacity: 1; }
.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; }
.twoCol { display: flex; gap: 24px; justify-content: center; }
.twoCol > div { text-align: left; }
.sdate { font-size: 11px; opacity: 0.65; }
.recRow { white-space: nowrap; }
.endRow { display: flex; gap: 16px; align-items: center; justify-content: center; margin: 8px 0; }
#endart { border: 1px solid #30363d; background: #0d1117; width: 300px; height: 170px; }
#endStats { text-align: left; font-size: 14px; line-height: 1.7; min-width: 170px; }
#recBanner { font-weight: bold; color: #ffcc00; font-size: 16px; min-height: 22px; animation: fadein 0.4s ease; }
#statsBox { text-align: left; font-size: 14px; line-height: 1.7; }
.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; }
#bandana { font-size: 14px; font-family: inherit; background: #0d1117; color: #fff; border: 1px solid #30363d; padding: 6px; }
#overlayBox.wide { width: 920px; max-width: 98%; }
#overlayBox.wide .menuBtns { flex: 1; min-width: 0; }
.customRow { display: flex; gap: 14px; align-items: flex-start; justify-content: center; }
.customLeft { min-width: 290px; }
#scr-custom #paperdoll { max-width: 430px; }
#itemTabs { flex-wrap: wrap; }
#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; }
#overlay.transparent { background: rgba(0,0,0,0.25); pointer-events: none; }
#overlay.transparent #overlayBox { pointer-events: auto; }
#overlay.transparent #overlayBox { background: transparent; border: none; width: auto; max-width: 96%; }
.lobbyRow { display: flex; gap: 12px; justify-content: center; margin: 8px 0; }
.lobbySide { background: #161b22; border: 1px solid #30363d; padding: 12px 16px; min-width: 200px; text-align: center; }
.lobbyTitle { text-align: center; letter-spacing: 2px; margin: 4px 0 10px; }
#lobbyWho .nick { font-weight: bold; }
#lobbyWho .nick.ready { color: #00ff88; text-shadow: 0 0 8px #00ff88; }
#btnNetStart2 { margin-top: 10px; }
#btnNetStart2.waiting { background: #484f58; animation: pulse-gray 1.6s infinite; }
@keyframes pulse-gray { 0%,100% { opacity: 0.65; } 50% { opacity: 1; } }
#overlay.transparent .menuMain { align-items: flex-start; }
#overlay.transparent .menuSide, #overlay.transparent #controls { display: none; }
#roomMsg { min-height: 20px; color: #ffcc00; }
#roomList { max-height: 180px; overflow-y: auto; margin: 6px 0; }
#roomCode { width: 150px; text-align: center; font-size: 18px; font-family: inherit; background: #0d1117; color: #fff; border: 1px solid #30363d; padding: 10px; text-transform: uppercase; letter-spacing: 2px; }
#btnNetStart2.armed2 { background: #f0b429; color: #000; }
.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: 11px; margin-top: 6px; }
