body {
    font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
}

:root {
    --duo-green: #58cc02;
    --duo-green-soft: #b9ef6b;
    --duo-blue: #1cb0f6;
    --duo-dark: #094c2e;
    --duo-amber: #ffb000;
    --duo-neutral: #f0f4f8;
}

[x-cloak] {
    display: none !important;
}

.student-card {
    transition: transform 0.2s ease, box-shadow 0.2s ease, background-color 0.2s ease;
}

.student-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.1);
}

.student-card-celebrating {
    animation: celebrate-shake 0.7s ease-in-out infinite;
    box-shadow: 0 0.75rem 1.5rem rgba(88, 204, 2, 0.35);
}

@keyframes celebrate-shake {
    0% { transform: translateY(-1px) rotate(-1deg); }
    50% { transform: translateY(1px) rotate(1deg); }
    100% { transform: translateY(-1px) rotate(-1deg); }
}

.student-card-queued {
    background: linear-gradient(135deg, rgba(32, 201, 151, 0.15), rgba(25, 135, 84, 0.05));
    box-shadow: inset 0 0 0 2px rgba(25, 135, 84, 0.25);
}

.student-card-behavior-green {
    border-left: 4px solid #198754;
}

.student-card-behavior-orange {
    border-left: 6px solid #fd7e14;
    background: linear-gradient(135deg, rgba(255, 193, 7, 0.18), rgba(255, 214, 102, 0.12));
}

.student-card-behavior-red {
    border-left: 6px solid #dc3545;
    background: linear-gradient(135deg, rgba(220, 53, 69, 0.18), rgba(255, 132, 150, 0.15));
}

.class-header {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1.5rem;
    flex-wrap: wrap;
}

.class-menu {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
}

.class-menu .navbar-toggler {
    font-weight: 600;
    padding: 0.4rem 0.9rem;
    border-radius: 999px;
}

.class-menu-actions {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    flex-wrap: wrap;
    justify-content: flex-end;
    flex: 1;
}

.class-menu-actions .btn {
    white-space: nowrap;
}

@media (max-width: 767.98px) {
    .class-menu {
        width: 100%;
        flex-direction: column;
        align-items: stretch;
        justify-content: flex-start;
    }

    .class-menu .navbar-toggler {
        align-self: flex-end;
    }

    .class-menu .navbar-collapse {
        width: 100%;
        margin-top: 0.75rem;
    }

    .class-menu-actions {
        flex-direction: column;
        align-items: stretch;
        gap: 0.5rem;
    }
}

.class-summary-card {
    border-radius: 1rem;
    background: linear-gradient(135deg, rgba(88, 204, 2, 0.08), rgba(28, 176, 246, 0.06));
    box-shadow: inset 0 0 0 1px rgba(88, 204, 2, 0.15);
}

.class-summary-card .btn {
    border-radius: 999px;
    font-weight: 600;
}

.class-summary-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
}

.class-summary-progress {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.class-summary-stats {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
}

.class-summary-caption {
    font-weight: 600;
}

.student-card-performance-baseline {
    background: linear-gradient(135deg, rgba(77, 171, 247, 0.18), rgba(206, 233, 255, 0.35));
}

.student-card-performance-high {
    background: linear-gradient(140deg, rgba(80, 227, 194, 0.28), rgba(123, 237, 159, 0.18));
    box-shadow: inset 0 0 0 2px rgba(80, 227, 194, 0.35), 0 0.45rem 1.2rem rgba(80, 227, 194, 0.25);
}

.student-card-performance-low {
    background: linear-gradient(150deg, rgba(255, 179, 71, 0.32), rgba(255, 111, 97, 0.18));
    box-shadow: inset 0 0 0 2px rgba(255, 111, 97, 0.35), 0 0.35rem 1rem rgba(255, 111, 97, 0.25);
}

body.points-hidden [data-total-points],
body.points-hidden [data-modal-points] {
    display: none !important;
}

.student-card {
    border: 1px solid rgba(0, 0, 0, 0.05);
    border-radius: 1.25rem;
    background: #ffffff;
    box-shadow: 0 0.75rem 1.6rem rgba(15, 23, 42, 0.08);
    transition: transform 0.25s ease, box-shadow 0.25s ease;
    cursor: pointer;
}

.student-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 1rem 2rem rgba(15, 23, 42, 0.15);
}

.student-card:focus-visible {
    outline: 3px solid #0ea5e9;
    outline-offset: 2px;
}

.student-card .badge {
    font-weight: 600;
    letter-spacing: 0.02em;
}

.student-name h5 {
    font-size: 1.05rem;
    font-weight: 700;
    line-height: 1.2;
    margin-bottom: 0;
}

.student-name {
    text-align: center;
    min-height: 2.2rem;
    max-height: 2.4rem;
    line-height: 1.2;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 0.25rem;
}


.student-streak-number {
    font-size: 1.5rem;
    font-weight: 700;
    color: #0f172a;
    margin-top: auto;
}

.student-streak-number small {
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
}

.student-streak-meta small {
    font-weight: 500;
}

.student-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 0.45rem;
    align-items: stretch;
}

.student-card-best {
    border-color: #0ea5e9;
    background: linear-gradient(180deg, rgba(14, 165, 233, 0.15), rgba(14, 165, 233, 0.06));
}

.student-card-button {
    border: 0;
    background: transparent;
    width: 100%;
    height: 100%;
    text-align: left;
    padding: 0;
    color: inherit;
    cursor: pointer;
}

.student-card .card-body {
    padding: 0.45rem 0.45rem 0.5rem;
    min-height: 132px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.student-name-block h2 {
    font-size: 1.05rem;
    font-weight: 700;
}

@media (min-width: 1200px) {
    .student-name-block h2 {
        font-size: 0.98rem;
    }
}

.student-indicators {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    margin-top: 0.3rem;
    flex-wrap: wrap;
}

.student-indicators .badge,
.student-indicators .xp-level-pill {
    font-size: 0.8rem;
    padding: 0.25rem 0.5rem;
    border-radius: 0.9rem;
}

.student-warning {
    display: inline-block;
    font-size: 1.1rem;
}

.performance-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.85rem;
    font-weight: 600;
    margin-top: 0.35rem;
    padding: 0.25rem 0.6rem;
    border-radius: 999px;
    background: rgba(77, 157, 224, 0.18);
    color: #1e3a8a;
}

.performance-chip-emoji {
    font-size: 1.1rem;
}

.performance-chip-high {
    background: linear-gradient(135deg, rgba(80, 227, 194, 0.28), rgba(123, 237, 159, 0.18));
    color: #0b5345;
    box-shadow: 0 0.35rem 0.8rem rgba(80, 227, 194, 0.35);
}

.performance-chip-baseline {
    background: linear-gradient(135deg, rgba(77, 157, 224, 0.32), rgba(147, 197, 253, 0.22));
    color: #0d3b66;
}

.performance-chip-low {
    background: linear-gradient(135deg, rgba(255, 179, 71, 0.32), rgba(255, 111, 97, 0.22));
    color: #7f1d1d;
    box-shadow: 0 0.35rem 0.8rem rgba(255, 111, 97, 0.3);
}

@media (min-width: 1200px) {
    .student-indicators .badge {
        font-size: 0.75rem;
        padding: 0.2rem 0.45rem;
    }
}

.xp-widget,
.class-progress-card {
    background: linear-gradient(135deg, rgba(88, 204, 2, 0.12), rgba(28, 176, 246, 0.1));
    border-radius: 0.9rem;
    padding: 0.65rem 0.8rem;
    box-shadow: inset 0 0 0 1px rgba(88, 204, 2, 0.2);
}

.xp-widget-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    margin-bottom: 0.55rem;
}

.xp-widget-copy {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--duo-dark);
}

.xp-level-pill {
    background: linear-gradient(135deg, rgba(88, 204, 2, 0.9), rgba(28, 176, 246, 0.65));
    color: #fff;
    font-weight: 700;
    padding: 0.3rem 0.75rem;
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    letter-spacing: 0.02em;
    text-transform: uppercase;
}

.xp-level-pill-sm {
    padding: 0.25rem 0.6rem;
    font-size: 0.7rem;
}

.xp-level-pill-good {
    background: linear-gradient(135deg, rgba(88, 204, 2, 0.95), rgba(123, 237, 159, 0.8));
}

.xp-level-pill-warning {
    background: linear-gradient(135deg, rgba(255, 193, 7, 0.95), rgba(255, 214, 102, 0.8));
}

.xp-level-pill-alert {
    background: linear-gradient(135deg, rgba(220, 53, 69, 0.95), rgba(255, 102, 128, 0.8));
}

.xp-meter {
    position: relative;
    height: 0.65rem;
    background: rgba(9, 76, 46, 0.12);
    border-radius: 999px;
    overflow: hidden;
}

.xp-meter-fill {
    position: absolute;
    inset: 0;
    width: 0;
    background: linear-gradient(90deg, rgba(88, 204, 2, 1), rgba(28, 176, 246, 0.95));
    border-radius: inherit;
    transition: width 0.4s ease;
    box-shadow: 0 0.35rem 0.8rem rgba(88, 204, 2, 0.25);
}

.xp-meter-fill-good {
    background: linear-gradient(90deg, rgba(88, 204, 2, 1), rgba(28, 176, 246, 0.95));
    box-shadow: 0 0.35rem 0.8rem rgba(88, 204, 2, 0.3);
}

.xp-meter-fill-warning {
    background: linear-gradient(90deg, rgba(255, 193, 7, 1), rgba(255, 161, 22, 0.95));
    box-shadow: 0 0.35rem 0.8rem rgba(255, 193, 7, 0.3);
}

.xp-meter-fill-alert {
    background: linear-gradient(90deg, rgba(220, 53, 69, 1), rgba(235, 87, 87, 0.95));
    box-shadow: 0 0.35rem 0.8rem rgba(220, 53, 69, 0.35);
}

.student-alert {
    margin-top: 0.6rem;
    font-size: 0.85rem;
    font-weight: 600;
    color: inherit;
    text-align: center;
}

.student-modal-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
}

.student-modal-name {
    font-size: 1.1rem;
    font-weight: 700;
}

.student-modal-points {
    font-size: 1.5rem;
    font-weight: 700;
    color: #0b4f71;
}

.student-modal-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
    gap: 0.75rem;
}

.student-modal-stat {
    background: rgba(9, 76, 46, 0.08);
    border-radius: 0.75rem;
    padding: 0.6rem 0.8rem;
    text-align: center;
}

.student-modal-stat-label {
    display: block;
    font-size: 0.7rem;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: #0d3b66;
    margin-bottom: 0.15rem;
}

.student-modal-stat-value {
    font-size: 1rem;
    font-weight: 700;
    color: #0b4f71;
}

.student-modal-actions {
    display: grid;
    gap: 0.75rem;
}

.student-modal-actions form {
    width: 100%;
}

.student-action-button {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.6rem;
    font-weight: 600;
    padding: 0.75rem;
}

.student-action-emoji {
    font-size: 1.4rem;
    line-height: 1;
}

.student-action-label {
    font-size: 1rem;
}


.duo-stat-pills {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.4rem;
    margin-top: 0.6rem;
}

.duo-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.75rem;
    font-weight: 600;
    padding: 0.3rem 0.65rem;
    border-radius: 999px;
    background: var(--duo-neutral);
    color: var(--duo-dark);
}

.duo-pill-positive {
    background: rgba(88, 204, 2, 0.18);
    color: #1f6f21;
}

.duo-pill-negative {
    background: rgba(255, 176, 0, 0.2);
    color: #8b4513;
}

.duo-pill-net {
    background: rgba(28, 176, 246, 0.18);
    color: #0b4f71;
}

.student-card-button:focus {
    outline: none;
    box-shadow: none;
}

.student-card-absent {
    opacity: 0.6;
    position: relative;
}

.student-card-absent::after {
    content: '';
    position: absolute;
    inset: 0;
    border: 2px dashed rgba(255, 193, 7, 0.7);
    border-radius: 0.5rem;
    pointer-events: none;
}

.student-card-suspended {
    position: relative;
}

.student-card-suspended::after {
    content: '';
    position: absolute;
    inset: 0;
    border: 2px solid rgba(33, 37, 41, 0.4);
    border-radius: 0.5rem;
    pointer-events: none;
}

.student-card-suspended .student-card-button {
    opacity: 0.75;
}

.student-card-absent-container {
    order: 99;
}

.random-highlight {
    animation: pulse 1s ease-in-out 2;
}

@keyframes pulse {
    0%, 100% { box-shadow: 0 0 0 rgba(13, 110, 253, 0); }
    50% { box-shadow: 0 0 0.75rem rgba(13, 110, 253, 0.5); }
}

.student-action-button {
    font-size: 2rem;
    padding: 0.85rem 0;
    line-height: 1;
    border-radius: 1rem;
}

[data-modal-name] {
    font-size: 2rem;
    font-weight: 800;
    letter-spacing: 0.02em;
}

[data-modal-turns],
[data-modal-points] {
    font-size: 1.1rem;
    padding: 0.5rem 0.75rem;
}
