/* ============================================
   TowerFill — Layout & Structure
   ============================================ */

.screen {
    position: fixed;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity var(--transition-normal);
    z-index: 1;
}

.screen.active {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    z-index: 10;
}

#game-screen {
    justify-content: flex-start;
    padding-top: 90px;
}

.title-container {
    text-align: center;
    position: relative;
    pointer-events: auto;
    background: rgba(255, 255, 255, 0.9);
    padding: 15px 30px;
    border-radius: 20px;
    border: 1px solid var(--border);
    backdrop-filter: blur(15px);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 95%;
    max-width: 600px;
    transition: transform 0.3s;
}

.title-glow {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 500px;
    height: 500px;
    background: radial-gradient(circle, var(--green-glow) 0%, transparent 70%);
    animation: pulse-glow 3s ease-in-out infinite;
    pointer-events: none;
}

.ui-layer {
    position: relative;
    z-index: 2000;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    height: 100%;
    padding-top: 70px;
    padding-bottom: 20px;
    pointer-events: none;
}

.title-text {
    font-family: var(--font-title);
    display: flex;
    flex-direction: column;
    gap: 4px;
    position: relative;
    z-index: 1;
}

.title-towerfill {
    font-size: 3.5rem;
    font-weight: 900;
    letter-spacing: 0.3em;
    color: transparent;
    -webkit-text-stroke: 2px var(--green-neon);
    text-shadow: 0 0 30px var(--green-glow), 0 0 60px var(--green-glow);
    animation: flicker 4s infinite alternate;
}

.title-assembly {
    font-size: 1.5rem;
    color: var(--green-dark);
    font-weight: 900;
}

.title-subtitle {
    font-size: 0.8rem;
    color: var(--text-secondary);
    letter-spacing: 1px;
    margin-top: 5px;
}

/* --- Header & Nav --- */
.game-header {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 20px;
    background: var(--bg-secondary);
    border-bottom: 2px solid var(--border);
    flex-shrink: 0;
    backdrop-filter: blur(5px);
    position: relative;
    z-index: 1000;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 15px;
}

.unified-nav {
    position: fixed;
    top: 70px;
    left: 20px;
    right: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    z-index: 1000;
}

/* --- Game Space --- */
.game-layout {
    flex: 1;
    display: flex;
    gap: 20px;
    padding: 20px;
    overflow: auto;
    align-items: flex-start;
    justify-content: center;
}

#game-safe-area {
    width: 100%;
    height: calc(100vh - 90px);
    overflow: hidden;
    display: flex;
    justify-content: center;
    align-items: center;
}

#game-responsive-wrapper {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    transform-origin: top center;
}

.board-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    user-select: none;
}

.board-middle {
    display: flex;
    align-items: center;
}

.ad-banner {
    width: 100%;
    height: 90px;
    background: rgba(0, 0, 0, 0.8);
    color: #555;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    border-bottom: 1px solid #333;
    position: fixed;
    top: 0;
    left: 0;
    z-index: 1000;
}

@media (max-width: 900px) {
    .game-layout {
        flex-direction: column;
        align-items: center;
        padding: 10px;
        gap: 15px;
    }
}

/* --- Stage Select Screen --- */
.stage-container {
    width: 95%;
    max-width: 800px;
    margin: 0 auto;
    padding-bottom: 40px;
}

.stage-header {
    text-align: center;
    margin-bottom: 30px;
    padding: 20px;
    background: var(--bg-card);
    border-radius: 16px;
    border: 1px solid var(--border);
    backdrop-filter: blur(10px);
}

.stage-progress-text {
    font-family: var(--font-body);
    font-size: 0.95rem;
    font-weight: bold;
    color: var(--green-neon);
    margin-top: 8px;
    letter-spacing: 1px;
}

.stage-diff-label {
    font-family: var(--font-title);
    font-size: 1.2rem;
    color: var(--green-neon);
    margin-bottom: 5px;
}

.stage-title-text {
    font-size: 0.9rem;
    color: var(--text-secondary);
    letter-spacing: 2px;
}

.stage-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 15px;
    width: 100%;
}

/* --- Tips Banner Styles (PC) --- */
.ad-banner {
    background: repeating-linear-gradient(-45deg,
            #1e1e1e,
            #1e1e1e 10px,
            #252525 10px,
            #252525 20px) !important;
    border-bottom: 2px solid rgba(0, 188, 212, 0.3) !important;
    color: inherit !important;
}

.tips-wrapper {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    padding: 0 20px;
    box-sizing: border-box;
    transition: opacity 0.3s ease, transform 0.3s ease;
    opacity: 1;
}

.tips-wrapper.fade-out {
    opacity: 0;
    transform: translateX(-15px);
}

.tips-wrapper.fade-in {
    animation: tipSlideIn 0.3s forwards;
}

@keyframes tipSlideIn {
    from {
        opacity: 0;
        transform: translateX(15px);
    }

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

.tips-character {
    height: 80px;
    width: auto;
    object-fit: contain;
    margin-right: 20px;
    image-rendering: pixelated;
    /* ドット絵をくっきり表示 */
    /* 枠線や個別背景・影を一切つけずにバナー背景に自然に溶け込ませる */
    border: none !important;
    background: transparent !important;
    box-shadow: none !important;
}

.tips-balloon {
    background: #ffffff;
    border: 2px solid #00bcd4;
    border-radius: 16px;
    padding: 8px 16px;
    position: relative;
    max-width: 70%;
    display: flex;
    align-items: center;
    box-shadow: 0 4px 10px rgba(0, 188, 212, 0.1);
}

.tips-balloon::before {
    content: '';
    position: absolute;
    left: -10px;
    top: 50%;
    transform: translateY(-50%);
    border-width: 6px 10px 6px 0;
    border-style: solid;
    border-color: transparent #00bcd4 transparent transparent;
}

.tips-balloon::after {
    content: '';
    position: absolute;
    left: -8px;
    top: 50%;
    transform: translateY(-50%);
    border-width: 5px 8px 5px 0;
    border-style: solid;
    border-color: transparent #ffffff transparent transparent;
}

.tips-text {
    font-size: 0.85rem;
    font-weight: 900;
    color: #006064;
    line-height: 1.4;
}

/* ⑤ フッター (固定) */
.portal-footer {
    height: 50px;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    border-top: 1px solid rgba(0, 188, 212, 0.2);
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    z-index: 3000;
    background: rgba(224, 247, 250, 0.9);
}

.portal-footer-links {
    margin-bottom: 4px;
}

.portal-footer-links a {
    color: #006064;
    text-decoration: none;
    font-size: 0.75rem;
    font-weight: 500;
}

.portal-footer-links a:hover {
    color: #00838f;
}

.portal-footer-links .sep {
    color: #b0bec5;
    margin: 0 10px;
    font-size: 0.7rem;
}

.portal-footer-copy {
    font-size: 0.65rem;
    color: #546e7a;
}

/* 暗い画面（リザルト・ステージ選択等）用のフッター */
.clear-footer {
    width: 100%;
    margin-top: 40px;
    padding-bottom: 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: transparent;
    border-top: 1px solid rgba(0, 229, 255, 0.2);
    position: relative;
    z-index: 10;
}

.clear-footer-links {
    margin-bottom: 8px;
}

.clear-footer-links a {
    color: #b0bec5;
    text-decoration: none;
    font-size: 0.8rem;
    font-weight: 500;
}

.clear-footer-links a:hover {
    color: #e0faff;
}

.clear-footer-links .sep {
    color: #546e7a;
    margin: 0 10px;
    font-size: 0.75rem;
}

.clear-footer-copy {
    font-size: 0.7rem;
    color: #546e7a;
}

/* ============================================
   2 Column Layout for Title Screen (PC)
   ============================================ */
.layout-two-column {
    display: flex;
    flex-direction: row;
    width: 100%;
    height: 100%;
    padding-top: 110px;
    /* 広告(90px) + 安全余白(20px) */
    padding-bottom: 50px;
    /* footerの高さ */
    box-sizing: border-box;
    align-items: stretch;
    justify-content: center;
    max-width: 1200px;
    margin: 0 auto;
}

/* 左: メインパネルエリア */
.layout-left-panel {
    width: 400px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    position: relative;
    z-index: 10;
    margin-right: 20px;
}

/* 戻るボタンの調整（絶対配置をやめる） */
.layout-left-panel .skyline-back-row {
    position: static !important;
    margin-bottom: 20px;
    align-self: flex-start;
    margin-left: 20px;
}

/* 右: コンテンツエリア (ビル群 or SEOテキスト) */
.layout-right-content {
    flex: 1;
    position: relative;
    z-index: 5;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    overflow: hidden;
    /* 子要素の角丸などをはみ出させない */
}

/* TowerFill専用の別空間演出（アルミ枠線） */
.layout-right-content.is-towerfill {
    border: 10px solid #b0bec5;
    border-radius: 20px;
    background: rgba(255, 255, 255, 0.3);
    backdrop-filter: blur(5px);
    box-shadow: inset 0 0 20px rgba(0, 0, 0, 0.1), 0 10px 30px rgba(0, 0, 0, 0.05);
}

/* SEOコンテンツエリア（PC版専用：モバイル版との衝突回避） */
.seo-content-area-pc {
    flex: 1;
    overflow-y: auto;
    padding: 30px 40px;
    background: rgba(255, 255, 255, 0.85);
    /* 左パネルと馴染む白基調の透過 */
    border-radius: 20px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
    margin-bottom: 20px;
    /* 下部フッターとの適度な余白 */

    /* カスタムスクロールバー */
    scrollbar-width: thin;
    scrollbar-color: rgba(0, 188, 212, 0.5) transparent;
}

.seo-content-area-pc::-webkit-scrollbar {
    width: 6px;
}

.seo-content-area-pc::-webkit-scrollbar-track {
    background: transparent;
}

.seo-content-area-pc::-webkit-scrollbar-thumb {
    background-color: rgba(0, 188, 212, 0.5);
    border-radius: 10px;
}

/* SEO用テキストの装飾 */
.seo-content-area-pc h1 {
    color: #006064;
    font-size: 1.4rem;
    margin-top: 0;
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 2px solid rgba(0, 188, 212, 0.3);
}

.seo-content-area-pc h2 {
    color: #00838f;
    font-size: 1.1rem;
    margin-top: 25px;
    margin-bottom: 15px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.seo-content-area-pc p {
    font-size: 0.95rem;
    line-height: 1.6;
    color: #455a64;
    margin-bottom: 15px;
}

.seo-content-area-pc ul {
    padding-left: 20px;
    margin-bottom: 20px;
    color: #455a64;
    font-size: 0.95rem;
    line-height: 1.6;
}

.seo-content-area-pc li {
    margin-bottom: 8px;
}

/* モバイル時の縦積み対応 */
@media (max-width: 900px) {
    .layout-two-column {
        flex-direction: column;
        align-items: center;
        padding-top: 100px;
    }

    .layout-left-panel {
        width: 100%;
        margin-right: 0;
        margin-bottom: 20px;
    }

    .layout-left-panel .skyline-back-row {
        align-self: center;
        margin-left: 0;
    }

    .layout-right-content {
        width: 100%;
        flex: 0 1 auto;
        /* 縦積み時は高さを伸ばさない */
    }
}