html,
    body {
      margin: 0;
      padding: 0;
      background: #111;
      color: #fff;
      font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, "Apple Color Emoji", "Segoe UI Emoji";
      height: 100%;
      overflow: hidden;
      -webkit-user-select: none;
      user-select: none;
      -webkit-touch-callout: none;
    }

    #wrap {
      position: fixed;
      inset: 0;
      display: grid;
      place-items: center;
    }

    canvas {
      display: block;
      background: #87ceeb;
      box-shadow: 0 10px 30px rgba(0, 0, 0, .35);
    }

    #ui {
      position: fixed;
      inset: 0;
      pointer-events: none;
      display: flex;
      flex-direction: column;
      align-items: center;
      justify-content: space-between;
      padding: 14px;
      z-index: 100;
    }

    .topbar {
      width: 100%;
      display: flex;
      justify-content: space-between;
      align-items: center;
      font-weight: 700;
      letter-spacing: .02em;
      text-shadow: 0 2px 0 rgba(0, 0, 0, .35);
    }

    .btns {
      display: flex;
      gap: 8px;
    }

    .btn {
      pointer-events: auto;
      -webkit-tap-highlight-color: transparent;
      border: none;
      border-radius: 10px;
      padding: 10px 14px;
      background: #222;
      color: #fff;
      font-weight: 700;
    }

    .btn:active {
      transform: translateY(1px);
    }

    #overlay {
      position: fixed;
      inset: 0;
      display: grid;
      place-items: center;
      background: rgba(0, 0, 0, .55);
      pointer-events: auto;
    }

    .card {
      width: min(92vw, 520px);
      background: #1c1c1c;
      border-radius: 16px;
      padding: 24px;
      box-shadow: 0 10px 30px rgba(0, 0, 0, .5);
      text-align: center;
      box-sizing: border-box;
    }

    .title {
      font-size: clamp(20px, 4vw, 28px);
      font-weight: 800;
      margin-bottom: 10px;
    }

    .sub {
      opacity: .9;
      line-height: 1.6;
    }

    .cta {
      margin-top: 18px;
      display: inline-flex;
      gap: 10px;
    }

    .cta .btn {
      font-size: 16px;
      padding: 12px 18px;
    }

    .hint {
      font-size: 12px;
      opacity: .8;
      margin-top: 10px;
    }

    #gameOverOverlay {
      position: fixed;
      inset: 0;
      background: rgba(255, 182, 193, 0.3);
      display: grid;
      place-items: center;
      z-index: 20;
      backdrop-filter: blur(3px);
    }

    #gameOverOverlay.hidden {
      display: none;
    }

    #gameOverOverlay .card {
      background: #ffebf2;
      color: #d81b60;
      border-radius: 20px;
      padding: 30px;
      text-align: center;
      box-shadow: 0 6px 30px rgba(0, 0, 0, 0.35);
    }

    #gameOverOverlay .title {
      font-size: 28px;
      font-weight: 800;
      margin-bottom: 10px;
    }

    #gameOverOverlay .sub {
      font-size: 18px;
      font-weight: 700;
      margin-bottom: 20px;
    }

    #gameOverOverlay .cta .btn {
      background: #f06292;
      color: #fff;
      border: none;
      border-radius: 10px;
      padding: .85rem 1rem;
      font-size: .85rem;
      margin: 0 6px;
      font-weight: 700;
      pointer-events: auto;
      transition: background 0.2s;
    }

    #gameOverOverlay .cta .btn:hover {
      background: #ec407a;
    }

    #gameOverOverlay .hint {
      margin-top: 15px;
      font-size: 13px;
      opacity: 0.8;
    }

    #countdownOverlay {
      position: fixed;
      inset: 0;
      background: rgba(0, 0, 0, 0.4);
      display: grid;
      place-items: center;
      z-index: 30;
    }

    #countdownOverlay.hidden {
      display: none;
    }

    #countdownText {
      font-size: 80px;
      font-weight: 900;
      color: #ffffff;
      text-shadow: 4px 4px 0 rgba(0, 0, 0, 0.6);
      font-family: system-ui, sans-serif;
    }

    #realtimeViewers {
      margin-top: 1rem;
      font-size: .85rem;
      color: rgb(238, 158, 171);
    }

    /* 無敵時のフラッシュ演出 */
    @keyframes flash {
      0% {
        opacity: 1;
        filter: brightness(1);
      }

      50% {
        opacity: 0.5;
        filter: brightness(2);
      }

      100% {
        opacity: 1;
        filter: brightness(1);
      }
    }

    .flash {
      animation: flash 0.2s ease-in-out 3;
    }
  
