/* ============================================
   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;
}