* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    background: #e8f7ec;
    color: #154a2e;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

header {
    background: linear-gradient(90deg, #4fbf73, #7ad697);
    padding: 10px 16px;
    color: #fff;
    box-shadow: 0 3px 8px rgba(0,0,0,0.15);
}

.header-inner {
    display: flex;
    align-items: center;
    gap: 12px;
    max-width: 1100px;
    margin: 0 auto;
}

.logo-img {
    height: 52px;
    width: auto;
    border-radius: 12px;
    background: rgba(255,255,255,0.2);
    padding: 4px;
}

.title-block h1 {
    font-size: 26px;
    margin: 0;
}
.title-block p {
    margin: 2px 0 0;
    font-size: 14px;
}

main {
    flex: 1;
    max-width: 1100px;
    width: 100%;
    margin: 0 auto;
    padding: 16px;
}

.controls {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: center;
    justify-content: center;
    margin-bottom: 12px;
}

.control-group {
    display: flex;
    flex-direction: column;
    font-size: 14px;
}

.control-group input,
.control-group select {
    padding: 8px 10px;
    border-radius: 999px;
    border: 2px solid #4fbf73;
    font-size: 16px;
    min-width: 180px;
}

.btn {
    border-radius: 999px;
    border: none;
    padding: 10px 18px;
    font-size: 16px;
    cursor: pointer;
    font-weight: 600;
    box-shadow: 0 3px 6px rgba(0,0,0,0.15);
    transition: transform 0.1s, box-shadow 0.1s;
}

.btn:active {
    transform: scale(0.97);
    box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}

.btn.primary {
    background: #4fbf73;
    color: white;
}

.btn.secondary {
    background: white;
    color: #4fbf73;
    border: 2px solid #4fbf73;
}

.word-box {
    margin: 10px auto 16px;
    max-width: 500px;
    background: #ffffff;
    border-radius: 20px;
    padding: 16px;
    box-shadow: 0 3px 10px rgba(0,0,0,0.15);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.speak-btn {
    font-size: 16px;
}

.current-word {
    font-size: 32px;
    font-weight: 700;
    padding: 6px 16px;
    border-radius: 999px;
    background: #e6f7ed;
    min-width: 180px;
    text-align: center;
}

.game-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 16px;
    margin-bottom: 16px;
}

.card {
    background: #ffffff;
    border-radius: 24px;
    padding: 18px 10px;
    box-shadow: 0 4px 10px rgba(0,0,0,0.18);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 56px;
    cursor: pointer;
    touch-action: manipulation;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
    transition: transform 0.1s, box-shadow 0.1s, border 0.1s;
}

.card:active {
    transform: scale(0.95);
    box-shadow: 0 2px 6px rgba(0,0,0,0.2);
}

.card.correct {
    border: 3px solid #2ecc71;
}
.card.wrong {
    border: 3px solid #e74c3c;
}

.status-bar {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 16px;
    align-items: center;
    font-size: 16px;
    margin-bottom: 12px;
}

#message {
    min-width: 180px;
    text-align: center;
    font-weight: 600;
}

/* Overlay / Urkunde */
.overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 50;
}
.hidden {
    display: none;
}

.certificate {
    background: #fffef4;
    border-radius: 24px;
    padding: 24px 24px 18px;
    max-width: 420px;
    width: 90%;
    text-align: center;
    box-shadow: 0 6px 18px rgba(0,0,0,0.25);
    border: 4px solid #f7d56a;
}

.certificate h2 {
    margin-top: 0;
    font-size: 26px;
    color: #c47a00;
}

.certificate-text {
    font-size: 20px;
    line-height: 1.5;
}

.certificate-sub {
    font-size: 16px;
    margin-top: 10px;
    color: #555;
}

.certificate-actions {
    margin-top: 16px;
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: center;
}

/* Druckansicht: nur Urkunde */
@media print {
    body > *:not(.overlay) {
        display: none !important;
    }
    .overlay {
        background: none;
        position: static;
    }
    .certificate {
        box-shadow: none;
        border: none;
        max-width: 100%;
    }
}

footer {
    text-align: center;
    font-size: 12px;
    padding: 8px 4px 10px;
    color: #3b6e4c;
}
