*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
}

:root {
    --font-family: 'Play', 'Roboto', -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Helvetica Neue', sans-serif;
    --font-mono: "Roboto Mono", monospace;
    --color-bg-primary: #222;
    --color-text-primary: #ddd;
    --color-ok: hsl(70, 100%, 50%);
    --color-alert: hsl(20, 100%, 50%);
}

html {
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
}

body {
    opacity: 0;
    min-height: 100vh;
    min-height: -webkit-fill-available;
    display: grid;
    grid-template-columns: 1fr;
    place-content: center;
    font-family: var(--font-family), sans-serif;
    font-weight: 400;
    background-color: var(--color-bg-primary);
    color: var(--color-text-primary);
    line-height: 1.5;
    overflow-x: hidden;
    transition: opacity 0.25s ease-in;
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    user-select: none;
}
body.loaded {
    opacity: 1;
}

@media (min-width: 451px) {
    body {
        grid-template-columns: auto;
        background-color: #eee;
    }
}

@media screen and (orientation: landscape) and (max-width: 450px),
screen and (orientation: landscape) and (max-height: 450px) {
    body::before {
        content: "Please rotate your device to portrait mode";
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background-color: var(--color-bg-primary);
        color: var(--color-text-primary);
        display: flex;
        align-items: center;
        justify-content: center;
        text-align: center;
        padding: 2rem;
        font-family: var(--font-family), sans-serif;
        font-size: 1.125rem;
        z-index: 9999;
    }
    main {
        display: none;
    }
}

main {
    min-height: -webkit-fill-available;
    max-width: 450px;
}

.header {
    position: sticky;
    top: 0;
    z-index: 1;
    background-color: var(--color-bg-primary);
}

.masthead {
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 48px;
    padding: 0 10px;
    border-bottom: 1px solid #444;
}
.masthead-left {
    display: flex;
    align-items: center;
}
.masthead-icon {
    width: 40px;
    height: 40px;
    margin-left: -2px;
}
.masthead-title {
    margin-left: 6px;
    font-size: 24px;
}
.masthead-right {
    display: flex;
    justify-content: end;
    align-items: center;
}

.results {
    display: flex;
    justify-content: space-between;
    height: 48px;
    padding: 0 8px;
}
.results-left {
    display: flex;
    align-items: center;
    gap: 16px;
}
.results-info {
    display: flex;
    align-items: center;
    gap: 4px;
}
.results-label {
    white-space: nowrap;
    font-size: 14px;
}
.results-value {
    color: var(--color-ok);
    font-size: 24px;
}
.results-value.alert {
    color: var(--color-alert);
}
.results-right {
    display: flex;
    align-items: center;
    gap: 16px;
}
.btn-clear-all {
    width: 28px;
    height: 28px;
    outline: none;
    border: none;
    padding: 0;
    background-color: transparent;
    -webkit-tap-highlight-color: transparent;
    cursor: pointer;
    opacity: 0.3;
    pointer-events: none;
}
.btn-clear-all.enabled {
    opacity: 1;
    pointer-events: auto;

}
.img-clear-all {
    width: 100%;
    height: 100%;
}

.problems-section {
    background-color: var(--color-bg-primary);
    background-size: cover;
    background-image: url("../img/wood.jpg");
    font-family: var(--font-mono), monospace;
}

.v0 {
    --color-level-tag: hsl(0, 0%, 50%);
}
.v1 {
    --color-level-tag: hsl(45, 40%, 50%);
}
.v2 {
    --color-level-tag: hsl(90, 40%, 50%);
}
.v3 {
    --color-level-tag: hsl(180, 40%, 50%);
}
.v4 {
    --color-level-tag: hsl(225, 40%, 50%);
}
.v5 {
    --color-level-tag: hsl(270, 40%, 50%);
}
.v6 {
    --color-level-tag: hsl(315, 40%, 50%);
}
.v7 {
    --color-level-tag: hsl(0, 40%, 50%);
}
.v8 {
    --color-level-tag: hsl(0, 0%, 0%);
}

.problem-line {
    display: grid;
    grid-template-columns: auto auto auto auto auto auto;
    gap: 16px;
    border-top: 1px solid #0002;
    padding: 6px 8px;
}
.problem-line.even-v {
    background-color: #fff6;
}
.problem-line.odd-v {
    background-color: #fff9;
}

.problem-identifier {
    display: flex;
    align-items: center;
}

.problem-level {
    display: grid;
    place-content: center right;
    width: 32px;
    height: 16px;
    background-color: var(--color-level-tag);
    color: #fff;
    padding-right: 3px;
    font-size: 11px;
    font-weight: 500;
    clip-path: polygon(0 0, 100% 0, 100% 100%, 16px 100%);
}

.problem-number {
    display: grid;
    place-content: center;
    width: 32px;
    height: 32px;
    border-radius: 2px;
    background-color: #fff;
    color: #222;
    font-weight: 500;
}

.problem-attempt {
    position: relative;
    display: grid;
    place-content: center;
    width: 32px;
    height: 32px;
    color: #222;
    font-family: var(--font-mono), monospace;
    outline: none !important;
    user-select: none;
    cursor: pointer;
    background-color: transparent;
    font-size: 11px;
    font-weight: 400;
    -webkit-tap-highlight-color: transparent;
}
.problem-attempt-success {
    display: none;
}
.problem-attempt.success .problem-attempt-success {
    display: block;
    position: absolute;
    inset: 0;
    background: url("../img/hold.svg") no-repeat center;
    background-size: 32px 32px;
    filter: grayscale(0.3);
}
.problem-attempt::after {
    content: attr(data-text);
    position: relative;
}
.problem-attempt.success::after {
    color: #000;
    font-size: 13px;
    font-weight: 700;
}

.footer {
    display: flex;
    align-items: center;
    gap: 6px;
    height: 48px;
    padding: 0 8px;
    background-color: var(--color-bg-primary);
}
.btn-show-qr {
    width: 30px;
    height: 30px;
    outline: none;
    border: none;
    padding: 0;
    background-color: transparent;
    -webkit-tap-highlight-color: transparent;
    cursor: pointer;
}
.img-show-qr {
    width: 100%;
    height: 100%;
    border-radius: 1px;
}
dialog {
    width: 70vw;
    height: 70vw;
    max-width: 250px;
    max-height: 250px;
    position: fixed;
    top: 140px;
    left: 50%;
    transform: translateX(-50%);
    border: none;
    border-radius: 8px;
    padding: 0;
    overflow: hidden;
    user-select: none;
}
dialog::backdrop {
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(3px);
}
.large-qr {
    width: 100%;
    height: 100%;
}
.footer-text {
     font-size: 14px;
}
