* { box-sizing: border-box; }

body {
    font-family: system-ui, sans-serif;
    margin: 0;
    background-color: #f5f5f5;
    color: #222;
}

.site-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.5rem;
    background: white;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.site-header .brand {
    font-weight: bold;
    text-decoration: none;
    color: #222;
}

.site-header nav a,
.site-header nav button {
    margin-left: 1rem;
}

.inline-form {
    display: inline;
}

.app-layout {
    display: flex;
    align-items: stretch;
    min-height: 100vh;
}

.main-area {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.content {
    flex: 1;
    max-width: 700px;
    width: 100%;
    margin: 2rem auto;
    padding: 0 1rem;
}

.sidebar {
    width: 240px;
    flex-shrink: 0;
    background: white;
    box-shadow: 1px 0 3px rgba(0,0,0,0.1);
    padding: 1.25rem;
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
}

.sidebar-profile {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding-bottom: 1rem;
    margin-bottom: 0.25rem;
    border-bottom: 1px solid #eee;
}

.avatar-placeholder {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: #007bff;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    flex-shrink: 0;
}

.sidebar-name {
    font-weight: bold;
    word-break: break-word;
    font-size: 0.95rem;
}

.sidebar-stats {
    list-style: none;
    margin: 0;
    padding: 0;
}

.sidebar-stat {
    padding: 0.6rem 0;
    border-bottom: 1px solid #f0f0f0;
}

.sidebar-stat:last-child {
    border-bottom: none;
}

.sidebar-stat-label {
    display: block;
    font-size: 0.8rem;
    color: #666;
}

.sidebar-stat-value {
    display: block;
    font-size: 1.1rem;
    font-weight: bold;
}

.sidebar-stat-changed {
    display: block;
    font-size: 0.75rem;
    color: #999;
    margin-top: 0.15rem;
}

@media (max-width: 640px) {
    .app-layout {
        flex-direction: column;
    }
    .sidebar {
        width: 100%;
        height: auto;
        position: static;
        box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    }
}

.card {
    background: white;
    padding: 1.5rem;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

form.stacked label {
    display: block;
    margin-top: 1rem;
    font-size: 0.9rem;
}

form.stacked input {
    width: 100%;
    padding: 0.5rem;
    margin-top: 0.25rem;
    font-size: 1rem;
}

button, input[type="submit"] {
    padding: 0.5rem 1rem;
    font-size: 1rem;
    cursor: pointer;
    background-color: #007bff;
    color: white;
    border: none;
    border-radius: 4px;
}

button:hover {
    background-color: #0056b3;
}

.error {
    color: #b00020;
}

.result-correct {
    border-left: 4px solid #2e7d32;
}

.result-incorrect {
    border-left: 4px solid #b00020;
}

.xp-line {
    color: #555;
    font-size: 0.9rem;
}

.achievement-badge {
    background: #fff8e1;
    border-radius: 4px;
    padding: 0.5rem;
    margin-top: 0.5rem;
}

.button-link {
    display: inline-block;
    margin-top: 1rem;
    padding: 0.5rem 1rem;
    background-color: #007bff;
    color: white;
    text-decoration: none;
    border-radius: 4px;
}

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

.exercise-meta {
    color: #666;
    font-size: 0.85rem;
}

.sprachbausteine-sentence {
    line-height: 2.4;
}

.sprachbausteine-sentence select {
    margin: 0 0.25rem;
}

.drill-sentence {
    font-size: 1.6rem;
    line-height: 1.5;
    min-height: 3.2rem;
    margin: 1.5rem 0;
}

.drill-translation {
    font-size: 1.05rem;
    color: #666;
    min-height: 1.5rem;
    margin: -1rem 0 1.5rem;
}

.drill-controls button {
    margin-right: 0.5rem;
}

.drill-controls button:disabled {
    background-color: #ccc;
    cursor: default;
}

.drill-list {
    margin-bottom: 1.5rem;
}

.drill-list li {
    margin: 0.25rem 0;
}

.drill-list .exercise-meta {
    margin-left: 0.5rem;
}

.drill-explanation {
    margin-top: 1rem;
    padding: 0.75rem 1rem;
    background-color: #f5f5f0;
    border-left: 3px solid #999;
    line-height: 1.5;
}

.drill-explanation code {
    background-color: #e8e8e0;
    padding: 0.1em 0.3em;
    border-radius: 3px;
    font-size: 0.9em;
}

.sprachbausteine-sentence select.gap-correct {
    border: 2px solid #2e7d32;
    background-color: #eaf6ea;
}

.sprachbausteine-sentence select.gap-incorrect {
    border: 2px solid #b00020;
    background-color: #fdeaea;
}

.gap-correct-answer {
    color: #b00020;
    font-size: 0.85rem;
    font-weight: bold;
}

.progress-table {
    width: 100%;
    border-collapse: collapse;
}

.progress-table th,
.progress-table td {
    text-align: left;
    padding: 0.4rem 0.5rem;
    border-bottom: 1px solid #eee;
}

.achievement-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 0.75rem;
}

.achievement-locked {
    opacity: 0.4;
}
