*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  background: #0F1117;
  color: #fff;
  font-family: system-ui, sans-serif;
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100vh;
  overflow: hidden;
  touch-action: none;
}

#app {
  position: relative;
  width: min(520px, 100vw);
  height: min(680px, 100vh);
}

canvas {
  display: block;
  width: 100%;
  height: 100%;
  border-radius: 12px;
  background: #1A1D27;
}

#hud {
  position: absolute;
  top: 0; left: 0; right: 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 14px;
  background: rgba(15,17,23,0.82);
  border-radius: 12px 12px 0 0;
  font-size: 13px;
  font-weight: 600;
  pointer-events: none;
  z-index: 5;
}

#overlay {
  position: absolute;
  inset: 0;
  background: rgba(15,17,23,0.93);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  border-radius: 12px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s;
  z-index: 10;
}
#overlay.active { opacity: 1; pointer-events: all; }

h1 { font-size: 2.4rem; font-weight: 800; }
h2 { font-size: 1.6rem; font-weight: 800; margin-bottom: 8px; }
p { color: #aaa; text-align: center; line-height: 1.6; }
.hint { font-size: 12px; color: #555; }

button {
  background: #305CDE;
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 12px 40px;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.2s, transform 0.1s;
}
button:hover { background: #4a70e8; transform: translateY(-2px); }

#scorecard {
  position: absolute;
  inset: 0;
  background: rgba(15,17,23,0.96);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  border-radius: 12px;
  z-index: 10;
  padding: 24px;
}
#scorecard.hidden { display: none; }

table {
  border-collapse: collapse;
  width: 100%;
  font-size: 13px;
}
th, td {
  border: 1px solid rgba(255,255,255,0.1);
  padding: 6px 10px;
  text-align: center;
}
th { background: rgba(48,92,222,0.3); font-weight: 700; }
.under { color: #4caf50; }
.over { color: #f44336; }
.even { color: #fff; }
.ace { color: #FFD700; font-weight: 700; }

#finalResult {
  font-size: 1.1rem;
  font-weight: 700;
  text-align: center;
  color: #FFD700;
}
