/* ============================================================
   DRILL MODE – OVERLAY LAYOUT
============================================================ */

#drillOverlay {
    position: fixed;
    inset: 0;
    z-index: 9999;
}

/* Hintergrund */
.drill-bg {
    position: absolute;
    inset: 0;
    background: rgba(15, 23, 42, 0.58);
    backdrop-filter: blur(4px);
}

/* Container: Karte links + Sidebar rechts */
.drill-container {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    display: grid;
    grid-template-columns: minmax(0, 760px) 240px;
    gap: 18px;
    align-items: stretch;
    width: min(1120px, calc(100vw - 32px));
    max-height: calc(100vh - 32px);
}

/* ============================================================
   DRILL CARD (linker Bereich)
============================================================ */

.drill-card {
    background: #ffffff;
    padding: clamp(22px, 3vw, 30px);
    width: 100%;
    border-radius: 18px;
    text-align: left;
    box-shadow: 0 22px 60px rgba(15, 23, 42, 0.24);
    overflow-y: auto;
}

.drill-card h2 {
    margin: 0;
    color: #17304a;
    font-size: clamp(1.45rem, 2.5vw, 2.05rem);
    line-height: 1.12;
}

.drill-title-row {
    display: flex;
    align-items: center;
    gap: 10px;
}

.drill-info {
    position: relative;
    width: 24px;
    height: 24px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    border-radius: 999px;
    background: #f5c451;
    color: #4b3710;
    font-size: 0.88rem;
    font-weight: 900;
    cursor: help;
}

.drill-xp-info {
    width: 34px;
    background: #2f9e62;
    color: #ffffff;
    font-size: 0.74rem;
    letter-spacing: 0;
}

.drill-info-tooltip {
    position: absolute;
    left: 50%;
    top: calc(100% + 10px);
    z-index: 2;
    width: min(280px, 78vw);
    padding: 10px 12px;
    border-radius: 10px;
    background: #17304a;
    color: #ffffff;
    font-size: 0.82rem;
    font-weight: 650;
    line-height: 1.45;
    text-align: left;
    box-shadow: 0 12px 26px rgba(15, 23, 42, 0.24);
    opacity: 0;
    pointer-events: none;
    transform: translate(-50%, -4px);
    transition: opacity 0.16s ease, transform 0.16s ease;
}

.drill-info:hover .drill-info-tooltip,
.drill-info:focus .drill-info-tooltip {
    opacity: 1;
    transform: translate(-50%, 0);
}

.drill-topbar {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 16px;
    margin-bottom: 18px;
}

.drill-kicker {
    margin: 0 0 6px;
    font-size: 12px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #1d5f77;
    font-weight: 850;
}

.drill-stats {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
    margin-bottom: 16px;
}

.drill-stat {
    background: #f7fafc;
    border: 1px solid #dfe9f1;
    border-radius: 12px;
    padding: 10px 12px;
    text-align: left;
}

.drill-stat-label {
    display: block;
    font-size: 12px;
    color: #6b7280;
    margin-bottom: 4px;
}

.drill-progress {
    height: 10px;
    background: #e7eff5;
    border-radius: 999px;
    overflow: hidden;
    margin-bottom: 18px;
}

.drill-progress-bar {
    width: 0;
    height: 100%;
    background: linear-gradient(90deg, #1d5f77, #2f7b57);
    transition: width 180ms ease;
}

.drill-question-wrap {
    margin-bottom: 18px;
    padding: 18px;
    border-radius: 16px;
    background: #f8fbfd;
    border: 1px solid #dfe9f1;
}

.drill-difficulty {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 999px;
    background: #e7f0f5;
    color: #1d5f77;
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin-bottom: 12px;
}

.drill-question {
    font-size: 18px;
    margin-bottom: 0;
    color: #17304a;
    font-weight: 800;
    line-height: 1.45;
}

/* Dropzonen */
.drill-row {
    padding: 14px;
    border: 1px solid #dfe9f1;
    border-radius: 16px;
    background: #ffffff;
}

.drill-row .cell > div:first-child {
    margin-bottom: 8px;
    color: #607489;
    font-size: 0.8rem;
    font-weight: 850;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.drill-row .dropzone {
    width: 100%;
    min-width: 170px;
    height: 50px;
    border-radius: 12px;
    border: 1px dashed #b8c8d6;
    background: #f8fbfd;
}

/* ============================================================
   DRILL BUTTONS
============================================================ */

.drill-check {
    margin-top: 10px;
}

.drill-actions {
    display: flex;
    justify-content: center;
    gap: 12px;
    margin-top: 18px;
}

.drill-check,
.drill-next {
    min-height: 46px;
    padding: 11px 18px;
    border-radius: 12px;
    border: 1px solid #174e63 !important;
    background: #1d5f77 !important;
    color: #fff !important;
    font-weight: 850;
}

.drill-next {
    background: #2f7b57 !important;
    border-color: #2a684b !important;
}

.drill-next.hidden,
.drill-check.hidden {
    display: none;
}

.drill-end {
    background: #f8fbfd !important;
    color: #37566b !important;
    border: 1px solid #d9e5ee !important;
    box-shadow: none !important;
}

/* Feedback */
.drill-feedback {
    min-height: 52px;
    margin-top: 14px;
    padding: 12px 14px;
    border-radius: 12px;
    text-align: left;
    border: 1px solid transparent;
}

.drill-feedback.success {
    background: #dcfce7;
    color: #166534;
    border-color: #bbf7d0;
}

.drill-feedback.error {
    background: #fee2e2;
    color: #991b1b;
    border-color: #fecaca;
}

.drill-feedback-hint {
    display: inline-block;
    margin-top: 6px;
    font-weight: 500;
}

.drill-feedback-xp {
    display: block;
    width: fit-content;
    margin-top: 9px;
    padding: 6px 9px;
    border-radius: 999px;
    background: rgba(47, 158, 98, 0.13);
    color: #166534;
    font-size: 0.82rem;
    font-weight: 850;
}

/* ============================================================
   DRILL SIDEBAR (rechter Bereich)
============================================================ */

.drill-sidebar {
    background: #ffffff;
    padding: 18px;
    border-radius: 18px;
    width: 100%;
    box-shadow: 0 22px 60px rgba(15, 23, 42, 0.2);
    max-height: 100%;
    overflow-y: auto;
}

.drill-sidebar h3 {
    text-align: left;
    margin-bottom: 8px;
    color: #17304a;
}

.drill-sidebar-note {
    font-size: 13px;
    color: #64748b;
    text-align: left;
    margin-bottom: 14px;
    line-height: 1.5;
}

/* Klassen Header */
.sidebar-class-header {
    padding: 10px;
    font-weight: bold;
    border-radius: 6px;
    cursor: pointer;
    color: #fff;
    margin-bottom: 6px;
}

.sidebar-class-header::after {
    content: "⯆";
    float: right;
}

.sidebar-class-header.open::after {
    content: "⯅";
}

/* Klassenfarben (wie im Hauptlayout) */
.class-0 { background: #6b7280; }
.class-1 { background: #0ea5e9; }
.class-2 { background: #16a34a; }
.class-3 { background: #f97316; }
.class-4 { background: #a855f7; }
.class-5 { background: #475569; }
.class-6 { background: #0f766e; }
.class-7 { background: #dc2626; }
.class-8 { background: #44403c; }
.class-9 { background: #7c3aed; }

/* Unterkonten */
.sidebar-subgroup {
    display: none;
    padding-left: 10px;
    margin-bottom: 10px;
}

.sidebar-subgroup.open {
    display: block;
}

.subaccount {
    background: #f8fafc;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    padding: 6px 8px;
    margin-bottom: 6px;
    cursor: grab;
    font-size: 14px;
    color: #334155;
}

.subaccount:hover {
    background: #e0e7ff;
    border-color: #6366f1;
}

/* ============================================================
   RESPONSIVE BEHAVIOR
============================================================ */

@media (max-width: 900px) {
    .drill-container {
        grid-template-columns: 1fr;
        transform: translate(-50%, -50%);
        width: calc(100vw - 24px);
        overflow-y: auto;
    }

    .drill-card {
        width: 100%;
        max-height: none;
    }

    .drill-sidebar {
        width: 100%;
        max-height: 280px;
    }

    .drill-stats {
        grid-template-columns: repeat(2, 1fr);
    }

    .drill-topbar,
    .drill-actions {
        display: grid;
    }
}
