body {
    margin: 0;
    padding: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    background: #131722;
    color: #d1d4dc;
    height: 100vh;
    width: 100vw;
    overflow: hidden;
    display: flex;
    /* サイドバーとメインコンテンツを横並びに */
}

/* --- レイアウト構造 --- */
#sidebar {
    width: 320px;
    min-width: 320px;
    background: #1e222d;
    border-right: 1px solid #2B2B43;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    z-index: 10;
}

#main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    position: relative;
    min-width: 0;
}

/* --- サイドバー（制御部） --- */
.sidebar-header {
    padding: 15px;
    border-bottom: 1px solid #2B2B43;
    background: #1e222d;
    position: sticky;
    top: 0;
}

.app-title {
    font-size: 16px;
    font-weight: bold;
    color: #E0E0E0;
    margin-bottom: 10px;
    text-align: center;
}

.selector-group {
    display: flex;
    gap: 8px;
}

select {
    padding: 8px;
    background: #2a2e39;
    color: #fff;
    border: 1px solid #363a45;
    border-radius: 4px;
    font-size: 14px;
    flex: 1;
}

/* --- モデルカード --- */
.model-card {
    padding: 12px 15px;
    border-bottom: 1px solid #2B2B43;
    cursor: pointer;
}

.model-card.active {
    background: #2962FF;
    color: white;
}

.stats-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 4px;
    font-size: 11px;
    margin-top: 5px;
}

/* --- メインエリア --- */
#header-info {
    height: 60px;
    padding: 0 20px;
    background: #1e222d;
    border-bottom: 1px solid #2B2B43;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

#chart-area {
    flex: 1;
    position: relative;
    background: #131722;
}

#chart-div {
    width: 100%;
    height: 100%;
}

/* --- 会員登録オーバーレイ（ポップアップ風） --- */
#payment-gate {
    position: absolute;
    top: 0;
    right: 0;
    width: 100%;
    /* デスクトップでは右半分 */
    height: 100%;
    z-index: 100;
    display: flex;
    justify-content: center;
    align-items: center;
    /* 右半分にかけて暗くなるグラデーション効果 */
    /* background: linear-gradient(to right, rgba(19, 23, 34, 0) 0%, rgba(19, 23, 34, 0.8) 25%, rgba(19, 23, 34, 0.95) 100%); */
    backdrop-filter: blur(5px);
    /* ぼかし効果 */
}

.gate-card {
    background: rgba(30, 34, 45, 0.95);
    padding: 30px;
    border-radius: 12px;
    text-align: center;
    border: 1px solid #2B2B43;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
    max-width: 320px;
}

.gate-logo {
    font-weight: bold;
    color: #2962FF;
    margin-bottom: 10px;
    font-size: 1.2em;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.gate-card h2 {
    margin: 0 0 10px 0;
    font-size: 1.4em;
}

.gate-card p {
    color: #d1d4dc;
    font-size: 0.9em;
    margin-bottom: 20px;
    line-height: 1.4;
}

.pricing-plan {
    background: rgba(41, 98, 255, 0.1);
    border: 1px solid #2962FF;
    border-radius: 8px;
    padding: 15px;
    margin: 20px 0;
}

.plan-name {
    font-size: 0.9em;
    color: #2962FF;
    font-weight: bold;
    margin-bottom: 5px;
}

.plan-price {
    font-size: 1.6em;
    font-weight: bold;
    color: white;
}

.plan-price span {
    font-size: 0.5em;
    color: #aaa;
    font-weight: normal;
}

#gate-action-btn {
    background: #2962FF;
    color: white;
    border: none;
    padding: 14px 24px;
    border-radius: 6px;
    font-size: 1em;
    font-weight: bold;
    cursor: pointer;
    width: 100%;
    transition: background 0.3s;
}

#gate-action-btn:hover {
    background: #1E4BD8;
}

/* スマホ向け：画面全体を半透明にする */
@media (max-width: 768px) {
    #payment-gate {
        width: 100%;
        background: rgba(19, 23, 34, 0.85);
        /* 全体を均等に半透明化 */
        backdrop-filter: blur(4px);
    }
}

.gate-content {
    background: #1e222d;
    padding: 40px;
    border-radius: 12px;
    border: 1px solid #2962FF;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    max-width: 400px;
}

#checkout-button {
    background: #2962FF;
    color: white;
    border: none;
    padding: 15px 30px;
    border-radius: 6px;
    font-size: 18px;
    font-weight: bold;
    cursor: pointer;
    margin-top: 20px;
    transition: background 0.3s;
}

#checkout-button:hover {
    background: #1E4BD8;
}

/* --- ツールチップ --- */
.floating-tooltip {
    width: 280px;
    position: absolute;
    display: none;
    padding: 12px;
    background: rgba(30, 34, 45, 0.9);
    border: 1px solid #2B2B43;
    border-radius: 8px;
    z-index: 100;
    pointer-events: none;
}

.profit-plus {
    color: #00E676;
}

.profit-minus {
    color: #FF5252;
}



/* --- 会員ナビゲーション (画面右上の配置) --- */
.user-nav {
    position: absolute;
    top: 10px;
    right: 20px;
    z-index: 1000;
    /* チャートより前面に表示 */
    display: flex;
    align-items: center;
}

/* サインインボタン & マイメニューボタン共通スタイル */
#auth-button,
#user-menu-btn {
    background: #2a2e39;
    color: #d1d4dc;
    border: 1px solid #363a45;
    padding: 6px 15px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 13px;
    transition: background 0.2s;
}

#auth-button:hover,
#user-menu-btn:hover {
    background: #363a45;
    border-color: #4b505d;
}

/* ドロップダウンの親要素 */
.dropdown {
    position: relative;
    display: inline-block;
}

/* ドロップダウン中身（隠れているメニュー） */
.dropdown-content {
    display: none;
    position: absolute;
    right: 0;
    /* 右端に合わせる */
    top: 100%;
    background-color: #1e222d;
    min-width: 180px;
    box-shadow: 0px 8px 16px 0px rgba(0, 0, 0, 0.5);
    border: 1px solid #363a45;
    border-radius: 4px;
    z-index: 1001;
    /* margin-top: 5px; */
    overflow: hidden;
}

/* ドロップダウン内のボタン */
.dropdown-content button {
    color: #d1d4dc;
    padding: 12px 16px;
    text-decoration: none;
    display: block;
    width: 100%;
    border: none;
    background: none;
    text-align: left;
    font-size: 13px;
    cursor: pointer;
    border-bottom: 1px solid #2B2B43;
}

.dropdown-content button:last-child {
    border-bottom: none;
}

.dropdown-content button:hover {
    background-color: #2a2e39;
    color: #fff;
}

/* ホバーでメニューを表示（JS制御が面倒な場合の簡易版。JSで制御する場合はここは不要） */
.dropdown:hover .dropdown-content {
    display: block;
}

/* ヘッダー情報のマージン調整（右上のメニューと重ならないように） */
#header-info {
    padding-right: 150px;
    /* 右側に余白を確保 */
}

/* ローディングアニメーション */
.loader-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
    /* リングと文字の隙間 */
}

.ring-loader {
    width: 45px;
    height: 45px;
    /* ベースの円（目立たない薄いブルー） */
    border: 4px solid rgba(41, 98, 255, 0.15);
    border-radius: 50%;
    position: relative;
}

.ring-loader::after {
    content: '';
    position: absolute;
    top: -4px;
    left: -4px;
    width: 100%;
    height: 100%;
    border: 4px solid transparent;
    /* 回転する部分（メインのアクセントブルー） */
    border-top-color: #2962FF;
    border-radius: 50%;
    animation: ring-rotate 1s cubic-bezier(0.5, 0, 0.5, 1) infinite;
    /* 少し緩急をつけるとプロっぽくなります */
}

@keyframes ring-rotate {
    to {
        transform: rotate(360deg);
    }
}

.loading-text {
    color: #d1d4dc;
    font-size: 14px;
    font-weight: bold;
    letter-spacing: 1px;
}


#auth-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(4px);
    z-index: 200;
    justify-content: center;
    align-items: center;
}

.auth-card {
    background: #1E222D;
    padding: 30px;
    border-radius: 12px;
    border: 1px solid #2B2B43;
    width: 320px;
    text-align: center;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
}

.auth-card h3 {
    color: white;
    margin-top: 0;
    margin-bottom: 20px;
}

.auth-input {
    width: 100%;
    padding: 12px;
    margin-bottom: 12px;
    background: #131722;
    color: white;
    border: 1px solid #2B2B43;
    border-radius: 6px;
    box-sizing: border-box;
    font-size: 14px;
}

.auth-input:focus {
    outline: none;
    border-color: #2962FF;
}

.btn-primary {
    width: 100%;
    padding: 12px;
    background: #2962FF;
    color: white;
    border: none;
    border-radius: 6px;
    margin-bottom: 10px;
    cursor: pointer;
    font-weight: bold;
    transition: 0.3s;
}

.btn-primary:hover {
    background: #1E4BD8;
}

.btn-outline {
    width: 100%;
    padding: 12px;
    background: transparent;
    color: #2962FF;
    border: 1px solid #2962FF;
    border-radius: 6px;
    margin-bottom: 20px;
    cursor: pointer;
    font-weight: bold;
    transition: 0.3s;
}

.btn-outline:hover {
    background: rgba(41, 98, 255, 0.1);
}

.btn-google {
    width: 100%;
    padding: 12px;
    background: white;
    color: #333;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-weight: bold;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.btn-google:hover {
    background: #f1f1f1;
}

.auth-divider {
    border-color: #2B2B43;
    margin-bottom: 20px;
    border-bottom: none;
}

.close-modal {
    color: #888;
    text-decoration: none;
    font-size: 0.9em;
    cursor: pointer;
    margin-top: 15px;
    display: inline-block;
}

.close-modal:hover {
    color: white;
}

/* ★ 追加: ドロップダウン内の無効化されたボタンのスタイル */
.dropdown-content button:disabled {
    color: #555;
    cursor: not-allowed;
    background-color: transparent;
    opacity: 0.5;
}

.dropdown-content button:disabled:hover {
    background-color: transparent;
    /* ホバー時の背景色変化をなくす */
}