/* リセット & 基本設定 */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    -webkit-tap-highlight-color: transparent;
    -ms-overflow-style: none;
    scrollbar-width: none;
}

*::-webkit-scrollbar {
    display: none;
}

:root {
    --primary-red: #CC1F3C;
    /* ボタン背景など */
    --accent-pink: #F23454;
    /* テキスト強調用（明るいピンク赤） */
    --gold-border: #c8a060;
    --font-main: "Noto Sans", sans-serif;
    --font-serif: "Zen Old Mincho", serif;

    /* 日付 */
    --font-display: "Almendra SC", serif;
}

body {
    font-family: var(--font-main);
    background-color: #000;
    color: #fff;
    overflow: hidden;
    height: 100dvh;
    width: 100vw;
}

/* 背景画像 */
.bg-layer {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: url('./image/bg.png');
    background-size: cover;
    background-position: center;
    z-index: -1;
    filter: brightness(0.7);
}

/* アプリコンテナ */
.app-container {
    position: relative;
    width: 100%;
    height: 100%;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

@media (min-width: 501px) {
    body {
        background-color: #111;
    }

    .app-container {
        box-shadow: 0 0 50px rgba(0, 0, 0, 0.5);
    }
}

/* --- ヘッダー --- */
.app-header {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    padding: 25px 20px;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    z-index: 100;
    pointer-events: none;
}

.date-display {
    font-family: var(--font-display);
    color: #fff;
    display: flex;
    align-items: flex-start;
    gap: 5px;
    text-shadow: 0 0 15px rgba(192, 43, 69, 0.7);
    line-height: 1;
}

.date-small-group {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    align-items: flex-end;
    padding-top: 5px;
}

.date-display .year {
    font-size: 1.2rem;
    letter-spacing: 0.05em;
}

.date-display .month-wrapper {
    font-size: 1.8rem;
    letter-spacing: 0.1rem;
}

.date-display .day {
    font-size: 4.6rem;
    line-height: 0.6;
    letter-spacing: -0.3rem;
}

.menu-btn {
    pointer-events: auto;
    background: #fff;
    border: none;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 5px;
    cursor: pointer;
    box-shadow: 0 0 15px rgba(192, 43, 69, 0.6);
    transition: transform 0.2s;
}

.menu-btn:active {
    transform: scale(0.95);
}


/* --- キャラクターエリア --- */
.character-area {
    position: absolute;
    top: 70px;
    left: 0;
    width: 100%;
    height: 105%;
    display: flex;
    justify-content: center;
    align-items: baseline;
    z-index: 0;
}

.char-container {
    width: 100%;
    height: 100%;
    /* 元の .char-img の高さ指定をここに移動 */
    position: relative;

    /* ふわふわアニメーションはここで一括制御 */
    animation: floatAngel 4s ease-in-out infinite;
}

/* ふわふわ浮くアニメーションの定義 */
@keyframes floatAngel {

    0%,
    100% {
        /* 開始と終了は元の位置 */
        transform: translateY(0);
    }

    50% {
        /* 中間地点で少し上に浮く（数値で浮遊幅を調整できます） */
        transform: translateY(-20px);
    }
}

.char-img {
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    -webkit-transform: translateX(-50%);
    -ms-transform: translateX(-50%);
    height: 100%;

    /* クロスフェードの設定 */
    opacity: 0;
    /* 基本は透明 */
    transition: opacity 0.5s ease;
    /* 0.5秒かけてふわっと切り替え */
    z-index: 1;
}

.char-img.active {
    opacity: 1;
    z-index: 2;
}

/* --- ホーム画面 --- */
.scene {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 10;
    display: none;
}

.scene.active {
    display: block;
}

.tap-start-text {
    position: absolute;
    top: 55%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: #fff;
    font-size: 1.1rem;
    text-shadow: 0 2px 5px rgba(0, 0, 0, 0.8);
    letter-spacing: 0.2em;
    white-space: nowrap;
    animation: pulse 2.5s infinite ease-in-out;
    pointer-events: none;
}

@keyframes pulse {

    0%,
    100% {
        opacity: 0.7;
    }

    50% {
        opacity: 1;
        text-shadow: 0 0 10px rgba(255, 255, 255, 0.8);
    }
}

.full-screen-trigger {
    width: 100%;
    height: 100%;
    cursor: pointer;
}

/* --- 会話ウィンドウ --- */
.dialogue-box {
    position: absolute;
    bottom: calc(20px + env(safe-area-inset-bottom));
    left: 50%;
    transform: translateX(-50%);
    width: 92%;
    max-width: 750px;
    box-sizing: border-box;
    background: rgba(0, 0, 0, 0.75);
    border-radius: 7px;
    padding: 14px 14px 20px 14px;
    color: #fff;
    z-index: 50;
    display: flex;
    flex-direction: column;
    /* 位置変更時にヌルっと動くようにアニメーション設定 */
    transition: bottom 0.3s ease;
}

.dialogue-box.shift-up {
    bottom: calc(90px + env(safe-area-inset-bottom));
    /* ボタンの分だけ上に上げる */
}

.lower-btn-area {
    position: absolute;
    bottom: calc(20px + env(safe-area-inset-bottom));
    /* 画面下部 */
    left: 50%;
    transform: translateX(-50%);
    z-index: 60;
    width: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    pointer-events: none;
    /* エリア自体はクリック透過 */
}

.btn-lower-secondary {
    pointer-events: auto;
    background: rgba(0, 0, 0, 0.4);
    /* 背景を少し暗くして文字を見やすく */
    border: 1px solid #fff;
    color: #fff;
    padding: 12px 35px;
    border-radius: 50px;
    font-size: 0.95rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 10px;
    font-family: var(--font-main);
    transition: background 0.2s, transform 0.1s;
}

.btn-lower-secondary:hover {
    background: rgba(255, 255, 255, 0.15);
}

.btn-lower-secondary:active {
    transform: scale(0.96);
}

.dialogue-box.hidden {
    display: none;
}

.name-container {
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
    margin-bottom: 10px;
}

/* ★追加: 名前画像自体のスタイル */
.name-img {
    width: 212px;
    height: auto;

    /* 任意：画像に少し影をつけて浮き出させる場合 */
    filter: drop-shadow(0 2px 3px rgba(0, 0, 0, 0.5));
}

.dialogue-text {
    font-size: 0.95rem;
    line-height: 1.8;
    min-height: 3.6em;
    white-space: pre-wrap;
    font-family: var(--font-main);
    max-height: 130px;
    overflow-y: scroll;
}

/* ★変更点: 指定された色と太字を適用 */
.user-wish-highlight {
    color: var(--accent-pink);
    /* #F23454 */
    font-weight: 700;
}

/* --- アクションボタン（中央浮遊） --- */
.center-btn-area {
    position: absolute;
    top: 52%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 60;
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 15px;
    justify-content: center;
    align-items: center;
    pointer-events: none;
}

.center-btn-note {
    font-size: 0.85rem;
    color: rgba(255, 255, 255, 0.9);
    text-shadow: 0 1px 4px rgba(0, 0, 0, 0.99);
    font-family: var(--font-main);
    font-weight: 500;
    white-space: nowrap;
}

.btn-center-primary {
    pointer-events: auto;
    background: #fff;
    color: var(--primary-red);
    border: none;
    padding: 15px 40px;
    border-radius: 50px;
    font-size: 1rem;
    font-weight: bold;
    cursor: pointer;
    box-shadow: 0 0 20px rgba(192, 43, 69, 0.5);
    display: flex;
    align-items: center;
    gap: 12px;
    font-family: var(--font-main);
    transition: transform 0.1s, box-shadow 0.2s;
}

.btn-center-primary img {
    width: 30px;
}

.btn-center-primary:active {
    transform: scale(0.96);
    box-shadow: 0 0 10px rgba(192, 43, 69, 0.6);
}

/* --- 台詞ウィンドウ内リンクエリア --- */
.dialogue-link-area {
    display: flex;
    justify-content: flex-end;
    align-items: center;
}

.btn-dialogue-link {
    background: none;
    border: none;
    color: #fff;
    font-size: 0.95rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    font-family: var(--font-main);
    opacity: 0.8;
    transition: opacity 0.2s;
}

.btn-dialogue-link:hover {
    opacity: 1;
}

.icon-arrow-text {
    font-size: 0.8rem;
}

/* --- モーダル --- */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    z-index: 200;
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s;
}

.modal-overlay:not(.hidden) {
    opacity: 1;
    pointer-events: auto;
}

/* ぼかし出現アニメーションの定義 */
@keyframes modalBlurIn {
    0% {
        opacity: 0;
        filter: blur(20px);
        /* 強いぼかし */
        transform: scale(0.9);
        /* 少し小さく */
    }

    100% {
        opacity: 1;
        filter: blur(0);
        /* くっきり */
        transform: scale(1);
        /* 元のサイズ */
    }
}

.modal-content {
    background-image: url("image/bg_modal.svg");
    background-size: auto;
    background-repeat: no-repeat;
    width: 320px;
    height: 465px;
    padding: 26px;
    display: flex;
    align-items: center;
    flex-direction: column;
    opacity: 0;
}

.modal-content img {
    width: 40px;
}

/* モーダルが表示されている時だけアニメーションを実行 */
.modal-overlay:not(.hidden) .modal-content {
    animation: modalBlurIn 0.5s cubic-bezier(0.25, 1, 0.5, 1) forwards;
}

.modal-title {
    color: var(--primary-red);
    font-family: var(--font-serif);
    margin-bottom: 25px;
    font-size: 1.3rem;
    font-weight: normal;
    text-align: center;
}

.wish-textarea {
    width: 100%;
    height: 80px;
    border: 1px solid #ccc;
    border-radius: 4px;
    padding: 12px;
    font-size: 0.8rem;
    resize: none;
    font-family: var(--font-main);
    margin-bottom: 5px;
}

.wish-textarea:focus {
    outline: 1px solid var(--primary-red);
    background: #fff;
}


.char-count {
    text-align: right;
    width: 100%;
    font-size: 0.75rem;
    color: #999;
    margin-bottom: 25px;
}

.btn-modal-confirm {
    background-color: var(--primary-red);
    color: #fff;
    width: 100%;
    border: none;
    padding: 14px;
    border-radius: 50px;
    font-size: 1rem;
    font-weight: bold;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
    margin-bottom: 25px;
}

.arrow-icon {
    font-size: 0.7rem;
    border: 1px solid #fff;
    border-radius: 50%;
    width: 16px;
    height: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding-left: 2px;
}

.btn-text-red {
    background: none;
    border: none;
    color: var(--primary-red);
    font-size: 0.9rem;
    font-weight: bold;
    cursor: pointer;
}

/* --- サイドメニュー --- */
.side-menu {
    position: fixed;
    top: 0;
    right: -280px;
    width: 280px;
    height: 100%;
    background: #fff;
    z-index: 300;
    transition: right 0.3s cubic-bezier(0.25, 1, 0.5, 1);
    padding-top: 100px;
    box-shadow: -5px 0 15px rgba(0, 0, 0, 0.1);
}

.side-menu.open {
    right: 0;
}

.menu-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    z-index: 299;
    display: none;
}

.menu-overlay.open {
    display: block;
}

.menu-nav a {
    display: flex;
    justify-content: end;
    padding: 20px 30px;
    color: var(--primary-red);
    text-decoration: none;
    font-weight: bold;
    font-size: 0.95rem;
    transition: background 0.2s;
    text-align: right;
}

.menu-nav a:hover {
    background: #fff5f5;
}

.menu-nav a .icon {
    margin-right: 10px;
}

/* シェアオプションエリア */
.share-options-area {
    display: flex;
    justify-content: end;
    gap: 30px;
    align-items: flex-start;
    padding: 15px 20px 30px 20px;
    margin-bottom: 10px;
    animation: slideDown 0.3s ease;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* 丸いシェアボタン */
.share-circle-btn {
    background: none;
    border: none;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    width: 70px;
}

/* ボタン内の画像 */
.share-circle-btn img {
    width: 50px;
    height: 50px;
    object-fit: contain;
    transition: transform 0.1s;
}

.share-circle-btn:active img {
    transform: scale(0.95);
}

.btn-label {
    font-size: 0.7rem;
    color: var(--primary-red);
    font-weight: bold;
    font-family: var(--font-main);
    white-space: nowrap;
}

/* --- Aboutページ --- */
.page-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(20, 20, 20, 0.75);
    z-index: 400;
    /* padding: 60px 20px;
    overflow-y: auto; */
    overflow: hidden;
    color: #fff;
    display: none;
    backdrop-filter: blur(5px);
}

.page-overlay.active {
    display: block;
}

.close-about-btn {
    position: fixed;
    z-index: 500;
    top: 25px;
    right: 25px;
    background: #fff;
    color: var(--primary-red);
    border: none;
    border-radius: 50%;
    width: 45px;
    height: 45px;
    font-size: 2rem;
    line-height: 1.5;
    cursor: pointer;
    box-shadow: 0 0 15px rgba(192, 43, 69, 0.6);
}

.overlay-scroll-wrap {
    width: 100%;
    height: 100%;
    overflow-y: auto;
    padding: 80px 20px 60px;
    -webkit-overflow-scrolling: touch;
}

.about-content {
    max-width: 600px;
    margin: 0 auto;
    line-height: 1.8;
    font-size: 0.88rem;
    font-weight: 300;
}

.about-content {
    max-width: 600px;
    margin: 20px auto;
    line-height: 1.8;
    font-size: 0.88rem;
    font-weight: 300;
}

.about-content h2 {
    font-family: var(--font-main);
    margin-bottom: 16px;
    font-size: 1.15rem;
}

.about-content ul {
    margin-left: 20px;
    list-style: disc;
}

.about-content hr {
    border: 0;
    border-top: 1px solid rgba(255, 255, 255, 0.3);
    margin: 40px 0 20px;
}

.caution {
    font-size: 0.8rem;
}

.credit {
    color: #fff;
    font-size: 0.9rem;
    margin-bottom: 15px;
}

.social-links {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.social-links a {
    color: #fff;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.social-links a:hover {
    text-decoration: underline;
    opacity: .5;
}