@charset "utf-8";

* {
    --key-size: 40px;
    box-sizing: border-box;
    --color-light-dark: light-dark(#f8f8f8, #333);
    --color-dark-light: light-dark(#333, #f8f8f8);
    --hover-dark-light: light-dark(#555, #ddd);
}

input,
label {
    position: relative;
    z-index: 2;
}

.btnCommon {
    padding: 10px;
    border-radius: 50px;
    text-align: center;
    border: 2px solid var(--color-dark-light);
}

.typingSec.innerContent {
    padding: 0;
}

.screenBg {
    width: 100%;
    padding: 0 20px;
    /* background-image: url(../imSe/bg-honeycomb_pattern_rev.svg); */
    /* background-size: auto 20%; */
    /* background-color: #999; */
}

.viewScreen {
    position: relative;
    overflow: hidden;
    max-width: 1200px;
    height: 500px;
    /* background-image: url(.././imSe/bg-bracket4.svg);
    background-repeat: no-repeat;
    background-size: auto 100%; */

    &::before {
        content: "";
        z-index: -1;
        position: absolute;
        left: 0;
        top: 0;
        width: 200px;
        height: 500px;
        background-image: light-dark(url(.././imSe/bg-bracket_start.svg), url(.././imSe/bg-bracket_start_light.svg));
        background-repeat: no-repeat;
        background-size: auto 100%;

    }

    &::after {
        content: "";
        z-index: -1;
        position: absolute;
        right: 0;
        top: 0;
        width: 200px;
        height: 500px;
        background-image: light-dark(url(.././imSe/bg-bracket_end.svg), url(.././imSe/bg-bracket_end_light.svg));
        background-repeat: no-repeat;
        background-size: auto 100%;
        background-position: right 0;

    }
}

.screenContainer {
    position: relative;
    /* background-color: #f8f8f8; */
    max-width: 1200px;
    height: 500px;
    transition: .3s;
}

.screenContainer * {
    user-select: none;
}


.screenContainer>.screen {
    display: none;
}

.screenContainer>.screen.active {
    display: block;
}

.screen {
    /* background-color: #f8f8f8; */
    width: 100%;
    height: 100%;
    padding: 50px;
}

/* MARK:start */

.startScreen h2 {
    width: fit-content;
    margin: 100px auto 30px;
    font-size: 36px;
}

.startScreen div {
    width: fit-content;
    margin: 0 auto 10px;
}

.startBtn {
    width: 160px;
    color: var(--color-light-dark);
    background-color: var(--color-dark-light);
    font-size: 16px;
    line-height: 16px;
    transition: .2s;

    &:hover {
        background-color: var(--hover-dark-light);
    }
}

.settingBtn {
    display: flex;
    justify-content: center;
    align-items: end;
    gap: 5px;
    width: 160px;
    color: var(--color-dark-light);
    background-color: var(--color-light-dark);
    font-size: 16px;
    line-height: 16px;
    transition: .2s;

    &:hover {
        background-color: light-dark(#ddd, #555);
    }
}

.settingBtn svg {
    fill: var(--color-dark-light);
}

.countDown {
    width: fit-content;
    font-size: 60px;
    font-weight: 800;
    margin: 0 auto;
    line-height: 400px;
}

/* MARK:game */

.typingScreen {
    position: relative;
}

.typingScreen span {
    display: inline-block;
    font-size: 24px;
}

.romanText {
    width: fit-content;
    margin: 0 auto 20px;
}

.typedRoman {
    color: #999;
}

.currentRoman {
    color: #f44;
}


.hiraganaText {
    width: fit-content;
    margin: 0 auto 20px;
}

.typedHiragana {
    white-space: pre-wrap;
    color: #999;
}

.untypedHiragana {
    white-space: pre-wrap;
}

.originalText {
    width: fit-content;
    margin: 0 auto 40px;
    font-size: 24px;
}

.keyboard {
    width: fit-content;
    margin: 0 auto;
    user-select: none;
}

.keyboardRow {
    display: flex;
    gap: 4px;
    margin-bottom: 4px;
}

.keyboardRow.column2 {
    padding-left: calc(var(--key-size) / 2);
}

.keyboardRow.column3 {
    padding-left: var(--key-size);
}

.keyboardRow.column4 {
    padding-left: calc(var(--key-size) * 1.5);
}

.keyboardRow.column5 {
    padding-left: calc(var(--key-size) * 4.5);
}

.key {
    width: var(--key-size);
    height: var(--key-size);
    font-size: calc(var(--key-size) / 2);
    text-align: center;
    line-height: var(--key-size);
    color: #f8f8f8;
    background-color: light-dark(#aaa, #444);
    /* border: 2px solid #999; */
    border-radius: calc(var(--key-size) / 5);
    transition: .1s;
}

.space {
    width: 120px;
}

.nextKey {
    color: #fff;
    background-color: light-dark(#333, #777);
    ;
}

.missKey {
    color: #fff;
    background-color: light-dark(#f99, #f44);
    border-color: light-dark(#f44, #f22);
}

.typingTimer {
    position: absolute;
    top: 50px;
    right: 50px;
    display: grid;
    grid-template-columns: 16px 32px;
    gap: 10px;
    width: fit-content;
}

.typingTimer span {
    display: inline-block;
    font-size: 16px;
}

.typingTimer svg {
    fill: var(--color-dark-light);
}

.typingTimer .timer {
    text-align: end;
}

.typingScreen .btnIconContainer {
    display: flex;
    justify-content: end;
    align-items: center;
    gap: 20px;
}

.btnIconContainer>div {
    height: fit-content;
}

.btnIconContainer .sound+label {

    .on {
        pointer-events: none;
        user-select: none;
        display: none;
    }

    .off {
        pointer-events: none;
        user-select: none;
        display: block;
    }
}

.btnIconContainer .sound:checked+label {

    .on {
        display: block;
    }

    .off {
        display: none;
    }
}

.btnIconContainer .alphabet+label {
    user-select: none;
    font-size: 24px;
    line-height: 24px;
}

.btnIconContainer .restartBtn {
    padding: 5px 10px;
    margin-bottom: -2px;
}

/* MARK:ReStart */

.restartBtn {
    display: flex;
    justify-content: center;
    width: 160px;
    border-radius: 50px;
    transition: .2s;

    &:hover {
        background-color: #f44;

        .icon {
            transform-origin: 8px 9px;
            animation: rotate-360 .2s linear;
        }

        .icon svg {
            fill: #f99;
        }

        .text {
            color: #f99;
        }
    }
}

@keyframes rotate-360 {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(-360deg);
    }
}

.restartBtn .icon {
    width: 16px;
    height: 16px;
    transition: .2s;
}

.restartBtn .icon svg {
    display: block;
}

.restartBtn .text {
    font-size: 16px;
    line-height: 16px;
    color: #999;
}

/* MARK:result */

.resultScreen {
    padding: 50px 100px;
}

.resultScreen .result {
    display: flex;
    justify-content: space-between;
    gap: 50px;
    margin-bottom: 50px;
}

.score {
    display: flex;
    gap: 20px;
    font-size: 72px;
}

.stats {
    width: fit-content;
}

.stats li {
    position: relative;
    width: fit-content;
    padding: 5px 0;
    margin-bottom: 5px;
    border-radius: 50px;

    background-color: #333;

    * {
        font-size: 16px;
        color: #f8f8f8;
    }

    /* &:nth-child(odd) {
        background-color: #333;

        * {
            color: #f8f8f8;
        }
    }

    &:nth-child(even) {
        background-color: #ccc;
    } */
}

.stats .statsKey {
    display: inline-block;
    width: 80px;
    padding-left: 30px;
    text-align: end;
}

.stats .statsValue {
    display: inline-block;
    width: 240px;
    padding-right: 30px;
    text-align: end;
}

.stats .tooltipBox {
    opacity: 0;
    z-index: 0;
    position: absolute;
    top: calc(100% + 2px);
    left: 0;
    padding: 5px 15px;
    color: var(--color-dark-light);
    background-color: var(--color-light-dark);
    border: 1px solid light-dark(#ccc, #555);
    transition: .2s;
}

.stats .listItem:hover+.tooltipBox {
    opacity: .9;
    z-index: 5;
}

.buttonArea {
    width: fit-content;
    margin-left: auto;
}

.buttonArea>* {
    width: fit-content;
    margin-left: auto;
}

.submitBtn {
    width: 180px;
    color: var(--color-light-dark);
    background-color: var(--color-dark-light);
    border-radius: 50px;
    font-size: 16px;
    line-height: 16px;
    margin-bottom: 10px;
    transition: .2s;

    &:hover {
        background-color: var(--hover-dark-light);
    }
}

/* MARK:setting */

.screenContainer .settingScreen {
    position: absolute;
    top: 0;
    left: 100%;
}

.settingScreen {
    position: relative;
}

.backBtn {
    position: absolute;
    bottom: 50px;
    right: 200px;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 5px;
    width: 100px;
    background-color: var(--color-dark-light);
    transition: .2s;

    &:hover {
        background-color: light-dark(#555, #eee);
    }
}

.backBtn .text {
    color: var(--color-light-dark);
    font-size: 16px;
    line-height: 16px;
}

.backBtn svg {
    fill: var(--color-light-dark);
}


.settingItem {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

.settingLabel {
    text-align: end;
    line-height: 24px;
}

/* MARK:toggle */

.toggleContainer {
    display: flex;
    align-items: center;
    gap: 10px;
}

.toggle {
    --toggle-size: 24px;
    --toggle-padding: 3px;
    display: block;
    position: relative;
    padding: var(--toggle-padding);
    width: calc(var(--toggle-size) * 2);
    height: var(--toggle-size);
    border-radius: calc(var(--toggle-size) / 2);
    /* border: 1px solid #ccc; */
    outline: 3px solid var(--color-dark-light);
    transition: .2s;

    &::after {
        content: "";
        display: block;
        width: calc(var(--toggle-size) - var(--toggle-padding) * 2);
        height: calc(var(--toggle-size) - var(--toggle-padding) * 2);
        margin-left: 0;
        background-color: var(--color-dark-light);
        border-radius: 50%;
        transition: .2s;
    }
}

input:checked+.toggle {
    background-color: light-dark(#aaa, #666);

    &::after {
        transform: translateX(calc(var(--toggle-size)));
    }
}

/* MARK:setting */

.soundIcon svg {
    display: block;

    &.onIcon {
        fill: var(--color-dark-light);
    }

    &.offIcon {
        fill: light-dark(#ccc, #999);
    }
}

.soundIcon {
    user-select: none;
    pointer-events: none;

    .on {
        display: none;
    }

    .off {
        display: inline-block;
    }
}

input:checked~.soundIcon {
    .on {
        display: inline-block;
    }

    .off {
        display: none;
    }
}

.rangeContainer {
    display: grid;
    grid-template-columns: 50% auto;
    align-items: center;
    gap: 20px;
}

.volumeRange {
    -webkit-appearance: none;
    appearance: none;
    outline: none;
    background: transparent;
    cursor: pointer;
    background-color: #ccc;
    width: 100%;
    height: 8px;
    border-radius: 4px;
}

/* Track: Chrome,Safari,Opera,Edge Chromium */
input[type="range"]::-webkit-slider-runnable-track {
    height: 8px;
}

/* Thumb: Chrome, Safari, Opera, Edge Chromium */
input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    height: 16px;
    width: 16px;
    margin-top: -4px;
    /* 位置の調整が必要 */
    background-color: var(--color-dark-light);
    border-radius: 50%;
    transition: 0.2s;
}



input[type="range"]::-webkit-slider-thumb:hover {
    box-shadow: 0 0 0 5px light-dark(rgba(50, 50, 50, .5), rgba(200, 200, 200, .5));
}

input[type="range"]:active::-webkit-slider-thumb {
    animation: scalingShadow .6s ease-in-out infinite;
}

input[type="range"]:focus::-webkit-slider-thumb {
    animation: scalingShadow .6s ease-in-out infinite;
}

/* Track: Firefox */
input[type="range"]::-moz-range-track {
    height: 8px;
}

/* Thumb: Firefox */
input[type="range"]::-moz-range-thumb {
    border: none;
    height: 12px;
    width: 12px;
    background-color: #333;
    border-radius: 50%;
}

input[type="range"]::-moz-range-thumb:hover {
    box-shadow: 0 0 0 5px light-dark(rgba(50, 50, 50, .5), rgba(200, 200, 200, .5));
}

input[type="range"]::-moz-range-thumb:active {
    box-shadow: 0 0 0 5px light-dark(rgba(50, 50, 50, .5), rgba(200, 200, 200, .5));
}

input[type="range"]::-moz-range-thumb:focus {
    box-shadow: 0 0 0 5px light-dark(rgba(50, 50, 50, .5), rgba(200, 200, 200, .5));
}

@keyframes scalingShadow {
    0% {
        box-shadow: 0 0 0 5px light-dark(rgba(50, 50, 50, .5), rgba(200, 200, 200, .5));
    }

    50% {
        box-shadow: 0 0 0 6px light-dark(rgba(50, 50, 50, .5), rgba(200, 200, 200, .5));
    }

    100% {
        box-shadow: 0 0 0 5px light-dark(rgba(50, 50, 50, .5), rgba(200, 200, 200, .5));
    }
}


.alphabetIcon {
    user-select: none;

    .on {
        font-weight: 800;
        color: light-dark(#ccc, #666);
    }

    .off {
        font-weight: 800;
        color: var(--color-dark-light);
    }
}

input:checked~.alphabetIcon {
    .on {
        color: var(--color-dark-light);
    }

    .off {
        color: light-dark(#ccc, #666);
    }
}

input[type="checkbox"] {
    display: none;
}

/* MARK: popUp */

.popupMessage {
    z-index: 1;
    opacity: 0;
    position: absolute;
    top: calc(50% - 20px);
    left: calc(50% - 200px);
    width: 400px;
    height: 40px;
    text-align: center;
    line-height: 40px;
    user-select: none;
    background-color: rgba(204, 204, 204, .5);
    border-radius: 10px;
    transition: .4s;
}

.popupMessage.active {
    opacity: 1;
    z-index: 10;
}

/* MARK:medaiaQueries */

@media screen and (max-width:1100px) {
    .score {
        font-size: 60px;
    }
}

@media screen and (max-width:1000px) {
    .score {
        font-size: 50px;
    }
}

@media screen and (max-width:950px) {
    .resultScreen {
        padding: 50px;
    }

    .resultScreen .score {
        display: block;
        text-align: end;
    }

}

@media screen and (max-width:900px) {
    * {
        --key-size: 30px;
    }

    .typingScreen span {
        font-size: 16px;
    }

    .originalText {
        font-size: 16px;
    }

    .score {
        text-align: end;
    }
}