@charset "UTF-8";
:root { --gold: #ffd36b; --green: #8bd34f; --red: #ff7b7b; }
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body {
  margin: 0; height: 100%; overflow: hidden; color: #f6efe0;
  background: radial-gradient(ellipse at 50% 15%, #2c4220 0%, #16210f 58%, #0a0f07 100%) #16210f;
  font-family: system-ui, "Segoe UI", Roboto, sans-serif; touch-action: none; user-select: none; -webkit-user-select: none;
}
button { font-family: inherit; cursor: pointer; }
body { display: flex; flex-direction: column; }

header, footer {
  display: flex; align-items: center; justify-content: center; gap: 6px; flex: none;
  padding-left: calc(8px + env(safe-area-inset-left)); padding-right: calc(8px + env(safe-area-inset-right));
}
header { padding-top: calc(7px + env(safe-area-inset-top)); padding-bottom: 4px; }
footer { padding-top: 4px; padding-bottom: calc(7px + env(safe-area-inset-bottom)); }

.stat {
  background: linear-gradient(180deg, rgba(60, 40, 18, .55), rgba(25, 16, 6, .55));
  border: 1px solid rgba(255, 211, 107, .3); border-radius: 10px;
  padding: 3px 9px; min-width: 58px; text-align: center; box-shadow: 0 2px 8px rgba(0, 0, 0, .25);
}
.stat .label { display: block; font-size: 10px; opacity: .72; text-transform: uppercase; letter-spacing: .5px; }
.stat b { font-size: 16px; color: var(--gold); text-shadow: 0 1px 0 rgba(0, 0, 0, .6); font-variant-numeric: tabular-nums; }
.stat.gold b::before { content: '💰'; font-size: 12px; margin-right: 3px; }
.stat.hearts b { color: var(--red); }
.stat.hearts b::before { content: '❤'; font-size: 12px; margin-right: 3px; }
.stat.hit { animation: hit .45s; }
@keyframes hit { 0%, 100% { transform: none; } 25% { transform: translateX(-3px); background: rgba(200, 40, 40, .6); } 60% { transform: translateX(3px); } }

header button, .tbtn {
  background: linear-gradient(180deg, rgba(255, 255, 255, .12), rgba(255, 255, 255, .04)); color: #fff;
  border: 1px solid rgba(255, 255, 255, .18); border-radius: 10px; padding: 8px 10px; font-size: 14px; font-weight: 700;
}
.tbtn { padding: 9px 14px; white-space: nowrap; }
.tbtn.go {
  background: linear-gradient(135deg, #ffe08a, #ffb347 60%, #ff8a3d); color: #2a1700; border: none;
  box-shadow: 0 0 14px rgba(255, 190, 80, .45); text-shadow: 0 1px 0 rgba(255, 255, 255, .35);
}
.tbtn.go.wait { background: rgba(255, 255, 255, .08); color: #e9dcc0; box-shadow: none; text-shadow: none; border: 1px solid rgba(255, 255, 255, .15); }
.tbtn[disabled] { cursor: default; }
#btn-speed.on { background: linear-gradient(135deg, #8bd34f, #3fae6a); border-color: transparent; color: #0f2208; }
button:active { transform: translateY(1px); }

.preview {
  flex: 0 1 auto; min-width: 0; display: flex; align-items: center; gap: 6px; overflow: hidden;
  font-size: 13px; background: rgba(0, 0, 0, .22); border-radius: 10px; padding: 4px 8px; border: 1px solid rgba(255, 255, 255, .08);
}
.preview .pv-l { opacity: .8; white-space: nowrap; font-weight: 700; }
.preview .pv-l.boss { color: #ff8a7a; }
.preview .pv { display: inline-flex; align-items: center; gap: 1px; white-space: nowrap; font-weight: 700; font-variant-numeric: tabular-nums; }
.preview img { width: 24px; height: 24px; display: block; }

#wrap {
  flex: 1; min-height: 0; display: flex; align-items: center; justify-content: center;
  padding: 2px calc(4px + env(safe-area-inset-right)) 2px calc(4px + env(safe-area-inset-left));
}
#board {
  display: block; border-radius: 12px; touch-action: none;
  box-shadow: 0 0 0 2px #4a3216, 0 0 0 4px rgba(255, 211, 107, .35), 0 14px 40px rgba(0, 0, 0, .6);
}

.overlay {
  position: fixed; inset: 0; background: rgba(8, 10, 4, .62); display: flex; align-items: center; justify-content: center;
  padding: 16px; z-index: 10; backdrop-filter: blur(2px); -webkit-backdrop-filter: blur(2px);
}
.panel {
  background: linear-gradient(180deg, rgba(58, 40, 20, .97), rgba(26, 18, 9, .97));
  border: 1px solid rgba(255, 211, 107, .45); border-radius: 16px; padding: 18px 20px;
  max-width: 480px; width: 100%; text-align: center; max-height: calc(100% - 8px); overflow-y: auto;
  box-shadow: 0 0 0 3px rgba(0, 0, 0, .25), 0 20px 60px rgba(0, 0, 0, .6);
}
.panel h1 { margin: 0 0 6px; font-size: 27px; color: #ffe7a6; text-shadow: 0 2px 0 #6b3d10, 0 0 16px rgba(255, 190, 80, .45); }
#ov-text { line-height: 1.5; opacity: .95; margin: 6px 0; font-size: 14.5px; }
#ov-text p { margin: 6px 0; }
.panel kbd {
  background: rgba(255, 255, 255, .12); border: 1px solid rgba(255, 255, 255, .25); border-bottom-width: 2px;
  border-radius: 5px; padding: 0 5px; font-size: 12px; font-family: inherit;
}
.maps { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 10px 0; }
.map-card {
  background: rgba(0, 0, 0, .3); border: 2px solid rgba(255, 255, 255, .12); border-radius: 12px; padding: 5px 5px 6px;
  color: #fff; display: flex; flex-direction: column; align-items: center; gap: 2px; font-size: 13px; min-width: 0;
}
.map-card img { width: 100%; aspect-ratio: 960 / 528; border-radius: 8px; display: block; background: #314a22; }
.map-card small { opacity: .75; font-size: 11px; }
.map-card.sel { border-color: var(--gold); box-shadow: 0 0 14px rgba(255, 211, 107, .45); background: rgba(255, 211, 107, .1); }
.foes { display: grid; grid-template-columns: 1fr 1fr; gap: 3px 10px; text-align: left; font-size: 12.5px; margin: 8px 0 2px; }
.foes span { display: flex; align-items: center; gap: 5px; line-height: 1.25; }
.foes img { width: 26px; height: 26px; flex: none; }
.alt { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; margin-top: 10px; }
.ghost {
  background: rgba(255, 255, 255, .08); color: #fff; border: 1px solid rgba(255, 255, 255, .22);
  border-radius: 10px; padding: 8px 14px; font-size: 14px; font-weight: 700;
}
#ov-stats { display: flex; gap: 8px; justify-content: center; margin: 10px 0; flex-wrap: wrap; }
.primary {
  background: linear-gradient(135deg, #ffe08a, #ffb347 55%, #ff8a3d); color: #2a1700; border: none; border-radius: 12px;
  padding: 12px 30px; font-size: 17px; font-weight: 800; margin-top: 6px; text-shadow: 0 1px 0 rgba(255, 255, 255, .4);
  box-shadow: 0 0 18px rgba(255, 180, 70, .45);
}
.primary:active { transform: translateY(1px); }
.hidden { display: none !important; }

@media (max-width: 400px) {
  header, footer { gap: 4px; }
  .stat { min-width: 50px; padding: 3px 6px; }
  .stat b { font-size: 14.5px; }
  header button { padding: 7px 8px; }
  .tbtn { padding: 9px 10px; font-size: 13px; }
  .preview { padding: 3px 6px; gap: 4px; font-size: 12px; }
  .preview img { width: 20px; height: 20px; }
  .panel { padding: 16px 14px; }
}
/* điện thoại nằm ngang: dồn HUD sang hai bên để sân chơi rộng hơn */
@media (orientation: landscape) and (max-height: 520px) {
  body { flex-direction: row; }
  header, footer { flex-direction: column; width: 96px; justify-content: center; }
  header { padding: calc(6px + env(safe-area-inset-top)) 4px 6px calc(6px + env(safe-area-inset-left)); }
  footer { padding: 6px calc(6px + env(safe-area-inset-right)) calc(6px + env(safe-area-inset-bottom)) 4px; }
  .stat { width: 100%; min-width: 0; padding: 2px 4px; }
  .stat b { font-size: 14px; }
  header button, .tbtn { width: 100%; padding: 7px 4px; font-size: 13px; white-space: normal; }
  .preview { flex-direction: column; flex-wrap: nowrap; width: 100%; padding: 4px; gap: 2px; }
  .preview .pv-l { white-space: normal; text-align: center; }
  #wrap { padding: 4px 2px; }
}
