* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body {
  margin: 0; padding: 0; height: 100%; overflow: hidden;
  background: #2A1A12;
  color: #2B1B12;
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Helvetica Neue", sans-serif;
  user-select: none; -webkit-user-select: none;
  touch-action: none;
}

.stage {
  position: fixed; inset: 0;
  overflow: hidden;
  background:
    radial-gradient(120% 70% at 50% 0%, #FFD9A8 0%, #FFB877 38%, #FF8A3D 68%, #E96A24 100%);
}

#game {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  display: block;
}

/* ---------- HUD ---------- */
.hud {
  position: absolute; left: 0; right: 0; top: 0;
  padding: calc(env(safe-area-inset-top, 0px) + 12px) 16px 0;
  display: flex; align-items: flex-start; justify-content: space-between;
  pointer-events: none; z-index: 5;
}
.hud-left { display: flex; gap: 8px; }
.hud-right { display: flex; gap: 8px; }

.pill {
  display: inline-flex; align-items: center; gap: 6px;
  height: 38px; padding: 0 14px;
  border-radius: 19px;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: 0 6px 16px rgba(140, 62, 12, 0.22), inset 0 -2px 0 rgba(0, 0, 0, 0.05);
  font-size: 16px; font-weight: 800; letter-spacing: 0.01em;
  color: #7A3A0C;
}
.pill .mp-icon { font-size: 19px; color: #FF8A3D; }
.pill-soft { background: rgba(255, 255, 255, 0.72); font-size: 14px; height: 34px; padding: 0 12px; }
.pill-soft .mp-icon { font-size: 17px; color: #E96A24; }

/* ---------- toast ---------- */
.toast {
  position: absolute; left: 50%; top: 46%;
  transform: translate(-50%, -50%) scale(0.9);
  padding: 10px 20px; border-radius: 14px;
  background: rgba(58, 26, 8, 0.86);
  color: #FFE7C9; font-size: 15px; font-weight: 700;
  opacity: 0; pointer-events: none; z-index: 8;
  transition: opacity 0.18s ease, transform 0.18s ease;
  white-space: nowrap;
}
.toast.show { opacity: 1; transform: translate(-50%, -50%) scale(1); }

/* ---------- panels ---------- */
.panel {
  position: absolute; inset: 0; z-index: 10;
  display: flex; align-items: center; justify-content: center;
  padding: 24px 20px calc(env(safe-area-inset-bottom, 0px) + 24px);
  background: radial-gradient(90% 60% at 50% 40%, rgba(60, 26, 6, 0.34), rgba(40, 16, 4, 0.62));
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
}
.panel.hidden { display: none; }

.panel-card {
  width: 100%; max-width: 360px;
  padding: 26px 22px 22px;
  border-radius: 26px;
  background: linear-gradient(180deg, #FFFDF8 0%, #FFF3E2 100%);
  border: 2px solid rgba(255, 255, 255, 0.9);
  box-shadow: 0 22px 48px rgba(70, 28, 4, 0.42), inset 0 -4px 0 rgba(233, 106, 36, 0.12);
  text-align: center;
  animation: pop 0.28s cubic-bezier(0.2, 1.3, 0.4, 1) both;
}
@keyframes pop {
  from { opacity: 0; transform: translateY(14px) scale(0.94); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.logo {
  width: 68px; height: 68px; margin: -52px auto 10px;
  border-radius: 22px;
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(160deg, #FFB066, #FF8A3D 55%, #E96A24);
  box-shadow: 0 12px 24px rgba(233, 106, 36, 0.45), inset 0 -3px 0 rgba(0, 0, 0, 0.12);
  color: #fff;
}
.logo .mp-icon { font-size: 34px; color: #fff; }
.logo-over { background: linear-gradient(160deg, #FFC46B, #FF8A3D 60%, #D9551A); }

h1 { margin: 0; font-size: 26px; font-weight: 900; letter-spacing: 0.02em; color: #4A2208; }
.tagline { margin: 8px 0 0; font-size: 14px; color: #9A6B45; line-height: 1.5; }

.tips { margin: 18px 0 4px; display: grid; gap: 9px; }
.tip {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px; border-radius: 14px;
  background: rgba(255, 138, 61, 0.1);
  border: 1px solid rgba(255, 138, 61, 0.22);
  font-size: 13px; color: #7A4520; text-align: left; line-height: 1.35;
}
.tip .mp-icon { font-size: 20px; color: #E96A24; flex: 0 0 auto; }

.stats { display: flex; gap: 12px; margin: 18px 0 4px; }
.stat {
  flex: 1; padding: 12px 8px; border-radius: 16px;
  background: rgba(255, 138, 61, 0.1);
  border: 1px solid rgba(255, 138, 61, 0.2);
}
.stat-num { display: block; font-size: 24px; font-weight: 900; color: #E96A24; }
.stat-label { display: block; margin-top: 2px; font-size: 12px; color: #9A6B45; }

.btn-primary {
  width: 100%; margin-top: 18px; height: 54px;
  display: flex; align-items: center; justify-content: center; gap: 8px;
  border: 0; border-radius: 27px;
  background: linear-gradient(180deg, #FFA45C, #FF8A3D 45%, #EE6F22);
  color: #fff; font-size: 17px; font-weight: 800; letter-spacing: 0.04em;
  box-shadow: 0 10px 22px rgba(233, 106, 36, 0.42), inset 0 -3px 0 rgba(0, 0, 0, 0.14);
  transition: transform 0.1s ease, box-shadow 0.1s ease;
  cursor: pointer;
}
.btn-primary .mp-icon { font-size: 22px; color: #fff; }
.btn-primary:active { transform: translateY(2px) scale(0.985); box-shadow: 0 5px 12px rgba(233, 106, 36, 0.36); }

.btn-ghost {
  width: 100%; margin-top: 10px; height: 46px;
  display: flex; align-items: center; justify-content: center; gap: 8px;
  border: 1.5px solid rgba(233, 106, 36, 0.35); border-radius: 23px;
  background: rgba(255, 255, 255, 0.7);
  color: #C4551A; font-size: 14px; font-weight: 700;
  transition: transform 0.1s ease, background 0.1s ease;
  cursor: pointer;
}
.btn-ghost .mp-icon { font-size: 19px; color: #E96A24; }
.btn-ghost:active { transform: scale(0.98); background: rgba(255, 138, 61, 0.16); }

.best-line { margin: 14px 0 0; font-size: 13px; color: #9A6B45; }
.best-line b { color: #E96A24; font-size: 15px; }
