/* === Nomenclingo Game Styles === */

#game-area {
    width: 100%;
    max-width: 600px;
    margin: 1.5rem auto;
}

/* --- Answer Zone --- */
#answer-zone {
    min-height: 56px;
    padding: 8px 12px;
    margin-bottom: 1rem;
    border: 2px dashed #ced4da;
    border-radius: 8px;
    background-color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
}

#answer-slots {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    justify-content: center;
    min-height: 40px;
    align-items: center;
}

#answer-slots:empty::before {
    content: "Tap tiles below to build the name";
    color: #adb5bd;
    font-style: italic;
    font-size: 0.95rem;
}

/* --- Tile Tray --- */
#tile-tray {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: center;
    padding: 12px;
    margin-bottom: 1rem;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    background-color: #f8f9fa;
    min-height: 50px;
}

/* --- Tile Base --- */
.tile {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 8px 14px;
    border-radius: 6px;
    font-family: 'Courier New', Courier, monospace;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    user-select: none;
    -webkit-user-select: none;
    touch-action: none;
    transition: transform 0.1s ease, box-shadow 0.1s ease, opacity 0.2s ease;
    border: 2px solid transparent;
}

.tile:hover {
    transform: translateY(-2px);
    box-shadow: 0 3px 8px rgba(0, 0, 0, 0.15);
}

.tile:active {
    transform: translateY(0);
}

/* Dragging state */
.tile.dragging {
    opacity: 0.3;
}

/* Floating ghost for touch drag */
.drag-ghost {
    position: fixed;
    z-index: 9999;
    pointer-events: none;
    opacity: 0.85;
    transform: scale(1.08);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.25);
}

/* Drop indicator: left border on the tile you'd insert before */
.tile.drop-before {
    border-left: 3px solid #362A8D;
}

/* Drop indicator: when appending at the end */
#answer-slots.drop-at-end {
    border-right: 3px solid #362A8D;
}

/* Cursor for draggable tiles */
.tile {
    cursor: grab;
}

.tile.dragging {
    cursor: grabbing;
}

/* Color coding by fragment type */
.tile[data-type="locant"] {
    background-color: #dbeafe;
    border-color: #93c5fd;
    color: #1e40af;
}

.tile[data-type="multiplier"] {
    background-color: #fef3c7;
    border-color: #fbbf24;
    color: #92400e;
}

.tile[data-type="root"] {
    background-color: #d1fae5;
    border-color: #6ee7b7;
    color: #065f46;
}

.tile[data-type="ring_prefix"] {
    background-color: #ede9fe;
    border-color: #a78bfa;
    color: #5b21b6;
}

.tile[data-type="suffix"] {
    background-color: #fce7f3;
    border-color: #f9a8d4;
    color: #9d174d;
}

.tile[data-type="substituent"] {
    background-color: #ffedd5;
    border-color: #fdba74;
    color: #9a3412;
}

.tile[data-type="connector"] {
    background-color: #e5e7eb;
    border-color: #9ca3af;
    color: #374151;
}

/* Tile in the answer zone */
#answer-slots .tile {
    padding: 6px 10px;
    font-size: 0.95rem;
}

/* --- Game Controls --- */
#game-controls {
    display: flex;
    gap: 10px;
    justify-content: center;
    margin-bottom: 1rem;
}

#check-btn {
    background-color: #362A8D;
    min-width: 100px;
}

#clear-btn {
    background-color: #6c757d;
    min-width: 80px;
}

#skip-btn {
    background-color: #bbc8ca;
    min-width: 100px;
}

#hint-btn {
    background-color: #bbc8ca;
    min-width: 80px;
}

/* --- Feedback --- */
#feedback-message {
    height: 30px;
    font-size: 1.2rem;
    font-weight: bold;
    text-align: center;
}

#hint-message {
    text-align: center;
    font-size: 0.95rem;
    color: #495057;
    min-height: 1.4em;
    margin-bottom: 0.5rem;
}

/* --- Score --- */

/* --- Correct/Incorrect Animations --- */
@keyframes shake {
    0%, 100% { transform: translateX(0); }
    20% { transform: translateX(-6px); }
    40% { transform: translateX(6px); }
    60% { transform: translateX(-4px); }
    80% { transform: translateX(4px); }
}

@keyframes pop {
    0% { transform: scale(1); }
    50% { transform: scale(1.05); }
    100% { transform: scale(1); }
}

#answer-zone.shake {
    animation: shake 0.4s ease;
    border-color: #dc3545;
}

#answer-zone.correct-flash {
    animation: pop 0.3s ease;
    border-color: #28a745;
    background-color: #d4edda;
}

/* --- Functional Group Filter Toggles --- */
#fg-toggles {
    display: grid;
    grid-template-columns: repeat(auto-fit, 165px);
    gap: 8px;
    margin-top: 1rem;
    justify-content: center;
}

#fg-toggles label {
    display: flex;
    align-items: center;
    padding: 4px 4px;
    border: 1px solid #ccc;
    border-radius: 20px;
    cursor: pointer;
    transition: background-color 0.2s ease-in-out, border-color 0.2s ease-in-out;
    font-size: 0.9rem;
}

#fg-toggles label:hover {
    background-color: #f0f4f5;
    border-color: #aab;
}

#fg-toggles input[type="checkbox"] {
    width: 16px;
    height: 16px;
    margin-right: 8px;
}

#fg-toggles input[type="checkbox"]:checked {
    accent-color: #291720;
}

.filter-actions {
    display: flex;
    gap: 1rem;
    margin-top: 8px;
}

.link-button {
    background: none;
    border: none;
    color: #007bff;
    text-decoration: underline;
    cursor: pointer;
    padding: 0;
    font-size: 0.9rem;
}

.link-button:hover {
    color: #0056b3;
}

.apply-container {
    text-align: center;
    margin: 0rem 1rem;
}

#apply-filters-btn {
    padding: 10px 20px;
    font-size: 1rem;
    cursor: pointer;
}

.all-filters-container {
    justify-self: center;
}

.apply-and-select-container {
    display: flex;
    justify-self: center;
}

.filters-toggles fieldset {
    border-radius: 8px;
    width: 300px;
    justify-self: center;
}

@media (min-width: 700px) {
    .filters-toggles fieldset {
        width: 700px;
        border-radius: 8px;
        justify-content: space-between;
    }
}

/* --- Responsive --- */
@media (max-width: 500px) {
    .tile {
        padding: 6px 10px;
        font-size: 0.85rem;
    }

    #answer-slots .tile {
        padding: 4px 8px;
        font-size: 0.8rem;
    }

    #tile-tray {
        gap: 6px;
        padding: 8px;
    }
}
