@charset "UTF-8";

/*共通部分*/
:root{
    --base-color: #e9f1fd;
    --base-color-2: #f8fafc;
    --main-color: #2777f7;
    --accent-color: #a855f7;
    --accent-color-2: #8d8d94;
    --accent-color-3: #334155;
    --font-gray: #5c5e64;
    --font-black: #1f2937;
    --font-white: #ffffff;
    --button-hover-color: #1a60d6;
    --error-color: #c53030;
}

html{
    color-scheme: light;
}

html[data-theme="dark"]{
    color-scheme: dark;
    --base-color: #16181b;
    --base-color-2: #23262b;
    --main-color: #60a5fa;
    --accent-color: #c893fb;
    --accent-color-2: #424a56;
    --accent-color-3: #020617;
    --font-gray: #d2dae3;
    --font-black: #e2e8f0;
    --font-white: #ffffff;
    --button-hover-color: #3b82f6;
    --error-color: #c53030;
}

body{
    font-size: 100%;
    background-color: var(--base-color);
}

h1{
    color: var(--font-black);
    font-size: 1.2rem;
    padding: 0.5rem 0 0.5rem 0;
}

h2{
    color: var(--font-black);
    font-size: 1.1rem;
    padding: 0.5rem 0 0.5rem 0;
}

p{
    font-size: 1rem;
    line-height: 2;
    color: var(--font-gray);
}

span{
    color: var(--font-gray);
}

a{
    text-decoration: none;
}

.nav-flex a:hover span,
.footer-flex a:hover span {
    font-weight: bold;
}

.font-small{
    font-size: 0.75rem;
}

.font-middle{
    font-size: .875rem;
}

.font-black{
    color: var(--font-black);
}

.font-white{
    color: var(--font-white);
}

.font-bold{
    font-weight: bold;
}

.right{
    text-align: right;
}

.left{
    text-align: left;
}

.center{
    text-align: center;
}

.icon{
    width: 1.25rem;
    height: 1.25rem;
    margin: 0 .25rem 0 .25rem;
}

hr{
    border: none;
    border-top: 1px solid var(--font-gray);
    margin: .5rem 0 .5rem 0;
}

.none-select{
    user-select: none;
}

.hidden{
    display: none;
}

/* ヘッダー&ナビゲーションメニュー */
/* .header-flex{
    display: flex;
    justify-content: space-between; 
    background-color: var(--base-color);
    height: 2.25rem;
    align-items: center;
    font-size: 1rem;
    padding: 0 1rem 0 1rem;
    white-space: nowrap;
} */

.nav-flex{
    background-color: var(--base-color);
    display: flex;
    flex-direction: row;
    /* justify-content: flex-end; */
    height: 2.25rem;
    width: 100%;
    align-items: center;
    padding: 0 1rem 0 1rem;
    gap: .5rem;
}

.theme-toggle{
    margin-left: auto;
    display: inline-flex;
    align-items: center;
    gap: .5rem;
}

.theme-toggle-text{
    color: var(--font-gray);
    font-weight: bold;
}

.theme-toggle-switch{
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.75rem;
    height: 1.5rem;
    cursor: pointer;
    position: relative;
    border: none;
    background-color: transparent;
}

.theme-toggle-input{
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    padding: 0;
    overflow: hidden;
    clip-path: inset(50%);
    border: 0;
    white-space: nowrap;
}

.theme-toggle-slider{
    display: block;
    width: 100%;
    height: 100%;
    background-color: var(--accent-color-2);
    border-radius: 999px;
    transition: background-color .2s ease;
    position: relative;
}

.theme-toggle-slider::before{
    content: '';
    position: absolute;
    top: 0.175rem;
    left: 0.175rem;
    width: 1.15rem;
    height: 1.15rem;
    border-radius: 50%;
    background-color: var(--font-white);
    transform: translateX(0);
    transition: transform .2s ease;
}

.theme-toggle-input:checked + .theme-toggle-slider{
    background-color: var(--main-color);
}

.theme-toggle-input:checked + .theme-toggle-slider::before{
    transform: translateX(1.25rem);
}

/*メインコンテンツ*/
.main-flex{
    display: flex;
    justify-content: center;
    gap: 1rem;
    margin: .5rem 0 .5rem 0;
}

/*タイピング画面*/
    /*設定画面*/
    .typing-contents{
        width: 51rem;
        height: 31rem;
        background-color: var(--base-color-2);
        border-radius: 16px;
        padding: 0 1rem 0 1rem;
        margin: 0 1rem .5rem 1rem;
        box-shadow: 0 0 .5rem rgba(0,0,0,0.1), 0 0 1.5rem rgba(0,0,0,0.05);
    }

    #start-screen{
        display: block;
    }

    .title{
        padding: .75rem 0 .75rem 0;
    }

    form{
        line-height: 1.75;
        text-align: center;
    }

    .form-flex{
        width: 49rem;
        display: flex;
        justify-content: center;
        gap: 2rem;
        background-color: var(--base-color);
        border-radius: 12px;
        padding: 1rem 0 1rem 0;
        margin: 0 0 .5rem 0;
    }

    .form-question-number{
        min-width: 4rem;
    }

    label{
        cursor: pointer;
        background-color: var(--base-color);
        border: solid 1.5px var(--base-color);
        border-radius: 4px;
        color: var(--font-gray);
    }

    label:hover{
        font-weight: bold;
    }

    input[type="radio"]{
        appearance: none;
        -webkit-appearance: none;
    }
    
    input[type="radio"] + label{
        display: inline-block;
        width: 100%;
        padding: 0 0.25rem 0 0.25rem;
    }
    
    input[type="radio"]:checked + label{
        font-weight: bold;
        border-color: var(--accent-color-2);
    }
    
    input[type="checkbox"]:checked + label{
        font-weight: bold;
    }
    
    #start-button{
        font-size: 1rem;
        background-color: var(--main-color);
        border-radius: 8px;
        padding: 0.5rem 2rem 0.5rem 2rem;
        margin: .5rem 0 .5rem 0;
        cursor: pointer;
        box-shadow: 0 0 .5rem rgba(0,0,0,0.1), 0 0 1.5rem rgba(0,0,0,0.05);
    }

    #start-button:hover{
        background-color: var(--button-hover-color);
    }

    .form-error-message{
        min-height: 1.5rem;
        color: var(--error-color);
    }
    
    /*ゲーム画面*/
    .game-area{
        background-color: var(--base-color);
        border-radius: 12px;
        width: 49rem;
    }

    #game-screen{
        display: none;
        flex-direction: column;
        align-items: center;
        justify-content: flex-start;
        gap: .625rem;
        padding: .625rem 0 .625rem 0;
        cursor: none;
    }

    /*question-areaヘッダー*/
    .question-info{
        display: flex;
        justify-content: space-between;
        padding: .375rem 1.75rem 0 1.75rem;
    }

    

    /* 分野（左側）：バッジ風のデザイン */
    .info-badge {
        background-color: var(--main-color);
        padding: .125rem .5rem;
        border-radius: 8px;
        font-weight: bold;
    }

    /* 出典（右側）：少し控えめに */
    .info-text {
        color: var(--font-gray);
        font-weight: bold;
    }

    #question-area{
        min-height: 8.5rem;
        position: relative;
        overflow: hidden;
    }

    #question-area-visual,
    #answer-area-visual{
        width: 100%;
        height: 100%;
        display: flex;
        flex-direction: column;
        justify-content: flex-start;
        gap: .25rem;
    }

    #question-remaining{
        position: absolute;
        right: 1.75rem;
        bottom: .25rem;
    }

    #answer-area{
        min-height: 12.25rem;
        overflow: hidden;
    }
  
    .delay-screen{
        opacity: 0;
    }

    .completed{
        color: var(--font-gray);
        opacity: 0.5;
    }

    .current{
        color: var(--accent-color);
    }

    #question-text{
        padding: .25rem 1.75rem .375rem 1.75rem;
    }


    #current-char-guide{
        display: flex;
        align-items: flex-start;
        justify-content: flex-start;
        padding: 0 1.75rem 0 1.75rem;
        margin-top: .375rem;
        min-height: 4rem;     
    }

    #current-guide{
        display: flex;
        align-items: flex-start;
        justify-content: flex-start;
        padding: 0 1.75rem 0 1.75rem;
        min-height: 3.5rem;     
    }


    #user-input{
        display: flex;
        align-items: flex-start;
        justify-content: flex-start;
        padding: 0 1.75rem 0 1.75rem;
        margin-bottom: .375rem;
        min-height: 3.5rem;     
        word-break: break-all;  
        letter-spacing: .025rem;
    }

    #current-guide .guide-completed{
        font-weight: bold;
    }

    #current-guide .guide-pending{
        font-weight: normal;
    }

    #user-input{
        width: 100%;
        word-break: break-all;
    }

    /*キーボード*/
    #keyboard-container{
        display: grid;
        grid-template-columns:repeat(45, 1fr);
        gap: 3.5px;
        padding: .5rem 1rem .5rem 1rem;
        height: 7.75rem;
    }

    .key{
        background-color: var(--accent-color-2);
        /* border: 1px solid var(--font-gray); */
        border-radius: 6px;    
        display: flex;
        justify-content: center;
        align-items: center;
        box-shadow: 0 1px 0 rgba(0,0,0,0.20), 0 2px 4px rgba(0,0,0,0.08);
        transition: background-color .15s ease, box-shadow .15s ease;
    }

    .key span{
        align-self: center;
        font-size: 0.75rem;
        font-weight: bold;
        color: var(--font-white);
    }
    
    .key.normal{
        grid-column: span 3;
        height: 25px;
    }

    .key.middle{
        grid-column: span 4;
        height: 25px;
    }

    .key.wide{
        grid-column: span 5;
        height: 25px;
    }

    .key.shift{
        grid-column: span 6;
        height: 25px;
    }

    .key.enter-top{
        grid-column: 41 / 46;
        border-radius: 6px 6px 0 6px;
        position: relative;
        z-index: 1;
    }

    .key.enter-bottom{
        grid-column: 42 / 46;
        height: 28px;
        border-top: none;
        margin-top: -4.5px;
        border-radius: 0 0 6px 6px;
        position: relative; 
        z-index: 2;
        align-items: top;
    }    

    .key.enter-bottom span{
        transform: translateY(-14px);
    }
    .key.active{
        background-color: var(--main-color);
        font-weight: bold;
        transform: translateY(1px);
        box-shadow: 0 0 0 rgba(0,0,0,0);
    }

    /*結果画面*/
    .result-graph-area{
        background-color: var(--base-color);
        margin: 0 .25rem 0 .25rem;
        width: 49rem;
        height : 21.375rem;
        border-radius: 12px;
        display: flex;
        flex-direction: column;
        position: relative;
        z-index: 1;
    }

    #results-screen{
        display: none;
        flex-direction: column;
        align-items: center;
        justify-content: flex-start;
        gap: .625rem;
        padding: .625rem 0 .625rem 0;
    }

    .result-graph-wrapper{
        flex: 1;
        min-height: 0;
        display: flex;
        flex-direction: column;
        width: 100%;
        padding: 0 1rem .5rem 1rem;
        gap: .5rem;
    }

    #result-chart{
        flex: 1;
        min-height: 0;
    }

    .result-period-selector{
        display: flex;
        justify-content: center;
        flex-wrap: wrap;
        gap: .375rem;
        padding: 0;
        margin: 0;
        border: none;
    }

    .result-period-selector input[type="radio"]{
        position: absolute;
        opacity: 0;
        pointer-events: none;
    }

    .result-period-selector input[type="radio"] + label{
        display: inline-flex;
        align-items: center;
        justify-content: center;
        width: 5.5rem;
        box-sizing: border-box;
        text-align: center;
        padding: 0 .5rem 0 .5rem;
    }

    .result-period-selector input[type="radio"]:checked + label{
        border-color: var(--accent-color-2);
    }

    .result-data-area{
        display: grid;
        grid-template-columns: repeat(3, 1fr);
        background-color: var(--base-color);
        margin: 0 .25rem 0 .25rem;
        padding: .5rem 1rem .5rem 1rem;
        height: 7.75rem;
        width: 49rem;
        border-radius: 12px;
        position: relative;
        overflow: visible;
        isolation: isolate;
        z-index: 4;
    }

    .result-history-section{
        background-color: var(--base-color-2);
        margin: 1rem 1rem 1rem 1rem;
        width: 51rem;
        border-radius: 12px;
    }

    .law-history-info{
        display: flex;
        justify-content: space-between;
        padding: .375rem 1.75rem 0 1.75rem;
    }

    .law-history-list{
        display: flex;
        flex-direction: column;
        gap: .625rem;
    }

    .law-history-card{
        background-color: var(--base-color);
        border-radius: 12px;
        width: 49rem;
        height: auto;
    }

    .law-history-text{
        padding: .25rem 1.75rem .375rem 1.75rem;
        word-break: break-word;
    }

    .law-history-pagination{
        display: flex;
        flex-wrap: wrap;
        justify-content: center;
        gap: .375rem;
        margin: 1rem 0 1rem 0;
    }

    .law-history-page-button{
        min-width: 2rem;
        padding: .125rem .5rem;
        border-radius: 6px;
        border: 1.5px solid var(--accent-color-2);
        background-color: var(--base-color-2);
        color: var(--font-gray);
        font-size: .875rem;
        cursor: pointer;
    }

    .law-history-page-button.is-active{
        border-color: var(--main-color);
        color: var(--main-color);
        font-weight: bold;
    }

    #law-history-empty{
        margin: .25rem 0 .5rem 0;
    }

    .result-guide{
        width: 100%;
        margin-top: .1rem;
        pointer-events: none;
        white-space: pre-wrap;
    }

    .stat-item{
        opacity: 0;
        position: relative;
        z-index: 1;
    }

    .stat-item:hover,
    .stat-item:focus-within{
        z-index: 20;
    }

    .stat-item.upper{
        grid-column: span 1;
        /* text-align: center; */
    }

    .stat-item.lower{
        grid-column: span 3;
    }

    .stat-label-with-help{
        position: relative;
        display: inline-block;
        padding-left: 1rem;
    }

    .result-title-with-help{
        position: relative;
        display: inline-block;
        padding: 0 .875rem 0 .875rem;
    }

    .stat-help-anchor{
        position: absolute;
        top: -0.2rem;
        left: 0;
        width: .75rem;
        height: .75rem;
        border: 1px solid var(--main-color);
        border-radius: 50%;
        background-color: var(--base-color-2);
        color: var(--main-color);
        font-size: .5rem;
        font-weight: bold;
        line-height: 1;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        user-select: none;
        z-index : 30;
    }


    .stat-help-anchor::after{
        content: attr(data-tooltip);
        position: absolute;
        bottom: calc(100% + .5rem);
        left: 0;
        width: 20rem;
        padding: .45rem .6rem;
        border-radius: 8px;
        background-color: var(--accent-color-3);
        color: var(--font-white);
        font-size: .72rem;
        line-height: 1.5;
        letter-spacing: .01em;
        box-shadow: 0 0.4rem 1.2rem rgba(0,0,0,0.18);
        opacity: 0;
        visibility: hidden;
        pointer-events: none;
        transition: opacity .2s ease;
        z-index: 12;
        white-space: normal;
    }

    .stat-help-anchor:hover::before,
    .stat-help-anchor:hover::after{
        opacity: 1;
        visibility: visible;
    }
     
/*注意書き*/
article{
    width: 51rem;
    background-color: var(--base-color-2);
    border-radius: 16px;
    padding: 0 1rem .25rem 1rem;
    margin: 1rem 1rem 1rem 1rem;
    box-shadow: 0 0 .5rem rgba(0,0,0,0.1), 0 0 1.5rem rgba(0,0,0,0.05);
}
.article-contents{
    padding : .25rem;
    margin: .5rem auto .5rem;
}

/*サイドコンテンツ*/
.aside-data-container{
    min-width: 18rem;
    max-width: 20rem;
    align-self: flex-start;
    min-width: 0;
    flex-shrink: 1;
    background-color: var(--base-color-2);
    border-radius: 16px;
    padding: 0.25rem 1rem 0.25rem 1rem;
    margin: 0 1rem .5rem 1rem;
    box-shadow: 0 0 .5rem rgba(0,0,0,0.1), 0 0 1.5rem rgba(0,0,0,0.05);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.aside-contents{
    border-radius: 8px;
    padding : .25rem;
    margin: .5rem auto .5rem;
}
.aside-stats-container{
    display: grid;
    grid-template-columns: 1fr 1fr;
}

/*フッター*/
footer{
    background-color: var(--base-color-2);
    padding: 8px 0 8px 0;
}

.footer-flex{
    display: flex;
    justify-content: center;
    gap: 1rem;
    margin : .5rem 0 .5rem 0;
}

/* 各種SNSリンク */
.footer-icon-flex{
    display: flex;
    justify-content: center;
    gap: .125rem;
}

.social-link{
    display: inline-flex;
    position: relative;
    width: 2.25rem;
    height: 2.25rem;
    border-radius: 50%;
    color: var(--font-gray);
    transition: color .2s ease, background-color .2s ease;
}

.social-link:hover{
    color: var(--main-color);
    background-color: var(--base-color);
}

.social-icon{
    width: 1.3rem;
    height: 1.3rem;
    fill: currentColor;
    display: block;
    overflow: visible;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

/* プライバシーポリシー */
.policy-rule-main{
    margin: 1rem 6rem 1rem 6rem;
    min-width: 500px;
    padding: 1rem 1rem 1rem 1rem;
    background-color: var(--base-color-2);
    border-radius: 16px;
    box-shadow: 0 0 .5rem rgba(0,0,0,0.1), 0 0 1.5rem rgba(0,0,0,0.05);
}

.policy-rule-main ul{
    margin-left: 1.5rem;
    color: var(--font-gray);
    list-style-type: disc;
    line-height: 2;
}

/*デスクトップ版*/
@media(min-width: 800px) {

}
