    }

    html, body {
      height: 100%;
    }

    body {
      font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
      background: linear-gradient(135deg, #0f0c29 0%, #1a1a3e 50%, #24243e 100%);
      height: 100vh;
      height: 100dvh;
      min-height: 100vh;
      min-height: 100dvh;
      display: flex;
      align-items: center;
      justify-content: center;
      padding: 10px 12px calc(10px + env(safe-area-inset-bottom));
      color: #fff;
      overflow: hidden;
      user-select: none;
      -webkit-user-select: none;
      -webkit-tap-highlight-color: transparent;
    }

    .game-container {
      height: 100%;
      width: 100%;
      max-width: 640px;
      min-height: 0;
      display: flex;
      flex-direction: column;
      align-items: stretch;
      gap: 10px;
    }

    h1 {
      flex: none;
      font-size: clamp(1.05rem, 3.4vh, 2rem);
      font-weight: 800;
      text-align: center;
      letter-spacing: 1px;
    }

    h1 span {
      background: linear-gradient(90deg, #4ecdc4, #44a08d);
      -webkit-background-clip: text;
      -webkit-text-fill-color: transparent;
      background-clip: text;
    }

    .score-panel {
      flex: none;
      display: flex;
      justify-content: space-between;
      align-items: center;
      gap: 10px;
      width: 100%;
      background: rgba(255, 255, 255, 0.05);
      backdrop-filter: blur(10px);
      border-radius: 16px;
      padding: 8px 16px;
      border: 1px solid rgba(255, 255, 255, 0.1);
    }

    .score-item {
      text-align: center;
      min-width: 0;
    }

    .score-label {
      font-size: 0.7rem;
      text-transform: uppercase;
      letter-spacing: 1.5px;
      color: #888;
      margin-bottom: 2px;
    }

    .score-value {
      font-size: 1.4rem;
      font-weight: 700;
      line-height: 1.2;
    }

    .score-value.current {
      color: #4ecdc4;
    }

    .score-value.high {
      color: #fbbf24;
    }

    .score-value.bump {
      animation: bump 0.2s ease;
    }

    .difficulty-btn {
      font-size: 0.8rem;
      font-weight: 600;
      color: #c4b5fd;
      background: rgba(139, 92, 246, 0.2);
      border: none;
      padding: 6px 12px;
      border-radius: 10px;
      cursor: pointer;
      transition: all 0.2s;
      white-space: nowrap;
    }

    .difficulty-btn:hover {
      background: rgba(139, 92, 246, 0.35);
      color: #ddd6fe;
    }

    .play-row {
      flex: 1 1 auto;
      min-height: 0;
      display: flex;
      flex-direction: column;
      gap: 10px;
    }

    .canvas-wrapper {
      flex: 1 1 auto;
      min-height: 0;
      min-width: 0;
      display: flex;
      align-items: center;
      justify-content: center;
      position: relative;
      overflow: hidden;
    }

    canvas {
      display: block;
      position: absolute;
      top: 50%;
      left: 50%;
      transform: translate(-50%, -50%);
      aspect-ratio: 1 / 1;
      border-radius: 16px;
      border: 2px solid rgba(255, 255, 255, 0.1);
      box-shadow: 0 20px 60px rgba(78, 205, 196, 0.1);
      cursor: pointer;
      touch-action: none;
    }

    .controls {
      flex: none;
      display: flex;
      flex-direction: column;
      gap: 10px;
    }

    .action-buttons {
      display: flex;
      gap: 8px;
      justify-content: center;
      flex-wrap: wrap;
    }

    .action-btn {
      padding: 10px 18px;
      border: none;
      border-radius: 12px;
      font-size: 0.9rem;
      font-weight: 600;
      font-family: inherit;
      cursor: pointer;
      transition: all 0.2s;
      display: flex;
      align-items: center;
      gap: 6px;
    }

    .action-btn:disabled {
      opacity: 0.4;
      cursor: default;
    }

    .btn-pause {
      background: rgba(78, 205, 196, 0.2);
      color: #4ecdc4;
      border: 1px solid rgba(78, 205, 196, 0.3);
    }

    .btn-pause:hover:not(:disabled) {
      background: rgba(78, 205, 196, 0.35);
    }

    .btn-restart {
      background: rgba(251, 191, 36, 0.2);
      color: #fbbf24;
      border: 1px solid rgba(251, 191, 36, 0.3);
    }

    .btn-restart:hover {
      background: rgba(251, 191, 36, 0.35);
    }

    .btn-mute {
      background: rgba(255, 255, 255, 0.08);
      color: #e5e7eb;
      border: 1px solid rgba(255, 255, 255, 0.15);
      padding: 10px 14px;
    }

    .btn-mute:hover {
      background: rgba(255, 255, 255, 0.16);
    }

    .dpad {
      display: none;
      grid-template-areas:
        ". up ."
        "left . right"
        ". down .";
      grid-template-columns: repeat(3, 54px);
      grid-template-rows: repeat(3, 54px);
      gap: 6px;
      justify-content: center;
    }

    .dpad-btn {
      width: 54px;
      height: 54px;
      border-radius: 14px;
      border: 1px solid rgba(255, 255, 255, 0.15);
      background: rgba(255, 255, 255, 0.07);
      color: #fff;
      font-size: 1.3rem;
      display: flex;
      align-items: center;
      justify-content: center;
      cursor: pointer;
      transition: background 0.15s, border-color 0.15s, transform 0.15s;
      touch-action: none;
      -webkit-tap-highlight-color: transparent;
    }

    .dpad-btn:active {
      background: rgba(78, 205, 196, 0.3);
      border-color: rgba(78, 205, 196, 0.5);
      transform: scale(0.92);
    }

    .dpad-up { grid-area: up; }
    .dpad-down { grid-area: down; }
    .dpad-left { grid-area: left; }
    .dpad-right { grid-area: right; }

    /* Modal */
    .modal-overlay {
      display: flex;
      position: fixed;
      inset: 0;
      background: rgba(0, 0, 0, 0.7);
      backdrop-filter: blur(4px);
      z-index: 100;
      align-items: center;
      justify-content: center;
    }

    .modal-overlay.hidden {
      display: none;
    }

    .modal {
      background: #1e1e3f;
      border: 1px solid rgba(255, 255, 255, 0.1);
      border-radius: 20px;
      padding: 22px 24px;
      width: 90%;
      max-width: 320px;
      max-height: calc(100% - 24px);
      overflow-y: auto;
      box-sizing: border-box;
      text-align: center;
    }

    .modal h2 {
      margin-bottom: 20px;
      font-size: 1.3rem;
    }

    .modal-options {
      display: flex;
      flex-direction: column;
      gap: 10px;
    }

    .modal-option {
      padding: 12px;
      border: 1px solid rgba(255, 255, 255, 0.1);
      border-radius: 12px;
      background: rgba(255, 255, 255, 0.05);
      color: #fff;
      font-family: inherit;
      font-size: 1rem;
      font-weight: 600;
      cursor: pointer;
      transition: all 0.2s;
    }

    .modal-option:hover {
      background: rgba(78, 205, 196, 0.15);
      border-color: rgba(78, 205, 196, 0.3);
    }

    .modal-option.selected {
      background: rgba(78, 205, 196, 0.2);
      border-color: #4ecdc4;
      color: #4ecdc4;
    }

    .modal-close {
      margin-top: 16px;
      padding: 10px 24px;
      border: none;
      border-radius: 10px;
      background: rgba(255, 255, 255, 0.1);
      color: #fff;
      font-family: inherit;
      font-size: 0.9rem;
      cursor: pointer;
      transition: background 0.2s;
    }

    .modal-close:hover {
      background: rgba(255, 255, 255, 0.2);
    }

    .hint {
      flex: none;
      font-size: 0.75rem;
      color: #666;
      text-align: center;
    }

    .gg-note {
      flex: none;
      font-size: 0.75rem;
      color: #4ecdc4;
      text-align: center;
      min-height: 1rem;
    }

    @media (max-width: 700px), (hover: none) and (pointer: coarse) {
      .dpad {
        display: grid;
      }
    }

    @media (hover: none) and (pointer: coarse) {
      .score-panel {
        backdrop-filter: none;
        -webkit-backdrop-filter: none;
        background: rgba(26, 26, 56, 0.92);
      }
      .modal-overlay {
        backdrop-filter: none;
        -webkit-backdrop-filter: none;
        background: rgba(0, 0, 0, 0.85);
      }
      canvas {
        box-shadow: none;
      }
      .live-record {
        box-shadow: none;
        animation: none;
      }
    }

    @media (max-width: 380px) {
      .score-panel { padding: 6px 10px; gap: 6px; }
      .score-value { font-size: 1.1rem; }
      .dpad { grid-template-columns: repeat(3, 48px); grid-template-rows: repeat(3, 48px); }
      .dpad-btn { width: 48px; height: 48px; }
    }

    @media (max-height: 560px) {
      h1 { display: none; }
      .hint { display: none; }
      .score-panel { padding: 6px 12px; }
      .score-value { font-size: 1.1rem; }
      .score-label { font-size: 0.6rem; }
      .dpad { grid-template-columns: repeat(3, 46px); grid-template-rows: repeat(3, 46px); }
      .dpad-btn { width: 46px; height: 46px; font-size: 1.15rem; }
      .controls { gap: 8px; }
    }

    @media (orientation: portrait) and (max-height: 700px) {
      body { padding: 6px 8px calc(6px + env(safe-area-inset-bottom)); }
      .game-container { gap: 6px; }
      h1 { display: none; }
      .hint { display: none; }
      .score-panel { padding: 5px 10px; gap: 6px; }
      .score-label { font-size: 0.6rem; letter-spacing: 1px; }
      .score-value { font-size: 1.05rem; }
      .difficulty-btn { font-size: 0.72rem; padding: 5px 9px; }
      .play-row { gap: 6px; }
      .controls { gap: 6px; }
      .action-btn { padding: 7px 12px; font-size: 0.8rem; }
      .dpad { grid-template-columns: repeat(3, 42px); grid-template-rows: repeat(3, 42px); gap: 5px; }
      .dpad-btn { width: 42px; height: 42px; font-size: 1.05rem; border-radius: 12px; }
      .gg-note { font-size: 0.68rem; min-height: 0.8rem; }
    }

    @media (orientation: landscape) and (max-height: 560px) {
      .game-container { max-width: 1000px; }
      .play-row { flex-direction: row; align-items: stretch; }
      .controls {
        width: 176px;
        flex: none;
        justify-content: center;
      }
      .action-btn { padding: 8px 10px; }
      .action-btn span { display: none; }
      .action-btn { font-size: 1.15rem; }
      .dpad { grid-template-columns: repeat(3, 48px); grid-template-rows: repeat(3, 48px); }
      .dpad-btn { width: 48px; height: 48px; }
    }

    @keyframes bump {
      50% { transform: scale(1.15); }
    }

    /* --- floating live-record badge над канвасом --- */
    .canvas-wrapper { position: relative; }
    .live-record {
      position: absolute; top: 16px; left: 50%; transform: translateX(-50%);
      z-index: 6; pointer-events: none;
      padding: 6px 14px; border-radius: 999px;
      background: linear-gradient(135deg, #f59e0b, #ef4444);
      color: #fff; font-weight: 800; font-size: 14px; letter-spacing: .06em;
      box-shadow: 0 4px 18px rgba(239, 68, 68, .45);
      animation: pulse-record 1s ease-in-out infinite;
    }
    @keyframes pulse-record {
      0%, 100% { transform: translateX(-50%) scale(1); }
      50% { transform: translateX(-50%) scale(1.08); }
    }
    /* --- подсказки сложности в модалке --- */
    .modal-option .opt-hint {
      display: block; margin-top: 4px;
      font-size: 12px; opacity: .65; font-style: normal;
    }

/* --- общее правило скрытия (раньше отсутствовало!) --- */
.hidden { display: none !important; }
