.attempt-page {
    min-height: 100vh;
    min-height: 100dvh;
    background-repeat: no-repeat;
}

.attempt-main {
    --attempt-line: #34364d;
    --attempt-input: #0d101a;
    padding-bottom: 5rem;
}

.attempt-layout {
    display: grid;
    grid-template-areas: 'card sidebar';
    grid-template-columns: minmax(0, 1fr) minmax(15rem, 18rem);
    align-items: start;
    gap: 1rem;
}

.attempt-card,
.attempt-number-panel {
    min-width: 0;
    margin: 0;
    padding: 1.4rem;
    border: 1px solid var(--probnik-border);
    border-radius: 1.125rem;
    background: var(--probnik-surface);
}

.attempt-card {
    grid-area: card;
}

.attempt-sidebar {
    grid-area: sidebar;
    position: sticky;
    top: 6rem;
    display: grid;
    min-width: 0;
    gap: .65rem;
}

.attempt-finish {
    min-height: 2.75rem;
    padding: .55rem .9rem;
    border: 1px solid #403958;
    border-radius: .7rem;
    background: #232039;
    color: #e4d7ff;
    font: 750 .875rem/1.25 var(--oz-font-body);
    cursor: pointer;
}

.attempt-finish:enabled:hover {
    background: #332a4d;
}

.attempt-finish:disabled {
    color: var(--probnik-muted);
    cursor: default;
}

.attempt-finish-dialog {
    width: min(100% - 2rem, 29rem);
    max-width: none;
    max-height: calc(100dvh - 2rem);
    margin: auto;
    padding: clamp(1rem, 4vw, 1.5rem);
    overflow: auto;
    border: 1px solid #403958;
    border-radius: 1rem;
    background: var(--probnik-surface);
    color: var(--oz-text-primary);
}

.attempt-finish-dialog::backdrop {
    background: rgba(6, 7, 14, .72);
}

.attempt-finish-dialog h2 {
    padding-right: 2.5rem;
    margin: 0;
    font-size: 1.2rem;
    line-height: 1.35;
}

.attempt-finish-dialog p {
    margin: .9rem 0 0;
    color: var(--probnik-muted);
    font-size: 1rem;
    line-height: 1.55;
}

.attempt-finish-dialog .attempt-viewer-close {
    top: .7rem;
    right: .7rem;
    background: transparent;
    border-color: transparent;
}

.attempt-finish-dialog .attempt-viewer-close:hover {
    background: #232039;
}

.attempt-finish-dialog button:focus-visible {
    outline: 2px solid var(--probnik-accent);
    outline-offset: 2px;
}

.attempt-finish-actions {
    display: flex;
    flex-wrap: wrap;
    gap: .6rem;
    margin-top: 1.25rem;
}

.attempt-finish-actions button {
    flex: 1 1 auto;
}

.attempt-progress-heading,
.attempt-task-heading {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    gap: .45rem 1rem;
}

.attempt-main .attempt-progress-heading h2 {
    font-size: 1.125rem;
}

.attempt-progress-heading span,
.attempt-task-heading span,
.attempt-number-group p {
    color: var(--probnik-muted);
    font-size: .875rem;
}

.attempt-nav {
    margin-top: .85rem;
}

.attempt-number-group + .attempt-number-group {
    margin-top: .8rem;
}

.attempt-number-group p {
    margin: 0 0 .4rem;
    font-weight: 700;
}

.attempt-numbers {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: .36rem;
}

.attempt-number-group + .attempt-number-group .attempt-numbers {
    grid-template-columns: repeat(6, minmax(0, 1fr));
}

.attempt-numbers button {
    min-height: 2.5rem;
    border: 1px solid var(--attempt-line);
    border-radius: .55rem;
    background: var(--attempt-input);
    color: #e7e1f0;
    font-family: inherit;
    font-size: .875rem;
    font-weight: 750;
    cursor: pointer;
}

.attempt-numbers button:hover {
    border-color: #8e75ca;
}

.attempt-numbers button[data-filled='true'] {
    border-color: #705aa5;
    background: #2e2349;
    color: #eee2ff;
}

.attempt-numbers button[aria-current='step'] {
    border-color: #d3c1ff;
    background: var(--probnik-accent);
    color: #17122a;
}

.attempt-numbers button[data-filled='true']::after {
    display: inline-block;
    width: 4px;
    height: 4px;
    margin-left: 3px;
    border-radius: 50%;
    background: currentColor;
    content: '';
    vertical-align: middle;
}

.attempt-main button:focus-visible,
.attempt-main summary:focus-visible {
    outline: 2px solid var(--probnik-accent);
    outline-offset: 2px;
}

.attempt-task-heading {
    margin-bottom: 1.1rem;
}

.attempt-main .attempt-task-heading h2 {
    font-size: clamp(1.45rem, 3.4vw, 1.85rem);
    scroll-margin-top: 6rem;
}

.attempt-task-heading span {
    padding: .25rem .65rem;
    border-radius: .5rem;
    background: #222039;
}

.attempt-question-content,
.attempt-condition-preview,
.attempt-condition-body {
    font-size: 1.0625rem;
    line-height: 1.65;
    color: #e4e6f1;
    overflow-wrap: anywhere;
}

.attempt-question-content p,
.attempt-condition-body p {
    margin: 0 0 .8rem;
    white-space: pre-line;
}

.attempt-question-content > :last-child,
.attempt-condition-body > :last-child {
    margin-bottom: 0;
}

.attempt-card [hidden] {
    display: none;
}

.attempt-card .katex-display {
    overflow-x: auto;
    padding-block: .15rem;
}

.attempt-card .oz-block-table-wrap {
    scrollbar-width: thin;
    scrollbar-color: #746793 transparent;
}

.attempt-card .oz-block-table {
    width: auto;
    min-width: 0;
    table-layout: auto;
}

.attempt-card .oz-block-table :is(th, td) {
    min-width: 0;
    padding: .25rem .375rem;
    font-size: .875rem;
    line-height: 1.3;
    overflow-wrap: normal;
}

.attempt-card .oz-block-table td {
    white-space: nowrap;
}

@media (width > 760px) {
    .attempt-card .oz-block-table :is(th, td) {
        padding: .4rem .625rem;
        font-size: 1rem;
        line-height: 1.45;
    }
}

html:has(.attempt-finish-dialog[open], .attempt-board[open]) {
    overflow: hidden;
}

.attempt-condition {
    margin-top: 1.25rem;
}

.attempt-condition summary {
    display: block;
    list-style: none;
    cursor: pointer;
}

.attempt-condition summary::-webkit-details-marker {
    display: none;
}

.attempt-condition-preview {
    display: block;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
}

.attempt-condition-toggle {
    display: inline-flex;
    align-items: center;
    gap: .45rem;
    color: var(--oz-text-primary);
    font-size: .9375rem;
    font-weight: 750;
}

.attempt-condition-toggle::after {
    width: .4rem;
    height: .4rem;
    border-right: 1px solid currentColor;
    border-bottom: 1px solid currentColor;
    transform: translateY(-.09rem) rotate(45deg);
    content: '';
}

.attempt-condition summary:hover .attempt-condition-toggle span {
    text-decoration: underline;
}

.attempt-condition-collapse,
.attempt-condition[open] :is(.attempt-condition-preview, .attempt-condition-expand) {
    display: none;
}

.attempt-condition[open] .attempt-condition-collapse {
    display: inline;
}

.attempt-condition[open] .attempt-condition-toggle::after {
    transform: translateY(.09rem) rotate(225deg);
}

.attempt-condition-body {
    margin-top: .55rem;
}

.attempt-answer {
    display: grid;
    gap: .5rem;
    margin-top: 1.4rem;
}

.attempt-answer label {
    color: #f1edf9;
    font-size: .9375rem;
    font-weight: 750;
}

.attempt-answer :is(input, textarea) {
    display: block;
    width: 100%;
    min-height: 2.85rem;
    padding: .65rem .85rem;
    border: 1px solid var(--attempt-line);
    border-radius: .65rem;
    background: var(--attempt-input);
    color: #f5efff;
    font: inherit;
    font-size: 1rem;
    line-height: 1.5;
}

.attempt-answer :is(input, textarea):focus {
    outline: 2px solid var(--probnik-accent);
    outline-offset: 1px;
}

.attempt-answer :is(input, textarea)::placeholder {
    color: #a1a8bc;
}

.attempt-answer textarea {
    resize: vertical;
}

.attempt-response[data-part='2'] {
    margin-top: 1.5rem;
    padding: clamp(.85rem, 2.5vw, 1.25rem);
    border: 1px solid #33344b;
    border-radius: .9rem;
    background: linear-gradient(145deg, #191b2b, #141725 65%);
}

.attempt-response[data-part='2'] .attempt-answer {
    margin-top: 0;
}

.attempt-solution {
    display: grid;
    gap: .5rem;
}

.attempt-response .attempt-solution h3 {
    font-size: 1.125rem;
}

.attempt-solution-methods {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(15rem, 100%), 1fr));
    gap: .65rem;
    margin-top: .25rem;
}

.attempt-solution-method {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    align-items: center;
    gap: .7rem;
    min-height: 4.4rem;
    padding: .65rem;
    border: 1px solid #373850;
    border-radius: .7rem;
    background: #1c1e30;
    color: #f1eefc;
    font: inherit;
    text-align: left;
    cursor: pointer;
}

.attempt-solution-method:enabled:hover,
.attempt-solution-method[data-selected='true'] {
    border-color: #8069bb;
    background: #28213e;
}

.attempt-solution-method:disabled {
    cursor: default;
}

.attempt-solution-icon {
    display: grid;
    width: 2.35rem;
    aspect-ratio: 1;
    place-items: center;
    border-radius: .55rem;
    background: #33284d;
    color: #cfbbff;
}

.attempt-solution-method-copy {
    display: grid;
    gap: .2rem;
    line-height: 1.3;
}

.attempt-solution-method-copy strong {
    font-size: .9375rem;
}

.attempt-solution-method-copy > span {
    color: var(--probnik-muted);
    font-size: .8125rem;
}

.attempt-response :is(.attempt-solution-help, .attempt-solution-status) {
    margin: 0;
    line-height: 1.4;
}

.attempt-solution-help {
    color: var(--probnik-muted);
    font-size: .875rem;
}

.attempt-solution-status {
    color: #f5c6d5;
    font-size: .875rem;
}

.attempt-solution-files {
    margin-top: .25rem;
}

.attempt-board-export {
    justify-self: start;
    margin-top: .25rem;
}

.attempt-solution-gallery {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(min(5rem, 100%), 6rem));
    gap: .65rem;
    padding: 0;
    margin: .55rem 0 0;
    list-style: none;
}

.attempt-solution-gallery:empty {
    display: none;
}

.attempt-solution-gallery li {
    display: grid;
    position: relative;
    min-width: 0;
}

.attempt-solution-preview {
    aspect-ratio: 1;
    overflow: hidden;
    padding: 0;
    border: 1px solid var(--attempt-line);
    border-radius: .65rem;
    background: var(--attempt-input);
    cursor: zoom-in;
}

.attempt-solution-preview img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.attempt-solution-remove {
    position: absolute;
    top: .15rem;
    right: .15rem;
    display: grid;
    width: 2rem;
    height: 2rem;
    place-items: center;
    padding: 0;
    border: 1px solid var(--attempt-line);
    border-radius: .55rem;
    background: var(--attempt-input);
    color: #fff;
    font-size: 1.3rem;
    line-height: 1;
    cursor: pointer;
}

.attempt-board {
    inset: 0;
    width: 100%;
    height: 100%;
    height: 100dvh;
    max-width: none;
    max-height: none;
    margin: 0;
    padding: 0;
    border: 0;
    background: #0d1117;
    color: var(--oz-text-primary);
}

.attempt-board[open] {
    display: grid;
    grid-template-rows: auto minmax(0, 1fr);
}

.attempt-board-heading {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: center;
    gap: .65rem;
    padding: max(.65rem, env(safe-area-inset-top)) .85rem .65rem;
    border-bottom: 1px solid var(--probnik-border);
    background: var(--probnik-surface);
}

.attempt-board-heading h2 {
    margin: 0;
    font-size: clamp(.95rem, 3vw, 1.2rem);
    line-height: 1.25;
}

.attempt-board-actions {
    display: flex;
    gap: .45rem;
}

.attempt-board-dismiss {
    min-width: 2.75rem;
    font-size: 1.35rem;
}

.probnik-page .attempt-board-heading .probnik-start {
    min-width: 0;
    padding-inline: .85rem;
    cursor: pointer;
}

.attempt-board button:focus-visible {
    outline: 2px solid var(--probnik-accent);
    outline-offset: 2px;
}

.attempt-board-surface {
    position: relative;
}

.attempt-board-notice {
    position: absolute;
    inset: auto 1rem 1rem;
    width: fit-content;
    max-width: calc(100% - 2rem);
    margin: 0 auto;
    padding: .55rem .8rem;
    border: 1px solid var(--probnik-border);
    border-radius: .65rem;
    background: var(--probnik-surface);
    color: var(--probnik-muted);
    font-size: .875rem;
}

.attempt-board #whiteboard-overlay {
    position: absolute;
    z-index: auto;
}

@media (max-width: 400px) {
    .attempt-board-heading {
        gap: .4rem;
        padding-inline: .55rem;
    }

    .attempt-board-actions .attempt-finish,
    .probnik-page .attempt-board-actions .probnik-start {
        padding-inline: .55rem;
    }
}

.attempt-answer-actions {
    display: flex;
    justify-content: flex-end;
    margin-top: .75rem;
}

.attempt-solution-save-hint {
    display: none;
}

.attempt-response[data-part='2'] .attempt-answer-actions {
    flex-wrap: wrap;
    align-items: center;
    gap: .65rem 1rem;
    margin-top: 1rem;
    padding-top: .85rem;
    border-top: 1px solid #33344b;
}

.attempt-response[data-part='2'] .attempt-solution-save-hint {
    display: block;
    flex: 1 1 13rem;
}

.attempt-main .attempt-answer-actions button:not(:disabled) {
    cursor: pointer;
}

.attempt-main .attempt-answer-actions button:not(:disabled):hover {
    background: linear-gradient(115deg, #c1afff, #edcffd);
}

.attempt-main .attempt-answer-actions button:disabled {
    border-color: var(--attempt-line);
    background: #232439;
    color: var(--probnik-muted);
    cursor: default;
}

.attempt-save-note {
    margin: .8rem 0 0;
    color: var(--probnik-muted);
    font-size: .875rem;
}

@media (max-width: 760px) {
    .attempt-layout {
        grid-template-areas: 'sidebar' 'card';
        grid-template-columns: minmax(0, 1fr);
    }

    .attempt-sidebar {
        position: static;
        grid-template-columns: minmax(0, 1fr) auto;
        align-items: center;
        gap: .65rem .75rem;
        padding: .85rem 1rem;
        border: 1px solid var(--probnik-border);
        border-radius: 1.125rem;
        background: var(--probnik-surface);
    }

    .attempt-number-panel {
        display: contents;
    }

    .attempt-progress-heading {
        grid-area: 1 / 1;
        display: grid;
        gap: .15rem;
    }

    .attempt-sidebar .attempt-finish {
        grid-area: 1 / 2;
    }

    .attempt-card {
        padding: 1rem;
    }

    .attempt-nav {
        grid-area: 2 / 1 / 3 / -1;
        display: flex;
        gap: .36rem;
        overflow-x: auto;
        margin-top: 0;
        padding: .25rem;
        scrollbar-width: none;
    }

    .attempt-nav::-webkit-scrollbar {
        display: none;
    }

    .attempt-number-group {
        flex: none;
    }

    .attempt-number-group p {
        display: none;
    }

    .attempt-numbers {
        display: flex;
    }

    .attempt-numbers button {
        width: 2.45rem;
    }

    .attempt-number-group + .attempt-number-group {
        margin-top: 0;
    }
}

