/* モバイル体験の向上 */

/* タップ領域の最小サイズ確保 */
@media (max-width: 768px) {
    button, 
    a.btn, 
    input[type="checkbox"],
    input[type="radio"] {
        min-height: 44px;
        min-width: 44px;
    }
    
    /* チェックボックスのタップ領域拡大 */
    input[type="checkbox"],
    input[type="radio"] {
        transform: scale(1.5);
        margin: 8px;
    }
    
    /* フォーム入力のしやすさ向上 */
    input[type="text"],
    input[type="email"],
    select,
    textarea {
        font-size: 16px !important; /* iOSでズームを防ぐ */
        padding: 12px !important;
    }
    
    /* ベータ枠バナーのモバイル最適化 */
    .beta-badge {
        font-size: 0.75rem;
        padding: 0.25rem 0.75rem;
    }
    
    /* 価格表示のモバイル最適化 */
    .price-old {
        font-size: 0.875rem;
    }
    
    /* CTAボタンのモバイル最適化 */
    .cta-button {
        width: 100%;
        padding: 16px !important;
        font-size: 16px !important;
    }
}

/* タブレット向け調整 */
@media (min-width: 768px) and (max-width: 1024px) {
    .container {
        padding-left: 2rem;
        padding-right: 2rem;
    }
}

/* 高解像度ディスプレイ対応 */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
    img {
        image-rendering: -webkit-optimize-contrast;
        image-rendering: crisp-edges;
    }
}

/* スムーススクロール */
html {
    scroll-behavior: smooth;
}

/* フォーカス時のアクセシビリティ */
*:focus-visible {
    outline: 3px solid #E85C88;
    outline-offset: 2px;
}

/* モバイルでのホバー効果を無効化（タップ時の遅延を防ぐ） */
@media (hover: none) {
    button:hover,
    a:hover {
        transform: none;
    }
}

/* 安全領域対応（ノッチ付きデバイス） */
@supports (padding: max(0px)) {
    body {
        padding-left: max(0px, env(safe-area-inset-left));
        padding-right: max(0px, env(safe-area-inset-right));
        padding-bottom: max(0px, env(safe-area-inset-bottom));
    }
}


/* Mobile estimate: one compact bar, details open only on request. */
.mobile-estimate-amount { display: none; }
.campaign-conditions summary { cursor: pointer; font-weight: 700; color: #666; }
.campaign-conditions p { margin-top: 10px; line-height: 1.85; }
@media (max-width: 1023px) {
    #stickyBetaBanner { display: none !important; }
    #customize { padding-bottom: 110px; }
    #customize #priceCalculator.mobile-ready {
        display: none;
        position: fixed !important;
        inset: auto 0 0;
        z-index: 110;
        margin: 0;
        padding: 0 !important;
        max-height: none;
        overflow: visible;
        transform: none !important;
        background: #fff;
        border: 1px solid #f6a7c1;
        border-bottom: 0;
        border-radius: 18px 18px 0 0;
        box-shadow: 0 -4px 20px rgb(34 34 34 / 10%);
    }
    #customize #priceCalculator.mobile-ready.mobile-visible { display: block; }
    #priceCalculator::before { display: none; }
    #priceCalculatorToggle {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 12px;
        width: 100%;
        margin: 0;
        padding: 14px 20px calc(14px + env(safe-area-inset-bottom));
        text-align: left;
        min-height: 72px;
    }
    #priceCalculatorToggle > span:first-child { font-size: 13px; font-weight: 700; }
    .mobile-estimate-amount { display: block; margin-top: 2px; font-size: 22px; font-weight: 900; }
    .mobile-estimate-amount small { font-size: 11px; font-weight: 400; }
    #mobileEstimateHint { font-size: 13px; white-space: nowrap; }
    #priceCalculator.mobile-ready #priceCalculatorBody { display: none; }
    #priceCalculator.mobile-ready.expanded #priceCalculatorBody {
        display: block;
        max-height: min(56vh, 440px);
        max-height: min(56dvh, 440px);
        padding: 4px 20px calc(20px + env(safe-area-inset-bottom));
        overflow-y: auto;
        overscroll-behavior: contain;
    }
    #selectedItems { max-height: none; }
    #selectedItems > div { gap: 12px; align-items: flex-start; }
    #selectedItems > div > span:last-child { white-space: nowrap; }
    body.mobile-estimate-visible #backToTop { display: none !important; }
    #beta-offer > div { padding: 22px 20px; }
    #betaOfferActive > div { align-items: stretch; }
    #betaOfferActive .text-left > p.font-bold { font-size: 20px; line-height: 1.55; }
    #betaOfferActive button { width: 100%; padding: 14px 16px; font-size: 16px; }
    .campaign-conditions { margin-top: 12px; font-size: 13px; }
    #customize label { line-height: 1.6; }
    #customize label p { font-size: 12px; line-height: 1.7; }
    #customize input[type="checkbox"] {
        min-width: 20px; min-height: 20px; width: 20px; height: 20px;
        transform: none; margin: 0 12px 0 0; flex-shrink: 0;
    }
    #customize h3 { font-size: 20px; }
    #customize .lg\:col-span-2 > .p-8 { padding: 20px; }
    #customize .checkbox-item {
        display: flex; flex-direction: column; align-items: stretch;
        gap: 8px; padding: 14px;
    }
    #customize .checkbox-item > div:first-child { align-items: flex-start; width: 100%; }
    #customize .checkbox-item > div:first-child > div { min-width: 0; flex: 1; }
    #customize .checkbox-item input { margin-top: 4px; }
    #customize .checkbox-item p.font-bold { display: block; font-size: 14px; line-height: 1.7; }
    #customize .checkbox-item p.font-bold button { display: inline-flex; vertical-align: middle; align-items: center; justify-content: center; }
    #customize .checkbox-item > span,
    #customize .checkbox-item > div:last-child:not(:first-child) { align-self: flex-end; text-align: right; }
    #customize .checkbox-item > span { font-size: 18px; white-space: nowrap; }
}
@media (max-width: 480px) {
    .vtuber-hero h1 { font-size: 28px !important; line-height: 1.45; }
    .vtuber-hero > .container > p { font-size: 15px !important; line-height: 1.85; }
}
@media (prefers-reduced-motion: reduce) {
    #priceCalculator { transition: none; }
}

/* Keep campaign copy inside a rectangular mobile card. */
@media (max-width: 1023px) {
    #betaPlansBanner,
    #betaPlansEnded {
        box-sizing: border-box;
        max-width: 100%;
        border-radius: 18px;
        padding: 18px 20px;
        line-height: 1.7;
        white-space: normal;
        overflow-wrap: anywhere;
    }
    #betaPlansBanner > span,
    #betaPlansEnded > span { max-width: 100%; }
    #betaPlansEnded { flex-direction: column; }
    #backToTop {
        right: 12px; bottom: 16px;
        width: 44px; height: 44px;
        min-width: 44px; min-height: 44px;
        padding: 0; font-size: 0;
        display: flex; align-items: center; justify-content: center;
    }
    #backToTop.hidden { display: none; }
    #backToTop::after { content: '↑'; font-size: 20px; }
}
