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

:root { --bg: #F3F1EF; }

html,
body {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: var(--bg);
  overscroll-behavior: none;
  touch-action: none;
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
  -webkit-tap-highlight-color: transparent;
}

canvas {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  touch-action: none;
  cursor: grab;
}
canvas:active { cursor: grabbing; }

/* WebGL2 非対応時 */
.fallback {
  display: none;
  position: fixed;
  inset: 0;
  place-items: center;
  font-family: "Fredoka", "Arial Rounded MT Bold", system-ui, sans-serif;
  font-weight: 600;
  font-size: min(15vw, 30vh);
  color: #fff;
  text-shadow: 0 .04em .12em rgba(80, 90, 120, .25);
  pointer-events: none;
}
.no-gl .fallback { display: grid; }
.no-gl canvas { display: none; }

/* 縦向きのときだけ出す「横に回す」アイコン */
.rotate {
  position: fixed;
  right: max(16px, env(safe-area-inset-right));
  bottom: max(16px, env(safe-area-inset-bottom));
  width: 40px;
  height: 40px;
  fill: none;
  stroke: rgba(255, 255, 255, .95);
  stroke-width: 2.2;
  stroke-linecap: round;
  stroke-linejoin: round;
  filter: drop-shadow(0 1px 3px rgba(60, 70, 100, .35));
  pointer-events: none;
  opacity: 0;
  transition: opacity .6s ease;
}
.rotate rect { animation: tilt 2.4s ease-in-out infinite; transform-origin: 24px 21px; }

@keyframes tilt {
  0%, 25%   { transform: rotate(0deg); }
  55%, 85%  { transform: rotate(-90deg); }
  100%      { transform: rotate(0deg); }
}

@media (orientation: portrait) and (pointer: coarse) {
  .rotate { opacity: 1; }
  .touched .rotate { opacity: 0; }
}

@media (prefers-reduced-motion: reduce) {
  .rotate rect { animation: none; }
}
