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

html, body {
  height: 100%;
  background: #05081a;
  color: #e8ecff;
  font-family: "Hiragino Maru Gothic ProN", "Hiragino Sans", "Noto Sans JP", "Yu Gothic", sans-serif;
  overflow: hidden;
  overscroll-behavior: none;
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
  -webkit-tap-highlight-color: transparent;
}

#app {
  display: flex;
  flex-direction: column;
  height: 100vh;
  height: 100dvh;
  max-width: 560px;
  margin: 0 auto;
  background: #0b1026;
}

#stage {
  position: relative;
  flex: 1;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

#game {
  display: block;
  touch-action: none;
}

#controls {
  display: flex;
  gap: 14px;
  padding: 14px 14px calc(14px + env(safe-area-inset-bottom));
  background: linear-gradient(#141a3a, #0b1026);
  border-top: 2px solid #232b5c;
}

.ctrl {
  flex: 1;
  height: 92px;
  border: none;
  border-radius: 22px;
  font: inherit;
  font-size: 26px;
  font-weight: bold;
  color: #fff;
  background: linear-gradient(#5b6bd6, #3f4bb0);
  box-shadow: 0 6px 0 #252d73, 0 10px 18px rgba(0, 0, 0, 0.4);
  touch-action: none;
  cursor: pointer;
  transition: transform 0.05s, box-shadow 0.05s;
}

.ctrl.jump {
  background: linear-gradient(#ff9a5c, #f0663a);
  box-shadow: 0 6px 0 #a33a1c, 0 10px 18px rgba(0, 0, 0, 0.4);
}

.ctrl.pressed {
  transform: translateY(5px);
  box-shadow: 0 1px 0 #252d73, 0 4px 8px rgba(0, 0, 0, 0.4);
}

.ctrl.jump.pressed {
  box-shadow: 0 1px 0 #a33a1c, 0 4px 8px rgba(0, 0, 0, 0.4);
}

.overlay {
  position: absolute;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(5, 8, 26, 0.62);
  backdrop-filter: blur(2px);
  z-index: 10;
}

.overlay.show {
  display: flex;
  animation: fadein 0.35s ease-out;
}

@keyframes fadein {
  from { opacity: 0; transform: scale(0.96); }
  to { opacity: 1; transform: scale(1); }
}

.panel {
  width: min(86%, 380px);
  padding: 28px 22px 24px;
  text-align: center;
  background: linear-gradient(#1d2554, #121838);
  border: 2px solid #3a4590;
  border-radius: 24px;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.5);
}

.emoji-hero {
  font-size: 54px;
  line-height: 1.1;
  margin-bottom: 6px;
  animation: bob 2.4s ease-in-out infinite;
}

@keyframes bob {
  50% { transform: translateY(-6px) rotate(-6deg); }
}

h1 {
  font-size: 44px;
  letter-spacing: 2px;
  color: #ffe9a8;
  text-shadow: 0 3px 0 #a3742a, 0 0 18px rgba(255, 220, 140, 0.4);
  margin-bottom: 14px;
}

h2 {
  font-size: 26px;
  color: #ffe9a8;
  margin-bottom: 18px;
}

h2 + .distance-label {
  margin-top: -6px;
}

.distance-label {
  font-size: 14px;
  color: #b9c1f0;
}

.distance {
  font-size: 52px;
  font-weight: bold;
  line-height: 1.15;
  color: #fff;
  text-shadow: 0 0 18px rgba(255, 220, 140, 0.35);
}

.record {
  display: none;
  margin: 2px 0 6px;
  font-size: 18px;
  font-weight: bold;
  color: #ffd76a;
  animation: pulse 0.8s ease-in-out infinite alternate;
}

.record.show {
  display: block;
}

@keyframes pulse {
  to { transform: scale(1.08); }
}

.distance + .record:not(.show) + .result {
  margin-top: 10px;
}

.panel p {
  font-size: 17px;
  line-height: 1.6;
  margin-bottom: 18px;
}

.panel p.hint {
  font-size: 12px;
  color: #9aa3d6;
  margin: 16px 0 0;
}

.result {
  margin: 0 auto 20px;
  border-collapse: collapse;
  font-size: 17px;
}

.result th {
  text-align: left;
  font-weight: normal;
  color: #b9c1f0;
  padding: 4px 18px 4px 0;
}

.result td {
  text-align: right;
  font-weight: bold;
  padding: 4px 0;
}

.btn-main {
  min-width: 200px;
  padding: 14px 28px;
  border: none;
  border-radius: 999px;
  font: inherit;
  font-size: 22px;
  font-weight: bold;
  color: #2a1a00;
  background: linear-gradient(#ffe48a, #f5b942);
  box-shadow: 0 5px 0 #a3742a, 0 8px 16px rgba(0, 0, 0, 0.4);
  cursor: pointer;
}

.btn-main:active {
  transform: translateY(4px);
  box-shadow: 0 1px 0 #a3742a;
}

@media (hover: none) {
  .pc-only { display: none; }
}
