body {
    margin: 0;
    padding: 0;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    background-color: #f5f6fa;
    font-family: Arial, sans-serif;
}


.page {
    min-height: 100vh;
    padding: 0 40px;
    box-sizing: border-box;
}

.page-header {
    text-align: center;
    margin-top: 40px;
    margin-bottom: 40px;
}

.page-header h1 {
    margin: 0;
    font-size: 32px;
}

.page-header p {
    margin: 8px 0 0;
    color: #666;
}



.workspace {
    display: grid;
    grid-template-columns:
        140px
        minmax(0, 700px)
        minmax(140px, 1fr);

    gap: 30px;

    width: 100%;
    align-items: start;
}

.panel h2 {
    margin: 0 0 15px;
    text-align: center;
    font-size: 24px;
}

.strip-panel {
    grid-column: 1;
    width: 140px;
    justify-self: start;
}

.palette-panel {
    grid-column: 2 / 3;

    width: min(700px, 100%);
    justify-self: center;

    display: flex;
    flex-direction: column;
    align-items: center;
}

@media (max-width: 900px) {
    .page {
        padding: 0 !important;
    }

    .workspace {
        max-width: 100vw !important;
        display: flex;
        flex-direction: column;
        align-items: center;
        gap: 30px;
    }

    .strip-panel {
        width: min(500px, 100%) !important;
    }

    .item-strip {
        flex-direction: row !important;
        height: 120px !important;

        overflow-x: auto !important;
        overflow-y: hidden !important;
    }

    .palette-panel {
        width: min(700px, 100%);
    }
}



/* Scrollable single row */
.item-strip {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;

    width: 100%;
    height: 80vh;
    padding: 30px;
    box-sizing: border-box;

    overflow-y: auto;
    overflow-x: hidden;
    scrollbar-width: thin;
    scrollbar-color: #bbb transparent;

    background-color: #ffffff;
    border-radius: 10px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.1);

    z-index: 100;
}
.item-strip .grid-item {
    flex: 0 0 100px;
    width: 100px;
    height: 100px;
}
/* First item's tooltip: show below the item */
.item-strip .grid-item:first-child:not(.grid-item-empty)::after {
    top: calc(100% + 6px);
    bottom: auto;
}
/* First item's tooltip: Arrow points upward */
.item-strip .grid-item:first-child:not(.grid-item-empty)::before {
    top: calc(100%);
    bottom: auto;

    border-top: none;
    border-bottom: 6px solid #333;
}



.grid-wrapper {
    padding: 20px 14px 14px 20px;
    background-color: #ffffff;
    border-radius: 40px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.1);
}
.grid-container {
    --columns: 3;
    --item-size: 80px;
    --gap: 10px;

    display: grid;
    grid-template-columns: repeat(var(--columns), var(--item-size));
    grid-auto-rows: var(--item-size);
    gap: var(--gap);

    overflow: auto;
    scrollbar-width: thin;
    scrollbar-color: #bbb transparent;
    scrollbar-gutter: stable;
}

.grid-item {
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
    color: white;
    background-size: cover;
    background-position: cover;
    font-size: 2rem;
    font-weight: bold;
    border-radius: 8px;
    user-select: none;
    transition: transform 0.2s ease, opacity 0.2s ease;
}
.grid-item:not(.grid-item-empty) {
    cursor: grab;
}

.grid-item:not(.grid-item-empty):active {
    cursor: grabbing;
}

/* Visual cue when an item is being dragged */
.grid-item.dragging {
    opacity: 0.5;
    transform: scale(0.95);
}

/* Visual cue when hovering over a drop target */
.grid-item.drag-over {
    border: 3px dashed #333;
    box-sizing: border-box;
}

/* Tooltip + arrow underneath */
.tooltip {
    position: fixed;
    z-index: 9999;
    padding: 7px 10px;
    border-radius: 5px;
    background: #333;
    color: white;
    font-size: 13px;
    line-height: 1.4;
    text-align: center;
    pointer-events: none;

    opacity: 0;
    visibility: hidden;
    transition: opacity 0.15s ease;
}
.tooltip::after {
    content: "";
    position: absolute;
    left: 50%;
    top: calc(100% - 1px);
    transform: translateX(-50%);

    border-left: 10px solid transparent;
    border-right: 10px solid transparent;
    border-top: 10px solid #333;
}
.tooltip.visible {
    opacity: 1;
    visibility: visible;
}



.grid-item-empty {
    /* background-image: url(./images/droplet.png); */
    border: 3px solid lightgray;
    border-radius: 40%;
}
/* Hide the tooltip on empty */
.grid-item-empty::after,
.grid-item-empty::before {
    display: none;
}




.file-controls {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;

    width: min(400px, 100%);
    margin: 0 auto;
}

.file-controls h3 {
    grid-column: 1 / -1;
    text-align: center;
    font-size: 18px;
    margin-top: 10px;
    margin-bottom: 0;
}

.file-controls input[type=text] {
    grid-column: 1 / -1;
    
    padding: 0 12px;
    border: 1px solid #ccc;
}

.file-controls input[type=text],
.button {
    height: 40px;
    box-sizing: border-box;
    border-radius: 6px;
    font: inherit;
}

.button {
    border: none;
    background: #333;
    color: white;
    cursor: pointer;
}
.button:hover {
    background: #555;
}

.file-controls input[type="range"] {
    grid-column: 1 / -1;
    margin: 0;

    accent-color: #333;
    cursor: pointer;
}
