/* ============================================
   Mobile Skyline Visualizer
   m/towerfill/index.html のタイトルスクリーン用
   モックアップ(mobile_skyline_mockup.html)準拠
   ============================================ */

/* --- Title Screen (Skyline Container) --- */
#title-screen.skyline-active {
    display: flex;
    flex-direction: column;
    align-items: stretch; /* 共通の center を上書きし、子要素を横いっぱいに広げる */
    height: 100%;
    overflow: hidden;
    background: var(--bg-primary, #e0f7fa);
    padding-top: 50px;
    /* ad-banner の高さ分オフセット */
    justify-content: flex-start;
}

/* --- Skyline Header --- */
.skyline-header {
    height: 50px;
    background: rgba(224, 247, 250, 0.95);
    backdrop-filter: blur(10px);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 10px;
    border-bottom: 1px solid rgba(0, 188, 212, 0.2);
    flex-shrink: 0;
    z-index: 1500;
    position: relative;
    /* 子要素の絶対配置の基準 */
}

.skyline-header .header-left {
    display: flex;
    justify-content: flex-start;
    z-index: 5;
}

.skyline-header .header-back {
    font-size: 1rem;
    color: var(--green-dark, #00838f);
    font-weight: 900;
    cursor: pointer;
    background: none;
    border: none;
    padding: 0;
}

.skyline-header .header-title {
    font-family: var(--font-title, 'Orbitron', sans-serif);
    font-size: 0.95rem;
    font-weight: 900;
    letter-spacing: 1px;
    color: var(--green-dark, #00838f);
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    text-align: center;
    z-index: 1;
    pointer-events: none;
    /* 下の要素のタッチを妨げない */
}

.skyline-header .header-right {
    display: flex;
    align-items: center;
    gap: 4px;
    z-index: 5;
}

/* --- Ticket Group --- */
.sky-ticket-group {
    display: flex;
    align-items: stretch;
    background: transparent;
    border: none;
    border-bottom: 1.5px solid var(--green-neon, #00bcd4);
    border-radius: 0;
    overflow: hidden;
    height: 26px;
}

.sky-ticket-display {
    display: flex;
    align-items: center;
    padding: 0 8px;
    font-size: 0.65rem;
    color: var(--green-dark, #00838f);
    font-weight: 900;
}

.sky-ticket-val {
    color: var(--green-neon, #00bcd4);
    font-family: var(--font-title, 'Orbitron', sans-serif);
    margin-left: 2px;
}

.sky-ticket-add-btn {
    background: var(--green-neon, #00bcd4);
    color: #fff;
    border: none;
    padding: 0 8px;
    font-weight: 900;
    font-size: 0.7rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* --- Mode Tabs (Daily / Permanent) --- */
.sky-mode-tabs-row {
    padding: 10px 0 0; /* 左右パディングを 0 にして横幅いっぱいに接着 */
    flex-shrink: 0;
}

.sky-mode-tabs {
    display: flex;
    width: 100%;
    background: rgba(0, 131, 143, 0.05);
    border-radius: 0; /* 角丸を排除して画面端に密着 */
    padding: 3px;
    border-top: 1.5px solid rgba(0, 188, 212, 0.15);
    border-bottom: 1.5px solid rgba(0, 188, 212, 0.15);
    border-left: none;
    border-right: none;
}

.sky-mode-tab {
    flex: 1;
    padding: 8px;
    text-align: center;
    border-radius: 0; /* アクティブ切り替え時も完全に平坦な構成に */
    font-weight: 900;
    font-size: 0.75rem;
    cursor: pointer;
    transition: all 0.3s;
    color: var(--green-dark, #00838f);
    opacity: 0.6;
    background: none;
    border: none;
}

.sky-mode-tab.active {
    background: #fff;
    color: var(--green-dark, #00838f);
    opacity: 1;
}

/* --- Skyline Content Area (Sky + Building) --- */
.skyline-content {
    flex: 1;
    position: relative;
    width: 100%;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background: linear-gradient(180deg, #00acc1 0%, #e0f7fa 100%);
    transition: background 2s ease;
}

.sky-building-container {
    flex: 1;
    min-height: 0;
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding-bottom: 20px;
    margin-bottom: 160px;
    overflow-y: auto;
}

/* --- Ground Base --- */
/* 元の絶対配置の地面は非表示にし、building-display の疑似要素で描画する */
.sky-ground-base {
    display: none;
}

/* --- Building Display & Stack --- */
.sky-building-display {
    position: relative;
    z-index: 5;
    margin-top: auto;
    padding-bottom: 30px;
}

/* 地面をビルと一体で描画（スクロール時にビルと連動） */
.sky-building-display::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 220px;
    height: 60px;
    background: #4caf50;
    border-radius: 50%;
    z-index: -1;
    box-shadow: inset 0 0 20px rgba(0, 0, 0, 0.2), 0 10px 20px rgba(0, 0, 0, 0.2);
}

.sky-building-stack {
    display: flex;
    flex-direction: column-reverse;
    align-items: center;
    position: relative;
    z-index: 5;
    --s: 60%;
}

/* Difficulty color variables */
.sky-building-display.diff-easy {
    --h: 140;
}

.sky-building-display.diff-normal {
    --h: 30;
    --s: 90%;
}

.sky-building-display.diff-hard {
    --h: 0;
}

/* --- 3D Floor Blocks --- */
.sky-floor-block {
    position: relative;
    width: 90px;
    height: 76px;
    margin-bottom: -46px;
    filter: drop-shadow(0 6px 12px rgba(0, 0, 0, 0.2));
    animation: skyFloorIn 0.5s cubic-bezier(0.4, 0, 0.2, 1) forwards;
    opacity: 0;
}

@keyframes skyFloorIn {
    from {
        transform: translateY(-30px);
        opacity: 0;
    }

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

.sky-floor-block .face {
    position: absolute;
}

.sky-floor-block .face-top {
    width: 90px;
    height: 45px;
    background: hsl(var(--h), var(--s, 60%), 65%);
    clip-path: polygon(50% 0%, 100% 50%, 50% 100%, 0% 50%);
    top: 0;
    left: 0;
    z-index: 3;
}

.sky-floor-block .face-left {
    width: 45px;
    height: 55px;
    background: hsl(var(--h), var(--s, 60%), 50%);
    clip-path: polygon(0% 0%, 100% 22px, 100% 55px, 0% 33px);
    top: 22px;
    left: 0;
    z-index: 2;
}

.sky-floor-block .face-right {
    width: 45px;
    height: 55px;
    background: hsl(var(--h), var(--s, 60%), 35%);
    clip-path: polygon(0% 22px, 100% 0%, 100% 33px, 0% 55px);
    top: 22px;
    left: 45px;
    z-index: 1;
}

/* --- Info Panel (Bottom Sheet) --- */
.sky-info-panel {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    background: #ffffff;
    border-top: 1px solid rgba(0, 188, 212, 0.2);
    border-top-left-radius: 20px;
    border-top-right-radius: 20px;
    padding: 12px 10px 24px;
    box-shadow: 0 -10px 40px rgba(0, 0, 0, 0.1);
    display: flex;
    flex-direction: column;
    gap: 12px;
    z-index: 100;
}

/* Info Main Row */
.sky-info-main-row {
    display: flex;
    align-items: center;
    width: 100%;
}

/* Navigation Buttons */
.sky-nav-btn {
    position: absolute;
    top: 40%;
    transform: translateY(-50%);
    width: 44px;
    height: 44px;
    background: rgba(255, 255, 255, 0.45);
    backdrop-filter: blur(8px);
    border: 1.5px solid rgba(255, 255, 255, 0.6);
    border-radius: 50%;
    font-size: 1.1rem;
    font-weight: 900;
    cursor: pointer;
    color: var(--green-dark, #00838f);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 200;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.15);
    transition: all 0.2s ease;
    user-select: none;
}

.sky-nav-btn:active {
    transform: translateY(-50%) scale(0.9);
    background: rgba(255, 255, 255, 0.7);
}

#sky-prev-diff {
    left: 20px;
}

#sky-next-diff {
    right: 20px;
}

/* Difficulty Area */
.sky-diff-area {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: flex-start;
}

.sky-diff-text {
    font-family: var(--font-title, 'Orbitron', sans-serif);
    font-size: 26px;
    font-weight: 900;
    white-space: nowrap;
}

/* Floor Area */
.sky-floor-area {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
}

.sky-floor-text {
    font-family: var(--font-title, 'Orbitron', sans-serif);
    font-size: 26px;
    font-weight: 900;
    color: #334155;
    white-space: nowrap;
}

/* Repair Area */
.sky-repair-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 2px;
}

.sky-damage-text {
    font-size: 0.65rem;
    font-weight: 900;
    transition: color 0.3s;
    margin-right: 4px;
}

.sky-btn-repair {
    background: #f1f3f4;
    border: none;
    border-radius: 4px;
    font-weight: 900;
    color: #90a4ae;
    font-size: 0.6rem;
    padding: 5px 0;
    width: 76px;
    text-align: center;
    transition: all 0.3s;
    cursor: not-allowed;
}

.sky-btn-repair.active {
    background: var(--green-neon, #00bcd4);
    color: #fff;
    box-shadow: 0 2px 8px rgba(0, 188, 212, 0.3);
    cursor: pointer;
}

/* Main Action Button */
.sky-btn-play {
    width: 100%;
    background: var(--green-neon, #00bcd4);
    border: none;
    border-radius: 12px;
    font-weight: 900;
    color: #fff;
    font-size: 0.95rem;
    padding: 14px;
    font-family: var(--font-title, 'Orbitron', sans-serif);
    box-shadow: 0 6px 15px rgba(0, 188, 212, 0.2);
    text-align: center;
    transition: all 0.3s;
    cursor: pointer;
}

.sky-btn-play.mode-permanent {
    background: #4caf50;
    box-shadow: 0 6px 15px rgba(76, 175, 80, 0.2);
}

/* --- Repair Modal --- */
.sky-repair-modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 9000;
    align-items: center;
    justify-content: center;
}

.sky-repair-modal-overlay.active {
    display: flex;
}

.sky-repair-modal {
    background: #fff;
    border-radius: 16px;
    padding: 24px;
    width: 85%;
    max-width: 320px;
    text-align: center;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
}

.sky-repair-modal h3 {
    font-family: var(--font-title, 'Orbitron', sans-serif);
    color: var(--green-dark, #00838f);
    margin-bottom: 12px;
    font-size: 1rem;
}

.sky-repair-modal p {
    font-size: 0.85rem;
    color: #555;
    line-height: 1.6;
    margin-bottom: 16px;
}

.sky-repair-modal .highlight {
    color: var(--green-neon, #00bcd4);
    font-weight: 900;
}

.sky-repair-modal-btns {
    display: flex;
    gap: 8px;
}

.sky-repair-modal-btns button {
    flex: 1;
    padding: 10px;
    border-radius: 8px;
    font-weight: 900;
    font-size: 0.85rem;
    border: none;
    cursor: pointer;
    transition: all 0.2s;
}

.sky-repair-modal-btns .btn-confirm {
    background: var(--green-neon, #00bcd4);
    color: #fff;
}

.sky-repair-modal-btns .btn-cancel {
    background: #f1f3f4;
    color: #666;
}