body {
    min-height: 100vh;
}

.auth-page {
    min-height: 100vh;
    background: linear-gradient(135deg, #192a56, #0f766e);
}

.auth-shell {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 24px;
}

.auth-brand {
    position: fixed;
    top: 22px;
    left: 24px;
    color: #fff;
    text-decoration: none;
    font-weight: 700;
}

.auth-card {
    width: min(100%, 420px);
    padding: 28px;
    border-radius: 8px;
    background: #fff;
    border: 1px solid rgba(255, 255, 255, 0.35);
    box-shadow: 0 18px 50px rgba(0, 0, 0, 0.2);
}

.auth-card-wide {
    width: min(100%, 560px);
}

.auth-field {
    margin-bottom: 16px;
}

.auth-field label {
    font-weight: 600;
    margin-bottom: 6px;
}

.auth-field input,
.auth-field select,
.auth-field textarea {
    display: block;
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #ced4da;
    border-radius: 8px;
    background: #fff;
}

.auth-field .form-text,
.auth-field ul {
    margin-top: 6px;
    margin-bottom: 0;
    color: #6c757d;
    font-size: 0.875rem;
}

.text-preline {
    white-space: pre-line;
}

.profile-card {
    color: #fff;
    background: linear-gradient(135deg, #192a56, #0f766e);
    border-radius: 8px;
}

.profile-subtitle {
    color: rgba(255, 255, 255, 0.86);
}

.avatar-circle {
    width: 64px;
    height: 64px;
    flex: 0 0 64px;
    aspect-ratio: 1;
    border-radius: 50%;
    display: grid;
    place-items: center;
    overflow: hidden;
    background: rgba(255, 255, 255, 0.18);
    border: 1px solid rgba(255, 255, 255, 0.35);
    font-size: 28px;
    font-weight: 700;
}

.avatar-circle img {
    width: 100%;
    height: 100%;
    display: block;
    object-fit: cover;
}

.stat-pill {
    background: rgba(255, 255, 255, 0.14);
    border: 1px solid rgba(255, 255, 255, 0.22);
    border-radius: 8px;
    padding: 12px;
}

.profile-hint {
    color: rgba(255, 255, 255, 0.76);
}

.achievement {
    display: flex;
    gap: 12px;
    align-items: flex-start;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    padding: 12px;
}

.achievement.earned {
    background: #f3fff7;
    border-color: #b8e7c9;
}

.achievement.locked {
    background: #f8f9fa;
}

.achievement-icon {
    width: 42px;
    height: 42px;
    flex: 0 0 42px;
    display: grid;
    place-items: center;
    border-radius: 8px;
    background: #fff;
    border: 1px solid #dee2e6;
    font-weight: 700;
}

.achievement-card {
    height: 100%;
    padding: 16px;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    background: #fff;
}

.achievement-card-earned {
    border-color: #9ad8b0;
    background: #f3fff7;
}

.achievement-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.achievement-badge {
    width: 42px;
    height: 42px;
    display: grid;
    place-items: center;
    border-radius: 8px;
    background: #f3fff7;
    border: 1px solid #9ad8b0;
    font-weight: 700;
    cursor: help;
}

.task-content pre,
.task-content code {
    font-family: Consolas, Monaco, monospace;
}

.task-content pre {
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    padding: 12px;
    overflow-x: auto;
}

.task-content table {
    width: 100%;
    margin: 12px 0;
    border-collapse: collapse;
}

.task-content td,
.task-content th {
    border: 1px solid #dee2e6;
    padding: 6px 8px;
}

.task-content img {
    max-width: 100%;
    height: auto;
}

.code-editor {
    font-family: Consolas, Monaco, monospace;
    font-size: 0.925rem;
    resize: vertical;
}

.mini-ide {
    overflow: hidden;
    border: 1px solid #2f3645;
    border-radius: 8px;
    background: #111827;
}

.mini-ide-bar {
    display: flex;
    align-items: center;
    gap: 8px;
    min-height: 36px;
    padding: 0 12px;
    color: #d1d5db;
    background: #1f2937;
    border-bottom: 1px solid #374151;
}

.mini-ide-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #6b7280;
}

.mini-ide-dot:first-child {
    background: #ef4444;
}

.mini-ide-dot:nth-child(2) {
    background: #f59e0b;
}

.mini-ide-dot:nth-child(3) {
    background: #22c55e;
}

.mini-ide .code-editor {
    min-height: 260px;
    color: #f9fafb;
    background: #111827;
    border: 0;
    border-radius: 0;
}

.mini-ide .code-editor:focus,
.terminal-input:focus {
    color: #f9fafb;
    background: #111827;
    box-shadow: none;
}

.terminal-panel {
    overflow: hidden;
    border: 1px solid #1f2937;
    border-radius: 8px;
    background: #0b1020;
}

.terminal-title {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    padding: 9px 12px;
    color: #e5e7eb;
    background: #111827;
    border-bottom: 1px solid #263244;
    font-size: 0.85rem;
}

.terminal-command,
.terminal-muted,
.terminal-status {
    color: #9ca3af;
}

.terminal-body {
    padding: 12px;
    color: #e5e7eb;
    font-family: Consolas, Monaco, monospace;
    font-size: 0.9rem;
}

.terminal-screen {
    min-height: 180px;
    max-height: 320px;
    overflow: auto;
    white-space: pre-wrap;
}

.terminal-line {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid #263244;
}

.terminal-command-input {
    flex: 1;
    min-width: 0;
    color: #f9fafb;
    background: transparent;
    border: 0;
    outline: 0;
    font-family: Consolas, Monaco, monospace;
}

.terminal-command-input:disabled {
    color: #6b7280;
}

.terminal-input-echo {
    color: #bfdbfe;
}

.terminal-status-text {
    color: #9ca3af;
}

.terminal-label {
    display: block;
    margin-bottom: 6px;
    color: #9ca3af;
    font-size: 0.8rem;
}

.terminal-input {
    color: #f9fafb;
    background: #111827;
    border: 1px solid #374151;
    border-radius: 8px;
    font-family: Consolas, Monaco, monospace;
    resize: vertical;
}

.terminal-input::placeholder {
    color: #6b7280;
}

.terminal-output {
    border-top: 1px solid #263244;
    padding-top: 12px;
}

.terminal-output pre {
    margin: 4px 0 10px;
    color: #f9fafb;
    white-space: pre-wrap;
}

.terminal-prompt {
    color: #22c55e;
}

.terminal-error {
    color: #fecaca;
}

.terminal-status {
    padding-top: 8px;
    border-top: 1px solid #263244;
    font-size: 0.82rem;
}

.code-output pre {
    max-height: 240px;
    overflow: auto;
    padding: 10px;
    border-radius: 8px;
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    white-space: pre-wrap;
}

.code-output .code-error {
    background: #fff3f3;
    border-color: #f1b0b7;
}

.variant-trail {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(44px, 1fr));
    gap: 8px;
}

.trail-item {
    min-height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    color: #212529;
    text-decoration: none;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    background: #fff;
    font-weight: 600;
}

.trail-item.active {
    border-color: #0d6efd;
    box-shadow: 0 0 0 3px rgba(13, 110, 253, 0.15);
}

.trail-item.answered {
    background: #eaf8ef;
    border-color: #9ad8b0;
    color: #0f5132;
}

.result-hero {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    align-items: center;
    padding: 24px;
    background: #fff;
    border: 1px solid #dee2e6;
    border-radius: 8px;
}

.result-score {
    text-align: right;
}

.nav-logout-form {
    display: flex;
    align-items: center;
    min-height: 40px;
    margin: 0;
}

.nav-action-btn {
    display: inline-flex;
    align-items: center;
    min-height: 31px;
}

.rating-avatar {
    width: 34px;
    height: 34px;
    flex: 0 0 34px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    background: #e9ecef;
    font-weight: 700;
}

.teacher-class-row,
.teacher-student-row,
.teacher-class-card {
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.teacher-class-row:hover,
.teacher-student-row:hover,
.teacher-class-card:hover {
    border-color: #9ec5fe !important;
    box-shadow: 0 0 0 3px rgba(13, 110, 253, 0.08);
}

.teacher-class-card {
    display: block;
    height: 100%;
    padding: 16px;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    background: #fff;
}

.teacher-tabs .nav-link {
    color: #495057;
}

.teacher-mini-progress {
    height: 8px;
}

.teacher-chart-bars {
    min-height: 220px;
    display: flex;
    align-items: flex-end;
    gap: 10px;
    padding: 12px 0 4px;
}

.teacher-chart-column {
    flex: 1 1 0;
    min-width: 22px;
    height: 190px;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    align-items: center;
    gap: 6px;
}

.teacher-chart-bar {
    width: 100%;
    min-height: 3px;
    border-radius: 6px 6px 0 0;
    background: #0d6efd;
}

.teacher-chart-label {
    font-size: 0.75rem;
    color: #6c757d;
}

.topic-group-box {
    padding: 14px;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    background: #f8f9fa;
}

.topic-subitem,
.variant-topic-check {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 9px 10px;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    background: #fff;
    color: #212529;
    text-decoration: none;
}

.topic-subitem:hover,
.variant-topic-check:hover {
    border-color: #9ec5fe;
}

.variant-topic-check {
    justify-content: flex-start;
    cursor: pointer;
}

.duel-lobby {
    min-height: 70vh;
    display: grid;
    place-items: center;
}

.duel-lobby-panel {
    width: min(100%, 560px);
    padding: 32px;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    background: #fff;
    text-align: center;
}

.duel-search-orbit {
    width: 170px;
    height: 170px;
    display: grid;
    place-items: center;
    margin: 10px auto 28px;
    border-radius: 50%;
    border: 2px dashed #0d6efd;
    animation: duel-spin 3s linear infinite;
}

.duel-search-core {
    width: 92px;
    height: 92px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    color: #fff;
    background: #0d6efd;
    font-size: 1.6rem;
    font-weight: 800;
    animation: duel-counter-spin 3s linear infinite;
}

.duel-scoreboard {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
    gap: 18px;
    align-items: center;
    margin-bottom: 24px;
}

.duel-player,
.duel-round-card {
    padding: 18px;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    background: #fff;
}

.duel-player-name {
    font-size: 1.1rem;
    font-weight: 700;
}

.duel-vs {
    width: 58px;
    height: 58px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    color: #fff;
    background: #212529;
    font-weight: 800;
}

.duel-hp-wrap {
    height: 14px;
    overflow: hidden;
    margin: 10px 0 4px;
    border-radius: 999px;
    background: #e9ecef;
}

.duel-hp-bar {
    width: 100%;
    height: 100%;
    border-radius: inherit;
    background: #198754;
    transition: width 0.45s ease, background-color 0.2s ease;
}

.duel-hp-bar.opponent {
    background: #0d6efd;
}

.duel-hp-bar.low {
    background: #dc3545;
}

.duel-timer {
    min-width: 64px;
    padding: 8px 10px;
    border-radius: 8px;
    color: #fff;
    background: #212529;
    text-align: center;
    font-weight: 800;
}

.duel-timer.danger {
    background: #dc3545;
    animation: duel-pulse 0.8s infinite;
}

.duel-task-content {
    max-height: 42vh;
    overflow: auto;
}

.duel-result-panel {
    padding: 16px;
    border: 1px solid #cfe2ff;
    border-radius: 8px;
    background: #f4f8ff;
}

.duel-damage-line {
    font-size: 1.2rem;
    font-weight: 800;
}

.duel-hit {
    animation: duel-hit 0.55s ease;
}

.duel-finish-overlay {
    position: fixed;
    inset: 0;
    z-index: 1080;
    display: grid;
    place-items: center;
    padding: 20px;
    background: rgba(15, 23, 42, 0.72);
}

.duel-finish-card {
    width: min(520px, 100%);
    padding: 32px;
    border-radius: 8px;
    background: #fff;
    text-align: center;
    box-shadow: 0 24px 70px rgba(0, 0, 0, 0.28);
    animation: duel-finish-pop 0.35s ease;
}

.duel-finish-kicker {
    color: #6c757d;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-size: 0.78rem;
}

.duel-finish-title {
    margin: 8px 0;
    font-size: 2.3rem;
    font-weight: 900;
}

.duel-finish-title.win {
    color: #198754;
}

.duel-finish-title.loss {
    color: #dc3545;
}

.duel-finish-title.draw {
    color: #0d6efd;
}

.duel-finish-text {
    color: #495057;
    margin-bottom: 22px;
}

@keyframes duel-spin {
    to { transform: rotate(360deg); }
}

@keyframes duel-counter-spin {
    to { transform: rotate(-360deg); }
}

@keyframes duel-pulse {
    50% { transform: scale(1.06); }
}

@keyframes duel-hit {
    20% { transform: translateX(-8px); box-shadow: 0 0 0 4px rgba(220, 53, 69, 0.18); }
    40% { transform: translateX(8px); }
    60% { transform: translateX(-5px); }
    100% { transform: translateX(0); }
}

@keyframes duel-finish-pop {
    from { transform: translateY(14px) scale(0.96); opacity: 0; }
    to { transform: translateY(0) scale(1); opacity: 1; }
}
