/* public/css/game.css */



/* === 1. GLOBALE VARIABLEN === */

:root {

    --bg-color: #f3f4f6;

    --text: #1f2937;

    --border: #e5e7eb;

    --primary: #007bff;

    --success-bg: #dcfce7;

    --success-text: #166534;

    --highlight-selecting: #fffacd; /* Hellgelb beim Ziehen */

    --highlight-found: #4CAF50;     /* Grün wenn gefunden */

}



/* === 2. BASIS LAYOUT === */

body {
    /* Schriftart und Hintergrund kommen aus games.css bzw. suchsel_game.php <style> */
    margin: 0;
    color: var(--text, #111);
}



h1, h2, h3 {

    margin-top: 0;

    color: #111;

}



h1 { text-align: center; margin-bottom: 25px; }



a { text-decoration: none; color: inherit; }



/* Haupt-Container (Karte) */

.container {

    max-width: 950px;

    margin: 0 auto;

    background: rgba(255, 255, 255, 0.98);

    padding: 30px;

    border-radius: 12px;

    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.08);

}



/* === 3. GAME AREA (LAYOUT) === */

.game-area {

    display: flex;

    flex-wrap: wrap;

    gap: 30px;

    justify-content: center;

    align-items: flex-start;

}



/* Linke Spalte: Gitter + Ergebnisse */

.grid-wrapper {

    flex: 0 0 auto;

    display: flex;

    flex-direction: column;

    gap: 20px;

    /* Damit das Grid nicht breiter wird als der Screen auf Mobile */

    max-width: 100%; 

}



/* Der Container für die Buchstaben */

.grid-container {

    display: grid;

    gap: 2px;

    user-select: none; /* Wichtig: Verhindert Textmarkierung beim Ziehen */

    background: #fff;

    padding: 10px;

    border-radius: 8px;

    box-shadow: 0 2px 10px rgba(0,0,0,0.05);

    border: 1px solid #eee;

    margin: 0 auto;

}



/* Einzelne Zelle */

.cell {

    width: 35px;

    height: 35px;

    display: flex;

    align-items: center;

    justify-content: center;

    font-weight: 400; /*Schriftgrad im app_suchsel*/

    font-size: 1.1rem;

    border: 1px solid #f0f0f0;

    border-radius: 4px;

    cursor: pointer;

    text-transform: uppercase;

    background: #fff;

    transition: background-color 0.1s, transform 0.1s;

}



.cell:hover {

    background-color: #f0f9ff;

    z-index: 1; /* Leichter Hover-Effekt über Nachbarn */

}



/* ZUSTAND: Während des Ziehens (Gelb) */

.cell.selecting {

    background-color: var(--highlight-selecting) !important;

}



/* ZUSTAND: Gefundenes Wort (Grün) */

.cell.found {

    background-color: var(--highlight-found) !important;

    color: white;

    border-color: #45a049;

    animation: popIn 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);

}



/* === 4. SIDEBAR (RECHTS) === */

.sidebar {

    flex: 1;

    min-width: 240px;

    max-width: 320px;

    background: #f8f9fa;

    padding: 20px;

    border-radius: 8px;

    border: 1px solid #eee;

}



.sidebar h3 {

    font-size: 1.1rem;

    border-bottom: 2px solid #e9ecef;

    padding-bottom: 10px;

    margin-bottom: 15px;

}



/* Wortliste */

.word-list {

    list-style: none;

    padding: 0;

    margin: 0;

    max-height: 400px;

    overflow-y: auto; /* Scrollen bei sehr vielen Wörtern */

}



.word-list li {

    padding: 8px 10px;

    border-bottom: 1px solid #e9ecef;

    font-weight: 500;

    font-size: 0.95rem;

    display: flex;

    justify-content: space-between;

    align-items: center;

    color: #333;

    transition: all 0.3s;

}



/* NEU: Richtungs-Badge (Basis) */

.dir-badge {

    display: inline-block;

    width: 20px;

    text-align: center;

    margin-right: 8px;

    color: #888;

    font-weight: bold;

    font-family: system-ui, sans-serif;

    line-height: 1;

}



/* Silbeneinfärbung in der Wortliste */

.syl-a {
    color: #1d4ed8; /* Blau – erste, dritte, … Silbe */
}

.syl-b {
    color: #dc2626; /* Rot  – zweite, vierte, … Silbe */
}

/* Gefundene Wörter: Silbenfarben dezenter */
.word-list li.found .syl-a,
.word-list li.found .syl-b {
    color: inherit;
}

/* Styling für Artikel vor Nomen */

.article-prefix {

    color: #999;

    font-size: 0.85em;

    font-weight: normal;

    margin-right: 4px;

    font-style: italic; /* Optional: kursiv sieht bei Artikeln oft gut aus */

}



/* Rotationen für die Pfeile (Basis ist ↑) */

.badge-h_right      { transform: rotate(90deg); }

.badge-h_left       { transform: rotate(-90deg); }

.badge-v_down       { transform: rotate(180deg); }

.badge-v_up         { transform: rotate(0deg); }

.badge-d_down_right { transform: rotate(135deg); }

.badge-d_up_left    { transform: rotate(-45deg); }

.badge-d_up_right   { transform: rotate(45deg); }

.badge-d_down_left  { transform: rotate(-135deg); }



/* Durchgestrichenes Wort */

.word-list li.found {

    color: #9ca3af;

    background-color: #e9ecef;

}



/* Nur den Text im Span durchstreichen (Artikel + Wort) */

.word-list li.found > span:first-child {

    text-decoration: line-through;

}



.word-list li .check {

    opacity: 0;

    color: var(--highlight-found);

    font-weight: bold;

    text-decoration: none; /* Zur Sicherheit */

}



.word-list li.found .check {

    opacity: 1;

}



/* Statusleiste (Timer & Zähler) */

.status-bar {

    margin-top: 20px;

    padding-top: 15px;

    border-top: 2px solid #e9ecef;

    display: flex;

    flex-direction: column;

    gap: 12px;

    font-weight: 600;

    color: #555;

}



.timer-display {

    font-family: 'Courier New', monospace;

    font-size: 1.2rem;

    color: #333;

    background: #e9ecef;

    padding: 8px;

    border-radius: 4px;

    text-align: center;

    letter-spacing: 1px;

}



/* === 5. ERGEBNIS BOX & HIGHSCORE === */

.result-box {

    background-color: var(--success-bg);

    border: 2px solid #86efac;

    color: var(--success-text);

    padding: 20px;

    border-radius: 8px;

    text-align: center;

    animation: slideUp 0.5s ease-out;

    width: 100%;

    box-sizing: border-box;

}



.result-box h2 {

    color: var(--success-text);

    margin-bottom: 10px;

}



/* Highscore Eingabezeile */

#highscoreInputSection {

    display: flex;

    gap: 10px;

    justify-content: center;

    margin: 20px 0;

}



#highscoreInputSection input {

    margin-bottom: 0; /* Override global input margin */

    width: auto;

    text-align: center;

    font-weight: bold;

}



/* Highscore Tabelle */

.hs-table {

    width: 100%;

    border-collapse: collapse;

    margin-top: 15px;

    background: rgba(255, 255, 255, 0.6);

    border-radius: 6px;

    font-size: 0.95rem;

}



.hs-table th {

    background-color: rgba(255, 255, 255, 0.8);

    font-weight: bold;

    text-align: left;

    padding: 8px;

    border-bottom: 2px solid #86efac;

}



.hs-table td {

    padding: 8px;

    border-bottom: 1px solid #c6f6d5;

    text-align: left;

}



.hs-table tr:last-child td {

    border-bottom: none;

}



/* === 6. EDITOR STYLES === */

/* Das Raster für die Checkboxen im Editor */

.options-grid {

    display: grid;

    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));

    gap: 12px;

    background: #fff;

    padding: 20px;

    border: 1px solid #ccc;

    border-radius: 6px;

    margin-bottom: 25px;

}



.options-grid label {

    display: flex;

    align-items: center;

    gap: 10px;

    cursor: pointer;

    font-weight: normal;

    font-size: 0.95rem;

    user-select: none;

}



.options-grid input[type="checkbox"] {

    width: 18px;

    height: 18px;

    cursor: pointer;

    accent-color: var(--primary);

    margin: 0;

}



/* Formularelemente */

textarea {

    width: 100%;

    min-height: 250px;

    padding: 12px;

    border: 1px solid #ccc;

    border-radius: 6px;

    font-family: monospace;

    font-size: 1rem;

    box-sizing: border-box;

    resize: vertical;

}



input[type="text"], input[type="number"] {

    width: 100%;

    padding: 10px;

    margin-bottom: 15px;

    border: 1px solid #ccc;

    border-radius: 6px;

    box-sizing: border-box;

    font-size: 1rem;

}



/* === 7. ANIMATIONEN & UTILS === */

.hidden {

    display: none !important;

}



@keyframes popIn {

    0% { transform: scale(0.5); opacity: 0; }

    60% { transform: scale(1.1); opacity: 1; }

    100% { transform: scale(1); }

}



@keyframes slideUp {

    from { opacity: 0; transform: translateY(20px); }

    to { opacity: 1; transform: translateY(0); }

}



/* === 8. RESPONSIVE DESIGN === */

@media (max-width: 768px) {

    .game-area {

        flex-direction: column-reverse; /* Sidebar oben oder unten je nach Wunsch, hier unten da Liste lang sein kann */

        align-items: center;

    }

    

    .sidebar {

        width: 100%;

        max-width: none;

    }



    /* Kleinere Zellen auf Handys */

    .cell {

        width: 28px;

        height: 28px;

        font-size: 0.9rem;

    }

    

    .container {

        padding: 15px;

    }

}



@media (max-width: 480px) {

    .cell {

        width: 24px;

        height: 24px;

        font-size: 0.75rem;

    }

    

    .options-grid {

        grid-template-columns: 1fr; /* Untereinander auf kleinen Screens */

    }

}

/* ... dein bestehender CSS Code ... */

/* === UPDATE FÜR SUCHSEL GITTER === */

.grid-container {
    display: grid;
    gap: 2px;
    background: #fff;
    padding: 10px;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
    border: 1px solid #eee;
    margin: 0 auto;
    
    /* NEU: Verhindert Zusammenquetschen & erlaubt Scrollen */
    width: max-content; 
    max-width: 100%;
    overflow-x: auto; 
}

/* Standard Zellengröße (Desktop) */
.cell {
    width: 35px;       /* Passend zur PHP-Berechnung */
    height: 35px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    border: 1px solid #f0f0f0;
    border-radius: 4px;
    cursor: pointer;
    text-transform: uppercase;
    background: #fff;
    user-select: none;
    transition: background-color 0.1s;
}

/* Mobile Anpassungen */
@media (max-width: 800px) {
    .cell { 
        width: 30px;   /* Kleiner auf Tablets/Handys */
        height: 30px; 
        font-size: 0.9rem; 
    }
}

@media (max-width: 480px) {
    .cell { 
        width: 26px;   /* Ganz klein auf kleinen Screens */
        height: 26px; 
        font-size: 0.8rem;
    }
}

.dir-badge {
    display: inline-block;
    width: 20px;
    height: 20px;
    text-align: center;
    margin-right: 8px;
    color: #999;
    font-weight: bold;
    font-size: 1.1rem;
    line-height: 1;
}

/* Rotationen */
.badge-h_right      { transform: rotate(90deg); }
.badge-h_left       { transform: rotate(-90deg); }
.badge-v_down       { transform: rotate(180deg); }
.badge-v_up         { transform: rotate(0deg); }
.badge-d_down_right { transform: rotate(135deg); }
.badge-d_up_left    { transform: rotate(-45deg); }
.badge-d_up_right   { transform: rotate(45deg); }
.badge-d_down_left  { transform: rotate(-135deg); }

/* Highscore Bereich sauber abtrennen */
.highscore-section {
    border-top: 1px solid #eee;
    padding-top: 20px;
}