html,
body {
    min-height: 100%;
}

body {
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    margin: 0;
    background: #e9edf9;
    color: #0f172a;
    display: flex;
    flex-direction: column;
}

header {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 18px;
    flex-wrap: wrap;
    padding: clamp(14px, 4vw, 28px);
}

header a {
    text-decoration: none;
    color: inherit;
    font-weight: 600;
    font-size: 1.05rem;
}

header a:hover {
    text-decoration: underline;
}

main#app {
    flex: 1;
    padding: clamp(16px, 5vw, 32px);
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
    box-sizing: border-box;
}

main#app > .home {
    align-self: stretch;
}

.home {
    max-width: 1100px;
    width: 100%;
    margin: 0 auto;
}

.columns {
    display: flex;
    gap: 20px;
    align-items: flex-start;
}

.col {
    flex: 1 1 0;
    min-width: 230px;
}

.card {
    border: 1px solid #e5e7f3;
    border-radius: 16px;
    padding: 22px 24px;
    margin-bottom: 18px;
    background: #ffffff;
    max-width: 420px;
    width: 100%;
    margin-left: auto;
    margin-right: auto;
    box-shadow: 0 18px 32px rgba(15, 23, 42, 0.12);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.card h2 {
    font-size: 1.65rem;
    margin-bottom: 14px;
}

.card p {
    font-size: 1.15rem;
    line-height: 1.6;
}

.card.small {
    padding: 10px 12px;
    border-radius: 8px;
    box-shadow: none;
    margin-bottom: 12px;
}

.card-link {
    text-decoration: none;
    color: inherit;
    display: block;
}

.card-link:hover .card {
    transform: translateY(-2px);
    box-shadow: 0 24px 36px rgba(15, 23, 42, 0.14);
}

.home .card {
    max-width: none;
    box-shadow: none;
    border-radius: 6px;
    padding: 14px 16px;
    margin: 0;
    border: 1px solid #ddd;
}

.home .card h2 {
    font-size: 1.3rem;
    margin-bottom: 10px;
}

.home .card p {
    font-size: 1rem;
}

.muted {
    opacity: 0.6;
}

/* === Language pair selector === */
.lang-select {
    max-width: 900px;
    width: 100%;
    margin: 0 auto;
    text-align: center;
}

.lang-select h1 {
    font-size: clamp(2rem, 6vw, 3rem);
    margin-bottom: 8px;
}

.lang-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    margin-top: 32px;
    text-align: left;
}

.lang-card {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
    padding: 20px 22px;
    border-radius: 14px;
    max-width: none;
    box-shadow: 0 4px 16px rgba(15, 23, 42, 0.08);
}

.lang-card h2 {
    font-size: 1.1rem;
    margin: 0;
}

.lang-card p {
    font-size: 0.9rem;
    margin: 0;
    color: #64748b;
}

.lang-flag {
    font-size: 2rem;
    line-height: 1;
    margin-bottom: 4px;
}

.card-link:hover .lang-card {
    transform: translateY(-3px);
    box-shadow: 0 8px 24px rgba(15, 23, 42, 0.14);
}

main#app > .lang-select {
    align-self: stretch;
}

/* === Gaps full-screen layout === */
.gaps-screen {
    flex: 1;
    width: 100%;
    background: radial-gradient(circle at top, #f6f9ff 0%, #eef2ff 45%, #e7ecff 100%);
    border-radius: 30px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    padding: clamp(24px, 6vw, 48px);
    box-shadow: inset 0 0 0 1px rgba(120, 138, 255, 0.07), 0 32px 60px rgba(15, 23, 42, 0.22);
    box-sizing: border-box;
}

.card-gap {
    max-width: 520px;
    width: 100%;
    min-height: clamp(540px, 85vh, 680px);
    display: flex;
    flex-direction: column;
    gap: clamp(18px, 3vw, 28px);
    padding: clamp(28px, 5vw, 36px);
    border-radius: 26px;
    box-shadow: 0 22px 48px rgba(15, 23, 42, 0.16);
    border: none;
}

.card-gap__header {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.card-gap h2 {
    font-size: clamp(1.5rem, 1.8rem, 2rem);
    margin-bottom: 8px;
}

.card-gap__sentence {
    font-size: clamp(1.35rem, 1.5rem, 1.65rem);
    line-height: 1.6;
    margin: 0;
}

.card-gap__input {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.card-gap__actions,
.sentence-actions {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

#gapInput {
    border: 2px solid rgba(99, 102, 241, 0.25);
    background: rgba(255, 255, 255, 0.85);
    border-radius: 14px;
    font-size: 1.25rem;
    padding: 16px 18px;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.card-gap__actions button,
.sentence-actions button {
    width: 100%;
    box-sizing: border-box;
    font-size: 1.25rem;
    padding: 16px 18px;
    border-radius: 14px;
    font-weight: 700;
    letter-spacing: 0.02em;
    border: none;
    cursor: pointer;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

#gapInput:focus {
    outline: none;
    border-color: rgba(99, 102, 241, 0.6);
    box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.25);
}

#checkGap,
#checkSentence {
    background: linear-gradient(135deg, #0f172a 0%, #1f2937 100%);
    color: #ffffff;
}

#nextGapBtn,
#nextSentence,
#nextArtikel {
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
    color: #ffffff;
}

#resetSentence {
    background: linear-gradient(135deg, #e2e8f0 0%, #cbd5f5 100%);
    color: #1f2937;
}

#checkGap:hover,
#nextGapBtn:hover,
#checkSentence:hover,
#nextSentence:hover,
#nextArtikel:hover,
#resetSentence:hover {
    transform: translateY(-2px);
    box-shadow: 0 16px 32px rgba(15, 23, 42, 0.15);
}

.gap-result {
    min-height: 52px;
    border-radius: 14px;
    padding: 12px 16px;
    display: flex;
    align-items: center;
    font-size: 1.05rem;
    font-weight: 600;
    margin-top: auto;
}

.correct {
    background: #c8f7c5;
}

.wrong {
    background: #f7c5c5;
}

.gap-result.correct {
    color: #0f5132;
}

.gap-result.wrong {
    color: #7f1d1d;
}

/* === added for training === */
.token {
    display: inline-block;
    border: 1px solid #888;
    padding: 4px 8px;
    margin: 4px;
    border-radius: 4px;
    cursor: pointer;
    background: #fff;
}


/* Responsive adjustments */
@media (max-width: 1024px) {
    .card {
        max-width: 100%;
    }

    .columns {
        flex-wrap: wrap;
    }
}


@media (max-width: 800px) {
    .columns {
        flex-direction: column;
    }

    .gaps-screen {
        border-radius: 24px;
    }

    .card-gap {
        min-height: auto;
    }
}

@media (max-width: 420px) {
    body {
        background: #f2f4fd;
    }

    header {
        gap: 12px;
        padding: 18px;
    }

    header a {
        font-size: 0.98rem;
    }

    main#app {
        padding: 0;
    }

    .gaps-screen {
        border-radius: 0;
        padding: 16px 16px;
        box-shadow: none;
        margin: 0;
        background: linear-gradient(160deg, #f3f5ff 0%, #ffffff 100%);
    }

    .card {
        padding: 20px;
        border-radius: 18px;
        max-width: 100%;
        margin: 0 0;
    }

    .card-gap {
        box-shadow: none;
        min-height: auto;
      
    }

    .card-gap__sentence {
        font-size: 1.15rem;
    }

    #checkGap,
    #nextGapBtn {
        font-size: 1.15rem;
        padding: 14px;
    }
}

/* ==== Sentences (mobile-first) ========================================== */

/*      .sentences-screen ( .sentence-screen) */
.sentences-screen .card,
.sentence-screen .card,
.card-sentence {
    width: 100%;
    max-width: 700px;
    margin: 0 auto;
    border-radius: 16px;
    padding: clamp(12px, 4vw, 18px);
    background: #fff;
    box-shadow: 0 1px 3px rgba(0, 0, 0, .06);
}

/*   */
.sentences-screen .sentence-text,
.sentence-screen .sentence-text {
    font-size: clamp(1rem, 2.5vw + 0.6rem, 1.25rem);
    line-height: 1.45;
    margin: 6px 0 12px;
}

/* ,     */
.sentences-screen .drop-zone,
.sentence-screen .drop-zone {
    min-height: 56px;
    border: 2px dashed #cbd5e1;
    border-radius: 12px;
    background: #fff;
    padding: 10px;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
    margin-bottom: 14px;
}

/*     */
.sentences-screen .tokens,
.sentence-screen .tokens {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: center;
    margin: 10px 0 14px;
}

/*   */
.sentences-screen .token,
.sentence-screen .token {
    font-size: 16px;
    /* >=16px,  iOS   */
    line-height: 1;
    padding: 10px 14px;
    border-radius: 9999px;
    background: #fff;
    border: 1px solid #cbd5e1;
    box-shadow: 0 1px 2px rgba(0, 0, 0, .04);
    user-select: none;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
    transition: transform .05s ease;
}

.sentences-screen .token:active,
.sentence-screen .token:active {
    transform: scale(.98);
}

/*   */


/*         */
@media (max-width: 640px) {
    header {
        position: sticky;
        top: 0;
        backdrop-filter: blur(6px);
        background: rgba(233, 237, 249, .85);
        overflow-x: auto;
        white-space: nowrap;
    }

    header a {
        display: inline-block;
        padding: 8px 10px;
        margin-right: 8px;
    }

    main#app {
        padding: clamp(12px, 4vw, 20px);
    }
}

/*    */

/*        */
.sentences-screen .card,
.card-sentence {
    width: 450px;
    margin: 12px auto 24px;
    border-radius: 16px;
    padding: clamp(14px, 4vw, 18px);
    box-shadow: 0 8px 18px rgba(15, 23, 42, .08);
}

/*    */
.sentences-screen .card h2 {
    margin: 4px 0 6px;
}

.sentences-screen .sentence-text {
    margin: 4px 0 10px;
}

/*    ,     */
.drop-zone {
    min-height: 56px;
    border: 2px dashed #cbd5e1;
    border-radius: 12px;
    background: #fff;
    padding: 10px;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
    margin: 8px 0 12px;
}

.drop-zone:empty::before {
    content: "Tap words to build the sentence";
    color: #94a3b8;
    font-size: 14px;
}

/*     ,      */
.tokens {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: center;
    margin: 8px 0 12px;
    max-height: 38vh;
    overflow: auto;
    -webkit-overflow-scrolling: touch;
}

/* /    */
.token {
    font-size: 16px;
    /* >=16px,  iOS   */
    line-height: 1;
    padding: 10px 14px;
    border-radius: 9999px;
    border: 1px solid #cbd5e1;
    background: #fff;
    box-shadow: 0 1px 2px rgba(0, 0, 0, .04);
    user-select: none;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
    transition: transform .05s ease;
}

.token:active {
    transform: scale(.98);
}

.token:focus-visible {
    outline: 3px solid rgba(59, 130, 246, .35);
}

/* Sticky-    */
/*     ,   */
.drop-zone.correct {
    background: #e8fbe9;
    border-color: #86efac;
}

.drop-zone.wrong {
    background: #ffe8e8;
    border-color: #fca5a5;
}

/*   ,     */
@media (max-width: 640px) {
    header {
        position: sticky;
        top: 0;
        backdrop-filter: blur(6px);
        background: rgba(233, 237, 249, .85);
        overflow-x: auto;
        white-space: nowrap;
        padding: 10px 12px;
    }

    header a {
        display: inline-block;
        padding: 8px 10px;
        margin-right: 8px;
    }

    main#app {
        padding: 12px;
    }
}

.levels {
    display: flex;
    flex-direction: column;
    gap: 16px;
    margin-top: 24px;
}

/* Level container */
.level details {
    background: #ffffff;
    border-radius: 18px;
    padding: 10px 14px 14px;
    box-shadow: 0 6px 18px rgba(15, 23, 42, 0.06);
}

/* Header of the level */
.level-summary {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px 16px;
    cursor: pointer;
    list-style: none;
}

.level-summary::-webkit-details-marker {
    display: none;
}

.level-badge {
    font-weight: 700;
    padding: 4px 10px;
    border-radius: 999px;
    border: 1px solid rgba(148, 163, 184, 0.6);
    font-size: 0.9rem;
}

.level-title {
    font-weight: 600;
}

.level-hint {
    font-size: 0.9rem;
    color: #64748b;
}

/* Grid of level cards */
.level-cards {
    margin-top: 14px;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
    gap: 12px;
}

/* Link around card */
.level-cards .card-link {
    text-decoration: none;
    color: inherit;
    display: block;
}

/* Basic card styles for small cards */
.card.small {
    padding: 10px 12px;
    border-radius: 14px;
    background: #f8fafc;
    border: 1px solid rgba(148, 163, 184, 0.35);
    transition: transform 0.12s ease, box-shadow 0.12s ease, background 0.12s ease;
}

.card.small:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 18px rgba(15, 23, 42, 0.08);
    background: #ffffff;
}

/* Muted (disabled) card styles */
.card.small.muted {
    opacity: 0.7;
    cursor: default;
}

.card.small.muted:hover {
    transform: none;
    box-shadow: none;
    background: #f8fafc;
}


.sublevels {
    margin-top: 12px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.sublevel details {
    background: #f8fafc;
    border-radius: 14px;
    padding: 8px 10px 10px;
    box-shadow: 0 4px 10px rgba(15, 23, 42, 0.04);
}

.sublevel-summary {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px 10px;
    cursor: pointer;
}

.sublevel-summary::-webkit-details-marker {
    display: none;
}

.sublevel-title {
    font-weight: 600;
}

.sublevel-hint {
    font-size: 0.85rem;
    color: #64748b;
}


/* === Artikel exercise === */

.card-artikel {
    max-width: 480px;
    width: 100%;
    text-align: center;
}

.artikel-noun {
    font-size: 2rem;
    font-weight: 700;
    margin: 20px 0 8px;
    color: #0f172a;
}

.artikel-translation {
    color: #64748b;
    font-size: 0.9rem;
    margin: 0 0 24px;
}

.artikel-buttons {
    display: flex;
    gap: 12px;
    justify-content: center;
    margin: 16px 0;
}

.artikel-btn {
    font-size: 1.1rem;
    font-weight: 600;
    padding: 12px 28px;
    border: 2px solid #cbd5e1;
    border-radius: 8px;
    background: #fff;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s;
    min-width: 80px;
}

.artikel-btn:hover:not(:disabled) {
    background: #f1f5f9;
    border-color: #94a3b8;
}

.artikel-btn:disabled {
    cursor: default;
}

.artikel-btn.correct {
    background: #c8f7c5;
    border-color: #4ade80;
}

.artikel-btn.wrong {
    background: #f7c5c5;
    border-color: #f87171;
}

#nextArtikel {
    width: 100%;
    box-sizing: border-box;
    font-size: 1.25rem;
    padding: 16px 18px;
    border-radius: 14px;
    font-weight: 700;
    letter-spacing: 0.02em;
    border: none;
    cursor: pointer;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
    margin-top: 8px;
}

/* === end Artikel exercise === */

#app-footer {
    text-align: center;
    padding: 12px;
    font-size: 0.75rem;
    color: #475569;
}
