
    * {
      box-sizing: border-box;
    }
    html, body {
      height: 100%;
    }
    body {
      margin: 0;
      padding: 0;
      background: radial-gradient(circle at top, #020617 0%, #020617 55%, #000013 100%);
      color: #e5e7eb;
      font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    }
    .game-wrapper {
      width: 100%;
      height: 100%;
      margin: 0;
      background: rgba(15,23,42,0.92);
      border-radius: 12px;
      border: 1px solid #1f2937;
      box-shadow:
        0 18px 38px rgba(15,23,42,0.85),
        0 0 0 1px rgba(15,23,42,0.9);
      padding: 8px 10px 10px;
      overflow: hidden;
    }
    .game-layout {
      position: relative;
      width: 100%;
      height: 100%;
    }
    .main-column {
      position: relative;
      width: 100%;
      height: 100%;
    }
    .sidebar {
      position: absolute;
      top: 8px;
      right: 8px;
      z-index: 20;
      min-width: 0;
      display: flex;
      align-items: stretch;
      max-width: 260px;
      transition: opacity 0.2s ease, transform 0.2s ease;
    }
    .game-viewport {
      position: relative;
      width: 100%;
      height: 100%;
    }
    #gameCanvas {
      border: 1px solid #334155;
      background: #020617;
      display: block;
      width: 100%;
      height: 100%;
      border-radius: 8px;
      box-shadow: 0 10px 30px rgba(15,23,42,0.7);
    }

    /* Лидерборд */
    .leaderboard-card {
      flex: 1;
      min-height: 100%;
      background: radial-gradient(circle at top left, rgba(15,23,42,1), rgba(15,23,42,0.98));
      border-radius: 14px;
      border: 1px solid #1e293b;
      box-shadow:
        0 18px 38px rgba(15,23,42,0.85),
        0 0 0 1px rgba(15,23,42,0.9);
      padding: 10px 12px 12px;
      font-size: 12px;
    }

    .leaderboard-header {
      display: flex;
      align-items: flex-start;
      justify-content: space-between;
      margin-bottom: 6px;
      gap: 8px;
    }
    .leaderboard-title-main {
      font-size: 14px;
      font-weight: 600;
      letter-spacing: 0.08em;
      text-transform: uppercase;
      color: #e5e7eb;
    }
    .leaderboard-title-sub {
      margin-top: 2px;
      font-size: 11px;
      color: #9ca3af;
    }

    .leaderboard-refresh {
      width: 26px;
      height: 26px;
      border-radius: 999px;
      background: radial-gradient(circle at top, rgba(15,23,42,0.95), rgba(15,23,42,0.98));
      border: 1px solid #334155;
      color: #9ca3af;
      display: inline-flex;
      align-items: center;
      justify-content: center;
      font-size: 14px;
      cursor: pointer;
      padding: 0;
      transition:
        background-color 0.12s ease,
        border-color 0.12s ease,
        transform 0.08s ease,
        box-shadow 0.12s ease,
        color 0.12s ease;
    }
    .leaderboard-refresh:hover {
      background: radial-gradient(circle at top, rgba(30,64,175,0.85), rgba(15,23,42,0.98));
      border-color: #38bdf8;
      color: #e5e7eb;
      box-shadow: 0 0 0 1px rgba(56,189,248,0.5);
      transform: translateY(-1px);
    }
    .leaderboard-refresh:active {
      transform: translateY(0);
      box-shadow: 0 0 0 1px rgba(56,189,248,0.3);
    }

    .leaderboard-body {
      max-height: 260px;
      overflow-y: auto;
      border-radius: 10px;
      background: radial-gradient(circle at top, rgba(15,23,42,0.95), rgba(15,23,42,0.98));
      border: 1px solid rgba(31,41,55,0.9);
    }
    .leaderboard-body table {
      width: 100%;
      border-collapse: collapse;
    }
    .leaderboard-body thead {
      position: sticky;
      top: 0;
      background: rgba(15,23,42,0.98);
      z-index: 1;
    }
    .leaderboard-body th,
    .leaderboard-body td {
      padding: 5px 7px;
      text-align: left;
      border-bottom: 1px solid rgba(30,64,175,0.35);
      font-variant-numeric: tabular-nums;
      white-space: nowrap;
    }
    .leaderboard-body th {
      font-size: 11px;
      text-transform: uppercase;
      letter-spacing: 0.08em;
      color: #9ca3af;
    }
    .leaderboard-body td {
      font-size: 12px;
      color: #e5e7eb;
    }
    .leaderboard-body th:nth-child(1),
    .leaderboard-body td:nth-child(1) {
      width: 1%;
      padding-left: 8px;
    }
    .leaderboard-body th:nth-child(3),
    .leaderboard-body td:nth-child(3) {
      text-align: right;
      padding-right: 8px;
    }
    .leaderboard-body tr:last-child td {
      border-bottom: none;
    }
    .lb-row--gold td {
      background: linear-gradient(90deg, rgba(250,204,21,0.16), transparent);
      color: #facc15;
      font-weight: 600;
    }
    .lb-row--silver td {
      background: linear-gradient(90deg, rgba(148,163,184,0.16), transparent);
      color: #e5e7eb;
      font-weight: 600;
    }
    .lb-row--bronze td {
      background: linear-gradient(90deg, rgba(248,113,113,0.16), transparent);
      color: #fed7aa;
      font-weight: 600;
    }

    .leaderboard-footer {
      margin-top: 6px;
      font-size: 11px;
      color: #9ca3af;
      display: flex;
      justify-content: space-between;
      align-items: center;
      gap: 8px;
    }
    .leaderboard-footer span[data-self-balance] {
      font-weight: 600;
      color: #e5e7eb;
    }
    .leaderboard-footer .hint {
      font-size: 10px;
      opacity: 0.85;
    }

    @media (max-width: 720px) {
      .game-wrapper {
        padding: 12px 12px 14px;
      }
      .game-layout {
        display: flex;
        flex-direction: column;
        align-items: center;
      }
      .main-column {
        width: 100%;
        max-width: 400px;
        margin: 0 auto;
      }
      .sidebar {
        position: static;
        width: 100%;
        max-width: 400px;
        margin-top: 8px;
      }
    }

    /* Нижняя панель управления (HUD + контролы) */
    .ui-bar {
      position: absolute;
      left: 8px;
      right: 8px;
      bottom: 8px;
      display: flex;
      align-items: center;
      gap: 8px;
      padding: 4px 10px;
      border-radius: 999px;
      background: radial-gradient(
        circle at top left,
        rgba(15,23,42,0.94),
        rgba(15,23,42,0.96)
      );
      border: 1px solid rgba(15,23,42,0.9);
      box-shadow: 0 6px 16px rgba(15,23,42,0.9);
      font-size: 12px;
      line-height: 1.2;
      overflow-x: auto;
      white-space: nowrap;
      transition: opacity 0.2s ease, transform 0.2s ease;
    }

    .hud {
      display: inline-flex;
      align-items: center;
      gap: 6px;
      margin: 0;
    }
    .hud .pill {
      display: inline-flex;
      align-items: center;
      gap: 4px;
      padding: 2px 7px;
      border-radius: 999px;
      background: rgba(15,23,42,0.8);
      border: 1px solid #1f2937;
    }
    .hud .pill-label {
      font-size: 11px;
      color: #9ca3af;
    }
    .hud .pill-value {
      font-weight: 600;
      color: #e5e7eb;
    }

    .controls {
      display: inline-flex;
      align-items: center;
      gap: 8px;
      margin-left: 12px;
      font-size: 12px;
    }
    .controls label {
      display: inline-flex;
      align-items: center;
      gap: 4px;
      white-space: nowrap;
      color: #d1d5db;
    }
    .controls input {
      background: #020617;
      border: 1px solid #475569;
      border-radius: 6px;
      padding: 2px 6px;
      font-size: 12px;
      height: 24px;
      min-width: 70px;
      color: #e5e7eb;
      outline: none;
      transition: border-color 0.12s ease, box-shadow 0.12s ease, background-color 0.12s ease;
    }
    .controls input:focus {
      border-color: #38bdf8;
      box-shadow: 0 0 0 1px rgba(56,189,248,0.4);
      background-color: #02081b;
    }
    .controls select {
      background: #020617;
      border: 1px solid #475569;
      border-radius: 6px;
      padding: 2px 6px;
      font-size: 12px;
      height: 24px;
      min-width: 120px;
      color: #e5e7eb;
      outline: none;
      transition: border-color 0.12s ease, box-shadow 0.12s ease, background-color 0.12s ease;
    }
    .controls select:focus {
      border-color: #38bdf8;
      box-shadow: 0 0 0 1px rgba(56,189,248,0.4);
      background-color: #02081b;
    }
    .controls button {
      padding: 4px 10px;
      font-size: 12px;
      border-radius: 999px;
      border: none;
      cursor: pointer;
      background: linear-gradient(135deg, #22c55e, #4ade80);
      color: #022c22;
      font-weight: 600;
      letter-spacing: 0.03em;
      text-transform: uppercase;
      display: inline-flex;
      align-items: center;
      gap: 4px;
      box-shadow:
        0 10px 25px rgba(22,163,74,0.45),
        0 0 0 1px rgba(21,128,61,0.7);
      transition:
        transform 0.08s ease,
        box-shadow 0.12s ease,
        filter 0.12s ease;
    }
    .controls button:hover:not(:disabled) {
      filter: brightness(1.06);
      box-shadow:
        0 12px 28px rgba(21,128,61,0.7),
        0 0 0 1px rgba(21,128,61,0.9);
      transform: translateY(-1px);
    }
    .controls button:active:not(:disabled) {
      transform: translateY(0);
      box-shadow:
        0 6px 16px rgba(22,163,74,0.5),
        0 0 0 1px rgba(21,128,61,0.95);
    }
    .controls button:disabled {
      background: #4b5563;
      color: #9ca3af;
      cursor: default;
      box-shadow: none;
      text-transform: none;
      letter-spacing: normal;
    }

    .message {
      margin-left: auto;
      font-size: 11px;
      color: #9ca3af;
      border: none;
      background: transparent;
      padding: 0;
    }
  
