/* ==========================================================================
   General Settings & Reset
   ========================================================================== */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

/* 全体のスクロールを極力なくし、1画面にすっぽり収めるための微調整 */
body {
    font-family: 'Inter', 'Segoe UI', 'Helvetica Neue', Arial, 'Hiragino Kaku Gothic ProN', 'Hiragino Sans', Meiryo, sans-serif;
    background-color: #0b0c10;
    color: #ffffff;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    margin: 0;
    padding: 0;
    overflow-x: hidden;
}

/* ==========================================================================
   Header & Footer
   ========================================================================== */
header,
footer {
    text-align: center;
    padding: 3rem 1rem;
    background-color: transparent;
}

header {
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

footer {
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    margin-top: 3rem;
    font-size: 0.9rem;
    color: #888888;
}

header h1 {
    font-size: 3rem;
    font-weight: 800;
    letter-spacing: -0.02em;
    margin-bottom: 0.5rem;
    background: linear-gradient(to right, #ffffff, #a0a0a0);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    text-shadow: 0 0 20px rgba(0, 255, 255, 0.3), 0 0 40px rgba(188, 19, 254, 0.2);
}

/* ==========================================================================
   Ad Containers (Placeholders)
   ========================================================================== */
#top-ad-container, #bottom-ad-container {
    max-width: 960px;
    margin: 2rem auto;
    padding: 1.5rem;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    text-align: center;
    color: #888888;
}

/* ==========================================================================
   Product Container (Responsive Grid)
   ========================================================================== */
#product-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2.5rem;
    max-width: 1200px;
    margin: 3rem auto;
    padding: 0 1rem;
}

/* ==========================================================================
   Product Card UI
   ========================================================================== */
.product-card {
    background: rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-radius: 16px;
    padding: 2rem;
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    cursor: pointer;
    display: flex;
    flex-direction: column;
    height: 100%;
}

.product-card:hover {
    transform: translateY(-10px) scale(1.02);
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(0, 255, 255, 0.5);
    box-shadow: 0 0 20px rgba(0, 255, 255, 0.4), 0 0 40px rgba(188, 19, 254, 0.2);
}

/* Card internal content helpers (for future dynamic elements) */
.product-card h3 {
    margin-bottom: 0.75rem;
    font-size: 1.5rem;
    color: #ffffff;
}

.product-card p {
    font-size: 1rem;
    color: #cccccc;
    margin-bottom: 2rem;
    flex-grow: 1;
}

.product-card .btn {
    display: inline-block;
    text-align: center;
    background: linear-gradient(45deg, #00d2ff 0%, #9d50bb 100%);
    color: #ffffff;
    text-decoration: none;
    padding: 0.8rem 1.5rem;
    border-radius: 8px;
    font-weight: bold;
    text-transform: uppercase;
    letter-spacing: 1px;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(0, 210, 255, 0.3);
}

.product-card .btn:hover {
    transform: scale(1.05);
    box-shadow: 0 0 20px rgba(0, 210, 255, 0.6), 0 0 10px rgba(157, 80, 187, 0.6);
    filter: brightness(1.2);
}

/* ==========================================================================
   Badge Style Tune-up
   ========================================================================== */
.product-card .badge {
    display: inline-block;
    width: fit-content;      /* 横幅をコンテンツに合わせる */
    color: #ffffff;          /* 文字色を白にする */
    padding: 0.25rem 0.75rem; /* 内側の余白 */
    border-radius: 4px;      /* 角丸 */
    font-size: 0.8rem;       /* 文字サイズ */
    font-weight: bold;
    margin-bottom: 0.75rem;  /* 下部との余白 */
}

.badge-container {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
}

/* 未実装アイテム用のスタイル */
.product-card--disabled {
    opacity: 0.7;
    filter: grayscale(0.5);
    cursor: default !important;
}

.product-card--disabled:hover {
    transform: none !important;
    background: rgba(255, 255, 255, 0.05) !important;
    border-color: rgba(255, 255, 255, 0.1) !important;
    box-shadow: none !important;
}

.unimplemented-badge {
    background-color: #666666 !important;
    margin-left: 0.5rem;
}

.btn-disabled {
    background: #444444 !important;
    color: #aaaaaa !important;
    cursor: not-allowed !important;
    box-shadow: none !important;
    pointer-events: none;
}

/* ==========================================================================
   Game Player Styles
   ========================================================================== */
main {
    display: block;
    padding: 2rem 1rem;
}

/* ==========================================================================
   Game Viewport Maximize (画面占有率を限界まで上げる)
   ========================================================================== */
iframe#game-viewport {
    display: block;
    margin: 0.25rem auto;
    
    /* 画面の高さ（100vh）から、上下の最低限の広告・ボタン分の高さ（約180px）だけを引いた「残りの高さすべて」をゲームに適用 */
    height: calc(100vh - 140px);
    
    /* 縦画面ゲームの比率（およそ9:16）を保ったまま、高さに合わせて横幅を自動で限界まで巨大化 */
    aspect-ratio: 9 / 14;
    width: auto;
    max-width: 100%;
    
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
}

.btn-back {
    display: block;
    width: fit-content;
    margin: 0.5rem auto 0.25rem auto;
    padding: 0.6rem 1.2rem;
    background-color: #ffffff;
    color: #333333;
    text-decoration: none;
    border: 1px solid #dddddd;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 500;
    transition: all 0.2s ease;
    cursor: pointer;
}

.btn-back:hover {
    background-color: #f8f9fa;
    border-color: #cccccc;
    transform: translateX(-3px);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

/* ==========================================================================
   Site-Wide Responsive Style (PC・スマホ完全分離出し分け・決定版)
   ========================================================================== */

/* 広告コンテナの基本防護（縦伸び・変形を絶対に許さない） */
.ad-container {
    overflow: hidden !important;
    flex-shrink: 0 !important;
    display: flex !important;
    justify-content: center !important;
    align-items: center !important;
    background-color: transparent !important;
    width: 100% !important;
}

/* --- ① 全画面共通：デバイス別表示・非表示の絶対ルール --- */
@media (max-width: 767px) {
    .pc-only { display: none !important; }
    .mobile-only { display: flex !important; }
}
@media (min-width: 768px) {
    .pc-only { display: flex !important; }
    .mobile-only { display: none !important; }
}
.ad-container img, .ad-container iframe, .ad-container ins {
    object-fit: contain !important;
    max-width: 100% !important;
}
.ad-container * {
    max-width: 100% !important;
    box-sizing: border-box !important;
}

/* --- ② 【ゲームプレイ画面専用】のレスポンシブ制御 --- */
/* --- ① htmlタグの基本リセット（ロックを解除） --- */
html {
    margin: 0;
    padding: 0;
    width: 100%;
}

/* --- ② 【ゲームプレイ画面専用】のレスポンシブ制御（スクロール救済版） --- */
body.player-page {
    margin: 0 !important;
    padding: 0 !important;
    width: 100% !important;
    min-height: 100% !important; /* 固定ではなく最小高さを100%にしてはみ出しに対応 */
    background-color: #120c1f !important;
    overflow-x: hidden !important;
    overflow-y: auto !important; /* はみ出した時だけ安全に縦スクロール可能にする */
}
body.player-page {
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
}
body.player-page main {
    width: 100% !important;
    box-sizing: border-box !important;
    display: block !important;
}
.player-page iframe#game-viewport {
    width: 100% !important;
    height: 100% !important;
    display: block !important;
    border: none !important;
}
.player-page .btn-back {
    width: 100% !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    background-color: #ffffff !important;
    color: #333 !important;
    font-weight: bold !important;
    text-decoration: none !important;
    flex-shrink: 0 !important;
    box-sizing: border-box !important;
}
.player-page footer { display: none !important; }

/* 📱 ゲーム画面：スマホ時（768px未満） */
@media (max-width: 767px) {
    body.player-page { height: 100dvh !important; }
    body.player-page .ad-container.mobile-only,
    body.player-page main,
    body.player-page .btn-back {
        max-width: 430px !important;
        margin-left: auto !important;
        margin-right: auto !important;
    }
    .ad-container.mobile-only {
        height: auto !important;
        min-height: 50px !important;
        max-height: 100px !important;
    }
    body.player-page main { flex: 1 !important; height: 100% !important; min-height: 0 !important; }
    .player-page .btn-back { height: 60px !important; border-radius: 0 0 8px 8px !important; }
}

/* 💻 ゲーム画面：PC時（768px以上） */
@media (min-width: 768px) {
    body.player-page { padding: 20px !important; justify-content: center !important; }
    body.player-page .ad-container.pc-only,
    body.player-page main,
    body.player-page .btn-back {
        max-width: 900px !important;
        margin-left: auto !important;
        margin-right: auto !important;
    }
    .ad-container.pc-only { height: 90px !important; margin-bottom: 15px !important; }
    body.player-page main { height: 600px !important; flex: none !important; }
    .player-page .btn-back {
        height: 50px !important;
        margin-top: 15px !important;
        border-radius: 8px !important;
    }
}

/* --- ③ 【ホーム画面専用】のレスポンシブ微調整 --- */
/* ホーム画面の既存デザイン（カードの並び等）を壊さず、追加した広告枠の高さだけをPC/スマホで固定します */
@media (max-width: 767px) {
    .ad-container.mobile-only { height: 60px !important; margin: 10px auto !important; }
}
@media (min-width: 768px) {
    .ad-container.pc-only { height: 90px !important; margin: 20px auto !important; }
}
