body {
      background-color: #020617;
      color: #e2e8f0;
      font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
      -webkit-tap-highlight-color: transparent;
      overflow-x: hidden;
    }

    body.scroll-lock {
      overflow: hidden !important;
      position: fixed;
      width: 100%;
    }

    .grid-cell {
      position: relative;
      background: #1e293b;
      border: 1px solid #334155;
      border-radius: 5px;
      cursor: pointer;
      transition: background-color 0.1s ease, border-color 0.1s ease;
      touch-action: none;
    }

    #main-grid .grid-cell {
        border-radius: 10px;
    }

    .grid-cell::before {
      content: '';
      position: absolute;
      inset: 0;
      border-radius: 5px;
      background: radial-gradient(circle at center, rgba(255, 255, 255, 0.1) 0%, transparent 70%);
      opacity: 0;
      transition: opacity 0.2s;
    }

    .filled {
      background: #f0f6ff !important;
      border-color: #ffffff !important;
      box-shadow: 0 0 6px #ffffff;
    }

    .filled::before {
      opacity: 1;
    }

    .placed-preview {
      background: #fbbf24 !important;
      border-color: #fbbf24 !important;
      box-shadow: 0 0 15px rgba(251, 191, 36, 0.6);
      z-index: 10;
    }

    .cleared-effect {
      animation: flashClear 1.5s infinite;
    }

    @keyframes flashClear {

      0%,
      100% {
        background: #f43f5e;
        box-shadow: 0 0 15px #f43f5e;
      }

      50% {
        background: #fda4af;
        box-shadow: 0 0 25px #fda4af;
      }
    }

    .main-board-container {
      backdrop-filter: blur(10px);
    }

    .bottom-sheet {
      position: fixed;
      left: 0;
      right: 0;
      bottom: 0;
      height: 100vh;
      background: #020617;
      border-radius: 24px 24px 0 0;
      transform: translateY(110%);
      transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
      z-index: 50;
      display: flex;
      flex-direction: column;
      border-top: 1px solid rgba(255, 255, 255, 0.1);
      box-shadow: 0 -10px 40px rgba(0, 0, 0, 0.5);
      will-change: transform;
    }

    .bg-game {
        background: #020617;
    }

    @media (min-width: 768px) {
      .bottom-sheet {
        height: 85vh;
      }
    }

    .bottom-sheet.active {
      transform: translateY(0);
    }

    .bottom-sheet.dragging {
      transition: none;
    }

    #sheet-handle {
      touch-action: none;
    }

    .fab-container {
      position: absolute;
      bottom: 0;
      left: 0;
      right: 0;
      padding: 0.75rem;
      background: linear-gradient(to top, #0f172a 80%, transparent);
      z-index: 60;
      pointer-events: none;
      display: flex;
      justify-content: center;
    }

    .fab-btn {
      pointer-events: auto;
      width: 100%;
      max-width: 400px;
      backdrop-filter: blur(8px);
    }

    .grid-wrapper {
      user-select: none;
      -webkit-user-select: none;
    }

    .history-item {
      position: relative;
      width: 45px;
      height: 45px;
      flex-shrink: 0;
      background: rgba(30, 41, 59, 0.8);
      border: 1px solid rgba(255, 255, 255, 0.1);
      border-radius: 5px;
      padding: 2px;
      cursor: pointer;
      transition: all 0.2s ease;
    }

    .history-item:hover {
      border-color: rgba(239, 68, 68, 0.5);
      box-shadow: 0 0 12px rgba(239, 68, 68, 0.25);
      transform: scale(1.08);
    }

    .history-item:active {
      transform: scale(0.95);
    }

    .history-item .delete-btn {
      position: absolute;
      top: -6px;
      right: -6px;
      width: 18px;
      height: 18px;
      background: #f43f5e;
      border-radius: 50%;
      display: none;
      align-items: center;
      justify-content: center;
      font-size: 10px;
      color: white;
      line-height: 1;
      cursor: pointer;
      z-index: 2;
      border: 2px solid #020617;
    }

    .history-item:hover .delete-btn {
      display: flex;
    }

    .library-scroll {
      display: flex;
      flex-wrap: wrap;
      gap: 5px;
      padding: 0.5rem;
      max-height: 800px;
      overflow-y: auto;
      align-content: flex-start;
      scrollbar-width: thin;
      scrollbar-color: rgba(100, 116, 139, 0.3) transparent;
    }

    @media (min-width: 1024px) {
      .library-scroll {
        max-height: 550px;
      }
    }

    .library-scroll::-webkit-scrollbar {
      width: 4px;
    }

    .library-scroll::-webkit-scrollbar-thumb {
      background: rgba(100, 116, 139, 0.3);
      border-radius: 2px;
    }

    .history-target-indicator {
      position: absolute;
      bottom: -2px;
      left: 50%;
      transform: translateX(-50%);
      font-size: 8px;
      background: linear-gradient(135deg, #ef4444, #8b5cf6);
      color: white;
      padding: 0px 4px;
      border-radius: 4px;
      font-weight: bold;
      pointer-events: none;
      opacity: 0;
      transition: opacity 0.2s;
    }

    .history-item:hover .history-target-indicator {
      opacity: 1;
    }

    .library-filter-btn.active {
      background: rgba(239, 68, 68, 0.2) !important;
      border-color: rgba(239, 68, 68, 0.5) !important;
      color: #ffffff !important;
    }

    .history-item.drag-over {
      border-color: #ffffff !important;
      transform: scale(1.1);
      box-shadow: 0 0 15px rgba(239, 68, 68, 0.5);
    }

    .brand-mark {
      width: 34px;
      height: 34px;
      border-radius: 8px;
      border: 1px solid rgba(239, 68, 68, 0.3);
      background:
        radial-gradient(circle at 20% 20%, rgba(239, 68, 68, 0.3), transparent 55%),
        linear-gradient(160deg, rgba(239, 68, 68, 0.15), rgba(139, 92, 246, 0.12));
      box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.04), 0 8px 20px rgba(0, 0, 0, 0.35);
      display: grid;
      grid-template-columns: repeat(3, 1fr);
      gap: 2px;
      padding: 4px;
    }

    .brand-mark-cell {
      border-radius: 2px;
      background: rgba(148, 163, 184, 0.18);
      border: 1px solid rgba(148, 163, 184, 0.2);
    }

    .brand-mark-cell.is-hot {
      background: linear-gradient(135deg, #ef4444, #f43f5e);
      border-color: rgba(255, 255, 255, 0.28);
      box-shadow: 0 0 8px rgba(239, 68, 68, 0.55);
    }

    .brand-title {
      font-weight: 800;
      letter-spacing: 0;
      line-height: 1.05;
    }

    .brand-subline {
      font-size: 10px;
      line-height: 1;
      color: #64748b;
      margin-top: 3px;
      font-weight: 600;
    }
