* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --bg-primary: #ffffff;
    --bg-secondary: #f8f9fa;
    --text-dark: #2c3e50;
    --text-light: #7f8c8d;
    --accent-purple: #8e44ad;
    --accent-blue: #3498db;
    --accent-green: #27ae60;
    --accent-red: #e74c3c;
    --border-light: #ecf0f1;
    --border-medium: #bdc3c7;
    --highlight-yellow: #fff3cd;
    --cell-size: 42px;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: var(--bg-secondary);
    color: var(--text-dark);
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.app-container {
    max-width: 100%;
    margin: 0 auto;
    padding: 20px;
    flex: 1;
    display: flex;
    flex-direction: column;
}

/* Header */
.header {
    background: var(--bg-primary);
    padding: 20px 30px;
    border-radius: 12px;
    margin-bottom: 15px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.title {
    font-size: 32px;
    font-weight: 700;
    color: var(--text-dark);
    margin-bottom: 20px;
    text-align: center;
}

.header-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 20px;
    flex-wrap: wrap;
}

.size-selector {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.action-buttons {
    display: flex;
    gap: 12px;
}

/* Buttons */
.btn {
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: inherit;
}

.btn-new {
    background: var(--accent-blue);
    color: white;
}

.btn-new:hover {
    background: #2980b9;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(52, 152, 219, 0.3);
}

.btn-check {
    background: var(--accent-purple);
    color: white;
}

.btn-check:hover {
    background: #7d3c98;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(142, 68, 173, 0.3);
}

.btn-reset {
    background: var(--accent-red);
    color: white;
}

.btn-reset:hover {
    background: #c0392b;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(231, 76, 60, 0.3);
}

.size-btn {
    padding: 10px 18px;
    background: var(--bg-primary);
    color: var(--text-dark);
    border: 2px solid var(--border-light);
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.size-btn:hover {
    border-color: var(--accent-blue);
    transform: translateY(-2px);
}

.size-btn.active {
    background: var(--accent-blue);
    color: white;
    border-color: var(--accent-blue);
}

/* Status Message */
#status {
    text-align: center;
    margin-bottom: 15px;
    min-height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.status-message {
    padding: 12px 24px;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
}

.status-message.success {
    background: #d4edda;
    color: var(--accent-green);
    border: 2px solid var(--accent-green);
}

.status-message.error {
    background: #f8d7da;
    color: var(--accent-red);
    border: 2px solid var(--accent-red);
}

/* Game Area */
.game-area {
    display: flex;
    justify-content: center;
    align-items: center;
    flex: 1;
    padding: 30px;
    background: var(--bg-primary);
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    overflow: auto;
    min-height: 500px;
}

#nonogramm-grid {
    display: inline-grid;
    gap: 0;
    border: 4px solid var(--text-dark);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
    margin: auto;
    border-radius: 4px;
}

/* Grid Cells */
.grid-cell {
    width: var(--cell-size);
    height: var(--cell-size);
    border: 1px solid #d0d0d0;
    background-color: #fafafa;
    cursor: pointer;
    position: relative;
    transition: all 0.15s ease;
    user-select: none;
}

/* Dicke Linien alle 5 Zellen */
.grid-cell.border-right-thick {
    border-right: 4px solid var(--text-dark) !important;
}

.grid-cell.border-bottom-thick {
    border-bottom: 4px solid var(--text-dark) !important;
}

.grid-cell:hover {
    background-color: #f0f0f0;
    border-color: var(--accent-blue);
    transform: scale(1.02);
    z-index: 5;
}

.grid-cell.filled {
    background: linear-gradient(135deg, #2c3e50 0%, #34495e 100%);
    border-color: #1a252f;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.2);
}

.grid-cell.filled:hover {
    background: linear-gradient(135deg, #34495e 0%, #3d566e 100%);
}

.grid-cell.solution-filled {
    background: linear-gradient(135deg, var(--accent-green) 0%, #2ecc71 100%);
    border-color: #229954;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.15);
}

.grid-cell.wrong-filled {
    background: linear-gradient(135deg, var(--accent-red) 0%, #ec7063 100%);
    border-color: #c0392b;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.15);
}

.grid-cell.marked::before {
    content: '×';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 28px;
    color: #95a5a6;
    font-weight: 700;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.grid-cell.highlight {
    background-color: #fff9c4 !important;
    box-shadow: inset 0 0 8px rgba(255, 204, 0, 0.3);
}

.grid-cell.filled.highlight {
    background: linear-gradient(135deg, #3d566e 0%, #4a6a86 100%) !important;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.2), 0 0 8px rgba(255, 204, 0, 0.3) !important;
}

.grid-cell.solution-filled.highlight {
    background: linear-gradient(135deg, #2ecc71 0%, #58d68d 100%) !important;
}

.grid-cell.wrong-filled.highlight {
    background: linear-gradient(135deg, #ec7063 0%, #f1948a 100%) !important;
}

/* Clue Cells */
.clue-cell {
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 15px;
    color: var(--text-dark);
    background-color: #f5f6f7;
    border: 1px solid #e0e0e0;
    user-select: none;
    transition: background-color 0.15s ease;
}

.clue-cell.row-clue {
    width: var(--cell-size);
    height: var(--cell-size);
    justify-content: center;
    gap: 5px;
}

.clue-cell.row-clue.last-clue {
    border-right: 4px solid var(--text-dark) !important;
}

.clue-cell.col-clue {
    width: var(--cell-size);
    height: var(--cell-size);
    flex-direction: column;
    justify-content: center;
    gap: 5px;
}

.clue-cell.col-clue.last-clue {
    border-bottom: 4px solid var(--text-dark) !important;
}

.clue-cell.corner {
    background-color: var(--bg-primary);
    border: 1px solid var(--border-light);
}

.clue-cell.highlight {
    background-color: #fff9c4 !important;
    font-weight: 800;
}

.clue-number {
    display: inline-block;
    font-variant-numeric: tabular-nums;
}

/* Responsive Design */
@media (max-width: 1024px) {
    :root {
        --cell-size: 30px;
    }
    
    .title {
        font-size: 28px;
    }
}

@media (max-width: 768px) {
    :root {
        --cell-size: 25px;
    }
    
    .app-container {
        padding: 15px;
    }
    
    .header {
        padding: 15px 20px;
    }
    
    .title {
        font-size: 24px;
        margin-bottom: 15px;
    }
    
    .header-controls {
        flex-direction: column;
        align-items: stretch;
    }
    
    .size-selector,
    .action-buttons {
        justify-content: center;
    }
    
    .btn {
        padding: 10px 20px;
        font-size: 14px;
    }
    
    .size-btn {
        padding: 8px 14px;
        font-size: 13px;
    }
    
    .game-area {
        padding: 10px;
    }
    
    .clue-cell {
        font-size: 12px;
    }
}

@media (max-width: 480px) {
    :root {
        --cell-size: 22px;
    }
    
    .title {
        font-size: 20px;
    }
    
    .clue-cell {
        font-size: 11px;
    }
}
