/* Drift Cup Free - Styles */

body {
    background-color: #050E3C;
    font-family: Arial, sans-serif;
}

/* Header overrides for dark background */
.cup-free-title { color: #fff; }
.cup-free-stats { color: #ccc; }
.cup-free-stat { color: #fff; }
.cup-free-divider { color: #666; }

.drift-container {
    color: #ffffff;
}

.drift-stat {
    background: rgba(255, 255, 255, 0.1);
    padding: 10px 20px;
    border-radius: 5px;
    display: flex;
    flex-direction: column;
    align-items: center;
    font-size: 14px;
    color: #ffd166;
    min-width: 100px;
}

.drift-stat span {
    font-size: 24px;
    font-weight: bold;
    color: white;
    margin-top: 5px;
}

/* Drift uses the shared .grid / .cell component (components/cell.css).
   gap=0 is required so .drift-dot's translate math (col*100% of its own width) stays exact. */
.drift-container .grid {
    --drift-size: 10;
    --cell-vw: 10vw;
    --cell-max: 50px;
    --grid-gap: 0;
    --grid-padding: 0;
    --grid-bg: #1a1a1a;
    --grid-cell-bg: #000;
    --grid-cell-border: #333;

    position: relative;
    border-radius: 8px;
    overflow: hidden;
}

.drift-container .cell {
    border-radius: 0;
    transition: background 120ms ease, box-shadow 120ms ease;
}

.drift-container .cell.drift-target {
    background: #ffffff;
    box-shadow: inset 0 0 8px rgba(255, 255, 255, 0.6);
}

.drift-container .cell.drift-indicator {
    background: rgba(255, 209, 102, 0.45);
    box-shadow: inset 0 0 0 2px #ffd166;
}

.drift-container .cell.drift-target.drift-indicator {
    background: #ffffff;
    box-shadow: inset 0 0 8px rgba(255, 255, 255, 0.6), inset 0 0 0 3px #ffd166;
}

/* Dot: absolutely positioned at top-left of the grid content area, sized to one cell.
   translate(col*100%, row*100%) precisely lands it on cell (col, row). */
.drift-dot {
    position: absolute;
    top: 0;
    left: 0;
    width: calc(100% / var(--drift-size));
    height: calc(100% / var(--drift-size));
    background: #e63946;
    border-radius: 50%;
    box-shadow: 0 0 10px rgba(230, 57, 70, 0.7);
    transition: transform 100ms ease;
    pointer-events: none;
    z-index: 2;
    /* Shrink the visual circle slightly so it doesn't cover the cell borders entirely. */
    transform-origin: top left;
    box-sizing: border-box;
    border: 3px solid transparent;
    background-clip: padding-box;
}

/* Off-grid direction arrow overlay (when the random direction points outside the grid). */
.drift-dot.drift-arrow-N::after,
.drift-dot.drift-arrow-S::after,
.drift-dot.drift-arrow-E::after,
.drift-dot.drift-arrow-W::after {
    content: '';
    position: absolute;
    inset: 0;
    color: #ffd166;
    font-weight: 900;
    font-size: 1.4em;
    display: flex;
    align-items: center;
    justify-content: center;
    text-shadow: 0 0 4px #000;
}
.drift-dot.drift-arrow-N::after { content: '↑'; }
.drift-dot.drift-arrow-S::after { content: '↓'; }
.drift-dot.drift-arrow-E::after { content: '→'; }
.drift-dot.drift-arrow-W::after { content: '←'; }

/* Status text */
.drift-status {
    text-align: center;
    padding: 10px;
    margin: 10px auto;
    max-width: 500px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 5px;
    color: white;
    font-size: 14px;
}

.drift-status:empty { display: none; }

/* Controls */
.drift-controls {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 15px;
    margin: 15px auto 25px;
    max-width: 500px;
    flex-wrap: wrap;
}

.drift-controls button {
    padding: 14px 28px;
    font-size: 18px;
    cursor: pointer;
    background: #4CAF50;
    color: white;
    border: none;
    border-radius: 6px;
    margin: 5px;
    font-weight: bold;
    transition: background 120ms ease, transform 80ms ease;
}

.drift-controls button:hover {
    background: #45a049;
}

.drift-controls button:active {
    transform: translateY(1px);
}

.drift-controls button:disabled {
    background: #666;
    cursor: not-allowed;
    opacity: 0.7;
}

#drift-press-btn {
    background: #e63946;
    min-width: 160px;
}

#drift-press-btn:hover {
    background: #c92e3b;
}

/* Leaderboard overrides for dark background */
.free-leaderboard h3 { color: #ffffff; }
.free-leaderboard table { background: #fff; }
.free-leaderboard td { color: #222; }

/* Mobile: minimum padding per project rule */
@media (max-width: 480px) {
    .drift-stat { padding: 6px 10px; min-width: 80px; }
    .drift-stat span { font-size: 18px; }
    .drift-container .grid { margin: 12px auto; }
    .drift-controls { margin: 10px auto; }
    .drift-controls button { padding: 10px 18px; font-size: 16px; }
    #drift-press-btn { min-width: 140px; }
}
