.practice-page {
    min-height: calc(100vh - 4rem);
    padding: 2rem 0 4rem;
    background: #f7f9fc;
    color: #17212b;
}

.practice-shell {
    width: min(100% - 2rem, 1400px);
    margin: 0 auto;
}

.practice-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 0.65rem;
}

.practice-kicker {
    margin: 0 0 0.3rem;
    color: #32715c;
    font-size: 0.78rem;
    font-weight: 700;
    text-transform: uppercase;
}

.practice-header h1 {
    margin: 0;
    font-size: 1.8rem;
    line-height: 1.25;
    overflow-wrap: anywhere;
}

.practice-completion-badge {
    flex: 0 0 auto;
    padding: 0.35rem 0.6rem;
    border: 1px solid #a8d8b8;
    border-radius: 999px;
    background: #edf9f0;
    color: #176236;
    font-size: 0.82rem;
    font-weight: 700;
}

.practice-description {
    max-width: 80ch;
    margin: 0 0 1.25rem;
    color: #455563;
    line-height: 1.6;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}

.practice-examples {
    max-width: 80ch;
    margin: 0 0 1.25rem;
    padding: 0.7rem 0.85rem;
    border-left: 3px solid #cbd8e3;
    background: #fff;
}

.practice-examples h2 {
    margin: 0 0 0.35rem;
    color: #314353;
    font-size: 0.86rem;
}

.practice-examples ul {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem 1rem;
    margin: 0;
    padding: 0;
    list-style: none;
    color: #536574;
    font-size: 0.84rem;
}

.practice-examples code {
    color: #243746;
}

.practice-context {
    margin: -0.7rem 0 1.2rem;
    color: #536574;
    font-size: 0.84rem;
    line-height: 1.45;
    overflow-wrap: anywhere;
}

.practice-workspace {
    display: grid;
    grid-template-columns: minmax(0, 1.1fr) minmax(0, 0.9fr);
    align-items: start;
    gap: 1rem;
}

.practice-editor-panel,
.practice-results-panel {
    min-width: 0;
    overflow: hidden;
    border: 1px solid #d8e1e9;
    border-radius: 7px;
    background: #fff;
}

.practice-panel-heading {
    display: flex;
    min-height: 48px;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.7rem 0.9rem;
    border-bottom: 1px solid #e5ebf0;
    background: #f2f6f8;
}

.practice-panel-heading h2 {
    min-width: 0;
    margin: 0;
    font-size: 0.98rem;
    line-height: 1.3;
    overflow-wrap: anywhere;
}

.practice-panel-heading > span {
    flex: 0 0 auto;
    color: #5e6d78;
    font-size: 0.78rem;
}

.practice-editor {
    display: block;
    width: 100%;
    min-width: 0;
    min-height: 440px;
    resize: vertical;
    padding: 1rem;
    border: 0;
    border-radius: 0;
    outline: none;
    background: #fbfcfe;
    color: #1c2b38;
    font-family: Consolas, 'Courier New', monospace;
    font-size: 0.9rem;
    line-height: 1.6;
    tab-size: 4;
    white-space: pre;
    overflow: auto;
}

.practice-editor:focus-visible {
    box-shadow: inset 0 0 0 3px rgba(37, 99, 235, 0.35);
}

.practice-editor:disabled {
    opacity: 0.78;
}

.practice-actions,
.practice-actions-primary {
    display: flex;
    align-items: center;
    gap: 0.6rem;
}

.practice-actions {
    justify-content: space-between;
    padding: 0.75rem 0.9rem;
    border-top: 1px solid #e5ebf0;
}

.practice-button {
    display: inline-flex;
    min-height: 44px;
    align-items: center;
    justify-content: center;
    gap: 0.35rem;
    padding: 0.55rem 0.9rem;
    border: 1px solid transparent;
    border-radius: 5px;
    cursor: pointer;
    font: inherit;
    font-size: 0.87rem;
    font-weight: 700;
    line-height: 1.25;
    text-align: center;
    text-decoration: none;
    overflow-wrap: anywhere;
}

.practice-button:focus-visible {
    outline: 3px solid rgba(37, 99, 235, 0.4);
    outline-offset: 2px;
}

.practice-button:disabled {
    cursor: not-allowed;
    opacity: 0.55;
}

.practice-button--primary {
    background: #166a4c;
    color: #fff;
}

.practice-button--primary:hover:not(:disabled) {
    background: #10583e;
}

.practice-button--secondary {
    border-color: #c5d0d9;
    background: #fff;
    color: #314353;
}

.practice-button--secondary:hover:not(:disabled) {
    background: #f2f6f8;
}

.practice-results-panel {
    padding-bottom: 0.9rem;
}

.practice-result-status {
    text-transform: capitalize;
}

.practice-result-status--passed {
    color: #176236 !important;
}

.practice-result-status--failed,
.practice-result-status--error,
.practice-result-status--timeout,
.practice-result-status--initialization-error {
    color: #9b3028 !important;
}

.practice-status-message {
    margin: 0.85rem 0.9rem;
    color: #536574;
    line-height: 1.5;
    overflow-wrap: anywhere;
}

.practice-status-message.is-success {
    color: #176236;
    font-weight: 700;
}

.practice-status-message.is-error {
    color: #9b3028;
}

.practice-output-group {
    margin: 0.9rem;
}

.practice-output-group h3 {
    margin: 0 0 0.4rem;
    font-size: 0.85rem;
}

.practice-output,
.practice-test-values pre {
    max-width: 100%;
    margin: 0;
    padding: 0.65rem;
    overflow: auto;
    border: 1px solid #e1e8ee;
    border-radius: 4px;
    background: #f8fafc;
    color: #283b49;
    font-family: Consolas, 'Courier New', monospace;
    font-size: 0.82rem;
    line-height: 1.5;
    white-space: pre;
}

.practice-output--error,
.practice-test-error {
    border-color: #f0c5c1 !important;
    background: #fff7f6 !important;
    color: #842b24 !important;
}

.practice-error-details {
    margin: 0.8rem 0.9rem;
    color: #354958;
}

.practice-error-details summary {
    min-height: 44px;
    padding: 0.65rem 0;
    cursor: pointer;
    font-size: 0.84rem;
    font-weight: 700;
}

.practice-test-results {
    display: grid;
    gap: 0.6rem;
    margin: 0.85rem 0.9rem;
    padding: 0;
    list-style: none;
}

.practice-test-results li {
    min-width: 0;
    padding: 0.7rem;
    border: 1px solid #e1e8ee;
    border-left: 3px solid #aebbc5;
    border-radius: 4px;
    background: #fff;
}

.practice-test-results li.is-passed {
    border-left-color: #26804e;
}

.practice-test-results li.is-failed {
    border-left-color: #b84338;
}

.practice-test-result-title {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.84rem;
    font-weight: 700;
    overflow-wrap: anywhere;
}

.practice-test-results li.is-passed .practice-test-result-title > span {
    color: #176236;
}

.practice-test-results li.is-failed .practice-test-result-title > span {
    color: #9b3028;
}

.practice-test-values {
    display: grid;
    gap: 0.55rem;
    margin-top: 0.6rem;
}

.practice-test-values > div {
    min-width: 0;
}

.practice-test-values strong {
    display: block;
    margin-bottom: 0.25rem;
    color: #536574;
    font-size: 0.75rem;
}

.practice-test-error {
    margin: 0;
    padding: 0.5rem;
    border: 1px solid;
    border-radius: 4px;
    font-size: 0.8rem;
    overflow-wrap: anywhere;
}

.practice-continue {
    margin: 0.4rem 0.9rem 0;
}

.practice-next-challenge {
    margin: 0.4rem 0.9rem 0;
}

.practice-ad {
    display: flex;
    justify-content: center;
    margin: 2rem auto 0;
    padding-top: 1.25rem;
    border-top: 1px solid #d8e1e9;
}

.practice-ad .notes-side-live-slot {
    flex: 0 0 336px;
}

.practice-visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

@media (max-width: 900px) {
    .practice-workspace {
        grid-template-columns: minmax(0, 1fr);
    }

    .practice-editor {
        min-height: 360px;
    }
}

@media (max-width: 520px) {
    .practice-page {
        padding-top: 1.25rem;
    }

    .practice-shell {
        width: min(100% - 1rem, 1400px);
    }

    .practice-header h1 {
        font-size: 1.45rem;
    }

    .practice-actions {
        align-items: stretch;
        flex-direction: column-reverse;
    }

    .practice-actions-primary {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .practice-actions > .practice-button,
    .practice-actions-primary .practice-button {
        width: 100%;
    }
}
