/* Custom-Tag als Block */
itemsolution {
    display: block;
    width: 100%;
}

/* Wrapper ohne Hintergrund, Inhalte schweben „frei“ */
.itemsolution-container {
    position: relative;
    display: block;
    width: 100%;
    box-sizing: border-box;
    padding: 0.3rem 0;
    outline: none;
}

/* Scrollbereich bestimmt die Tile-Höhe (z.B. 3rem) */
.itemsolution-scroll {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    box-sizing: border-box;
    height: 5vh;
    display: block;
    padding-bottom: 0.1rem;
    scrollbar-width: thin;
    -ms-overflow-style: none;
    text-align:center;
}

.itemsolution-scroll::-webkit-scrollbar {
    display: thin; /* Chrome/Safari/Edge */
}

/* Platz für den Submit-Button rechts freihalten */
.itemsolution-has-submit .itemsolution-scroll {
    padding-right: 5.8rem;
    padding-left: 5.8rem;
}

/* Tiles-Row: horizontale Leiste, linksbündig */
.itemsolution-tiles {
    display: inline-block;
    font-size: 2.7rem;
    font-weight: bolder;
    width: max-content;
    height: calc(100% - 4px);
}

/* Basis-Tile: quadratisch per aspect-ratio, Glass-Outset */
.itemsolution-tile {
    box-sizing: border-box;
    text-align: center;
    font-family: monospace;
    user-select: none;
    white-space: nowrap;
    height: 100%;
    aspect-ratio: 1 / 1;
    display: inline-block;
    align-items: center;
    align-content: center;
    margin: 2px;
    font-size: 80%;
    border-radius: 2px;
    background: linear-gradient(145deg, rgba(255, 255, 255, 0.9), rgba(210, 210, 210, 0.6));
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.25), 0 0 0 1px rgba(255, 255, 255, 0.6);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    color: #222;
    position: relative; /* für Index-Overlays */
}

/* Kleine Index-Box oben links (immer sichtbar, verdrängt nichts) */
.itemsolution-tile::before {
    content: attr(data-pos);
    position: absolute;
    top: 0.1rem;
    left: 0.15rem;
    padding: 0 0.2em;
    border-radius: 2px;
    font-size: 0.55em;
    line-height: 1.1;
    background: rgba(0, 0, 0, 0.25);
    color: rgba(255, 255, 255, 0.9);
    pointer-events: none;
    mix-blend-mode: soft-light;
}

/* Add-Mode: leere Tiles mit großer, eingebrannter Nummer im Hintergrund */
.itemsolution-addmode .itemsolution-tile-empty::after {
    content: attr(data-pos);
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5em;
    font-weight: 700;
    color: rgba(255, 255, 255, 0.35);
    pointer-events: none;
}

/* Editierbar: Glass-Inset */
.itemsolution-editable .itemsolution-tile {
    box-shadow: inset 1px 1px 2px rgba(0, 0, 0, 0.65), inset 0 0 0 1px rgba(255, 255, 255, 0.4);
    background: linear-gradient(145deg, rgba(240, 240, 240, 0.8), rgba(190, 190, 190, 0.5));
    cursor: pointer;
}

/* Add-Mode (operation=additems): blauer Akzent, gleicher Glass-Look */
.itemsolution-addmode.itemsolution-editable .itemsolution-tile {
    background:linear-gradient(145deg, rgba(227, 249, 253 , 0.9), rgba(0, 130, 150 , 0.5));
    box-shadow:
        inset 0 2px 4px rgba(13, 71, 161, 0.4),
        inset 0 0 0 1px rgba(227, 242, 253, 0.8);
}

/* Leere Tiles: leicht eingedrückte Glasflächen */
.itemsolution-tile-empty {
    opacity: 0.7;
    box-shadow:
        inset 0 1px 2px rgba(0, 0, 0, 0.25),
        inset 0 0 0 1px rgba(255, 255, 255, 0.35);
    background: linear-gradient(145deg,
        rgba(245, 245, 245, 0.7),
        rgba(210, 210, 210, 0.5)
    );
    color: #888;
}

/* Wildcard-Tiles (nur im upd-Kontext gesetzt) */
.itemsolution-tile-wildcard {
    opacity: 1;
    box-shadow:
        inset 0 1px 3px rgba(25, 118, 210, 0.7),
        inset 0 0 0 1px rgba(227, 242, 253, 0.9);
    background: linear-gradient(145deg,
        rgba(227, 242, 253, 0.98),
        rgba(144, 202, 249, 0.9)
    );
    color: #0d47a1;
}

/* Korrekt / falsch (Glass-Farben) */
.itemsolution-tile-correct {
    background: linear-gradient(145deg,
        rgba(200, 230, 201, 0.9),
        rgba(129, 199, 132, 0.8)
    );
}

.itemsolution-tile-wrong {
    background: linear-gradient(145deg,
        rgba(255, 205, 210, 0.9),
        rgba(239, 154, 154, 0.8)
    );
}

/* Im Add-Mode bleiben correct/wrong erkennbar, aber mit leichter Blautönung */
.itemsolution-addmode .itemsolution-tile-correct {
    background: linear-gradient(145deg,
        rgba(200, 230, 201, 0.95),
        rgba(129, 199, 132, 0.9)
    );
}

.itemsolution-addmode .itemsolution-tile-wrong {
    background: linear-gradient(145deg,
        rgba(255, 205, 210, 0.95),
        rgba(239, 154, 154, 0.9)
    );
}

/* Aktive (Cursor-)Kachel */
.itemsolution-tile-active {
    outline: 2px solid rgba(66, 66, 66, 0.9);
    outline-offset: 0;
}

/* Fokusrahmen für das ganze Feld */
.itemsolution-container:focus {
    outline: 2px solid #1976d2;
    outline-offset: 2px;
}

/* Submit-Buttons: Glass-Style, fix am rechten Rand, nicht mitscrollend */
.itemsolution-submit {
    position: absolute;
    right: 0.6rem;
    top: calc(50% - 2.4rem);
    width: 4.8rem;
    height: 4.8rem;
    border: none;
    padding: 0;
    border-radius: 2px;
    cursor: pointer;
    font-size: 3.4rem;
    line-height: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(145deg, rgba(255, 255, 255, 0.9), rgba(210, 210, 210, 0.7));
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3), 0 0 0 1px rgba(255, 255, 255, 0.7);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    color: #111;
}

/* Farbliche Nuancen für Add/Update */
.itemsolution-submit-add {
    color: var(--link-4);
}

.itemsolution-submit-upd {
    color: var(--link-3);
}

/* ---------- Kreis-Auswahl A–F für Touch ---------- */

.itemsolution-chooser {
    position: absolute;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    pointer-events: none; /* Optionen selbst reaktivieren das */
    z-index: 5;
}

.itemsolution-chooser-option {
    position: absolute;
    border-radius: 2px;
    text-align: center;
    font-family: monospace;
    white-space: nowrap;
    user-select: none;
    pointer-events: auto;

    background: linear-gradient(145deg,
        rgba(245, 245, 245, 0.95),
        rgba(200, 200, 200, 0.8)
    );
    box-shadow:
        0 2px 4px rgba(0, 0, 0, 0.3),
        0 0 0 1px rgba(255, 255, 255, 0.7);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    color: #222;

    opacity: 0;
    transform: scale(0.5);
    transition: opacity 0.18s ease-out, transform 0.18s ease-out;
}

.itemsolution-chooser-visible .itemsolution-chooser-option {
    opacity: 1;
    transform: scale(1);
}


.itemsolution-correct-popup {
    position: absolute;
    display: flex;
    align-items: center;
    justify-content: center;
    right: 2px;
    left: 2px;
    bottom: 2px;
    top: 2px;
    padding: 0.1rem 0.25rem;
    border-radius: 2px;
    font-family: monospace;
    overflow: hidden;
    font-size: 3rem;
    font-weight: 700;
    white-space: nowrap;
    background: linear-gradient(145deg, rgba(200, 230, 201, 0.95), rgba(129, 199, 132, 0.9));
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.35), 0 0 0 1px rgba(255, 255, 255, 0.7);
    color: #ffffff;
    opacity: 0;
    pointer-events: none;
    transform: scale3d(0.1, 0.5, 0.3);
    transition: opacity 0.35s 
    ease-out, transform 0.35s 
    ease-out;
}

.itemsolution-correct-popup-visible {
    opacity: 1;
    transform: scale3d(1, 1, 1);
}
