.student-bar {
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 12px;
    padding: 1rem 1.1rem;
    margin: 0 0 0.55rem;
    display: grid;
    grid-template-columns: 1fr 1fr 1fr auto;
    gap: 0.7rem;
    align-items: end;
}

.student-bar label {
    display: block;
    font-size: 0.85rem;
    color: #555;
    margin-bottom: 0.25rem;
}

.student-bar input {
    width: 100%;
    padding: 0.5rem 0.65rem;
    border: 1px solid #d0d5dd;
    border-radius: 8px;
    font-size: 0.95rem;
}

.student-bar input:read-only {
    background: #eef2ff;
    color: #2d3748;
}

.login-action button {
    min-width: 6.2rem;
    height: 2.45rem;
    padding: 0 1.1rem;
    border: none;
    border-radius: 8px;
    background: #667eea;
    color: #fff;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
}

.login-action button:hover {
    background: #5a67d8;
}

.login-status {
    min-height: 1.4rem;
    margin: 0 0 1.3rem;
    font-size: 0.95rem;
}

.login-status.ok {
    color: #276749;
    font-weight: 600;
}

.login-status.error {
    color: #c53030;
    font-weight: 600;
}

.exercise {
    background: #fff;
    border: 1px solid #e9ecef;
    border-radius: 12px;
    padding: 1.2rem 1.3rem 1.35rem;
    margin-bottom: 1.25rem;
}

.exercise h3 {
    color: #4c51bf;
    font-size: 1.2rem;
    margin: 0 0 0.45rem;
}

.stats-link-row {
    margin: 0 0 0.7rem;
}

.stats-open-btn {
    display: inline-block;
    padding: 0.28rem 0.85rem;
    border: 1px solid #667eea;
    border-radius: 999px;
    background: #fff;
    color: #4c51bf;
    font-size: 0.88rem;
    font-weight: 600;
    text-decoration: none;
}

.stats-open-btn:hover {
    background: #eef2ff;
}

.exercise h4 {
    color: #2d3748;
    font-size: 1rem;
    margin: 0.9rem 0 0.35rem;
}

.exercise ul {
    margin: 0.3rem 0 0.4rem 1.2rem;
}

.exercise li {
    margin: 0.2rem 0;
}

.field {
    margin-top: 0.85rem;
}

.field label {
    display: block;
    font-weight: 600;
    margin-bottom: 0.35rem;
}

.field .hint {
    font-weight: 400;
    color: #5a6775;
    font-size: 0.88rem;
}

.field textarea {
    width: 100%;
    min-height: 180px;
    padding: 0.7rem 0.75rem;
    border: 1px solid #d0d5dd;
    border-radius: 8px;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 0.88rem;
    line-height: 1.5;
    resize: vertical;
}

.field.has-cm textarea.code-source {
    display: none;
}

.code-editor {
    min-height: 220px;
}

.code-editor .CodeMirror {
    height: 220px;
    border: 1px solid #d0d5dd;
    border-radius: 8px;
    font-size: 0.88rem;
    line-height: 1.5;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

.code-editor .CodeMirror-focused {
    outline: 2px solid #667eea;
    outline-offset: 0;
}

.code-editor .CodeMirror-empty {
    outline: none;
}

.code-editor .CodeMirror pre.CodeMirror-placeholder {
    color: #8b95a5;
}

.field textarea::placeholder {
    color: #8b95a5;
}

.limit-hint {
    margin: 0.35rem 0 0;
    color: #c53030;
    font-size: 0.88rem;
}

.limit-hint:empty {
    display: none;
}

.code-editor .CodeMirror pre {
    padding: 0 0.5rem;
}

.code-editor .cm-keyword { color: #0033b3; font-weight: 600; }
.code-editor .cm-def { color: #111188; }
.code-editor .cm-builtin { color: #7a3e9d; }
.code-editor .cm-string,
.code-editor .cm-string-2 { color: #067d17; }
.code-editor .cm-comment { color: #8c8c8c; font-style: italic; }
.code-editor .cm-number { color: #1750eb; }
.code-editor .cm-operator { color: #5c2699; }
.code-editor .cm-variable { color: #1a202c; }
.code-editor .cm-meta { color: #9e880d; }

.field textarea.result {
    min-height: 140px;
}

.submit-row {
    margin-top: 0.75rem;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.7rem 1rem;
}

.submit-btn {
    min-width: 6.2rem;
    height: 2.45rem;
    padding: 0 1.2rem;
    border: none;
    border-radius: 8px;
    background: #667eea;
    color: #fff;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
}

.submit-btn:hover:not(:disabled) {
    background: #5a67d8;
}

.submit-btn:disabled {
    background: #c5c9d4;
    color: #f7f7f8;
    cursor: not-allowed;
}

.submitted-flag {
    margin: 0;
    color: #276749;
    font-size: 0.95rem;
    font-weight: 600;
}

.submitted-flag[hidden] {
    display: none !important;
}

.submit-status {
    margin: 0;
    font-size: 0.95rem;
}

.submit-status.error {
    color: #c53030;
    font-weight: 600;
}

.submit-status.ok {
    color: #276749;
    font-weight: 600;
}

.analysis-box {
    margin-top: 0.85rem;
    padding: 0.85rem 1rem;
    border: 1px solid #c6d0f5;
    border-radius: 10px;
    background: #f7f8ff;
}

.analysis-box h4 {
    margin: 0 0 0.4rem;
    color: #4c51bf;
    font-size: 0.98rem;
}

.analysis-box .analysis-text {
    margin: 0;
    white-space: pre-wrap;
    line-height: 1.65;
    color: #2d3748;
}

.stat-card.focus-ex,
table.hw-table th.focus-ex,
table.hw-table td.focus-ex {
    outline: 2px solid #667eea;
    outline-offset: -2px;
}

.practice-grid a.section {
    display: block;
    text-decoration: none;
    color: inherit;
}

.practice-grid a.section:hover {
    border-color: #667eea;
}

.stats-scroll {
    overflow: auto;
    max-height: calc(100vh - 8rem);
    margin: 0 0 1.4rem;
    border: 1px solid #7eb6e0;
}

table.hw-table.stats-freeze {
    width: max-content;
    min-width: 100%;
    border-collapse: separate;
    border-spacing: 0;
}

table.hw-table.stats-freeze th,
table.hw-table.stats-freeze td {
    border: 0;
    border-right: 1px solid #7eb6e0;
    border-bottom: 1px solid #7eb6e0;
}

table.hw-table.stats-freeze thead th {
    position: sticky;
    top: 0;
    z-index: 2;
    background: #003d5c;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.18);
}

table.hw-table.stats-freeze .freeze-col {
    position: sticky;
    z-index: 1;
}

table.hw-table.stats-freeze thead th.freeze-col {
    z-index: 4;
}

table.hw-table.stats-freeze .freeze-1 {
    left: 0;
    width: 6.2rem;
    min-width: 6.2rem;
    max-width: 6.2rem;
}

table.hw-table.stats-freeze .freeze-2 {
    left: 6.2rem;
    width: 8.4rem;
    min-width: 8.4rem;
    max-width: 8.4rem;
}

table.hw-table.stats-freeze .freeze-3 {
    left: 14.6rem;
    width: 6rem;
    min-width: 6rem;
    max-width: 6rem;
    box-shadow: 4px 0 6px -3px rgba(0, 0, 0, 0.35);
}

table.hw-table.stats-freeze tbody tr:nth-child(odd) td.freeze-col {
    background: #d9edf7;
}

table.hw-table.stats-freeze tbody tr:nth-child(even) td.freeze-col {
    background: #ffffff;
}

@media (max-width: 700px) {
    .student-bar {
        grid-template-columns: 1fr;
    }

    .login-action button {
        width: 100%;
    }
}
