:root {
    /* タイポグラフィ定義 */
    --font-size-main-title: 2.6vh;
    --font-size-sub-title: 2.2vh;
    --font-size-body: 1.9vh;
    --font-size-strong: 2.2vh;
    --font-size-button: 2.2vh;
    --font-size-sub: 1.4vh;
}

html,
body {
    margin: 0;
    padding: 0;
    height: 100%;
    width: 100%;
    overflow: hidden;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    font-size: var(--font-size-body);
}

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

/* スタート画面 */
#StartScreen {
    height: 100vh;
    width: 100vw;
    display: flex;
    position: relative;
    overflow: hidden;
}

/* スタート画面の背景画像 */
#StartScreen img:not(#StartButton) {
    position: absolute;
    top: 0;
    left: 0;
    height: 100vh;
    width: 100vw;
    object-fit: cover;
    z-index: -1;
}

#StartButton {
    position: absolute;
    bottom: 25vh;
    left: 50%;
    transform: translateX(-50%);
    width: 180px;
    z-index: 10;
    cursor: pointer;
    transition: all 0.2s ease;
}

#StartButton:hover {
    transform: translateX(-50%) scale(1.05);
}


/* チュートリアル画面 */
/* チュートリアル共通（1と2） */
#TutorialScreen,
#TutorialScreen2,
#TutorialScreen3 {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    height: 100%;
    width: 100%;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 150;
    background: rgba(0, 0, 0, 0.6);
}

#TutorialScreen p,
#TutorialScreen2 p,
#TutorialScreen3 p {
    color: #fff;
    font-size: var(--font-size-body);
    margin: 0.8vh 20px;
    /* 1.2vh -> 0.8vh */
    text-shadow: 1px 1px 4px rgba(0, 0, 0, 0.8);
    width: 90%;
    text-align: left;
    line-height: 1.5;
}

/* チュートリアル2の項目名（見出し） */
#TutorialText4,
#TutorialText5,
#TutorialText9 {
    font-size: var(--font-size-sub-title) !important;
    font-weight: 900 !important;
    color: #fff !important;
    margin-top: 1.2vh !important;
    margin-bottom: 0.4vh !important;
}

/* 説明文（・で始まる行）のインデント */
#TutorialScreen2 p:not(#TutorialText3):not(#TutorialText4):not(#TutorialText5):not(#TutorialText9) {
    margin-left: 20px;
    font-size: var(--font-size-body);
    opacity: 0.95;
}

#TutorialText1,
#TutorialText3,
#TutorialText11 {
    font-size: var(--font-size-main-title) !important;
    font-weight: bold;
    margin-bottom: 1.5vh !important;
    text-align: center !important;
}

#NextButton,
#NextButton2,
#NextButton3 {
    margin-top: 2.5vh;
    font-size: var(--font-size-button);
    padding: 1.2vh 6vw;
    background: rgba(255, 255, 255, 0.2);
    color: #fff;
    border: 1px solid #fff;
    border-radius: 50px;
    cursor: pointer;
    transition: all 0.2s;
    z-index: 160;
    min-width: 120px;
}

#NextButton:hover,
#NextButton2:hover,
#NextButton3:hover {
    background: rgba(255, 255, 255, 0.4);
    transform: scale(1.05);
}

/* 日付更新・起床画面 */
#DateUpdateScreen,
#MorningScreen {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.65);
    z-index: 400;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    color: white;
    text-align: center;
}

#DateUpdateScreen p:first-child {
    font-size: var(--font-size-body) !important;
    font-weight: normal !important;
    margin: 10px 0;
    text-shadow: 2px 2px 10px rgba(0, 0, 0, 0.5);
}

#MorningScreen p:first-child,
#MorningEventMessage {
    font-size: var(--font-size-main-title) !important;
    font-weight: bold !important;
    margin: 10px 0;
    text-shadow: 2px 2px 10px rgba(0, 0, 0, 0.5);
}

#MorningEventMessage,
#MorningEventMessage2 {
    white-space: pre-wrap;
    width: 80%;
    margin-left: auto;
    margin-right: auto;
    line-height: 1.4;
}

#MorningEventMessage {
    margin-top: 2vh !important;
}

#MorningEventMessage2,
#MorningScreen p:nth-child(2),
#DateUpdateScreen p:nth-child(2) {
    font-size: var(--font-size-body) !important;
    font-weight: normal !important;
    opacity: 0.9;
    margin-top: 0.4vh !important;
}

#DateUpdateNextButton,
#MorningNextButton {
    margin-top: 4vh;
    font-size: var(--font-size-button);
    padding: 1.2vh 6vw;
    background: rgba(255, 255, 255, 0.2);
    color: #fff;
    border: 1px solid #fff;
    border-radius: 50px;
    cursor: pointer;
    transition: all 0.2s;
    z-index: 160;
    min-width: 120px;
}

#DateUpdateNextButton:hover,
#MorningNextButton:hover {
    background: rgba(255, 255, 255, 0.4);
    transform: scale(1.05);
}

/* メイン画面 */
#MainScreen {
    display: none;
    height: 100vh;
    width: 100vw;
    position: relative;
    overflow: hidden;
}

#MainScreen img {
    position: absolute;
    top: 0;
    left: 0;
    height: 100vh;
    width: 100vw;
    object-fit: cover;
    z-index: -1;
}

/* ステータスコンテナ（上部横並びヘッダー） */
#StatusContainer {
    position: fixed;
    top: 60px;
    left: 0;
    width: 100%;
    z-index: 200;
    display: flex;
    flex-direction: row;
    justify-content: center;
    gap: 3vw;
    align-items: center;
    padding: 1vh 2vw;
    background: #fff;
    border-bottom: 1px solid rgba(0, 0, 0, 0.1);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
}

/* ステータスバー強調表示（チュートリアル用） */
.highlight-status {
    background: rgba(255, 255, 255, 0.8) !important;
    box-shadow: 0 0 30px rgba(255, 255, 255, 0.8), 0 0 60px rgba(255, 255, 255, 0.4) !important;
    border-bottom: 2px solid #fff !important;
    animation: statusPulse 2s infinite ease-in-out;
}

@keyframes statusPulse {
    0% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.02);
    }

    100% {
        transform: scale(1);
    }
}

.StatusItem {
    display: flex;
    align-items: baseline;
    gap: 0.5vw;
}

.StatusLabel {
    font-size: var(--font-size-sub);
    color: #666;
    font-weight: bold;
    white-space: nowrap;
}

.StatusValue {
    font-size: var(--font-size-strong);
    font-weight: 900;
    color: #666;
    white-space: nowrap;
    line-height: 1;
}

.StatusUnit {
    font-size: var(--font-size-sub);
    color: #888;
}

/* 集中ゲージ専用スタイル */
#FocusCountPosition {
    display: flex;
    flex-direction: row;
    align-items: center;
}

.FocusHeader {
    display: flex;
    align-items: baseline;
    gap: 0.5vw;
    margin-right: 8px;
}

#FocusBarContainer {
    width: 12vw;
    max-width: 120px;
    height: 1.2vh;
    background-color: rgba(0, 0, 0, 0.1);
    border-radius: 10px;
    overflow: hidden;
    border: 1px solid rgba(0, 0, 0, 0.05);
}

#FocusBar {
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, #00f2fe 0%, #4facfe 100%);
    transition: width 0.3s ease;
}

/* 各項目の個別調整 */
#DayCountPosition {
    background: rgba(255, 71, 87, 0.1);
    padding: 0.5vh 1.5vw;
    border-radius: 8px;
}

#DayCountPosition .StatusLabel {
    color: #666;
}

#MainButtonPosition {
    position: absolute;
    display: flex;
    width: 100%;
    bottom: 10vh;
    left: 0;
    justify-content: center;
    z-index: 10;
    gap: 8vw;
}

#MainButtonPosition.highlight-position {
    z-index: 200 !important;
}

.MainButton {
    border-radius: 50%;
    width: 22vw;
    height: 22vw;
    max-width: 120px;
    max-height: 120px;
    font-size: var(--font-size-button);
    font-weight: bold;
    cursor: pointer;
    border: 2px solid #fff;
    background: rgba(255, 255, 255, 0.9);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #000;
}

.MainButton:hover {
    transform: scale(1.1);
    background: #fff;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.3);
}

/* メインボタン強調表示（チュートリアル3用） */
.highlight-button {
    position: relative;
    background: #fff !important;
    box-shadow: 0 0 25px rgba(255, 255, 255, 0.9), 0 0 45px rgba(255, 255, 255, 0.5) !important;
    border: 3px solid #fff !important;
    animation: statusPulse 2s infinite ease-in-out;
    z-index: 210 !important;
    pointer-events: none;
}

/* ポップアップ共通オーバーレイ */
#WorkScreen,
#ItemConfirmScreen,
#TaskSelectScreen,
#TaskConfirmScreen,
#AlertScreen {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    justify-content: center;
    align-items: center;
    background: rgba(0, 0, 0, 0.6);
    z-index: 300;
}

/* ポップアップコンテナ */
#WorkText,
#ItemConfirmText,
#TaskConfirmText,
#TaskText,
#AlertText {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    background: rgba(255, 255, 255, 0.98);
    width: 85%;
    max-width: 400px;
    padding: 30px 20px;
    border-radius: 24px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(0, 0, 0, 0.1);
}

#TaskText {
    height: 70%;
    max-width: 500px;
}

#WorkText p,
#ItemConfirmText p,
#TaskConfirmText p,
#TaskConfirmDetail,
#AlertTextContent {
    font-size: var(--font-size-body);
    margin: 1vh 0;
    color: #333;
    text-align: center;
}

#TaskText h2 {
    font-size: var(--font-size-sub-title);
    font-weight: 800;
    margin-bottom: 20px;
    color: #000;
}

/* ボタンコンテナと共通ボタン */
.ButtonContainer {
    display: flex;
    gap: 20px;
    margin-top: 2.5vh;
}

.PopupButton,
.NoButton {
    padding: 1.2vh 4vw;
    font-size: var(--font-size-button);
    font-weight: bold;
    border-radius: 50px;
    cursor: pointer;
    border: none;
    min-width: 100px;
    transition: all 0.2s ease;
}

.YesButton {
    background: linear-gradient(135deg, #42e695 0%, #3bb2b8 100%);
    color: white;
}

.YesButton:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(66, 230, 149, 0.4);
}

.NoButton {
    background: #f1f2f6;
    color: #2f3542;
}

.NoButton:hover {
    background: #dfe4ea;
}

/* 課題リスト表示 */
.task-summary {
    display: flex;
    justify-content: space-around;
    background: #f8f9fa;
    padding: 12px;
    border-radius: 12px;
    margin-bottom: 20px;
    width: 100%;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.05);
}

.summary-item {
    font-size: var(--font-size-body);
    font-weight: bold;
    color: #444;
}

.summary-count {
    font-size: var(--font-size-sub-title);
    font-weight: 900;
    margin-left: 4px;
}

#TaskList {
    width: 100%;
    flex-grow: 1;
    overflow-y: auto;
    padding: 10px;
}

.task-list-header {
    font-size: var(--font-size-sub);
    font-weight: bold;
    color: #666;
    margin: 15px 0 5px;
    border-bottom: 2px solid #ddd;
}

.task-item {
    background: #fff;
    border: 1px solid #eee;
    border-radius: 12px;
    padding: 12px;
    margin-bottom: 8px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.task-item.submitted {
    opacity: 0.6;
    background: #f9f9f9;
}

.task-info {
    font-size: var(--font-size-body);
    font-weight: bold;
}

.task-cost {
    font-size: var(--font-size-sub);
    color: #666;
    display: flex;
    align-items: center;
    gap: 10px;
}

.task-submit-button {
    background: #4facfe;
    color: #fff;
    border: none;
    padding: 4px 12px;
    border-radius: 4px;
    font-size: var(--font-size-sub);
    cursor: pointer;
}

/* ゲームオーバー画面 */
#GameOverScreen,
#GameClearScreen {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    width: 100vw;
    z-index: 500;
}

#GameOverScreen img:first-child,
#GameClearScreen img:first-child {
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    width: 100%;
    object-fit: cover;
    z-index: -1;
}

#ClearResultContainer {
    position: absolute;
    top: 25%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
    width: 80%;
    z-index: 5;
}

#GameOverResultContainer {
    position: absolute;
    top: 34%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
    width: 100%;
    z-index: 5;
}

#ClearResultContainer {
    color: rgb(255, 255, 110);
}

#GameOverResultContainer {
    color: rgb(0, 0, 0);
}

#ClearResultContainer p,
#GameOverResultContainer p {
    margin: 1vh 0;
    font-weight: bold;
    line-height: 1.4;
    paint-order: stroke;
}

#ClearResultContainer p {
    -webkit-text-stroke: 2px rgb(150, 100, 0);
}

#ClearEnergyDrink {
    color: rgb(255, 255, 110);
    -webkit-text-stroke: 1.5px rgb(150, 100, 0);
}

#GameOverEnergyDrink {
    color: rgb(0, 0, 0);
}

#ClearWorkHours {
    color: rgb(255, 255, 110);
    -webkit-text-stroke: 1.5px rgb(150, 100, 0);
}

#GameOverWorkHours {
    color: rgb(0, 0, 0);
}

#GameOverUnfinishedTasks {
    color: rgb(0, 0, 0);
}

#ClearEnergyDrink,
#ClearWorkHours,
#GameOverEnergyDrink,
#GameOverWorkHours,
#GameOverUnfinishedTasks {
    font-size: var(--font-size-sub-title);
}

#ClearMessage,
#GameOverMessage {
    font-size: var(--font-size-main-title);
}

#RetryButton,
#ClearRetryButton {
    position: absolute;
    bottom: 10vh;
    left: 50%;
    transform: translateX(-50%);
    width: 250px;
    cursor: pointer;
    transition: transform 0.2s ease;
    z-index: 10;
}

#RetryButton:hover,
#ClearRetryButton:hover {
    transform: translateX(-50%) scale(1.1);
}