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

html, body {
  height: 100%;
  overflow: hidden;
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
  touch-action: none;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background:
    radial-gradient(circle at 50% -20%, #26263a 0%, #171726 45%, #0e0e18 100%);
  color: #fff;
}

#app {
  position: relative;
  display: flex;
  flex-direction: column;
  height: 100vh;
  max-width: 600px;
  margin: 0 auto;
}

/* floating corner badge */
.ribbon {
  position: absolute;
  top: 12px;
  left: -34px;
  transform: rotate(-45deg);
  background: linear-gradient(180deg, #ff4d4d, #d21f1f);
  color: #fff;
  font-weight: 900;
  font-size: 15px;
  letter-spacing: 1px;
  padding: 5px 44px;
  box-shadow: 0 3px 8px rgba(0,0,0,0.4);
  z-index: 5;
  pointer-events: none;
}

#hud {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px 18px 8px;
  padding-left: 64px;
}

.stat {
  display: flex;
  flex-direction: column;
  line-height: 1.05;
}

.stat .label {
  font-size: 11px;
  letter-spacing: 2px;
  color: #8a8ab0;
  font-weight: 700;
}

.stat .value {
  font-size: 30px;
  font-weight: 900;
  color: #fff;
  text-shadow: 0 2px 6px rgba(0,0,0,0.5);
  font-variant-numeric: tabular-nums;
}

.stat.right { margin-left: auto; }

#sound, #rotate {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: none;
  background: rgba(255,255,255,0.08);
  color: #cfcfff;
  font-size: 19px;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
#sound:active, #rotate:active { background: rgba(255,255,255,0.18); }

#hint {
  text-align: center;
  font-size: 12px;
  color: #8a8ab0;
  padding: 2px 0 10px;
  letter-spacing: 0.5px;
}

#board {
  flex: 1;
  display: block;
  width: 100%;
  touch-action: none;
}

#over {
  position: fixed;
  inset: 0;
  background: rgba(5,5,12,0.72);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 20;
  animation: fade 0.3s ease;
}
#over.hidden { display: none; }

.over-card {
  text-align: center;
  background: linear-gradient(180deg, #232338, #161624);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 18px;
  padding: 32px 44px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.6);
}

.over-card h2 { margin-bottom: 10px; font-size: 30px; }
.over-card p { font-size: 18px; color: #b9b9e0; margin-bottom: 6px; }
.over-card p b { color: #fff; font-size: 30px; display: block; margin: 2px 0 8px; }

.over-card button {
  margin-top: 18px;
  padding: 14px 40px;
  font-size: 18px;
  font-weight: 800;
  color: #fff;
  background: linear-gradient(180deg, #ff8a3d, #ff5f2e);
  border: none;
  border-radius: 12px;
  cursor: pointer;
  box-shadow: 0 5px 0 #b83a12, 0 8px 18px rgba(0,0,0,0.35);
}
.over-card button:active { transform: translateY(4px); box-shadow: 0 1px 0 #b83a12; }

@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
