* {
    box-sizing: border-box;
}

:root {
    --blue: #397de8;
    --red: #f04747;
    --green: #16b981;
    --text: #293241;
    --muted: #7e8795;
    --border: #edf0f3;
}

body {
    margin: 0;
    min-width: 320px;
    color: var(--text);
    background: #fff;
    font-family: Arial, sans-serif;
}

main {
    width: min(1088px, calc(100% - 36px));
    margin: 0 auto;
}

header {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 26px;
    min-height: 74px;
    border-bottom: 1px solid var(--border);
}

h1 {
    margin: 0;
    color: var(--text);
    font-size: 24px;
    font-weight: 700;
}

.top-actions {
    position: absolute;
    right: max(18px, calc((100vw - 1088px) / 2));
    display: flex;
    gap: 7px;
}

button {
    border: 0;
    border-radius: 3px;
    color: #fff;
    cursor: pointer;
    font-size: 13px;
}

.save,
.restart {
    padding: 10px 15px;
}

.save {
    background: var(--blue);
}

.top-actions .save {
    display: inline-block;
    color: #fff;
    text-decoration: none;
}

.global-list-link {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    margin: 18px 0 22px;
    padding: 16px 20px;
    border: 1px solid #c9e8dc;
    border-left: 5px solid var(--green);
    color: #176b54;
    background: #f2fbf7;
    text-decoration: none;
    transition: border-color .2s ease, background .2s ease, transform .2s ease;
}

.global-list-link:hover,
.global-list-link:focus-visible {
    border-color: var(--green);
    background: #e8f8f1;
    transform: translateY(-2px);
}

.global-list-link-copy {
    display: grid;
    gap: 4px;
}

.global-list-link-copy strong {
    color: #12513f;
    font-size: 14px;
}

.global-list-link-copy span {
    color: #568376;
    font-size: 12px;
}

.global-list-link-arrow {
    color: var(--green);
    font-size: 25px;
    line-height: 1;
}

.restart {
    background: var(--red);
}

.status {
    min-height: 18px;
    margin: 18px 0 8px;
    color: var(--muted);
    font-size: 12px;
}

.level-card {
    display: grid;
    grid-template-columns: minmax(220px, 280px) 1fr auto;
    align-items: center;
    gap: 13px;
    min-height: 174px;
    margin: 16px 0;
    padding: 10px;
    border: 1px solid #f0f1f3;
    box-shadow: 0 7px 15px rgba(34, 45, 60, .1);
}

.level-image {
    width: 100%;
    height: 154px;
    object-fit: cover;
    background: #dfe5eb;
}

.level-image.empty {
    display: grid;
    place-items: center;
    color: #a0a8b1;
    font-size: 12px;
}

.level-info h2 {
    margin: 0 0 5px;
    font-size: 20px;
    font-weight: 700;
}

.level-info p {
    margin: 0;
    color: var(--muted);
    font-size: 12px;
    font-style: italic;
}

.level-info .position {
    color: var(--text);
    font-size: 21px;
    font-style: normal;
    font-weight: 700;
}

.level-info .position span {
    color: var(--muted);
    font-size: 16px;
    font-weight: 400;
}

.level-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.progress-input {
    width: 135px;
    padding: 8px;
    border: 1px solid #e1e5e9;
    border-radius: 2px;
    color: var(--text);
    font-size: 12px;
}

.done,
.give-up {
    padding: 8px 11px;
}

.done {
    background: var(--green);
}

.give-up {
    background: var(--red);
}

.current-card {
    margin-top: 22px;
}

.next-card {
    margin-top: 42px;
}

.next-card::before {
    content: "NEXT LEVEL";
    position: absolute;
}

.next-card {
    position: relative;
}

.next-card::before {
    top: -24px;
    left: 0;
    color: var(--muted);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 1px;
}

#levelsList {
    display: grid;
    gap: 16px;
}

#levelsList .level-card {
    margin: 0;
}

.level-card.new-card {
    animation: slideUp .45s ease-out both;
}

.card-state {
    color: var(--muted);
    font-size: 13px;
    font-weight: 700;
}

.card-state.done {
    color: var(--green);
}

.card-state.given-up {
    color: var(--red);
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(60px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

footer {
    margin: 72px 0 22px;
    color: #a4abb4;
    font-size: 12px;
    text-align: center;
}

@media (max-width: 720px) {
    main {
        width: min(100% - 24px, 1088px);
    }
    header {
        justify-content: space-between;
        margin-top: 18px;
    }
    h1 {
        font-size: 20px;
    }
    .top-actions {
        position: static;
        flex-wrap: wrap;
        justify-content: flex-end;
    }
    .global-list-link {
        margin-top: 16px;
    }
    .level-card {
        grid-template-columns: 1fr;
        gap: 12px;
    }
    .level-image {
        width: 100%;
        height: 140px;
    }
    .level-info h2 {
        font-size: 18px;
    }
    .level-info .position {
        font-size: 19px;
    }
    .level-actions {
        grid-column: auto;
    }
    .progress-input {
        flex: 1;
    }
}