/* Base Reset & Variables */
:root {
    --bg-color: #0d1117;
    --card-bg: rgba(22, 27, 34, 0.7);
    --text-main: #f0f6fc;
    --text-muted: #8b949e;
    --accent-color: #58a6ff;
    --accent-glow: rgba(88, 166, 255, 0.4);
    --gold: #d4af37;
    --glass-border: rgba(255, 255, 255, 0.1);
    --glass-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
}

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

body {
    font-family: 'Inter', 'Helvetica Neue', Arial, sans-serif;
    background-color: var(--bg-color);
    color: var(--text-main);
    line-height: 1.6;
    overflow-x: hidden;
    /* Fancy animated background */
    background: radial-gradient(circle at 15% 50%, rgba(20, 30, 60, 1), #0d1117 40%),
        radial-gradient(circle at 85% 30%, rgba(25, 40, 60, 1), #0d1117 50%);
    background-size: cover;
    background-attachment: fixed;
    min-height: 100vh;
}

/* Typography */
h1,
h2,
h3 {
    font-weight: 600;
}

/* TODAY'S INSPIREと名言枠の間を少し開ける */
.app-title {
    font-size: 1.2rem;
    color: var(--text-muted);
    letter-spacing: 2px;
    text-transform: uppercase;
    margin-bottom: 15px;
    /* ←これを追加 */
}

/* Layout */
.app-container {
    max-width: 600px;
    width: 100%;
    /* ← 横幅いっぱいまで広げる指定を追加 */
    margin: 0 auto;
    min-height: 100vh;
    padding: 20px 20px;
    /* ← スマホ画面の左右の隙間をピッタリ20pxに指定 */
    display: flex;
    flex-direction: column;
    box-sizing: border-box;
    /* ← 隙間の計算ズレを防ぐ指定を追加 */
}

/* Daily View */
.daily-view {
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    height: 100%;
    flex: 1;
    transition: opacity 0.3s ease;
}

.daily-view.hidden {
    opacity: 0;
    pointer-events: none;
    position: absolute;
}

.app-header {
    text-align: center;
    margin-bottom: 0.5rem;
    margin-top: 1rem;
    animation: fadeInDown 0.8s ease-out;
}

/* 日付バッジ（名言カードと同じ横幅に広げる） */
.date-badge {
    display: block;
    /* ←ここを変更 */
    width: 100%;
    /* ←横幅いっぱいにする指定を追加 */
    box-sizing: border-box;
    /* ←はみ出し防止 */
    text-align: center;
    /* ←文字を真ん中に */
    background: linear-gradient(135deg, var(--accent-color), #3b82f6);
    color: white;
    padding: 12px 10px;
    /* ←上下のバランスを調整 */
    border-radius: 20px;
    /* ※名言カードと同じ丸み */
    font-weight: bold;
    font-size: 1.3rem;
    margin-bottom: 5px;
    box-shadow: 0 4px 15px var(--accent-glow);
}

/* 六曜のデザインと、下の余白を 10px に指定 */
.rokuyo-badge {
    display: block;
    font-size: 1.2rem;
    color: var(--gold);
    font-weight: bold;
    letter-spacing: 4px;
    margin-bottom: 25px !important;
    /* ← ここを広げました */
}

/* Quote Card (Glassmorphism) */
.quote-card {
    background: var(--card-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
    border-radius: 20px;
    padding: 1.5rem 1rem;
    box-shadow: var(--glass-shadow);
    margin-bottom: 0.5rem;
    animation: fadeInUp 1s ease-out;
    position: relative;
    overflow: hidden;
}

/* Subtle glow behind card */
.quote-card::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(255, 255, 255, 0.03) 0%, transparent 60%);
    transform: rotate(30deg);
    pointer-events: none;
}

.quote-content {
    position: relative;
    margin-bottom: 2rem;
}

.quote-mark {
    font-family: 'Noto Serif JP', serif;
    font-size: 4rem;
    color: var(--accent-color);
    opacity: 0.3;
    position: absolute;
    line-height: 1;
}

.quote-mark.open {
    top: -1.5rem;
    left: -1rem;
}

.quote-mark.close {
    bottom: -2.5rem;
    right: -1rem;
}

/* 偉人の言葉を大きく */
.quote-text {
    font-family: 'Noto Serif JP', serif;
    font-size: 1.6rem;
    /* ←1.3remから大きくしました */
    line-height: 1.7;
    color: #fff;
    text-align: center;
    font-weight: 700;
    letter-spacing: 0.05em;
    z-index: 1;
    position: relative;
}

/* 偉人名と役職を中央配置に */
.quote-author {
    text-align: center;
    /* ←rightからcenterに変更 */
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    padding-top: 1rem;
}

/* 偉人名を16pxに指定 */
.author-name {
    font-size: 16px;
    /* ←指定通り16pxに */
    font-weight: 600;
    color: var(--accent-color);
    margin-bottom: 5px;
    /* ←役職との間隔調整に追加 */
}

/* 偉人の役職を少し大きく */
.author-title {
    font-size: 1.1rem;
    /* ←0.9remから大きくしました */
    color: var(--text-muted);
}

/* アクションエリア全体の余白調整（間延び解消） */
.action-area {
    margin-top: 40px;
    /* ←100pxから40pxに減らしました */
    margin-bottom: 100px;
    /* ←画面下部との距離を約100px確保 */
    text-align: center;
    animation: fadeIn 1.5s ease;
}

/* ヒントのテキストを大きく */
.gacha-hint {
    font-size: 1.1rem;
    /* ←0.9remから大きくしました */
    color: var(--text-muted);
    margin-bottom: 0.8rem;
    font-weight: bold;
    /* ←見やすくするため太字追加 */
}

.gacha-button {
    background: linear-gradient(135deg, #FF6B6B, #FF8E53);
    color: white;
    border: none;
    border-radius: 30px;
    padding: 1rem 2rem;
    font-size: 1.1rem;
    font-weight: bold;
    cursor: pointer;
    width: 100%;
    margin-bottom: 1rem;
    box-shadow: 0 4px 15px rgba(255, 107, 107, 0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    transition: transform 0.2s, box-shadow 0.2s;
}

.gacha-button:hover {
    transform: translateY(-2px) scale(1.02);
    box-shadow: 0 6px 20px rgba(255, 107, 107, 0.6);
}

.text-button {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 0.9rem;
    cursor: pointer;
    text-decoration: underline;
    transition: color 0.2s;
}

.text-button:hover {
    color: white;
}

/* Gacha View */
.gacha-view {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(13, 17, 23, 0.95);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s;
}

.gacha-view.active {
    opacity: 1;
    pointer-events: auto;
}

.gacha-container {
    width: 90%;
    max-width: 400px;
    background: var(--card-bg);
    border: 1px solid var(--glass-border);
    border-radius: 20px;
    padding: 2.5rem 2rem;
    text-align: center;
    position: relative;
    transform: translateY(20px);
    transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.gacha-view.active .gacha-container {
    transform: translateY(0);
}

.gacha-header h2 {
    color: var(--gold);
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
}

.gacha-header p {
    color: var(--text-muted);
    margin-bottom: 2rem;
}

.gacha-machine {
    height: 150px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 2rem;
}

.gacha-capsule {
    width: 100px;
    height: 100px;
    background: radial-gradient(circle at 30% 30%, #ffd700, #ff8c00);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 3rem;
    font-weight: bold;
    color: white;
    box-shadow: inset -10px -10px 20px rgba(0, 0, 0, 0.2), 0 10px 20px rgba(0, 0, 0, 0.3);
    transition: transform 0.3s;
}

/* Gacha Animation */
@keyframes shake {
    0% {
        transform: translate(1px, 1px) rotate(0deg);
    }

    10% {
        transform: translate(-1px, -2px) rotate(-5deg);
    }

    20% {
        transform: translate(-3px, 0px) rotate(5deg);
    }

    30% {
        transform: translate(3px, 2px) rotate(0deg);
    }

    40% {
        transform: translate(1px, -1px) rotate(5deg);
    }

    50% {
        transform: translate(-1px, 2px) rotate(-5deg);
    }

    60% {
        transform: translate(-3px, 1px) rotate(0deg);
    }

    70% {
        transform: translate(3px, 1px) rotate(-5deg);
    }

    80% {
        transform: translate(-1px, -1px) rotate(5deg);
    }

    90% {
        transform: translate(1px, 2px) rotate(0deg);
    }

    100% {
        transform: translate(1px, -2px) rotate(-5deg);
    }
}

@keyframes popOut {
    0% {
        transform: scale(0.1);
        opacity: 0;
    }

    50% {
        transform: scale(1.2);
        opacity: 1;
    }

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

.spinning {
    animation: shake 0.5s infinite;
}

.spin-button {
    background: var(--gold);
    color: #000;
    border: none;
    border-radius: 20px;
    padding: 1rem 2rem;
    font-size: 1.2rem;
    font-weight: bold;
    cursor: pointer;
    width: 100%;
    box-shadow: 0 4px 15px rgba(212, 175, 55, 0.4);
    transition: transform 0.2s;
}

.spin-button:hover {
    transform: scale(1.05);
}

.gacha-result {
    margin-top: 1.5rem;
    animation: popOut 0.6s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}

.result-rarity {
    color: #ffd700;
    font-size: 1.2rem;
    margin-bottom: 0.5rem;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
}

/* ガチャ後のメッセージを大きく */
.result-message {
    font-family: 'Noto Serif JP', serif;
    font-size: 1.4rem;
    /* ←1.2remから大きくしました */
    line-height: 1.5;
    background: rgba(255, 255, 255, 0.05);
    padding: 1rem;
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: #ffffff !important;
    min-height: 50px;
}

/* Modals */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(5px);
    z-index: 200;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s;
}

.modal-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

.modal-content {
    background: #1c2128;
    border: 1px solid var(--glass-border);
    border-radius: 20px;
    width: 90%;
    max-width: 450px;
    padding: 2.5rem 2rem;
    position: relative;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.5);
    transform: translateY(20px);
    transition: transform 0.3s;
}

.modal-overlay.active .modal-content {
    transform: translateY(0);
}

.close-btn {
    position: absolute;
    top: 15px;
    right: 20px;
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 2rem;
    cursor: pointer;
    line-height: 1;
}

.modal-header h2 {
    color: #fff;
    margin-bottom: 0.5rem;
    font-size: 1.4rem;
}

.modal-header p {
    color: var(--accent-color);
    font-size: 0.95rem;
    margin-bottom: 1.5rem;
}

.benefit-list {
    list-style: none;
    margin-bottom: 1.5rem;
    text-align: left;
    background: rgba(0, 0, 0, 0.2);
    padding: 1rem;
    border-radius: 10px;
}

.benefit-list li {
    margin-bottom: 0.8rem;
    font-size: 0.95rem;
}

.benefit-list li:last-child {
    margin-bottom: 0;
}

.form-input {
    width: 100%;
    padding: 12px 15px;
    border-radius: 8px;
    border: 1px solid var(--text-muted);
    background: #0d1117;
    color: #fff;
    font-size: 1rem;
    margin-bottom: 1rem;
    outline: none;
    transition: border-color 0.2s;
}

.form-input:focus {
    border-color: var(--accent-color);
}

.submit-button {
    width: 100%;
    padding: 12px;
    background: var(--accent-color);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 1.1rem;
    font-weight: bold;
    cursor: pointer;
    transition: background 0.2s;
}

.submit-button:hover {
    background: #478ce0;
}

.privacy-note {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 1rem;
    text-align: center;
}

.primary-button {
    width: 100%;
    padding: 12px;
    background: transparent;
    color: var(--accent-color);
    border: 1px solid var(--accent-color);
    border-radius: 8px;
    font-size: 1rem;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.2s;
}

.primary-button:hover {
    background: rgba(88, 166, 255, 0.1);
}

.mt-4 {
    margin-top: 1rem;
}

.hidden {
    display: none !important;
}

/* Utilities */
@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeInDown {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* 一番下につけた便利カウンターのデザイン */
.year-counter {
    margin-top: 30px;
    font-size: 0.95rem;
    color: var(--text-muted);
    background: rgba(255, 255, 255, 0.05);
    padding: 10px 20px;
    border-radius: 8px;
    display: inline-block;
    border: 1px dashed rgba(255, 255, 255, 0.2);
}

/* Googleカレンダー埋め込みエリア（上下50pxの余白） */
.google-calendar-wrapper {
    margin: 50px 0;
    /* 上下に50pxの余白 */
    width: 100%;
    background: #ffffff;
    /* カレンダーが見やすいように背景は白 */
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
    padding: 5px;
}

/* iframe自体の角を丸くする */
.google-calendar-wrapper iframe {
    border-radius: 8px;
    background-color: #ffffff;
}

/* カレンダー下の注意書きテキスト */
.calendar-notice {
    font-size: 0.75rem;
    color: #666;
    text-align: center;
    margin-top: 5px;
    padding-bottom: 5px;
}

/* アプリ化フローティングボタン */
.app-install-fab {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background: linear-gradient(135deg, #3b82f6, #2563eb);
    color: white;
    border: none;
    border-radius: 30px;
    padding: 12px 20px;
    font-size: 1rem;
    font-weight: bold;
    box-shadow: 0 4px 15px rgba(59, 130, 246, 0.4);
    cursor: pointer;
    z-index: 90;
    transition: transform 0.2s, box-shadow 0.2s;
}

.app-install-fab:hover {
    transform: translateY(-2px) scale(1.05);
}

/* すでにアプリ化されている時は非表示にする用 */
.app-install-fab.hidden {
    display: none !important;
}

/* 和暦西暦 早見ツール */
.era-converter-wrapper {
    margin: 40px auto;
    padding: 20px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px dashed rgba(255, 255, 255, 0.2);
    border-radius: 10px;
    max-width: 90%;
    text-align: center;
}

.era-converter-wrapper h3 {
    font-size: 1.1rem;
    color: var(--accent-color);
    margin-bottom: 15px;
}

.converter-inputs {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin-bottom: 10px;
}

.converter-inputs input {
    background: #0d1117;
    color: #fff;
    border: 1px solid var(--text-muted);
    border-radius: 5px;
    padding: 10px;
    font-size: 1.1rem;
    text-align: center;
    width: 100px;
}

.converter-inputs input[readonly] {
    background: rgba(255, 255, 255, 0.1);
    border-color: transparent;
    width: 130px;
    color: var(--gold);
    font-weight: bold;
}

.converter-hint {
    font-size: 0.85rem;
    color: var(--text-muted);
}

/* =========================================
   スマホ画面（幅480px以下）専用の調整
========================================= */
@media screen and (max-width: 480px) {

    /* 日付の文字サイズをスマホに合わせて微調整 */
    .date-badge {
        font-size: 18px !important;
        padding: 12px 5px !important;
        white-space: nowrap;
    }

    /* スマホ画面の両端の隙間を削って、要素を最大限広げる！ */
    .app-container {
        padding: 15px 10px !important;
        /* ←左右の隙間を10pxまで減らしました */
    }

    /* 名言カード内の隙間もスマホ向けに調整 */
    .quote-card {
        padding: 30px 15px !important;
    }

    /* ガチャボタンの文字サイズもスマホ向けに微調整 */
    .gacha-button {
        font-size: 16px !important;
        padding: 13px 16px !important;
    }

    /*　ガチャを回すボタンを1行に収める調整 */
    .spin-button {
        font-size: 18px !important;
        /* 文字サイズを少しだけ調整 */
        padding: 13px 8px !important;
        /* 左右のパディングを極限まで減らす */
        white-space: nowrap !important;
        /* 強制的に1行にする（改行禁止） */
    }

    .era-converter-wrapper {
        margin: 20px auto !important;
    }

}

/* =========================================
   大吉（シークレット）用の特別エフェクト
========================================= */
.daikichi-mode {
    font-size: 1.25rem !important;
    font-weight: bold;
    background: linear-gradient(135deg, #FFD700, #FFA500);
    /* 黄金のグラデーション */
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    text-shadow: 0px 0px 15px rgba(255, 215, 0, 0.6);
    /* 光る影 */
    animation: daikichi-pulse 1.5s infinite alternate;
    /* ドクンドクンと脈打つアニメーション */
    line-height: 1.6;
}

@keyframes daikichi-pulse {
    0% {
        transform: scale(1);
    }

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

/* 日付バッジとTODAY'S INSPIREの間の余白を広げる */
.app-header .app-title {
    margin-top: 2.0rem !important;
}