* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: #f3ecdf; color: #2c2420; }
body {
  font-family: ui-rounded, "Segoe UI", system-ui, sans-serif;
  touch-action: none;
  overscroll-behavior: none;
}
#app {
  height: 100dvh;
  display: flex;
  flex-direction: column;
  padding: env(safe-area-inset-top) 12px env(safe-area-inset-bottom);
  max-width: 520px;
  margin: 0 auto;
}
header {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 48px;
  padding: 6px 2px;
}
.title { font-weight: 700; letter-spacing: -0.02em; }
#level { font-size: 13px; color: #6e6256; }
#hearts { color: #c4553a; letter-spacing: 2px; font-size: 18px; }
#score { margin-left: auto; font-variant-numeric: tabular-nums; font-weight: 650; }
header button, #play, #restart, #bomb, .dpad button {
  border: 0;
  background: #fff8ee;
  color: #2c2420;
  border-radius: 999px;
  font: inherit;
  font-weight: 650;
}
header button { min-height: 36px; padding: 0 10px; }
#board-wrap {
  flex: 1;
  min-height: 0;
  border-radius: 18px;
  overflow: hidden;
  background: #efe2cf;
}
canvas { display: block; width: 100%; height: 100%; }
.controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 4px 8px;
  gap: 12px;
}
.dpad {
  display: grid;
  grid-template-columns: 56px 56px 56px;
  grid-template-rows: 56px 56px 56px;
  gap: 6px;
}
.dpad button { width: 56px; height: 56px; border-radius: 16px; font-size: 22px; }
.dpad button[data-dir="up"] { grid-column: 2; grid-row: 1; }
.dpad button[data-dir="left"] { grid-column: 1; grid-row: 2; }
.dpad button[data-dir="right"] { grid-column: 3; grid-row: 2; }
.dpad button[data-dir="down"] { grid-column: 2; grid-row: 3; }
.dpad button[data-dir="up"]::after { content: "↑"; }
.dpad button[data-dir="down"]::after { content: "↓"; }
.dpad button[data-dir="left"]::after { content: "←"; }
.dpad button[data-dir="right"]::after { content: "→"; }
#bomb {
  width: 88px;
  height: 88px;
  border-radius: 50%;
  background: #c4553a;
  color: #fff8ee;
  font-size: 18px;
  box-shadow: 0 8px 0 #8d3a28;
}
#bomb:active, .dpad button:active { transform: translateY(2px); }
#overlay {
  position: fixed;
  inset: 0;
  background: rgba(44, 36, 32, 0.46);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 18px;
  padding-bottom: calc(18px + env(safe-area-inset-bottom));
}
#overlay[hidden] { display: none; }
.card {
  width: min(440px, 100%);
  background: #fff8ee;
  border-radius: 24px;
  padding: 22px 20px 18px;
}
h1 { margin: 0 0 8px; font-size: 32px; letter-spacing: -0.03em; }
.lead { margin: 0 0 16px; font-size: 18px; line-height: 1.35; }
#play, #restart {
  width: 100%;
  min-height: 52px;
  font-size: 18px;
  border-radius: 16px;
}
#play { background: #c4553a; color: #fff8ee; }
#restart {
  margin-top: 8px;
  background: transparent;
  color: #6e6256;
  min-height: 40px;
}
#sh-auth { margin-top: 12px; }
.hint { margin: 14px 0 0; color: #6e6256; font-size: 14px; line-height: 1.4; }
