/* Grid settings drawer */
.grid-drawer {
    position: fixed;
    top: 0;
    right: 0;
    height: 100vh;
    width: 380px;
    max-width: 90vw;
    background: #2a2a2a;
    color: #eee;
    z-index: 100;
    transform: translateX(100%);
    transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: -4px 0 20px rgba(0, 0, 0, 0.4);
    display: flex;
    flex-direction: column;
}

.grid-drawer.open {
    transform: translateX(0);
}

/* Slide content when drawer is open */
main,
footer {
    transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

body.drawer-open main,
body.drawer-open footer {
    transform: translateX(100vw);
}

/* Fake cursor */
.fake-cursor {
    position: fixed;
    width: 24px;
    height: 24px;
    pointer-events: none;
    z-index: 50;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.fake-cursor.active {
    opacity: 1;
}

.fake-cursor::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 24px;
    height: 24px;
    background: rgba(255, 255, 255, 0.15);
    border-radius: 50%;
    transform: translate(-50%, -50%);
}

.grid-drawer-content {
    padding: 2rem 1.5rem;
    overflow-y: auto;
    flex: 1;
}

.grid-drawer h2 {
    margin-bottom: 1.5rem;
    font-size: 1.4rem;
    font-weight: 600;
}

.grid-drawer label {
    display: block;
    margin-bottom: 1.5rem;
    font-size: 0.95rem;
    color: #ccc;
}

.grid-drawer label span {
    display: flex;
    justify-content: space-between;
    margin-bottom: 0.3rem;
}

.grid-drawer input[type="range"] {
    width: 100%;
    height: 6px;
    accent-color: #22a05a;
    cursor: pointer;
}

.grid-drawer-randomize {
    display: block;
    width: 100%;
    margin-top: 0.5rem;
    padding: 0.6rem 1rem;
    background: rgba(255, 255, 255, 0.08);
    color: #eee;
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.95rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    transition: background 0.2s ease;
}

.grid-drawer-randomize:hover {
    background: rgba(255, 255, 255, 0.18);
}

/* Close button */
.grid-drawer-close {
    position: absolute;
    top: 0.8rem;
    right: 0.8rem;
    width: 32px;
    height: 32px;
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.5);
    font-size: 1.4rem;
    cursor: pointer;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.2s ease, background 0.2s ease;
    z-index: 1;
}

.grid-drawer-close:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.1);
}

/* Hide tab when drawer is open */
body.drawer-open .grid-drawer-tab {
    opacity: 0;
    pointer-events: none;
}

/* Pull tab */
.grid-drawer-tab {
    position: fixed;
    right: 0;
    top: 50%;
    transform: translateY(-50%);
    z-index: 99;
    background: rgba(42, 42, 42, 0.9);
    color: #ccc;
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-right: none;
    border-radius: 8px 0 0 8px;
    padding: 0.9rem 0.7rem;
    cursor: default;
    font-size: 0.9rem;
    font-weight: 600;
    letter-spacing: 0.1em;
    transition: opacity 0.4s ease, background 0.2s ease, right 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    opacity: 0;
    pointer-events: none;
    backdrop-filter: blur(4px);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0;
}

.grid-drawer-tab.ready:hover {
    background: rgba(60, 60, 60, 0.95);
    color: #fff;
}

.grid-drawer-tab.visible {
    opacity: 1;
    pointer-events: auto;
}

/* Tab marker dots */
.tab-markers {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 0.5rem 0;
}

.tab-dot {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    border: 1.5px solid rgba(255, 255, 255, 0.3);
    background: transparent;
    transition: all 0.3s ease;
}

.tab-dot.lit {
    background: rgba(255, 215, 0, 0.9);
    border-color: rgba(0, 0, 0, 0.6);
    box-shadow: 0 0 6px 2px rgba(255, 215, 0, 0.4);
}

/* Crossfade dots → label inside the same tab */
.tab-markers,
.tab-label {
    transition: opacity 0.6s ease;
}

.tab-label {
    writing-mode: vertical-rl;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    opacity: 0;
    white-space: nowrap;
}

.grid-drawer-tab.ready .tab-markers {
    opacity: 0;
}

.grid-drawer-tab.ready .tab-label {
    opacity: 1;
    transition-delay: 0.4s;
}

.grid-drawer-tab.ready {
    cursor: pointer;
}

.grid-drawer-tab.pulse {
    animation: tab-pulse 1.5s ease-in-out infinite;
    padding: 1.2rem 0.7rem;
}

@keyframes tab-pulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(255, 215, 0, 0.6); background: rgba(42, 42, 42, 0.9); }
    50% { box-shadow: 0 0 14px 4px rgba(255, 215, 0, 0.4); background: rgba(60, 55, 30, 0.95); }
}

.grid-drawer-tab.pushed {
    right: 380px;
}
