@font-face { font-family: 'dos'; src: local('Menlo'); }

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  height: 100%;
  background: #0a0a12;
  color: #e8e0c8;
  font-family: "Menlo", "Consolas", monospace;
  overflow: hidden;
}

#app {
  position: relative;
  width: 1280px;
  max-width: 100vw;
  margin: 0 auto;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}

#game {
  image-rendering: pixelated;
  width: 1280px;
  max-width: 100vw;
  max-height: 100vh;
  aspect-ratio: 4 / 3;
  background: #000;
}

.screen {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 18px;
  background: radial-gradient(ellipse at 50% 30%, #232338 0%, #0a0a12 75%);
  z-index: 10;
  overflow-y: auto;
  padding: 20px;
}
#menu {
  background:
    linear-gradient(rgba(8, 8, 14, 0.82), rgba(8, 8, 14, 0.93)),
    url('../assets/gfx/title.png') center / cover no-repeat;
  image-rendering: pixelated;
}
.screen.hidden { display: none; }

.title-box { text-align: center; }
h1 {
  font-size: 64px;
  letter-spacing: 6px;
  color: #ffcc33;
  text-shadow: 4px 4px 0 #7a2020, 8px 8px 0 #000;
}
.subtitle { color: #999; margin-top: 8px; }

h2 { color: #ffcc33; letter-spacing: 3px; margin-bottom: 8px; }

.menu-buttons { display: flex; flex-direction: column; gap: 10px; }

button {
  font-family: inherit;
  font-size: 15px;
  background: #2a2a40;
  color: #e8e0c8;
  border: 2px solid #555;
  border-bottom-color: #222;
  border-right-color: #222;
  padding: 8px 22px;
  cursor: pointer;
  letter-spacing: 1px;
}
button:hover { background: #3d3d5c; color: #ffcc33; }
button.big { font-size: 19px; padding: 12px 34px; border-color: #ffcc33; }
button:disabled { opacity: .45; cursor: default; }

.options-panel {
  background: #14141f;
  border: 2px solid #444;
  padding: 16px 22px;
  max-width: 760px;
}
.opt-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px 18px;
}
.opt-grid label { display: flex; flex-direction: column; font-size: 12px; color: #aaa; gap: 3px; }
input, select {
  font-family: inherit;
  font-size: 14px;
  background: #000;
  color: #e8e0c8;
  border: 1px solid #555;
  padding: 4px 6px;
}
.keys-help { margin-top: 12px; font-size: 12px; color: #888; }
.keys-help b { color: #ffcc33; }

.dialog {
  background: #14141f;
  border: 3px solid #ffcc33;
  padding: 28px 40px;
  text-align: center;
  min-width: 420px;
}
.dialog p { margin: 8px 0; color: #bbb; }
.row { display: flex; gap: 12px; justify-content: center; margin-top: 14px; }

.pg-head { font-size: 12px; color: #888; letter-spacing: 2px; margin-top: 4px; }
#public-games {
  min-height: 56px;
  max-height: 220px;
  overflow-y: auto;
  border: 1px solid #333;
  background: #0c0c14;
  margin: 6px 0 12px 0;
  padding: 4px;
}
.pg-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 6px 10px;
  border-bottom: 1px solid #22222e;
  font-size: 14px;
}
.pg-row:last-child { border-bottom: none; }
.pg-name { color: #ffcc33; }
.pg-info { color: #8a8; font-size: 12px; }
.pg-row button { padding: 4px 14px; font-size: 13px; border-color: #7fff5c; color: #7fff5c; }
.pg-row button:hover { background: #1e3a1e; }
.pg-empty { padding: 12px; }

#join-code {
  font-size: 42px;
  width: 190px;
  text-align: center;
  text-transform: uppercase;
  letter-spacing: 10px;
  margin: 10px 0;
}
.room-code-label { font-size: 12px; color: #888; margin-bottom: 0; }
.room-code {
  font-size: 56px;
  letter-spacing: 14px;
  color: #7fff5c;
  text-shadow: 3px 3px 0 #143a0a;
  margin: 4px 0 6px 0;
}
.hint { font-size: 12px; }
#lobby-players { list-style: none; margin: 14px 0; }
#lobby-players li { font-size: 18px; padding: 4px; }
.status { min-height: 20px; color: #ff7f66; font-size: 13px; }

/* ------- shop: original 640x480 frame, scaled to fit ------- */
#shop { padding: 0; gap: 0; background: #000; }
#shop-fit { position: relative; overflow: hidden; }
#shop-stage {
  position: absolute; left: 0; top: 0;
  width: 640px; height: 480px;
  transform-origin: 0 0;
  background: url('../assets/gfx/shopframe.png') 0 0 / 640px 480px no-repeat;
  image-rendering: pixelated;
  font-size: 8px; line-height: 1;
}
#shop-stage > * { position: absolute; }
.sb {
  height: 8px; padding: 0 2px; overflow: hidden; white-space: nowrap;
  font-size: 7px; line-height: 8px; color: #e8e0c8;
}
#sb-name  { left: 33px; top: 15px; width: 179px; }
#sb-dig   { left: 33px; top: 29px; width: 63px; }
#sb-cash  { left: 33px; top: 42px; width: 63px; color: #ffd24a; }
#sb-items { left: 33px; top: 57px; width: 63px; }
#sb-rname  { left: 453px; top: 15px; width: 179px; }
#sb-rdig   { left: 453px; top: 29px; width: 63px; }
#sb-rcash  { left: 453px; top: 42px; width: 63px; color: #ffd24a; }
#sb-ritems { left: 453px; top: 57px; width: 63px; }
#shop-level {
  left: 288px; top: 50px; width: 64px; height: 45px;
  display: flex; align-items: center; justify-content: center; text-align: center;
  font-size: 7px; color: #7fff5c; letter-spacing: 0.5px;
}
#shop-rounds {
  left: 292px; top: 117px; width: 56px; height: 13px;
  display: flex; align-items: center; justify-content: center;
  font-size: 9px; color: #ffd24a; font-weight: bold;
}
.shop-panel {
  top: 96px; width: 255px; height: 336px;
  display: grid; grid-template-rows: repeat(14, 1fr);
  overflow: hidden;
}
#shop-left  { left: 33px; }
#shop-right { left: 353px; }
.shop-item {
  display: grid; grid-template-columns: 24px 1fr 34px 22px; align-items: center; gap: 3px;
  padding: 0 3px 0 1px; cursor: pointer;
  border-bottom: 1px solid #1c1c1c;
  color: #5fe05f;
}
.shop-item:hover { background: #2a2a2a; }
.shop-item.cant { color: #3a6a3a; }
.shop-item.cant .si-price { color: #a04040; }
.shop-item.have .si-name { color: #b8ffb8; }
.shop-item .si-icon { width: 22px; height: 22px; image-rendering: pixelated; display: block; }
.shop-item .si-name { font-size: 7.5px; letter-spacing: 0.2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; text-transform: uppercase; }
.shop-item .si-price { font-size: 7.5px; text-align: right; color: #ffd24a; }
.shop-item .si-owned { font-size: 7.5px; text-align: right; color: #66bfff; }
#shop-bottom {
  left: 0; top: 438px; width: 640px; height: 42px;
  padding: 2px 14px 0; display: grid; grid-template-columns: 1fr auto; grid-template-rows: auto auto; column-gap: 12px;
  color: #ccc; font-size: 7px; line-height: 1.35;
}
#shop-hint { grid-column: 1; color: #e8e0c8; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#shop-inv  { grid-column: 1; color: #9a9a9a; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#shop-foot { grid-column: 2; grid-row: 1 / span 2; display: flex; align-items: center; gap: 8px; }
#shop-foot .status { font-size: 7px; color: #7fff5c; margin: 0; }
#shop-foot button.big { font-size: 9px; padding: 4px 12px; }
#results-body { margin: 16px 0; font-size: 17px; line-height: 2; }
#results-body .r-row { display: flex; justify-content: space-between; gap: 40px; }
#results-body .winner { color: #7fff5c; }
