
/* 基本設定 */

*{
    margin:0;
    padding:0;
    box-sizing:border-box;
}

body{

    background:#ffffff;

    font-family:'DotGothic16',sans-serif;

    color:#6663d4;

    padding:20px;

}

.container{

    max-width:1100px;

    margin:auto;

    background:#c1c3ff;

    border:4px solid #6663d4;

    padding:25px;

    box-shadow:8px 8px #6663d4;

}

/* タイトル */

header{

    text-align:center;

    margin-bottom:30px;

}

header h1{

    font-size:36px;

    letter-spacing:3px;

}

header p{

    margin-top:10px;

}



  /* カレンダー */


.calendar{

    display:grid;

　grid-template-columns: repeat(7, minmax(0, 1fr));

    gap:12px;

}

.day{

    background:#ffffff;

    border:3px solid #6663d4;

    min-height:110px;

    display:flex;

    flex-direction:column;

    align-items:center;

    justify-content:center;

    cursor:pointer;

    transition:.15s;

}

.day:hover{

    transform:translate(-3px,-3px);

    box-shadow:5px 5px #6663d4;

}

.day.selected{

    background:#ffbbe4;

}

.day.today{

    border:3px dashed #6663d4;

}

.day-number{

    margin-bottom:8px;

}

.day img{

    width:58px;

    image-rendering:pixelated;

}


/* --------------------
   感情選択
-------------------- */

.emotion-window{

    margin-top:40px;

    background:#ffffff;

    border:4px solid #6663d4;

    padding:20px;

    box-shadow:8px 8px #6663d4;

}

.emotion-window h2{

    text-align:center;

    margin-bottom:20px;

}

.emotion-list{

    display:grid;

    grid-template-columns:repeat(4,1fr);

    gap:20px;

}

.emotion-list img{

    width:70px;

    margin:auto;

    cursor:pointer;

    image-rendering:pixelated;

    transition:.15s;

}

.emotion-list img:hover{

    transform:scale(1.15);

}


/* --------------------
   メモ
-------------------- */

.memo-window{

    margin-top:35px;

    background:#c1c3ff;

    border:4px solid #6663d4;

    padding:20px;

    box-shadow:8px 8px #6663d4;

}

.memo-window h2{

    text-align:center;

    margin-bottom:15px;

}

textarea{

    width:100%;

    height:120px;

    resize:none;

    padding:15px;

    font-family:'DotGothic16',sans-serif;

    border:3px solid black;

    font-size:14px;

}

.memo-footer{

    display:flex;

    justify-content:space-between;

    align-items:center;

    margin-top:15px;

}

#saveButton{

    width:150px;

    height:45px;

    background:white;

    border:3px solid #6663d4;

    cursor:pointer;

    font-family:'DotGothic16',sans-serif;

    transition:.15s;

}

#saveButton:hover{

    transform:translate(-2px,-2px);

    box-shadow:4px 4px black;

}

#saveButton:active{

    transform:translate(2px,2px);

    box-shadow:none;

}


/* --------------------
   SAVE COMPLETE
-------------------- */

#savePopup{

    position:fixed;

    top:20px;

    right:20px;

    background:#6663d4;

    color:white;

    padding:15px 25px;

    border:3px solid white;

    display:none;

    z-index:1000;

}


/* --------------------
   HISTORY
-------------------- */

.history-window{

    margin-top:45px;

    background:#fbfbfb;

    border:4px solid #6663d4;

    padding:20px;

    box-shadow:8px 8px #6663d4;

}

.history-window h2{

    text-align:center;

    margin-bottom:20px;

}


/* 外側 */

.history-wrapper{

    overflow:hidden;

}


/* 流れる部分 */

#historyTrack{

    display:flex;

    gap:20px;

    width:max-content;

    animation:historyScroll 35s linear infinite;

}

/* PCではホバーで停止 */

#historyTrack:hover{

    animation-play-state:paused;

}


/* カード */

.history-card{

    width:170px;

    min-height:190px;

    background:white;

    border:3px solid #6663d4;

    box-shadow:5px 5px #6663d4;

    padding:15px;

    flex-shrink:0;

    text-align:center;

}

.history-card img{

    width:70px;

    image-rendering:pixelated;

    margin-bottom:10px;

}

.history-date{

    margin-bottom:10px;

}

.history-comment{

    font-size:13px;

    word-break:break-word;

}


/* --------------------
   アニメーション
-------------------- */

@keyframes historyScroll{

    from{

        transform:translateX(0);

    }

    to{

        transform:translateX(calc(-190px * 8));

    }

}

@keyframes pop{

    0%{

        transform:scale(.6);

    }

    50%{

        transform:scale(1.2);

    }

    100%{

        transform:scale(1);

    }

}

.pop{

    animation:pop .25s;

}


/* --------------------
   フッター
-------------------- */

footer{

    margin-top:50px;

    text-align:center;

}


/* --------------------
   スマホ
-------------------- */

@media(max-width:768px){

.calendar{

gap: 4px;

}

.day{

min-height:90px;

}

.day img{

width:45px;

}

.emotion-list{

grid-template-columns:repeat(4,1fr);

gap:12px;

}

.emotion-list img{

width:55px;

}

.memo-footer{

flex-direction:column;

gap:15px;

}

#saveButton{

width:100%;

}

.history-wrapper{

overflow-x:auto;

overflow-y:hidden;

padding-bottom:10px;

}

/* スマホでは自動スクロールを止めて
   指で横スクロールできるようにする */

#historyTrack{

animation:none;

padding-right:20px;

}

.history-card{

width:150px;

min-height:170px;

}

}

#historyTrack{

    display:flex;

    gap:20px;

    width:max-content;

    animation:historyScroll 60s linear infinite;

}
.delete-btn{

    margin-top:10px;

    width:28px;

    height:28px;

    border:2px solid #6663d4;

    background:white;

    cursor:pointer;

    font-family:'DotGothic16',sans-serif;

}

.delete-btn:hover{

    background:#ffb5b5;

}

.day {
    min-width: 0;
}

.day img {
    max-width: 100%;
    height: auto;
}

.history-wrapper {
    overflow-x: auto;
    overflow-y: hidden;
    padding: 4px 6px 12px;
}

#historyTrack {
    flex-wrap: nowrap;
    animation: none;
}

.history-card {
    height: 190px;
    min-height: 0;
    overflow-y: auto;
    overflow-wrap: anywhere;
}

@media (max-width: 768px) {
    body {
        padding: 10px;
    }

    .container {
        padding: 8px;
        box-shadow: 4px 4px #6663d4;
    }

    .day {
        min-height: 64px;
        border-width: 2px;
    }

    .day.today {
        border-width: 2px;
    }

    .day img {
        width: min(32px, 100%);
    }

    .emotion-list {
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }

    .emotion-list img {
        max-width: 100%;
        height: auto;
    }
}

.calendar {
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
}

.calendar-weekday {
    text-align: center;
    font-size: 14px;
    padding-block: 6px;
}

#calendar {
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
}

.calendar-weekday {
    text-align: center;
    padding-block: 6px;
}

.day-icon:not([src]) {
    display: none;
}

@media (max-width: 768px) {
    #calendar {
        gap: 4px;
    }
}
.status-bar, .month-controls {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
    gap: 8px 16px;
    margin-block: 16px;
}

.status-bar {
    background: white;
    border: 3px solid #6663d4;
    padding: 8px;
}

.calendar-section {
    text-align: center;
}

.month-controls button, #currentMonth {
    background: white;
    border: 2px solid #6663d4;
    color: inherit;
    font: inherit;
    padding: 6px 12px;
    cursor: pointer;
}

#currentMonth {
    margin-bottom: 10px;
}

.day {
    color: inherit;
    font: inherit;
    padding: 2px;
}

.calendar-weekday:first-child { color: #9c2457; }
.calendar-weekday:nth-child(7) { color: #304da7; }

.history-space { flex: 0 0 20px; }

#loadingScreen[hidden] {
    display: none;
}

#loadingScreen {
    position: fixed;
    inset: 0;
    z-index: 2000;
    display: grid;
    place-items: center;
    padding: 20px;
    background: #c1c3ff;
}

.loading-card {
    width: min(100%, 260px);
    padding: 24px;
    border: 4px solid #6663d4;
    box-shadow: 6px 6px #6663d4;
    background: #fff;
    text-align: center;
    letter-spacing: 2px;
}

.loading-heart {
    display: block;
    margin-bottom: 6px;
    color: #6663d4;
    font-size: 44px;
    line-height: 1;
    animation: loadingBounce 600ms steps(3) infinite alternate;
}

.loading-bar {
    height: 16px;
    margin-top: 14px;
    border: 2px solid #6663d4;
    background: #ffeff8;
    overflow: hidden;
}

.loading-bar::before {
    content: "";
    display: block;
    width: 40%;
    height: 100%;
    background: #a19eff;
    animation: loadingSlide 850ms steps(6) infinite alternate;
}

@keyframes loadingBounce {
    to { transform: translateY(-8px); }
}

@keyframes loadingSlide {
    to { transform: translateX(150%); }
}

@media (prefers-reduced-motion: reduce) {
    .loading-heart,
    .loading-bar::before {
        animation: none;
    }
}