:root {
  --bg: #1a1a2e;
  --panel: #16213e;
  --panel2: #1c2a4a;
  --border: #2a3f5f;
  --text: #e0e0e0;
  --muted: #8090a0;
  --hp: #e04040;
  --ep: #4080e0;
  --gold: #f0c040;
}
* { box-sizing: border-box; margin: 0; }
body { min-height: 100vh; background: var(--bg); color: var(--text); font-family: 'Segoe UI', Arial, sans-serif; }

.app { max-width: 1200px; margin: 0 auto; padding: 10px; }

.header { text-align: center; padding: 10px; background: var(--panel); border: 1px solid var(--border); border-radius: 4px; margin-bottom: 10px; }
.header h1 { font-size: 18px; letter-spacing: 2px; }

.layout { display: grid; grid-template-columns: 160px 1fr 200px; gap: 10px; }

.sidebar { display: flex; flex-direction: column; gap: 8px; }
.box { background: var(--panel); border: 1px solid var(--border); border-radius: 4px; padding: 10px; }
.boxTitle { font-size: 11px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: 1px; margin-bottom: 6px; }
.bigNum { font-size: 24px; font-weight: 800; text-align: center; }

.statRow { display: flex; align-items: center; gap: 6px; font-size: 13px; margin-bottom: 4px; }
.statRow strong { margin-left: auto; }
.statIcon { font-size: 14px; }

.hpBar, .epBar { height: 8px; background: #333; border-radius: 4px; margin: 4px 0 8px; overflow: hidden; }
.hpFill { height: 100%; width: 100%; background: var(--hp); transition: width 0.2s; border-radius: 4px; }
.epFill { height: 100%; width: 100%; background: var(--ep); transition: width 0.2s; border-radius: 4px; }

select { width: 100%; height: 30px; background: var(--panel2); color: var(--text); border: 1px solid var(--border); border-radius: 3px; padding: 0 6px; font-size: 12px; }
button { width: 100%; height: 34px; background: var(--panel2); color: var(--text); border: 1px solid var(--border); border-radius: 4px; font-weight: 700; font-size: 12px; cursor: pointer; text-transform: uppercase; letter-spacing: 1px; }
button:hover { background: #2a4a6a; border-color: #4a7aaa; }
button.active { background: #2a5a3a; border-color: #4a9a6a; }

.gameArea { background: #0a0a14; border: 1px solid var(--border); border-radius: 4px; min-height: 500px; display: flex; align-items: center; justify-content: center; overflow: hidden; padding: 0; }
#gameCanvas { display: block; width: 100%; height: 100%; min-height: 500px; image-rendering: pixelated; image-rendering: crisp-edges; background: #0a0a14; }
#minimap { display: block; width: 100%; height: 80px; image-rendering: pixelated; background: #0a0a14; border-radius: 3px; }

.logBox { flex: 1; min-height: 0; }
.logList { max-height: 160px; overflow-y: auto; font-size: 11px; color: #a0b0b8; line-height: 1.5; }
.logList div { padding: 2px 0; border-bottom: 1px solid rgba(255,255,255,0.03); }

.legend { display: flex; flex-wrap: wrap; gap: 12px; justify-content: center; margin-top: 10px; padding: 10px; background: var(--panel); border: 1px solid var(--border); border-radius: 4px; }
.legendItem { display: flex; align-items: center; gap: 5px; font-size: 12px; color: var(--muted); }
.li-icon { width: 18px; height: 18px; border-radius: 3px; display: inline-block; }
.player-icon { background: #5588ff; }
.enemy-icon { background: #88aa44; }
.boss-icon { background: #cc3333; }
.trap-icon { background: #886633; }
.heal-icon { background: #ee4466; }
.key-icon { background: #f0c040; }
.chest-icon { background: #aa7733; }
.door-icon { background: #666688; }

@media (max-width: 800px) {
  .layout { grid-template-columns: 1fr; }
  .sidebar { flex-direction: row; flex-wrap: wrap; }
  .sidebar .box { flex: 1; min-width: 140px; }
  .gameArea { min-height: 350px; }
}
