/* paper.io 2 風 — ライトテーマ */
* { box-sizing: border-box; }
html, body {
  margin: 0; padding: 0;
  height: 100%;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Hiragino Sans', system-ui, sans-serif;
  background: #f8fafc;
  color: #0f172a;
  overscroll-behavior: none;
  -webkit-tap-highlight-color: transparent;
}
body { overflow: hidden; }

.screen {
  position: fixed; inset: 0;
  display: flex; flex-direction: column;
}
.hidden { display: none !important; }

/* ---- Menu ---- */
#menu-screen {
  background: linear-gradient(180deg, #f8fafc 0%, #e2e8f0 100%);
  align-items: center;
  overflow: auto;
  padding: 16px;
}
.menu-header { text-align: center; margin: 16px 0 8px; }
.menu-header h1 {
  font-size: 28px; margin: 0;
  background: linear-gradient(90deg, #3b82f6, #ec4899);
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent;
}
.tagline { color: #64748b; margin: 4px 0 0; font-size: 13px; }

.menu-card {
  width: min(520px, 100%);
  background: #fff;
  border-radius: 14px;
  padding: 18px;
  box-shadow: 0 10px 30px -10px rgba(15, 23, 42, .15);
  margin: 12px 0;
}
.menu-card h3 {
  font-size: 14px; font-weight: 600;
  margin: 18px 0 8px;
  color: #475569;
  text-transform: uppercase;
  letter-spacing: .04em;
}
.row {
  display: flex; align-items: center;
  justify-content: space-between;
  padding: 8px 0;
  border-bottom: 1px solid #f1f5f9;
}
.row:last-of-type { border-bottom: none; }
.row label { color: #64748b; font-size: 13px; font-weight: 500; }
.row input {
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  padding: 6px 10px;
  font-size: 14px;
  width: 120px;
  text-align: right;
  background: #f8fafc;
}
.row input:focus { outline: none; border-color: #3b82f6; background: #fff; }

/* skin grid */
.skin-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(96px, 1fr));
  gap: 8px;
}
.skin {
  display: flex; flex-direction: column; align-items: center;
  gap: 4px;
  background: #f8fafc;
  border: 2px solid transparent;
  border-radius: 10px;
  padding: 10px 6px;
  cursor: pointer;
  transition: all .15s;
  font: inherit;
}
.skin:hover { background: #f1f5f9; }
.skin.selected { border-color: #3b82f6; background: #eff6ff; }
.skin.locked { opacity: .55; cursor: not-allowed; }
.swatch { width: 40px; height: 40px; border-radius: 50%; border: 3px solid; }
.skin-name { font-size: 11px; color: #475569; font-weight: 500; }
.skin-lock { font-size: 10px; color: #94a3b8; }

.lb-panel {
  background: #f8fafc;
  border-radius: 10px;
  padding: 10px 14px;
  min-height: 60px;
}
.lb-panel ol { margin: 0; padding-left: 18px; font-size: 13px; }
.lb-panel li { display: flex; justify-content: space-between; padding: 3px 0; }
.muted { color: #94a3b8; font-size: 13px; margin: 0; }

.actions {
  display: flex; gap: 8px;
  margin-top: 16px;
  flex-wrap: wrap;
}
button.primary, button.secondary, button.ghost {
  padding: 10px 16px;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  font-family: inherit;
}
button.primary { background: #3b82f6; color: #fff; flex: 1; }
button.primary:hover { background: #2563eb; }
button.secondary { background: #e2e8f0; color: #0f172a; flex: 1; }
button.secondary:hover { background: #cbd5e1; }
button.ghost { background: transparent; border: 1px solid #cbd5e1; }

.menu-footer { text-align: center; font-size: 11px; color: #94a3b8; margin: 8px 0; }

/* ---- Ad slots ---- */
.ad-slot {
  width: min(728px, 100%);
  background: repeating-linear-gradient(
    45deg, #f1f5f9, #f1f5f9 10px, #e2e8f0 10px, #e2e8f0 20px
  );
  border: 1px dashed #cbd5e1;
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  margin: 8px 0;
}
.ad-top, .ad-bottom { height: 80px; }
.ad-result { height: 120px; margin-top: 16px; }
.ad-placeholder { font-size: 11px; color: #94a3b8; letter-spacing: .05em; }

/* ---- Game screen ---- */
#game-screen { background: #f8fafc; }
#game-canvas { position: absolute; inset: 0; width: 100%; height: 100%; }
.hud {
  position: absolute;
  top: 12px; left: 12px; right: 12px;
  display: flex; align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  pointer-events: none;
}
.hud-left { display: flex; flex-wrap: wrap; gap: 6px; }
.badge {
  background: rgba(255, 255, 255, .9);
  border-radius: 8px;
  padding: 5px 10px;
  font-size: 12px;
  display: flex; flex-direction: column;
  box-shadow: 0 2px 8px -2px rgba(15, 23, 42, .1);
}
.badge span { font-size: 10px; color: #64748b; text-transform: uppercase; }
.badge b { font-size: 14px; }

.live-lb {
  list-style: none;
  margin: 0; padding: 6px;
  background: rgba(255, 255, 255, .9);
  border-radius: 8px;
  font-size: 11px;
  min-width: 130px;
}
.live-lb li { display: flex; align-items: center; gap: 6px; padding: 2px 4px; }
.live-lb li.me { font-weight: 700; }
.live-lb li.dead { opacity: .4; text-decoration: line-through; }
.live-lb .dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }
.live-lb .name { flex: 1; }
.live-lb .pct { font-variant-numeric: tabular-nums; }

.minimap {
  background: rgba(255, 255, 255, .9);
  border-radius: 8px;
  box-shadow: 0 2px 8px -2px rgba(15, 23, 42, .1);
}

/* ---- Joystick ---- */
.joystick {
  position: absolute;
  bottom: 24px; left: 24px;
  width: 110px; height: 110px;
  border-radius: 50%;
  background: rgba(15, 23, 42, .15);
  display: none;
  touch-action: none;
}
.joystick .knob {
  position: absolute;
  top: 50%; left: 50%;
  width: 50px; height: 50px;
  margin: -25px 0 0 -25px;
  border-radius: 50%;
  background: rgba(255, 255, 255, .9);
  box-shadow: 0 4px 12px -2px rgba(15, 23, 42, .2);
  transition: transform .05s;
}
@media (pointer: coarse) {
  .joystick { display: block; }
}

/* ---- Result ---- */
#result-screen {
  background: rgba(15, 23, 42, .55);
  align-items: center;
  justify-content: center;
}
.result-card {
  width: min(420px, 92%);
  background: #fff;
  border-radius: 14px;
  padding: 24px;
  box-shadow: 0 30px 60px -20px rgba(15, 23, 42, .3);
}
.result-card h2 { margin: 0 0 12px; }
.result-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin: 16px 0;
}
.result-stats > div {
  background: #f8fafc;
  border-radius: 8px;
  padding: 10px 14px;
  display: flex; flex-direction: column;
}
.result-stats > div span { font-size: 11px; color: #64748b; }
.result-stats > div b { font-size: 18px; }
.result-stats .big {
  grid-column: 1 / -1;
  background: linear-gradient(90deg, #eff6ff, #fef3c7);
}
.result-stats .big b { font-size: 24px; color: #2563eb; }
.unlocks {
  background: #fef3c7; border-radius: 8px;
  padding: 8px 12px; font-size: 13px;
  color: #92400e;
}
.rank {
  background: #eff6ff; border-radius: 8px;
  padding: 8px 12px; font-size: 13px;
}
