/* Metamonsters v1 — DS-era UI. No external fonts: system stack only. */
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; background: #0a0e1a; }
body {
  font-family: "Trebuchet MS", "Segoe UI", Verdana, sans-serif;
  color: #f2f6ff; overflow: hidden;
  display: flex; align-items: center; justify-content: center;
}
#game-wrap { position: relative; width: 960px; height: 640px; max-width: 100vw; max-height: 100vh;
  box-shadow: 0 0 60px rgba(30, 80, 200, .45), 0 0 0 4px #1b2a52; background: #000; }
#game { width: 100%; height: 100%; display: block; image-rendering: pixelated; background: #000; }
.hidden { display: none !important; }

/* ---------- HUD ---------- */
#hud { position: absolute; top: 0; left: 0; right: 0; display: flex; justify-content: space-between;
  align-items: center; padding: 8px 12px; pointer-events: none;
  background: linear-gradient(180deg, rgba(6,12,34,.85), rgba(6,12,34,0)); z-index: 5; }
#hud-left, #hud-right { display: flex; gap: 14px; align-items: center; }
#hud-location { font-weight: 800; letter-spacing: 1px; font-size: 15px; color: #ffe9a8;
  text-shadow: 1px 1px 0 #000; }
#hud-mission { font-size: 12px; color: #bcd3ff; text-shadow: 1px 1px 0 #000; max-width: 420px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#hud-cash { font-size: 13px; font-weight: 700; color: #ffd94d; text-shadow: 1px 1px 0 #000; }
#hud-time { font-size: 12px; color: #9fb6e8; }
#hud button { pointer-events: auto; cursor: pointer; border: 2px solid #ffe9a8; border-radius: 6px;
  background: linear-gradient(180deg, #2b4a9e, #16275e); color: #fff; font-weight: 800;
  font-size: 12px; padding: 4px 10px; letter-spacing: 1px; }
#hud button:hover { background: linear-gradient(180deg, #3b5fc0, #1d3478); }

/* ---------- Dialog ---------- */
#dialog { position: absolute; left: 24px; right: 24px; bottom: 18px; z-index: 8;
  background: linear-gradient(180deg, #fdfdf4, #e8ecff);
  border: 3px solid #1b2a52; border-radius: 12px; outline: 3px solid #ffd94d;
  padding: 12px 16px 20px; color: #10182e; min-height: 96px; cursor: pointer;
  box-shadow: 0 8px 24px rgba(0,0,0,.5);
  animation: dialogIn .15s ease-out; }
@keyframes dialogIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
#dialog-name { font-weight: 900; color: #1b3a9e; font-size: 14px; letter-spacing: .5px; margin-bottom: 4px; }
#dialog-text { font-family: "Courier New", monospace; font-size: 16px; line-height: 1.45; font-weight: 700; }
#dialog-hint { position: absolute; right: 14px; bottom: 6px; font-size: 11px; color: #5a6a9e;
  animation: blink 1s steps(2) infinite; }
@keyframes blink { 50% { opacity: 0; } }

/* ---------- Menu panel (DOM) ---------- */
#menu { position: absolute; inset: 0; z-index: 20; background: rgba(4, 8, 24, .82);
  display: flex; align-items: center; justify-content: center; }
.panel { width: 620px; max-width: 92%; max-height: 88%; overflow-y: auto;
  background: linear-gradient(180deg, #fdfdf4 0%, #dfe8ff 100%);
  border: 3px solid #1b2a52; outline: 3px solid #ffd94d; border-radius: 14px;
  color: #10182e; padding: 18px 20px; box-shadow: 0 12px 40px rgba(0,0,0,.6);
  animation: panelIn .18s ease-out; }
@keyframes panelIn { from { opacity: 0; transform: translateY(10px) scale(.98); } to { opacity: 1; transform: none; } }
.panel h2 { color: #1b3a9e; letter-spacing: 1px; font-size: 22px; margin-bottom: 2px; }
.panel h3 { color: #1b3a9e; margin: 14px 0 6px; font-size: 16px; }
.panel .sub { color: #5a6a9e; font-size: 13px; margin-bottom: 10px; }
.panel button, .choice-btn { display: block; width: 100%; text-align: left; cursor: pointer;
  margin: 6px 0; padding: 10px 12px; font-size: 15px; font-weight: 700;
  background: linear-gradient(180deg, #ffffff, #dbe6ff); color: #16275e;
  border: 2px solid #1b2a52; border-radius: 8px; }
.panel button:hover, .choice-btn:hover, .panel button.sel { background: linear-gradient(180deg, #ffe9a8, #ffcf4d);
  border-color: #8a6d00; }
.panel button:disabled { opacity: .45; cursor: default; }
.panel .row { display: flex; gap: 10px; align-items: center; padding: 7px 4px;
  border-bottom: 1px solid #c3d0f2; font-size: 14px; }
.panel .row b { min-width: 150px; }
.panel .bar { flex: 1; height: 12px; background: #b9c6ea; border-radius: 6px; overflow: hidden; }
.panel .bar > div { height: 100%; background: linear-gradient(90deg, #37c978, #1d9e56); }
.panel .hpbar { flex: 1; height: 12px; background: #b9c6ea; border-radius: 6px; overflow: hidden; }
.panel .hpbar > div { height: 100%; background: linear-gradient(90deg, #ff5f5f, #c81e1e); }
.panel .hpbar > div.mid { background: linear-gradient(90deg, #ffcf4d, #e8a100); }
.panel .hpbar > div.high { background: linear-gradient(90deg, #37c978, #1d9e56); }
.panel .close { margin-top: 14px; }
.panel .tag { display: inline-block; font-size: 11px; font-weight: 800; padding: 2px 7px; border-radius: 5px;
  color: #fff; margin-left: 6px; letter-spacing: .5px; }
.moves-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.sprite-thumb { width: 64px; height: 64px; image-rendering: pixelated; object-fit: contain; }
.item-thumb { width: 40px; height: 40px; image-rendering: pixelated; object-fit: contain; }
.stars { color: #e8a100; letter-spacing: 2px; }
.mission-done { color: #1d9e56; font-weight: 800; }
.mission-active { color: #1b3a9e; font-weight: 800; }
.mission-locked { color: #8a97b5; }

/* ---------- Battle UI ---------- */
#battle-ui { position: absolute; left: 0; right: 0; bottom: 0; z-index: 9; }
#battle-log { margin: 0 24px 8px; background: linear-gradient(180deg, #fdfdf4, #e8ecff);
  border: 3px solid #1b2a52; outline: 3px solid #ffd94d; border-radius: 12px;
  color: #10182e; padding: 10px 14px; font-family: "Courier New", monospace;
  font-weight: 700; font-size: 15px; line-height: 1.4; min-height: 52px; }
#battle-actions { margin: 0 24px 14px; display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
#battle-actions button { cursor: pointer; padding: 12px 6px; font-size: 15px; font-weight: 900;
  letter-spacing: 1px; color: #fff; border: 2px solid #ffe9a8; border-radius: 10px;
  background: linear-gradient(180deg, #2b4a9e, #16275e); }
#battle-actions button:hover { background: linear-gradient(180deg, #3b5fc0, #1d3478); }
#battle-actions button:disabled { opacity: .4; cursor: default; }
#battle-actions button.move-btn { background: linear-gradient(180deg, #3a7d2c, #1e4d16); }
#battle-actions button.move-btn:hover { background: linear-gradient(180deg, #4a9a38, #27631c); }
#battle-actions button.back-btn { background: linear-gradient(180deg, #7d3a2c, #4d1e16); }

/* ---------- Title ---------- */
#title-screen { position: absolute; inset: 0; z-index: 30; overflow: hidden; }
#title-bg { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover;
  animation: titleZoom 24s ease-in-out infinite alternate; }
@keyframes titleZoom { from { transform: scale(1); } to { transform: scale(1.07); } }
#title-inner { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center;
  justify-content: center; background: linear-gradient(180deg, rgba(4,8,24,.25), rgba(4,8,24,.55)); }
#title-logo { font-size: 84px; font-weight: 900; letter-spacing: 6px; color: #fff;
  text-shadow: 0 4px 0 #1b3a9e, 0 8px 0 #0c1c4e, 0 12px 24px rgba(0,0,0,.7);
  animation: logoFloat 3.2s ease-in-out infinite; }
@keyframes logoFloat { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-8px); } }
#title-logo span { color: #ffd94d; }
#title-tag { font-size: 17px; color: #ffe9a8; text-shadow: 1px 1px 0 #000; margin: 6px 0 34px; font-style: italic; }
#title-buttons { display: flex; flex-direction: column; gap: 12px; width: 280px; }
#title-buttons button { cursor: pointer; padding: 14px; font-size: 19px; font-weight: 900; letter-spacing: 2px;
  color: #16275e; background: linear-gradient(180deg, #ffe9a8, #ffcf4d);
  border: 3px solid #8a6d00; border-radius: 12px; box-shadow: 0 6px 0 #8a6d00; }
#title-buttons button:hover { transform: translateY(2px); box-shadow: 0 4px 0 #8a6d00; }
#title-buttons button:disabled { opacity: .45; cursor: default; }
#title-foot { margin-top: 26px; font-size: 12px; color: #cdd9f5; text-shadow: 1px 1px 0 #000; }

/* ---------- Toast ---------- */
#toast { position: absolute; top: 120px; left: 50%; transform: translateX(-50%); z-index: 25;
  background: linear-gradient(180deg, #fdfdf4, #e8ecff); color: #10182e; font-weight: 800; font-size: 14px;
  border: 2px solid #1b2a52; outline: 2px solid #ffd94d; border-radius: 10px; padding: 8px 16px;
  box-shadow: 0 6px 20px rgba(0,0,0,.5); }
