@font-face {
  font-family: "PixelJP";
  src: local("MS Gothic");
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: #000;
  color: #fff;
  font-family: "MS Gothic", "PixelJP", monospace;
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
}

#game {
  width: 480px;
  position: relative;
  user-select: none;
}

#statusBar {
  background: #1a1a6c;
  border: 3px solid #fff;
  padding: 4px 8px;
  font-size: 12px;
}

#statusBar .goldLine {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 2px;
}

#statusBar .partyRow {
  padding: 1px 0;
}

#statusBar .partyRow.fainted {
  opacity: 0.5;
}

.muteBtnInline {
  font-size: 11px;
  padding: 1px 6px;
  margin: 0;
}

#exploreScreen {
  border-left: 3px solid #fff;
  border-right: 3px solid #fff;
  line-height: 0;
}

#exploreScreen canvas {
  display: block;
  width: 100%;
  background: #063;
  image-rendering: pixelated;
}

#messageBox {
  background: #1a1a6c;
  border: 3px solid #fff;
  min-height: 60px;
  padding: 8px 10px;
  font-size: 14px;
  line-height: 1.5;
  white-space: pre-wrap;
}

.hidden { display: none !important; }

#battleScreen {
  background: #300;
  border-left: 3px solid #fff;
  border-right: 3px solid #fff;
  padding: 10px;
  min-height: 320px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}

#enemyArea {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  margin-top: 10px;
}

#enemyAvatar {
  width: 120px;
  height: 120px;
  image-rendering: pixelated;
}

#enemyName { font-size: 15px; }

#battleActor {
  font-size: 13px;
  min-height: 16px;
}

#enemyHpBarOuter {
  width: 140px;
  height: 10px;
  border: 2px solid #fff;
  background: #400;
}
#enemyHpBarInner {
  height: 100%;
  background: #e33;
  width: 100%;
  transition: width 0.2s;
}

#battleMenu, #subMenu {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  width: 220px;
}

button {
  background: #1a1a6c;
  color: #fff;
  border: 3px solid #fff;
  font-family: inherit;
  font-size: 14px;
  padding: 8px 4px;
  cursor: pointer;
}
button:hover { background: #33339c; }
button:disabled { opacity: 0.4; cursor: default; }

#townScreen {
  background: #1a2a1a;
  border-left: 3px solid #fff;
  border-right: 3px solid #fff;
  padding: 14px 10px;
  min-height: 320px;
}

.townTitle {
  font-size: 16px;
  margin-bottom: 10px;
  text-align: center;
}

.townInfo {
  font-size: 13px;
  margin: 8px 0 4px;
}

.townMenuGrid, #townSub button {
  width: 100%;
}

.townMenuGrid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
}

#townSub button {
  display: block;
  margin-bottom: 6px;
  text-align: left;
}

#titleScreen {
  background: linear-gradient(#0a1a3a, #163a5a);
  border: 3px solid #fff;
  padding: 40px 20px 20px;
  min-height: 560px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  text-align: center;
}

#titleScreen h1 {
  font-size: 30px;
  letter-spacing: 4px;
  margin: 20px 0 4px;
  color: #ffdc8a;
  text-shadow: 2px 2px 0 #000;
}

.titleSub {
  font-size: 13px;
  color: #cde;
  margin-bottom: 40px;
}

#titleButtons {
  display: flex;
  flex-direction: column;
  gap: 12px;
  width: 200px;
}

#titleButtons button {
  padding: 12px 4px;
}

.muteBtn {
  background: transparent;
  border: 2px solid #fff;
  font-size: 12px;
  padding: 4px 8px;
  margin-top: 30px;
}


.adSlot {
  margin-top: 30px;
  width: 100%;
  max-width: 100%;
  min-height: 4px;
  overflow-x: auto;
}
.adSlot > div, .adSlot iframe, .adSlot table {
  max-width: 100%;
}

.adLabel {
  display: inline-block;
  font-size: 10px;
  color: #333;
  background: #ffdc8a;
  padding: 1px 6px;
  border-radius: 2px;
  margin-bottom: 4px;
  letter-spacing: 1px;
}

.goodsSection {
  margin-top: 18px;
  width: 100%;
  max-width: 100%;
}

.goodsRow {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding-bottom: 6px;
}

.goodsRow img {
  width: 64px;
  height: 64px;
  object-fit: cover;
  border: 2px solid #fff;
  display: block;
}

#gameOverScreen {
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.9);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  text-align: center;
  padding: 20px;
  overflow-y: auto;
}
